WendyYang 1 рік тому
джерело
коміт
7b7dc6f010
5 змінених файлів з 256 додано та 0 видалено
  1. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java
  2. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java
  3. +84
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  4. +64
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectLibListReq.java
  5. +58
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java

+ 14
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java Переглянути файл

@@ -7,6 +7,7 @@ import org.springframework.util.NumberUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;

/**
@@ -36,4 +37,17 @@ public class BizUtils {
return splitToNum(str, Long.class);
}


public static <T> void notNull(T obj, Consumer<T> consumer) {
if (obj != null) {
consumer.accept(obj);
}
}

public static void notBlank(String str,Consumer<String> consumer) {
if (StrUtil.isNotBlank(str)) {
consumer.accept(str);
}
}

}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java Переглянути файл

@@ -0,0 +1,36 @@
package com.ningdatech.pmapi.projectlib.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectLibListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* <p>
* ProjectLibController
* </p>
*
* @author WendyYang
* @since 17:30 2023/2/1
*/
@RestController
@RequestMapping("/api/v1/project/lib")
@AllArgsConstructor
@Api(tags = "项目库")
public class ProjectLibController {

private final ProjectLibManage projectLibManage;

@GetMapping("/list")
@ApiOperation("项目库列表")
public PageVo<ProjectLibListItemVO> projectLibList(ProjectLibListReq req) {
return projectLibManage.projectLibList(req);
}

}

+ 84
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Переглянути файл

@@ -0,0 +1,84 @@
package com.ningdatech.pmapi.projectlib.manage;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.projectlib.model.req.ProjectLibListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.wflow.bean.entity.NdDeclaredProject;
import com.wflow.service.NdDeclaredProjectService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

import static com.ningdatech.pmapi.common.utils.BizUtils.notBlank;
import static com.ningdatech.pmapi.common.utils.BizUtils.notNull;

/**
* <p>
* ProjectLibManage
* </p>
*
* @author WendyYang
* @since 14:19 2023/2/1
*/
@Component
@RequiredArgsConstructor
public class ProjectLibManage {

private final NdDeclaredProjectService declaredProjectService;

private LambdaQueryWrapper<NdDeclaredProject> projectLibQuery(ProjectLibListReq req) {
LambdaQueryWrapper<NdDeclaredProject> query = Wrappers.lambdaQuery(NdDeclaredProject.class);
notBlank(req.getProjectName(), w -> query.like(NdDeclaredProject::getProjectName, w));
notNull(req.getProjectType(), w -> query.eq(NdDeclaredProject::getProjectType, w));
notNull(req.getProjectYear(), w -> query.eq(NdDeclaredProject::getProjectYear, w));
// 申报金额 批复金额
notNull(req.getApprovedAmountMin(), w -> query.ge(NdDeclaredProject::getApprovedAmount, w));
notNull(req.getApprovedAmountMax(), w -> query.le(NdDeclaredProject::getApprovedAmount, w));

notNull(req.getDeclaredAmountMax(), w -> query.le(NdDeclaredProject::getDeclaredAmount, w));
notNull(req.getDeclaredAmountMin(), w -> query.ge(NdDeclaredProject::getDeclaredAmount, w));
// 状态查询
notNull(req.getStatus1st(), w -> query.ge(NdDeclaredProject::getProjectStatusFirst, w));
notNull(req.getStatus2nd(), w -> query.ge(NdDeclaredProject::getProjectStatusSecond, w));

notNull(req.getCreateOnMin(), w -> query.ge(NdDeclaredProject::getCreateOn, w));
notNull(req.getCreateOnMax(), w -> query.le(NdDeclaredProject::getCreateOn, w));

notBlank(req.getApplyOrg(), w -> query.like(NdDeclaredProject::getOrgName, w));

query.orderByDesc(NdDeclaredProject::getUpdateOn, NdDeclaredProject::getCreateOn);
// TODO 区域编码处理
return query;
}

public PageVo<ProjectLibListItemVO> projectLibList(ProjectLibListReq req) {
LambdaQueryWrapper<NdDeclaredProject> query = projectLibQuery(req);
Page<NdDeclaredProject> page = declaredProjectService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
return PageVo.empty();
}
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclaredAmount());
item.setStatus1st(w.getProjectStatusFirst());
item.setStatus2nd(w.getProjectStatusSecond());
item.setProjectType(w.getProjectType());
item.setProjectYear(w.getProjectYear());
item.setApplyOrg(w.getOrgName());
item.setBizArea(w.getBizArea());
return item;
});
return PageVo.of(records, total);
}

}

+ 64
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectLibListReq.java Переглянути файл

@@ -0,0 +1,64 @@
package com.ningdatech.pmapi.projectlib.model.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* <p>
* ProjectLibListReq
* </p>
*
* @author WendyYang
* @since 14:35 2023/2/1
*/
@Data
@ApiModel("项目库列表查询")
@EqualsAndHashCode(callSuper = true)
public class ProjectLibListReq extends PagePo {

@ApiModelProperty("区域编码")
private String regionCode;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报单位")
private String applyOrg;

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("预算年度")
private Integer projectYear;

@ApiModelProperty("项目状态")
private Integer status1st;

@ApiModelProperty("项目状态")
private Integer status2nd;

@ApiModelProperty("申报金额")
private BigDecimal declaredAmountMin;

@ApiModelProperty("申报金额")
private BigDecimal declaredAmountMax;

@ApiModelProperty("批复金额")
private BigDecimal approvedAmountMin;

@ApiModelProperty("批复金额")
private BigDecimal approvedAmountMax;

@ApiModelProperty("创建时间")
private LocalDateTime createOnMin;

@ApiModelProperty("创建时间")
private LocalDateTime createOnMax;

}

+ 58
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java Переглянути файл

@@ -0,0 +1,58 @@
package com.ningdatech.pmapi.projectlib.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* <p>
* ProjectLibListItemVO
* </p>
*
* @author WendyYang
* @since 15:13 2023/2/1
*/
@Data
@ApiModel("项目库列表视图")
public class ProjectLibListItemVO {

@ApiModelProperty("项目ID")
private Long id;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报金额")
private BigDecimal declaredAmount;

@ApiModelProperty("批复金额")
private BigDecimal approvedAmount;

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("项目状态")
private Integer status1st;

@ApiModelProperty("项目状态")
private Integer status2nd;

@ApiModelProperty("申报年度")
private Integer projectYear;

@ApiModelProperty("申报单位")
private String applyOrg;

@ApiModelProperty("业务领域")
private String bizArea;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

}

Завантаження…
Відмінити
Зберегти