|
@@ -14,9 +14,11 @@ import com.ozs.common.enums.SysFileRefEnum;
|
|
|
import com.ozs.common.exception.ServiceException;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.bean.BeanUtils;
|
|
|
+import com.ozs.plan.doman.PlanQuarter;
|
|
|
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.PlanQuarterMapper;
|
|
|
import com.ozs.plan.mapper.PlanYearsMapper;
|
|
|
import com.ozs.plan.service.PlanYearsService;
|
|
|
import com.ozs.system.domain.SysFileInfo;
|
|
@@ -52,6 +54,8 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
@Autowired
|
|
|
PlanYearsMapper planYearsMapper;
|
|
|
@Autowired
|
|
|
+ PlanQuarterMapper planQuarterMapper;
|
|
|
+ @Autowired
|
|
|
protected Validator validator;
|
|
|
@Autowired
|
|
|
private ISysDictTypeService dictTypeService;
|
|
@@ -284,6 +288,7 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public String importPlanYears(List<PlanYearsStandardVo> planYears, boolean isUpdateSupport, LoginUser loginUser) {
|
|
|
if (StringUtils.isNull(planYears) || planYears.size() == 0) {
|
|
@@ -314,18 +319,21 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
if (planYearsMapper.countProjectName(ofYear.getProjectName()) == 0) {
|
|
|
//采购单位
|
|
|
SysDept info = deptMapper.checkDeptNameOnlyOne(ofYear.getPurchaseDeptName());
|
|
|
- if (StringUtils.isNotNull(info)) {
|
|
|
+ if (!ObjectUtils.isEmpty(info)) {
|
|
|
ofYear.setPurchaseDeptId(info.getDeptId());
|
|
|
+ } else {
|
|
|
+ ++failureNum;
|
|
|
+ failureMsg.append("*" + failureNum + "*采购单位“" + ofYear.getPurchaseDeptName() + "”不存在");
|
|
|
}
|
|
|
ofYear.setProjectType(projectTypesMap.get(ofYear.getProjectType()));
|
|
|
ofYear.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
ofYear.setPurchaseMode(planPurchaseModesMap.get(ofYear.getPurchaseMode()));
|
|
|
//项目属性是多选字段
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
- if (ofYear.getProjectAttr().contains(",")) {
|
|
|
- String[] split = ofYear.getProjectAttr().split(",");
|
|
|
+ if (ofYear.getProjectAttr().contains(",")) {
|
|
|
+ String[] split = ofYear.getProjectAttr().split(",");
|
|
|
for (String s : split) {
|
|
|
- builder.append(projectAttributes.get(s) + ",");
|
|
|
+ builder.append(projectAttributes.get(s) + ",");
|
|
|
}
|
|
|
} else {
|
|
|
builder.append(projectAttributes.get(ofYear.getProjectAttr()));
|
|
@@ -348,11 +356,11 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
// successMsg.append("<br/>" + successNum + "、项目 " + ofYear.getProjectName() + " 更新成功");
|
|
|
} else {
|
|
|
failureNum++;
|
|
|
- failureMsg.append("*" + successNum + "、项目 " + ofYear.getProjectName() + " 已存在");
|
|
|
+ failureMsg.append(failureNum + "*项目 " + ofYear.getProjectName() + " 已存在!/n");
|
|
|
}
|
|
|
} catch (Exception exc) {
|
|
|
failureNum++;
|
|
|
- String msg = "*" + successNum + "、项目 " + ofYear.getProjectName() + " 导入失败";
|
|
|
+ String msg = "*" + successNum + "*项目 " + ofYear.getProjectName() + " 导入失败";
|
|
|
failureMsg.append(msg + exc.getMessage());
|
|
|
log.error(msg, exc);
|
|
|
}
|
|
@@ -403,6 +411,11 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
public AjaxResult reviewTo(PlanYearsStandardVo vo) {
|
|
|
PlanYears ofYears = new PlanYears();
|
|
|
BeanUtils.copyProperties(vo, ofYears);
|
|
|
+ //年度计划审核通过后同步到季度计划
|
|
|
+ PlanYears byId = planYearsMapper.getById(vo.getPlanYearId());
|
|
|
+ PlanQuarter quarters = new PlanQuarter();
|
|
|
+ BeanUtils.copyProperties(byId, quarters);
|
|
|
+ planQuarterMapper.insertPlanQuarter(quarters);
|
|
|
ofYears.setPlanYearId(vo.getPlanYearId());
|
|
|
ofYears.setProjectStatus(ProjectStatus.PLANTOEXAMINE.getCode());
|
|
|
return review(vo, ofYears);
|
|
@@ -532,11 +545,11 @@ public class PlanYearsServiceImpl implements PlanYearsService {
|
|
|
//项目属性是拼接的
|
|
|
if (planYear.getProjectAttr().length() > 1) {
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
- String[] split = planYear.getProjectAttr().split(",");
|
|
|
+ String[] split = planYear.getProjectAttr().split(",");
|
|
|
for (String s : split) {
|
|
|
for (Map.Entry<String, String> entry : projectAttributes.entrySet()) {
|
|
|
if (s.equals(entry.getValue())) {
|
|
|
- builder.append(entry.getKey() + ",");
|
|
|
+ builder.append(entry.getKey() + ",");
|
|
|
break;
|
|
|
}
|
|
|
}
|