| | |
| | | @Autowired |
| | | private PipeOutPlanMapper pipeOutPlanMapper; |
| | | |
| | | public static final Object LOCK = new Object(); |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BasicResult insert(PipeOutPlanEntity pipeOutPlanEntity) { |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BasicResult update(PipeOutPlanEntity pipeOutPlanEntity) { |
| | | PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear()); |
| | | if (!pipeOutPlanEntity.getPlanOutId().equals(isExit.getPlanOutId()) && isExit != null){ |
| | | if (isExit != null && !pipeOutPlanEntity.getPlanOutId().equals(isExit.getPlanOutId()) ){ |
| | | return BasicResult.faild("500","同一项目、年份有且只有一个计划",null); |
| | | } |
| | | pipeOutPlanMapper.update(pipeOutPlanEntity); |
| | |
| | | String planOutId = obj.getPlanOutId(); |
| | | List<PipeOutPlanMothEntity> mothListByProIdAndYear = pipeOutPlanMapper.findMothListByProIdAndYear(proId, planYear.toString(), planOutId); |
| | | Integer completePlanProductNum = 0; |
| | | synchronized (this.LOCK){ |
| | | for (PipeOutPlanMothEntity pipeOutPlanMothEntity : mothListByProIdAndYear) { |
| | | Integer completePlanProduct = pipeOutPlanMothEntity.getCompletePlanProduct(); |
| | | completePlanProductNum+=completePlanProduct; |
| | | } |
| | | } |
| | | obj.setMonthList(mothListByProIdAndYear); |
| | | obj.setCompletePipeNum(completePlanProductNum); |
| | | }); |