|
@@ -8,11 +8,11 @@ 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.PlanOfYears;
|
|
|
-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.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.service.ISysDictTypeService;
|
|
|
import com.ozs.system.service.impl.SysUserServiceImpl;
|
|
|
import org.slf4j.Logger;
|
|
@@ -32,35 +32,35 @@ import java.util.List;
|
|
|
* @author buzhanyi
|
|
|
*/
|
|
|
@Service
|
|
|
-public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
+public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
|
|
|
|
|
@Autowired
|
|
|
- PlanOfYearsMapper planOfYearsMapper;
|
|
|
+ PlanYearsMapper planYearsMapper;
|
|
|
@Autowired
|
|
|
protected Validator validator;
|
|
|
@Autowired
|
|
|
private ISysDictTypeService dictTypeService;
|
|
|
|
|
|
@Override
|
|
|
- public List<PlanOfYears> selectPlanOfYearsList(PlanOfYearsStandardVo vo) {
|
|
|
- PlanOfYears ofYears = new PlanOfYears();
|
|
|
- List<PlanOfYears> planOfYears = new ArrayList<>();
|
|
|
+ public List<PlanYears> selectPlanOfYearsList(PlanYearsStandardVo vo) {
|
|
|
+ PlanYears ofYears = new PlanYears();
|
|
|
+ List<PlanYears> planYears = new ArrayList<>();
|
|
|
try {
|
|
|
BeanUtils.copyProperties(vo, ofYears);
|
|
|
- planOfYears = planOfYearsMapper.selectPlanOfYearsList(ofYears);
|
|
|
+ planYears = planYearsMapper.selectPlanOfYearsList(ofYears);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return planOfYears;
|
|
|
+ return planYears;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult insertPlanOfYears(PlanOfYearsStandardVo yearsStandardVo) {
|
|
|
- if (planOfYearsMapper.countProjectName(yearsStandardVo.getProjectName()).size() > 0) {
|
|
|
+ public AjaxResult insertPlanOfYears(PlanYearsStandardVo yearsStandardVo) {
|
|
|
+ if (planYearsMapper.countProjectName(yearsStandardVo.getProjectName()).size() > 0) {
|
|
|
return AjaxResult.error("该项目名称已经存在");
|
|
|
}
|
|
|
- PlanOfYears ofYears = new PlanOfYears();
|
|
|
+ PlanYears ofYears = new PlanYears();
|
|
|
try {
|
|
|
BeanUtils.copyProperties(yearsStandardVo, ofYears);
|
|
|
} catch (Exception e) {
|
|
@@ -92,39 +92,39 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
}
|
|
|
ofYears.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
ofYears.setCreateTime(new Date());
|
|
|
- planOfYearsMapper.insertPlanOfYears(ofYears);
|
|
|
+ planYearsMapper.insertPlanOfYears(ofYears);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AjaxResult deletePlanOfYearsByIds(Long[] planIds) {
|
|
|
- planOfYearsMapper.deletePlanOfYearsByIds(planIds);
|
|
|
+ planYearsMapper.deletePlanOfYearsByIds(planIds);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AjaxResult deletePlanOfYearsById(Long planId) {
|
|
|
- planOfYearsMapper.deletePlanOfYearsById(planId);
|
|
|
+ planYearsMapper.deletePlanOfYearsById(planId);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult view(PlanOfYearsStandardVo yearsStandardVo) {
|
|
|
- PlanOfYearsResponseVo planOfYearsResponseVo = new PlanOfYearsResponseVo();
|
|
|
- PlanOfYears byId = planOfYearsMapper.getById(yearsStandardVo.getPlanYearId());
|
|
|
+ public AjaxResult view(PlanYearsStandardVo yearsStandardVo) {
|
|
|
+ PlanYearsResponseVo planYearsResponseVo = new PlanYearsResponseVo();
|
|
|
+ PlanYears byId = planYearsMapper.getById(yearsStandardVo.getPlanYearId());
|
|
|
if (byId == null) {
|
|
|
return AjaxResult.error("数据查询失败");
|
|
|
}
|
|
|
- BeanUtils.copyProperties(byId, planOfYearsResponseVo);
|
|
|
- return AjaxResult.success(planOfYearsResponseVo);
|
|
|
+ BeanUtils.copyProperties(byId, planYearsResponseVo);
|
|
|
+ return AjaxResult.success(planYearsResponseVo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult update(PlanOfYearsStandardVo yearsStandardVo) {
|
|
|
- if (planOfYearsMapper.countProjectNameOther(yearsStandardVo.getProjectName(), String.valueOf(yearsStandardVo.getPlanYearId())) > 0) {
|
|
|
+ public AjaxResult update(PlanYearsStandardVo yearsStandardVo) {
|
|
|
+ if (planYearsMapper.countProjectNameOther(yearsStandardVo.getProjectName(), String.valueOf(yearsStandardVo.getPlanYearId())) > 0) {
|
|
|
return AjaxResult.error("该项目名称已经存在");
|
|
|
}
|
|
|
- PlanOfYears ofYears = new PlanOfYears();
|
|
|
+ PlanYears ofYears = new PlanYears();
|
|
|
try {
|
|
|
BeanUtils.copyProperties(yearsStandardVo, ofYears);
|
|
|
} catch (Exception e) {
|
|
@@ -155,34 +155,42 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
ofYears.setIsExcess("0");
|
|
|
}
|
|
|
|
|
|
- planOfYearsMapper.updateById(ofYears);
|
|
|
+ planYearsMapper.updateById(ofYears);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String importPlanOfYears(List<PlanOfYears> planOfYears, boolean isUpdateSupport, String operName) {
|
|
|
- if (StringUtils.isNull(planOfYears) || planOfYears.size() == 0) {
|
|
|
+ public String importPlanOfYears(List<PlanYears> planYears, boolean isUpdateSupport, String operName) {
|
|
|
+ if (StringUtils.isNull(planYears) || planYears.size() == 0) {
|
|
|
throw new ServiceException("导入年度计划数据不能为空!");
|
|
|
}
|
|
|
+ HashMap<String, HashMap<String, String>> planEnums = dictTypeService.getAboutEnums();
|
|
|
+ HashMap<String, String> projectTypesMap = planEnums.get("ProjectTypes");
|
|
|
+ HashMap<String, String> projectStatusMap = planEnums.get("ProjectStatus");
|
|
|
+ HashMap<String, String> planPurchaseModesMap = planEnums.get("PlanPurchaseModes");
|
|
|
+ HashMap<String, String> projectAttributes = planEnums.get("ProjectAttributes");
|
|
|
+ HashMap<String, String> purchaseServices = planEnums.get("purchaseServices");
|
|
|
int successNum = 0;
|
|
|
int failureNum = 0;
|
|
|
StringBuilder successMsg = new StringBuilder();
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
- for (PlanOfYears ofYear : planOfYears) {
|
|
|
+ for (PlanYears ofYear : planYears) {
|
|
|
try {
|
|
|
//验证项目名称是否重复导入
|
|
|
- List<PlanOfYears> plan = planOfYearsMapper.countProjectName(ofYear.getProjectName());
|
|
|
+ List<PlanYears> plan = planYearsMapper.countProjectName(ofYear.getProjectName());
|
|
|
if (plan.size() == 0) {
|
|
|
- planOfYearsMapper.insertPlanOfYears(ofYear);
|
|
|
+ //将录入信息中的值更改为要保存的数据
|
|
|
+
|
|
|
+ planYearsMapper.insertPlanOfYears(ofYear);
|
|
|
successNum++;
|
|
|
successMsg.append("<br/>" + successNum + "、项目 " + ofYear.getProjectName() + " 导入成功");
|
|
|
} else if (isUpdateSupport) {
|
|
|
- PlanOfYears years = plan.get(0);
|
|
|
+ PlanYears years = plan.get(0);
|
|
|
BeanValidators.validateWithException(validator, ofYear);
|
|
|
years.setCreateBy(operName);
|
|
|
years.setCreateTime(new Date());
|
|
|
years.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
- planOfYearsMapper.updateById(years);
|
|
|
+ planYearsMapper.updateById(years);
|
|
|
successNum++;
|
|
|
successMsg.append("<br/>" + successNum + "、项目 " + ofYear.getProjectName() + " 更新成功");
|
|
|
} else {
|
|
@@ -206,7 +214,7 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult commit(PlanOfYearsStandardVo yearsStandardVo) {
|
|
|
+ public AjaxResult commit(PlanYearsStandardVo yearsStandardVo) {
|
|
|
//PlanOfYears byId = planOfYearsMapper.getById(yearsStandardVo.getPlanYearId());
|
|
|
//BigDecimal evaluation = byId.getEvaluation();
|
|
|
//BigDecimal threshold = new BigDecimal(0);
|
|
@@ -230,7 +238,7 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
// //是超额项目
|
|
|
//}
|
|
|
|
|
|
- int commit = planOfYearsMapper.commit(yearsStandardVo.getPlanYearId());
|
|
|
+ int commit = planYearsMapper.commit(yearsStandardVo.getPlanYearId());
|
|
|
if (commit != 1) {
|
|
|
return AjaxResult.error("项目状态数据异常");
|
|
|
}
|
|
@@ -238,11 +246,11 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult reviewTo(PlanOfYearsStandardVo vo) {
|
|
|
- PlanOfYears ofYears = new PlanOfYears();
|
|
|
+ public AjaxResult reviewTo(PlanYearsStandardVo vo) {
|
|
|
+ PlanYears ofYears = new PlanYears();
|
|
|
ofYears.setPlanYearId(vo.getPlanYearId());
|
|
|
ofYears.setProjectStatus(ProjectStatus.PLANTOEXAMINE.getCode());
|
|
|
- int review = planOfYearsMapper.review(ofYears);
|
|
|
+ int review = planYearsMapper.review(ofYears);
|
|
|
if (review != 1) {
|
|
|
return AjaxResult.error("项目状态数据异常");
|
|
|
}
|
|
@@ -250,11 +258,11 @@ public class PlanOfYearsServiceImpl implements PlanOfYearsService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult reviewReturn(PlanOfYearsStandardVo vo) {
|
|
|
- PlanOfYears ofYears = new PlanOfYears();
|
|
|
+ public AjaxResult reviewReturn(PlanYearsStandardVo vo) {
|
|
|
+ PlanYears ofYears = new PlanYears();
|
|
|
BeanUtils.copyProperties(vo, ofYears);
|
|
|
ofYears.setProjectStatus(ProjectStatus.PLANTOBACK.getCode());
|
|
|
- int review = planOfYearsMapper.review(ofYears);
|
|
|
+ int review = planYearsMapper.review(ofYears);
|
|
|
if (review != 1) {
|
|
|
return AjaxResult.error("项目状态数据异常");
|
|
|
}
|