| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.WorksheetMainDTO; |
| | | 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 io.swagger.models.auth.In; |
| | | import com.whyc.pojo.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private DocUserMapper userMapper; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private ProductBomApprovingService approvingService; |
| | | |
| | | @Autowired |
| | | private ComponentProductApprovingService cpApprovingService; |
| | | |
| | | @Transactional |
| | | public boolean submit(WorksheetMain main, DocUser user) { |
| | |
| | | bom.setMainId(main.getId()); |
| | | bom.setUpUserId(user.getId()); |
| | | 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 componentProductSubmit(WorksheetMainDTO mainDTO, DocUser user) { |
| | | List<ComponentProductApproving> approvingList = new LinkedList<>(); |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | List<ComponentProductApproving> addedList = mainDTO.getAddedList(); |
| | | List<ComponentProductApproving> replacedList = mainDTO.getReplacedList(); |
| | | List<ComponentProductApproving> removedList = mainDTO.getRemovedList(); |
| | | |
| | | //提交主表 |
| | | 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 false; |
| | | } |
| | | //散装件-产品审批提交 |
| | | 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<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); |
| | | query.eq("create_user_id",user.getId()).in("status",1,2).orderByDesc("id"); |
| | | List<WorksheetMain> worksheetMainList = mainMapper.selectList(query); |
| | | //查询主表状态对应的子表 |
| | | worksheetMainList.forEach(main -> { |
| | |
| | | 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); |
| | | 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); |
| | |
| | | //自己的工单 |
| | | if(!user.getRoleId().equals("1003")){ |
| | | QueryWrapper<WorksheetMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",user.getId()).in("status",5); |
| | | query.eq("create_user_id",user.getId()).in("status",5).orderByDesc("id"); |
| | | worksheetMainList = mainMapper.selectList(query); |
| | | |
| | | }else{ |
| | |
| | | |
| | | public Response<PageInfo<WorksheetMain>> getHandlingListPage(DocUser user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorksheetMain> worksheetMainList = linkService.getInfoList2(user.getId(),0); |
| | | List<WorksheetMain> worksheetMainList = linkService.getInfoList3(user.getId(),0); |
| | | PageInfo<WorksheetMain> pageInfo = new PageInfo<>(worksheetMainList); |
| | | return new Response<PageInfo<WorksheetMain>>().set(1,pageInfo); |
| | | } |
| | |
| | | return new Response<PageInfo<WorksheetMain>>().set(1,pageInfo); |
| | | |
| | | } |
| | | |
| | | } |