| | |
| | | import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; |
| | | import org.jeecg.modules.eam.constant.EquipmentRepairStatus; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamInspectionOrderService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | | import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | private IEamWeekMaintenanceOrderService weekMaintenanceOrderService; |
| | | @Resource |
| | | private ObjectMapper objectMapper; |
| | | |
| | | @Resource |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | @Autowired |
| | | private IEamRepairOrderService repairOrderService; |
| | | |
| | | |
| | | @ApiOperation(value = "看板接口-维保状态统计", notes = "看板接口-维保状态统计") |
| | | @GetMapping(value = "/equipmentStatusStatistics") |
| | |
| | | @ApiOperation(value = "维修看板-维修工排名", notes = "维修看板-维修工排名") |
| | | @GetMapping(value = "/repairmanRanking") |
| | | public Result<?> repairmanRanking() { |
| | | return null; |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate end = today.plusDays(1); |
| | | LocalDate start = today.minusDays(30); |
| | | //只取前7名 |
| | | List<RepairmanRankingVO> list = repairOrderService.repairmanRanking(start.toString(), end.toString()); |
| | | if(CollectionUtil.isEmpty(list)) { |
| | | return Result.ok(Collections.emptyList()); |
| | | } |
| | | if(list.size() > 7) { |
| | | list = list.subList(0, 7); |
| | | } |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | try { |
| | | for(RepairmanRankingVO vo : list) { |
| | | String json = objectMapper.writeValueAsString(vo); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("repairer", vo.getRepairer(), item, "sys_user,realname,username"); |
| | | items.add(item); |
| | | } |
| | | return Result.OK(items); |
| | | }catch (Exception e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | | } |