| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.highdatas.mdm.entity.Flows; |
| | | import com.highdatas.mdm.entity.Maintain; |
| | | import com.highdatas.mdm.entity.MaintainField; |
| | | import com.highdatas.mdm.entity.TUser; |
| | | import com.highdatas.mdm.mapper.FlowsMapper; |
| | | import com.highdatas.mdm.pojo.*; |
| | | import com.highdatas.mdm.service.ActivitiService; |
| | | import com.highdatas.mdm.service.IFlowsService; |
| | | import com.highdatas.mdm.service.IMaintainService; |
| | | import com.highdatas.mdm.service.ITUserService; |
| | | import com.highdatas.mdm.service.*; |
| | | import com.highdatas.mdm.service.act.*; |
| | | import com.highdatas.mdm.util.Constant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | IMaintainService maintainService; |
| | | @Autowired |
| | | ITUserService userService; |
| | | @Autowired |
| | | IMasterModifiedService masterModifiedService; |
| | | |
| | | @Autowired |
| | | IMaintainFieldService maintainFieldService; |
| | | @Value("${img.url}") |
| | | String basePath; |
| | | |
| | |
| | | @RequestMapping(value = "/start/{key}", method = RequestMethod.GET) |
| | | public Result<Object> start(@PathVariable String key,@RequestParam String businessId, HttpServletRequest request) { |
| | | if (StringUtils.isEmpty(key)) { |
| | | return Result.error(new CodeMsg(1000, "key is not found")); |
| | | return Result.error(new CodeMsg(1000, "key is not found")); |
| | | } |
| | | String desp = request.getParameter("desp"); |
| | | String businessType = request.getParameter("businessType"); |
| | | ActivitiBusinessType type; |
| | | if (StringUtils.isEmpty(businessType)) { |
| | | type = ActivitiBusinessType.maintain; |
| | | } else { |
| | | type = ActivitiBusinessType.valueOf(businessType); |
| | | } |
| | | HttpSession session = request.getSession(); |
| | | Flows flows = activitiService.start(key, session, businessId, type); |
| | | if (flows == null) { |
| | | return Result.error(CodeMsg.INSERT_ERROR); |
| | | } else { |
| | | if (type.equals(ActivitiBusinessType.field)) { |
| | | MaintainField maintainField = maintainFieldService.selectById(businessId); |
| | | maintainField.setFlowId(flows.getId()); |
| | | maintainField.setDesp(desp); |
| | | maintainField.updateById(); |
| | | return Result.success(flows.getId()); |
| | | } |
| | | String desp = request.getParameter("desp"); |
| | | String businessType = request.getParameter("businessType"); |
| | | ActivitiBusinessType type; |
| | | if (StringUtils.isEmpty(businessType)) { |
| | | type = ActivitiBusinessType.maintain; |
| | | } else { |
| | | type = ActivitiBusinessType.valueOf(businessType); |
| | | } |
| | | HttpSession session = request.getSession(); |
| | | Flows flows = activitiService.start(key, session, businessId, type); |
| | | if (flows == null) { |
| | | return Result.error(CodeMsg.INSERT_ERROR); |
| | | } else { |
| | | |
| | | if (type.equals(ActivitiBusinessType.maintain)) { |
| | | else if (type.equals(ActivitiBusinessType.maintain)) { |
| | | Maintain maintain = maintainService.selectById(businessId); |
| | | maintain.setFlowId(flows.getId()); |
| | | maintain.setDesp(desp); |
| | |
| | | if (!StringUtils.isEmpty(pageSizeStr)) { |
| | | page.setPageSize(Integer.valueOf(pageSizeStr)); |
| | | } |
| | | |
| | | subList = subList.stream().skip(page.getBeginRecordNo_1()).limit(page.getPageSize()).collect(Collectors.toList()); |
| | | ArrayList<Map<String, Object>> result = new ArrayList<>(); |
| | | for (HistoricProcessInstance historicProcessInstance : subList) { |
| | |
| | | one.put("createTime", flows.getCreateTime()); |
| | | result.add(one); |
| | | } |
| | | |
| | | Collections.sort(result, new Comparator<Map<String, Object>>() { |
| | | @Override |
| | | public int compare(Map<String, Object> o1, Map<String, Object> o2) { |
| | | Date o1Date = (Date) o1.get("createTime"); |
| | | Date o2Date = (Date) o2.get("createTime"); |
| | | return o2Date.compareTo(o1Date); |
| | | } |
| | | }); |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.fluentPut("total", page.getRecordCount()); |
| | | object.fluentPut("size", page.getPageSize()); |
| | |
| | | flows.setStatus(ActivitiStatus.close); |
| | | } |
| | | |
| | | if (flows.getBusinessType().equals(ActivitiBusinessType.maintain)){ |
| | | String maintainId = flows.getBusinessId(); |
| | | maintainService.dealFlow(maintainId, flows.getStatus()); |
| | | } |
| | | |
| | | flowsService.aduitFinish(flows); |
| | | |
| | | } else { |
| | | if (pass && flows.getStatus().equals(ActivitiStatus.refuse)) { |
| | |
| | | return Result.success(CodeMsg.INSERT_ERROR); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |