From 4371080df058a549cdaf31dddeca6c5fee58e23b Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期二, 10 六月 2025 15:31:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionOrderController.java | 365 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 345 insertions(+), 20 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionOrderController.java index 128eb2f..8dc1de8 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionOrderController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionOrderController.java @@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import org.apache.shiro.SecurityUtils; @@ -33,6 +34,7 @@ //import org.jeecg.modules.system.entity.SysUploadRela; //import org.jeecg.modules.system.service.IUploadRelaService; //import org.jeecg.modules.system.service.IUploadService; +import org.jeecg.modules.eam.vo.InspectionResultVo; import org.jeecg.modules.eam.vo.SysFileNameVo; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; @@ -91,6 +93,10 @@ @Lazy private IDailyInspectionStandardService dailyInspectionStandardService; + @Autowired + @Lazy + private IAreaService areaService; + // @Autowired // private IUploadRelaService uploadRelaService; // @@ -132,8 +138,8 @@ List<Map<String, Object>> records = inspectionOrderList.getRecords(); for (Map<String, Object> record : records) { String id = (String)record.get("id"); - String equipmentId = (String)record.get("equipmentId"); - String status = (String)record.get("status"); +// String equipmentId = (String)record.get("equipmentId"); +// String status = (String)record.get("status"); String inspectionStandardId = (String)record.get("inspectionStandardId"); List<InspectionCycleVo> inspectionCycles = inspectionOrderService.getInspectionCycleByEqId(inspectionStandardId); record.put("inspectionCycles",inspectionCycles); @@ -142,22 +148,22 @@ record.put("inspectionOrderDetails",inspectionOrderDetails); - List<InspectionOrderDetail> failCount = inspectionOrderDetailService.lambdaQuery() - .eq(InspectionOrderDetail::getInspectionOrderId, id) - .eq(InspectionOrderDetail::getJudgmentResult, "fail") - .eq(InspectionOrderDetail::getDelFlag, 0).list(); +// List<InspectionOrderDetail> failCount = inspectionOrderDetailService.lambdaQuery() +// .eq(InspectionOrderDetail::getInspectionOrderId, id) +// .eq(InspectionOrderDetail::getJudgmentResult, "fail") +// .eq(InspectionOrderDetail::getDelFlag, 0).list(); +// +// List<InspectionOrderDetail> passCount = inspectionOrderDetailService.lambdaQuery() +// .eq(InspectionOrderDetail::getInspectionOrderId, id) +// .eq(InspectionOrderDetail::getJudgmentResult,"pass") +// .eq(InspectionOrderDetail::getDelFlag, 0).list(); +// record.put("result","姝e父:"+passCount.size()+"锛�"+"寮傚父:"+failCount.size()); - List<InspectionOrderDetail> passCount = inspectionOrderDetailService.lambdaQuery() - .eq(InspectionOrderDetail::getInspectionOrderId, id) - .eq(InspectionOrderDetail::getJudgmentResult,"pass") - .eq(InspectionOrderDetail::getDelFlag, 0).list(); - record.put("result","姝e父:"+passCount.size()+"锛�"+"寮傚父:"+failCount.size()); - - if("5".equals(status) ){ - record.put("distable",true); - }else{ - record.put("distable",false); - } +// if("5".equals(status) ){ +// record.put("distable",true); +// }else{ +// record.put("distable",false); +// } } return Result.ok(inspectionOrderList); } @@ -187,6 +193,7 @@ } inspectionOrder.setInspectionDeadline(date); inspectionOrder.setInspectionStandardType("1"); + inspectionOrder.setStatus("3");//3:鏈紑濮� inspectionOrderService.save(inspectionOrder); String equipmentId = inspectionOrder.getEquipmentId(); @@ -197,11 +204,13 @@ for (InspectionOrderDetail inspectionOrderDetail : inspectionOrderDetailList) { String id = inspectionOrder.getId(); String inspectionStandardDetailId = inspectionOrderDetail.getInspectionStandardDetailId(); + //鐐规椤圭洰id String inspectionProjectId = inspectionOrderDetail.getInspectionProjectId(); - + //鐐规鏍囧噯 DailyInspectionStandardDetail dailyInspectionStandardDetail = dailyInspectionStandardDetailService.getById(inspectionStandardDetailId); + //鐐规椤圭洰 InspectionProject inspectionProject = inspectionProjectService.getById(inspectionProjectId); - + //鐐规鏄庣粏娣诲姞 inspectionOrderDetail.setId(""); inspectionOrderDetail.setInspectionOrderId(id); inspectionOrderDetail.setLocation(dailyInspectionStandardDetail.getLocation()); @@ -216,11 +225,18 @@ inspectionOrderDetailService.save(inspectionOrderDetail); } }else{ + //鐢熶骇绾胯澶囷紝鎸夌収鐢熶骇绾挎潵杩涜鐐规 String lineId = equipment.getLineId(); + if(StringUtils.isBlank(lineId)){ + return Result.error("鐢熶骇绾胯澶囨病鏈夊叧鑱斿埌浜х嚎缂栧彿"); + } List<DailyInspectionStandard> dailyInspectionStandards = dailyInspectionStandardService.lambdaQuery() .eq(DailyInspectionStandard::getEquipmentId, lineId) .eq(DailyInspectionStandard::getVersionStatus, "2") .eq(DailyInspectionStandard::getDelFlag, "0").list(); + if(CollectionUtils.isEmpty(dailyInspectionStandards)){ + return Result.error("璁惧瀵瑰簲鐨勪骇绾挎病鏈夐厤缃偣妫�鏍囧噯"); + } if(dailyInspectionStandards.size()>0) { DailyInspectionStandard dailyInspectionStandard = dailyInspectionStandards.get(0); //淇濆瓨鐐规宸ュ崟瀛愯〃鏁版嵁 @@ -555,6 +571,7 @@ equipmentReportRepair.setNum(num); equipmentReportRepair.setStatus("1"); equipmentReportRepair.setSource("2"); + equipmentReportRepair.setType("2");//绫诲瀷锛�1琚姩鎶ヤ慨锛�2涓诲姩鎶ヤ慨锛� equipmentReportRepair.setIsCreateOrder(0); equipmentReportRepair.setEquipmentId(inspectionOrder.getEquipmentId()); equipmentReportRepair.setFaultDescription(orderDetail.getAbnormalDesc()); @@ -568,6 +585,7 @@ } } inspectionOrder.setActualEndTime(new Date()); + inspectionOrder.setInspectionOrderUda2(sysUser.getRealname()); boolean b = inspectionOrderService.updateById(inspectionOrder); if (!b) { return Result.error("鎶ュ伐澶辫触!"); @@ -596,4 +614,311 @@ } } -} + + /** + *鐢熶骇璁惧鑷富缁存姢鐐规琛� 鎶ヨ〃 + * 2024-3-27 qsw + */ + @GetMapping("findInspectionProjectList") + public Result<?> findInspectionProjectList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, + @RequestParam Map<String, Object> params) { + IPage<Map<String, Object>> dayInspectionProjectList = inspectionOrderService.findDayInspectionProjectList(pageNo, 1000, params); + List<Map<String, Object>> records = dayInspectionProjectList.getRecords(); + List<Map<String, Object>> maps = new ArrayList<>(); + for (Map<String, Object> record : records) { + if(maps.size()>0){ + Boolean flag = false; + for (Map<String, Object> map : maps) { + if(map.containsValue(record.get("name")) && map.containsValue(record.get("detectionStandard"))){ + map.put(record.get("createTime").toString(),record.get("insResult")); + flag = true; + } + } + if(flag == false){ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("name",record.get("name")); + hashMap.put("equipmentNum",record.get("equipmentNum")); + hashMap.put("equipmentName",record.get("equipmentName")); + hashMap.put("detectionStandard",record.get("detectionStandard")); + hashMap.put(record.get("createTime").toString(),record.get("insResult")); + maps.add(hashMap); + } + }else{ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("name",record.get("name")); + hashMap.put("equipmentNum",record.get("equipmentNum")); + hashMap.put("equipmentName",record.get("equipmentName")); + hashMap.put("detectionStandard",record.get("detectionStandard")); + hashMap.put(record.get("createTime").toString(),record.get("insResult")); + maps.add(hashMap); + } + } + return Result.ok(maps); + } + + /** + *鐢熶骇璁惧鑷富缁存姢鍛ㄧ偣妫�琛� 鎶ヨ〃 + * 2024-3-27 qsw + */ + @GetMapping("findWeekInspectionProjectList") + public Result<?> findWeekInspectionProjectList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, + @RequestParam Map<String, Object> params) { + IPage<Map<String, Object>> dayInspectionProjectList = inspectionOrderService.findWeekInspectionProjectList(pageNo, 1000, params); + List<Map<String, Object>> records = dayInspectionProjectList.getRecords(); + List<Map<String, Object>> maps = new ArrayList<>(); + for (Map<String, Object> record : records) { + if(maps.size()>0){ + Boolean flag = false; + for (Map<String, Object> map : maps) { + if(map.containsValue(record.get("name")) && map.containsValue(record.get("detectionStandard"))){ + map.put(record.get("createTime").toString(),record.get("insResult")); + flag = true; + } + } + if(flag == false){ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("name",record.get("name")); + hashMap.put("equipmentNum",record.get("equipmentNum")); + hashMap.put("equipmentName",record.get("equipmentName")); + hashMap.put("detectionStandard",record.get("detectionStandard")); + hashMap.put(record.get("createTime").toString(),record.get("insResult")); + maps.add(hashMap); + } + }else{ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("name",record.get("name")); + hashMap.put("equipmentNum",record.get("equipmentNum")); + hashMap.put("equipmentName",record.get("equipmentName")); + hashMap.put("detectionStandard",record.get("detectionStandard")); + hashMap.put(record.get("createTime").toString(),record.get("insResult")); + maps.add(hashMap); + } + } + return Result.ok(maps); + } + + + /** + *鐢熶骇璁惧鑷富缁存姢鐐规琛� 鎶ヨ〃 + * 2024-3-27 qsw + */ + @GetMapping("findInspectionForms") + public Result<?> findInspectionForms(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, + @RequestParam Map<String, Object> params) { + + HashMap<String, Object> mapResult = new HashMap<>(); + + String equipmentNum = (String)params.get("num"); + String dataTime = (String)params.get("dataTime"); + Equipment equipment = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getNum, equipmentNum).eq(Equipment::getDelFlag, 0)); + if(equipment == null){ + return Result.error("璁惧缁熶竴缂栧彿涓嶅瓨鍦紒"); + } + String workCenterId = equipment.getWorkCenterId(); + Area area = areaService.getById(workCenterId); + +// DailyInspectionStandard standard = dailyInspectionStandardService.getOne(new LambdaQueryWrapper<DailyInspectionStandard>() +// .eq(DailyInspectionStandard::getEquipmentId, equipment.getId()) +// .eq(DailyInspectionStandard::getDelFlag, 0) +// .eq(DailyInspectionStandard::getVersionStatus, "2")); + List<DailyInspectionStandard> list = dailyInspectionStandardService.lambdaQuery().eq(DailyInspectionStandard::getEquipmentId, equipment.getId()) + .eq(DailyInspectionStandard::getDelFlag, 0) + .eq(DailyInspectionStandard::getVersionStatus, "2").list(); + + + List<Map<String, Object>> list1 = this.getInspectionStandars(equipmentNum,"day",dataTime); + List<Map<String, Object>> list2 = this.getUserQianzi(equipmentNum,"day",dataTime); + List<Map<String, Object>> list3 = this.getCheckUserQianzi(equipmentNum,"day",dataTime); + List<Map<String, Object>> list4 = this.getInspectionStandars(equipmentNum, "week",dataTime); + List<Map<String, Object>> list5 = this.getUserQianzi(equipmentNum,"week",dataTime); + List<Map<String, Object>> list6 = this.getCheckUserQianzi(equipmentNum,"week",dataTime); + + mapResult.put("equipentNum",equipment.getNum()); + mapResult.put("equipentName",equipment.getName()); + mapResult.put("equipmentModel",equipment.getModel()); + mapResult.put("equipmentModel",equipment.getModel()); + if(area != null){ + mapResult.put("workCenterName",area.getName()); + } + if(list.size() > 0){ + mapResult.put("regulations",list.get(0).getDisUda1()); + }else{ + mapResult.put("regulations","-"); + } + mapResult.put("list1",list1); + mapResult.put("list2",list2); + mapResult.put("list3",list3); + mapResult.put("list4",list4); + mapResult.put("list5",list5); + mapResult.put("list6",list6); + + return Result.ok(mapResult); + } + + List<Map<String, Object>> getInspectionStandars(String equipmentNum,String cycleUnit,String dataTime){ + List<Map<String, Object>> maps = new ArrayList<>(); + List<Map<String, Object>> dayInspectionStandard = inspectionOrderService.findDayInspectionStandard(equipmentNum,cycleUnit); + for (Map<String, Object> map : dayInspectionStandard) { + String name = (String)map.get("name"); + String detectionStandard = (String)map.get("detectionStandard"); + List<Map<String, Object>> record = inspectionOrderService.findDayInspectionStandardProject(equipmentNum,name, detectionStandard,dataTime); + List<InspectionResultVo> listS = new ArrayList<>(); + for (Map<String, Object> r : record) { + + if(maps.size()>0){ + Boolean flag = false; + for (Map<String, Object> map1 : maps) { + if(map1.containsValue(r.get("name")) && map1.containsValue(r.get("detectionStandard"))){ + map1.put(r.get("dayTime").toString(),r.get("insResult")); + flag = true; + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)r.get("dayTime")); + inspectionResultVo.setWeekOfMonth((Integer)r.get("weekOfMonth")); + inspectionResultVo.setInsResult((String)r.get("insResult")); + listS.add(inspectionResultVo); + + map1.put("dataList",listS); + + } + } + if(flag == false){ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("name",r.get("name")); + hashMap.put("detectionStandard",r.get("detectionStandard")); + +// hashMap.put(r.get("dayTime").toString(),r.get("insResult")); + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)r.get("dayTime")); + inspectionResultVo.setWeekOfMonth((Integer)r.get("weekOfMonth")); + inspectionResultVo.setInsResult((String)r.get("insResult")); + listS.add(inspectionResultVo); + + hashMap.put("dataList",listS);//---- + maps.add(hashMap); + } + }else{ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("name",r.get("name")); + hashMap.put("detectionStandard",r.get("detectionStandard")); +// hashMap.put(r.get("dayTime").toString(),r.get("insResult")); + + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)r.get("dayTime")); + inspectionResultVo.setInsResult((String)r.get("insResult")); + inspectionResultVo.setWeekOfMonth((Integer)r.get("weekOfMonth")); + listS.add(inspectionResultVo); + hashMap.put("dataList",listS); + + maps.add(hashMap); + } + } + } + return maps; + } + + List<Map<String, Object>> getUserQianzi(String equipmentNum,String cycleUnit,String dataTime){ + List<Map<String, Object>> maps2 = new ArrayList<>(); + List<InspectionResultVo> listIn = new ArrayList<>(); + List<Map<String, Object>> userQianZi = inspectionOrderService.getUserQianZi(equipmentNum,cycleUnit,dataTime); + for (Map<String, Object> map : userQianZi) { + if(maps2.size()>0){ + Boolean flag = false; + for (Map<String, Object> map1 : maps2) { + if(map1.containsValue("缁存姢璐d换浜虹瀛�")){ +// map1.put(map.get("dayTime").toString(),map.get("inspectionUserName")); + flag = true; + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)map.get("dayTime")); + inspectionResultVo.setInspectionUserName((String)map.get("inspectionUserName")); + inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); + listIn.add(inspectionResultVo); + + map1.put("dataList",listIn); + } + } + if(flag == false){ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("inspectionUserName","缁存姢璐d换浜虹瀛�"); +// hashMap.put(map.get("dayTime").toString(),map.get("inspectionUserName")); +// maps2.add(hashMap); + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)map.get("dayTime")); + inspectionResultVo.setInspectionUserName((String)map.get("inspectionUserName")); + inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); + listIn.add(inspectionResultVo); + hashMap.put("dataList",listIn);//--- + hashMap.put("dataList",listIn); + } + }else{ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("inspectionUserName","缁存姢璐d换浜虹瀛�"); +// hashMap.put(map.get("dayTime").toString(),map.get("inspectionUserName")); +// maps2.add(hashMap); + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)map.get("dayTime")); + inspectionResultVo.setInspectionUserName((String)map.get("inspectionUserName")); + inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); + listIn.add(inspectionResultVo); + hashMap.put("dataList",listIn); + + maps2.add(hashMap); + } + } + return maps2; + } + + List<Map<String, Object>> getCheckUserQianzi(String num,String cycleUnit,String dataTime){ + List<Map<String, Object>> maps3 = new ArrayList<>(); + List<InspectionResultVo> listRe = new ArrayList<>(); + List<Map<String, Object>> checkUserQianZi = inspectionOrderService.getUserQianZi(num,cycleUnit,dataTime); + for (Map<String, Object> map : checkUserQianZi) { + if(maps3.size()>0){ + Boolean flag = false; + for (Map<String, Object> map1 : maps3) { + if(map1.containsValue("妫�鏌ヨ矗浠讳汉绛惧瓧")){ +// map1.put(map.get("dayTime").toString(),map.get("repairConfirmPerson")); + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)map.get("dayTime")); + inspectionResultVo.setRepairConfirmPerson((String)map.get("repairConfirmPerson")); + inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); + listRe.add(inspectionResultVo); + + map1.put("dataList",listRe); + flag = true; + } + } + if(flag == false){ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("repairConfirmPerson","妫�鏌ヨ矗浠讳汉绛惧瓧"); +// hashMap.put(map.get("dayTime").toString(),map.get("repairConfirmPerson")); +// maps3.add(hashMap); + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)map.get("dayTime")); + inspectionResultVo.setRepairConfirmPerson((String)map.get("repairConfirmPerson")); + inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); + listRe.add(inspectionResultVo); + hashMap.put("dataList",listRe); + + maps3.add(hashMap);//--- + } + }else{ + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("repairConfirmPerson","妫�鏌ヨ矗浠讳汉绛惧瓧"); +// hashMap.put(map.get("dayTime").toString(),map.get("repairConfirmPerson")); +// maps3.add(hashMap); + InspectionResultVo inspectionResultVo = new InspectionResultVo(); + inspectionResultVo.setDayTime((String)map.get("dayTime")); + inspectionResultVo.setRepairConfirmPerson((String)map.get("repairConfirmPerson")); + inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); + listRe.add(inspectionResultVo); + hashMap.put("dataList",listRe); + + maps3.add(hashMap); + } + } + return maps3; + } + } -- Gitblit v1.9.3