| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; |
| | |
| | | @GetMapping(value = "/repairList") |
| | | public Result<?> repairList() { |
| | | List<EquipmentRepairListVO> list = reportRepairService.repairList(); |
| | | if(CollectionUtil.isEmpty(list)) { |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Result.ok(Collections.emptyList()); |
| | | } |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | try { |
| | | for(EquipmentRepairListVO vo : list) { |
| | | for (EquipmentRepairListVO vo : list) { |
| | | String json = objectMapper.writeValueAsString(vo); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("reportOperator", vo.getReportOperator(), item, "sys_user,realname,username"); |
| | |
| | | items.add(item); |
| | | } |
| | | return Result.OK(items); |
| | | }catch (Exception e) { |
| | | } catch (Exception e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | |
| | | LocalDate start = today.minusDays(30); |
| | | //只取前7名 |
| | | List<RepairmanRankingVO> list = repairOrderService.repairmanRanking(start.toString(), end.toString()); |
| | | if(CollectionUtil.isEmpty(list)) { |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Result.ok(Collections.emptyList()); |
| | | } |
| | | if(list.size() > 7) { |
| | | if (list.size() > 7) { |
| | | list = list.subList(0, 7); |
| | | } |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | try { |
| | | for(RepairmanRankingVO vo : list) { |
| | | 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) { |
| | | } catch (Exception e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "维修看板-故障类型统计", notes = "维修看板-故障类型统计") |
| | | @GetMapping(value = "/faultTypeStatistics") |
| | | public Result<?> faultTypeStatistics() { |
| | | //统计今年来故障分类情况 |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate end = today.plusDays(1); |
| | | //今年第一天 |
| | | LocalDate start = today.withDayOfYear(1); |
| | | // 统计个数 |
| | | List<FaultTypeStatisticsVO> list = reportRepairService.faultTypeStatistics(start.toString(), end.toString()); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Result.ok(Collections.emptyList()); |
| | | } |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | try { |
| | | for (FaultTypeStatisticsVO vo : list) { |
| | | String json = objectMapper.writeValueAsString(vo); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("faultType", vo.getFaultType(), item, "fault_reason_category"); |
| | | if (item.get("faultType" + CommonConstant.DICT_TEXT_SUFFIX) != null) { |
| | | items.add(item); |
| | | } |
| | | } |
| | | return Result.OK(items); |
| | | } catch (Exception e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |