|
|
|
@ -32,8 +32,8 @@ public class IProgressNewServiceImpl extends ServiceImpl<IProgressNewMapper, IPr |
|
|
|
|
public AjaxResult add(IProgressNew iProgressNew) { |
|
|
|
|
//查询填报日期下的当日进度
|
|
|
|
|
IProgressNew ip=iProgressNewMapper.queryByDate(iProgressNew.getPlanId(),iProgressNew.getProcessDate()); |
|
|
|
|
List<IProgressNew> list=iProgressNewMapper.queryList(new IProgress().setPlanId(iProgressNew.getPlanId())); |
|
|
|
|
if(ObjectUtils.isEmpty(ip)){ |
|
|
|
|
List<IProgressNew> list=iProgressNewMapper.queryList(new IProgress().setPlanId(iProgressNew.getPlanId())); |
|
|
|
|
long total = list.stream().mapToLong(IProgressNew::getDayProgress).sum(); |
|
|
|
|
if(iProgressNew.getDayProgress()+total>100){ |
|
|
|
|
return AjaxResult.error("已超出最大值,最大值应为"+ (100 - total)); |
|
|
|
@ -42,15 +42,16 @@ public class IProgressNewServiceImpl extends ServiceImpl<IProgressNewMapper, IPr |
|
|
|
|
iProgressNew1.setPlanId(iProgressNew.getPlanId()); |
|
|
|
|
iProgressNew1.setDayProgress(iProgressNew.getDayProgress()); |
|
|
|
|
iProgressNew1.setCreateTime(new Date()); |
|
|
|
|
iProgressNew1.setAccumulativeProgress(Integer.parseInt(String.valueOf(total))+iProgressNew.getDayProgress()); |
|
|
|
|
iProgressNew1.setProcessDate(iProgressNew.getProcessDate()); |
|
|
|
|
return AjaxResult.success(iProgressNewMapper.insert(iProgressNew1)) ; |
|
|
|
|
}else{ |
|
|
|
|
List<IProgressNew> list=iProgressNewMapper.queryList(new IProgress().setPlanId(iProgressNew.getPlanId())); |
|
|
|
|
long total = list.stream().mapToLong(IProgressNew::getDayProgress).sum(); |
|
|
|
|
if(iProgressNew.getDayProgress()+total>100){ |
|
|
|
|
return AjaxResult.error("已超出最大值,最大值应为"+ (100 - total)); |
|
|
|
|
} |
|
|
|
|
ip.setDayProgress(ip.getDayProgress()+iProgressNew.getDayProgress()); |
|
|
|
|
ip.setAccumulativeProgress(ip.getAccumulativeProgress()+iProgressNew.getDayProgress()); |
|
|
|
|
return AjaxResult.success(iProgressNewMapper.updateById(ip)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|