|
@@ -90,6 +90,10 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int updateProvisionalPlanById(ProvisionalPlanVo provisionalPlan) {
|
|
|
+ //默认未超额
|
|
|
+ if (ObjectUtils.isEmpty(provisionalPlan.getIsExcess())) {
|
|
|
+ provisionalPlan.setIsExcess("0");
|
|
|
+ }
|
|
|
List<SysFileRef> sysFileRefs = provisionalPlan.getSysFileRefs();
|
|
|
if (!ObjectUtils.isEmpty(sysFileRefs)) {
|
|
|
// 删关联
|
|
@@ -460,6 +464,44 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public AjaxResult auditPass(ProvisionalPlanVo provisionalPlanVo) {
|
|
|
+ SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
|
|
|
+ Long deptId = sysUser.getDeptId();
|
|
|
+ SysDept sysDept = deptMapper.selectDeptById(deptId);
|
|
|
+ String[] ancestors = sysDept.getAncestors().split(",");
|
|
|
+ String deptLevel = null;
|
|
|
+ if (ancestors.length == 2) { //C级
|
|
|
+ deptLevel = "C";
|
|
|
+ } else if (ancestors.length == 3) { //B级
|
|
|
+ deptLevel = "B";
|
|
|
+ } else if (ancestors.length == 4) { //A级
|
|
|
+ deptLevel = "A";
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PmAuditDeptRef> lw = new LambdaQueryWrapper();
|
|
|
+ lw.eq(PmAuditDeptRef::getRefId, provisionalPlanVo.getPlanPracticalId());
|
|
|
+ lw.eq(PmAuditDeptRef::getRefType, "1");
|
|
|
+ List<PmAuditDeptRef> list = pmAuditDeptRefService.list(lw);
|
|
|
+ boolean flay = true;
|
|
|
+ if (!ObjectUtils.isEmpty(list)) {
|
|
|
+ for (PmAuditDeptRef pmAuditDeptRef : list) {
|
|
|
+ // 判断 deptLevel 是否还有更高的 且是 待审核的数据
|
|
|
+ if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) > 0
|
|
|
+ && pmAuditDeptRef.getStatus().equals(Integer.parseInt("0"))) {
|
|
|
+ flay = false;
|
|
|
+ }
|
|
|
+ // 更新当前 deptLevel 级别的审核状态
|
|
|
+ if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) == 0) {
|
|
|
+ pmAuditDeptRef.setStatus(1);
|
|
|
+ pmAuditDeptRefService.updateById(pmAuditDeptRef);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flay) {
|
|
|
+ realReviewTo(provisionalPlanVo);
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ public AjaxResult realReviewTo(ProvisionalPlanVo provisionalPlanVo) {
|
|
|
ProvisionalPlan byId = provisionalPlanMapper.seletById(provisionalPlanVo.getPlanPracticalId());
|
|
|
if (ObjectUtils.isEmpty(byId.getPlanYearId())) {
|
|
|
PlanYears ofYears = new PlanYears();
|
|
@@ -496,8 +538,27 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
|
|
|
sysFileRefMapper.insert(ref);
|
|
|
}
|
|
|
}
|
|
|
- provisionalPlanVo.setProjectStatus(ProjectStatus.PLANTOEXAMINE.getCode());
|
|
|
//上传审核文件并赋予计划审核通过
|
|
|
+ provisionalPlanVo.setProjectStatus(ProjectStatus.PLANTOEXAMINE.getCode());
|
|
|
+ List<SysFileRef> sysFileRefss = provisionalPlanVo.getSysFileRefs();
|
|
|
+ if (!ObjectUtils.isEmpty(sysFileRefss)) {
|
|
|
+ for (SysFileRef ref : sysFileRefss) {
|
|
|
+ ref.setRedId(provisionalPlanVo.getPlanPracticalId().longValue());
|
|
|
+ ref.setType(SysFileRefEnum.PLAN_TEMPORARY_EXAMINE.getType());
|
|
|
+ ref.setCreated(provisionalPlanVo.getUpdated());
|
|
|
+ ref.setCreateTime(new Date());
|
|
|
+ ref.setUpdated(provisionalPlanVo.getUpdated());
|
|
|
+ ref.setUpdateTime(new Date());
|
|
|
+ sysFileRefMapper.insert(ref);
|
|
|
+ //同步到采购需求审核文件
|
|
|
+ SysFileRef ref2 = new SysFileRef(null, demand.getDemandId(), ref.getFileId(), SysFileRefEnum.PM_DEMAND.getType());
|
|
|
+ ref2.setCreated(provisionalPlanVo.getUpdated());
|
|
|
+ ref2.setCreateTime(new Date());
|
|
|
+ ref2.setUpdated(provisionalPlanVo.getUpdated());
|
|
|
+ ref2.setUpdateTime(new Date());
|
|
|
+ sysFileRefMapper.insert(ref2);
|
|
|
+ }
|
|
|
+ }
|
|
|
return review(provisionalPlanVo);
|
|
|
}
|
|
|
|
|
@@ -545,18 +606,6 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
|
|
|
}
|
|
|
|
|
|
private AjaxResult review(ProvisionalPlanVo vo) {
|
|
|
- List<SysFileRef> sysFileRefs = vo.getSysFileRefs();
|
|
|
- if (!ObjectUtils.isEmpty(sysFileRefs)) {
|
|
|
- for (SysFileRef ref : sysFileRefs) {
|
|
|
- ref.setRedId(vo.getPlanPracticalId().longValue());
|
|
|
- ref.setType(SysFileRefEnum.PLAN_TEMPORARY_EXAMINE.getType());
|
|
|
- ref.setCreated(vo.getUpdated());
|
|
|
- ref.setCreateTime(new Date());
|
|
|
- ref.setUpdated(vo.getUpdated());
|
|
|
- ref.setUpdateTime(new Date());
|
|
|
- sysFileRefMapper.insert(ref);
|
|
|
- }
|
|
|
- }
|
|
|
int review = provisionalPlanMapper.review(vo);
|
|
|
if (review != 1) {
|
|
|
return AjaxResult.error("项目状态数据异常");
|