| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | 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.IEamInspectionOrderService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | | import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService; |
| | | import org.jeecg.modules.eam.vo.EquipmentInspectionStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentMaintenanceStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentRepairStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentStatusStatistics; |
| | | import org.jeecg.modules.eam.vo.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | |
| | |
| | | private IEamInspectionOrderService inspectionOrderService; |
| | | @Autowired |
| | | private IEamWeekMaintenanceOrderService weekMaintenanceOrderService; |
| | | @Resource |
| | | private ObjectMapper objectMapper; |
| | | |
| | | @Resource |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | |
| | | @ApiOperation(value = "看板接口-维保状态统计", notes = "看板接口-维保状态统计") |
| | | @GetMapping(value = "/equipmentStatusStatistics") |
| | |
| | | resultList.sort(Comparator.comparing(EquipmentMaintenanceStatistics::getMonthStr)); |
| | | return Result.ok(resultList); |
| | | } |
| | | |
| | | @ApiOperation(value = "维修看板-维修状态统计", notes = "维修看板-维修状态统计") |
| | | @GetMapping(value = "/repairStatusStatistics") |
| | | public Result<?> repairStatusStatistics() { |
| | | EquipmentRepairStatusStatistics statistics = reportRepairService.repairStatusStatistics(); |
| | | return Result.OK(statistics); |
| | | } |
| | | |
| | | @ApiOperation(value = "维修看板-维修列表", notes = "维修看板-维修列表") |
| | | @GetMapping(value = "/repairList") |
| | | public Result<?> repairList() { |
| | | List<EquipmentRepairListVO> list = reportRepairService.repairList(); |
| | | if(CollectionUtil.isEmpty(list)) { |
| | | return Result.ok(Collections.emptyList()); |
| | | } |
| | | List<JSONObject> items = new ArrayList<>(); |
| | | try { |
| | | 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"); |
| | | translateDictTextUtils.translateField("repairOperator", vo.getRepairOperator(), item, "sys_user,realname,username"); |
| | | translateDictTextUtils.translateField("reportStatus", vo.getReportStatus(), item, "report_repair_status"); |
| | | translateDictTextUtils.translateField("orgId", vo.getOrgId(), item, "mdc_production,production_name,id"); |
| | | items.add(item); |
| | | } |
| | | return Result.OK(items); |
| | | }catch (Exception e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "维修看板-维修工排名", notes = "维修看板-维修工排名") |
| | | @GetMapping(value = "/repairmanRanking") |
| | | public Result<?> repairmanRanking() { |
| | | return null; |
| | | } |
| | | } |