|
@@ -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;
|
|
|
}
|
|
|
|
|
|
/**
|