Browse Source

测试问题修改

yejian016332 3 years ago
parent
commit
a3df17db31

+ 20 - 13
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/classSchedule/service/impl/ScheduleUserServiceImpl.java

@@ -8,6 +8,7 @@ import com.github.zuihou.business.classSchedule.entity.ScheduleUser;
 import com.github.zuihou.business.classSchedule.service.ScheduleUserService;
 import com.github.zuihou.base.service.SuperServiceImpl;
 
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.injection.annonation.InjectionResult;
@@ -16,13 +17,12 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
 import static com.github.zuihou.utils.BizAssert.isFalse;
+import static java.util.stream.Collectors.groupingBy;
 
 /**
  * <p>
@@ -48,7 +48,6 @@ public class ScheduleUserServiceImpl extends SuperServiceImpl<ScheduleUserMapper
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public ScheduleUser save(ScheduleUserSaveDTO data) {
         ScheduleUser module = BeanPlusUtil.toBean(data, ScheduleUser.class);
         //先删除再插入
@@ -56,21 +55,29 @@ public class ScheduleUserServiceImpl extends SuperServiceImpl<ScheduleUserMapper
 
         // 解决不能删除事务问题,
         List<ScheduleUser> hisUserList = baseMapper.selectList(Wraps.<ScheduleUser>lbQ().eq(ScheduleUser::getScheduleFlag,module.getScheduleFlag()));
-        List<Long> hisUsers = hisUserList.stream().map(p -> p.getUserId()).collect(Collectors.toList());
-        List<ScheduleUser> insertUser = new ArrayList<>();
+        List<Long> hisUsers = hisUserList.stream().map(p -> p.getId()).collect(Collectors.toList());
+        baseMapper.delete(Wraps.<ScheduleUser>lbQ().in(ScheduleUser::getId,hisUsers));
 
         List<ScheduleUser> detailList = data.getScheduleUserList();
-        for(ScheduleUser scheduleUser : detailList){
-            if(!hisUsers.contains(scheduleUser.getUserId())){
-                scheduleUser.setScheduleFlag(module.getScheduleFlag());
-                insertUser.add(scheduleUser);
-            }
+        detailList = detailList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
+                () -> new TreeSet<>(Comparator.comparing(o -> o.getUserId()))), ArrayList::new));
+
+        if(detailList !=null && detailList.size()>0){
+            List<ScheduleUser> mainList = detailList.stream().map((map) -> {
+                ScheduleUser item = new ScheduleUser();
+                BeanUtil.copyProperties(map, item);
+                item.setScheduleFlag(module.getScheduleFlag());
+                item.setId(null);
+                return item;
+            }).collect(Collectors.toList());
+            super.saveBatch(mainList);
         }
-        super.saveBatch(insertUser);
 
         return module;
+
     }
 
+
     public boolean check(ScheduleUserSaveDTO model) {
         return super.count(Wraps.<ScheduleUser>lbQ().eq(ScheduleUser::getScheduleFlag, model.getScheduleFlag())) > 0;
     }

+ 6 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java

@@ -1633,16 +1633,19 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
 
                 R r = R.success();
 
-                Map<String, Object> retStockInfo = new HashMap<String, Object>();
 
                 List<Map> allReturnList = new ArrayList<>();
 
                 List<Map> returnBeginStockList =  processStockInfo(manualInfo.getDeviceUnit() ,manualInfo.getStartResourceId(),manualInfo.getStartpointId());
+                System.out.println("returnBeginStockList=" + returnBeginStockList.size());
                 allReturnList.addAll(returnBeginStockList);
                 List<Map> returnEndStockList =  processStockInfo(manualInfo.getDeviceUnit() ,manualInfo.getEndResourceId(),manualInfo.getEndpointId());
+                System.out.println("returnEndStockList=" + returnEndStockList.size());
                 allReturnList.addAll(returnEndStockList);
 
-                HttpEntity<String> formEntity = new HttpEntity<String>(JSON.toJSON(allReturnList).toString(), headers);
+                Map<String, Object> retStockInfo = new HashMap<String, Object>();
+                retStockInfo.put("data",allReturnList);
+                HttpEntity<String> formEntity = new HttpEntity<String>(JSON.toJSON(R.success(retStockInfo)).toString(), headers);
                 //调用接口
                 try {
                     JSONObject returnDataObject = new JSONObject();
@@ -1842,6 +1845,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
         List<Map> returnList = new ArrayList<>();
         Map map = new HashMap();
         map.put("resourceId", resourceId);
+        map.put("pointId", pointId);
         List<ProductionresourcePosition> list = productionresourcePositionMapper.getProductlineStockInfo(map);
         Map<String, List<ProductionresourcePosition>> pointMap = list.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
         for (String key : pointMap.keySet()) {

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/MaintenceLogMapper.xml

@@ -20,7 +20,7 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_time,create_user,update_time,update_user,
-        repair_id,maintenance_time,maintenance_user,maintenance_name, status,remark,code,resresourceName,productlineName
+        repair_id,maintenance_time,maintenance_user,maintenance_name, status,remark,code,resresourceName,GROUP_CONCAT(productlineName) AS productlineName
     </sql>
 
     <!-- 分页 -->

+ 2 - 1
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/RepairMapper.xml

@@ -20,7 +20,7 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_time,create_user,update_time,update_user,
-        productionresource_id,repair_end_time,repair_status,status,remark,code,productionresourceName,lineDesc,process,downTime,operationName,expireFlag,org_id
+        productionresource_id,repair_end_time,repair_status,status,remark,code,productionresourceName,GROUP_CONCAT(lineDesc) AS lineDesc,process,downTime,operationName,expireFlag,GROUP_CONCAT(org_id) AS org_id
     </sql>
 
     <!-- 分页 -->
@@ -62,6 +62,7 @@
          and  a.productionresource_id = b.id
          and  a.productionresource_id = izzp.resource_id
          and  izzp.zone_id = izz.id
+         and  b.id = izzp.resource_id
         ) s ${ew.customSqlSegment}
     </select>
 

+ 1 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/MaintenanceLogController.java

@@ -50,6 +50,7 @@ public class MaintenanceLogController extends SuperController<MaintenanceLogServ
         MaintenanceLog maintenanceLog = BeanUtil.toBean(data, MaintenanceLog.class);
 
         wrapper.eq(MaintenanceLog::getRepairId,data.getRepairId());
+        wrapper.groupBy(MaintenanceLog::getRepairId);
         //Wraps.lbQ(station); 这种写法值 不能和  ${ew.customSqlSegment} 一起使用
         // ${ew.customSqlSegment} 语法一定要手动eq like 等
         baseService.pageList(page, wrapper);

+ 2 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/RepairController.java

@@ -50,7 +50,8 @@ public class RepairController extends SuperController<RepairService,Long, Repair
         LbqWrapper<Repair> wrapper = wrap.lambda();
         wrap.like(StringUtils.isNotEmpty(data.getCode()),"code",data.getCode());
         wrap.like(StringUtils.isNotEmpty(data.getProductionresourceName()),"productionresourceName",data.getProductionresourceName());
-        wrap.eq(null != data.getProductionLineId() && data.getProductionLineId() > 0,"productionLineId",data.getProductionLineId());
+        wrap.like(null != data.getProductionLineId() && data.getProductionLineId() > 0,"productionLineId",data.getProductionLineId());
+        wrap.groupBy("productionresource_id");
         Repair repair = BeanUtil.toBean(data, Repair.class);
         //Wraps.lbQ(station); 这种写法值 不能和  ${ew.customSqlSegment} 一起使用
         // ${ew.customSqlSegment} 语法一定要手动eq like 等