From 87794ed4e7b7cf7b13f7deef5da3e3ff03255d81 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期日, 04 八月 2024 23:01:09 +0800 Subject: [PATCH] 检验任务负责人展示修改 --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 137 +++++++++++++++++++-------------------------- 1 files changed, 58 insertions(+), 79 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java index a01ae4a..97e187c 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java @@ -135,6 +135,7 @@ @Resource private InsOrderFileMapper insOrderFileMapper; + @Override public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { Map<String, Object> map = new HashMap<>(); @@ -153,13 +154,15 @@ laboratory = departLims; } } - Integer userId =null; - if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId()) ) { + String userName = null; + Integer userId = null; + if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { userId = map1.get("userId"); - insOrderPlanDTO.setUserId(userId.longValue()); + userName=userMapper.selectById(map1.get("userId")).getName(); + insOrderPlanDTO.setUserId(null); } String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹� - IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory); + IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userName, sonLaboratory, laboratory); map.put("body", insOrderPage); return map; } @@ -187,7 +190,7 @@ insOrderPlanDTO.setUserId(userId.longValue()); } String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹� - IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory); + IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory); map.put("body", insOrderPage); return map; } @@ -200,7 +203,7 @@ } Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); Integer userId = map1.get("userId"); - InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1,entity.getSonLaboratory()); + InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 0, entity.getSonLaboratory()); return insSampleUserMapper.insert(insSampleUser) > 0; } @@ -238,8 +241,6 @@ insProducts = insSampleMapper.getInsProduct3(id); break; } - // 鏁伴噰鏂板 - getDeviceMessage(insProducts, request); Set<Integer> set = new HashSet<>(); Map<Integer, String> map2 = new HashMap<>(); @@ -248,33 +249,6 @@ return insProducts; } - private List<InsProduct> getDeviceMessage(List<InsProduct> insProducts, HttpServletRequest request) { - String ipAddress = request.getRemoteAddr(); - // 闃叉鍥炵幆鍦板潃鍙樹负IPv6 - String ip = ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress; - insProducts.forEach(i -> { - Map<String, Object> devices = baseMapper.getDeviceMessage(ip, i.getInspectionItem(), i.getInspectionItemSubclass(), i.getSampleType()); - if (ObjectUtils.isNotEmpty(devices) && ObjectUtils.isNotEmpty(devices.get("file_type")) && ObjectUtils.isNotEmpty(devices.get("collect_url"))) { - InsProductResult insProductResult = i.getInsProductResult(); - if (ObjectUtils.isEmpty(insProductResult)) { - insProductResult = new InsProductResult(); - } - List<Object> list = new ArrayList<>(); - Map<Object, Object> hashMap = new HashMap<>(); - hashMap.put("v", devices.get("device_name")); - list.add(hashMap); - insProductResult.setEquipName(JSON.toJSON(list).toString()); - List<Object> listValue = new ArrayList<>(); - Map<Object, Object> hashMapValue = new HashMap<>(); - hashMapValue.put("v", devices.get("management_number")); - listValue.add(hashMapValue); - insProductResult.setEquipName(JSON.toJSON(list).toString()); - insProductResult.setEquipValue(JSON.toJSON(listValue).toString()); - i.setInsProductResult(insProductResult); - } - }); - return insProducts; - } @Override public List<String> checkSubmitPlan(Integer orderId, String laboratory) { List<String> collect = new ArrayList<>(); @@ -353,9 +327,9 @@ for (InsFibers insFiber : insFibers) { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFibersId, insFiber.getId())); List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); - if (insProducts.size()==collect.size()) { + if (insProducts.size() == collect.size()) { insFiber.setState(1);//宸叉楠� - }else { + } else { insFiber.setState(0);//鏈楠� } } @@ -365,9 +339,9 @@ for (InsFiber insFiber : fiberList) { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); - if (insProducts.size()==collect.size()) { + if (insProducts.size() == collect.size()) { insFiber.setState(1);//宸叉楠� - }else { + } else { insFiber.setState(0);//鏈楠� } } @@ -378,9 +352,9 @@ for (InsFiber insFiber : insFiberList) { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); - if (insProducts.size()==collect.size()) { + if (insProducts.size() == collect.size()) { insFiber.setState(1);//宸叉楠� - }else { + } else { insFiber.setState(0);//鏈楠� } } @@ -403,7 +377,7 @@ //鍏堟煡鍑鸿繖涓牱鍝佷笅鏈夊摢浜涚鑹叉爣,鍏夌氦甯�,鍏夌氦鑹叉爣 //鍏堟煡鍑哄绠� List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId)); - if (insBushings.size()>0) { + if (insBushings.size() > 0) { //閫氫俊--娓╁害寰幆 for (InsBushing insBushing : insBushings) { //鍐嶆煡璇㈠嚭鎵�鏈夌殑鍏夌氦甯� @@ -430,13 +404,13 @@ insProduct.setInsProductResult(insProductResult); } //姹傚悓绛夋潯浠朵笅1娆″惊鐜�20搴﹀父娓╃殑璁$畻鍊� - InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() - .eq(InsProduct::getInsSampleId,sampleId) + InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, sampleId) .eq(InsProduct::getInspectionItem, "1") .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)") .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass()) - .eq(InsProduct::getInsFiberId, fiber.getId())).getId() )); - if (ObjectUtils.isNotEmpty(insProductResult1) &&!insProductResult1.getComValue().equals("[]")) { + .eq(InsProduct::getInsFiberId, fiber.getId())).getId())); + if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) { insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]); } productVo.setInsProduct(insProduct); @@ -444,8 +418,7 @@ } } } - } - else { + } else { //濡傛灉濂楃涓嬫病鏈夊厜绾ゅ甫灏卞彧鏈夊厜绾や簡 List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId())); for (InsFiber fiber : insFiberList) { @@ -463,12 +436,12 @@ productVo.setBushColor(fiber.getBushColor()); insProduct.setInsProductResult(insProductResult); //姹傚悓绛夋潯浠朵笅1娆″惊鐜�20搴﹀父娓╃殑璁$畻鍊� - InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() - .eq(InsProduct::getInsSampleId,sampleId) + InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() + .eq(InsProduct::getInsSampleId, sampleId) .eq(InsProduct::getInspectionItem, "1") .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)") .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass()) - .eq(InsProduct::getInsFiberId, fiber.getId())).getId() )); + .eq(InsProduct::getInsFiberId, fiber.getId())).getId())); if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) { insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]); } @@ -479,8 +452,7 @@ } } productVos = productVos.stream().sorted(Comparator.comparing(productVo -> productVo.getInsProduct().getInspectionItemClass())).collect(Collectors.toList()); - } - else { + } else { //鐢靛姏--鐑惊鐜拰娓╁崌璇曢獙 List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() .eq(InsProduct::getInsSampleId, sampleId) @@ -564,6 +536,7 @@ insProduct.setLastValue(o.equals("") ? null : (o.toString())); } } catch (Exception e) { + insProduct.setLastValue("");//'' } if (jo.get("equipValue") != null) { JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue"))); @@ -592,6 +565,7 @@ String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + ""; insProduct.setInsResult(Integer.parseInt(ir)); } catch (Exception e) { + insProduct.setInsResult(2);//寰呭畾 } if (BeanUtil.isEmpty(result.getId())) { result.setCreateUser(userId); @@ -616,15 +590,22 @@ PerformanceShift performanceShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery() .eq(PerformanceShift::getUserId, userId) .eq(PerformanceShift::getWorkTime, today)); - if (ObjectUtils.isNotEmpty(performanceShift)){ + if (ObjectUtils.isNotEmpty(performanceShift)) { ShiftTime shiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, performanceShift.getShift())); - if (ObjectUtils.isNotEmpty(shiftTime)){ + if (ObjectUtils.isNotEmpty(shiftTime)) { DateTimeFormatter forma = DateTimeFormatter.ofPattern("HH:mm"); LocalTime now = LocalTime.now(); LocalTime startTime = LocalTime.parse(shiftTime.getStartTime(), forma); LocalTime endTime = LocalTime.parse(shiftTime.getEndTime(), forma); // 妫�鏌ュ綋鍓嶆椂闂存槸鍚﹀湪鑼冨洿鍐咃紙鍖呮嫭杈圭晫锛� - boolean isWithinRange = !now.isBefore(startTime) && !now.isAfter(endTime); + boolean isWithinRange; + if (endTime.isAfter(startTime)) { + // 涓嶈法澶╃殑鎯呭喌 + isWithinRange = !now.isBefore(startTime) && !now.isAfter(endTime); + } else { + // 璺ㄥぉ鐨勬儏鍐� + isWithinRange = !now.isBefore(startTime) || !now.isAfter(endTime); + } //鍔犵彮 AuxiliaryOutputWorkingHours count1 = auxiliaryOutputWorkingHoursMapper.selectOne(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() .eq(AuxiliaryOutputWorkingHours::getCheck, userId) @@ -637,7 +618,7 @@ .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem()) .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass()) .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())); - if (ObjectUtils.isNotEmpty(insProduct.getManHour())&& ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) { + if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) { AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); if (isWithinRange) { //鍦ㄦ椂闂村唴灏辨槸姝e父涓婄彮 @@ -647,7 +628,7 @@ auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙� auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//闈炲姞鐝伐鏃� auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲� - auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime())?auxiliaryOutputWorkingHours.getOvertimeWorkTime():0)+(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime())?auxiliaryOutputWorkingHours.getWorkTime():0));//浜ч噺宸ユ椂 + auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//浜ч噺宸ユ椂 auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); @@ -665,7 +646,7 @@ auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//鍔犵彮濮旀墭鍗曞彿 auxiliaryOutputWorkingHours.setOvertimeWorkTime(insProduct.getManHour());//鍔犵彮宸ユ椂 auxiliaryOutputWorkingHours.setOvertimeAmount(1);//鍔犵彮鏁伴噺 - auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime())?auxiliaryOutputWorkingHours.getOvertimeWorkTime():0)+(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime())?auxiliaryOutputWorkingHours.getWorkTime():0));//浜ч噺宸ユ椂 + auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//浜ч噺宸ユ椂 auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); @@ -727,7 +708,7 @@ //浜ゆ帴 @Override - public int upPlanUser(Integer userId, Integer orderId,String sonLaboratory) { + public int upPlanUser(Integer userId, Integer orderId, String sonLaboratory) { InsSampleUser insSampleUser = new InsSampleUser(); insSampleUser.setUserId(userId); insSampleUser.setInsSampleId(orderId); @@ -1111,8 +1092,8 @@ if (i % number == 0) { List<RowRenderData> rows = new ArrayList<>(); //琛ㄦ牸鐨勮鏁� 脳 鈭� 鉁� 鉁� - long count1 = size-(index-1)*number < number ? size-(index-1)*number + 3 : number + 3; - for (int j = 0; j <count1 ; j++) { + long count1 = size - (index - 1) * number < number ? size - (index - 1) * number + 3 : number + 3; + for (int j = 0; j < count1; j++) { RowRenderData rowRenderData = new RowRenderData(); RowStyle rowStyle = new RowStyle(); rowStyle.setHeight(40); @@ -1154,8 +1135,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } - } - else if (j == 1) { + } else if (j == 1) { //绗簩琛� if (k == 0) { //绗竴鍒� @@ -1198,8 +1178,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } - } - else if (j == count1-1) { + } else if (j == count1 - 1) { //鏈�鍚庝竴琛� if (k == 0 || k == 1) { //鍓嶄袱鍒� @@ -1217,8 +1196,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } - } - else { + } else { if (k == 0) { //绗竴鍒� textRenderData.setText((j - 1) + ""); @@ -1586,7 +1564,7 @@ if (i % 16 == 0) { //鏍峰搧鏁伴噺瓒呰繃16闇�瑕佹柊澧炶〃鏍� List<RowRenderData> rows = new ArrayList<>(); - int count2 = sampleList.size()-(index41-1)*16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17; + int count2 = sampleList.size() - (index41 - 1) * 16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17; //琛ㄦ牸鐨勮鏁� for (int j = 0; j < count2; j++) { RowRenderData rowRenderData = new RowRenderData(); @@ -1642,8 +1620,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } - } - else { + } else { if (k == 0) { //绗竴鍒� textRenderData.setText(sampleList.get(0).getModel() + "鈭�44"); @@ -1782,7 +1759,7 @@ } catch (Exception e) { throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�"); } - if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) { + if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) { throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�"); } //Custom custom = customMapper.selectById(user.get("company")); @@ -3472,8 +3449,7 @@ } catch (IOException e) { throw new RuntimeException(e); } - } - else { + } else { //澶嶆牳涓嶉�氳繃灏嗘妸澶嶆牳鐨勮礋璐d汉鍘绘帀 Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId(); insSampleUserMapper.deleteById(id); @@ -3515,7 +3491,11 @@ .in(InsProduct::getInsSampleId, ids) .eq(InsProduct::getSonLaboratory, laboratory) .eq(InsProduct::getState, 1) - .isNull(InsProduct::getInsResult) + .and(wrapper -> wrapper + .isNull(InsProduct::getInsResult) + .or() + .eq(InsProduct::getInsResult, 2) + ) .isNull(InsProduct::getInsFiberId) .isNull(InsProduct::getInsFibersId)); insProducts.addAll(insProductMapper.selectFiberInsProduct(ids, laboratory)); @@ -3541,7 +3521,7 @@ insProductMapper.updateById(product); } //濡傛灉鏄儹寰幆鎴栬�呮槸娓╁崌璇曢獙 - else if (product.getInspectionItem().equals("鐑惊鐜�") || product.getInspectionItem().equals("娓╁崌璇曢獙")){ + else if (product.getInspectionItem().equals("鐑惊鐜�") || product.getInspectionItem().equals("娓╁崌璇曢獙")) { //鏌ヨ杩欎簺椤圭洰涓嬬殑鍏朵粬妫�楠岄」鐩槸鍚﹀叏閮ㄦ楠� List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() .eq(InsProduct::getInsSampleId, product.getInsSampleId()) @@ -3557,8 +3537,7 @@ product.setInsResult(1); } insProductMapper.updateById(product); - } - else { + } else { count++; str += "<br/>" + count + "锛�" + product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>"; } @@ -3583,7 +3562,7 @@ InsSampleUser insSampleUser = new InsSampleUser(); insSampleUser.setUserId(verifyUser); insSampleUser.setInsSampleId(orderId); - insSampleUser.setState(0); + insSampleUser.setState(1); insSampleUser.setSonLaboratory(laboratory); insSampleUserMapper.insert(insSampleUser); /*鏍¢獙涓�涓媟esult琛�*/ -- Gitblit v1.9.3