Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 year ago
parent
commit
0378eaea6d
18 changed files with 347 additions and 26 deletions
  1. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java
  2. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java
  3. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java
  4. +119
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java
  5. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java
  6. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml
  7. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java
  8. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java
  9. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java
  10. +8
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java
  11. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java
  12. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java
  13. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java
  14. +23
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  15. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java
  16. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java
  17. +28
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java
  18. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java View File

@@ -24,6 +24,8 @@ public interface RegionConst {
* 丽水行政区划编码
*/
String RC_LS = "331100";
//遂昌县
String RC_SC = "331123";

/**
* 中国行政区划编码


+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceIndicatorTemplateController.java View File

@@ -1,6 +1,7 @@
package com.ningdatech.pmapi.performance.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.performance.manage.IndicatorTemplateManage;
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
@@ -32,8 +33,15 @@ public class PerformanceIndicatorTemplateController {
return indicatorTemplateManage.projectList(req);
}

@GetMapping("/project/detail/{id}")
@ApiOperation("项目指标配置模板详情")
public PerformanceIndicatorProjectTemplateVO projectDetail(@PathVariable Long id) {
return indicatorTemplateManage.projectDetail(id);
}

@PostMapping("/project/save")
@ApiOperation("项目指标配置模板保存")
@WebLog("项目指标配置模板保存")
public String projectTemplateSave(@Valid @RequestBody PerformanceIndicatorProjectTemplateSaveDTO dto) {
return indicatorTemplateManage.projectTemplateSave(dto);
}


+ 44
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java View File

@@ -0,0 +1,44 @@
package com.ningdatech.pmapi.performance.enumration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
* <p>
* PerformanceTemplateTypeEnum
* </p>
*
* @author Poffy
* @since 16:56 2023/6/27
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PerformanceTemplateTypeEnum {
/**
* 模板类型
*/
STAGE(0, "阶段"),
FIRST_INDEX(1, "第一指标"),
SECOND_INDEX(2, "第二指标"),
THIRD_INDEX(3, "第三指标");

private Integer code;
private String desc;

public static String getDesc(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (PerformanceTemplateTypeEnum t : PerformanceTemplateTypeEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}
}

+ 119
- 4
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorTemplateManage.java View File

@@ -1,16 +1,23 @@
package com.ningdatech.pmapi.performance.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
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.google.common.collect.Lists;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum;
import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO;
import com.ningdatech.pmapi.performance.model.dto.ProjectTemplateDetailDTO;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplate;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceIndicatorProjectTemplateVO;
import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO;
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService;
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
@@ -20,6 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -36,6 +44,8 @@ import java.util.stream.Collectors;
public class IndicatorTemplateManage {
private final IPerformanceIndicatorProjectTemplateService indicatorTemplateService;

private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService;

/**
* 模板列表
* @param req
@@ -60,6 +70,26 @@ public class IndicatorTemplateManage {
}

/**
* 查询项目模板详情
* @param id
* @return
*/
public PerformanceIndicatorProjectTemplateVO projectDetail(Long id) {
PerformanceIndicatorProjectTemplate template = indicatorTemplateService.getById(id);
if(Objects.isNull(template)){
return null;
}
PerformanceIndicatorProjectTemplateVO vo = BeanUtil.copyProperties(template,
PerformanceIndicatorProjectTemplateVO.class);
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id));
if(CollUtil.isNotEmpty(templateDetails)){
vo.setTemplateDetails(buildTemplateDetail(templateDetails));
}
return vo;
}

/**
* 项目指标 模板保存
* @param dto
* @return
@@ -67,7 +97,6 @@ public class IndicatorTemplateManage {
public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class);

if(Objects.nonNull(dto.getId())){
PerformanceIndicatorProjectTemplate old = indicatorTemplateService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!");
@@ -77,14 +106,100 @@ public class IndicatorTemplateManage {
template.setCreateOn(LocalDateTime.now());
template.setCreateBy(user.getUsername());
}

template.setUpdateOn(LocalDateTime.now());
template.setUpdateBy(user.getUsername());
if(indicatorTemplateService.saveOrUpdate(template)){
//保存 模板的详情
return "保存成功";
if(CollUtil.isNotEmpty(dto.getTemplateDetails())){
//先删除
indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class)
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()));
analysisTemplateDetails(dto.getTemplateDetails(),template.getId());
}
return "保存成功";
}

throw new BizException("保存失败!");
}

/**
* 解析 项目考核指标
* @param templateDetails
* @return
*/
private void analysisTemplateDetails(
List<ProjectTemplateDetailDTO> templateDetails,Long templateId) {
List<PerformanceIndicatorProjectTemplateDetail> details = Lists.newArrayList();
if(CollUtil.isEmpty(templateDetails)){
return;
}

analysisTemplateDetailsInner(templateDetails,templateId,null);
}

private void analysisTemplateDetailsInner(List<ProjectTemplateDetailDTO> templateDetails,
Long templateId,Long parentId) {
if(CollUtil.isEmpty(templateDetails)){
return;
}
UserInfoDetails user = LoginUserUtil.loginUserDetail();
for(ProjectTemplateDetailDTO detail : templateDetails){
PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class);
templateDetail.setCreateBy(user.getUsername());
templateDetail.setCreateOn(LocalDateTime.now());
templateDetail.setUpdateBy(user.getUsername());
templateDetail.setUpdateOn(LocalDateTime.now());
templateDetail.setTemplateId(templateId);
templateDetail.setParentId(parentId);
indicatorProjectTemplateDetailService.save(templateDetail);

if(CollUtil.isNotEmpty(detail.getChildren())){
analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId());
}
}
}

/**
* 装配 模板详情
* @param templateDetails
* @return
*/
private List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails) {
List<ProjectTemplateDetailVO> res = Lists.newArrayList();
//第一层是 一级的
for(PerformanceIndicatorProjectTemplateDetail templateDetail : templateDetails){
if(PerformanceTemplateTypeEnum.STAGE.getCode().equals(templateDetail.getType())){
ProjectTemplateDetailVO detailVo = BeanUtil.copyProperties(templateDetail, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList();
for(PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) {
if (Objects.nonNull(templateDetailSecond.getParentId()) &&
templateDetailSecond.getParentId().equals(templateDetail.getId())) {
ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList();
for(PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) {
if (Objects.nonNull(templateDetailThird.getParentId()) &&
templateDetailThird.getParentId().equals(templateDetailSecond.getId())) {
ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> fourList = Lists.newArrayList();
for(PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) {
if (Objects.nonNull(templateDetailFour.getParentId()) &&
templateDetailFour.getParentId().equals(templateDetailThird.getId())) {
ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class);
fourList.add(detailFourVo);
}
}
detailThirdVo.setChildren(fourList);
thirdList.add(detailThirdVo);
}
}
detailSecondVo.setChildren(thirdList);
secondList.add(detailSecondVo);
}
}
detailVo.setChildren(secondList);
res.add(detailVo);
}
}

return res;
}
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.performance.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;

/**
* <p>
* Mapper 接口
* </p>
*
* @author Zpf
* @since 2023-06-03
*/
public interface PerformanceIndicatorProjectTemplateDetailMapper extends BaseMapper<PerformanceIndicatorProjectTemplateDetail> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceIndicatorProjectTemplateDetailMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.performance.mapper.PerformanceIndicatorProjectTemplateDetailMapper">

</mapper>

+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java View File

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
* @Classname PerformanceIndicatorProjectTemplateSaveDTO
@@ -30,9 +31,12 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable
@ApiModelProperty("项目年度")
private Integer projectYear;

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

@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange;

@ApiModelProperty("绩效指标详情")
private ProjectTemplateDetailDTO templateDetail;
private List<ProjectTemplateDetailDTO> templateDetails;
}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectTemplateDetailDTO.java View File

@@ -9,6 +9,7 @@ import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* @Classname PerformanceIndicatorProjectTemplateDetail
@@ -41,5 +42,5 @@ public class ProjectTemplateDetailDTO implements Serializable {
private String scoreRubric;

@ApiModelProperty("子指标")
private ProjectTemplateDetailDTO children;
private List<ProjectTemplateDetailDTO> children;
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java View File

@@ -41,6 +41,9 @@ public class PerformanceIndicatorProjectTemplate implements Serializable {
@ApiModelProperty("项目年度")
private Integer projectYear;

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

@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange;
}

+ 8
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceIndicatorProjectTemplateVO.java View File

@@ -6,9 +6,10 @@ import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* @Classname PerformanceIndicatorTemplateVO
* @Classname PerformanceIndicatorProjectTemplateVO
* @Description 绩效评价考核项目指标模板
* @Date 2023/6/19 14:02
* @Author PoffyZhang
@@ -36,6 +37,12 @@ public class PerformanceIndicatorProjectTemplateVO implements Serializable {
@ApiModelProperty("项目年度")
private Integer projectYear;

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

@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange;

@ApiModelProperty("绩效指标详情")
private List<ProjectTemplateDetailVO> templateDetails;
}

+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.pmapi.performance.model.vo;

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

import java.io.Serializable;
import java.util.List;

/**
* @Classname PerformanceIndicatorProjectTemplateDetail
* @Description 绩效评价考核项目指标模板
* @Date 2023/6/19 14:02
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "绩效评价考核项目指标模板详情保存树", description = "绩效评价考核项目指标模板详情保存树")
public class ProjectTemplateDetailVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("关联模板ID")
private Long templateId;

@ApiModelProperty("指标名称")
private String name;

@ApiModelProperty("指标类型 0阶段 1一级指标 2二级指标 3三级指标")
private Integer type;

@ApiModelProperty("父级指标id")
private Long parentId;

@ApiModelProperty("分数 3级指标才有")
private Integer score;

@ApiModelProperty("分数细则 3级指标才有")
private String scoreRubric;

@ApiModelProperty("子指标")
private List<ProjectTemplateDetailVO> children;
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceIndicatorProjectTemplateDetailService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.performance.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;

/**
* <p>
* 服务类
* </p>
*
* @author PoffyZhang
* @since 2023-06-03
*/
public interface IPerformanceIndicatorProjectTemplateDetailService extends IService<PerformanceIndicatorProjectTemplateDetail> {

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceIndicatorProjectTemplateDetailServiceImpl.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.performance.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.performance.mapper.PerformanceIndicatorProjectTemplateDetailMapper;
import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail;
import com.ningdatech.pmapi.performance.service.IPerformanceIndicatorProjectTemplateDetailService;
import org.springframework.stereotype.Service;

/**
* <p>
* 绩效评价详情 服务实现类
* </p>
*
* @author ZPF
* @since 2023-06-15
*/
@Service
public class PerformanceIndicatorProjectTemplateDetailServiceImpl extends ServiceImpl<PerformanceIndicatorProjectTemplateDetailMapper, PerformanceIndicatorProjectTemplateDetail>
implements IPerformanceIndicatorProjectTemplateDetailService {

}

+ 23
- 9
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java View File

@@ -12,6 +12,7 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
@@ -191,15 +192,28 @@ public class PurchaseManage {
purchaseEntity.setId(purchase.getId());
}
purchaseEntity.setProjectId(projectId);
purchaseService.saveOrUpdate(purchaseEntity);

//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setTransactionAmount(dto.getTransactionAmount());
project.setTransactionTime(dto.getTransactionTime());
projectService.updateById(project);
if(purchaseService.saveOrUpdate(purchaseEntity)){
//如果 需要推送项目和应用管理的话 只有遂昌县才有
// String areaCode = project.getAreaCode();
// String appCode = dto.getAppCode();
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){
// try{
//
// }catch (Exception e){
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage());
// }
// }

//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setTransactionAmount(dto.getTransactionAmount());
project.setTransactionTime(dto.getTransactionTime());
projectService.updateById(project);

return "填写成功";
}

return "填写成功";
return "保存失败";
}
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java View File

@@ -56,4 +56,6 @@ public class PurchaseSaveDTO {
@ApiModelProperty("中标通知书")
private String acceptanceLetter;

@ApiModelProperty("应用编码")
private String appCode;
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java View File

@@ -24,10 +24,10 @@ public class ProjectApplicationController {

private final ApplicationManage applicationManage;

@GetMapping("/get-report")
@GetMapping("/get-report/{appCode}")
@ApiOperation("获取应用 试运行报告")
@WebLog("获取应用 试运行报告")
public String getReport(@RequestParam(required = false) String appCode) {
public String getReport(@PathVariable String appCode) {
return applicationManage.getReport(appCode);
}



+ 28
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java View File

@@ -1,7 +1,12 @@
package com.ningdatech.pmapi.projectlib.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.common.util.HmacAuthUtil;
import com.ningdatech.pmapi.projectlib.model.dto.ApplicationAppCodeSaveDTO;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
@@ -9,11 +14,9 @@ import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
@@ -85,11 +88,29 @@ public class ApplicationManage {
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);

RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class);
ResponseEntity<ApiResponse> forEntity = restTemplate.exchange(appUrl, HttpMethod.GET,formEntity, ApiResponse.class);

log.info("body:",forEntity.getBody());
String body = forEntity.getBody();
ApiResponse body = forEntity.getBody();

return null;
if(!body.getCode().equals(HttpStatus.OK.value())){
throw new BizException(body.getMessage());
}

Object data = body.getData();
if(Objects.nonNull(data)){
JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data));
JSONArray resourceList = dataJson.getJSONArray("resourceList");
if(CollUtil.isNotEmpty(resourceList)){
JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0)));
if(StringUtils.isBlank(resource.getString("reportOss"))){
//暂时没有 appCode 所以先返回测试数据
return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D";
}else{
return resource.getString("reportOss");
}
}
}
throw new BizException("获取报告失败!");
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -731,7 +731,7 @@ public class ProjectLibManage {

if(StringUtils.isNotBlank(req.getApplicationName())){
wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName,req.getApplicationName())
.or(q2 -> q2.like(ProjectApplication::getAccountAppName,req.getApplicationName())));
.or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication,req.getApplicationName())));
}
wrapper.orderByDesc(ProjectApplication::getUpdateOn);
projectApplicationService.page(page,wrapper);


Loading…
Cancel
Save