| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.WorkflowMainMapper; |
| | | import com.whyc.pojo.BattDischargePlanTemp; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.WorkflowLink; |
| | | import com.whyc.pojo.WorkflowMain; |
| | |
| | | |
| | | @Autowired |
| | | private WorkflowLinkService linkService; |
| | | |
| | | @Autowired |
| | | private BattDischargePlanTempService tempService; |
| | | |
| | | /** |
| | | * 分派单号: |
| | |
| | | |
| | | |
| | | public WorkflowMain getBaseInfo(Integer mainId) { |
| | | return mapper.getBaseInfo(mainId); |
| | | //根据mainId查询是哪种类型 |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("id",mainId).last(" limit 1"); |
| | | WorkflowMain workflowMain = mapper.selectOne(query); |
| | | Integer type = workflowMain.getType(); |
| | | if(type ==1){ |
| | | List<BattDischargePlanTemp> tempList = tempService.getListByMainId(mainId); |
| | | workflowMain.setTempList(tempList); |
| | | } |
| | | List<WorkflowLink> linkList = linkService.getWorkflowInfo(mainId); |
| | | workflowMain.setLinkList(linkList); |
| | | |
| | | return workflowMain; |
| | | } |
| | | |
| | | public List<WorkflowLink> getAssignReply(Integer mainId) { |
| | |
| | | statistics.put(1,0); |
| | | statistics.put(2,0); |
| | | statistics.put(3,0); |
| | | statistics.put(4,0); |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",userId); |
| | | List<WorkflowMain> mains = mapper.selectList(query); |
| | |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int userId, int type, int status, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorkflowMain> mains = getOwnListByUserAndType(userId,type,status); |
| | | if(type == 1) { |
| | | for (WorkflowMain main : mains) { |
| | | Integer id = main.getId(); |
| | | List<BattDischargePlanTemp> tempList = tempService.getListByMainId(id); |
| | | main.setTempList(tempList); |
| | | } |
| | | } |
| | | PageInfo<WorkflowMain> pageInfo = new PageInfo<>(mains); |
| | | return new Response<PageInfo<WorkflowMain>>().set(1,pageInfo); |
| | | } |
| | | |
| | | private List<WorkflowMain> getOwnListByUserAndType(int userId, int type, int status) { |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",userId).eq("type",type).eq("status",status); |
| | | if(status == 0){ |
| | | query.eq("create_user_id",userId).eq("type",type); |
| | | }else { |
| | | query.eq("create_user_id", userId).eq("type", type).eq("status", status); |
| | | } |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type, int status, UserInf user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorkflowMain> mains = getReceivedListByUserAndType(user,type,status); |
| | | if (type == 1) { |
| | | for (WorkflowMain main : mains) { |
| | | Integer id = main.getId(); |
| | | List<BattDischargePlanTemp> tempList = tempService.getListByMainId(id); |
| | | main.setTempList(tempList); |
| | | } |
| | | } |
| | | PageInfo<WorkflowMain> pageInfo = new PageInfo<>(mains); |
| | | return new Response<PageInfo<WorkflowMain>>().set(1,pageInfo); |
| | | return new Response<PageInfo<WorkflowMain>>().set(1, pageInfo); |
| | | } |
| | | |
| | | private List<WorkflowMain> getReceivedListByUserAndType(UserInf user, int type, int status) { |
| | | return mapper.getReceivedListByUserAndType(user,type,status); |
| | | return mapper.getReceivedListByUserAndType(user, type, status); |
| | | } |
| | | |
| | | public WorkflowMain getOne(Integer mainId) { |
| | | return mapper.selectById(mainId); |
| | | } |
| | | |
| | | //查询表单编号 |
| | | public int getMaxId() { |
| | | Integer id = mapper.getMaxId(); |
| | | if (id == null) { |
| | | id = 1; |
| | | } else { |
| | | id = id + 1; |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | //插入主表带指定主键id不要自增 |
| | | public void addWorkMain(WorkflowMain main) { |
| | | mapper.addWorkMain(main); |
| | | } |
| | | |
| | | } |