Commit d6e6e00f authored by 竹天卫's avatar 竹天卫

委托评审的时候修改保存 优化2

parent 730f9c75
...@@ -606,15 +606,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -606,15 +606,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (StringUtils.isEmpty(sampleQuery.getOrigin())) { if (StringUtils.isEmpty(sampleQuery.getOrigin())) {
return BaseResponse.errorMsg("请选择样品产地"); return BaseResponse.errorMsg("请选择样品产地");
} }
}
//删除之前的样品
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrust.getId());
sampleTmpService.remove(queryWrapper);
List<SampleTmp> sampleTmpList = new ArrayList<>();
for (SampleQuery sampleQuery : query.getSampleList()) {
SampleTmp sampleTmp = new SampleTmp();
BeanUtils.copyProperties(sampleQuery, sampleTmp);
String teamIds = sampleQuery.getTeamIds(); //选择的检测项id集合 String teamIds = sampleQuery.getTeamIds(); //选择的检测项id集合
BigDecimal charge = new BigDecimal("0.00"); BigDecimal charge = new BigDecimal("0.00");
if (teamIds != null) { if (teamIds != null) {
...@@ -657,8 +649,19 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -657,8 +649,19 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if (entrust.getIsUrgent() == 1) { if (entrust.getIsUrgent() == 1) {
charge = charge.multiply(new BigDecimal(3)); charge = charge.multiply(new BigDecimal(3));
} }
sampleQuery.setCharge(charge);
}
//删除之前的样品
QueryWrapper<SampleTmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_id", entrust.getId());
sampleTmpService.remove(queryWrapper);
List<SampleTmp> sampleTmpList = new ArrayList<>();
for (SampleQuery sampleQuery : query.getSampleList()) {
SampleTmp sampleTmp = new SampleTmp();
BeanUtils.copyProperties(sampleQuery, sampleTmp);
sampleTmp.setEntrustId(entrust.getId()) sampleTmp.setEntrustId(entrust.getId())
.setCharge(charge) .setCharge(sampleQuery.getCharge())
.setCreateTime(LocalDateTime.now()); .setCreateTime(LocalDateTime.now());
sampleTmpList.add(sampleTmp); sampleTmpList.add(sampleTmp);
sampleTmpService.save(sampleTmp); sampleTmpService.save(sampleTmp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment