|
@@ -1,7 +1,9 @@
|
|
|
package com.ozs.plan.service.impl;
|
|
|
|
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
|
+import com.ozs.common.core.domain.entity.SysDictData;
|
|
|
import com.ozs.common.enums.ProjectStatus;
|
|
|
+import com.ozs.common.enums.ProjectTypes;
|
|
|
import com.ozs.common.exception.ServiceException;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.bean.BeanUtils;
|
|
@@ -11,6 +13,7 @@ import com.ozs.plan.doman.vo.requestVo.PlanOfYearsStandardVo;
|
|
|
import com.ozs.plan.doman.vo.responseVo.PlanOfYearsResponseVo;
|
|
|
import com.ozs.plan.mapper.PlanOfYearsMapper;
|
|
|
import com.ozs.plan.service.PlanOfYearsService;
|
|
|
+import com.ozs.system.service.ISysDictTypeService;
|
|
|
import com.ozs.system.service.impl.SysUserServiceImpl;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -18,8 +21,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.validation.Validator;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -33,6 +39,8 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
PlanOfYearsMapper planOfYearsMapper;
|
|
|
@Autowired
|
|
|
protected Validator validator;
|
|
|
+ @Autowired
|
|
|
+ private ISysDictTypeService dictTypeService;
|
|
|
|
|
|
@Override
|
|
|
public List<PlanOfYears> selectPlanOfYearsList(PlanOfYearsStandardVo vo) {
|
|
@@ -58,8 +66,30 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- //判断是否为超额计划---
|
|
|
-
|
|
|
+ //判断是否为超额计划
|
|
|
+ BigDecimal evaluation = yearsStandardVo.getEvaluation();
|
|
|
+ BigDecimal threshold = new BigDecimal(0);
|
|
|
+ //获取各个项目类型设定的概算金额阈值
|
|
|
+ List<SysDictData> data = dictTypeService.selectDictDataByType("sys_over_limit_threshold");
|
|
|
+ HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
+ //各个类型的概算金额阈值
|
|
|
+ for (SysDictData dictData : data) {
|
|
|
+ // 类型----阈值
|
|
|
+ thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
+ }
|
|
|
+ //项目类型
|
|
|
+ for (ProjectTypes value : ProjectTypes.values()) {
|
|
|
+ if (yearsStandardVo.getProjectType().equals(value.getCode())) {
|
|
|
+ threshold = BigDecimal.valueOf(Long.parseLong(thresholdMap.get(value.getInfo())));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (evaluation.compareTo(threshold) == 1) {
|
|
|
+ //是超额项目
|
|
|
+ ofYears.setIsExcess("1");
|
|
|
+ } else {
|
|
|
+ ofYears.setIsExcess("0");
|
|
|
+ }
|
|
|
ofYears.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
ofYears.setCreateTime(new Date());
|
|
|
planOfYearsMapper.insertPlanOfYears(ofYears);
|
|
@@ -100,6 +130,31 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ BigDecimal evaluation = ofYears.getEvaluation();
|
|
|
+ BigDecimal threshold = new BigDecimal(0);
|
|
|
+ //获取各个项目类型设定的概算金额阈值
|
|
|
+ List<SysDictData> data = dictTypeService.selectDictDataByType("sys_over_limit_threshold");
|
|
|
+ HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
+ //各个类型的概算金额阈值
|
|
|
+ for (SysDictData dictData : data) {
|
|
|
+ // 类型----阈值
|
|
|
+ thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
+ }
|
|
|
+ //项目类型
|
|
|
+ for (ProjectTypes value : ProjectTypes.values()) {
|
|
|
+ if (ofYears.getProjectType().equals(value.getCode())) {
|
|
|
+ threshold = BigDecimal.valueOf(Long.parseLong(thresholdMap.get(value.getInfo())));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (evaluation.compareTo(threshold) == 1) {
|
|
|
+ //是超额项目
|
|
|
+ ofYears.setIsExcess("1");
|
|
|
+ } else {
|
|
|
+ ofYears.setIsExcess("0");
|
|
|
+ }
|
|
|
+
|
|
|
planOfYearsMapper.updateById(ofYears);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
@@ -152,6 +207,28 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
|
|
|
@Override
|
|
|
public AjaxResult commit(PlanOfYearsStandardVo yearsStandardVo) {
|
|
|
+ //PlanOfYears byId = planOfYearsMapper.getById(yearsStandardVo.getPlanYearId());
|
|
|
+ //BigDecimal evaluation = byId.getEvaluation();
|
|
|
+ //BigDecimal threshold = new BigDecimal(0);
|
|
|
+ ////获取各个项目类型设定的概算金额阈值
|
|
|
+ //List<SysDictData> data = dictTypeService.selectDictDataByType("sys_over_limit_threshold");
|
|
|
+ //HashMap<String, String> thresholdMap = new LinkedHashMap<>();
|
|
|
+ ////各个类型的概算金额阈值
|
|
|
+ //for (SysDictData dictData : data) {
|
|
|
+ // // 类型----阈值
|
|
|
+ // thresholdMap.put(dictData.getDictLabel(), dictData.getDictValue());
|
|
|
+ //}
|
|
|
+ ////项目类型
|
|
|
+ //for (ProjectTypes value : ProjectTypes.values()) {
|
|
|
+ // if (byId.getProjectType().equals(value.getCode())) {
|
|
|
+ // threshold = BigDecimal.valueOf(Long.parseLong(thresholdMap.get(value.getInfo())));
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //if (evaluation.compareTo(threshold) == 1) {
|
|
|
+ // //是超额项目
|
|
|
+ //}
|
|
|
|
|
|
int commit = planOfYearsMapper.commit(yearsStandardVo.getPlanYearId());
|
|
|
if (commit != 1) {
|