longyvfengyun
2022-07-28 a96cf9b83c7f65ab0820403d29602f173fe60a99
src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -50,6 +50,7 @@
            link2.setDealDesc("工单被经理驳回,驳回信息:"+link.getDealReason());
            link2.setLinkStatus(0);
            link2.setEnableArchive(0);
            link2.setRejectVersion(link.getRejectVersion());
            linkMapper.insert(link2);
            //更新主表状态
            mainService.updateStatusById(link.getMainId(),0);
@@ -63,6 +64,7 @@
            link2.setDealDesc("工单被经理审核通过,信息:"+link.getDealReason());
            link2.setLinkStatus(0);
            link2.setEnableArchive(1);
            link2.setRejectVersion(link.getRejectVersion());
            linkMapper.insert(link2);
            //更新主表状态
            mainService.updateStatusById(link.getMainId(),2);
@@ -76,19 +78,20 @@
        linkMapper.updateById(link);
        if(link.getLinkStatus() == 2){ //驳回
            //驳回到员工进行处理
            //查询工单的员工
            Long createUserId = mainService.getInfoById(link.getMainId()).getCreateUserId();
            //查询对应的项目经理
            Long createUserId = linkMapper.selectById(link.getParentId()).getDealUserId();
            WorksheetLink link2 = new WorksheetLink();
            link2.setMainId(link.getMainId());
            link2.setParentId(link.getId());
            link2.setDealUserId(createUserId);
            link2.setDealType(0);
            link2.setDealDesc("工单被经理驳回,驳回信息:"+link.getDealReason());
            link2.setDealDesc("工单被总经理驳回,驳回信息:"+link.getDealReason());
            link2.setLinkStatus(0);
            link2.setEnableArchive(0);
            link2.setRejectVersion(link.getRejectVersion());
            linkMapper.insert(link2);
            //更新主表状态
            mainService.updateStatusById(link.getMainId(),0);
            mainService.updateStatusById(link.getMainId(),1);
        }else{
            //审批通过,更新主表状态
            mainService.updateEndStatusById(link.getMainId(),"完结",5);
@@ -102,9 +105,10 @@
            //删除? TODO 需要约定逻辑
            //查询部件最新的版本号
            Integer currentVersion = bomService.getProduct(approvingList.get(0).getParentModel()).getVersion();
            if(currentVersion==null){
                currentVersion = 0;
            ProductBom product = bomService.getProduct(approvingList.get(0).getParentModel());
            int currentVersion = -1;
            if(product!=null){
                currentVersion = product.getVersion();
            }
            Integer nextVersion = currentVersion+1;
            //更新到product_bom_history,增加进去的需要sVersion和eVersion一致
@@ -143,7 +147,6 @@
                his.setThickness(approvingBom.getThickness());
                his.setType(approvingBom.getType());
                his.setUnit(approvingBom.getUnit());
                his.setUpdateDate(approvingBom.getUpdateDate());
                his.setUpUser(approvingBom.getUpUser());
                newHistoryList.add(his);
@@ -158,8 +161,9 @@
                    .filter(currentHistory -> !approvingUpdateSubNameList.contains(currentHistory.getSubName()))
                    .collect(Collectors.toList());
            newVersionCurrentHistoryList.forEach(history->{history.setEVersion(nextVersion);});
            historyService.updateVersionBatch(newVersionCurrentHistoryList);
            if(newVersionCurrentHistoryList.size()!=0) {
                historyService.updateVersionBatch(newVersionCurrentHistoryList);
            }
            /*更新到product_bom*/
            //查询新的版本
            List<ProductBomHistory> newBomList = historyService.getListByParentModel(approvingList.get(0).getParentModel(), nextVersion);
@@ -169,7 +173,7 @@
            FileUtil.copyDir()*/
            //将产品bom表的url修正,更新到正式表
            //将产品bom表的url修正,更新到正式表 TODO
        }
    }