|
@@ -565,7 +565,7 @@ public class TrialDetectionController extends BladeController {
|
|
|
}
|
|
|
vo.setSupervisionUnit(contractInfo.getSupervisionUnitName());
|
|
|
vo.setLabName(contractInfo.getLaboratoryName());
|
|
|
- vo.setContractName(contractInfo.getContractNumber());
|
|
|
+ vo.setContractName(contractInfo.getContractName());
|
|
|
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);
|
|
|
if (record != null) {
|
|
@@ -588,6 +588,26 @@ public class TrialDetectionController extends BladeController {
|
|
|
vo.setProjectPosition(record.getProjectPosition());
|
|
|
}
|
|
|
vo.setStandardId(record.getStandardId());
|
|
|
+ vo.setStandardInfoIds(record.getStandardInfoIds());
|
|
|
+ if (record.getStandardInfoIds() != null) {
|
|
|
+ List<StandardInfo> standardInfoList = jdbcTemplate.query("select * from u_standard_info where id in (" + record.getStandardInfoIds() + ")", new BeanPropertyRowMapper<>(StandardInfo.class));
|
|
|
+ if (!standardInfoList.isEmpty()) {
|
|
|
+ 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));
|
|
|
+ Map<Long, List<StandardInfo>> map = standardInfoList.stream().collect(Collectors.groupingBy(StandardInfo::getParentId));
|
|
|
+ List<TrialSeleInspectionRecordBaseInfoDTO.StandardVo> standardVos = new ArrayList<>();
|
|
|
+ parentStandardInfoList.forEach(standardInfo -> {
|
|
|
+ TrialSeleInspectionRecordBaseInfoDTO.StandardVo standardVo = new TrialSeleInspectionRecordBaseInfoDTO.StandardVo();
|
|
|
+ List<StandardInfo> list = map.get(standardInfo.getId());
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ standardVo.setId(list.get(0).getId());
|
|
|
+ standardVo.setName(standardInfo.getName());
|
|
|
+ standardVos.add(standardVo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ vo.setStandardInfos(standardVos);
|
|
|
+ }
|
|
|
+ }
|
|
|
vo.setReportNo(record.getReportNo());
|
|
|
vo.setRecordNo(record.getRecordNo());
|
|
|
// 获取设备信息和使用信息
|
|
@@ -648,16 +668,61 @@ public class TrialDetectionController extends BladeController {
|
|
|
@ApiOperationSupport(order = 30)
|
|
|
@ApiOperation(value = "根据 standardId 查询 样品品种,代号和强度等级", notes = "standardId")
|
|
|
public R<Map<String, List<StandardInfo>>> getStandardInfoByStandardId( @RequestParam Long standardId) {
|
|
|
- List<StandardInfo> list = uStandardInfoService.list(Wrappers.<StandardInfo>lambdaQuery().eq(StandardInfo::getStandardId, standardId).eq(StandardInfo::getType, 1)
|
|
|
- .eq(StandardInfo::getParentId, 0).and(query -> query.eq(StandardInfo::getName, "样品品种").or().eq(StandardInfo::getName, "代号").or().eq(StandardInfo::getName, "强度等级")));
|
|
|
+ List<StandardInfo> list = uStandardInfoService.list(Wrappers.<StandardInfo>lambdaQuery().eq(StandardInfo::getStandardId, standardId).eq(StandardInfo::getType, 1));
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
return R.data(new HashMap<>());
|
|
|
}
|
|
|
- List<Long> ids = list.stream().map(StandardInfo::getId).collect(Collectors.toList());
|
|
|
- List<StandardInfo> childList = uStandardInfoService.list(Wrappers.<StandardInfo>lambdaQuery().in(StandardInfo::getParentId, ids).eq(StandardInfo::getType, 1));
|
|
|
- Map<Long, List<StandardInfo>> map = childList.stream().collect(Collectors.groupingBy(StandardInfo::getParentId));
|
|
|
+ Map<Long, List<StandardInfo>> map = list.stream().collect(Collectors.groupingBy(StandardInfo::getParentId));
|
|
|
Map<String, List<StandardInfo>> result = new HashMap<>();
|
|
|
- list.forEach(standardInfo -> result.put(standardInfo.getName(), map.get(standardInfo.getId()) == null ? new ArrayList<>() : map.get(standardInfo.getId())));
|
|
|
+ List<StandardInfo> standardInfos = map.get(0L);
|
|
|
+ if (standardInfos != null) {
|
|
|
+ standardInfos.forEach(standardInfo -> result.put(standardInfo.getName(), map.get(standardInfo.getId()) == null ? new ArrayList<>() : map.get(standardInfo.getId())));
|
|
|
+ }
|
|
|
return R.data(result);
|
|
|
}
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 根据 设备id 查询 设备信息以及设备使用信息
|
|
|
+// */
|
|
|
+// @GetMapping("/self/getDeviceInfoByIds")
|
|
|
+// @ApiOperationSupport(order = 30)
|
|
|
+// @ApiOperation(value = "根据 设备id 查询 设备信息以及设备使用信息", notes = "standardId")
|
|
|
+// public R<List<TrailDeviceUseInfoDTO>> getDeviceInfoByIds( @RequestParam String deviceInfoIds) {
|
|
|
+// if (deviceInfoIds.isEmpty()) {
|
|
|
+// return R.data(new ArrayList<>());
|
|
|
+// }
|
|
|
+// // 校验设备id
|
|
|
+// try {
|
|
|
+// String[] split = deviceInfoIds.split(",");
|
|
|
+// for (String s : split) {
|
|
|
+// long id = Long.parseLong(s);
|
|
|
+// if (id <= 0) {
|
|
|
+// return R.fail("设备id格式错误");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// return R.fail("设备id格式错误");
|
|
|
+// }
|
|
|
+// List<TrialDeviceInfo> deviceInfoList = jdbcTemplate.query("select * from u_device_info where id in (" + deviceInfoIds + ")", new BeanPropertyRowMapper<>(TrialDeviceInfo.class));
|
|
|
+// deviceInfoList.forEach(deviceInfo -> {
|
|
|
+//
|
|
|
+// });
|
|
|
+//
|
|
|
+// trialDeviceUseList.forEach(trailDeviceUseInfoDTO -> {
|
|
|
+// TrialDeviceInfo deviceInfo = trialDeviceInfoMap.get(trailDeviceUseInfoDTO.getDeviceInfoId());
|
|
|
+// if (deviceInfo != null) {
|
|
|
+// trailDeviceUseInfoDTO.setMeasuringRange(deviceInfo.getMeasuringRange());
|
|
|
+// trailDeviceUseInfoDTO.setAccuracy(deviceInfo.getAccuracy());
|
|
|
+// // 计算使用时长
|
|
|
+// trailDeviceUseInfoDTO.setUseDuration(DateUtils.dateDiff(trailDeviceUseInfoDTO.getStartDate(), trailDeviceUseInfoDTO.getEndDate()));
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+//// List<TrailDeviceUseInfoDTO> trialDeviceUseList = jdbcTemplate.query("select * from u_trial_device_use where self_inspection_record_id = " + id, new BeanPropertyRowMapper<>(TrailDeviceUseInfoDTO.class));
|
|
|
+//// if (!trialDeviceUseList.isEmpty()) {
|
|
|
+//// Set<Long> ids = trialDeviceUseList.stream().map(TrailDeviceUseInfoDTO::getDeviceInfoId).collect(Collectors.toSet());
|
|
|
+////
|
|
|
+//// }
|
|
|
+// return R.data(trialDeviceUseList);
|
|
|
+// }
|
|
|
}
|