|
@@ -4,13 +4,16 @@ import cn.hutool.core.map.MapWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.bstek.ureport.font.yahei.YaheiFontRegister;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.modules.project.mapper.ProjectInfoMapper;
|
|
import org.springblade.modules.project.mapper.ProjectInfoMapper;
|
|
|
|
+import org.springblade.modules.project.pojo.dto.ProjectAndPlanDetailDTO;
|
|
import org.springblade.modules.project.pojo.dto.ProjectInfoDTO;
|
|
import org.springblade.modules.project.pojo.dto.ProjectInfoDTO;
|
|
import org.springblade.modules.project.pojo.dto.ProjectInfoPageDTO;
|
|
import org.springblade.modules.project.pojo.dto.ProjectInfoPageDTO;
|
|
|
|
+import org.springblade.modules.project.pojo.dto.ProjectInvestPlanDTO;
|
|
import org.springblade.modules.project.pojo.entity.ProjectInfo;
|
|
import org.springblade.modules.project.pojo.entity.ProjectInfo;
|
|
import org.springblade.modules.project.pojo.entity.ProjectInvestPlan;
|
|
import org.springblade.modules.project.pojo.entity.ProjectInvestPlan;
|
|
import org.springblade.modules.project.pojo.entity.ProjectPlanProgress;
|
|
import org.springblade.modules.project.pojo.entity.ProjectPlanProgress;
|
|
@@ -93,7 +96,7 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
if ((plan.getYearlyInvest() == null && !all.equals(BigDecimal.ZERO)) || (plan.getYearlyInvest() != null && !all.equals(plan.getYearlyInvest()))){
|
|
if ((plan.getYearlyInvest() == null && !all.equals(BigDecimal.ZERO)) || (plan.getYearlyInvest() != null && !all.equals(plan.getYearlyInvest()))){
|
|
throw new ServiceException(plan.getPlanYear()+"年全年计划投资与每季度总和不对");
|
|
throw new ServiceException(plan.getPlanYear()+"年全年计划投资与每季度总和不对");
|
|
}
|
|
}
|
|
- projectAll.add(all);
|
|
|
|
|
|
+ projectAll = projectAll.add(all);
|
|
}
|
|
}
|
|
if ((info.getAllInvestMoney() == null && !projectAll.equals(BigDecimal.ZERO) || (info.getAllInvestMoney() != null && !info.getAllInvestMoney().equals(projectAll)) )){
|
|
if ((info.getAllInvestMoney() == null && !projectAll.equals(BigDecimal.ZERO) || (info.getAllInvestMoney() != null && !info.getAllInvestMoney().equals(projectAll)) )){
|
|
throw new ServiceException("所有年计划投资之和不等于总投资,请修改后重新保存");
|
|
throw new ServiceException("所有年计划投资之和不等于总投资,请修改后重新保存");
|
|
@@ -112,8 +115,8 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
if (total == 0){
|
|
if (total == 0){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- BigDecimal totalMonth = new BigDecimal(total).multiply(new BigDecimal("1200"));
|
|
|
|
- BigDecimal totalField = new BigDecimal(total).multiply(new BigDecimal("4800"));
|
|
|
|
|
|
+ BigDecimal totalMonth = new BigDecimal(total).multiply(new BigDecimal("12"));
|
|
|
|
+ BigDecimal totalField = new BigDecimal(total).multiply(new BigDecimal("0.48"));
|
|
//项目进展比例
|
|
//项目进展比例
|
|
if (vo.getProgress() != null){
|
|
if (vo.getProgress() != null){
|
|
vo.setProgressRatio(vo.getProgress().divide(totalMonth,2, RoundingMode.UP));
|
|
vo.setProgressRatio(vo.getProgress().divide(totalMonth,2, RoundingMode.UP));
|
|
@@ -144,14 +147,13 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
public void update2(ProjectInfoDTO dto) {
|
|
public void update2(ProjectInfoDTO dto) {
|
|
ProjectInfo oldInfo = this.getById(dto.getId());
|
|
ProjectInfo oldInfo = this.getById(dto.getId());
|
|
if (oldInfo.getStartYear() != null){
|
|
if (oldInfo.getStartYear() != null){
|
|
- if (oldInfo.getStartYear() != dto.getStartYear() || oldInfo.getEndYear() != dto.getEndYear()){
|
|
|
|
|
|
+ if (!oldInfo.getStartYear().equals(dto.getStartYear()) || !oldInfo.getEndYear().equals(dto.getEndYear())){
|
|
throw new ServiceException("不能修改年份");
|
|
throw new ServiceException("不能修改年份");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//修改项目信息
|
|
//修改项目信息
|
|
ProjectInfo info = new ProjectInfo();
|
|
ProjectInfo info = new ProjectInfo();
|
|
BeanUtils.copyProperties(dto,info);
|
|
BeanUtils.copyProperties(dto,info);
|
|
- info.setId(SnowFlakeUtil.getId());
|
|
|
|
this.updateById(info);
|
|
this.updateById(info);
|
|
//修改计划信息,先校验年份是否改变
|
|
//修改计划信息,先校验年份是否改变
|
|
List<ProjectInvestPlan> list = dto.getList();
|
|
List<ProjectInvestPlan> list = dto.getList();
|
|
@@ -173,7 +175,7 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
if (plan.getOneInvest() != null){
|
|
if (plan.getOneInvest() != null){
|
|
all = all.add(plan.getFourInvest());
|
|
all = all.add(plan.getFourInvest());
|
|
}
|
|
}
|
|
- if ((plan.getYearlyInvest() == null && !all.equals(BigDecimal.ZERO)) || (plan.getYearlyInvest() != null && !all.equals(plan.getYearlyInvest()))){
|
|
|
|
|
|
+ if ((plan.getYearlyInvest() == null && all.compareTo(BigDecimal.ZERO) != 0) || (plan.getYearlyInvest() != null && all.compareTo(plan.getYearlyInvest()) != 0)){
|
|
throw new ServiceException(plan.getPlanYear()+"年全年计划投资与每季度总和不对");
|
|
throw new ServiceException(plan.getPlanYear()+"年全年计划投资与每季度总和不对");
|
|
}
|
|
}
|
|
if (plan.getYearlyInvest() != null || StringUtils.isNotBlank(plan.getYearlyTarget()) || StringUtils.isNotBlank(plan.getOnePlan())
|
|
if (plan.getYearlyInvest() != null || StringUtils.isNotBlank(plan.getYearlyTarget()) || StringUtils.isNotBlank(plan.getOnePlan())
|
|
@@ -273,7 +275,9 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
planVO.setIsCanFill(1);
|
|
planVO.setIsCanFill(1);
|
|
//如果没有填写过完成情况,则创建构建完成情况信息
|
|
//如果没有填写过完成情况,则创建构建完成情况信息
|
|
List<ProjectPlanProgressVO> progresses = new ArrayList<>();
|
|
List<ProjectPlanProgressVO> progresses = new ArrayList<>();
|
|
|
|
+ BigDecimal monthFinished = BigDecimal.ZERO;
|
|
if (planVO.getIsFillPlan() == 0){
|
|
if (planVO.getIsFillPlan() == 0){
|
|
|
|
+
|
|
for (int i = 1; i <= 12; i++) {
|
|
for (int i = 1; i <= 12; i++) {
|
|
ProjectPlanProgressVO progress = new ProjectPlanProgressVO();
|
|
ProjectPlanProgressVO progress = new ProjectPlanProgressVO();
|
|
progress.setProjectId(id);
|
|
progress.setProjectId(id);
|
|
@@ -281,6 +285,7 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
progress.setPlanYear(planVO.getPlanYear());
|
|
progress.setPlanYear(planVO.getPlanYear());
|
|
progress.setPlanMonth(i);
|
|
progress.setPlanMonth(i);
|
|
progress.setPlanMonthName(monthNames[i]);
|
|
progress.setPlanMonthName(monthNames[i]);
|
|
|
|
+ progress.setYearlyTarget(planVO.getYearlyTarget());
|
|
if (i <= 3){
|
|
if (i <= 3){
|
|
progress.setPlanQuarter(1);
|
|
progress.setPlanQuarter(1);
|
|
progress.setPlanQuarterName("一季度");
|
|
progress.setPlanQuarterName("一季度");
|
|
@@ -306,24 +311,39 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
List<ProjectPlanProgressVO> vos = listMap.get(planVO.getId());
|
|
List<ProjectPlanProgressVO> vos = listMap.get(planVO.getId());
|
|
- if (isPlanDetail || vos == null || vos.size() == 0){
|
|
|
|
|
|
+ if (!isPlanDetail || vos == null || vos.size() == 0){
|
|
throw new ServiceException("数据错误,请联系管理员");
|
|
throw new ServiceException("数据错误,请联系管理员");
|
|
}
|
|
}
|
|
for (ProjectPlanProgressVO progress : vos) {
|
|
for (ProjectPlanProgressVO progress : vos) {
|
|
Integer i = progress.getPlanMonth();
|
|
Integer i = progress.getPlanMonth();
|
|
if (i <= 3){
|
|
if (i <= 3){
|
|
- progress.setPlanInvestMoney(planVO.getOneInvest());
|
|
|
|
|
|
+ if (planVO.getOneInvest() != null) {
|
|
|
|
+ progress.setPlanInvestMoney(planVO.getOneInvest());
|
|
|
|
+ progress.setInvestUnfinishedMoney(planVO.getOneInvest().subtract(monthFinished));
|
|
|
|
+ }
|
|
progress.setWorkPlan(planVO.getOnePlan());
|
|
progress.setWorkPlan(planVO.getOnePlan());
|
|
}else if (i <= 6){
|
|
}else if (i <= 6){
|
|
- progress.setPlanInvestMoney(planVO.getTwoInvest());
|
|
|
|
|
|
+ if (planVO.getTwoInvest() != null) {
|
|
|
|
+ progress.setPlanInvestMoney(planVO.getTwoInvest());
|
|
|
|
+ progress.setInvestUnfinishedMoney(planVO.getTwoInvest().subtract(monthFinished));
|
|
|
|
+ }
|
|
progress.setWorkPlan(planVO.getTwoPlan());
|
|
progress.setWorkPlan(planVO.getTwoPlan());
|
|
}else if (i <= 9){
|
|
}else if (i <= 9){
|
|
- progress.setPlanInvestMoney(planVO.getThreeInvest());
|
|
|
|
|
|
+ if (planVO.getThreeInvest() != null) {
|
|
|
|
+ progress.setPlanInvestMoney(planVO.getThreeInvest());
|
|
|
|
+ progress.setInvestUnfinishedMoney(planVO.getThreeInvest().subtract(monthFinished));
|
|
|
|
+ }
|
|
progress.setWorkPlan(planVO.getThreePlan());
|
|
progress.setWorkPlan(planVO.getThreePlan());
|
|
}else {
|
|
}else {
|
|
- progress.setPlanInvestMoney(planVO.getFourInvest());
|
|
|
|
|
|
+ if (planVO.getFourInvest() != null) {
|
|
|
|
+ progress.setPlanInvestMoney(planVO.getFourInvest());
|
|
|
|
+ progress.setInvestUnfinishedMoney(planVO.getFourInvest().subtract(monthFinished));
|
|
|
|
+ }
|
|
progress.setWorkPlan(planVO.getFourPlan());
|
|
progress.setWorkPlan(planVO.getFourPlan());
|
|
}
|
|
}
|
|
|
|
+ if (i % 3 == 0){
|
|
|
|
+ monthFinished = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
progresses = vos;
|
|
progresses = vos;
|
|
}
|
|
}
|
|
@@ -332,4 +352,267 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
vo.setList(planList);
|
|
vo.setList(planList);
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ public void updateFinished(ProjectAndPlanDetailDTO dto) {
|
|
|
|
+ //获取年数组,如果数组为null则跳过保存
|
|
|
|
+ List<ProjectInvestPlanDTO> years = dto.getList();
|
|
|
|
+ if (years == null || years.size() == 0){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<ProjectInvestPlan> updateYearPlan = new ArrayList<>();
|
|
|
|
+ for (ProjectInvestPlanDTO year : years) {
|
|
|
|
+ //如果此年不能填写,则直接跳过
|
|
|
|
+ if (year.getIsCanFill() == 0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //统计当前整年数据
|
|
|
|
+ ProjectInvestPlan yearPlan = new ProjectInvestPlan();
|
|
|
|
+ //设置底部4条数据
|
|
|
|
+ yearPlan.setId(year.getId());
|
|
|
|
+ yearPlan.setQuestionable(year.getQuestionable());
|
|
|
|
+ yearPlan.setWorkAdvise(year.getWorkAdvise());
|
|
|
|
+ yearPlan.setWriteUnit(year.getWriteUnit());
|
|
|
|
+ yearPlan.setLinkman(year.getLinkman());
|
|
|
|
+ //整年累计完成投资
|
|
|
|
+ BigDecimal allInvestFinished = BigDecimal.ZERO;
|
|
|
|
+ //季度已投资
|
|
|
|
+ BigDecimal investFinished = BigDecimal.ZERO;
|
|
|
|
+ //前面所有季度计划投资
|
|
|
|
+ BigDecimal planInvest = BigDecimal.ZERO;
|
|
|
|
+ //当季投资填写次数
|
|
|
|
+ Integer quarterFillTotal = 0;
|
|
|
|
+ //季度进度总和
|
|
|
|
+ BigDecimal planFinished = BigDecimal.ZERO;
|
|
|
|
+ //当季进度填写次数
|
|
|
|
+ Integer quarterPlanTotal = 0;
|
|
|
|
+
|
|
|
|
+ List<ProjectPlanProgress> monthList = year.getList();
|
|
|
|
+ for (ProjectPlanProgress progress : monthList) {
|
|
|
|
+ progress.setInvestMoneyAll(null);
|
|
|
|
+ //设置当前行已经填写字段
|
|
|
|
+ Integer fillField = 0;
|
|
|
|
+ Integer i = progress.getPlanMonth();
|
|
|
|
+ if (i <= 3){
|
|
|
|
+ if (year.getOneInvest() != null && year.getOneInvest().compareTo(BigDecimal.ZERO) != 0 && progress.getInvestMoney() != null) {
|
|
|
|
+ fillField ++;
|
|
|
|
+ quarterFillTotal++;
|
|
|
|
+ investFinished = investFinished.add(progress.getInvestMoney());
|
|
|
|
+ allInvestFinished = allInvestFinished.add(progress.getInvestMoney());
|
|
|
|
+ progress.setInvestMoneyAll(allInvestFinished);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(year.getOnePlan())){
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgress())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgressAll())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (progress.getPlanRatio() != null){
|
|
|
|
+ fillField++;
|
|
|
|
+ quarterPlanTotal++;
|
|
|
|
+ planFinished = planFinished.add(progress.getPlanRatio());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (i == 3){
|
|
|
|
+ if (year.getOneInvest() != null){
|
|
|
|
+ planInvest = planInvest.add(year.getOneInvest());
|
|
|
|
+ }
|
|
|
|
+ //设置一季度已投资
|
|
|
|
+ yearPlan.setOneInvestFinish(investFinished);
|
|
|
|
+ if (quarterFillTotal > 0)yearPlan.setIsFillPlan(1);
|
|
|
|
+ if (quarterFillTotal == 3){
|
|
|
|
+ //一季度全部投资都填完,设置投资比例
|
|
|
|
+ yearPlan.setIsOneInvestFinish(1);
|
|
|
|
+ yearPlan.setOneInvestRatio(investFinished.divide(year.getOneInvest(),4, RoundingMode.UP).multiply(new BigDecimal(100)).setScale(2));
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsOneInvestFinish(0);
|
|
|
|
+ }
|
|
|
|
+ if (quarterPlanTotal == 3){
|
|
|
|
+ yearPlan.setIsOnePlanFinish(1) ;
|
|
|
|
+ yearPlan.setOnePlanRatio(planFinished.divide(new BigDecimal(3),2,RoundingMode.UP));
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsOnePlanFinish(0);
|
|
|
|
+ }
|
|
|
|
+ //重置季度填写统计
|
|
|
|
+ quarterFillTotal = 0;
|
|
|
|
+ quarterPlanTotal = 0;
|
|
|
|
+ //重置季度已投资
|
|
|
|
+ investFinished = BigDecimal.ZERO;
|
|
|
|
+ planFinished = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+ }else if (i <= 6){
|
|
|
|
+ if (year.getTwoInvest() != null && year.getTwoInvest().compareTo(BigDecimal.ZERO) != 0 && progress.getInvestMoney() != null) {
|
|
|
|
+ fillField += 1;
|
|
|
|
+ quarterFillTotal++;
|
|
|
|
+ investFinished = investFinished.add(progress.getInvestMoney());
|
|
|
|
+ allInvestFinished = allInvestFinished.add(progress.getInvestMoney());
|
|
|
|
+ progress.setInvestMoneyAll(allInvestFinished);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(year.getTwoPlan())){
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgress())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgressAll())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (progress.getPlanRatio() != null){
|
|
|
|
+ fillField++;
|
|
|
|
+ quarterPlanTotal++;
|
|
|
|
+ planFinished = planFinished.add(progress.getPlanRatio());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (i == 6){
|
|
|
|
+ if (year.getTwoInvest() != null){
|
|
|
|
+ planInvest = planInvest.add(year.getTwoInvest());
|
|
|
|
+ }
|
|
|
|
+ //设置季度已投资
|
|
|
|
+ yearPlan.setOneInvestFinish(investFinished);
|
|
|
|
+ if (quarterFillTotal > 0)yearPlan.setIsFillPlan(1);
|
|
|
|
+ if (quarterFillTotal == 3){
|
|
|
|
+ //季度全部投资都填完,设置投资比例
|
|
|
|
+ yearPlan.setIsTwoInvestFinish(1);
|
|
|
|
+ yearPlan.setTwoInvestRatio(investFinished.divide(year.getTwoInvest(),4, RoundingMode.UP).multiply(new BigDecimal(100)).setScale(2));
|
|
|
|
+ //设置累计投资比例,前面所有季度之和
|
|
|
|
+ if (planInvest.compareTo(BigDecimal.ZERO) != 0){
|
|
|
|
+ yearPlan.setTwoAggregateRatio(allInvestFinished.divide(planInvest,4, RoundingMode.UP).multiply(new BigDecimal(100)).setScale(2));
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsTwoInvestFinish(0);
|
|
|
|
+ }
|
|
|
|
+ if (quarterPlanTotal == 3){
|
|
|
|
+ yearPlan.setIsTwoPlanFinish(1); ;
|
|
|
|
+ yearPlan.setTwoPlanRatio(planFinished.divide(new BigDecimal(3),2,RoundingMode.UP));
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsTwoPlanFinish(0);
|
|
|
|
+ }
|
|
|
|
+ //重置季度填写统计
|
|
|
|
+ quarterFillTotal = 0;
|
|
|
|
+ quarterPlanTotal = 0;
|
|
|
|
+ //重置季度已投资
|
|
|
|
+ investFinished = BigDecimal.ZERO;
|
|
|
|
+ planFinished = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+ }else if (i <= 9){
|
|
|
|
+ if (year.getThreeInvest() != null && year.getThreeInvest().compareTo(BigDecimal.ZERO) != 0 && progress.getInvestMoney() != null) {
|
|
|
|
+ fillField += 1;
|
|
|
|
+ quarterFillTotal++;
|
|
|
|
+ investFinished = investFinished.add(progress.getInvestMoney());
|
|
|
|
+ allInvestFinished = allInvestFinished.add(progress.getInvestMoney());
|
|
|
|
+ progress.setInvestMoneyAll(allInvestFinished);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(year.getThreePlan())){
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgress())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgressAll())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (progress.getPlanRatio() != null){
|
|
|
|
+ fillField++;
|
|
|
|
+ quarterPlanTotal++;
|
|
|
|
+ planFinished = planFinished.add(progress.getPlanRatio());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (i == 9){
|
|
|
|
+ if (year.getThreeInvest() != null){
|
|
|
|
+ planInvest = planInvest.add(year.getThreeInvest());
|
|
|
|
+ }
|
|
|
|
+ //设置季度已投资
|
|
|
|
+ yearPlan.setOneInvestFinish(investFinished);
|
|
|
|
+ if (quarterFillTotal > 0)yearPlan.setIsFillPlan(1);
|
|
|
|
+ if (quarterFillTotal == 3){
|
|
|
|
+ //季度全部投资都填完,设置投资比例
|
|
|
|
+ yearPlan.setIsThreeInvestFinish(1);
|
|
|
|
+ yearPlan.setThreeInvestRatio(investFinished.divide(year.getThreeInvest(),4, RoundingMode.UP).multiply(new BigDecimal(100)).setScale(2));
|
|
|
|
+ //设置累计投资比例,前面所有季度之和
|
|
|
|
+ if (planInvest.compareTo(BigDecimal.ZERO) != 0){
|
|
|
|
+ yearPlan.setThreeAggregateRatio(allInvestFinished.divide(planInvest,4, RoundingMode.UP).multiply(new BigDecimal(100)).setScale(2));
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsThreeInvestFinish(0);
|
|
|
|
+ }
|
|
|
|
+ if (quarterPlanTotal == 3){
|
|
|
|
+ yearPlan.setIsThreePlanFinish(1); ;
|
|
|
|
+ yearPlan.setThreePlanRatio(planFinished.divide(new BigDecimal(3),2,RoundingMode.UP));
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsThreePlanFinish(0);
|
|
|
|
+ }
|
|
|
|
+ //重置季度填写统计
|
|
|
|
+ quarterFillTotal = 0;
|
|
|
|
+ quarterPlanTotal = 0;
|
|
|
|
+ //重置季度已投资
|
|
|
|
+ investFinished = BigDecimal.ZERO;
|
|
|
|
+ planFinished = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if (year.getFourInvest() != null && year.getFourInvest().compareTo(BigDecimal.ZERO) != 0 && progress.getInvestMoney() != null) {
|
|
|
|
+ fillField += 1;
|
|
|
|
+ quarterFillTotal++;
|
|
|
|
+ investFinished = investFinished.add(progress.getInvestMoney());
|
|
|
|
+ allInvestFinished = allInvestFinished.add(progress.getInvestMoney());
|
|
|
|
+ progress.setInvestMoneyAll(allInvestFinished);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(year.getFourPlan())){
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgress())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(progress.getWorkProgressAll())){
|
|
|
|
+ fillField++;
|
|
|
|
+ }
|
|
|
|
+ if (progress.getPlanRatio() != null){
|
|
|
|
+ fillField++;
|
|
|
|
+ quarterPlanTotal++;
|
|
|
|
+ planFinished = planFinished.add(progress.getPlanRatio());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (i == 12){
|
|
|
|
+ if (year.getFourInvest() != null){
|
|
|
|
+ planInvest = planInvest.add(year.getFourInvest());
|
|
|
|
+ }
|
|
|
|
+ //设置季度已投资
|
|
|
|
+ yearPlan.setFourInvestFinish(investFinished);
|
|
|
|
+ if (quarterFillTotal > 0)yearPlan.setIsFillPlan(1);
|
|
|
|
+ if (quarterFillTotal == 3){
|
|
|
|
+ //季度全部投资都填完,设置投资比例
|
|
|
|
+ yearPlan.setIsFourInvestFinish(1);
|
|
|
|
+ yearPlan.setFourInvestRatio(investFinished.divide(year.getFourInvest(),4, RoundingMode.UP).multiply(new BigDecimal(100)).setScale(2));
|
|
|
|
+ //设置累计投资比例,前面所有季度之和
|
|
|
|
+ if (planInvest.compareTo(BigDecimal.ZERO) != 0){
|
|
|
|
+ yearPlan.setFourAggregateRatio(allInvestFinished.divide(planInvest,4, RoundingMode.UP).multiply(new BigDecimal(100)).setScale(2));
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsFourInvestFinish(0);
|
|
|
|
+ }
|
|
|
|
+ if (quarterPlanTotal == 3){
|
|
|
|
+ yearPlan.setIsFourPlanFinish(1); ;
|
|
|
|
+ yearPlan.setFourPlanRatio(planFinished.divide(new BigDecimal(3),2,RoundingMode.UP));
|
|
|
|
+ }else {
|
|
|
|
+ yearPlan.setIsFourPlanFinish(0);
|
|
|
|
+ }
|
|
|
|
+ //重置季度填写统计
|
|
|
|
+ quarterFillTotal = 0;
|
|
|
|
+ quarterPlanTotal = 0;
|
|
|
|
+ //重置季度已投资
|
|
|
|
+ investFinished = BigDecimal.ZERO;
|
|
|
|
+ planFinished = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ progress.setFillField(fillField);
|
|
|
|
+ }
|
|
|
|
+ //直接保存或修改月计划集合
|
|
|
|
+ planProgressService.saveOrUpdateBatch(monthList);
|
|
|
|
+ //添加要修改年计划
|
|
|
|
+ yearPlan.setYearFinishInvest(allInvestFinished);
|
|
|
|
+ yearPlan.setYearUnfinishedInvest(year.getYearlyInvest().subtract(allInvestFinished));
|
|
|
|
+ updateYearPlan.add(yearPlan);
|
|
|
|
+ }
|
|
|
|
+ //修改年计划
|
|
|
|
+ investPlanService.updateBatchById(updateYearPlan);
|
|
|
|
+ }
|
|
}
|
|
}
|