| | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return maintainService.getUnSubmitData(tableName, pageNo, pageSize, whereSegment); |
| | | } |
| | | |
| | | @RequestMapping(value = "/history/{tableName}", method = RequestMethod.GET) |
| | | @RequestMapping(value = "{tableName}/unflow/{pageNo}", method = RequestMethod.GET) |
| | | public Result unflow(@PathVariable String tableName, @PathVariable Integer pageNo, HttpServletRequest request) throws UnsupportedEncodingException { |
| | | String pageSize = request.getParameter("pageSize"); |
| | | String whereSegment = request.getParameter("whereSegment"); |
| | | |
| | | if (StringUtils.isEmpty(whereSegment)) { |
| | | whereSegment = Constant.WHERE_DEFAULT; |
| | | }else { |
| | | whereSegment = URLDecoder.decode(whereSegment, "UTF-8"); |
| | | } |
| | | if (StringUtils.isEmpty(pageSize)) { |
| | | return maintainService.getInvalidVerionData(tableName, whereSegment, pageNo, null); |
| | | } else { |
| | | return maintainService.getInvalidVerionData(tableName, whereSegment, pageNo, Integer.valueOf(pageSize)); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/version/{tableName}", method = RequestMethod.GET) |
| | | public Result getHistory(@PathVariable String tableName) { |
| | | |
| | | Maintain nowVersion = maintainService.getNowVersion(tableName); |
| | | if (nowVersion == null) { |
| | | return Result.error(new CodeMsg(100001,"无当前版本")); |
| | | } |
| | | List<Maintain> maintainList = maintainService.selectList(new EntityWrapper<Maintain>().eq("table_name", tableName).le("order_no",nowVersion.getOrderNo() - 1).orderBy("order_no",false)); |
| | | List<Maintain> maintainList = maintainService.selectList(new EntityWrapper<Maintain>().eq("table_name", tableName).orderBy("order_no",false)); |
| | | List<Maintain> result = new ArrayList<>(); |
| | | for (Maintain maintain : maintainList) { |
| | | String flowId = maintain.getFlowId(); |
| | | if (StringUtils.isEmpty(flowId)) { |
| | | continue; |
| | | } |
| | | |
| | | if (maintainList == null) { |
| | | return Result.error(CodeMsg.SELECT_ERROR_NOTFOUND); |
| | | Flows flows = flowsService.selectById(maintain.getFlowId()); |
| | | if (flows.getStatus().equals(ActivitiStatus.close)) { |
| | | continue; |
| | | } |
| | | if (flows.getStatus().equals(ActivitiStatus.working) || flows.getStatus().equals(ActivitiStatus.refuse)) { |
| | | maintain.setMaintainType(-1); |
| | | }else if(flows.getStatus().equals(ActivitiStatus.open)){ |
| | | maintain.setMaintainType(1); |
| | | } |
| | | if (maintain.getId().equalsIgnoreCase(nowVersion.getId())) { |
| | | maintain.setMaintainType(0); |
| | | } |
| | | result.add(maintain); |
| | | } |
| | | |
| | | List<String> result = maintainList.stream() |
| | | .map(maintain -> maintain.getVersion()) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return Result.success(result); |
| | | } |
| | |
| | | result = maintainService.selectPage(maintainPage); |
| | | } else { |
| | | Wrapper<Maintain> tableNameWrapper = new EntityWrapper<Maintain>().eq("table_name", tableName); |
| | | tableNameWrapper.orderBy("version desc"); |
| | | tableNameWrapper.orderBy("order_no desc"); |
| | | result = maintainService.selectPage(maintainPage, tableNameWrapper); |
| | | } |
| | | List<Maintain> records = result.getRecords(); |