hexiao преди 2 години
родител
ревизия
9af5fe5ec8

+ 24 - 8
purchase-admin/src/main/java/com/ozs/web/controller/base/BaseAgencyController.java

@@ -146,6 +146,22 @@ public class BaseAgencyController extends BaseController {
             lw.eq(BaseAgency::getCompanyType, vo.getCompanyType());
         }
         IPage<BaseAgency> page = baseAgencyService.page(new Page<BaseAgency>(vo.getPageNum(), vo.getPageSize()), lw);
+        if (!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())) {
+
+            List<SysDictData> dictData = dictTypeService.selectDictDataByType(Constants.SYS_COMPANY_NATURE);
+            if (!ObjectUtils.isEmpty(dictData)) {
+                List<BaseAgency> collect = page.getRecords().stream().map(o -> {
+                    List<SysDictData> dl = dictData.stream()
+                            .filter(d -> d.getDictValue().equals(o.getCompanyNature())).collect(Collectors.toList());
+                    if (!ObjectUtils.isEmpty(dl)) {
+                        o.setCompanyNature(dl.get(0).getDictLabel());
+                    }
+                    return o;
+                }).collect(Collectors.toList());
+                page.setRecords(collect);
+            }
+
+        }
         return success(page);
     }
 
@@ -223,7 +239,7 @@ public class BaseAgencyController extends BaseController {
     @PreAuthorize("@ss.hasPermi('base:agency:listProjectInfoLikeName')")
     @Log(title = ModularConstans.agency, businessType = BusinessType.QUERY)
     public AjaxResult listProjectInfoLikeName(@NotEmpty(message = "数据为空")
-                                      @RequestBody BasePolicyPageReqVo vo) {
+                                              @RequestBody BasePolicyPageReqVo vo) {
         LambdaQueryWrapper<MonthlyReconciliation> lw = new LambdaQueryWrapper<>();
         lw.isNull(MonthlyReconciliation::getAgencyId);
         lw.eq(MonthlyReconciliation::getProjectStatus, PmProjectStatus.WAIT_SELECT_AGENT.getCode());
@@ -239,18 +255,18 @@ public class BaseAgencyController extends BaseController {
     @PreAuthorize("@ss.hasPermi('base:agency:extract')")
     @Log(title = ModularConstans.agency, businessType = BusinessType.OTHER)
     public AjaxResult extract(@NotEmpty(message = "主键id不能为空")
-                                  @RequestParam(value = "demandId", required = true)
-                                               Long demandId) {
+                              @RequestParam(value = "demandId", required = true)
+                                      Long demandId) {
         LambdaQueryWrapper<BaseAgency> lw = new LambdaQueryWrapper<>();
         MonthlyReconciliation byId = monthlyReconciliationService.getById(demandId);
-        if(ObjectUtils.isEmpty(byId)){
-         return error("参数错误");
+        if (ObjectUtils.isEmpty(byId)) {
+            return error("参数错误");
         }
         byId.setExtractAgencyTime(new Date());
-        lw.eq(BaseAgency::getCompanyType,byId.getProjectType());
-        lw.eq(BaseAgency::getStatus,0);
+        lw.eq(BaseAgency::getCompanyType, byId.getProjectType());
+        lw.eq(BaseAgency::getStatus, 0);
         Optional<BaseAgency> any = baseAgencyService.list(lw).stream().findAny();
-        if(ObjectUtils.isEmpty(any)){
+        if (ObjectUtils.isEmpty(any)) {
             return error("没有符合的招标代理机构,抽取失败!");
         }
         byId.setAgencyId(any.get().getId());

+ 2 - 62
purchase-admin/src/main/java/com/ozs/web/controller/plan/MonthlyReconciliationController.java

@@ -63,60 +63,9 @@ public class MonthlyReconciliationController extends BaseController {
     @Log(title = ModularConstans.monthly, businessType = BusinessType.QUERY)
     public AjaxResult page(@NotEmpty(message = "数据为空")
                            @RequestBody MonthlyReconciliationPageReqVo vo) {
-        LambdaQueryWrapper<MonthlyReconciliation> lw = new LambdaQueryWrapper<>();
-        if (!StringUtils.isBlank(vo.getProjectName())) {
-            lw.like(MonthlyReconciliation::getProjectName, vo.getProjectName());
-        }
-        if (!ObjectUtils.isEmpty(vo.getProjectStatus())) {
-            lw.eq(MonthlyReconciliation::getProjectStatus, vo.getProjectStatus());
-        }
-        if (!StringUtils.isBlank(vo.getPurchaseServices())) {
-            lw.eq(MonthlyReconciliation::getPurchaseServices, vo.getPurchaseServices());
-        }
-        if (!ObjectUtils.isEmpty(vo.getStartTime())) {
-            lw.ge(MonthlyReconciliation::getPlanDemandSubTime, vo.getStartTime());
-        }
-        if (!ObjectUtils.isEmpty(vo.getStartTime())) {
-            lw.le(MonthlyReconciliation::getPlanDemandSubTime, vo.getEntTime());
-        }
-        if (!StringUtils.isBlank(vo.getWarnStatus())) {
-            lw.eq(MonthlyReconciliation::getWarnStatus, vo.getWarnStatus());
-        }
-        // 添加数据权限
-        List<String> roleKeys = getLoginUser().getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.toList());
-        if (roleKeys.contains(Constants.DEMAND_UNIT)) {
-            // 需求单位
-            /*(purchase_dept_id = 当前用户deptID) */
-            lw.eq(MonthlyReconciliation::getPurchaseDeptId, getDeptId());
-        } else if (roleKeys.contains(Constants.PURCHASING_MANAGEMENT)
-                || roleKeys.contains(Constants.PURCHASE_SERVICES)) {
-            // 采购管理部门  或  采购办
-            SysDept sysDept = new SysDept();
-            sysDept.setParentId(getDeptId());
-            sysDept.setStatus("0");
-            List<Long> childDeptIds = iSysDeptService.selectDeptList(sysDept)
-                    .stream()
-                    .map(SysDept::getDeptId)
-                    .collect(Collectors.toList());
-            if(ObjectUtils.isEmpty(childDeptIds)){
-                lw.and((wrapper) -> {
-                    wrapper.eq(MonthlyReconciliation::getIsExcess, 0);
-                    wrapper.eq(MonthlyReconciliation::getPurchaseDeptId, getDeptId());
-                });
-            }else {
-                lw.and((wrapper) -> {
-                    wrapper.eq(MonthlyReconciliation::getIsExcess, 0);
-                    wrapper.eq(MonthlyReconciliation::getPurchaseDeptId, getDeptId());
-                })
-                        .or((wrapper) -> {
-                            wrapper.eq(MonthlyReconciliation::getIsExcess, 1);
-                            wrapper.in(MonthlyReconciliation::getPurchaseDeptId, childDeptIds);
-                        });
-            }
-        }
-
+        vo.setDeptId(getDeptId());
         // 分页查询
-        IPage<MonthlyReconciliation> page = monthlyReconciliationService.page(new Page<>(vo.getPageNum(), vo.getPageSize()), lw);
+        IPage<MonthlyReconciliation> page = monthlyReconciliationService.queryPage(vo);
         if (!ObjectUtils.isEmpty(page.getRecords()) && page.getRecords().size() > 0) {
             page.setRecords(page.getRecords().stream().map(dto -> {
                 // 采购单位名称
@@ -125,15 +74,6 @@ public class MonthlyReconciliationController extends BaseController {
                     SysDeptResponseVo sysDept = (SysDeptResponseVo) stringObjectMap.get("sysDept");
                     dto.setPurchaseDeptName(sysDept.getDeptName());
                 }
-                // todo 采购服务站名称    要修改为单位管理里面的
-//                List<SysDictData> data = dictTypeService.selectDictDataByType(Constants.PURCHASE_SERVICES);
-//                if (!ObjectUtils.isEmpty(data)) {
-//                    List<SysDictData> collect = data.stream()
-//                            .filter(d -> d.getDictValue().equals(dto.getPurchaseServices())).collect(Collectors.toList());
-//                    if (!ObjectUtils.isEmpty(collect)) {
-//                        dto.setPurchaseServicesName(collect.get(0).getDictLabel());
-//                    }
-//                }
                 // 项目状态
                 List<SysDictData> projectStatus = dictTypeService.selectDictDataByType(Constants.SYS_PROJECT_STATUS);
                 if (!ObjectUtils.isEmpty(projectStatus)) {

+ 1 - 1
purchase-admin/src/main/java/com/ozs/web/controller/pm/PmDemandController.java

@@ -62,7 +62,7 @@ public class PmDemandController extends BaseController {
      */
     @ApiOperation(value = "查看详情", notes = "必传demandId和详情类型(1项目计划,2需求建档,3任务下达,4中标信息,5合同信息,6建设情况),其他字段不传")
     @PostMapping("/view")
-    @PreAuthorize("@ss.hasPermi('pm:demand:view')")
+//    @PreAuthorize("@ss.hasPermi('pm:demand:view')")  首页去除权限
     @Log(title = ModularConstans.demand, businessType = BusinessType.QUERY)
     public AjaxResult view(@RequestBody PmDemandReqVo pmDemandReqVo) {
         if(pmDemandReqVo.getDemandId() == null){

+ 2 - 0
purchase-common/src/main/java/com/ozs/common/constant/Constants.java

@@ -160,4 +160,6 @@ public class Constants {
     public static final String SYS_PROJECT_STATUS = "sys_project_status";
     // 报警状态
     public static final String PROJECT_WARN_STATUS = "project_warn_status";
+    // 单位性质
+    public static final String SYS_COMPANY_NATURE = "sys_company_nature";
 }

+ 1 - 0
purchase-system/src/main/java/com/ozs/plan/doman/vo/requestVo/MonthlyReconciliationPageReqVo.java

@@ -37,4 +37,5 @@ public class MonthlyReconciliationPageReqVo extends PageVo {
     @ApiModelProperty("预警状态")
     private String warnStatus;
 
+    private Long deptId;
 }

+ 16 - 1
purchase-system/src/main/java/com/ozs/plan/mapper/MonthlyReconciliationMapper.java

@@ -3,11 +3,26 @@ package com.ozs.plan.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ozs.base.domain.BaseAgency;
 import com.ozs.plan.doman.MonthlyReconciliation;
+import com.ozs.plan.doman.vo.requestVo.MonthlyReconciliationPageReqVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 
 @Mapper
 public interface MonthlyReconciliationMapper extends BaseMapper<MonthlyReconciliation> {
 
-
+    @Select("select p.* from " +
+            " pm_demand p left join pm_audit_dept_ref r " +
+            " on p.demand_id = r.ref_id  and  r.ref_type = 2 " +
+            " where r.dept_id = #{deptId}  " +
+            " and (#{projectName} is null  or   p.project_name like concat('%',#{projectName},'%'))  " +
+            " and (#{purchaseServices} is null  or   p.purchase_services = #{purchaseServices})  " +
+            " and (#{projectStatus} is null  or   p.project_status = #{projectStatus})  " +
+            " and (#{warnStatus} is null  or   p.warn_status = #{warnStatus})  " +
+            " and (#{startTime} is null  or   to_days(p.plan_demand_sub_time) >= to_days(#{startTime}) ) " +
+            " and (#{entTime} is null  or   to_days(p.plan_demand_sub_time) <= to_days(#{entTime}) ) " +
+            "  ")
+    List<MonthlyReconciliation> query(MonthlyReconciliationPageReqVo vo);
 }

+ 4 - 0
purchase-system/src/main/java/com/ozs/plan/service/MonthlyReconciliationService.java

@@ -1,10 +1,14 @@
 package com.ozs.plan.service;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ozs.plan.doman.MonthlyReconciliation;
+import com.ozs.plan.doman.vo.requestVo.MonthlyReconciliationPageReqVo;
 
 public interface MonthlyReconciliationService extends IService<MonthlyReconciliation> {
 
 
+    IPage<MonthlyReconciliation> queryPage(MonthlyReconciliationPageReqVo vo);
+
 }

+ 26 - 0
purchase-system/src/main/java/com/ozs/plan/service/impl/MonthlyReconciliationServiceImpl.java

@@ -1,15 +1,41 @@
 package com.ozs.plan.service.impl;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
 import com.ozs.plan.doman.MonthlyReconciliation;
+import com.ozs.plan.doman.vo.requestVo.MonthlyReconciliationPageReqVo;
 import com.ozs.plan.mapper.MonthlyReconciliationMapper;
 import com.ozs.plan.service.MonthlyReconciliationService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 @Slf4j
 public class MonthlyReconciliationServiceImpl extends ServiceImpl<MonthlyReconciliationMapper, MonthlyReconciliation> implements MonthlyReconciliationService {
 
+    @Autowired
+    private MonthlyReconciliationMapper monthlyReconciliationMapper;
+
+    @Override
+    public IPage<MonthlyReconciliation> queryPage(MonthlyReconciliationPageReqVo vo) {
+        int pageNum = Integer.parseInt(vo.getPageNum().toString());
+        int pageSize = Integer.parseInt(vo.getPageSize().toString());
+        vo.setProjectName(StringUtils.isBlank(vo.getProjectName()) ? null : vo.getProjectName());
+        vo.setPurchaseServices(StringUtils.isBlank(vo.getPurchaseServices()) ? null : vo.getPurchaseServices());
+        vo.setWarnStatus(StringUtils.isBlank(vo.getWarnStatus()) ? null : vo.getWarnStatus());
+        Page<MonthlyReconciliation> page = PageHelper.startPage(pageNum, pageSize)
+                .doSelectPage(() -> monthlyReconciliationMapper.query(vo));
+        com.baomidou.mybatisplus.extension.plugins.pagination.Page<MonthlyReconciliation> monthlyReconciliationPage =
+                new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
+        monthlyReconciliationPage.setRecords(page.getResult());
+        monthlyReconciliationPage.setTotal(page.getTotal());
+        return monthlyReconciliationPage;
+    }
+
 }