src/main/java/com/whyc/controller/WorksheetMainController.java
@@ -14,10 +14,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.validation.Valid; import java.io.IOException; import java.util.List; import java.util.Map; @RestController src/main/java/com/whyc/mapper/ProductApprovingMapper.java
New file @@ -0,0 +1,6 @@ package com.whyc.mapper; import com.whyc.pojo.ProductApproving; public interface ProductApprovingMapper extends CustomMapper<ProductApproving> { } src/main/java/com/whyc/pojo/ProductApproving.java
New file @@ -0,0 +1,126 @@ package com.whyc.pojo; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModelProperty; import org.apache.ibatis.type.Alias; import java.util.Date; import java.util.List; /** * * 产品审批 */ @Alias("ProductApproving") @TableName(schema = "db_doc",value = "tb_product_approving") public class ProductApproving { @TableId(value = "id", type = IdType.AUTO) private Integer id; private Integer mainId; private String parentCode; private String parentName; private String parentModel; @ApiModelProperty(value = "备注") private String notes; @ApiModelProperty("定制表单号") private String customCode; private Date createTime; @ApiModelProperty("文件夹路径,绝对路径") private String fileUrl; @TableField(exist = false) private List<ProductBomApproving> bomApprovingList; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getMainId() { return mainId; } public void setMainId(Integer mainId) { this.mainId = mainId; } public String getParentCode() { return parentCode; } public void setParentCode(String parentCode) { this.parentCode = parentCode; } public String getParentName() { return parentName; } public void setParentName(String parentName) { this.parentName = parentName; } public String getParentModel() { return parentModel; } public void setParentModel(String parentModel) { this.parentModel = parentModel; } public String getNotes() { return notes; } public void setNotes(String notes) { this.notes = notes; } public String getCustomCode() { return customCode; } public void setCustomCode(String customCode) { this.customCode = customCode; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public List<ProductBomApproving> getBomApprovingList() { return bomApprovingList; } public void setBomApprovingList(List<ProductBomApproving> bomApprovingList) { this.bomApprovingList = bomApprovingList; } public String getFileUrl() { return fileUrl; } public void setFileUrl(String fileUrl) { this.fileUrl = fileUrl; } } src/main/java/com/whyc/pojo/ProductBomApproving.java
@@ -16,10 +16,8 @@ public class ProductBomApproving { private Integer id; @ApiModelProperty("审批主表id") private Integer mainId; @ApiModelProperty("产品id") private Integer productId; @ApiModelProperty("产品审批id") private Integer productApprovingId; @ApiModelProperty("母料编号") private String parentCode; @ApiModelProperty("母料名称") @@ -67,7 +65,7 @@ @TableField(exist = false) private String excelName; @ApiModelProperty("散装件数组") @ApiModelProperty("物料列表") @TableField(exist = false) private List<Material> materialList; @@ -77,14 +75,6 @@ public void setId(Integer id) { this.id = id; } public Integer getMainId() { return mainId; } public void setMainId(Integer mainId) { this.mainId = mainId; } public String getParentCode() { @@ -271,12 +261,12 @@ this.excelName = excelName; } public Integer getProductId() { return productId; public Integer getProductApprovingId() { return productApprovingId; } public void setProductId(Integer productId) { this.productId = productId; public void setProductApprovingId(Integer productApprovingId) { this.productApprovingId = productApprovingId; } public List<Material> getMaterialList() { src/main/java/com/whyc/pojo/WorksheetLink.java
@@ -5,7 +5,6 @@ import org.apache.ibatis.type.Alias; import java.util.Date; import java.util.List; @TableName(schema = "db_doc",value = "tb_worksheet_link") @Alias("WorksheetLink") @@ -45,8 +44,6 @@ private Date createTime; /**节点处理时间*/ private Date dealTime; /**驳回版本*/ private Integer rejectVersion; /**流程的下个处理人*/ @TableField(exist = false) @@ -176,14 +173,6 @@ public void setMain(WorksheetMain main) { this.main = main; } public Integer getRejectVersion() { return rejectVersion; } public void setRejectVersion(Integer rejectVersion) { this.rejectVersion = rejectVersion; } } src/main/java/com/whyc/pojo/WorksheetMain.java
@@ -1,12 +1,10 @@ package com.whyc.pojo; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; 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; @@ -58,9 +56,9 @@ @TableField(exist = false) private DocUser createUser; @ApiModelProperty("待审批产品bom") @ApiModelProperty("待审批产品") @TableField(exist = false) private List<ProductBomApproving> approvingBomList; private ProductApproving productApproving; @TableField(exist = false) private LinkedList<WorksheetLink> links; @@ -187,12 +185,12 @@ this.links = links; } public List<ProductBomApproving> getApprovingBomList() { return approvingBomList; public ProductApproving getProductApproving() { return productApproving; } public void setApprovingBomList(List<ProductBomApproving> approvingBomList) { this.approvingBomList = approvingBomList; public void setProductApproving(ProductApproving productApproving) { this.productApproving = productApproving; } public DocUser getApprovingUser() { src/main/java/com/whyc/service/ProductApprovingService.java
New file @@ -0,0 +1,26 @@ package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.whyc.mapper.ProductApprovingMapper; import com.whyc.pojo.ProductApproving; import org.springframework.stereotype.Service; import javax.annotation.Resource; @Service public class ProductApprovingService { @Resource private ProductApprovingMapper mapper; public void insert(ProductApproving productApproving) { mapper.insert(productApproving); } public ProductApproving getByMainId(Integer mainId) { QueryWrapper<ProductApproving> query = Wrappers.query(); query.eq("main_id",mainId).last(" limit 1"); return mapper.selectOne(query); } } src/main/java/com/whyc/service/ProductBomApprovingService.java
@@ -7,20 +7,15 @@ import com.whyc.mapper.ProductBomApprovingMapper; import com.whyc.pojo.DocUser; import com.whyc.pojo.ProductBomApproving; import com.whyc.pojo.WorksheetMain; import com.whyc.util.*; import io.swagger.models.auth.In; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.xml.crypto.Data; import java.io.*; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -143,8 +138,8 @@ List<FileUrlDTO> dwgExistsList = getDwgList(fileList); for (int i = 0; i < fileList.size(); i++) { String fileTempUrl = fileList.get(i); //查询到需上传的bom数据 if(fileTempUrl.contains(".xls") && fileTempUrl.contains("(BOM)-erp")){ //查询需上传的bom数据 if(fileTempUrl.contains(".xls") && fileTempUrl.contains("(BOM)")){ Workbook workbook = null; InputStream inputStream = new FileInputStream(new File(fileTempUrl)); workbook = WorkbookFactory.create(inputStream); @@ -226,7 +221,7 @@ bomList.add(bomApproving); } } //这个是子表数据,用做对比校验 /*//这个是子表数据,用做对比校验 else if(fileTempUrl.contains(".xls")){ File fileTemp = new File(fileTempUrl); Workbook workbook = null; @@ -326,7 +321,7 @@ } list.add(bomApproving); } } }*/ } /*String parentModel = list.get(0).getParentModel(); for (int i = 0; i < list.size(); i++) { @@ -337,7 +332,7 @@ //通过包名,查询工单流程审批标题 //String nextTitle = mainService.getNextTitle(originalFilename); //子表,逐条对比bom表,子料编码/子料型号/子料数量 /*//子表,逐条对比bom表,子料编码/子料型号/子料数量 for (ProductBomApproving sub:list){ String subCode = sub.getSubCode(); String subModel = sub.getSubModel(); @@ -361,8 +356,8 @@ if(!exists){ return response.set(1,false,excelName+"中货品编码:"+subCode+"在bom表中不存在"); } } //处理名称重复的子件 }*/ /*//处理名称重复的子件 List<ProductBomApproving> newBomList = new LinkedList<>(); Map<String, List<ProductBomApproving>> subNameMap = bomList.stream().collect(Collectors.groupingBy(ProductBomApproving::getSubName)); subNameMap.forEach((subName,approvingList)->{ @@ -375,10 +370,10 @@ }else{ newBomList.addAll(approvingList); } }); List<ProductBomApproving> collect = newBomList.stream().sorted(Comparator.comparing(ProductBomApproving::getId)).collect(Collectors.toList()); });*/ List<ProductBomApproving> collect = bomList.stream().sorted(Comparator.comparing(ProductBomApproving::getId)).collect(Collectors.toList()); String nextTitle = originalFilename.substring(0,originalFilename.lastIndexOf(".")); return response.setIII(1,true,collect,nextTitle,"解析完成"); return response.setIII(1,true,collect,nextTitle,filePath); } private List<FileUrlDTO> getDwgList(List<String> fileList) { @@ -411,16 +406,9 @@ return new Response().set(1,"doc_file"+dwgSubFileDirPath+File.separator+pdfFileName); } public int getRejectVersion(Integer mainId) { public List<ProductBomApproving> getList(Integer productApprovingId) { QueryWrapper<ProductBomApproving> query = Wrappers.query(); query.select("reject_version").eq("main_id",mainId).orderByDesc("id").last(" limit 1"); ProductBomApproving bomApproving = mapper.selectOne(query); if(bomApproving==null){ return -1; }else{ //lxw注释 //return bomApproving.getRejectVersion(); return 0; } query.eq("product_approving_id",productApprovingId); return mapper.selectList(query); } } src/main/java/com/whyc/service/ProductBomService.java
@@ -422,4 +422,14 @@ bom.setCreateDate(m.getCreateDate()); return bom; } public void insertBatch(List<ProductBom> productBomList) { mapper.insertBatchSomeColumn(productBomList); } public List<ProductBom> getBomByProductId(Integer productId) { QueryWrapper<ProductBom> query = Wrappers.query(); query.eq("product_id",productId); return mapper.selectList(query); } } src/main/java/com/whyc/service/ProductHistoryService.java
@@ -1,6 +1,8 @@ package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.whyc.dto.Response; import com.whyc.mapper.ProductHistoryMapper; import com.whyc.pojo.ProductHistory; @@ -23,4 +25,14 @@ List<ProductHistory> list=mapper.selectList(wrapper); return new Response().setII(1,list.size()>0?true:false,list,"返回产品版信息"); } /**新增追加的版本并将原先的版本的启用设置为未启用*/ public void insertAndUpdateEnabled(ProductHistory productHistory) { UpdateWrapper<ProductHistory> update = Wrappers.update(); update.set("enabled",0).eq("parent_code",productHistory.getParentCode()) .eq("custom_code",productHistory.getCustomCode()).eq("enabled",1); mapper.update(null,update); mapper.insert(productHistory); } } src/main/java/com/whyc/service/ProductService.java
@@ -1,10 +1,13 @@ package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.dto.Response; import com.whyc.mapper.ProductMapper; import com.whyc.pojo.Product; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -37,4 +40,19 @@ return new Response().setII(1,list.size()>0?true:false,pageInfo,"返回产品信息"); } public Product getVersion(String parentCode, String customCode) { QueryWrapper<Product> query = Wrappers.query(); query.eq("parent_code",parentCode).eq("custom_code",customCode).last(" limit 1"); return mapper.selectOne(query); } public int updateVersion(String parentCode, String customCode, Integer nextVersion) { UpdateWrapper<Product> update = Wrappers.update(); update.set("version",nextVersion).eq("parent_code",parentCode).eq("custom_code",customCode); mapper.update(null,update); QueryWrapper<Product> query = Wrappers.query(); query.select("id").eq("parent_code",parentCode).eq("custom_code",customCode); return mapper.selectOne(query).getId(); } } src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -6,15 +6,11 @@ import com.whyc.mapper.ProductBomApprovingMapper; import com.whyc.mapper.WorksheetLinkMapper; import com.whyc.pojo.*; import com.whyc.util.CommonUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.FileCopyUtils; import javax.annotation.Resource; import java.io.File; import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -34,7 +30,16 @@ private ProductBomService bomService; @Autowired private ProductApprovingService paService; @Autowired private ProductService productService; @Autowired private ProductBomHistoryService historyService; @Autowired private ProductBomApprovingService pbaService; @Autowired private MaterialProductHistoryService cphService; @@ -53,6 +58,9 @@ @Autowired private ProductSoftwareService productSoftwareService; @Autowired private ProductHistoryService phService; @Transactional public void audit(WorksheetLink link) { @@ -88,7 +96,6 @@ link2.setDealDesc("工单被经理审核通过,信息:"+link.getDealReason()); link2.setLinkStatus(0); link2.setEnableArchive(1); link2.setRejectVersion(link.getRejectVersion()); linkMapper.insert(link2); //更新主表状态 mainService.updateStatusById(link.getMainId(),2); @@ -114,7 +121,6 @@ link2.setDealDesc("工单被总经理驳回,驳回信息:" + link.getDealReason()); link2.setLinkStatus(0); link2.setEnableArchive(0); link2.setRejectVersion(link.getRejectVersion()); linkMapper.insert(link2); //更新主表状态 mainService.updateStatusById(link.getMainId(), 1); @@ -126,95 +132,89 @@ //审批通过,更新主表状态 mainService.updateEndStatusById(link.getMainId(), "完结", 5); if (type.intValue() == EnumWorksheetType.ProductBom.getType()) { //产品审批 //将产品文件复制至正式路径 QueryWrapper<ProductBomApproving> query = Wrappers.query(); query.eq("main_id", link.getMainId()); List<ProductBomApproving> approvingList = approvingMapper.selectList(query); //增加->增加部件(增加记录,同时所有eVersion+1) //修改->修改部件图纸,修改部件非图纸(增加记录,同时修改非原部件的所有eVersion+1) //删除? TODO 需要约定逻辑 //查询部件最新的版本号 ProductBom product = bomService.getProduct(approvingList.get(0).getParentModel()); int currentVersion = -1; //将产品文件复制至正式路径 TODO ProductApproving productApproving = paService.getByMainId(link.getMainId()); //查询产品最新的版本号 String parentCode = productApproving.getParentCode(); String customCode = productApproving.getCustomCode(); Product product = productService.getVersion(parentCode, customCode); int currentVersion = 0; if (product != null) { currentVersion = product.getVersion(); } Integer nextVersion = currentVersion + 1; //更新到product_bom_history,增加进去的需要sVersion和eVersion一致 //增加所有部件,排查出相关的原部件,非也是更新 List<ProductBomHistory> currentHistoryList = historyService.getListByParentModel(approvingList.get(0).getParentModel(), currentVersion); List<String> currentSubNameList = currentHistoryList.stream().map(ProductBomHistory::getSubName).collect(Collectors.toList()); //转移审批表数据到历史表/最新版本表 product_history/product_bom_history/product/product_bom List<ProductBomApproving> approvingList = pbaService.getList(productApproving.getId()); ProductHistory productHistory = new ProductHistory(); productHistory.setParentCode(parentCode); productHistory.setParentName(productApproving.getParentName()); productApproving.setParentModel(productApproving.getParentModel()); productHistory.setNotes(productApproving.getNotes()); productHistory.setCustomCode(customCode); productHistory.setCreateTime(new Date()); productHistory.setVersion(nextVersion); productHistory.setEnabled(1); List<ProductBomHistory> newHistoryList = new LinkedList<>(); approvingList.forEach(approvingBom -> { if (currentSubNameList.contains(approvingBom.getSubName())) { approvingBom.setVersion(1); } else { approvingBom.setVersion(0); } //转化为productBomHistory ProductBomHistory his = new ProductBomHistory(); his.setCategory(approvingBom.getCategory()); his.setCreateDate(approvingBom.getCreateDate()); his.setDwgUrl(approvingBom.getDwgUrl()); //lxw注释 //his.setEVersion(nextVersion); his.setFileUrl(approvingBom.getFileUrl()); his.setMaterial(approvingBom.getMaterial()); his.setNotes(approvingBom.getNotes()); //his.setParentCode(approvingBom.getParentCode()); //his.setParentModel(approvingBom.getParentModel()); //his.setParentName(approvingBom.getParentName()); //his.setParentVersion(approvingBom.getParentVersion()); his.setPictureUrl(approvingBom.getPictureUrl()); his.setProducer(approvingBom.getProducer()); his.setQuantity(approvingBom.getQuantity()); his.setSubCode(approvingBom.getSubCode()); his.setSubModel(approvingBom.getSubModel()); his.setSubName(approvingBom.getSubName()); his.setSurfaceDetail(approvingBom.getSurfaceDetail()); //his.setSVersion(nextVersion); his.setThickness(approvingBom.getThickness()); his.setType(approvingBom.getType()); his.setUnit(approvingBom.getUnit()); his.setUpUserId(approvingBom.getUpUserId()); phService.insertAndUpdateEnabled(productHistory); int productId = productService.updateVersion(parentCode,customCode,nextVersion); newHistoryList.add(his); List<ProductBomHistory> productBomHistoryList = new LinkedList<>(); List<ProductBom> productBomList = new LinkedList<>(); approvingList.forEach(approving->{ ProductBomHistory bomHistory = new ProductBomHistory(); ProductBom bom = new ProductBom(); bom.setProductId(productId); bom.setCategory(approving.getCategory()); bom.setCreateDate(new Date()); bom.setDwgUrl(approving.getDwgUrl()); bom.setFileUrl(approving.getFileUrl()); bom.setMaterial(approving.getMaterial()); bom.setNotes(approving.getNotes()); bom.setPictureUrl(approving.getPictureUrl()); bom.setProducer(approving.getProducer()); bom.setQuantity(approving.getQuantity()); bom.setSubCode(approving.getSubCode()); bom.setSubModel(approving.getSubModel()); bom.setSubName(approving.getSubName()); bom.setSurfaceDetail(approving.getSurfaceDetail()); bom.setThickness(approving.getThickness()); bom.setType(approving.getType()); bom.setUnit(approving.getUnit()); bom.setUpUserId(approving.getUpUserId()); bom.setVersion(nextVersion); bomHistory.setProductId(productHistory.getId()); bomHistory.setCategory(approving.getCategory()); bomHistory.setCreateDate(new Date()); bomHistory.setDwgUrl(approving.getDwgUrl()); bomHistory.setFileUrl(approving.getFileUrl()); bomHistory.setMaterial(approving.getMaterial()); bomHistory.setNotes(approving.getNotes()); bomHistory.setPictureUrl(approving.getPictureUrl()); bomHistory.setProducer(approving.getProducer()); bomHistory.setQuantity(approving.getQuantity()); bomHistory.setSubCode(approving.getSubCode()); bomHistory.setSubModel(approving.getSubModel()); bomHistory.setSubName(approving.getSubName()); bomHistory.setSurfaceDetail(approving.getSurfaceDetail()); bomHistory.setThickness(approving.getThickness()); bomHistory.setType(approving.getType()); bomHistory.setUnit(approving.getUnit()); bomHistory.setUpUserId(approving.getUpUserId()); bomHistory.setVersion(nextVersion); productBomHistoryList.add(bomHistory); productBomList.add(bom); }); //本次审核中子件被修改的子件集合 List<String> approvingUpdateSubNameList = approvingList.stream().filter(approvingBom -> approvingBom.getVersion() == 1).map(ProductBomApproving::getSubName).collect(Collectors.toList()); historyService.addBatch(productBomHistoryList); bomService.insertBatch(productBomList); historyService.addBatch(newHistoryList); /*更新产品的当前版本,更新到最新的版本*/ //当前版本的所有bom的eVersion更新,排除被修改的子件 List<ProductBomHistory> newVersionCurrentHistoryList = currentHistoryList.stream() .filter(currentHistory -> !approvingUpdateSubNameList.contains(currentHistory.getSubName())) .collect(Collectors.toList()); newVersionCurrentHistoryList.forEach(history -> { //lxw修改 //history.setEVersion(nextVersion); }); if (newVersionCurrentHistoryList.size() != 0) { historyService.updateVersionBatch(newVersionCurrentHistoryList); } //更新散件表当前版本,更新eVersion List<MaterialProductHistory> cphList = cphService.getListByParentModel(approvingList.get(0).getParentModel(),currentVersion); if(cphList.size()!=0){cphService.updateVersionBatch(cphList);} //物料表中不存在的,则添加到物料表中去 TODO 考虑是否需要这么操作 /*更新到product_bom*/ //查询新的版本 List<ProductBomHistory> newBomList = historyService.getListByParentModel(approvingList.get(0).getParentModel(), nextVersion); bomService.updateNewBom(newBomList); /*String projectDir = CommonUtil.getProjectDir(); FileUtil.copyDir()*/ /*将产品bom表的url修正,更新到正式表*/ //审批完后,将本次的bom带url的全部复制到正式文件夹中 List<ProductBomApproving> fileBomApprovingList = approvingList.stream() //文件转移,未跟子件挂钩的所有图纸图片转移到产品版本下:doc_file/product/{产品型号}/standard或者{customCode}}/{version}/ //跟子件挂钩的转移到子件图纸下:doc_file/material/ TODO /*List<ProductBomApproving> fileBomApprovingList = approvingList.stream() .filter(productBomApproving -> productBomApproving.getPictureUrl() != null || productBomApproving.getDwgUrl() != null ).collect(Collectors.toList()); @@ -248,7 +248,7 @@ } }); //更新正式bom的对应url bomService.updateUrl(fileBomApprovingList); bomService.updateUrl(fileBomApprovingList);*/ } else if(type.intValue() == EnumWorksheetType.Material.getType()){ //物料 List<MaterialApproving> approvingList = mAService.getListByMainId(link.getMainId()); src/main/java/com/whyc/service/WorksheetMainService.java
@@ -48,6 +48,9 @@ private ProductBomApprovingService approvingService; @Autowired private ProductApprovingService paService; @Autowired private MaterialProductApprovingService cpApprovingService; @Autowired @@ -71,8 +74,8 @@ @Transactional public boolean submit(WorksheetMain main, DocUser user) { main.setType(1); List<ProductBomApproving> bomList = main.getApprovingBomList(); int rejectVersion=-1; ProductApproving productApproving = main.getProductApproving(); List<ProductBomApproving> bomList = productApproving.getBomApprovingList(); //提交主表 main.setCreateUserId(user.getId()); //提交人角色来判断工作流层级 @@ -81,8 +84,6 @@ main.setLevel(2); main.setStatus(1); mainMapper.insert(main); }else { rejectVersion = approvingService.getRejectVersion(main.getId()); } //提交子表 WorksheetLink link =new WorksheetLink(); @@ -93,7 +94,6 @@ link.setDealDesc(main.getDealDesc()); link.setLinkStatus(0); link.setEnableArchive(0); link.setRejectVersion(rejectVersion+1); linkMapper.insert(link); } else if(user.getRoleId().equals("1002")){ @@ -101,8 +101,6 @@ main.setLevel(1); main.setStatus(2); mainMapper.insert(main); }else { rejectVersion = approvingService.getRejectVersion(main.getId()); } //提交子表 WorksheetLink link =new WorksheetLink(); @@ -113,7 +111,6 @@ link.setDealDesc(main.getDealDesc()); link.setLinkStatus(0); link.setEnableArchive(1); link.setRejectVersion(rejectVersion+1); linkMapper.insert(link); } else if(user.getRoleId().equals("1003")){ @@ -124,13 +121,35 @@ return false; } //产品bom/图纸图片提交 //查询当前驳回版本 int nextRejectVersion = rejectVersion+1; if(productApproving.getCustomCode()!=null && bomList.get(0).getId()!=null) { //与前端约定 定制表单号关联产品,则关联的产品id写入id List<ProductBom> productBomList = pbService.getBomByProductId(bomList.get(0).getId()); bomList.clear(); productBomList.forEach(bom->{ ProductBomApproving approving = new ProductBomApproving(); approving.setCategory(bom.getCategory()); approving.setSubCode(bom.getSubCode()); approving.setSubName(bom.getSubName()); approving.setSubModel(bom.getSubModel()); approving.setUnit(bom.getUnit()); approving.setQuantity(bom.getQuantity()); approving.setProducer(bom.getProducer()); approving.setMaterial(bom.getMaterial()); approving.setThickness(bom.getThickness()); approving.setSurfaceDetail(bom.getSurfaceDetail()); approving.setNotes(bom.getNotes()); bomList.add(approving); }); } productApproving.setMainId(main.getId()); productApproving.setCreateTime(new Date()); paService.insert(productApproving); bomList.forEach(bom->{ bom.setMainId(main.getId()); //bom.setMainId(main.getId()); bom.setProductApprovingId(productApproving.getId()); bom.setUpUserId(user.getId()); //lxw注释 //bom.setRejectVersion(nextRejectVersion); bom.setCreateDate(new Date()); if(bom.getDwgUrl()==null){ bom.setDwgUrl(""); src/main/resources/mapper/WorksheetMainMapper.xml
@@ -34,7 +34,7 @@ </collection> </resultMap> <resultMap id="Map_WorksheetMain2" type="WorksheetMain" extends="Map_WorksheetMain"> <collection property="approvingBomList" ofType="ProductBomApproving"> <collection property="productApproving" ofType="ProductBomApproving"> <result column="parent_code" property="parentCode"/> <result column="parent_name" property="parentName"/> <result column="parent_model" property="parentModel"/> @@ -59,7 +59,7 @@ </collection> </resultMap> <resultMap id="Map_WorksheetMain3" type="WorksheetMain" extends="Map_WorksheetMain"> <collection property="cApprovingList" ofType="MaterialApproving"> <collection property="mApprovingList" ofType="MaterialApproving"> <result column="type" property="type"/> <result column="category" property="category"/> <result column="sub_code" property="subCode"/> @@ -92,7 +92,7 @@ </collection> </resultMap> <resultMap id="Map_WorksheetMain4" type="WorksheetMain" extends="Map_WorksheetMain"> <collection property="cpApprovingList" ofType="MaterialProductApproving"> <collection property="mpApprovingList" ofType="MaterialProductApproving"> <!-- <result column="parent_model" property="parentModel" /> <result column="sub_name" property="subName"/> <result column="link_type" property="linkType"/>