|
@@ -1,5 +1,6 @@
|
|
package org.springblade.business.controller;
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
@@ -540,7 +541,7 @@ public class TrialDetectionController extends BladeController {
|
|
@GetMapping("/self/getBaseInfo")
|
|
@GetMapping("/self/getBaseInfo")
|
|
@ApiOperationSupport(order = 30)
|
|
@ApiOperationSupport(order = 30)
|
|
@ApiOperation(value = "获取试验自检基础信息", notes = "传入节点pKeyId")
|
|
@ApiOperation(value = "获取试验自检基础信息", notes = "传入节点pKeyId")
|
|
- public R<TrialSeleInspectionRecordBaseInfoDTO> getBaseInfo(@RequestParam Long projectId, @RequestParam Long contractId, @RequestParam Long nodeId, @RequestParam(required = false) Long id) {
|
|
|
|
|
|
+ public R<TrialSeleInspectionRecordInfoDTO> getBaseInfo(@RequestParam Long projectId, @RequestParam Long contractId, @RequestParam Long nodeId, @RequestParam(required = false) Long id) {
|
|
ProjectInfo projectInfo = jdbcTemplate.query("select * from m_project_info where id = " + projectId, new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
|
|
ProjectInfo projectInfo = jdbcTemplate.query("select * from m_project_info where id = " + projectId, new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
|
|
if (projectInfo == null) {
|
|
if (projectInfo == null) {
|
|
return R.fail("未获取到项目信息");
|
|
return R.fail("未获取到项目信息");
|
|
@@ -549,7 +550,7 @@ public class TrialDetectionController extends BladeController {
|
|
if (contractInfo == null) {
|
|
if (contractInfo == null) {
|
|
return R.fail("未获取到合同信息");
|
|
return R.fail("未获取到合同信息");
|
|
}
|
|
}
|
|
- TrialSeleInspectionRecordBaseInfoDTO vo = new TrialSeleInspectionRecordBaseInfoDTO();
|
|
|
|
|
|
+ TrialSeleInspectionRecordInfoDTO vo = new TrialSeleInspectionRecordInfoDTO();
|
|
vo.setProjectName(projectInfo.getProjectName());
|
|
vo.setProjectName(projectInfo.getProjectName());
|
|
vo.setConstructionUnit(contractInfo.getConstructionUnitName());
|
|
vo.setConstructionUnit(contractInfo.getConstructionUnitName());
|
|
if (contractInfo.getContractType().equals(2)) {
|
|
if (contractInfo.getContractType().equals(2)) {
|
|
@@ -567,21 +568,27 @@ public class TrialDetectionController extends BladeController {
|
|
if (id != null) {
|
|
if (id != null) {
|
|
TrialSelfInspectionRecord record = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + id, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
|
|
TrialSelfInspectionRecord record = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + id, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
|
|
if (record != null) {
|
|
if (record != null) {
|
|
|
|
+ String baseInfo = record.getBaseInfo();
|
|
|
|
+ if (baseInfo != null) {
|
|
|
|
+ TrialSeleInspectionRecordInfoDTO info = JSON.parseObject(baseInfo, TrialSeleInspectionRecordInfoDTO.class);
|
|
|
|
+ BeanUtil.copyProperties(info, vo);
|
|
|
|
+ }
|
|
// 取样
|
|
// 取样
|
|
Long entrustId = record.getEntrustId();
|
|
Long entrustId = record.getEntrustId();
|
|
- if (entrustId != null) {
|
|
|
|
|
|
+ if (vo.getEntrustNo() == null && entrustId != null) {
|
|
EntrustInfo entrustInfo = jdbcTemplate.query("select * from u_entrust_info where id = " + entrustId, new BeanPropertyRowMapper<>(EntrustInfo.class)).stream().findAny().orElse(null);
|
|
EntrustInfo entrustInfo = jdbcTemplate.query("select * from u_entrust_info where id = " + entrustId, new BeanPropertyRowMapper<>(EntrustInfo.class)).stream().findAny().orElse(null);
|
|
if (entrustInfo != null) {
|
|
if (entrustInfo != null) {
|
|
vo.setEntrustNo(entrustInfo.getEntrustNo());
|
|
vo.setEntrustNo(entrustInfo.getEntrustNo());
|
|
vo.setEntrustId(entrustInfo.getId());
|
|
vo.setEntrustId(entrustInfo.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- 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.setTrialSampleInfoList(trialSampleInfoList);
|
|
|
|
- vo.setTrialSampleInfo(trialSampleInfoList.isEmpty() ? new TrialSampleInfo() : trialSampleInfoList.get(0));
|
|
|
|
|
|
+ if (vo.getTrialSampleInfo() == null) {
|
|
|
|
+ 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 (vo.getProjectPosition() == null) {
|
|
if (vo.getProjectPosition() == null) {
|
|
vo.setProjectPosition(record.getProjectPosition());
|
|
vo.setProjectPosition(record.getProjectPosition());
|
|
@@ -594,9 +601,9 @@ public class TrialDetectionController extends BladeController {
|
|
Set<Long> ids = standardInfoList.stream().map(StandardInfo::getParentId).collect(Collectors.toSet());
|
|
Set<Long> ids = standardInfoList.stream().map(StandardInfo::getParentId).collect(Collectors.toSet());
|
|
List<StandardInfo> parentStandardInfoList = jdbcTemplate.query("select * from u_standard_info where id in (" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")", new BeanPropertyRowMapper<>(StandardInfo.class));
|
|
List<StandardInfo> parentStandardInfoList = jdbcTemplate.query("select * from u_standard_info where id in (" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")", new BeanPropertyRowMapper<>(StandardInfo.class));
|
|
Map<Long, List<StandardInfo>> map = standardInfoList.stream().collect(Collectors.groupingBy(StandardInfo::getParentId));
|
|
Map<Long, List<StandardInfo>> map = standardInfoList.stream().collect(Collectors.groupingBy(StandardInfo::getParentId));
|
|
- List<TrialSeleInspectionRecordBaseInfoDTO.StandardVo> standardVos = new ArrayList<>();
|
|
|
|
|
|
+ List<TrialSeleInspectionRecordInfoDTO.StandardVo> standardVos = new ArrayList<>();
|
|
parentStandardInfoList.forEach(standardInfo -> {
|
|
parentStandardInfoList.forEach(standardInfo -> {
|
|
- TrialSeleInspectionRecordBaseInfoDTO.StandardVo standardVo = new TrialSeleInspectionRecordBaseInfoDTO.StandardVo();
|
|
|
|
|
|
+ TrialSeleInspectionRecordInfoDTO.StandardVo standardVo = new TrialSeleInspectionRecordInfoDTO.StandardVo();
|
|
List<StandardInfo> list = map.get(standardInfo.getId());
|
|
List<StandardInfo> list = map.get(standardInfo.getId());
|
|
if (list != null && !list.isEmpty()) {
|
|
if (list != null && !list.isEmpty()) {
|
|
standardVo.setId(list.get(0).getId());
|
|
standardVo.setId(list.get(0).getId());
|
|
@@ -642,13 +649,20 @@ public class TrialDetectionController extends BladeController {
|
|
vo.setReportNo(map.get("trialNumber"));
|
|
vo.setReportNo(map.get("trialNumber"));
|
|
vo.setReportAutoNumber(map.get("trialAutoNumber"));
|
|
vo.setReportAutoNumber(map.get("trialAutoNumber"));
|
|
}
|
|
}
|
|
- List<TrialSeleInspectionRecordBaseInfoDTO.StandardVo> mapList = jdbcTemplate.query("SELECT id,name from u_wbs_private_standard WHERE type = 2 and is_deleted = 0 and status = 1 and private_id = " + nodeId,
|
|
|
|
- new BeanPropertyRowMapper<>(TrialSeleInspectionRecordBaseInfoDTO.StandardVo.class));
|
|
|
|
|
|
+ List<TrialSeleInspectionRecordInfoDTO.StandardVo> mapList = jdbcTemplate.query("SELECT id,name from u_wbs_private_standard WHERE type = 2 and is_deleted = 0 and status = 1 and private_id = " + nodeId,
|
|
|
|
+ new BeanPropertyRowMapper<>(TrialSeleInspectionRecordInfoDTO.StandardVo.class));
|
|
vo.setStandardVos(mapList);
|
|
vo.setStandardVos(mapList);
|
|
return R.data(vo);
|
|
return R.data(vo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/self/saveBaseInfo")
|
|
|
|
+ @ApiOperationSupport(order = 30)
|
|
|
|
+ @ApiOperation(value = "保存试验自检基础信息")
|
|
|
|
+ public R<Boolean> saveBaseInfo(@RequestBody TrialSeleInspectionRecordInfoDTO vo) {
|
|
|
|
+ return R.status(iTrialSelfInspectionRecordService.saveBaseInfo(vo));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取最近一次使用的设备信息
|
|
* 获取最近一次使用的设备信息
|
|
*/
|
|
*/
|