| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.dto.WorksheetMainDTO2; |
| | | import com.whyc.mapper.DocUserMapper; |
| | | import com.whyc.mapper.WorksheetLinkMapper; |
| | | import com.whyc.mapper.WorksheetMainMapper; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.ProductBomApproving; |
| | | import com.whyc.pojo.WorksheetLink; |
| | | import com.whyc.pojo.WorksheetMain; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.Zip4jUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import sun.print.PSPrinterJob; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private DocUserMapper userMapper; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private ProductBomApprovingService approvingService; |
| | | |
| | | @Autowired |
| | | private MaterialProductApprovingService cpApprovingService; |
| | | |
| | | @Autowired |
| | | private MaterialApprovingService mApprovingService; |
| | | |
| | | @Autowired |
| | | private MaterialService mService; |
| | | |
| | | @Autowired |
| | | private ProductBomService pbService; |
| | | |
| | | @Autowired |
| | | private MaterialProductHistoryService cphService; |
| | | |
| | | @Autowired |
| | | private ProductSoftwareApprovingService psaService; |
| | | |
| | | @Autowired |
| | | private ProductSoftwareService productSoftwareService; |
| | | |
| | | @Transactional |
| | | public boolean submit(WorksheetMainDTO mainDTO, DocUser user) { |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | List<ProductBomApproving> bomList = mainDTO.getBomList(); |
| | | public boolean submit(WorksheetMain main, DocUser user) { |
| | | main.setType(1); |
| | | List<ProductBomApproving> bomList = main.getApprovingBomList(); |
| | | int rejectVersion=-1; |
| | | //提交主表 |
| | | main.setCreateUserId(user.getId()); |
| | | //提交人角色来判断工作流层级 |
| | | if(user.getRoleId().equals("1001")){ |
| | | main.setLevel(2); |
| | | main.setStatus(1); |
| | | if(main.getId()==null) { |
| | | main.setLevel(2); |
| | | main.setStatus(1); |
| | | mainMapper.insert(main); |
| | | }else { |
| | | rejectVersion = approvingService.getRejectVersion(main.getId()); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(1); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(0); |
| | | link.setRejectVersion(rejectVersion+1); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1002")){ |
| | | if(main.getId()==null) { |
| | | main.setLevel(1); |
| | | main.setStatus(2); |
| | | mainMapper.insert(main); |
| | | }else { |
| | | rejectVersion = approvingService.getRejectVersion(main.getId()); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(2); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(1); |
| | | link.setRejectVersion(rejectVersion+1); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1003")){ |
| | | main.setLevel(0); |
| | | main.setStatus(5); |
| | | mainMapper.insert(main); |
| | | }else{ |
| | | return false; |
| | | } |
| | | //产品bom/图纸图片提交 |
| | | //查询当前驳回版本 |
| | | int nextRejectVersion = rejectVersion+1; |
| | | bomList.forEach(bom->{ |
| | | bom.setMainId(main.getId()); |
| | | bom.setUpUserId(user.getId()); |
| | | //lxw注释 |
| | | //bom.setRejectVersion(nextRejectVersion); |
| | | bom.setCreateDate(new Date()); |
| | | if(bom.getDwgUrl()==null){ |
| | | bom.setDwgUrl(""); |
| | | }else { |
| | | bom.setDwgUrl(bom.getDwgUrl()); |
| | | } |
| | | if(bom.getFileUrl()==null){ |
| | | bom.setFileUrl(""); |
| | | }else { |
| | | bom.setFileUrl(bom.getFileUrl()); |
| | | } |
| | | if(bom.getPictureUrl()==null){ |
| | | bom.setPictureUrl(""); |
| | | }else{ |
| | | bom.setPictureUrl(bom.getPictureUrl()); |
| | | } |
| | | }); |
| | | approvingService.insert(bomList); |
| | | return true; |
| | | } |
| | | |
| | | public boolean MaterialProductSubmit(WorksheetMainDTO mainDTO, DocUser user) { |
| | | List<MaterialProductApproving> approvingList = new LinkedList<>(); |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | List<MaterialProductApproving> addedList = mainDTO.getAddedList(); |
| | | List<MaterialProductApproving> replacedList = mainDTO.getReplacedList(); |
| | | List<MaterialProductApproving> removedList = mainDTO.getRemovedList(); |
| | | |
| | | main.setType(EnumWorksheetType.MaterialProduct.getType()); |
| | | //提交主表 |
| | | main.setCreateUserId(user.getId()); |
| | | //提交人角色来判断工作流层级 |
| | | if(user.getRoleId().equals("1001")){ |
| | | if(main.getId()==null) { |
| | | main.setLevel(2); |
| | | main.setStatus(1); |
| | | mainMapper.insert(main); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1002")){ |
| | | main.setLevel(1); |
| | | main.setStatus(2); |
| | | mainMapper.insert(main); |
| | | if(main.getId()==null) { |
| | | main.setLevel(1); |
| | | main.setStatus(2); |
| | | mainMapper.insert(main); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | |
| | | }else{ |
| | | return false; |
| | | } |
| | | //产品bom/图纸图片提交 |
| | | bomList.forEach(bom->bom.setMainId(main.getId())); |
| | | approvingService.insert(bomList); |
| | | //物料-产品审批提交 |
| | | if(addedList!=null && addedList.size()!=0){ |
| | | addedList.forEach(item->{ |
| | | item.setMainId(main.getId()); |
| | | item.setLinkType(1); |
| | | }); |
| | | approvingList.addAll(addedList); |
| | | } |
| | | if(replacedList!=null && replacedList.size()!=0){ |
| | | replacedList.forEach(item->{ |
| | | item.setMainId(main.getId()); |
| | | item.setLinkType(2); |
| | | }); |
| | | approvingList.addAll(replacedList); |
| | | } |
| | | if(removedList!=null && removedList.size()!=0){ |
| | | removedList.forEach(item->{ |
| | | item.setMainId(main.getId()); |
| | | item.setLinkType(-1); |
| | | }); |
| | | approvingList.addAll(removedList); |
| | | } |
| | | cpApprovingService.insert(approvingList); |
| | | return true; |
| | | } |
| | | |
| | | public Response materialSubmit(WorksheetMain main, DocUser user) { |
| | | Response<Object> response = new Response<>(); |
| | | List<MaterialApproving> mApprovingList = main.getMApprovingList(); |
| | | //判断是新增还是删除 |
| | | boolean isAdded = mApprovingList.get(0).getSubName()!=null; |
| | | if(isAdded) { //新增 |
| | | //查询是否有 已生效或者已提交审批的 相同的物料 |
| | | List<Material> existMaterialList = new LinkedList<>(); |
| | | List<MaterialApproving> existCAList = new LinkedList<>(); |
| | | |
| | | List<Material> materialList = mService.getList(); |
| | | List<MaterialApproving> cAList = mApprovingService.getListByStatus(1); |
| | | for (int i = 0; i < mApprovingList.size(); i++) { |
| | | MaterialApproving materialApproving = mApprovingList.get(i); |
| | | for (int j = 0; j < materialList.size(); j++) { |
| | | if (materialApproving.getSubCode().equals(materialList.get(j).getSubCode()) |
| | | && materialApproving.getSubName().equals(materialList.get(j).getSubName()) |
| | | && materialApproving.getSubModel().equals(materialList.get(j).getSubModel()) |
| | | ) { |
| | | existMaterialList.add(materialList.get(j)); |
| | | } |
| | | } |
| | | |
| | | for (int j = 0; j < cAList.size(); j++) { |
| | | if (materialApproving.getSubCode().equals(cAList.get(j).getSubCode()) |
| | | && materialApproving.getSubName().equals(cAList.get(j).getSubName()) |
| | | && materialApproving.getSubModel().equals(cAList.get(j).getSubModel()) |
| | | ) { |
| | | existCAList.add(cAList.get(j)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int existCASize = existCAList.size(); |
| | | int existMaterialSize = existMaterialList.size(); |
| | | if (existCASize != 0) { |
| | | if (existMaterialSize != 0) { |
| | | response.setII(21, existCAList, existMaterialList, "重复提交:现有物料及正在进行审批的物料中,存在当前提交上传的物料"); |
| | | } else { |
| | | response.set(22, existCAList, "重复提交:正在进行审批的物料中,存在当前提交上传的物料"); |
| | | } |
| | | return response; |
| | | } else { |
| | | if (existMaterialSize != 0) { |
| | | return response.setII(23, null, existMaterialList, "重复提交:现有物料中,存在当前提交上传的物料"); |
| | | } |
| | | } |
| | | }else{ //删除 |
| | | //判断是否在物料审批删除中,是否存在产品关联及关联审批 |
| | | MaterialApproving deleteApproving = new MaterialApproving(); |
| | | List<MaterialProductHistory> existMaterialProducts = new LinkedList<>(); |
| | | List<MaterialProductApproving> existMaterialProductApprovingList = new LinkedList<>(); |
| | | deleteApproving = mApprovingService.getListByMaterialId(mApprovingList.get(0).getMaterialId()); |
| | | |
| | | //查看产品关联 |
| | | List<MaterialProductHistory> cphLatestExistList = cphService.getLatestExistListByMaterialId(mApprovingList.get(0).getMaterialId()); |
| | | //查看产品关联审批 |
| | | List<MaterialProductApproving> cpaLatestExistList = cpApprovingService.getLatestExistListByMaterialId(mApprovingList.get(0).getMaterialId()); |
| | | if(deleteApproving!=null){ |
| | | return response.set(31,deleteApproving,"拒绝本次删除申请,当前物料正在进行删除审批"); |
| | | } |
| | | if(cphLatestExistList!=null && cphLatestExistList.size()!=0){ |
| | | if(cpaLatestExistList!=null && cpaLatestExistList.size()!=0){ |
| | | return response.setII(32,cpaLatestExistList,cphLatestExistList,"拒绝本次删除申请,当前散装已经关联产品及在产品关联审批"); |
| | | }else{ |
| | | return response.setII(33,null,cphLatestExistList,"拒绝本次删除申请,当前物料在产品关联审批"); |
| | | } |
| | | }else{ |
| | | if(cpaLatestExistList!=null && cpaLatestExistList.size()!=0){ |
| | | return response.set(34,cpaLatestExistList,"拒绝本次删除申请,当前物料已经关联产品"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | main.setType(EnumWorksheetType.Material.getType()); |
| | | //提交主表 |
| | | main.setCreateUserId(user.getId()); |
| | | //提交人角色来判断工作流层级 |
| | | if(user.getRoleId().equals("1001")){ |
| | | if(main.getId()==null) { |
| | | main.setLevel(2); |
| | | main.setStatus(1); |
| | | mainMapper.insert(main); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(1); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(0); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1002")){ |
| | | if(main.getId()==null) { |
| | | main.setLevel(1); |
| | | main.setStatus(2); |
| | | mainMapper.insert(main); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(2); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(1); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1003")){ |
| | | main.setLevel(0); |
| | | main.setStatus(5); |
| | | mainMapper.insert(main); |
| | | }else{ |
| | | return response.set(3); |
| | | } |
| | | //物料-审批提交 |
| | | mApprovingList.forEach(cApproving->{ |
| | | cApproving.setCreateDate(new Date()); |
| | | cApproving.setMainId(main.getId()); |
| | | cApproving.setStatus(1); |
| | | }); |
| | | |
| | | mApprovingService.insert(mApprovingList); |
| | | return response.set(1); |
| | | } |
| | | |
| | | public Response productSoftwareSubmit(MultipartFile file, WorksheetMainDTO2 mainDTO, DocUser user) throws IOException { |
| | | Response response = new Response(); |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | ProductSoftwareApproving approving = mainDTO.getApproving(); |
| | | //首先校验文件名是否已存在 |
| | | String filename = file.getOriginalFilename(); |
| | | List<ProductSoftwareApproving> softwareApprovingList = psaService.getAll(); |
| | | List<ProductSoftware> softwareList = productSoftwareService.getAll(); |
| | | List<String> existApprovingList = softwareApprovingList.stream().map(ProductSoftwareApproving::getSoftwareName).collect(Collectors.toList()); |
| | | List<String> existList = softwareList.stream().map(ProductSoftware::getSoftwareName).collect(Collectors.toList()); |
| | | |
| | | for (String existFilename:existList){ |
| | | if(filename.equals(existFilename)){ |
| | | return response.set(1,false,"软件文件名已存在"); |
| | | } |
| | | } |
| | | for (String existFilename:existApprovingList){ |
| | | if(filename.equals(existFilename)){ |
| | | return response.set(1,false,"软件文件名在审批列表中已存在"); |
| | | } |
| | | } |
| | | |
| | | main.setType(1); |
| | | //提交主表 |
| | | main.setCreateUserId(user.getId()); |
| | | //提交人角色来判断工作流层级 |
| | | if(user.getRoleId().equals("1001")){ |
| | | if(main.getId()==null) { |
| | | main.setLevel(2); |
| | | main.setStatus(1); |
| | | mainMapper.insert(main); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(1); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(0); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1002")){ |
| | | if(main.getId()==null) { |
| | | main.setLevel(1); |
| | | main.setStatus(2); |
| | | mainMapper.insert(main); |
| | | } |
| | | //提交子表 |
| | | WorksheetLink link =new WorksheetLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setDealUserId(main.getNextUser()); |
| | | link.setDealType(2); |
| | | link.setDealDesc(main.getDealDesc()); |
| | | link.setLinkStatus(0); |
| | | link.setEnableArchive(1); |
| | | linkMapper.insert(link); |
| | | } |
| | | else if(user.getRoleId().equals("1003")){ |
| | | main.setLevel(0); |
| | | main.setStatus(5); |
| | | mainMapper.insert(main); |
| | | }else{ |
| | | return response.set(1,false,"角色无法提交审批"); |
| | | } |
| | | //转化为审批路径 |
| | | //检查是否为zip |
| | | boolean isZip = Zip4jUtil.checkZipFileParam(file); |
| | | if(!isZip){ |
| | | return response.set(1,false,"上传的文件格式不是zip"); |
| | | } |
| | | //zip存储路径:doc_file/product_approving/${username}/{dateFormat}/${timeStamp} |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | String dateFormat = new SimpleDateFormat("YYYY-MM").format(new Date()); |
| | | long timeStamp = System.currentTimeMillis(); |
| | | String productSoftwarePath = File.separator + "product_software" + File.separator + user.getName() + File.separator + dateFormat+ File.separator + timeStamp; |
| | | String filePath = rootFile + productSoftwarePath; |
| | | String originalFilename = file.getOriginalFilename(); |
| | | File zipFile = new File(filePath+File.separator+ originalFilename); |
| | | if(!zipFile.exists()){ |
| | | zipFile.mkdirs(); |
| | | } |
| | | file.transferTo(zipFile); |
| | | approving.setSoftwareUrl("doc_file"+productSoftwarePath+File.separator+ originalFilename); |
| | | approving.setSoftwareName(originalFilename); |
| | | approving.setCreateTime(new Date()); |
| | | approving.setMainId(main.getId()); |
| | | //产品软件提交 |
| | | psaService.insert(approving); |
| | | return response.set(1,true, "提交完成"); |
| | | } |
| | | |
| | | public WorksheetMain getInfoById(Integer id) { |
| | |
| | | main.setId(id); |
| | | main.setStatus(status); |
| | | main.setEndReason(endReason); |
| | | main.setEndTime(new Date()); |
| | | mainMapper.updateById(main); |
| | | } |
| | | |
| | | /** |
| | | * 用户对应的工作台数据分类 |
| | | * @param user |
| | | * */ |
| | | public Map<String, List<WorksheetMain>> getList(DocUser user) { |
| | | Map<String,List<WorksheetMain>> map = new HashMap<>(); |
| | | * @return*/ |
| | | public Map<String, Integer> getStatusStatistic(DocUser user) { |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | switch (user.getRoleId()){ |
| | | //普通员工 |
| | | case "1001": |
| | | { |
| | | //未处理(审批中)/已驳回/已审批 |
| | | map.put("rejected",0); |
| | | map.put("approving",0); |
| | | map.put("approved",0); |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()); |
| | | List<WorksheetMain> worksheetMainList = mainMapper.selectList(query); |
| | |
| | | groupingList.forEach((status,mainList)->{ |
| | | switch (status){ |
| | | case 0:{ |
| | | map.put("rejected",mainList); |
| | | map.put("rejected",mainList.size()); |
| | | }break; |
| | | case 1: |
| | | case 2:{ |
| | | List<WorksheetMain> addedMainList = map.get("approving"); |
| | | if(addedMainList ==null){ |
| | | map.put("approving",mainList); |
| | | Integer addedMainCount= map.get("approving"); |
| | | if(addedMainCount ==0){ |
| | | map.put("approving",mainList.size()); |
| | | }else{ |
| | | addedMainList.addAll(mainList); |
| | | map.put("approving",addedMainList); |
| | | map.put("approving",addedMainCount+mainList.size()); |
| | | } |
| | | }break; |
| | | case 5:{ |
| | | map.put("approved",mainList); |
| | | map.put("approved",mainList.size()); |
| | | }break; |
| | | } |
| | | }); |
| | |
| | | { |
| | | //待处理/已处理/属于自己-审批中/已驳回/已审批 |
| | | //属于自己-审批中/已驳回/已审批 |
| | | map.put("rejected",0); |
| | | map.put("approving",0); |
| | | map.put("approved",0); |
| | | map.put("handling",0); |
| | | map.put("handled",0); |
| | | |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()); |
| | | List<WorksheetMain> worksheetMainList = mainMapper.selectList(query); |
| | |
| | | groupingList.forEach((status,mainList)->{ |
| | | switch (status){ |
| | | case 0:{ |
| | | map.put("rejected",mainList); |
| | | map.put("rejected",mainList.size()); |
| | | }break; |
| | | case 2:{ |
| | | map.put("approving",mainList); |
| | | map.put("approving",mainList.size()); |
| | | }break; |
| | | case 5:{ |
| | | map.put("approved",mainList); |
| | | map.put("approved",mainList.size()); |
| | | }break; |
| | | } |
| | | }); |
| | |
| | | linkList.forEach(link -> {mainList.add(link.getMain());}); |
| | | switch (linkStatus){ |
| | | case 0:{ |
| | | map.put("handling",mainList); |
| | | map.put("handling",mainList.size()); |
| | | }break; |
| | | case 1: |
| | | case 2:{ |
| | | map.put("handled",mainList); |
| | | Integer addedMainCount= map.get("handled"); |
| | | if(addedMainCount ==0){ |
| | | map.put("handled",mainList.size()); |
| | | }else{ |
| | | map.put("handled",addedMainCount+mainList.size()); |
| | | } |
| | | }break; |
| | | } |
| | | }); |
| | |
| | | case "1003": |
| | | { |
| | | //待处理/已审批 |
| | | map.put("handling",0); |
| | | map.put("approved",0); |
| | | List<WorksheetLink> WorksheetLinkList = linkService.getInfoList(user.getId()); |
| | | Map<Integer, List<WorksheetLink>> groupingLinkList = WorksheetLinkList.stream().collect(Collectors.groupingBy(WorksheetLink::getLinkStatus)); |
| | | groupingLinkList.forEach((linkStatus,linkList)->{ |
| | |
| | | linkList.forEach(link -> {mainList.add(link.getMain());}); |
| | | switch (linkStatus){ |
| | | case 0:{ |
| | | map.put("handling",mainList); |
| | | map.put("handling",mainList.size()); |
| | | }break; |
| | | case 1: |
| | | case 2:{ |
| | | map.put("handled",mainList); |
| | | Integer addedMainCount= map.get("approved"); |
| | | if(addedMainCount ==0){ |
| | | map.put("approved",mainList.size()); |
| | | }else{ |
| | | map.put("approved",addedMainCount+mainList.size()); |
| | | } |
| | | }break; |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | } |
| | | //查询我的工单数量 |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()); |
| | | Integer count = mainMapper.selectCount(query); |
| | | map.put("my",count); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | public WorksheetMain getLinkList(int id) { |
| | | return mainMapper.getLinkList(id); |
| | | //判断是哪种类型的审批,返回不同的类型 具体数据 |
| | | Integer type = getInfoById(id).getType(); |
| | | if(type.intValue() == EnumWorksheetType.ProductBom.getType()) { |
| | | return mainMapper.getLinkList(id); |
| | | }else if(type.intValue() == EnumWorksheetType.Material.getType()){ |
| | | //lxw注释 |
| | | //return mainMapper.getLinkListWithMaterials(id); |
| | | return null; |
| | | }else{ //物料-产品 |
| | | //return mainMapper.getLinkListWithMaterialProducts(id); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public Response<PageInfo<WorksheetMain>> getApprovingListPage(DocUser user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()).in("status",1,2).orderByDesc("id"); |
| | | List<WorksheetMain> worksheetMainList = mainMapper.selectList(query); |
| | | //查询主表状态对应的子表 |
| | | worksheetMainList.forEach(main -> { |
| | | main.setApprovingUser(linkService.getApprovingUser(main.getId())); |
| | | }); |
| | | PageInfo<WorksheetMain> pageInfo = new PageInfo<>(worksheetMainList); |
| | | return new Response<PageInfo<WorksheetMain>>().set(1,pageInfo); |
| | | } |
| | | |
| | | public Response<PageInfo<WorksheetMain>> getRejectedListPage(DocUser user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()).in("status",0).orderByDesc("id"); |
| | | List<WorksheetMain> worksheetMainList = mainMapper.selectList(query); |
| | | PageInfo<WorksheetMain> pageInfo = new PageInfo<>(worksheetMainList); |
| | | return new Response<PageInfo<WorksheetMain>>().set(1,pageInfo); |
| | | } |
| | | |
| | | public Response<PageInfo<WorksheetMain>> getApprovedListPage(DocUser user, int pageNum, int pageSize) { |
| | | Response<PageInfo<WorksheetMain>> response = new Response<>(); |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorksheetMain> worksheetMainList = null; |
| | | //自己的工单 |
| | | if(!user.getRoleId().equals("1003")){ |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()).in("status",5).orderByDesc("id"); |
| | | worksheetMainList = mainMapper.selectList(query); |
| | | |
| | | }else{ |
| | | //总经理,节点审批人为自己 |
| | | worksheetMainList = linkService.getInfoList2(user.getId(),1); |
| | | } |
| | | PageInfo<WorksheetMain> pageInfo = new PageInfo<>(worksheetMainList); |
| | | return response.set(1,pageInfo); |
| | | } |
| | | |
| | | public Response<PageInfo<WorksheetMain>> getHandlingListPage(DocUser user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorksheetMain> worksheetMainList = linkService.getInfoList3(user.getId(),0); |
| | | PageInfo<WorksheetMain> pageInfo = new PageInfo<>(worksheetMainList); |
| | | return new Response<PageInfo<WorksheetMain>>().set(1,pageInfo); |
| | | } |
| | | |
| | | public Response<PageInfo<WorksheetMain>> getHandledListPage(DocUser user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorksheetMain> worksheetMainList = linkService.getInfoList3(user.getId(),1); |
| | | PageInfo<WorksheetMain> pageInfo = new PageInfo<>(worksheetMainList); |
| | | return new Response<PageInfo<WorksheetMain>>().set(1,pageInfo); |
| | | } |
| | | |
| | | public WorksheetMain getInfo(int id) { |
| | | return mainMapper.selectById(id); |
| | | } |
| | | |
| | | public Response<PageInfo<WorksheetMain>> getMyList(int pageNum, int pageSize, DocUser user) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()).orderByDesc("id"); |
| | | List<WorksheetMain> worksheetMainList = mainMapper.selectList(query); |
| | | PageInfo<WorksheetMain> pageInfo = new PageInfo<>(worksheetMainList); |
| | | return new Response<PageInfo<WorksheetMain>>().set(1,pageInfo); |
| | | |
| | | } |
| | | |
| | | } |