| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.EquipmentAvailabilityVo; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | HttpServletRequest req) { |
| | | Page<RepairOrder> page = new Page<RepairOrder>(pageNo, pageSize); |
| | | IPage<RepairOrder> pageList = repairOrderService.getRepairOrderList(page, repairOrder); |
| | | for(RepairOrder repairOrder1 : pageList.getRecords()){ |
| | | if(StringUtils.isNotBlank(repairOrder1.getReportRepairId())){ |
| | | EquipmentReportRepair equipmentReportRepair = equipmentReportRepairService.getById(repairOrder1.getReportRepairId()); |
| | | repairOrder1.setReportRepairNum(equipmentReportRepair.getNum()); |
| | | } |
| | | if(StringUtils.isNotBlank(repairOrder1.getProjectMaintenanceOrderId())){ |
| | | ProjectMaintenanceOrderDetail projectMaintenanceOrderDetail = projectMaintenanceOrderDetailService.getById(repairOrder1.getProjectMaintenanceOrderId()); |
| | | repairOrder1.setProjectMaintenanceOrderNum(projectMaintenanceOrderDetail.getTaskNum()); |
| | | } |
| | | |
| | | String id = repairOrder1.getId(); |
| | | QueryWrapper<RepairOrderActualWorkHours> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("repair_order_id", id) |
| | | .eq("del_flag", 0); |
| | | wrapper.select("sum(actual_hour) as actualHour"); |
| | | Map<String, Object> map = repairOrderActualWorkHoursService.getMap(wrapper); |
| | | BigDecimal actualHour = new BigDecimal(0); |
| | | if (map != null) { |
| | | actualHour = (BigDecimal) map.get("actualHour"); |
| | | } |
| | | repairOrder1.setActualHour(actualHour); |
| | | } |
| | | // for(RepairOrder repairOrder1 : pageList.getRecords()){ |
| | | // if(StringUtils.isNotBlank(repairOrder1.getReportRepairId())){ |
| | | // EquipmentReportRepair equipmentReportRepair = equipmentReportRepairService.getById(repairOrder1.getReportRepairId()); |
| | | // repairOrder1.setReportRepairNum(equipmentReportRepair.getNum()); |
| | | // } |
| | | // if(StringUtils.isNotBlank(repairOrder1.getProjectMaintenanceOrderId())){ |
| | | // ProjectMaintenanceOrderDetail projectMaintenanceOrderDetail = projectMaintenanceOrderDetailService.getById(repairOrder1.getProjectMaintenanceOrderId()); |
| | | // repairOrder1.setProjectMaintenanceOrderNum(projectMaintenanceOrderDetail.getTaskNum()); |
| | | // } |
| | | // |
| | | // String id = repairOrder1.getId(); |
| | | // QueryWrapper<RepairOrderActualWorkHours> wrapper = new QueryWrapper<>(); |
| | | // wrapper.eq("repair_order_id", id) |
| | | // .eq("del_flag", 0); |
| | | // wrapper.select("sum(actual_hour) as actualHour"); |
| | | // Map<String, Object> map = repairOrderActualWorkHoursService.getMap(wrapper); |
| | | // BigDecimal actualHour = new BigDecimal(0); |
| | | // if (map != null) { |
| | | // actualHour = (BigDecimal) map.get("actualHour"); |
| | | // } |
| | | // repairOrder1.setActualHour(actualHour); |
| | | // } |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | repairOrderService.updateById(repairOrder); |
| | | return Result.OK("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 设备完好率 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/equipmentAvailability") |
| | | public JSONObject equipmentAvailability(@RequestParam Map<String, String> query) throws ParseException { |
| | | List<EquipmentAvailabilityVo> list = repairOrderService.equipmentAvailability(query); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",list); |
| | | return jsonObject; |
| | | } |
| | | |
| | | /** |
| | | * 设备可开动率 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/getStartRate") |
| | | public JSONObject getStartRate(@RequestParam Map<String, String> query) throws ParseException { |
| | | List<EquipmentAvailabilityVo> list = repairOrderService.getStartRate(query); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",list); |
| | | return jsonObject; |
| | | } |
| | | } |