From c928419eadb34da253257457befb00ab70006270 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 08 八月 2024 19:02:50 +0800
Subject: [PATCH] 登录信息-返回userId
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 399 ++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 285 insertions(+), 114 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 692c498..cc30704 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,18 +135,34 @@
@Resource
private InsOrderFileMapper insOrderFileMapper;
+
@Override
public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
Map<String, Object> map = new HashMap<>();
map.put("head", PrintChina.printChina(InsOrderPlanVO.class));
+ Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
+ User user = userMapper.selectById(map1.get("userId"));//褰撳墠鐧诲綍鐨勪汉
+
+ //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
+ String departLimsId = user.getDepartLimsId();
+ String laboratory = null;
+ if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
+ String[] split = departLimsId.split(",");
+ //鏌ヨ瀵瑰簲鏋舵瀯鍚嶇О(閫氫俊瀹為獙瀹�,鐢靛姏瀹為獙瀹�,妫�娴嬪姙)
+ String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
+ if (departLims.contains("瀹為獙瀹�")) {
+ laboratory = departLims;
+ }
+ }
+ String userName = null;
Integer userId = null;
- if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId()) ) {
- Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
- userId = map1.get("userId");
- insOrderPlanDTO.setUserId(userId.longValue());
+ if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
+ userId = map1.get("userId");
+ 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);
+ IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userName, sonLaboratory, laboratory);
map.put("body", insOrderPage);
return map;
}
@@ -157,11 +173,24 @@
map.put("head", PrintChina.printChina(InsOrderPlanTaskSwitchVo.class));
Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
Integer userId = map1.get("userId");
+ User user = userMapper.selectById(map1.get("userId"));//褰撳墠鐧诲綍鐨勪汉
+
+ //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
+ String departLimsId = user.getDepartLimsId();
+ String laboratory = null;
+ if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
+ String[] split = departLimsId.split(",");
+ //鏌ヨ瀵瑰簲鏋舵瀯鍚嶇О(閫氫俊瀹為獙瀹�,鐢靛姏瀹為獙瀹�,妫�娴嬪姙)
+ String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
+ if (departLims.contains("瀹為獙瀹�")) {
+ laboratory = departLims;
+ }
+ }
if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
insOrderPlanDTO.setUserId(userId.longValue());
}
String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹�
- IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory);
+ IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory);
map.put("body", insOrderPage);
return map;
}
@@ -174,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;
}
@@ -203,17 +232,22 @@
List<InsProduct> insProducts = new ArrayList<>();
switch (type) {
case 0:
+ //鏍峰搧
insProducts = insSampleMapper.getInsProduct1(id, laboratory);
break;
case 1:
+ //鍏夌氦甯�
insProducts = insSampleMapper.getInsProduct2(id);
break;
case 2:
+ //鍏夌氦
insProducts = insSampleMapper.getInsProduct3(id);
break;
+ case 3:
+ //濂楃
+ insProducts = insSampleMapper.getInsProduct4(id);
+ break;
}
- // 鏁伴噰鏂板
- getDeviceMessage(insProducts, request);
Set<Integer> set = new HashSet<>();
Map<Integer, String> map2 = new HashMap<>();
@@ -222,33 +256,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());
- 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<>();
@@ -320,16 +327,19 @@
List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId));
List<InsFibers> fibers = new ArrayList<>();
List<InsFiber> fiber = new ArrayList<>();
+ List<InsBushing> bush = new ArrayList<>();
for (InsBushing insBushing : insBushings) {
//鍐嶆煡璇㈠嚭鎵�鏈夌殑鍏夌氦甯�
List<InsFibers> insFibers = insFibersMapper.selectList(Wrappers.<InsFibers>lambdaQuery().eq(InsFibers::getInsBushingId, insBushing.getId()));
+ List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
if (CollectionUtils.isNotEmpty(insFibers)) {
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()) {
+ List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult)
+ .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
+ if (insProducts.size() == collect.size()) {
insFiber.setState(1);//宸叉楠�
- }else {
+ } else {
insFiber.setState(0);//鏈楠�
}
}
@@ -338,31 +348,48 @@
List<InsFiber> fiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().in(InsFiber::getInsFibersId, insFibers.stream().map(InsFibers::getId).collect(Collectors.toList())));
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()) {
+ List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult)
+ .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
+ if (insProducts.size() == collect.size()) {
insFiber.setState(1);//宸叉楠�
- }else {
+ } else {
insFiber.setState(0);//鏈楠�
}
}
fiber.addAll(fiberList);
- } else {
- //濡傛灉濂楃涓嬫病鏈夊厜绾ゅ甫灏卞彧鏈夊厜绾や簡
- List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
+ }
+ //濡傛灉濂楃涓嬫病鏈夊厜绾ゅ甫灏卞彧鏈夊厜绾や簡
+ else if (CollectionUtils.isNotEmpty(insFiberList)) {
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()) {
+ List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult)
+ .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
+ if (insProducts.size() == collect.size()) {
insFiber.setState(1);//宸叉楠�
- }else {
+ } else {
insFiber.setState(0);//鏈楠�
}
}
fiber.addAll(insFiberList);
}
+ //濡傛灉鍏夌氦甯﹀拰鍏夌氦閮芥病鏈夊氨鍙湁濂楃(鏉惧绠�)
+ else {
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getInsBushId, insBushing.getId()));
+ List<Integer> collect = insProducts.stream()
+ .map(InsProduct::getInsResult)
+ .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
+ if (insProducts.size() == collect.size()) {
+ insBushing.setState(1);//宸叉楠�
+ } else {
+ insBushing.setState(0);//鏈楠�
+ }
+ bush.add(insBushing);
+ }
}
map.put("鍏夌氦甯�", fibers);
map.put("鍏夌氦", fiber);
+ map.put("濂楃", bush);
return map;
}
@@ -377,7 +404,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) {
//鍐嶆煡璇㈠嚭鎵�鏈夌殑鍏夌氦甯�
@@ -399,18 +426,18 @@
ProductVo productVo = new ProductVo();
productVo.setCode(insFiber.getCode());
productVo.setColor(fiber.getColor());
- productVo.setBushColor(fiber.getBushColor());
+ productVo.setBushColor(insBushing.getColor());
if (ObjectUtils.isNotEmpty(insProductResult)) {
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);
@@ -418,8 +445,7 @@
}
}
}
- }
- else {
+ } else {
//濡傛灉濂楃涓嬫病鏈夊厜绾ゅ甫灏卞彧鏈夊厜绾や簡
List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
for (InsFiber fiber : insFiberList) {
@@ -432,17 +458,17 @@
for (InsProduct insProduct : insProducts) {
InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
ProductVo productVo = new ProductVo();
- productVo.setCode("/");
+ productVo.setCode("-");
productVo.setColor(fiber.getColor());
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]);
}
@@ -453,8 +479,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)
@@ -489,7 +514,9 @@
JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
InsProduct insProduct = new InsProduct();
insProduct.setId(Integer.parseInt(k));
- List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
+ List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, insProduct.getId()));
+ InsProduct product = insProductMapper.selectById(insProduct.getId());
InsProductResult result;
if (CollectionUtils.isEmpty(results)) {
result = new InsProductResult();
@@ -497,6 +524,16 @@
result = results.get(0);
}
result.setInsProductId(Integer.parseInt(k));
+ /*鏍¢獙涓�涓媟esult琛�*/
+ List<InsProductResult> insProductResultss = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, insProduct.getId()));
+ if (insProductResultss.size() > 1) {
+ for (int i = 1; i < insProductResultss.size(); i++) {
+ insProductResultMapper.deleteById(insProductResultss.get(i));
+ }
+ }
+ InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, Integer.parseInt(k)));
+ //妫�楠屽��
if (jo.get("insValue") != null) {
JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue")));
List<Map<String, Object>> iv = new ArrayList<>();
@@ -519,6 +556,7 @@
}
result.setInsValue(JSON.toJSONString(iv));
}
+ //璁$畻鍊�
if (jo.get("comValue") != null && !Objects.equals(jo.get("comValue"), "")) {
JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue")));
List<Map<String, Object>> cv = new ArrayList<>();
@@ -530,6 +568,7 @@
}
result.setComValue(JSON.toJSONString(cv));
}
+ //鏈�缁堝��
try {
JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue")));
if (resValue.get("v") != null) {
@@ -537,7 +576,9 @@
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")));
List<Map<String, Object>> ev = new ArrayList<>();
@@ -549,6 +590,7 @@
}
result.setEquipValue(JSON.toJSONString(ev));
}
+ //璁惧鍚嶇О
if (jo.get("equipName") != null) {
JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipName")));
List<Map<String, Object>> ev = new ArrayList<>();
@@ -560,11 +602,13 @@
}
result.setEquipName(JSON.toJSONString(ev));
}
+ //缁撹
try {
JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult")));
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);
@@ -575,6 +619,55 @@
result.setUpdateTime(LocalDateTime.now());
insProductResultMapper.updateById(result);
}
+
+ /*濡傛灉鏄涓�娆¢�夋嫨璁惧淇℃伅,涓旇繕鏈夊叾浣欐牱鍝佷篃鏈夊悓涓�涓粡楠岄」鐩�,閭d箞鎵�鏈夋牱鍝佺殑璇ラ」鐩兘鐢ㄨ繖涓澶囦俊鎭�*/
+ //鍏堟煡璇㈡槸鍚﹁繕鏈夊叾浣欐牱鍝�
+
+ Integer insSampleId = product.getInsSampleId();
+ List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSampleMapper.selectById(insSampleId).getInsOrderId()));
+ if (insSamples.size() > 1 && !product.getInspectionItemType().equals("1")) {
+ //瀛樺湪鍏朵綑鏍峰搧,鏌ヨ鏄惁鏈夊悓涓�绉嶆楠岄」鐩�
+ for (InsSample sample : insSamples.stream().filter(insSample -> !insSample.getId().equals(insSampleId)).collect(Collectors.toList())) {
+ InsProduct product1 = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
+ .eq(InsProduct::getState, 1)
+ .eq(InsProduct::getInsSampleId, sample.getId())
+ .eq(InsProduct::getInspectionItem, product.getInspectionItem())
+ .eq(InsProduct::getInspectionItemEn, product.getInspectionItemEn())
+ .eq(InsProduct::getInspectionItemSubclass, product.getInspectionItemSubclass())
+ .eq(InsProduct::getInspectionItemSubclassEn, product.getInspectionItemSubclassEn())
+ .eq(InsProduct::getTemplateId, product.getTemplateId())
+ .eq(InsProduct::getStandardMethodListId, product.getStandardMethodListId())
+ .eq(InsProduct::getInsBushId, product.getInsBushId())
+ .eq(InsProduct::getInsFibersId, product.getInsFibersId())
+ .eq(InsProduct::getInsFiberId, product.getInsFiberId())
+ );
+ if (ObjectUtils.isNotEmpty(product1)) {
+ //濡傛灉瀛樺湪椤圭洰,鏌ヨ鏄惁鏈夎〃
+ InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, product1.getId()));
+ if (ObjectUtils.isEmpty(productResult)) {
+ //娌℃湁琛ㄦ柊寤鸿〃
+ productResult = new InsProductResult();
+ productResult.setInsProductId(product1.getId());
+ productResult.setEquipValue(result.getEquipValue());
+ productResult.setEquipName(result.getEquipValue());
+ productResult.setCreateUser(userId);
+ productResult.setUpdateUser(userId);
+ insProductResultMapper.insert(productResult);
+ } else if (ObjectUtils.isEmpty(productResult.getEquipValue())) {
+ //鏈夎〃鍒ゆ柇鏄惁鏈夎澶�
+ productResult.setEquipValue(result.getEquipValue());
+ productResult.setEquipName(result.getEquipValue());
+ productResult.setUpdateUser(userId);
+ productResult.setUpdateTime(LocalDateTime.now());
+ insProductResultMapper.updateById(productResult);
+ }
+ }
+ }
+
+ }
+
+
insProduct.setUpdateUser(userId);
insProductMapper.updateById(insProduct);
insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
@@ -589,36 +682,49 @@
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()
+ List<AuxiliaryOutputWorkingHours> count1s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
.eq(AuxiliaryOutputWorkingHours::getCheck, userId)
.eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem())
.eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass())
- .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode()));
+ .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode())
+ .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode()));
+ if (count1s.size() > 1) {
+ for (int i = 1; i < count1s.size(); i++) {
+ auxiliaryOutputWorkingHoursMapper.deleteById(count1s.get(i));
+ }
+ }
//闈炲姞鐝�
- AuxiliaryOutputWorkingHours count2 = auxiliaryOutputWorkingHoursMapper.selectOne(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
+ List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
.eq(AuxiliaryOutputWorkingHours::getCheck, userId)
.eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem())
.eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass())
- .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()));
- AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
- if (ObjectUtils.isNotEmpty(count1) ){
- auxiliaryOutputWorkingHours = count1;
+ .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())
+ .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode()));
+ if (count2s.size() > 1) {
+ for (int i = 1; i < count2s.size(); i++) {
+ auxiliaryOutputWorkingHoursMapper.deleteById(count2s.get(i));
+ }
}
- else if (ObjectUtils.isNotEmpty(count2) ){
- auxiliaryOutputWorkingHours = count2;
- }
- if (ObjectUtils.isNotEmpty(insProduct.getManHour())) {
- if (isWithinRange && ObjectUtils.isEmpty(count2)) {
+ if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && CollectionUtils.isEmpty(count2s) && CollectionUtils.isEmpty(count1s)) {
+ AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
+ if (isWithinRange) {
//鍦ㄦ椂闂村唴灏辨槸姝e父涓婄彮
auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤�
auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤�
@@ -626,7 +732,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");
@@ -636,7 +742,7 @@
auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡
auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ
auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉
- } else if(ObjectUtils.isEmpty(count1)) {
+ } else {
//鍔犵彮
auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤�
auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤�
@@ -644,7 +750,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");
@@ -655,7 +761,9 @@
auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ
auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉
}
- auxiliaryOutputWorkingHoursService.saveOrUpdate(auxiliaryOutputWorkingHours);
+ if (ObjectUtils.isEmpty(insProductResult) && !result.getInsValue().equals("[]") || (ObjectUtils.isNotEmpty(insProductResult) && !insProductResult.getInsValue().equals(result.getInsValue()) && !insProductResult.getInsValue().equals("[]"))) {
+ auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
+ }
}
}
}
@@ -665,15 +773,23 @@
Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
.eq(InsProduct::getInsSampleId, insSample.getId()));
Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
- .eq(InsProduct::getInsSampleId, insSample.getId()).isNotNull(InsProduct::getInsResult));
+ .eq(InsProduct::getInsSampleId, insSample.getId())
+ .and(wrapper -> wrapper
+ .isNull(InsProduct::getInsResult)
+ .or()
+ .eq(InsProduct::getInsResult, 2)
+ ));
if (l == l1) {
insSample.setInsState(2);
}
insSampleMapper.updateById(insSample);
/*鏍¢獙涓�涓媟esult琛�*/
- List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()).orderByDesc(InsProductResult::getId));
+ List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, insProduct.getId()));
if (insProductResults.size() > 1) {
- insProductResultMapper.deleteById(insProductResults.get(0));
+ for (int i = 1; i < insProductResults.size(); i++) {
+ insProductResultMapper.deleteById(insProductResults.get(i));
+ }
}
});
return insContext.keySet().stream().findFirst().orElse(null);
@@ -687,8 +803,17 @@
int orderId = insSampleMapper.selectById(sampleId).getInsOrderId();
// 閫氳繃璁㈠崟id鏌ユ壘鎵�鏈夋牱鏈琲d
List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList());
- // 閫氳繃妫�鏌ユ瘡涓�涓牱鏈琲d鏌ュ埌灞炰簬妫�楠岄」缁撹 is null鐨勬暟閲�
- Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()).eq(InsProduct::getState, 1));
+ // 閫氳繃妫�鏌ユ瘡涓�涓牱鏈琲d鏌ュ埌灞炰簬妫�楠岄」缁撹 is null 鎴栬�� =2 鐨勬暟閲�
+ Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+ .in(InsProduct::getInsSampleId, sampleIds)
+ .and(wrapper -> wrapper
+ .isNull(InsProduct::getInsResult)
+ .or()
+ .eq(InsProduct::getInsResult, 2)
+ )
+ //.isNull(InsProduct::getInsResult)
+ .eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory())
+ .eq(InsProduct::getState, 1));
if (count == 0) {
insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
.eq(InsOrderState::getInsOrderId, orderId)
@@ -704,7 +829,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);
@@ -911,8 +1036,48 @@
textRenderData.setText("鈭�");
break;
case 0:
- resultCh.set(resultCh.get() + "銆�" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass()));
- resultEn.set(resultEn.get() + "銆�" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()));
+ String current = resultCh.get();
+ // 浣跨敤 Set 鏉ヤ繚鎸佸敮涓�椤�
+ Set<String> uniqueItems = new HashSet<>();
+ if (!current.isEmpty()) {
+ // 鍒嗗壊褰撳墠瀛楃涓插苟鍔犲叆鍒� Set 涓�
+ String[] items = current.split("銆�");
+ for (String item : items) {
+ if (!item.isEmpty()) {
+ uniqueItems.add(item);
+ }
+ }
+ }
+ // 澶勭悊鏂版暟鎹�
+ String newItem = p.getInspectionItem() +
+ (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass());
+ uniqueItems.add(newItem);
+
+ // 杩炴帴鍞竴椤瑰苟鏇存柊 AtomicReference
+ String result = String.join("銆�", uniqueItems);
+ resultCh.set(result);
+ //resultCh.set(resultCh.get() + "銆�" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass()));
+
+ String current1 = resultEn.get();
+ // 浣跨敤 Set 鏉ヤ繚鎸佸敮涓�椤�
+ Set<String> uniqueItems1 = new HashSet<>();
+ if (!current1.isEmpty()) {
+ // 鍒嗗壊褰撳墠瀛楃涓插苟鍔犲叆鍒� Set 涓�
+ String[] items = current1.split("銆�");
+ for (String item : items) {
+ if (!item.isEmpty()) {
+ uniqueItems1.add(item);
+ }
+ }
+ }
+ // 澶勭悊鏂版暟鎹�
+ String newItem1 = p.getInspectionItemEn() +
+ ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn());
+ uniqueItems1.add(newItem1);
+ // 杩炴帴鍞竴椤瑰苟鏇存柊 AtomicReference
+ String result1 = String.join("銆�", uniqueItems1);
+ resultEn.set(result1);
+ //resultEn.set(resultEn.get() + "銆�" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()));
textRenderData.setText("脳");
break;
default:
@@ -981,7 +1146,7 @@
textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "");
}
} else {
- textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "");
+ textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "鈭�" + jo1.get("mc"));
}
if (jo1.get("mc") != null) {
textRenderData.setText(textRenderData.getText() + "鈭�" + jo1.get("mc"));
@@ -1088,8 +1253,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);
@@ -1131,8 +1296,7 @@
cellRenderData.setParagraphs(paragraphRenderDataList);
cells.add(cellRenderData);
}
- }
- else if (j == 1) {
+ } else if (j == 1) {
//绗簩琛�
if (k == 0) {
//绗竴鍒�
@@ -1175,8 +1339,7 @@
cellRenderData.setParagraphs(paragraphRenderDataList);
cells.add(cellRenderData);
}
- }
- else if (j == count1-1) {
+ } else if (j == count1 - 1) {
//鏈�鍚庝竴琛�
if (k == 0 || k == 1) {
//鍓嶄袱鍒�
@@ -1194,8 +1357,7 @@
cellRenderData.setParagraphs(paragraphRenderDataList);
cells.add(cellRenderData);
}
- }
- else {
+ } else {
if (k == 0) {
//绗竴鍒�
textRenderData.setText((j - 1) + "");
@@ -1563,7 +1725,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();
@@ -1619,8 +1781,7 @@
cellRenderData.setParagraphs(paragraphRenderDataList);
cells.add(cellRenderData);
}
- }
- else {
+ } else {
if (k == 0) {
//绗竴鍒�
textRenderData.setText(sampleList.get(0).getModel() + "鈭�44");
@@ -1759,7 +1920,7 @@
} catch (Exception e) {
throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
}
- if (signatureUrl.equals("")) {
+ if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) {
throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
}
//Custom custom = customMapper.selectById(user.get("company"));
@@ -3324,7 +3485,7 @@
put("createTime", now.format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�")));
put("createTimeEn", monthNames[now.getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear());
put("insTime", insOrder.getInsTime().format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�")));
- put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear());
+ put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + insOrder.getInsTime().getDayOfMonth() + ", " + insOrder.getInsTime().getYear());
put("writeUrl", null);
put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
put("images", images);
@@ -3449,6 +3610,10 @@
} catch (IOException e) {
throw new RuntimeException(e);
}
+ } else {
+ //澶嶆牳涓嶉�氳繃灏嗘妸澶嶆牳鐨勮礋璐d汉鍘绘帀
+ Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId();
+ insSampleUserMapper.deleteById(id);
}
return 1;
}
@@ -3480,14 +3645,18 @@
}
@Override
- public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode, String sampleCode) {
+ public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode) {
List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId));
List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
.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));
@@ -3513,7 +3682,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())
@@ -3529,8 +3698,7 @@
product.setInsResult(1);
}
insProductMapper.updateById(product);
- }
- else {
+ } else {
count++;
str += "<br/>" + count + "锛�" + product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>";
}
@@ -3555,23 +3723,26 @@
InsSampleUser insSampleUser = new InsSampleUser();
insSampleUser.setUserId(verifyUser);
insSampleUser.setInsSampleId(orderId);
- insSampleUser.setState(0);
+ insSampleUser.setState(1);
insSampleUser.setSonLaboratory(laboratory);
insSampleUserMapper.insert(insSampleUser);
/*鏍¢獙涓�涓媟esult琛�*/
CompletableFuture.supplyAsync(() -> {
List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList());
for (Integer ip : ips) {
- List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, ip).orderByDesc(InsProductResult::getId));
+ List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
+ .eq(InsProductResult::getInsProductId, ip));
if (insProductResults.size() > 1) {
- insProductResultMapper.deleteById(insProductResults.get(0));
+ for (int i = 1; i < insProductResults.size(); i++) {
+ insProductResultMapper.deleteById(insProductResults.get(i));
+ }
}
}
return null;
});
// 鍒犻櫎鏁伴噰閲囬泦娆℃暟
- String key = "frequency" + ":" + entrustCode + ":" + sampleCode;
- RedisUtil.del(key);
+ String key = "frequency" + ":" + entrustCode + ":*";
+ RedisUtil.delsLike(key);
return 1;
}
--
Gitblit v1.9.3