Browse Source

计划数据提交

buzhanyi 2 years ago
parent
commit
dd38e351a8

+ 2 - 0
purchase-system/src/main/java/com/ozs/plan/service/PlanYearsService.java

@@ -20,6 +20,8 @@ import java.util.List;
 public interface PlanYearsService extends IService<PlanYears> {
 public interface PlanYearsService extends IService<PlanYears> {
 
 
 
 
+    //public Page selectPlanYearsExamineList(PlanYearsStandardVo vo);
+
     /**
     /**
      * 查询年度计划记录集合--导出
      * 查询年度计划记录集合--导出
      *
      *

+ 21 - 1
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanQuarterServiceImpl.java

@@ -8,6 +8,7 @@ import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysRole;
 import com.ozs.common.core.domain.entity.SysRole;
+import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.common.enums.DataIsDelete;
 import com.ozs.common.enums.DataIsDelete;
 import com.ozs.common.enums.PmProjectStatus;
 import com.ozs.common.enums.PmProjectStatus;
@@ -17,6 +18,7 @@ import com.ozs.common.enums.QuarterEnum;
 import com.ozs.common.enums.SysFileRefEnum;
 import com.ozs.common.enums.SysFileRefEnum;
 import com.ozs.common.exception.ServiceException;
 import com.ozs.common.exception.ServiceException;
 import com.ozs.common.utils.PageUtils;
 import com.ozs.common.utils.PageUtils;
+import com.ozs.common.utils.SecurityUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.bean.BeanUtils;
 import com.ozs.common.utils.bean.BeanUtils;
 import com.ozs.plan.doman.PlanQuarter;
 import com.ozs.plan.doman.PlanQuarter;
@@ -29,6 +31,7 @@ import com.ozs.plan.service.PlanQuarterService;
 import com.ozs.pm.doman.PmDemand;
 import com.ozs.pm.doman.PmDemand;
 import com.ozs.pm.mapper.PmDemandMapper;
 import com.ozs.pm.mapper.PmDemandMapper;
 import com.ozs.pm.service.IPmDemandService;
 import com.ozs.pm.service.IPmDemandService;
+import com.ozs.pm.service.PmAuditDeptRefService;
 import com.ozs.system.domain.SysFileInfo;
 import com.ozs.system.domain.SysFileInfo;
 import com.ozs.system.domain.SysFileRef;
 import com.ozs.system.domain.SysFileRef;
 import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
 import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
@@ -36,6 +39,7 @@ import com.ozs.system.mapper.SysDeptMapper;
 import com.ozs.system.mapper.SysFileRefMapper;
 import com.ozs.system.mapper.SysFileRefMapper;
 import com.ozs.system.service.ISysDeptService;
 import com.ozs.system.service.ISysDeptService;
 import com.ozs.system.service.ISysDictTypeService;
 import com.ozs.system.service.ISysDictTypeService;
+import com.ozs.system.service.ISysUserService;
 import com.ozs.system.service.SysFileService;
 import com.ozs.system.service.SysFileService;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -86,6 +90,10 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
     private PmDemandMapper pmDemandMapper;
     private PmDemandMapper pmDemandMapper;
     @Autowired
     @Autowired
     private IPmDemandService demandService;
     private IPmDemandService demandService;
+    @Autowired
+    private ISysUserService userService;
+    @Autowired
+    private PmAuditDeptRefService pmAuditDeptRefService;
 
 
     @Override
     @Override
     public List<PlanQuarterResponseVo> selectPlanQuarterListEXP(PlanQuarterStandardVo vo, LoginUser loginUser) {
     public List<PlanQuarterResponseVo> selectPlanQuarterListEXP(PlanQuarterStandardVo vo, LoginUser loginUser) {
@@ -420,8 +428,20 @@ public class PlanQuarterServiceImpl extends ServiceImpl<PlanQuarterMapper, PlanQ
     }
     }
 
 
     @Override
     @Override
+    @Transactional
     public AjaxResult commit(PlanQuarterStandardVo quarterStandardVo) {
     public AjaxResult commit(PlanQuarterStandardVo quarterStandardVo) {
-
+        PlanQuarter byId = planQuarterMapper.getById(quarterStandardVo.getPlanPracticalId());
+        BigDecimal evaluation = byId.getEvaluation();
+        SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
+        Long deptId = sysUser.getDeptId();
+        if (!pmAuditDeptRefService.insertPmAuditDeptRefs(byId.getPlanPracticalId(),
+                "1",
+                deptId,
+                evaluation,
+                sysUser.getUserId(),
+                byId.getProjectType())) {
+            throw new ServiceException("审核关联数据插入失败");
+        }
 
 
         int commit = planQuarterMapper.commit(quarterStandardVo.getPlanPracticalId());
         int commit = planQuarterMapper.commit(quarterStandardVo.getPlanPracticalId());
         if (commit != 1) {
         if (commit != 1) {

+ 37 - 2
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanYearsServiceImpl.java

@@ -4,19 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.github.pagehelper.PageHelper;
 import com.ozs.base.domain.BaseAgency;
 import com.ozs.base.domain.BaseAgency;
 import com.ozs.base.service.BaseAgencyService;
 import com.ozs.base.service.BaseAgencyService;
 import com.ozs.common.constant.Constants;
 import com.ozs.common.constant.Constants;
 import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysDictData;
+import com.ozs.common.core.domain.entity.SysProcurementStandard;
 import com.ozs.common.core.domain.entity.SysRole;
 import com.ozs.common.core.domain.entity.SysRole;
 import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.common.enums.*;
 import com.ozs.common.enums.*;
 import com.ozs.common.exception.ServiceException;
 import com.ozs.common.exception.ServiceException;
-import com.ozs.common.utils.PageUtils;
+import com.ozs.common.exception.base.BaseException;
 import com.ozs.common.utils.SecurityUtils;
 import com.ozs.common.utils.SecurityUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.bean.BeanUtils;
 import com.ozs.common.utils.bean.BeanUtils;
@@ -40,6 +40,7 @@ import com.ozs.system.domain.SysFileRef;
 import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
 import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
 import com.ozs.system.mapper.SysDeptMapper;
 import com.ozs.system.mapper.SysDeptMapper;
 import com.ozs.system.mapper.SysFileRefMapper;
 import com.ozs.system.mapper.SysFileRefMapper;
+import com.ozs.system.mapper.SysProcurementStandardMapper;
 import com.ozs.system.mapper.SysRoleMapper;
 import com.ozs.system.mapper.SysRoleMapper;
 import com.ozs.system.service.*;
 import com.ozs.system.service.*;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
@@ -48,6 +49,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.ObjectUtils;
 
 
+import javax.annotation.Resource;
 import javax.validation.Validator;
 import javax.validation.Validator;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.ParseException;
@@ -120,6 +122,26 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
     private PmProjectConstructionService pmProjectConstructionService;
     private PmProjectConstructionService pmProjectConstructionService;
     @Autowired
     @Autowired
     private SysFileRefService sysFileRefService;
     private SysFileRefService sysFileRefService;
+    @Autowired
+    private PmAuditDeptRefService pmAuditDeptRefService;
+
+
+    //@Override
+    //public Page selectPlanYearsExamineList(PlanYearsStandardVo vo) {
+    //    PlanYears ofYears = new PlanYears();
+    //    PageHelper.startPage(vo.getPageNum().intValue(), vo.getPageSize().intValue());
+    //    List<PlanYears> planYears;
+    //    List<PlanYearsResponseVo> planYearsList = new ArrayList<>();
+    //    try {
+    //        BeanUtils.copyProperties(vo, ofYears);
+    //        planYears = planYearsMapper.selectPlanYearsExamineList(ofYears);
+    //        planYearsList = changeTo(planYears);
+    //    } catch (Exception e) {
+    //        e.printStackTrace();
+    //    }
+    //    Page pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planYearsList);
+    //    return pages;
+    //}
 
 
     @Override
     @Override
     public List<PlanYearsResponseVo> selectPlanYearsListEXP(PlanYearsStandardVo vo, LoginUser loginUser) {
     public List<PlanYearsResponseVo> selectPlanYearsListEXP(PlanYearsStandardVo vo, LoginUser loginUser) {
@@ -456,7 +478,20 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
     }
     }
 
 
     @Override
     @Override
+    @Transactional
     public AjaxResult commit(PlanYearsStandardVo yearsStandardVo) {
     public AjaxResult commit(PlanYearsStandardVo yearsStandardVo) {
+        PlanYears byId = planYearsMapper.getById(yearsStandardVo.getPlanYearId());
+        BigDecimal evaluation = byId.getEvaluation();
+        SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
+        Long deptId = sysUser.getDeptId();
+        if (!pmAuditDeptRefService.insertPmAuditDeptRefs(byId.getPlanYearId(),
+                "0",
+                deptId,
+                evaluation,
+                sysUser.getUserId(),
+                byId.getProjectType())) {
+            throw new ServiceException("审核关联数据插入失败");
+        }
 
 
         int commit = planYearsMapper.commit(yearsStandardVo.getPlanYearId());
         int commit = planYearsMapper.commit(yearsStandardVo.getPlanYearId());
         if (commit != 1) {
         if (commit != 1) {

+ 21 - 0
purchase-system/src/main/java/com/ozs/plan/service/impl/ProvisionalPlanServiceImpl.java

@@ -12,6 +12,7 @@ import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.domain.entity.SysRole;
 import com.ozs.common.core.domain.entity.SysRole;
+import com.ozs.common.core.domain.entity.SysUser;
 import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.common.enums.DataIsDelete;
 import com.ozs.common.enums.DataIsDelete;
 import com.ozs.common.enums.PmProjectStatus;
 import com.ozs.common.enums.PmProjectStatus;
@@ -20,6 +21,7 @@ import com.ozs.common.enums.ProjectTypes;
 import com.ozs.common.enums.SysFileRefEnum;
 import com.ozs.common.enums.SysFileRefEnum;
 import com.ozs.common.exception.ServiceException;
 import com.ozs.common.exception.ServiceException;
 import com.ozs.common.utils.PageUtils;
 import com.ozs.common.utils.PageUtils;
+import com.ozs.common.utils.SecurityUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.bean.BeanUtils;
 import com.ozs.common.utils.bean.BeanUtils;
 import com.ozs.plan.doman.MonthlyReconciliation;
 import com.ozs.plan.doman.MonthlyReconciliation;
@@ -32,6 +34,7 @@ import com.ozs.plan.service.ProvisionalPlanService;
 import com.ozs.pm.doman.PmDemand;
 import com.ozs.pm.doman.PmDemand;
 import com.ozs.pm.mapper.PmDemandMapper;
 import com.ozs.pm.mapper.PmDemandMapper;
 import com.ozs.pm.service.IPmDemandService;
 import com.ozs.pm.service.IPmDemandService;
+import com.ozs.pm.service.PmAuditDeptRefService;
 import com.ozs.system.domain.SysFileInfo;
 import com.ozs.system.domain.SysFileInfo;
 import com.ozs.system.domain.SysFileRef;
 import com.ozs.system.domain.SysFileRef;
 import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
 import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
@@ -39,6 +42,7 @@ import com.ozs.system.mapper.SysDeptMapper;
 import com.ozs.system.mapper.SysFileRefMapper;
 import com.ozs.system.mapper.SysFileRefMapper;
 import com.ozs.system.service.ISysDeptService;
 import com.ozs.system.service.ISysDeptService;
 import com.ozs.system.service.ISysDictTypeService;
 import com.ozs.system.service.ISysDictTypeService;
+import com.ozs.system.service.ISysUserService;
 import com.ozs.system.service.SysFileService;
 import com.ozs.system.service.SysFileService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -72,6 +76,10 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
     private PmDemandMapper pmDemandMapper;
     private PmDemandMapper pmDemandMapper;
     @Autowired
     @Autowired
     private IPmDemandService demandService;
     private IPmDemandService demandService;
+    @Autowired
+    private ISysUserService userService;
+    @Autowired
+    private PmAuditDeptRefService pmAuditDeptRefService;
 
 
     @Override
     @Override
     public int deleteProvisionalPlanById(Long planPracticalId) {
     public int deleteProvisionalPlanById(Long planPracticalId) {
@@ -245,7 +253,20 @@ public class ProvisionalPlanServiceImpl extends ServiceImpl<ProvisionalPlanMappe
     }
     }
 
 
     @Override
     @Override
+    @Transactional
     public int commitProvisionalPlan(ProvisionalPlanVo provisionalPlanVo) {
     public int commitProvisionalPlan(ProvisionalPlanVo provisionalPlanVo) {
+        ProvisionalPlan byId = provisionalPlanMapper.seletById(provisionalPlanVo.getPlanPracticalId());
+        BigDecimal evaluation = byId.getEvaluation();
+        SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
+        Long deptId = sysUser.getDeptId();
+        if (!pmAuditDeptRefService.insertPmAuditDeptRefs(byId.getPlanPracticalId(),
+                "1",
+                deptId,
+                evaluation,
+                sysUser.getUserId(),
+                byId.getProjectType())) {
+            throw new ServiceException("审核关联数据插入失败");
+        }
         return provisionalPlanMapper.commitProvisionalPlan(provisionalPlanVo.getPlanPracticalId());
         return provisionalPlanMapper.commitProvisionalPlan(provisionalPlanVo.getPlanPracticalId());
     }
     }
 
 

+ 15 - 1
purchase-system/src/main/java/com/ozs/pm/doman/PmAuditDeptRef.java

@@ -81,5 +81,19 @@ public class PmAuditDeptRef implements Serializable {
     @TableField("UPDATE_TIME")
     @TableField("UPDATE_TIME")
     private Date updateTime;
     private Date updateTime;
 
 
-
+    public PmAuditDeptRef() {
+    }
+
+    public PmAuditDeptRef(Long id, Long refId, String refType, Long deptId, String deptLevel, Integer status, String created, Date createTime, String updated, Date updateTime) {
+        this.id = id;
+        this.refId = refId;
+        this.refType = refType;
+        this.deptId = deptId;
+        this.deptLevel = deptLevel;
+        this.status = status;
+        this.created = created;
+        this.createTime = createTime;
+        this.updated = updated;
+        this.updateTime = updateTime;
+    }
 }
 }

+ 12 - 0
purchase-system/src/main/java/com/ozs/pm/service/PmAuditDeptRefService.java

@@ -3,6 +3,8 @@ package com.ozs.pm.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ozs.pm.doman.PmAuditDeptRef;
 import com.ozs.pm.doman.PmAuditDeptRef;
 
 
+import java.math.BigDecimal;
+
 /**
 /**
  * 审核关联表(PmAuditDeptRef)表服务接口
  * 审核关联表(PmAuditDeptRef)表服务接口
  *
  *
@@ -11,4 +13,14 @@ import com.ozs.pm.doman.PmAuditDeptRef;
  */
  */
 public interface PmAuditDeptRefService extends IService<PmAuditDeptRef> {
 public interface PmAuditDeptRefService extends IService<PmAuditDeptRef> {
 
 
+    /**
+     * 审核关联数据的插入
+     *
+     * @param refId      关联id
+     * @param refType    关联类型
+     * @param deptId     部门id
+     * @param evaluation 金额
+     * @return
+     */
+    Boolean insertPmAuditDeptRefs(Long refId, String refType, Long deptId, BigDecimal evaluation, Long userId, String projectType);
 }
 }

+ 152 - 0
purchase-system/src/main/java/com/ozs/pm/service/impl/PmAuditDeptRefServiceImpl.java

@@ -1,10 +1,28 @@
 package com.ozs.pm.service.impl;
 package com.ozs.pm.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ozs.common.core.domain.entity.SysDept;
+import com.ozs.common.core.domain.entity.SysProcurementStandard;
+import com.ozs.common.exception.ServiceException;
+import com.ozs.common.exception.base.BaseException;
+import com.ozs.plan.mapper.PlanYearsMapper;
 import com.ozs.pm.mapper.PmAuditDeptRefMapper;
 import com.ozs.pm.mapper.PmAuditDeptRefMapper;
 import com.ozs.pm.doman.PmAuditDeptRef;
 import com.ozs.pm.doman.PmAuditDeptRef;
 import com.ozs.pm.service.PmAuditDeptRefService;
 import com.ozs.pm.service.PmAuditDeptRefService;
+import com.ozs.system.mapper.SysDeptMapper;
+import com.ozs.system.mapper.SysProcurementStandardMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
+
+import javax.annotation.Resource;
+import javax.validation.Validator;
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * 审核关联表(PmAuditDeptRef)表服务实现类
  * 审核关联表(PmAuditDeptRef)表服务实现类
@@ -15,4 +33,138 @@ import org.springframework.stereotype.Service;
 @Service
 @Service
 public class PmAuditDeptRefServiceImpl extends ServiceImpl<PmAuditDeptRefMapper, PmAuditDeptRef> implements PmAuditDeptRefService {
 public class PmAuditDeptRefServiceImpl extends ServiceImpl<PmAuditDeptRefMapper, PmAuditDeptRef> implements PmAuditDeptRefService {
 
 
+    @Autowired
+    PlanYearsMapper planYearsMapper;
+    @Autowired
+    protected Validator validator;
+    @Autowired
+    private SysDeptMapper deptMapper;
+    @Resource
+    private SysProcurementStandardMapper sysProcurementStandardMapper;
+    @Autowired
+    private PmAuditDeptRefService pmAuditDeptRefService;
+
+    @Override
+    @Transactional
+    public Boolean insertPmAuditDeptRefs(Long refId, String refType, Long deptId, BigDecimal evaluation, Long userId, String projectType) {
+        Date now = new Date();
+        SysDept sysDept = deptMapper.selectDeptById(deptId);
+        String[] ancestors = sysDept.getAncestors().split(",");
+        //当前用户的部门,是否允许提交(不在规定等级范围不可提交)
+        //查询当前用户的部门是否有上级,是否需要上级及祖级进行审核
+        Long cdeptId = null;
+        Long bdeptId = null;
+        String deptLevel = null;
+        if (ancestors.length == 2) { //C级
+            deptLevel = "C";
+        } else if (ancestors.length == 3) { //B级
+            deptLevel = "B";
+            cdeptId = Long.valueOf(ancestors[1]);
+        } else if (ancestors.length == 4) { //A级
+            deptLevel = "A";
+            cdeptId = Long.valueOf(ancestors[1]);
+            bdeptId = Long.valueOf(ancestors[2]);
+        }
+        if (!Arrays.asList("A", "B", "C").contains(deptLevel)) {
+            throw new BaseException("当前用户单位不属于ABC三级,无权提交");
+        }
+        //判断每个级别是否允许审核,并插入审核关联表
+        PmAuditDeptRef refA = new PmAuditDeptRef(null, refId, refType, deptId,
+                "A", 0, userId + "", now,
+                userId + "", now);
+
+        PmAuditDeptRef refB = new PmAuditDeptRef(null, refId, refType, bdeptId,
+                "B", 0, userId + "",
+                now, userId + "", now);
+
+        PmAuditDeptRef refC = null;
+        //审核关联表--PmAuditDeptRef
+        switch (deptLevel) {
+            case "A":
+                // A的判断  最少插入1条。最多插入3条
+                //获取各个项目类型设定的概算金额阈值
+                LambdaQueryWrapper<SysProcurementStandard> queryWrapperA = new LambdaQueryWrapper<>();
+                queryWrapperA.eq(SysProcurementStandard::getDeptId, deptId);
+                queryWrapperA.eq(SysProcurementStandard::getCategory, projectType.equals("2") ? "1" : projectType.equals("1") ? "2" : projectType);
+                List<SysProcurementStandard> sysProcurementStandardsListA = sysProcurementStandardMapper.selectList(queryWrapperA);
+                if (ObjectUtils.isEmpty(sysProcurementStandardsListA)) {
+                    throw new ServiceException("部门id为" + deptId + "的部门采购标准未进行初始化!");
+                }
+                //A不限额就自己审核
+                SysProcurementStandard sA = sysProcurementStandardsListA.get(0);
+                if (sA.getState().equals(Integer.valueOf(0))) {
+                    //refA采用初始化数据
+                } else {
+                    //A限额了判断是否超额,不超额就自己审。超额了追加上级
+                    BigDecimal maximum = sA.getMaximum();
+                    if (maximum.compareTo(evaluation) == 1) {
+                        //refA采用初始化数据
+                    } else {
+                        //A限额了,找B
+                        refA = new PmAuditDeptRef(null, refId, refType, deptId,
+                                "A", 1, userId + "", now,
+                                userId + "", now);
+                        LambdaQueryWrapper<SysProcurementStandard> queryWrapperB = new LambdaQueryWrapper<>();
+                        queryWrapperB.eq(SysProcurementStandard::getDeptId, bdeptId);
+                        queryWrapperB.eq(SysProcurementStandard::getCategory, projectType.equals("2") ? "1" : projectType.equals("1") ? "2" : projectType);
+                        List<SysProcurementStandard> sysProcurementStandardsListB = sysProcurementStandardMapper.selectList(queryWrapperB);
+                        //B不限额,B审
+                        if (ObjectUtils.isEmpty(sysProcurementStandardsListB)) {
+                            throw new ServiceException("部门id为" + bdeptId + "的部门采购标准未进行初始化!");
+                        }
+                        SysProcurementStandard sB = sysProcurementStandardsListB.get(0);
+                        if (sB.getState().equals(Integer.valueOf(0))) {
+                            //refB采用初始化数据
+                            pmAuditDeptRefService.save(refB);
+                        } else {
+                            //B限额了判断是否超额,不超额就自己审。超额了追加C级
+                            BigDecimal maximumB = sB.getMaximum();
+                            //B超额
+                            if (maximumB.compareTo(evaluation) == -1) {
+                                //C不限额,
+                                refC = new PmAuditDeptRef(null, refId, refType, cdeptId, "C", 0, userId + "", now, userId + "", now);
+                                pmAuditDeptRefService.save(refC);
+                            }
+                            //refB采用初始化数据
+                            pmAuditDeptRefService.save(refB);
+                        }
+                    }
+                }
+                pmAuditDeptRefService.save(refA);
+                break;
+            case "B":
+                // B的判断  最少插入1条。最多插入2条
+                LambdaQueryWrapper<SysProcurementStandard> queryWrapperB = new LambdaQueryWrapper<>();
+                queryWrapperB.eq(SysProcurementStandard::getDeptId, deptId);
+                queryWrapperB.eq(SysProcurementStandard::getCategory, projectType.equals("2") ? "1" : projectType.equals("1") ? "2" : projectType);
+                List<SysProcurementStandard> sysProcurementStandardsListB = sysProcurementStandardMapper.selectList(queryWrapperB);
+                //B不限额,B审
+                if (ObjectUtils.isEmpty(sysProcurementStandardsListB)) {
+                    throw new ServiceException("部门id为" + deptId + "的部门采购标准未进行初始化!");
+                }
+                SysProcurementStandard sB = sysProcurementStandardsListB.get(0);
+                refB = new PmAuditDeptRef(null, refId, refType, deptId, "B", 0, userId + "", now, userId + "", now);
+                if (sB.getState() == 0) {
+                } else {
+                    //B限额了判断是否超额,不超额就自己审。超额了追加C级
+                    BigDecimal maximumB = sB.getMaximum();
+                    //B不超额B审
+                    if (maximumB.compareTo(evaluation) == 1) {
+                    } else {
+                        //C不限额C审,
+                        refB = new PmAuditDeptRef(null, refId, refType, deptId, "B", 1, userId + "", now, userId + "", now);
+                        refC = new PmAuditDeptRef(null, refId, refType, cdeptId, "C", 0, userId + "", now, userId + "", now);
+                        pmAuditDeptRefService.save(refC);
+                    }
+                }
+                pmAuditDeptRefService.save(refB);
+                break;
+            default:
+                //C不限额C审,
+                // 插入1条
+                refC = new PmAuditDeptRef(null, refId, refType, deptId, "C", 0, userId + "", now, userId + "", now);
+                pmAuditDeptRefService.save(refC);
+        }
+        return true;
+    }
 }
 }