From 182b0785c628e6b1134d51985a692d0df7a8fb85 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期二, 16 七月 2024 21:17:22 +0800 Subject: [PATCH] 区间改为& --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 100 insertions(+), 20 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java index 8f7c742..a67a306 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java @@ -148,8 +148,8 @@ } insSampleMapper.insert(a); if (ObjectUtil.isNotEmpty(a.getInsProduct())) { - addInsProductMethod(a.getId(), a.getInsProduct(), null, 0,false); - if (ObjectUtil.isNotEmpty(a.getBushing())){ + addInsProductMethod(a.getId(), a.getInsProduct(), null, 0, false); + if (ObjectUtil.isNotEmpty(a.getBushing())) { for (BushingDto bushingDto : a.getBushing()) { bushingDto.setInsSampleId(a.getId()); insBushingMapper.insert(bushingDto); @@ -157,10 +157,10 @@ for (FiberDto fiberDto : bushingDto.getFiber()) { fiberDto.setInsBushingId(bushingDto.getId()); insFiberMapper.insert(fiberDto); - addInsProductMethod(a.getId(), a.getInsProduct(), fiberDto.getId(), 2,true); - addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2,false); + addInsProductMethod(a.getId(), a.getInsProduct(), fiberDto.getId(), 2, true); + addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2, false); } - }else { + } else { for (FibersDto fibersDto : bushingDto.getFibers()) { fibersDto.setInsBushingId(bushingDto.getId()); fibersDto.setCode(this.giveCode.giveCode("", "ins_fibers", "", "yyMMdd")); @@ -168,11 +168,11 @@ for (FiberDto fiberDto : fibersDto.getFiber()) { fiberDto.setInsFibersId(fibersDto.getId()); insFiberMapper.insert(fiberDto); - addInsProductMethod(a.getId(), a.getInsProduct(), fiberDto.getId(), 2,true); - addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2,false); + addInsProductMethod(a.getId(), a.getInsProduct(), fiberDto.getId(), 2, true); + addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2, false); } //addInsProductMethod(a.getId(), a.getInsProduct(), fibersDto.getId(), 1); - addInsProductMethod(a.getId(), fibersDto.getProductList(), fibersDto.getId(), 1,false); + addInsProductMethod(a.getId(), fibersDto.getProductList(), fibersDto.getId(), 1, false); } } } @@ -186,13 +186,13 @@ for (InsProduct product : ip2) { product.setStandardMethodListId(a.getInsulating().getStandardMethodListId()); } - addInsProductMethod(a.getId(), ip2, null, 0,false); + addInsProductMethod(a.getId(), ip2, null, 0, false); } if (ObjectUtil.isNotEmpty(a.getSheath())) { for (InsProduct product : a.getSheath().getInsProduct()) { product.setStandardMethodListId(a.getSheath().getStandardMethodListId()); } - addInsProductMethod(a.getId(), a.getSheath().getInsProduct(), null, 0,false); + addInsProductMethod(a.getId(), a.getSheath().getInsProduct(), null, 0, false); } if (ObjectUtil.isNotEmpty(a.getChildSampleList())) { for (SampleProductDto b : a.getChildSampleList()) { @@ -205,7 +205,7 @@ } insSampleMapper.insert(b); if (ObjectUtil.isNotEmpty(b.getInsProduct())) { - addInsProductMethod(b.getId(), b.getInsProduct(), null, 0,false); + addInsProductMethod(b.getId(), b.getInsProduct(), null, 0, false); } } } @@ -218,7 +218,7 @@ for (FiberDto fiberDto : bushingDto.getFiber()) { fiberDto.setInsBushingId(bushingDto.getId()); insFiberMapper.insert(fiberDto); - addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2,false); + addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2, false); } } else { for (FibersDto fibersDto : bushingDto.getFibers()) { @@ -228,9 +228,9 @@ for (FiberDto fiberDto : fibersDto.getFiber()) { fiberDto.setInsFibersId(fibersDto.getId()); insFiberMapper.insert(fiberDto); - addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2,false); + addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2, false); } - addInsProductMethod(a.getId(), fibersDto.getProductList(), fibersDto.getId(), 1,false); + addInsProductMethod(a.getId(), fibersDto.getProductList(), fibersDto.getId(), 1, false); } } } @@ -254,7 +254,7 @@ return insOrder.getId(); } - private void addInsProductMethod(Integer sampleId, List<InsProduct> productList, Integer id, Integer type,Boolean is) { + private void addInsProductMethod(Integer sampleId, List<InsProduct> productList, Integer id, Integer type, Boolean is) { InsOrder insOrder = insOrderMapper.selectById(insSampleMapper.selectById(sampleId).getInsOrderId()); for (InsProduct product : productList) { if (product.getState() == 1 && !product.getInspectionItem().equals("鍏夌氦鎺ュご鎹熻��")) { @@ -263,7 +263,9 @@ List<InsProduct> insProductes = new ArrayList<>(); List<InsProduct> insProducts = new ArrayList<>(); String[] strings = product.getAsk().split(";"); + for (int i = 0; i < strings.length; i++) { + int count = Integer.parseInt(strings[strings.length - 1]); if (i != strings.length - 1) { InsProduct insProduct = new InsProduct(); switch (type) { @@ -275,7 +277,11 @@ break; } String[] split = strings[i].split(","); - insProduct.setInspectionItem("1");//妫�楠岄」--寰幆娆℃暟 + if (split[0].equals("20鈩�")) { + insProduct.setInspectionItem(count + "");//妫�楠岄」--寰幆娆℃暟 + } else { + insProduct.setInspectionItem("1");//妫�楠岄」--寰幆娆℃暟 + } insProduct.setInspectionItemSubclass(split[0]);//妫�楠岄」--娓╁害 insProduct.setInspectionItemClass(split[1]);//妫�楠岄」--鍏夌氦椤圭洰 insProduct.setAsk(split[2]);//妫�楠岃姹� @@ -296,14 +302,13 @@ insProductes.add(insProduct); } else { //鏈�鍚庝竴涓暟鎹槸璇存槑浼氬惊鐜灏戞 - int count = Integer.parseInt(strings[i]); if (count > 1) { //寰幆瓒呰繃1娆� for (int j = 2; j <= count; j++) { for (InsProduct insProduct : insProducts) { - if (!insProduct.getInspectionItemSubclass().equals("20鈩�")) { + if (!insProduct.getInspectionItemSubclass().equals("20鈩�") && !insProduct.getInspectionItemSubclass().equals("20鈩�(甯告俯)")) { InsProduct insProduct1 = new InsProduct(); - BeanUtils.copyProperties(insProduct,insProduct1); + BeanUtils.copyProperties(insProduct, insProduct1); insProduct1.setInspectionItem(j + ""); insProductes.add(insProduct1); } @@ -313,7 +318,67 @@ } } insProductService.saveBatch(insProductes); - } else { + } + //鍒ゆ柇鐑惊鐜」鐩殑娣诲姞鍜屾俯鍗囪瘯楠岄」鐩殑娣诲姞 + else if (product.getInspectionItem().equals("鐑惊鐜�") || product.getInspectionItem().equals("娓╁崌璇曢獙")) { + List<InsProduct> insProductess = new ArrayList<>(); + insProductess.add(product); + List<InsProduct> insProductes = new ArrayList<>(); + List<InsProduct> insProducts = new ArrayList<>(); + String[] strings = product.getAsk().split(";"); + //寰幆娆℃暟 + int count = Integer.parseInt(strings[strings.length - 1]); + for (int i = 0; i < strings.length - 1; i++) { + String[] split = strings[i].split(","); + InsProduct insProduct = new InsProduct(); + insProduct.setInspectionItem("1");//妫�楠岀埗椤�--寰幆娆℃暟 + insProduct.setInspectionItemSubclass(split[0]);//妫�楠屽瓙椤�--鐜娓╁害/瀵肩嚎娓╁害/鑰愬紶娓╁害/鎺ョ画娓╁害 + insProduct.setInspectionItemSubclassEn(split[1]);//妫�楠屽瓙椤硅嫳鏂�--鐜娓╁害/瀵肩嚎娓╁害/鑰愬紶娓╁害/鎺ョ画娓╁害 + insProduct.setAsk(null);//妫�楠岃姹� + insProduct.setTell(null);//妫�楠屾弿杩� + insProduct.setInsSampleId(sampleId); + insProduct.setState(1); + insProduct.setFactory(product.getFactory()); + insProduct.setLaboratory(product.getLaboratory()); + insProduct.setSampleType(product.getSampleType()); + insProduct.setSample(product.getSample()); + insProduct.setModel(product.getModel()); + insProduct.setSonLaboratory(product.getSonLaboratory()); + insProduct.setUnit("鈩�");//鍗曚綅 + insProduct.setManHourGroup(product.getManHourGroup()); + insProduct.setInspectionItemType("0"); + insProduct.setInspectionValueType("1"); + insProducts.add(insProduct); + insProductes.add(insProduct); + insProductess.add(insProduct); + } + //鐑惊鐜墠鏈夊娆″惊鐜鏁� + if (product.getInspectionItem().equals("鐑惊鐜�")) { + //鐑惊鐜繕瑕佸姞涓婄洿娴佺數闃� + for (InsProduct insProduct : insProducts) { + InsProduct insProduct1 = new InsProduct(); + BeanUtils.copyProperties(insProduct, insProduct1); + insProduct1.setInspectionItemClass("鐩存祦鐢甸樆");//妫�楠屽瓙瀛愰」--鐩存祦鐢甸樆 + insProduct1.setInspectionItemClassEn("DC resistance");//妫�楠屽瓙瀛愰」鑻辨枃--鐩存祦鐢甸樆 + insProduct1.setUnit("惟/km");//鍗曚綅 + insProductes.add(insProduct1); + insProductess.add(insProduct1); + } + } + if (count > 1) { + //寰幆瓒呰繃1娆� + for (int j = 2; j <= count; j++) { + for (InsProduct insProduct : insProductes) { + InsProduct insProduct1 = new InsProduct(); + BeanUtils.copyProperties(insProduct, insProduct1); + insProduct1.setInspectionItem(j + "");//寰幆娆℃暟 + insProductess.add(insProduct1); + } + } + } + insProductService.saveBatch(insProductess); + } + else { if (!is) { switch (type) { case 1: @@ -399,6 +464,21 @@ } @Override + public Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto) { + Map<String, Object> map = new HashMap<>(); + String dates = costStatisticsDto.getDates(); + String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); + costStatisticsDto.setDates(null); + List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); + double totalPrice = costStatisticsDtos.stream() + .filter(dto -> dto.getPrice() != null) // 杩囨护鎺変环鏍间负 null 鐨勫璞� + .mapToDouble(value -> value.getPrice().doubleValue()) + .sum(); + map.put("total", totalPrice); + return map; + } + + @Override public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) { List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems, orderNumber); Map<String, Object> map = new HashMap<>(); -- Gitblit v1.9.3