|
@@ -35,14 +35,17 @@ import com.ozs.pm.mapper.PmAuditDeptRefMapper;
|
|
|
import com.ozs.pm.mapper.PmDemandMapper;
|
|
|
import com.ozs.pm.service.IPmDemandService;
|
|
|
import com.ozs.pm.service.PmAuditDeptRefService;
|
|
|
+import com.ozs.system.domain.SysDeptOrgan;
|
|
|
import com.ozs.system.domain.SysFileInfo;
|
|
|
import com.ozs.system.domain.SysFileRef;
|
|
|
import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
|
|
|
import com.ozs.system.mapper.SysDeptMapper;
|
|
|
+import com.ozs.system.mapper.SysDeptOrganMapper;
|
|
|
import com.ozs.system.mapper.SysFileRefMapper;
|
|
|
import com.ozs.system.service.ISysDeptService;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
|
import com.ozs.system.service.ISysUserService;
|
|
|
+import com.ozs.system.service.SysDeptOrganService;
|
|
|
import com.ozs.system.service.SysFileService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -60,31 +63,33 @@ import java.util.stream.Collectors;
|
|
|
public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMapper, ProvisionalPlan> implements ProvisionalPlanService {
|
|
|
|
|
|
@Autowired
|
|
|
- private ProvisionalPlanMapper provisionalPlanMapper;
|
|
|
+ private SysDeptMapper deptMapper;
|
|
|
@Autowired
|
|
|
- private ISysDictTypeService dictTypeService;
|
|
|
+ private SysFileService fileService;
|
|
|
@Autowired
|
|
|
- private SysDeptMapper deptMapper;
|
|
|
+ private ISysUserService userService;
|
|
|
@Autowired
|
|
|
private ISysDeptService deptService;
|
|
|
@Autowired
|
|
|
- private PlanYearsMapper planYearsMapper;
|
|
|
+ private PmDemandMapper pmDemandMapper;
|
|
|
@Autowired
|
|
|
- private SysFileRefMapper sysFileRefMapper;
|
|
|
+ private IPmDemandService demandService;
|
|
|
@Autowired
|
|
|
- private SysFileService fileService;
|
|
|
+ private PlanYearsMapper planYearsMapper;
|
|
|
@Autowired
|
|
|
- private PmDemandMapper pmDemandMapper;
|
|
|
+ private PlanQuarterService quarterService;
|
|
|
@Autowired
|
|
|
- private IPmDemandService demandService;
|
|
|
+ private SysFileRefMapper sysFileRefMapper;
|
|
|
@Autowired
|
|
|
- private ISysUserService userService;
|
|
|
+ private ISysDictTypeService dictTypeService;
|
|
|
@Autowired
|
|
|
- private PmAuditDeptRefService pmAuditDeptRefService;
|
|
|
+ private SysDeptOrganMapper sysDeptOrganMapper;
|
|
|
@Autowired
|
|
|
private PmAuditDeptRefMapper pmAuditDeptRefMapper;
|
|
|
@Autowired
|
|
|
- private PlanQuarterService quarterService;
|
|
|
+ private PmAuditDeptRefService pmAuditDeptRefService;
|
|
|
+ @Autowired
|
|
|
+ private ProvisionalPlanMapper provisionalPlanMapper;
|
|
|
|
|
|
@Override
|
|
|
public int deleteProvisionalPlanById(Long planPracticalId) {
|
|
@@ -133,77 +138,79 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
|
|
|
for (ProvisionalPlan ofProvisionalPlan : provisionalPlans) {
|
|
|
try {
|
|
|
//将录入信息中的值更改为要保存的数据
|
|
|
- //采购单位
|
|
|
- SysDept info = deptMapper.checkDeptNameOnlyOne(ofProvisionalPlan.getPurchaseDeptName());
|
|
|
- if (StringUtils.isNotNull(info)) {
|
|
|
- ofProvisionalPlan.setPurchaseDeptId(String.valueOf(info.getDeptId()));
|
|
|
- }
|
|
|
- ofProvisionalPlan.setProjectType(projectTypesMap.get(ofProvisionalPlan.getProjectType()));
|
|
|
- ofProvisionalPlan.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
-
|
|
|
- //机关业务指导处是多选字段
|
|
|
- StringBuilder zBuilder = new StringBuilder();
|
|
|
- if (ofProvisionalPlan.getOrganDivision().contains(",")) {
|
|
|
- String[] split = ofProvisionalPlan.getOrganDivision().split(",");
|
|
|
- for (String s : split) {
|
|
|
- SysDept infoTow = deptMapper.checkDeptNameOnlyOne(s);
|
|
|
- //不是最后一位就加‘,’,是就直接结尾
|
|
|
- if (!ofProvisionalPlan.getOrganDivision().endsWith(s)) {
|
|
|
- if (!ObjectUtils.isEmpty(infoTow)) {
|
|
|
- zBuilder.append(infoTow.getDeptId() + ",");
|
|
|
- } else {
|
|
|
- ++failureNum;
|
|
|
- failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
|
|
|
- }
|
|
|
+ //采购单位
|
|
|
+ SysDept info = deptMapper.checkDeptNameOnlyOne(ofProvisionalPlan.getPurchaseDeptName());
|
|
|
+ if (StringUtils.isNotNull(info)) {
|
|
|
+ ofProvisionalPlan.setPurchaseDeptId(String.valueOf(info.getDeptId()));
|
|
|
+ }
|
|
|
+ ofProvisionalPlan.setProjectType(projectTypesMap.get(ofProvisionalPlan.getProjectType()));
|
|
|
+ ofProvisionalPlan.setProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
|
|
|
+
|
|
|
+ //机关业务指导处是多选字段
|
|
|
+ StringBuilder zBuilder = new StringBuilder();
|
|
|
+ if (ofProvisionalPlan.getOrganDivision().contains(",")) {
|
|
|
+ String[] split = ofProvisionalPlan.getOrganDivision().split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ SysDeptOrgan infoTow = sysDeptOrganMapper.checkDeptOrganNameOnlyOne(s);
|
|
|
+ //不是最后一位就加‘,’,是就直接结尾
|
|
|
+ if (!ofProvisionalPlan.getOrganDivision().endsWith(s)) {
|
|
|
+ if (!ObjectUtils.isEmpty(infoTow)) {
|
|
|
+ zBuilder.append(infoTow.getId() + ",");
|
|
|
} else {
|
|
|
- if (!ObjectUtils.isEmpty(infoTow)) {
|
|
|
- zBuilder.append(infoTow.getDeptId());
|
|
|
- } else {
|
|
|
- ++failureNum;
|
|
|
- failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
|
|
|
- }
|
|
|
+ ++failureNum;
|
|
|
+ failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
|
|
|
}
|
|
|
- }
|
|
|
- String zs = zBuilder.toString();
|
|
|
- if (zs.endsWith(",")) {
|
|
|
- zBuilder = null;
|
|
|
- zBuilder.append(zs.substring(0, zs.length() - 1));
|
|
|
- }
|
|
|
- } else {
|
|
|
- //没有多选
|
|
|
- SysDept infoTow = deptMapper.checkDeptNameOnlyOne(ofProvisionalPlan.getOrganDivision());
|
|
|
- if (!ObjectUtils.isEmpty(infoTow)) {
|
|
|
- zBuilder.append(infoTow.getDeptId());
|
|
|
} else {
|
|
|
- ++failureNum;
|
|
|
- failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
|
|
|
+ if (!ObjectUtils.isEmpty(infoTow)) {
|
|
|
+ zBuilder.append(infoTow.getId());
|
|
|
+ } else {
|
|
|
+ ++failureNum;
|
|
|
+ failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- ofProvisionalPlan.setOrganDivision(zBuilder.toString());
|
|
|
+ String zs = zBuilder.toString();
|
|
|
+ if (zs.endsWith(",")) {
|
|
|
+ zBuilder = null;
|
|
|
+ zBuilder.append(zs.substring(0, zs.length() - 1));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //没有多选
|
|
|
+ SysDeptOrgan infoTow = sysDeptOrganMapper.checkDeptOrganNameOnlyOne(ofProvisionalPlan.getOrganDivision());
|
|
|
+ if (!ObjectUtils.isEmpty(infoTow)) {
|
|
|
+ zBuilder.append(infoTow.getId());
|
|
|
+ } else {
|
|
|
+ ++failureNum;
|
|
|
+ failureMsg.append(failureNum + "、机关业务指导处(科)“" + ofProvisionalPlan.getOrganDivision() + "”不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ofProvisionalPlan.setOrganDivision(zBuilder.toString());
|
|
|
|
|
|
|
|
|
- //项目属性是多选字段
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- if (ofProvisionalPlan.getProjectAttr().contains(",")) {
|
|
|
- String[] split = ofProvisionalPlan.getProjectAttr().split(",");
|
|
|
- for (String s : split) {
|
|
|
- if (!ofProvisionalPlan.getProjectAttr().endsWith(s)) {
|
|
|
- builder.append(projectAttributes.get(s) + ",");
|
|
|
- } else {
|
|
|
- builder.append(projectAttributes.get(s));
|
|
|
- }
|
|
|
+ //项目属性是多选字段
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ if (ofProvisionalPlan.getProjectAttr().contains(",")) {
|
|
|
+ String[] split = ofProvisionalPlan.getProjectAttr().split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ if (!ofProvisionalPlan.getProjectAttr().endsWith(s)) {
|
|
|
+ builder.append(projectAttributes.get(s) + ",");
|
|
|
+ } else {
|
|
|
+ builder.append(projectAttributes.get(s));
|
|
|
}
|
|
|
- } else {
|
|
|
- builder.append(projectAttributes.get(ofProvisionalPlan.getProjectAttr()));
|
|
|
}
|
|
|
- ofProvisionalPlan.setProjectAttr(builder.toString());
|
|
|
- //ofProvisionalPlan.setIsExcess(deptService.isExcessOrNo(ofProvisionalPlan.getProjectType(), ofProvisionalPlan.getEvaluation(), info.getDeptId()));
|
|
|
- ofProvisionalPlan.setCreated(String.valueOf(loginUser.getUserId()));
|
|
|
- ofProvisionalPlan.setCreateTime(new Date());
|
|
|
- ofProvisionalPlan.setPlanType("1");
|
|
|
+ } else {
|
|
|
+ builder.append(projectAttributes.get(ofProvisionalPlan.getProjectAttr()));
|
|
|
+ }
|
|
|
+ ofProvisionalPlan.setProjectAttr(builder.toString());
|
|
|
+ //ofProvisionalPlan.setIsExcess(deptService.isExcessOrNo(ofProvisionalPlan.getProjectType(), ofProvisionalPlan.getEvaluation(), info.getDeptId()));
|
|
|
+ ofProvisionalPlan.setCreated(String.valueOf(loginUser.getUserId()));
|
|
|
+ ofProvisionalPlan.setCreateTime(new Date());
|
|
|
+ ofProvisionalPlan.setPlanType("1");
|
|
|
+ if (!ObjectUtils.isEmpty(ofProvisionalPlan.getPlanPracticalId()) && !ObjectUtils.isEmpty(ofProvisionalPlan.getOrganDivision())) {
|
|
|
provisionalPlanMapper.insert(ofProvisionalPlan);
|
|
|
successNum++;
|
|
|
successMsg.append(successNum + "、项目 " + ofProvisionalPlan.getProjectName() + " 导入成功!");
|
|
|
+ }
|
|
|
} catch (Exception exc) {
|
|
|
failureNum++;
|
|
|
String msg = successNum + "、项目 " + ofProvisionalPlan.getProjectName() + " 导入失败;";
|