|
@@ -25,6 +25,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -313,6 +314,7 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public HttpRespMsg addOrUpdatePlan(Plan plan) {
|
|
public HttpRespMsg addOrUpdatePlan(Plan plan) {
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
boolean isNew=true;
|
|
boolean isNew=true;
|
|
@@ -492,7 +494,9 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
planProcedureTotals.add(p);
|
|
planProcedureTotals.add(p);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- planProcedureTotalService.saveOrUpdateBatch(planProcedureTotals);
|
|
|
|
|
|
+ if (planProcedureTotals.size() > 0) {
|
|
|
|
+ planProcedureTotalService.saveOrUpdateBatch(planProcedureTotals);
|
|
|
|
+ }
|
|
List<PlanProcedureTotal> totals = planProcedureTotals.stream().filter(ps -> ps.getPlanId().equals(plan.getId())).collect(Collectors.toList());
|
|
List<PlanProcedureTotal> totals = planProcedureTotals.stream().filter(ps -> ps.getPlanId().equals(plan.getId())).collect(Collectors.toList());
|
|
if(totals.size()>0){
|
|
if(totals.size()>0){
|
|
double sum = totals.stream().filter(t->t.getTotalWages()!=null).mapToDouble(PlanProcedureTotal::getTotalWages).sum();
|
|
double sum = totals.stream().filter(t->t.getTotalWages()!=null).mapToDouble(PlanProcedureTotal::getTotalWages).sum();
|