|
|
@ -669,6 +669,13 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru |
|
|
|
private List<MaterialListForBookVo> getMaterialBookVoList(List<EntrustmentIdentificationMaterial> materialList) { |
|
|
|
private List<MaterialListForBookVo> getMaterialBookVoList(List<EntrustmentIdentificationMaterial> materialList) { |
|
|
|
List<MaterialListForBookVo> materialListForBookVoList = new ArrayList<>(); |
|
|
|
List<MaterialListForBookVo> materialListForBookVoList = new ArrayList<>(); |
|
|
|
materialList.forEach(item -> { |
|
|
|
materialList.forEach(item -> { |
|
|
|
|
|
|
|
MaterialListForBookVo eg = getMaterialListForBookVo(item); |
|
|
|
|
|
|
|
materialListForBookVoList.add(eg); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return materialListForBookVoList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MaterialListForBookVo getMaterialListForBookVo(EntrustmentIdentificationMaterial item) { |
|
|
|
MaterialListForBookVo eg = new MaterialListForBookVo(); |
|
|
|
MaterialListForBookVo eg = new MaterialListForBookVo(); |
|
|
|
eg.setAcceptNo(item.getAcceptNo()); |
|
|
|
eg.setAcceptNo(item.getAcceptNo()); |
|
|
|
eg.setIndexNo(item.getShortNameDes() + "检材"); |
|
|
|
eg.setIndexNo(item.getShortNameDes() + "检材"); |
|
|
@ -680,7 +687,21 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru |
|
|
|
eg.setRtSampleQuantity(item.getRtSampleQuantity()); |
|
|
|
eg.setRtSampleQuantity(item.getRtSampleQuantity()); |
|
|
|
eg.setRemark(item.getRemark()); |
|
|
|
eg.setRemark(item.getRemark()); |
|
|
|
eg.setOrderNo(item.getOrderNo()); |
|
|
|
eg.setOrderNo(item.getOrderNo()); |
|
|
|
BigDecimal totalSampleMass; |
|
|
|
BigDecimal totalSampleMass = calculateTotalSampleMass(item, eg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据 totalSampleMass 大小来决定保留的小数位数
|
|
|
|
|
|
|
|
if (totalSampleMass.compareTo(new BigDecimal(100)) >= 0) { |
|
|
|
|
|
|
|
// 如果 totalSampleMass 大于 100,保留 1 位小数
|
|
|
|
|
|
|
|
eg.setTotalSampleDes(totalSampleMass.setScale(1, BigDecimal.ROUND_HALF_UP) + item.getUnit()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 否则保留 2 位小数
|
|
|
|
|
|
|
|
eg.setTotalSampleDes(totalSampleMass.setScale(2, BigDecimal.ROUND_HALF_UP) + item.getUnit()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return eg; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BigDecimal calculateTotalSampleMass(EntrustmentIdentificationMaterial item, MaterialListForBookVo eg) { |
|
|
|
|
|
|
|
BigDecimal totalSampleMass = BigDecimal.ZERO; |
|
|
|
//因为现在有的检材可以不用复称,例如送来的一支电子烟,所以我们用送检的数量与单位进行描述即可
|
|
|
|
//因为现在有的检材可以不用复称,例如送来的一支电子烟,所以我们用送检的数量与单位进行描述即可
|
|
|
|
if (item.getSample1RepeatWeigh() == null || item.getSample1RepeatWeigh().compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
if (item.getSample1RepeatWeigh() == null || item.getSample1RepeatWeigh().compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
eg.setAnalysisSampleDes(item.getSample1Quantity() + item.getUnit()); |
|
|
|
eg.setAnalysisSampleDes(item.getSample1Quantity() + item.getUnit()); |
|
|
@ -691,15 +712,22 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
eg.setRetainedSampleDes(new BigDecimal(0) + item.getUnit()); |
|
|
|
eg.setRetainedSampleDes(new BigDecimal(0) + item.getUnit()); |
|
|
|
} |
|
|
|
} |
|
|
|
eg.setTotalSampleDes(totalSampleMass.setScale(2, BigDecimal.ROUND_HALF_UP) + item.getUnit()); |
|
|
|
// eg.setTotalSampleDes(totalSampleMass.setScale(2, BigDecimal.ROUND_HALF_UP) + item.getUnit());
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
eg.setAnalysisSampleDes(item.getSample1RepeatWeigh() + item.getUnit()); |
|
|
|
eg.setAnalysisSampleDes(item.getSample1RepeatWeigh() + item.getUnit()); |
|
|
|
eg.setRetainedSampleDes(item.getSample2RepeatWeigh() + item.getUnit()); |
|
|
|
eg.setRetainedSampleDes(item.getSample2RepeatWeigh() + item.getUnit()); |
|
|
|
eg.setTotalSampleDes((item.getSample1RepeatWeigh() == null ? new BigDecimal(0) : item.getSample1RepeatWeigh()).add(item.getSample2RepeatWeigh() == null ? new BigDecimal(0) : item.getSample2RepeatWeigh()).setScale(2, BigDecimal.ROUND_HALF_UP) + "克"); |
|
|
|
// eg.setTotalSampleDes(
|
|
|
|
} |
|
|
|
// (item.getSample1RepeatWeigh() == null ? new BigDecimal(0) : item.getSample1RepeatWeigh())
|
|
|
|
materialListForBookVoList.add(eg); |
|
|
|
// .add(
|
|
|
|
}); |
|
|
|
// item.getSample2RepeatWeigh() == null ? new BigDecimal(0) : item.getSample2RepeatWeigh()
|
|
|
|
return materialListForBookVoList; |
|
|
|
// )
|
|
|
|
|
|
|
|
// .setScale(2, BigDecimal.ROUND_HALF_UP)
|
|
|
|
|
|
|
|
// + "克"
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
totalSampleMass = (item.getSample1RepeatWeigh() == null ? BigDecimal.ZERO : item.getSample1RepeatWeigh()) |
|
|
|
|
|
|
|
.add(item.getSample2RepeatWeigh() == null ? BigDecimal.ZERO : item.getSample2RepeatWeigh()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return totalSampleMass; |
|
|
|
} |
|
|
|
} |
|
|
|
//构造鉴定委托书文书中的检材列表
|
|
|
|
//构造鉴定委托书文书中的检材列表
|
|
|
|
|
|
|
|
|
|
|
@ -2153,7 +2181,16 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru |
|
|
|
//设置鉴定要求
|
|
|
|
//设置鉴定要求
|
|
|
|
//dm.put("identifyReq",entrustmentService.buildIdentfyReq(materialList));
|
|
|
|
//dm.put("identifyReq",entrustmentService.buildIdentfyReq(materialList));
|
|
|
|
dm.put("identifyReq", ev.getEntrustRequirement()); |
|
|
|
dm.put("identifyReq", ev.getEntrustRequirement()); |
|
|
|
//设置检材列表
|
|
|
|
//设置检材列表, 对检材的重量进行处理 小于100的保留两位小数,100以上保留一位小数
|
|
|
|
|
|
|
|
BigDecimal compareNumber = new BigDecimal(100); |
|
|
|
|
|
|
|
for (EntrustmentIdentificationMaterial entrustmentIdentificationMaterial : materialList) { |
|
|
|
|
|
|
|
BigDecimal quantity = entrustmentIdentificationMaterial.getQuantity(); |
|
|
|
|
|
|
|
if (quantity.compareTo(compareNumber) >= 0) { |
|
|
|
|
|
|
|
entrustmentIdentificationMaterial.setQuantity(quantity.setScale(1, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
entrustmentIdentificationMaterial.setQuantity(quantity.setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
dm.put("materialList", materialList); |
|
|
|
dm.put("materialList", materialList); |
|
|
|
// QR Code
|
|
|
|
// QR Code
|
|
|
|
// BufferedImage bufferedImage = QRCodeUtils.genQRCode(ev.getEntrustmentNo(), 100, 100);
|
|
|
|
// BufferedImage bufferedImage = QRCodeUtils.genQRCode(ev.getEntrustmentNo(), 100, 100);
|
|
|
|