suntianwu 2 éve
szülő
commit
3226ee0d8a

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

@@ -2,6 +2,7 @@ package com.ozs.web.controller.pm;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.pagehelper.PageInfo;
 import com.ozs.common.core.domain.model.LoginUser;
 import com.ozs.framework.web.service.TokenService;
@@ -9,6 +10,7 @@ import com.ozs.pm.doman.vo.requestVo.PmBookBuildingReqVo;
 import com.ozs.pm.doman.vo.requestVo.PmDemandReqVo;
 import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
 import com.ozs.pm.service.IPmDemandService;
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -26,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
  * @author ruoyi
  * @date 2023-01-16
  */
+@Api(tags = "采购需求")
 @RestController
 @RequestMapping("/pm/demand")
 public class PmDemandController extends BaseController {
@@ -40,9 +43,9 @@ public class PmDemandController extends BaseController {
     @ApiOperation(value = "查询采购需求列表", notes = "参数非必传")
     @PostMapping("/list")
     public AjaxResult list(@RequestBody PmDemandReqVo pmDemandReqVo) {
-        List<PmDemandResVo> list = pmDemandService.selectPmDemandList(pmDemandReqVo);
-        PageInfo<PmDemandResVo> page = new PageInfo<>(list);
+        IPage<PmDemandResVo> page  = pmDemandService.selectPmDemandList(pmDemandReqVo);
         return success(page);
+
     }
 
     /**

+ 6 - 0
purchase-system/src/main/java/com/ozs/pm/doman/PmDemand.java

@@ -127,5 +127,11 @@ public class PmDemand extends BaseEntity
     @Excel(name = "调整建议")
     private String adjustAdvice;
 
+    /** 抽取招标代理机构id */
+    @Excel(name = "抽取招标代理机构id")
+    private Long agencyId;
 
+    /** 抽取招标代理机构时间 */
+    @Excel(name = "抽取招标代理机构时间")
+    private Date extractAgencyTime;
 }

+ 5 - 4
purchase-system/src/main/java/com/ozs/pm/doman/vo/requestVo/PmDemandReqVo.java

@@ -22,7 +22,7 @@ import java.util.List;
 @AllArgsConstructor
 @NoArgsConstructor
 @Builder
-@ApiModel("采购需求对象")
+@ApiModel("采购需求查询对象")
 public class PmDemandReqVo extends PageVo
 {
     /** 主键 */
@@ -35,7 +35,7 @@ public class PmDemandReqVo extends PageVo
 
     /** 采购服务站 */
     @ApiModelProperty("采购服务站")
-    private String purchaseServiceStation;
+    private String purchaseServices;
 
 
     /** 项目状态(4:需求待填制,5:需求待提交,6:需求待审核,7:任务待下达,8:任务已下达,9:中标信息待填制,10:中标信息已填制,11:合同待填制,12:合同已填制,13:项目建设中,14:项目建设完成) */
@@ -47,11 +47,11 @@ public class PmDemandReqVo extends PageVo
     private Integer isExcess;
 
     /** 开始日期 */
-    @ApiModelProperty("开始日期")
+    @ApiModelProperty("开始日期 yyyy-MM-dd")
     private String beginDate;
 
     /** 结束日期 */
-    @ApiModelProperty("结束日期")
+    @ApiModelProperty("结束日期 yyyy-MM-dd")
     private String endDate;
 
     /** 退回原因 */
@@ -72,4 +72,5 @@ public class PmDemandReqVo extends PageVo
     /** 模块名称 */
     @ApiModelProperty("模块名称")
     private String moduleName;
+
 }

+ 2 - 1
purchase-system/src/main/java/com/ozs/pm/mapper/PmDemandMapper.java

@@ -1,5 +1,6 @@
 package com.ozs.pm.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ozs.pm.doman.PmDemand;
 
 import java.util.List;
@@ -11,7 +12,7 @@ import java.util.List;
  * @author ruoyi
  * @date 2023-01-16
  */
-public interface PmDemandMapper 
+public interface PmDemandMapper extends BaseMapper<PmDemand>
 {
     /**
      * 查询采购需求

+ 4 - 3
purchase-system/src/main/java/com/ozs/pm/service/IPmDemandService.java

@@ -1,13 +1,14 @@
 package com.ozs.pm.service;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ozs.pm.doman.PmDemand;
 import com.ozs.pm.doman.vo.requestVo.PmBookBuildingReqVo;
 import com.ozs.pm.doman.vo.requestVo.PmDemandReqVo;
 import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
 import com.ozs.pm.doman.vo.responseVo.PmFlowChartResVo;
 
-import java.util.List;
 
 
 /**
@@ -16,7 +17,7 @@ import java.util.List;
  * @author ruoyi
  * @date 2023-01-16
  */
-public interface IPmDemandService 
+public interface IPmDemandService extends IService<PmDemand>
 {
     /**
      * 查询采购需求
@@ -32,7 +33,7 @@ public interface IPmDemandService
      * @param pmDemandReqVo 采购需求
      * @return 采购需求集合
      */
-    public List<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo);
+    public IPage<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo);
 
     /**
      * 新增采购需求

+ 44 - 20
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -2,6 +2,10 @@ package com.ozs.pm.service.impl;
 
 import java.util.*;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ozs.common.enums.*;
 import com.ozs.common.utils.DateUtils;
 import com.ozs.common.utils.StringUtils;
@@ -30,7 +34,7 @@ import org.springframework.util.ObjectUtils;
  * @date 2023-01-16
  */
 @Service
-public class PmDemandServiceImpl implements IPmDemandService
+public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> implements IPmDemandService
 {
     @Autowired
     private PmDemandMapper pmDemandMapper;
@@ -251,25 +255,43 @@ public class PmDemandServiceImpl implements IPmDemandService
      * @return 采购需求
      */
     @Override
-    public List<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo) {
-        PmDemand pmDemand = new PmDemand();
-        pmDemand.setProjectName(pmDemandReqVo.getProjectName());
-        pmDemand.setPurchaseServices(pmDemandReqVo.getPurchaseServiceStation());
-        pmDemand.setProjectStatus(pmDemandReqVo.getProjectStatus());
-        pmDemand.setIsExcess(pmDemandReqVo.getIsExcess());
-        Map<String,Object> params = new HashMap<>();
-        params.put("beginDate", pmDemandReqVo.getBeginDate());
-        params.put("endDate", pmDemandReqVo.getEndDate());
-        pmDemand.setParams(params);
-        List<PmDemand> pmDemandList = pmDemandMapper.selectPmDemandList(pmDemand);
-        List<PmDemandResVo> pmDemandResponseVoList = new ArrayList<>();
-        if(pmDemandList != null && !pmDemandList.isEmpty()){
-            for(PmDemand pmDemand1 : pmDemandList){
+    public IPage<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo) {
+
+        LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<>();
+        if (!StringUtils.isBlank(pmDemandReqVo.getProjectName())) {
+            lw.like(PmDemand::getProjectName, "%" + pmDemandReqVo.getProjectName() + "%");
+        }
+        if (!StringUtils.isBlank(pmDemandReqVo.getPurchaseServices())) {
+            lw.eq(PmDemand::getPurchaseServices, pmDemandReqVo.getPurchaseServices());
+        }
+        if (pmDemandReqVo.getProjectStatus() != null) {
+            lw.eq(PmDemand::getProjectStatus, pmDemandReqVo.getProjectStatus());
+        }
+        if (pmDemandReqVo.getIsExcess() != null) {
+            lw.eq(PmDemand::getIsExcess, pmDemandReqVo.getIsExcess());
+        }
+        if (!StringUtils.isBlank(pmDemandReqVo.getBeginDate())) {
+            lw.apply("(plan_demand_sub_time >= '" + pmDemandReqVo.getBeginDate() +"' or plan_purchase_finish_time >= '" + pmDemandReqVo.getBeginDate() + "' or plan_deliver_time >=  '" + pmDemandReqVo.getBeginDate() +"' )");
+        }
+        if (!StringUtils.isBlank(pmDemandReqVo.getEndDate())) {
+            lw.apply("(plan_demand_sub_time <= '" + pmDemandReqVo.getEndDate() +"' or plan_purchase_finish_time <= '" + pmDemandReqVo.getEndDate() + "' or plan_deliver_time <=  '" + pmDemandReqVo.getEndDate() +"' )");
+        }
+
+        IPage<PmDemand> pageRes = this.page(new Page<>(pmDemandReqVo.getPageNum(), pmDemandReqVo.getPageSize()), lw);
+        IPage<PmDemandResVo> results = new Page<>(pageRes.getCurrent(), pageRes.getSize(), pageRes.getTotal());
+        if(pageRes.getRecords() != null && pageRes.getRecords().size() > 0){
+            List<PmDemandResVo> pmDemandResponseVoList = new ArrayList<>();
+            for(PmDemand pmDemand1 : pageRes.getRecords()){
                 PmDemandResVo vo = new PmDemandResVo();
-                BeanUtils.copyBeanProp(pmDemand1,vo);
-                SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo) deptService.selectDeptById(vo.getPurchaseDeptId()).get("sysDept");
-                if(sysDeptResponseVo != null){
-                    vo.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
+                BeanUtils.copyProperties(pmDemand1,vo);
+                if(vo.getPurchaseDeptId() != null){
+                    Map<String, Object> deptMap =  deptService.selectDeptById(vo.getPurchaseDeptId());
+                    if(deptMap!= null){
+                        SysDeptResponseVo sysDeptResponseVo = (SysDeptResponseVo)deptMap.get("sysDept");
+                        if(sysDeptResponseVo != null){
+                            vo.setPurchaseDeptName(sysDeptResponseVo.getDeptName());
+                        }
+                    }
                 }
 
                 String purchaseServicesName = dictDataService.selectDictLabel("purchase_services",vo.getPurchaseServices());
@@ -323,8 +345,10 @@ public class PmDemandServiceImpl implements IPmDemandService
                 }
                 pmDemandResponseVoList.add(vo);
             }
+            results.setRecords(pmDemandResponseVoList);
         }
-        return pmDemandResponseVoList;
+
+        return results;
     }
 
     /**