whycxzp
2022-08-10 d8ca9ccd14fe70e83bd586468cbc3db569f91de2
更新散装件审批
1个文件已添加
4个文件已修改
67 ■■■■■ 已修改文件
src/main/java/com/whyc/config/EnumWorksheetType.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/WorksheetLinkController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/WorksheetMain.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorksheetLinkService.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorksheetMainService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/config/EnumWorksheetType.java
New file
@@ -0,0 +1,31 @@
package com.whyc.config;
public enum EnumWorksheetType {
    ProductBom(1,"产品Bom"),
    Component(2,"散装件"),
    ComponentProduct(3,"散装件-产品");
    EnumWorksheetType(Integer type, String typeName) {
        this.type = type;
        this.typeName = typeName;
    }
    private Integer type;
    private String typeName;
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
}
src/main/java/com/whyc/controller/WorksheetLinkController.java
@@ -35,8 +35,8 @@
    @PostMapping("approve")
    @ApiOperation(value = "总经理审批",notes = "传参:int id,int linkStatus,String dealReason,int mainId,int rejectVersion;" +
            "linkStatus:1通过,2驳回,驳回到员工,通知经理;dealReason:审核意见")
    public Response approve(@RequestBody WorksheetLink link,Integer componentProductFlag){
        service.approve(link,componentProductFlag);
    public Response approve(@RequestBody WorksheetLink link){
        service.approve(link);
        return new Response().setII(1,"审批完成");
    }
src/main/java/com/whyc/pojo/WorksheetMain.java
@@ -2,8 +2,10 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.whyc.config.EnumWorksheetType;
import io.swagger.annotations.ApiModelProperty;
import org.apache.ibatis.type.Alias;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.LinkedList;
@@ -37,6 +39,12 @@
    private Integer status;
    @ApiModelProperty("工单结束意见")
    private String endReason;
    /**
     * {@link EnumWorksheetType#getType()}
     */
    @ApiModelProperty("工单类型:1-bom,2-散装件,3-bom-散装件")
    private Integer type;
    @ApiModelProperty("流程的下个处理人")
    @TableField(exist = false)
@@ -186,4 +194,12 @@
    public void setApprovingUser(DocUser approvingUser) {
        this.approvingUser = approvingUser;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
}
src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.whyc.config.EnumWorksheetType;
import com.whyc.mapper.ProductBomApprovingMapper;
import com.whyc.mapper.WorksheetLinkMapper;
import com.whyc.pojo.*;
@@ -83,7 +84,9 @@
    }
    @Transactional
    public void approve(WorksheetLink link, Integer componentProductFlag) {
    public void approve(WorksheetLink link) {
        //根据节点,查询主表类型
        Integer type = mainService.getInfoById(link.getMainId()).getType();
        link.setDealTime(new Date());
        //更新节点信息
        linkMapper.updateById(link);
@@ -110,7 +113,7 @@
        }else {
            //审批通过,更新主表状态
            mainService.updateEndStatusById(link.getMainId(), "完结", 5);
            if (componentProductFlag == null) { //产品审批
            if (type.intValue() == EnumWorksheetType.ProductBom.getType()) { //产品审批
                //将产品文件复制至正式路径
                QueryWrapper<ProductBomApproving> query = Wrappers.query();
                query.eq("main_id", link.getMainId());
@@ -232,7 +235,11 @@
                });
                //更新正式bom的对应url
                bomService.updateUrl(fileBomApprovingList);
            }else{ //更新散装件-产品关系
            }
            else if(type.intValue() == EnumWorksheetType.Component.getType()){ //散装件 TODO
            }
            else if(type.intValue() == EnumWorksheetType.ComponentProduct.getType()){ //更新散装件-产品关系
                //查找到对应的散装件-产品关系数据
                List<ComponentProductApproving> cpAList = cpAService.getListByMainId(link.getMainId());
                //查询部件最新的版本号
src/main/java/com/whyc/service/WorksheetMainService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.config.EnumWorksheetType;
import com.whyc.dto.Response;
import com.whyc.dto.WorksheetMainDTO;
import com.whyc.mapper.DocUserMapper;
@@ -44,6 +45,7 @@
    @Transactional
    public boolean submit(WorksheetMain main, DocUser user) {
        main.setType(1);
        List<ProductBomApproving> bomList = main.getApprovingBomList();
        int rejectVersion=-1;
        //提交主表
@@ -131,6 +133,7 @@
        List<ComponentProductApproving> replacedList = mainDTO.getReplacedList();
        List<ComponentProductApproving> removedList = mainDTO.getRemovedList();
        main.setType(EnumWorksheetType.ComponentProduct.getType());
        //提交主表
        main.setCreateUserId(user.getId());
        //提交人角色来判断工作流层级