|
@@ -8,12 +8,13 @@ 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;
|
|
|
-import com.ozs.common.utils.bean.BeanValidators;
|
|
|
import com.ozs.plan.doman.PlanYears;
|
|
|
import com.ozs.plan.doman.vo.requestVo.PlanYearsStandardVo;
|
|
|
import com.ozs.plan.doman.vo.responseVo.PlanYearsResponseVo;
|
|
|
import com.ozs.plan.mapper.PlanYearsMapper;
|
|
|
import com.ozs.plan.service.PlanYearsService;
|
|
|
+import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
|
|
|
+import com.ozs.system.service.ISysDeptService;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
|
import com.ozs.system.service.impl.SysUserServiceImpl;
|
|
|
import org.slf4j.Logger;
|
|
@@ -42,6 +43,8 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
protected Validator validator;
|
|
|
@Autowired
|
|
|
private ISysDictTypeService dictTypeService;
|
|
|
+ @Autowired
|
|
|
+ private ISysDeptService deptService;
|
|
|
|
|
|
@Override
|
|
|
public List<PlanYears> selectPlanYearsList(PlanYearsStandardVo vo) {
|
|
@@ -50,6 +53,27 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
try {
|
|
|
BeanUtils.copyProperties(vo, ofYears);
|
|
|
planYears = planYearsMapper.selectPlanYearsList(ofYears);
|
|
|
+ for (PlanYears planYear : planYears) {
|
|
|
+ SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo) deptService.selectDeptById(planYear.getPurchaseDeptId()).get("sysDept");
|
|
|
+ planYear.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return planYears;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<PlanYears> selectPlanYearsExamineList(PlanYearsStandardVo vo) {
|
|
|
+ PlanYears ofYears = new PlanYears();
|
|
|
+ List<PlanYears> planYears = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ BeanUtils.copyProperties(vo, ofYears);
|
|
|
+ planYears = planYearsMapper.selectPlanYearsExamineList(ofYears);
|
|
|
+ for (PlanYears planYear : planYears) {
|
|
|
+ SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo) deptService.selectDeptById(planYear.getPurchaseDeptId()).get("sysDept");
|
|
|
+ planYear.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -125,6 +149,7 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
HashMap<String, String> planPurchaseModesMap = planEnums.get("PlanPurchaseModes");
|
|
|
HashMap<String, String> projectAttributes = planEnums.get("ProjectAttributes");
|
|
|
HashMap<String, String> purchaseServices = planEnums.get("purchaseServices");
|
|
|
+ //deptService.se
|
|
|
int successNum = 0;
|
|
|
int failureNum = 0;
|
|
|
StringBuilder successMsg = new StringBuilder();
|
|
@@ -139,9 +164,17 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
ofYear.setProjectType(projectTypesMap.get(ofYear.getProjectType()));
|
|
|
ofYear.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
ofYear.setPurchaseMode(planPurchaseModesMap.get(ofYear.getPurchaseMode()));
|
|
|
- ofYear.setProjectAtt(projectAttributes.get(ofYear.getProjectAtt()));
|
|
|
+ //项目属性是多选字段
|
|
|
+ String[] split = ofYear.getProjectAtt().split(",");
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ if (split.length > 1) {
|
|
|
+ for (String s : split) {
|
|
|
+ builder.append(projectAttributes.get(s) + ",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ofYear.setProjectAtt(builder.toString());
|
|
|
ofYear.setPurchaseServices(purchaseServices.get(ofYear.getPurchaseServices()));
|
|
|
- ofYear.setCreateBy(String.valueOf(loginUser.getUserId()));
|
|
|
+ ofYear.setCreated(String.valueOf(loginUser.getUserId()));
|
|
|
ofYear.setCreateTime(new Date());
|
|
|
//采购单位
|
|
|
planYearsMapper.insertPlanYears(ofYear);
|
|
@@ -150,7 +183,6 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
//} else if (isUpdateSupport) {
|
|
|
// PlanYears years = plan.get(0);
|
|
|
// BeanValidators.validateWithException(validator, ofYear);
|
|
|
- // years.setCreateBy(operName);
|
|
|
// years.setCreateTime(new Date());
|
|
|
// years.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
// planYearsMapper.updateById(years);
|
|
@@ -232,6 +264,19 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AjaxResult appUpdate(PlanYearsStandardVo vo) {
|
|
|
+ PlanYears ofYears = new PlanYears();
|
|
|
+ BeanUtils.copyProperties(vo, ofYears);
|
|
|
+ //申请后会成为未提交的状态,可以进行修改
|
|
|
+ ofYears.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
+ int review = planYearsMapper.review(ofYears);
|
|
|
+ if (review != 1) {
|
|
|
+ return AjaxResult.error("项目状态数据异常");
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
//判断是否为超额计划
|
|
|
public String isExcessOrNo(String projectType, BigDecimal evaluation) {
|
|
|
BigDecimal threshold = new BigDecimal(0);
|