浏览代码

modify:

1. 资金下达相关接口;
tags/24090601
WendyYang 2 个月前
父节点
当前提交
ba738aef87
共有 8 个文件被更改,包括 298 次插入0 次删除
  1. +52
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AmountApprovalController.java
  2. +173
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java
  3. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java
  4. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java
  5. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java
  6. +35
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitAmountApprovalReq.java
  7. +26
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AmountApprovalProgressStatisticsVO.java
  8. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java

+ 52
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/AmountApprovalController.java 查看文件

@@ -0,0 +1,52 @@
package com.hz.pm.api.projectlib.controller;

import com.hz.pm.api.projectlib.manage.AmountApprovalManage;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.req.SubmitAmountApprovalReq;
import com.hz.pm.api.projectlib.model.vo.AmountApprovalProgressStatisticsVO;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* <p>
* AmountApprovalController
* </p>
*
* @author WendyYang
* @since 17:08 2024/9/4
*/
@Api(tags = "资金下达控制器")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/amountApproval")
public class AmountApprovalController {

private final AmountApprovalManage amountApprovalManage;

@GetMapping("/page")
@ApiOperation("分页查询")
public PageVo<ProjectLibListItemVO> page(ProjectListReq req) {
return amountApprovalManage.page(req);
}

@GetMapping("progressStatistics")
@ApiOperation("资金下达进度统计")
public AmountApprovalProgressStatisticsVO progressStatistics(ProjectListReq req) {
return amountApprovalManage.progressStatistics(req);
}

@PostMapping("/submit")
@ApiOperation("资金下达")
@WebLog("资金下达")
public void submit(@RequestBody @Valid SubmitAmountApprovalReq req) {
amountApprovalManage.submitAmountApproval(req);
}

}

+ 173
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java 查看文件

@@ -0,0 +1,173 @@
package com.hz.pm.api.projectlib.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.datascope.model.DataScopeDTO;
import com.hz.pm.api.datascope.utils.DataScopeUtil;
import com.hz.pm.api.projectlib.helper.ProjectManageUtil;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.req.SubmitAmountApprovalReq;
import com.hz.pm.api.projectlib.model.vo.AmountApprovalProgressStatisticsVO;
import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO;
import com.hz.pm.api.projectlib.model.vo.AnnualPlanProgressStatisticsVO;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;

/**
* <p>
* AmountApprovalManage
* </p>
*
* @author WendyYang
* @since 17:10 2024/9/4
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class AmountApprovalManage {

private final IProjectService projectService;
private final UserInfoHelper userInfoHelper;
private final MhUnitCache mhUnitCache;


private boolean projectQueryPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) {
boolean queryState = true;
Optional<DataScopeDTO> currDs = DataScopeUtil.getCurrentUserDataScopeHasUserId(user);
if (!currDs.isPresent()) {
log.warn("没有取到权限信息 当前查询 没有权限条件");
queryState = false;
} else {
switch (currDs.get().getRole()) {
case NORMAL_MEMBER:
//普通用户 只能看到自己单位去申报的
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr());
break;
case COMPANY_MANAGER:
List<Long> childUnitIds = mhUnitCache.getViewChildIdsRecursion(user.getMhUnitId());
List<String> viewUnitIdList = CollUtils.convert(childUnitIds, String::valueOf);
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目
query.and(q1 -> q1.in(Project::getBuildOrgCode, viewUnitIdList)
.or(q2 -> q2.eq(Project::getStage, ProjectStatus.NOT_APPROVED.getCode())
.in(Project::getSuperOrgCode, viewUnitIdList)));
break;
case SUPER_ADMIN:
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员
break;
case VISITOR:
//访客可以看全市的
break;
case DASHBOARD:
break;
default:
//没有权限的话 就让它查不到
queryState = false;
break;
}
}
return queryState;
}

public PageVo<ProjectLibListItemVO> page(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery();
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
if (!projectQueryPermission(query, user)) {
return PageVo.empty();
}
ProjectManageUtil.projectQuery(query, req);
ProjectManageUtil.projectBaseQuery(query);
query.eq(Project::getNewest, Boolean.TRUE)
.ne(Project::getStage, ProjectStatus.STOPPED.getCode());
if (req.getIsAmountApproval() != null) {
if (Boolean.TRUE.equals(req.getIsAmountApproval())) {
query.gt(Project::getApprovalAmount, 0)
.isNotNull(Project::getApprovalAmount);
} else {
query.and(q -> q.isNull(Project::getApprovalAmount)
.or(q1 -> q1.le(Project::getApprovalAmount, 0)));
}
}
Page<Project> page = projectService.page(req.page(), query);
long total = page.getTotal();
if (total == 0) {
return PageVo.empty();
}
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectCode(w.getProjectCode());
item.setProjectName(w.getProjectName());
item.setStage(w.getStage());
item.setStatus(w.getStatus());
item.setProjectYear(w.getProjectYear());
item.setProjectType(w.getProjectType());
item.setDeclaredAmount(w.getDeclareAmount());
item.setBuildOrg(w.getBuildOrgName());
item.setCreateOn(w.getCreateOn());
item.setApprovedAmount(w.getApprovalAmount());
item.setReviewAmount(w.getReviewAmount());
return item;
});
return PageVo.of(records, total);
}

public AmountApprovalProgressStatisticsVO progressStatistics(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery();
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
if (!projectQueryPermission(query, user)) {
return null;
}
ProjectManageUtil.projectQuery(query, req);
ProjectManageUtil.projectBaseQuery(query);
query.eq(Project::getNewest, Boolean.TRUE)
.ne(Project::getStage, ProjectStatus.STOPPED.getCode());
if (req.getIsAmountApproval() != null) {
if (Boolean.TRUE.equals(req.getIsAmountApproval())) {
query.gt(Project::getApprovalAmount, 0)
.isNotNull(Project::getApprovalAmount);
} else {
query.and(q -> q.isNull(Project::getApprovalAmount)
.or(q1 -> q1.le(Project::getApprovalAmount, 0)));
}
}
List<Project> page = projectService.list(query);
AmountApprovalProgressStatisticsVO stat = new AmountApprovalProgressStatisticsVO();
stat.setTotalCount(page.size());
stat.setApprovalCount(CollUtil.count(page, w -> w.getApprovalAmount() != null
&& NumberUtil.isGreater(w.getApprovalAmount(), BigDecimal.ZERO)));
stat.setUnApprovalCount(stat.getTotalCount() - stat.getApprovalCount());
return stat;
}

public void submitAmountApproval(SubmitAmountApprovalReq req) {
Project project = projectService.getNewestNoNull(req.getProjectId());
Assert.isTrue(ProjectStatus.STOPPED.eq(project.getStage()), "项目终止中");
LambdaUpdateWrapper<Project> wrapper = Wrappers.lambdaUpdate(Project.class)
.set(Project::getApprovalAmountFile, req.getApprovalAmountFile())
.set(Project::getApprovalAmount, req.getApprovalAmount())
.set(Project::getReviewAmount, req.getReviewAmount())
.eq(Project::getId, project.getId());
projectService.update(wrapper);
}

}

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java 查看文件

@@ -183,6 +183,9 @@ public class ProjectDTO implements Serializable {
@ApiModelProperty("年度支付计划")
private List<ProjectPaymentPlanDTO> paymentPlanList;

@ApiModelProperty("资金下达附件")
private String approvalAmountFile;

@ApiModelProperty("立项批复资金(万元)")
private BigDecimal approvalAmount;



+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java 查看文件

@@ -185,6 +185,9 @@ public class Project implements Serializable {

//==================================================================================================================

@ApiModelProperty("资金下达附件")
private String approvalAmountFile;

@ApiModelProperty("批复-自有金额(万元)")
private BigDecimal approvalHaveAmount;



+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java 查看文件

@@ -121,6 +121,9 @@ public class ProjectListReq extends PagePo {

private Boolean isStartDeclaredProject;

@ApiModelProperty("是否资金已下达")
private Boolean isAmountApproval;

private Long declaredUnitId;

private List<Long> declaredUnitIds;


+ 35
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitAmountApprovalReq.java 查看文件

@@ -0,0 +1,35 @@
package com.hz.pm.api.projectlib.model.req;

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

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
* <p>
* SubmitAmountApprovalReq
* </p>
*
* @author WendyYang
* @since 17:28 2024/9/4
*/
@Data
public class SubmitAmountApprovalReq {

@ApiModelProperty("项目ID")
@NotNull(message = "项目ID不能为空")
private Long projectId;

@ApiModelProperty("批复金额")
@NotNull(message = "批复金额不能为空")
private BigDecimal approvalAmount;

@ApiModelProperty("评审金额")
@NotNull(message = "评审金额不能为空")
private BigDecimal reviewAmount;

@ApiModelProperty("资金下达附件")
private String approvalAmountFile;

}

+ 26
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/AmountApprovalProgressStatisticsVO.java 查看文件

@@ -0,0 +1,26 @@
package com.hz.pm.api.projectlib.model.vo;

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

/**
* <p>
* AmountApprovalProgressStatisticsVO
* </p>
*
* @author WendyYang
* @since 17:01 2024/9/4
*/
@Data
public class AmountApprovalProgressStatisticsVO {

@ApiModelProperty("总数量")
private Integer totalCount;

@ApiModelProperty("已下达资金数量")
private Integer approvalCount;

@ApiModelProperty("未下达资金数量")
private Integer unApprovalCount;

}

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java 查看文件

@@ -213,6 +213,9 @@ public class ProjectDetailVO {
@ApiModelProperty("年度支付计划-其它资金(万元)")
private BigDecimal annualPlanOtherAmount;

@ApiModelProperty("资金下达附件")
private String approvalAmountFile;

@ApiModelProperty("立项批复资金(万元)")
private BigDecimal approvalAmount;



正在加载...
取消
保存