浏览代码

Merge remote-tracking branch 'origin/test-merge-02' into test-merge-02

chenr 3 月之前
父节点
当前提交
8bc5be6a33

+ 7 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSeleInspectionRecordInfoDTO.java

@@ -31,6 +31,9 @@ public class TrialSeleInspectionRecordInfoDTO extends TrialSeleInspectionRecordB
 	@ApiModelProperty("id")
 	private Long id;
 
+	@ApiModelProperty(value = "所属方类型 1=施工自检 2=监理抽检 3业主")
+	private Integer type;
+
 	@ApiModelProperty(value = "节点ID")
 	private Long nodeId;
 
@@ -65,6 +68,10 @@ public class TrialSeleInspectionRecordInfoDTO extends TrialSeleInspectionRecordB
 	@ApiModelProperty("设备信息和使用信息")
 	private List<TrailDeviceUseInfoDTO> trailDeviceUseInfoDTOS;
 
+
+	@ApiModelProperty("样品信息")
+	private List<TrialSampleInfo> trialSampleInfoList;
+
 	@Data
 	public static class StandardVo {
 		@ApiModelProperty("id")

+ 17 - 6
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -553,6 +553,9 @@ public class TrialDetectionController extends BladeController {
             return R.fail("未获取到合同信息");
         }
         TrialSeleInspectionRecordInfoDTO vo = new TrialSeleInspectionRecordInfoDTO();
+        vo.setNodeId(nodeId);
+        vo.setContractId(contractId);
+        vo.setId(id);
         vo.setProjectName(projectInfo.getProjectName());
         vo.setConstructionUnit(contractInfo.getConstructionUnitName());
         if (contractInfo.getContractType().equals(2)) {
@@ -572,8 +575,14 @@ public class TrialDetectionController extends BladeController {
             if (record != null) {
                 String baseInfo = record.getBaseInfo();
                 if (baseInfo != null) {
-                    TrialSeleInspectionRecordInfoDTO info = JSON.parseObject(baseInfo, TrialSeleInspectionRecordInfoDTO.class);
-                    BeanUtil.copyProperties(info, vo);
+                    try {
+                        TrialSeleInspectionRecordInfoDTO info = JSON.parseObject(baseInfo, TrialSeleInspectionRecordInfoDTO.class);
+                        if (info != null) {
+                            BeanUtil.copyProperties(info, vo);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
                 }
                 // 取样
                 Long entrustId = record.getEntrustId();
@@ -588,8 +597,10 @@ public class TrialDetectionController extends BladeController {
                     List<TrialSelfSample> selfSampleList = jdbcTemplate.query("select * from u_trial_self_sample where self_id = " + id, new BeanPropertyRowMapper<>(TrialSelfSample.class));
                     if (!selfSampleList.isEmpty()) {
                         String samplingIds = selfSampleList.stream().map(TrialSelfSample::getSamplingId).map(String::valueOf).collect(Collectors.joining(","));
-                        List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select * from u_trial_sample_info where id in (" + samplingIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
-                        vo.setTrialSampleInfo(trialSampleInfoList.isEmpty() ? new TrialSampleInfo() : trialSampleInfoList.get(0));
+                        if (samplingIds != null && !"".equals(samplingIds)) {
+                            List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select * from u_trial_sample_info where id in (" + samplingIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+                            vo.setTrialSampleInfo(trialSampleInfoList.isEmpty() ? new TrialSampleInfo() : trialSampleInfoList.get(0));
+                        }
                     }
                 }
                 if (vo.getProjectPosition() == null) {
@@ -661,8 +672,8 @@ public class TrialDetectionController extends BladeController {
     @PostMapping("/self/saveBaseInfo")
     @ApiOperationSupport(order = 30)
     @ApiOperation(value = "保存试验自检基础信息")
-    public R<Boolean> saveBaseInfo(@RequestBody TrialSeleInspectionRecordInfoDTO vo) {
-        return R.status(iTrialSelfInspectionRecordService.saveBaseInfo(vo));
+    public R<Long> saveBaseInfo(@RequestBody TrialSeleInspectionRecordInfoDTO vo) {
+        return R.data(iTrialSelfInspectionRecordService.saveBaseInfo(vo));
     }
 
     /**

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSelfInspectionRecordService.java

@@ -47,5 +47,5 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
     R getSamplePdfUrl(String id,String contrctId);
 
-    Boolean saveBaseInfo(TrialSeleInspectionRecordInfoDTO vo);
+    Long saveBaseInfo(TrialSeleInspectionRecordInfoDTO vo);
 }

+ 62 - 23
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -43,6 +43,7 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.*;
 import org.springblade.manager.entity.*;
@@ -2095,40 +2096,78 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     }
 
     @Override
-    public Boolean saveBaseInfo(TrialSeleInspectionRecordInfoDTO dto) {
+    public Long saveBaseInfo(TrialSeleInspectionRecordInfoDTO dto) {
         TrialSelfInspectionRecord record = new TrialSelfInspectionRecord();
         BeanUtil.copyProperties(dto, record);
         TrialSeleInspectionRecordBaseInfoDTO baseInfo = new TrialSeleInspectionRecordBaseInfoDTO();
         BeanUtil.copyProperties(dto, baseInfo);
         record.setBaseInfo(JSON.toJSONString(baseInfo));
-        this.saveOrUpdate(record);
-        TrialSampleInfo trialSampleInfo = dto.getTrialSampleInfo();
-        if (trialSampleInfo != null) {
-            TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(trialSampleInfo.getId());
-            if (sampleInfo != null) {
-                //------关联取样信息------
-                RecordSampleSubmitDTO sampleSubmitDTO = new RecordSampleSubmitDTO();
-                sampleSubmitDTO.setId(record.getId());
-                sampleSubmitDTO.setSampleIds(trialSampleInfo.getId() + "");
-                //删除关联
-                baseMapper.delSelfSample(record.getId());
-                baseMapper.saveSelfSample(SnowFlakeUtil.getId(), record.getId(), trialSampleInfo.getId() + "");
-                //更新
-                this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
-                        .set(sampleInfo.getSamplingLocation() != null && !sampleInfo.getSamplingLocation().isEmpty(),TrialSelfInspectionRecord::getSamplingLocation, sampleInfo.getSamplingLocation())
-                        .set(sampleInfo.getCalculationUnit() != null && !sampleInfo.getCalculationUnit().isEmpty(), TrialSelfInspectionRecord::getCompany, sampleInfo.getCalculationUnit())
-                        .set(trialSampleInfo.getSpecificationNumber() != null && !trialSampleInfo.getSpecificationNumber().isEmpty(), TrialSelfInspectionRecord::getSpecificationNumber, trialSampleInfo.getSpecificationNumber())
-                        .set(sampleInfo.getSpecificationModel() != null && !sampleInfo.getSpecificationModel().isEmpty(), TrialSelfInspectionRecord::getSpecificationModel, sampleInfo.getSpecificationModel())
-                        .eq(TrialSelfInspectionRecord::getId, sampleSubmitDTO.getId())
-                );
-            }
+        if (record.getId() == null) {
+            this.save(record);
+        } else {
+            this.updateById(record);
+        }
+        List<TrialSampleInfo> trialSampleInfoList = dto.getTrialSampleInfoList();
+        TrialSampleInfo info = dto.getTrialSampleInfo();
+        if (trialSampleInfoList == null) {
+            trialSampleInfoList = new ArrayList<>();
+        }
+        if (info != null) {
+            trialSampleInfoList.add(info);
+        }
+        if (!trialSampleInfoList.isEmpty()) {
+            List<TrialSampleInfo> trialSampleInfos = new ArrayList<>();
+            trialSampleInfoList.forEach(trialSampleInfo -> {
+                TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(trialSampleInfo.getId());
+                if (sampleInfo != null) {
+                    //------关联取样信息------
+                    RecordSampleSubmitDTO sampleSubmitDTO = new RecordSampleSubmitDTO();
+                    sampleSubmitDTO.setId(record.getId());
+                    sampleSubmitDTO.setSampleIds(trialSampleInfo.getId() + "");
+                    //删除关联
+                    baseMapper.delSelfSample(record.getId());
+                    baseMapper.saveSelfSample(SnowFlakeUtil.getId(), record.getId(), trialSampleInfo.getId() + "");
+                    trialSampleInfos.add(sampleInfo);
+                }
+            });
+            List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            String samplingLocation = org.apache.commons.lang.StringUtils.join(samplingLocations, "、");
+
+            List<String> calculationUnits = trialSampleInfos.stream().map(TrialSampleInfo::getCalculationUnit).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            String calculationUnit = org.apache.commons.lang.StringUtils.join(calculationUnits, "、");
+
+            List<String> specificationNumbers = trialSampleInfoList.stream().map(TrialSampleInfo::getSpecificationNumber).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            String specificationNumber = org.apache.commons.lang.StringUtils.join(specificationNumbers, "、");
+
+            List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
+            String specificationModel = org.apache.commons.lang.StringUtils.join(specificationModels, "、");
+
+            //更新
+            this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
+                    .set(samplingLocation != null && !samplingLocation.isEmpty(), TrialSelfInspectionRecord::getSamplingLocation, samplingLocation)
+                    .set(calculationUnit != null && !calculationUnit.isEmpty(),TrialSelfInspectionRecord::getCompany, calculationUnit)
+                    .set(specificationNumber != null && !specificationNumber.isEmpty(),TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
+                    .set(specificationModel != null && !specificationModel.isEmpty(),TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
+                    .eq(TrialSelfInspectionRecord::getId, dto.getId()));
         }
         // ---- 修改样品单号信息 --------
         if(Func.isNotEmpty(dto.getEntrustId())){
             //修改项目节点基础信息
             jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='"+dto.getEntrustId()+"'");
         }
-        return true;
+        //------关联新增设备使用记录信息------
+        List<TrailDeviceUseInfoDTO> deviceUseInfoDTOS = dto.getTrailDeviceUseInfoDTOS();
+        if (deviceUseInfoDTOS != null && !deviceUseInfoDTOS.isEmpty()) {
+            List<Long> ids = deviceUseInfoDTOS.stream().map(TrailDeviceUseInfoDTO::getDeviceInfoId).collect(Collectors.toList());
+            TrialSelfInspectionRecordDTO recordDTO = new TrialSelfInspectionRecordDTO();
+            recordDTO.setDeviceUseIds(org.apache.commons.lang.StringUtils.join(ids, ","));
+            List<Long> collect = trialSampleInfoList.stream().map(TrialSampleInfo::getId).collect(Collectors.toList());
+            recordDTO.setSampleIds(org.apache.commons.lang.StringUtils.join(collect, ","));
+            recordDTO.setNodeId(dto.getNodeId());
+            recordDTO.setTrialUserName(AuthUtil.getUserName());
+            this.trialDeviceUseService.addDeviceUseInfo(recordDTO, record.getId());
+        }
+        return record.getId();
     }
 
 

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/TextdictInfoServiceImpl.java

@@ -97,6 +97,9 @@ public class TextdictInfoServiceImpl extends ServiceImpl<TextdictInfoMapper, Tex
                     List<TextdictInfoVO> textdictList= baseMapper.selectTextdictInfoByExcelId(page, textdictInfo);
                     if (textdict == null || textdict.isEmpty()) {
                         textdict = textdictList;
+                        if (textdict != null) {
+                            textdict.forEach(textdictInfoVO -> textdictInfoVO.setIsSystem(2));
+                        }
                     } else if (textdictList != null && !textdictList.isEmpty()) {
                         Map<String, Map<String, TextdictInfoVO>> map = textdict.stream().collect(Collectors.groupingBy(TextdictInfoVO::getColKey, Collectors.toMap(TextdictInfoVO::getSigRoleId, v -> v, (v1, v2) -> v1)));
                         List<TextdictInfoVO> collect = textdictList.stream().filter(textdictInfoVO -> {