zhangherong
2025-05-09 8203359e4e68775b3ce0e540837bf3332d970798
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java
@@ -13,10 +13,7 @@
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;
@@ -43,9 +40,11 @@
    private IEamWeekMaintenanceOrderService weekMaintenanceOrderService;
    @Resource
    private ObjectMapper objectMapper;
    @Resource
    private TranslateDictTextUtils translateDictTextUtils;
    @Autowired
    private IEamRepairOrderService repairOrderService;
    @ApiOperation(value = "看板接口-维保状态统计", notes = "看板接口-维保状态统计")
    @GetMapping(value = "/equipmentStatusStatistics")
@@ -194,6 +193,28 @@
    @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("数据转译失败!");
        }
    }
}