|
@@ -10,6 +10,9 @@ import com.ozs.common.core.domain.entity.SysDept;
|
|
|
import com.ozs.common.core.domain.model.LoginUser;
|
|
|
import com.ozs.common.enums.BusinessType;
|
|
|
import com.ozs.common.enums.DataIsDelete;
|
|
|
+import com.ozs.common.exception.ServiceException;
|
|
|
+import com.ozs.common.exception.base.BaseException;
|
|
|
+import com.ozs.common.core.domain.entity.SysProcurementStandard;
|
|
|
import com.ozs.common.utils.PageUtils;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.file.FileUtils;
|
|
@@ -20,7 +23,9 @@ import com.ozs.plan.doman.vo.requestVo.PlanYearsStandardVo;
|
|
|
import com.ozs.plan.doman.vo.responseVo.PlanYearsResponseVo;
|
|
|
import com.ozs.plan.service.PlanYearsService;
|
|
|
import com.ozs.plan.service.impl.PlanYearsServiceImpl;
|
|
|
+import com.ozs.pm.doman.PmAuditDeptRef;
|
|
|
import com.ozs.system.service.ISysDeptService;
|
|
|
+import com.ozs.system.service.SysProcurementStandardService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -38,6 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -58,7 +64,7 @@ public class PlanYearsController extends BaseController {
|
|
|
@Autowired
|
|
|
private ISysDeptService iSysDeptService;
|
|
|
@Autowired
|
|
|
- private PlanYearsServiceImpl planYearsServiceImpl;
|
|
|
+ private SysProcurementStandardService sysProcurementStandardService;
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询年度计划")
|
|
@@ -97,7 +103,7 @@ public class PlanYearsController extends BaseController {
|
|
|
lw.eq(PlanYears::getDelFlay, DataIsDelete.DataNOTDelete.getCode());
|
|
|
lw.orderBy(true, false, PlanYears::getCreateTime);
|
|
|
List<PlanYears> planYears = planYearsService.list(lw);
|
|
|
- planYearsList = planYearsServiceImpl.changeTo(planYears);
|
|
|
+ planYearsList = planYearsService.changeTo(planYears);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -118,7 +124,7 @@ public class PlanYearsController extends BaseController {
|
|
|
vo.setCreated(String.valueOf(loginUser.getUserId()));
|
|
|
List<PlanYears> planYears = planYearsService.queryPage(vo);
|
|
|
if (!ObjectUtils.isEmpty(planYears) && !ObjectUtils.isEmpty(planYears.size())) {
|
|
|
- planYearsList = planYearsServiceImpl.changeTo(planYears);
|
|
|
+ planYearsList = planYearsService.changeTo(planYears);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -283,21 +289,133 @@ public class PlanYearsController extends BaseController {
|
|
|
@GetMapping("/getProcurementService")
|
|
|
// @PreAuthorize("@ss.hasPermi('plan:planYears:getProcurementService')")
|
|
|
@Log(title = ModularConstans.planYear, businessType = BusinessType.QUERY)
|
|
|
- public AjaxResult getProcurementService() {
|
|
|
+ public AjaxResult getProcurementService(@RequestBody PlanYears p) {
|
|
|
//获取当前登录人的部门ID
|
|
|
LoginUser loginUser = getLoginUser();
|
|
|
+ String projectType = p.getProjectType();
|
|
|
+ BigDecimal evaluation = p.getEvaluation();
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ list.add("网空采购站");
|
|
|
if (StringUtils.isNull(loginUser) || StringUtils.isNull(loginUser.getDeptId())) {
|
|
|
- return success("当前登陆过期,请重新登录!");
|
|
|
+ return error("当前登陆过期,请重新登录!");
|
|
|
}
|
|
|
Long deptId = loginUser.getDeptId();
|
|
|
// 获取当前登陆人的部门名称
|
|
|
SysDept sysDept = iSysDeptService.selectById(deptId);
|
|
|
if (StringUtils.isNull(sysDept) || StringUtils.isNull(sysDept.getDeptName())) {
|
|
|
- return success("当前登陆人没有部门信息,请核对数据!");
|
|
|
+ return error("当前登陆人没有部门信息,请核对数据!");
|
|
|
+ }
|
|
|
+
|
|
|
+ String str = sysDept.getPurchaseServices();
|
|
|
+
|
|
|
+ if (!ObjectUtils.isEmpty(p)) {
|
|
|
+ if (ObjectUtils.isEmpty(p.getEvaluation()) || ObjectUtils.isEmpty(p.getProjectType())) {
|
|
|
+ return error("概算金额与项目类型必须先选");
|
|
|
+ }
|
|
|
+ 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[2]);
|
|
|
+ } else if (ancestors.length == 4) { //A级
|
|
|
+ deptLevel = "A";
|
|
|
+ cdeptId = Long.valueOf(ancestors[2]);
|
|
|
+ bdeptId = Long.valueOf(ancestors[3]);
|
|
|
+ }
|
|
|
+ if (!Arrays.asList("A", "B", "C").contains(deptLevel)) {
|
|
|
+ return success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (deptLevel) {
|
|
|
+ case "A":
|
|
|
+ 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 = sysProcurementStandardService.list(queryWrapperA);
|
|
|
+ if (ObjectUtils.isEmpty(sysProcurementStandardsListA)) {
|
|
|
+ throw new ServiceException("部门id为" + deptId + "的部门采购标准未进行初始化!");
|
|
|
+ }
|
|
|
+ //A不限额就自己审核
|
|
|
+ SysProcurementStandard sA = sysProcurementStandardsListA.get(0);
|
|
|
+ if (sA.getState().equals(Integer.valueOf(0))) {
|
|
|
+ //采用初始化数据
|
|
|
+ } else {
|
|
|
+ //A限额了判断是否超额,不超额就自己审。超额了追加上级
|
|
|
+ BigDecimal maximum = sA.getMaximum();
|
|
|
+ if (maximum.compareTo(evaluation) == 1) {
|
|
|
+ //采用初始化数据
|
|
|
+ } else {
|
|
|
+ //A限额了,找B
|
|
|
+ SysDept b = iSysDeptService.selectById(bdeptId);
|
|
|
+ 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 = sysProcurementStandardService.list(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采用初始化数据
|
|
|
+
|
|
|
+ str = b.getPurchaseServices();
|
|
|
+ } else {
|
|
|
+ //B限额了判断是否超额,不超额就自己审。超额了追加C级
|
|
|
+ str = b.getPurchaseServices();
|
|
|
+ BigDecimal maximumB = sB.getMaximum();
|
|
|
+ //B超额
|
|
|
+ if (maximumB.compareTo(evaluation) == -1) {
|
|
|
+ SysDept c = iSysDeptService.selectById(cdeptId);
|
|
|
+ str = c.getPurchaseServices();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "B":
|
|
|
+ // B的判断 最少插入1条。最多插入2条
|
|
|
+ SysDept b = iSysDeptService.selectById(bdeptId);
|
|
|
+ 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 = sysProcurementStandardService.list(queryWrapperB);
|
|
|
+ //B不限额,B审
|
|
|
+ if (ObjectUtils.isEmpty(sysProcurementStandardsListB)) {
|
|
|
+ throw new ServiceException("部门id为" + deptId + "的部门采购标准未进行初始化!");
|
|
|
+ }
|
|
|
+ SysProcurementStandard sB = sysProcurementStandardsListB.get(0);
|
|
|
+ if (sB.getState() == 0) {
|
|
|
+
|
|
|
+ str = b.getPurchaseServices();
|
|
|
+ } else {
|
|
|
+ //B限额了判断是否超额,不超额就自己审。超额了追加C级
|
|
|
+ BigDecimal maximumB = sB.getMaximum();
|
|
|
+ //B不超额B审
|
|
|
+ if (maximumB.compareTo(evaluation) == 1) {
|
|
|
+ str = b.getPurchaseServices();
|
|
|
+ } else {
|
|
|
+ SysDept c = iSysDeptService.selectById(cdeptId);
|
|
|
+ str = c.getPurchaseServices();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ SysDept c = iSysDeptService.selectById(cdeptId);
|
|
|
+ str = c.getPurchaseServices();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!org.apache.commons.lang3.StringUtils.isBlank(str)) {
|
|
|
+ list.add(str);
|
|
|
}
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
- list.add("网空采购站");
|
|
|
- list.add(sysDept.getPurchaseServices());
|
|
|
return success(list);
|
|
|
}
|
|
|
}
|