@@ -136,7 +136,7 @@ public class ExcelDownUtil { | |||||
} | } | ||||
public static void setExportResponseHeader(String fileName, HttpServletResponse response) throws UnsupportedEncodingException { | public static void setExportResponseHeader(String fileName, HttpServletResponse response) throws UnsupportedEncodingException { | ||||
// 设置响应头和保存文件名 | // 设置响应头和保存文件名 | ||||
response.setContentType(StrPool.CONTENT_TYPE); | |||||
response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); | |||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls"); | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls"); | ||||
} | } | ||||
@@ -2,8 +2,10 @@ package com.ningdatech.pmapi.projectlib.controller; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||||
import com.ningdatech.pmapi.projectlib.manage.ProjectRenewalFundManage; | import com.ningdatech.pmapi.projectlib.manage.ProjectRenewalFundManage; | ||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
@@ -12,6 +14,8 @@ import lombok.AllArgsConstructor; | |||||
import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import javax.servlet.http.HttpServletResponse; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 续建项目资金申请表 前端控制器 | * 续建项目资金申请表 前端控制器 | ||||
@@ -44,4 +48,23 @@ public class ProjectRenewalFundDeclarationController { | |||||
private Long declared (@Validated @RequestBody ProjectRenewalFundDeclarationDTO dto){ | private Long declared (@Validated @RequestBody ProjectRenewalFundDeclarationDTO dto){ | ||||
return projectRenewalFundManage.declared(dto); | return projectRenewalFundManage.declared(dto); | ||||
} | } | ||||
@PostMapping("/audit") | |||||
@ApiOperation("续建项目审核") | |||||
private Long audit(@Validated @RequestBody ProjectRenewalAuditReq param){ | |||||
return projectRenewalFundManage.audit(param); | |||||
} | |||||
@DeleteMapping("/delete/{projectRenewalId}") | |||||
@ApiOperation("续建项目删除") | |||||
private Long delete(@PathVariable("projectRenewalId") Long projectRenewalId){ | |||||
return projectRenewalFundManage.delete(projectRenewalId); | |||||
} | |||||
@GetMapping("/export") | |||||
@ApiOperation("续建项目列表导出") | |||||
private void exportList(ProjectRenewalListReq req, HttpServletResponse response){ | |||||
ExcelDownUtil.downXls(response,req,projectRenewalFundManage::exportList); | |||||
} | |||||
} | } |
@@ -1,6 +1,13 @@ | |||||
package com.ningdatech.pmapi.projectlib.enumeration; | package com.ningdatech.pmapi.projectlib.enumeration; | ||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
import lombok.NoArgsConstructor; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import java.util.Objects; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* ProjectRenewalApprovalStatusEnum | * ProjectRenewalApprovalStatusEnum | ||||
@@ -9,6 +16,9 @@ package com.ningdatech.pmapi.projectlib.enumeration; | |||||
* @author Poffy | * @author Poffy | ||||
* @since 16:54 2023/2/11 | * @since 16:54 2023/2/11 | ||||
*/ | */ | ||||
@Getter | |||||
@AllArgsConstructor | |||||
@NoArgsConstructor | |||||
public enum ProjectRenewalApprovalStatusEnum { | public enum ProjectRenewalApprovalStatusEnum { | ||||
/** | /** | ||||
* 续建项目 审核状态 | * 续建项目 审核状态 | ||||
@@ -16,8 +26,23 @@ public enum ProjectRenewalApprovalStatusEnum { | |||||
* 通过 | * 通过 | ||||
* 不通过 | * 不通过 | ||||
*/ | */ | ||||
PENDING, | |||||
PASS, | |||||
NOT_PASS; | |||||
PENDING(1,"审核中"), | |||||
PASS(2,"通过"), | |||||
NOT_PASS(3,"不通过"); | |||||
private Integer code; | |||||
private String desc; | |||||
public static String getDescByCode(Integer code) { | |||||
if (Objects.isNull(code)) { | |||||
return StringUtils.EMPTY; | |||||
} | |||||
for (ProjectRenewalApprovalStatusEnum t : ProjectRenewalApprovalStatusEnum.values()) { | |||||
if (code.equals(t.getCode())) { | |||||
return t.desc; | |||||
} | |||||
} | |||||
return StringUtils.EMPTY; | |||||
} | |||||
} | } |
@@ -1,15 +1,25 @@ | |||||
package com.ningdatech.pmapi.projectlib.manage; | package com.ningdatech.pmapi.projectlib.manage; | ||||
import cn.hutool.core.util.StrUtil; | |||||
import com.alibaba.excel.EasyExcel; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||||
import com.ningdatech.pmapi.common.util.ExcelExportStyle; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalExportDTO; | |||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | ||||
import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; | import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | ||||
@@ -19,9 +29,12 @@ import lombok.RequiredArgsConstructor; | |||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import javax.servlet.http.HttpServletResponse; | |||||
import java.io.IOException; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -115,4 +128,79 @@ public class ProjectRenewalFundManage { | |||||
} | } | ||||
return declaration.getId(); | return declaration.getId(); | ||||
} | } | ||||
/** | |||||
* 续建项目审核 | |||||
* @param param | |||||
* @return | |||||
*/ | |||||
public Long audit(ProjectRenewalAuditReq param) { | |||||
Long projectRenewalId = param.getProjectRenewalId(); | |||||
ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId); | |||||
if (Boolean.TRUE.equals(param.getResult())){ | |||||
projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PASS.name()); | |||||
}else { | |||||
String auditOpinion = param.getAuditOpinion(); | |||||
if (StrUtil.isBlank(auditOpinion)){ | |||||
throw new BizException("审核意见不能为空"); | |||||
} | |||||
projectRenewal.setAuditOpinion(auditOpinion); | |||||
projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.NOT_PASS.name()); | |||||
} | |||||
projectRenewal.setUpdateOn(LocalDateTime.now()); | |||||
projectRenewalFundDeclarationService.updateById(projectRenewal); | |||||
return projectRenewal.getId(); | |||||
} | |||||
/** | |||||
* 续建项目删除 | |||||
* @param projectRenewalId | |||||
* @return | |||||
*/ | |||||
public Long delete(Long projectRenewalId) { | |||||
ProjectRenewalFundDeclaration projectRenewal = projectRenewalFundDeclarationService.getById(projectRenewalId); | |||||
projectRenewal.setDeleted(true); | |||||
projectRenewal.setUpdateOn(LocalDateTime.now()); | |||||
projectRenewalFundDeclarationService.updateById(projectRenewal); | |||||
return projectRenewal.getId(); | |||||
} | |||||
public void exportList(HttpServletResponse response, ProjectRenewalListReq param) { | |||||
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); | |||||
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); | |||||
Page<ProjectRenewalFundDeclarationPO> page = param.page(); | |||||
projectRenewalFundDeclarationService.pageSql(page, param); | |||||
List<ProjectRenewalFundDeclarationPO> records = page.getRecords(); | |||||
List<ProjectRenewalExportDTO> collect = records.stream().map(r -> { | |||||
ProjectRenewalExportDTO exportDTO = new ProjectRenewalExportDTO(); | |||||
BeanUtils.copyProperties(r, exportDTO); | |||||
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType())); | |||||
if (ProjectRenewalApprovalStatusEnum.PENDING.name().equals(r.getApprovalStatus())) { | |||||
exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PENDING.getDesc()); | |||||
} else if (ProjectRenewalApprovalStatusEnum.PASS.name().equals(r.getApprovalStatus())) { | |||||
exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.PASS.getDesc()); | |||||
} else if (ProjectRenewalApprovalStatusEnum.NOT_PASS.name().equals(r.getApprovalStatus())) { | |||||
exportDTO.setApprovalStatusName(ProjectRenewalApprovalStatusEnum.NOT_PASS.getDesc()); | |||||
} | |||||
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||||
exportDTO.setCreateOn(createOnStr); | |||||
return exportDTO; | |||||
}).collect(Collectors.toList()); | |||||
String fileName = "续建项目资金库列表"; | |||||
ExcelDownUtil.setFileName(fileName,response); | |||||
//数据导出处理函数 | |||||
try { | |||||
EasyExcel.write(response.getOutputStream(), ProjectRenewalExportDTO.class) | |||||
.autoCloseStream(false) | |||||
.registerWriteHandler(ExcelExportStyle.formalStyle()) | |||||
.sheet(fileName) | |||||
.doWrite(collect); | |||||
} catch (IOException e) { | |||||
throw new RuntimeException(e); | |||||
} | |||||
} | |||||
} | } |
@@ -0,0 +1,41 @@ | |||||
package com.ningdatech.pmapi.projectlib.model.dto; | |||||
import com.alibaba.excel.annotation.ExcelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.math.BigDecimal; | |||||
/** | |||||
* 项目续建列表导出实体 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/21 15:03 | |||||
*/ | |||||
@Data | |||||
public class ProjectRenewalExportDTO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ExcelProperty("项目名称") | |||||
private String projectName; | |||||
@ExcelProperty("申报单位") | |||||
private String buildOrgName; | |||||
@ExcelProperty("项目类型") | |||||
private String projectTypeName; | |||||
@ExcelProperty("预算年度") | |||||
private Integer projectYear; | |||||
@ExcelProperty("年度支付金额(万元)") | |||||
private BigDecimal annualPaymentAmount; | |||||
@ExcelProperty("状态") | |||||
private String approvalStatusName; | |||||
@ExcelProperty("创建时间") | |||||
private String createOn; | |||||
} |
@@ -71,5 +71,8 @@ public class ProjectRenewalFundDeclaration implements Serializable { | |||||
@ApiModelProperty("是否删除 false未删 true已删") | @ApiModelProperty("是否删除 false未删 true已删") | ||||
private Boolean deleted; | private Boolean deleted; | ||||
@ApiModelProperty("审核意见") | |||||
private String auditOpinion; | |||||
} | } |
@@ -0,0 +1,33 @@ | |||||
package com.ningdatech.pmapi.projectlib.model.req; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import org.hibernate.validator.constraints.Length; | |||||
import javax.validation.constraints.Max; | |||||
import javax.validation.constraints.NotNull; | |||||
import javax.validation.constraints.Size; | |||||
/** | |||||
* 续建项目审核请求实体 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/21 13:43 | |||||
*/ | |||||
@Data | |||||
@ApiModel("续建项目审核请求参数") | |||||
public class ProjectRenewalAuditReq { | |||||
@NotNull | |||||
@ApiModelProperty("续建项目ID") | |||||
private Long projectRenewalId; | |||||
@NotNull(message = "审核结果不能为空") | |||||
@ApiModelProperty("审核结果") | |||||
private Boolean result; | |||||
@ApiModelProperty("审核意见") | |||||
@Length(max = 200) | |||||
private String auditOpinion; | |||||
} |
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | ||||
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | ||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | ||||
@@ -23,7 +24,9 @@ import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | |||||
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | ||||
import com.ningdatech.pmapi.user.model.vo.UserRoleVO; | import com.ningdatech.pmapi.user.model.vo.UserRoleVO; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | import com.ningdatech.pmapi.user.service.IUserInfoService; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
@@ -46,6 +49,7 @@ public class UserInfoManage { | |||||
private final IUserInfoService iUserInfoService; | private final IUserInfoService iUserInfoService; | ||||
private final IUserRoleService iUserRoleService; | private final IUserRoleService iUserRoleService; | ||||
private final IRoleService iRoleService; | private final IRoleService iRoleService; | ||||
private final UserInfoHelper userInfoHelper; | |||||
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | ||||
LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) | LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) | ||||
@@ -63,7 +67,7 @@ public class UserInfoManage { | |||||
Map<String, UserInfo> employeeCodeAvailableMap = new HashMap<>(); | Map<String, UserInfo> employeeCodeAvailableMap = new HashMap<>(); | ||||
if (CollUtil.isNotEmpty(employeeCodeList)) { | if (CollUtil.isNotEmpty(employeeCodeList)) { | ||||
employeeCodeAvailableMap = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) | employeeCodeAvailableMap = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) | ||||
.in(UserInfo::getEmployeeCode,employeeCodeList)) | |||||
.in(UserInfo::getEmployeeCode, employeeCodeList)) | |||||
.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, Function.identity())); | .stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, Function.identity())); | ||||
} | } | ||||
@@ -86,6 +90,8 @@ public class UserInfoManage { | |||||
if (StringUtils.isNotBlank(userInfo.getAvailable()) | if (StringUtils.isNotBlank(userInfo.getAvailable()) | ||||
&& UserAvailableEnum.ENABLE.name().equals(userInfo.getAvailable())) { | && UserAvailableEnum.ENABLE.name().equals(userInfo.getAvailable())) { | ||||
resListVO.setStatus(UserAvailableEnum.ENABLE.name()); | resListVO.setStatus(UserAvailableEnum.ENABLE.name()); | ||||
} else { | |||||
resListVO.setStatus(UserAvailableEnum.DISABLE.name()); | |||||
} | } | ||||
resListVO.setUserId(userInfo.getId()); | resListVO.setUserId(userInfo.getId()); | ||||
} else { | } else { | ||||
@@ -172,8 +178,10 @@ public class UserInfoManage { | |||||
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | ||||
.eq(UserInfo::getEmployeeCode, employeeCode)); | .eq(UserInfo::getEmployeeCode, employeeCode)); | ||||
if (Objects.isNull(userInfo)) { | if (Objects.isNull(userInfo)) { | ||||
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getMainJob, "true")); | |||||
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService | |||||
.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode) | |||||
.eq(DingEmployeeInfo::getMainJob, "true")); | |||||
if (CollUtil.isEmpty(dingEmployeeInfoList)) { | if (CollUtil.isEmpty(dingEmployeeInfoList)) { | ||||
throw new BizException("员工账号不存在"); | throw new BizException("员工账号不存在"); | ||||
} | } | ||||
@@ -196,6 +204,8 @@ public class UserInfoManage { | |||||
public ResUserDetailVO currentUserInfo() { | public ResUserDetailVO currentUserInfo() { | ||||
Long userId = LoginUserUtil.getUserId(); | |||||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||||
return null; | return null; | ||||
} | } | ||||
} | } |
@@ -15,14 +15,12 @@ security: | |||||
- /api/v1/user/auth/invalid-session | - /api/v1/user/auth/invalid-session | ||||
- /api/v1/user/auth/login/password | - /api/v1/user/auth/login/password | ||||
- /api/v1/user/auth/forget-password | - /api/v1/user/auth/forget-password | ||||
- /api/v1/** | |||||
- /doc.html | - /doc.html | ||||
- /ok.html | - /ok.html | ||||
- /open/api/** | - /open/api/** | ||||
- /oa/** | - /oa/** | ||||
- /wflow/** | - /wflow/** | ||||
- /sys/** | - /sys/** | ||||
- /api/v1/user-info/** | |||||
ignore-csrf-urls: | ignore-csrf-urls: | ||||
- /api/v1/user/auth/** | - /api/v1/user/auth/** | ||||
- /v2/api-docs | - /v2/api-docs | ||||