From 9116abf53b1dd05f342e89ed5e287964433637fa Mon Sep 17 00:00:00 2001
From: 晏有为 <13214124+yan-youwei@user.noreply.gitee.com>
Date: 星期三, 15 五月 2024 14:23:06 +0800
Subject: [PATCH] 访问第三方接口
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java | 63 +++++++++++++++++++------------
1 files changed, 38 insertions(+), 25 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
index 5739ac1..660938b 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -11,13 +11,12 @@
import com.yuanchu.mom.pojo.StandardProductList;
import com.yuanchu.mom.pojo.StandardTree;
import com.yuanchu.mom.service.StandardProductListService;
+import com.yuanchu.mom.service.StandardProductListService2;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@@ -37,6 +36,8 @@
private GetLook getLook;
+ private StandardProductListService2 standardProductListService2;
+
@Override
public int upStandardProductList(StandardProductList list) {
return standardProductListMapper.updateById(list);
@@ -49,7 +50,7 @@
@Override
public List<StandardProductList> selectStandardProductList(InsSample insSample) {
- String[] models = insSample.getModel().split("-");
+ String[] models = insSample.getModel().split("-(?=[^-]*$)");//鎷嗗垎鏈�鍚庝竴涓��-銆�
List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0]));
list = list.stream().filter(a -> {
try {
@@ -100,7 +101,7 @@
}
@Override
- public List<StandardProductList> selectStandardProductListByMethodId(Integer id, String tree) {
+ public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page) {
String[] trees = tree.split(" - ");
List<StandardProductList> list = new ArrayList<>();
if (trees.length == 3) {
@@ -127,7 +128,7 @@
&& Objects.equals(sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass())
&& Objects.equals(sp.getModel(), pl.getModel())) {
pl.setId(sp.getId());
- pl.setState(sp.getState());
+ pl.setState(id==0?1:sp.getState());
pl.setMethodS(sp.getMethodS());
if(sp.getAsk()!=null&&!sp.getAsk().equals("")){
pl.setAsk(sp.getAsk());
@@ -144,29 +145,41 @@
if(sp.getSection()!=null&&!sp.getSection().equals("")){
pl.setSection(sp.getSection());
}
+ if(sp.getTemplateId()!=null&&!sp.getTemplateId().equals("")){
+ pl.setTemplateId(sp.getTemplateId());
+ }
break;
}
}
}
- Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
- CompletableFuture.supplyAsync(() -> {
- standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
- saveBatch(list.stream().map(a->{
- a.setFactory(trees[0]);
- a.setLaboratory(trees[1]);
- a.setSampleType(trees[2]);
- a.setCreateUser(userId);
- a.setUpdateUser(userId);
- a.setStandardMethodListId(id);
- return a;
- }).collect(Collectors.toList()));
- return null;
- }).thenAccept(res -> {
- }).exceptionally(e -> {
- e.printStackTrace();
- return null;
- });
- return list;
+ if(page == 1){
+ Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+ CompletableFuture.supplyAsync(() -> {
+ standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
+ standardProductListService2.saveBatch(list.stream().map(a->{
+ a.setFactory(trees[0]);
+ a.setLaboratory(trees[1]);
+ a.setSampleType(trees[2]);
+ a.setCreateUser(userId);
+ a.setUpdateUser(userId);
+ a.setStandardMethodListId(id);
+ return a;
+ }).collect(Collectors.toList()));
+ return null;
+ }).thenAccept(res -> {
+ }).exceptionally(e -> {
+ e.printStackTrace();
+ return null;
+ });
+ }
+ Map<String, Object> map = new HashMap<>();
+ try {
+ map.put("productList", list.subList((page - 1)*50, page * 50));
+ }catch (IndexOutOfBoundsException e){
+ map.put("productList", list.subList((page - 1)*50, list.size()));
+ }
+ map.put("total", list.size());
+ return map;
}
}
--
Gitblit v1.9.3