|
@@ -14,12 +14,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.ozs.base.domain.*;
|
|
import com.ozs.base.domain.*;
|
|
import com.ozs.base.domain.vo.BaseExpertVo;
|
|
import com.ozs.base.domain.vo.BaseExpertVo;
|
|
|
|
+import com.ozs.base.mapper.BaseExpertMapper;
|
|
import com.ozs.base.service.*;
|
|
import com.ozs.base.service.*;
|
|
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.SysDictData;
|
|
|
|
-import com.ozs.common.core.domain.entity.SysRole;
|
|
|
|
-import com.ozs.common.core.domain.entity.SysUser;
|
|
|
|
|
|
+import com.ozs.common.core.domain.entity.*;
|
|
import com.ozs.common.enums.*;
|
|
import com.ozs.common.enums.*;
|
|
import com.ozs.common.utils.DateUtils;
|
|
import com.ozs.common.utils.DateUtils;
|
|
import com.ozs.common.utils.RandomUtil;
|
|
import com.ozs.common.utils.RandomUtil;
|
|
@@ -123,6 +121,13 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SysDeptMapper deptMapper;
|
|
private SysDeptMapper deptMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaseExpertMapper baseExpertMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysProcurementStandardService sysProcurementStandardService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PmAuditDeptRefService pmAuditDeptRefService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询采购需求
|
|
* 查询采购需求
|
|
@@ -710,13 +715,70 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public boolean commit(PmDemandReqVo pmDemandReqVo) {
|
|
public boolean commit(PmDemandReqVo pmDemandReqVo) {
|
|
- PmDemand pmDemand = new PmDemand();
|
|
|
|
- pmDemand.setDemandId(pmDemandReqVo.getDemandId());
|
|
|
|
- pmDemand.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
|
|
|
|
- pmDemand.setRealDemandCommitTime(DateUtils.getNowDate());
|
|
|
|
- pmDemand.setUpdateBy(pmDemandReqVo.getUpdateBy());
|
|
|
|
- pmDemand.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
- return this.updateById(pmDemand);
|
|
|
|
|
|
+ PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
|
|
|
|
+
|
|
|
|
+ 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<SysProcurementStandard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ lambdaQueryWrapper.eq(SysProcurementStandard::getDeptId,deptId)
|
|
|
|
+ .eq(SysProcurementStandard::getCategory,pmDemand.getProjectType())
|
|
|
|
+ .eq(SysProcurementStandard::getState,1);//0不限1限额
|
|
|
|
+ SysProcurementStandard sysProcurementStandard = sysProcurementStandardService.getOne(lambdaQueryWrapper);
|
|
|
|
+
|
|
|
|
+ PmAuditDeptRef pmAuditDeptRef = new PmAuditDeptRef();
|
|
|
|
+ pmAuditDeptRef.setRefId(pmDemand.getDemandId());
|
|
|
|
+ pmAuditDeptRef.setRefType("2");
|
|
|
|
+ pmAuditDeptRef.setStatus(0);
|
|
|
|
+ pmAuditDeptRef.setCreated(pmDemandReqVo.getUpdateBy());
|
|
|
|
+ pmAuditDeptRef.setCreateTime(DateUtils.getNowDate());
|
|
|
|
+ pmAuditDeptRef.setUpdated(pmDemandReqVo.getUpdateBy());
|
|
|
|
+ pmAuditDeptRef.setUpdateTime(pmAuditDeptRef.getCreateTime());
|
|
|
|
+
|
|
|
|
+ if(!ObjectUtils.isEmpty(sysProcurementStandard)){ //限额
|
|
|
|
+ BigDecimal maximum = sysProcurementStandard.getMaximum();
|
|
|
|
+ if(maximum.doubleValue() < pmDemand.getEvaluation()) { //需求超额了,提交给上级部门
|
|
|
|
+ String parentDeptLevel = null;
|
|
|
|
+ Long parentDeptId = null;
|
|
|
|
+ if("A".endsWith(deptLevel)){
|
|
|
|
+ parentDeptLevel = "B";
|
|
|
|
+ parentDeptId = sysDept.getParentId();
|
|
|
|
+ } else if("B".endsWith(deptLevel)) {
|
|
|
|
+ parentDeptLevel = "C";
|
|
|
|
+ parentDeptId = sysDept.getParentId();
|
|
|
|
+ } else { //C级提交同级
|
|
|
|
+ parentDeptLevel = "C";
|
|
|
|
+ parentDeptId = deptId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ pmAuditDeptRef.setDeptId(parentDeptId);
|
|
|
|
+ pmAuditDeptRef.setDeptLevel(parentDeptLevel);
|
|
|
|
+ } else { //没超额,提交给同级
|
|
|
|
+ pmAuditDeptRef.setDeptId(deptId);
|
|
|
|
+ pmAuditDeptRef.setDeptLevel(deptLevel);
|
|
|
|
+ }
|
|
|
|
+ } else { //不限额,提交给同级
|
|
|
|
+ pmAuditDeptRef.setDeptId(deptId);
|
|
|
|
+ pmAuditDeptRef.setDeptLevel(deptLevel);
|
|
|
|
+ }
|
|
|
|
+ pmAuditDeptRefService.save(pmAuditDeptRef);
|
|
|
|
+
|
|
|
|
+ PmDemand pmDemandUpdate = new PmDemand();
|
|
|
|
+ pmDemandUpdate.setDemandId(pmDemand.getDemandId());
|
|
|
|
+ pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
|
|
|
|
+ pmDemandUpdate.setRealDemandCommitTime(DateUtils.getNowDate());
|
|
|
|
+ pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
|
|
|
|
+ pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
+ return this.updateById(pmDemandUpdate);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -728,16 +790,83 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public boolean reviewTo(PmDemandReqVo pmDemandReqVo) {
|
|
public boolean reviewTo(PmDemandReqVo pmDemandReqVo) {
|
|
- PmDemand pmDemand = new PmDemand();
|
|
|
|
- pmDemand.setDemandId(pmDemandReqVo.getDemandId());
|
|
|
|
- pmDemand.setProjectStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
|
|
|
|
|
|
+ PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
|
|
|
|
+
|
|
|
|
+ PmDemand pmDemandUpdate = new PmDemand();
|
|
|
|
+ pmDemandUpdate.setDemandId(pmDemand.getDemandId());
|
|
|
|
+
|
|
|
|
+ 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<SysProcurementStandard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ lambdaQueryWrapper.eq(SysProcurementStandard::getDeptId,deptId)
|
|
|
|
+ .eq(SysProcurementStandard::getCategory,pmDemand.getProjectType())
|
|
|
|
+ .eq(SysProcurementStandard::getState,1);//0不限1限额
|
|
|
|
+ SysProcurementStandard sysProcurementStandard = sysProcurementStandardService.getOne(lambdaQueryWrapper);
|
|
|
|
+
|
|
|
|
+ PmAuditDeptRef pmAuditDeptRef = new PmAuditDeptRef();
|
|
|
|
+ pmAuditDeptRef.setRefId(pmDemand.getDemandId());
|
|
|
|
+ pmAuditDeptRef.setRefType("2");
|
|
|
|
+ pmAuditDeptRef.setCreated(pmDemandReqVo.getUpdateBy());
|
|
|
|
+ pmAuditDeptRef.setCreateTime(DateUtils.getNowDate());
|
|
|
|
+ pmAuditDeptRef.setUpdated(pmDemandReqVo.getUpdateBy());
|
|
|
|
+ pmAuditDeptRef.setUpdateTime(pmAuditDeptRef.getCreateTime());
|
|
|
|
+
|
|
|
|
+ if(!ObjectUtils.isEmpty(sysProcurementStandard)){ //限额
|
|
|
|
+ BigDecimal maximum = sysProcurementStandard.getMaximum();
|
|
|
|
+ if(maximum.doubleValue() < pmDemand.getEvaluation()) { //需求超额了,提交给上级部门
|
|
|
|
+ String parentDeptLevel = null;
|
|
|
|
+ Long parentDeptId = null;
|
|
|
|
+ if("A".endsWith(deptLevel)){
|
|
|
|
+ parentDeptLevel = "B";
|
|
|
|
+ parentDeptId = sysDept.getParentId();
|
|
|
|
+ pmAuditDeptRef.setStatus(0);
|
|
|
|
+ pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
|
|
|
|
+ } else if("B".endsWith(deptLevel)) {
|
|
|
|
+ parentDeptLevel = "C";
|
|
|
|
+ parentDeptId = sysDept.getParentId();
|
|
|
|
+ pmAuditDeptRef.setStatus(0);
|
|
|
|
+ pmDemandUpdate.setProjectStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
|
|
|
|
+ } else { //C级 审核通过
|
|
|
|
+ parentDeptLevel = "C";
|
|
|
|
+ parentDeptId = deptId;
|
|
|
|
+ pmAuditDeptRef.setStatus(1);
|
|
|
|
+ pmDemandUpdate.setProjectStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ pmAuditDeptRef.setDeptId(parentDeptId);
|
|
|
|
+ pmAuditDeptRef.setDeptLevel(parentDeptLevel);
|
|
|
|
+
|
|
|
|
+ } else { //没超额,审核通过
|
|
|
|
+ pmAuditDeptRef.setDeptId(deptId);
|
|
|
|
+ pmAuditDeptRef.setDeptLevel(deptLevel);
|
|
|
|
+ pmAuditDeptRef.setStatus(1);
|
|
|
|
+ pmDemandUpdate.setProjectStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
|
|
|
|
+ }
|
|
|
|
+ } else { //不限额,审核通过
|
|
|
|
+ pmAuditDeptRef.setDeptId(deptId);
|
|
|
|
+ pmAuditDeptRef.setDeptLevel(deptLevel);
|
|
|
|
+ pmAuditDeptRef.setStatus(1);
|
|
|
|
+ pmDemandUpdate.setProjectStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
|
|
|
|
+ }
|
|
|
|
+ pmAuditDeptRefService.save(pmAuditDeptRef);
|
|
|
|
+
|
|
List<SysFileRef> sysFileRefs = pmDemandReqVo.getSysFileRefs();
|
|
List<SysFileRef> sysFileRefs = pmDemandReqVo.getSysFileRefs();
|
|
uploadFile(pmDemandReqVo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType(), sysFileRefs, pmDemandReqVo.getUpdateBy());
|
|
uploadFile(pmDemandReqVo.getDemandId(), SysFileRefEnum.PM_DEMAND_EXAMINE.getType(), sysFileRefs, pmDemandReqVo.getUpdateBy());
|
|
|
|
|
|
- pmDemand.setUpdateBy(pmDemandReqVo.getUpdateBy());
|
|
|
|
- pmDemand.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
- pmDemand.setAuditTime(DateUtils.getNowDate());
|
|
|
|
- return this.updateById(pmDemand);
|
|
|
|
|
|
+ pmDemandUpdate.setUpdateBy(pmDemandReqVo.getUpdateBy());
|
|
|
|
+ pmDemandUpdate.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
+ pmDemandUpdate.setAuditTime(DateUtils.getNowDate());
|
|
|
|
+ return this.updateById(pmDemandUpdate);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -916,6 +1045,18 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
pmDemandExpertRef.setUpdateBy(pmBaseExpertFillReqVo.getCreateBy());
|
|
pmDemandExpertRef.setUpdateBy(pmBaseExpertFillReqVo.getCreateBy());
|
|
pmDemandExpertRef.setUpdateTime(pmDemandExpertRef.getCreateTime());
|
|
pmDemandExpertRef.setUpdateTime(pmDemandExpertRef.getCreateTime());
|
|
pmDemandExpertRefService.saveOrUpdate(pmDemandExpertRef);
|
|
pmDemandExpertRefService.saveOrUpdate(pmDemandExpertRef);
|
|
|
|
+
|
|
|
|
+ //专家单位
|
|
|
|
+ if (StringUtils.isNotNull(baseExpert.getUnitInformation())) {
|
|
|
|
+ List<BaseUnitInformation> baseUnitInformationList = baseExpertMapper.selectByUnitInformation(baseExpert.getUnitInformation());
|
|
|
|
+ if (baseUnitInformationList.size() <= 0) {
|
|
|
|
+ BaseUnitInformation baseUnitInformation = new BaseUnitInformation();
|
|
|
|
+ baseUnitInformation.setUnitName(baseExpert.getUnitInformation());
|
|
|
|
+ baseUnitInformation.setCreated(baseExpert.getExpertName());
|
|
|
|
+ baseUnitInformation.setCreateTime(new Date());
|
|
|
|
+ Integer i = baseExpertMapper.insertBaseUnitInformation(baseUnitInformation);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|