Переглянути джерело

Merge remote-tracking branch 'origin/master'

master
WendyYang 1 рік тому
джерело
коміт
b1d3b55e36
8 змінених файлів з 112 додано та 64 видалено
  1. +25
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java
  3. +19
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  4. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java
  6. +47
    -27
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  7. +6
    -6
      pmapi/src/main/resources/application-pre.yml
  8. +6
    -6
      pmapi/src/main/resources/application-prod.yml

+ 25
- 7
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Переглянути файл

@@ -1,6 +1,9 @@
package com.ningdatech.pmapi.ding.controller;

import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.ningdatech.irs.service.IRefreshTokenService;
import com.ningdatech.pmapi.common.config.ProvincialProperties;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
@@ -12,7 +15,9 @@ import com.ningdatech.zwdd.client.provider.ZwddAuthClientProvider;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.bind.annotation.*;
@@ -52,6 +57,9 @@ public class DingInfoPullController {

private final ZwddIntegrationProperties zwddIntegrationProperties;

@Autowired
private ProvincialProperties provincialProperties;

@GetMapping("/employee")
public void employeeBatchGet() {
employeeBatchGetTask.batchGetEmployeeTask();
@@ -112,12 +120,12 @@ public class DingInfoPullController {
@ApiOperation(value = "省级主管接口测试", notes = "省级主管接口测试")
@GetMapping("/test-org")
public String testOrg() throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
Long timeStamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String method = "POST";
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method);
String sign = CryptUtils.MD5Encode(appKey + secret + timestamp);
String sign = CryptUtils.MD5Encode(appKey + secret + timeStamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
@@ -128,10 +136,10 @@ public class DingInfoPullController {

String url = "https://interface.zjzwfw.gov.cn/gateway" +
"/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm?" +
"requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&timestamp=" + timestamp +
"&authSignature=" + zwddIntegrationProperties.getAppSecret() +
"&authKey=" + zwddIntegrationProperties.getAppKey();
"requestTime=" + timeStamp + "&sign=" + sign +
"&appKey=" + appKey + "&timestamp=" + timeStamp +
"&authSignature=" + getSha256(timeStamp/1000,provincialProperties.getPushUrl(), HttpMethod.GET.name()) +
"&authKey=" + provincialProperties.getKey();
log.info("url :{}",url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
@@ -158,7 +166,7 @@ public class DingInfoPullController {
}
String appId = "A330000100000202105005790";
String updateTime = "2023-07-26 00:00:00";
String capCode = timestamp + updateTime + appId;
String capCode = CryptUtils.MD5Encode(timestamp + updateTime + appId);
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" +
"dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + appKey +
@@ -169,4 +177,14 @@ public class DingInfoPullController {
log.info(forEntity.getBody());
return forEntity.getBody();
}

private String getSha256(Long timeStamp,String url,String method){
String secret = provincialProperties.getSecret();
String key = provincialProperties.getKey();
String bytesToSign = method + StrUtil.LF + url + StrUtil.LF + timeStamp + StrUtil.LF + key;
log.info("加密message :{}",bytesToSign);
String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false);
log.info("加密结果 :{}",res);
return res;
}
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java Переглянути файл

@@ -302,6 +302,9 @@ public class ProjectDraft implements Serializable {
@ApiModelProperty("项目申报书")
private String projectApplicationForm;

@ApiModelProperty("项目编码")
private String projectCode;

private Long createBy;
private Long updateBy;
}

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

@@ -275,10 +275,10 @@ public class ProjectLibManage {
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1;
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,project.getId()));
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode()));
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,version));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
@@ -289,6 +289,7 @@ public class ProjectLibManage {
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setProjectVersion(version);
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveOrUpdateBatch(applications);
@@ -358,14 +359,9 @@ public class ProjectLibManage {
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication())
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
List<String> projectCodeList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, project.getProjectCode())
.eq(Project::getIsConstruct, Boolean.TRUE)).stream()
.map(Project::getProjectCode).collect(Collectors.toList());
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList)
.eq(ProjectApplication::getProjectVersion,project.getVersion())
.eq(ProjectApplication::getIsConstruct,Boolean.TRUE));

if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
@@ -379,6 +375,7 @@ public class ProjectLibManage {
projectApplication.setBuildOrgCode(finalProject.getBuildOrgCode());
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setIsConstruct(Boolean.TRUE);
projectApplication.setProjectVersion(finalProject.getVersion());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(applications);
@@ -406,9 +403,8 @@ public class ProjectLibManage {
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,project.getId()));
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode()));
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,project.getVersion()));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
@@ -417,6 +413,7 @@ public class ProjectLibManage {
projectApplication.setId(null);
projectApplication.setProjectId(finalProject.getId());
projectApplication.setProjectCode(finalProject.getProjectCode());
projectApplication.setProjectVersion(finalProject.getVersion());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveOrUpdateBatch(applications);
@@ -490,7 +487,8 @@ public class ProjectLibManage {
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList)
.eq(ProjectApplication::getIsConstruct,isConstruct));
.eq(ProjectApplication::getIsConstruct,isConstruct)
.eq(ProjectApplication::getProjectVersion,project.getVersion()));

//app
List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();
@@ -503,6 +501,7 @@ public class ProjectLibManage {
app.setBuildOrgName(project.getBuildOrgName());
app.setBuildOrgCode(project.getBuildOrgCode());
app.setIsConstruct(isConstruct);
app.setProjectVersion(project.getVersion());
return app;
})
.collect(Collectors.toList());
@@ -546,9 +545,8 @@ public class ProjectLibManage {
//app
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,project.getId()));
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode()));
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,project.getVersion()));

List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();
if(CollUtil.isNotEmpty(applicationList)){
@@ -560,6 +558,7 @@ public class ProjectLibManage {
app.setProjectCode(project.getProjectCode());
app.setBuildOrgName(project.getBuildOrgName());
app.setBuildOrgCode(project.getBuildOrgCode());
app.setProjectVersion(project.getVersion());
return app;
})
.collect(Collectors.toList());
@@ -685,7 +684,8 @@ public class ProjectLibManage {
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct()));
.eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion,projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
@@ -774,7 +774,8 @@ public class ProjectLibManage {
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct()));
.eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion,projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,


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

@@ -182,6 +182,9 @@ public class ProjectApplication implements Serializable {
@ApiModelProperty("项目编码")
private String projectCode;

@ApiModelProperty("项目版本")
private Integer projectVersion;

@ApiModelProperty("是否为建设方案申报")
private Boolean isConstruct;
}

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

@@ -174,6 +174,9 @@ public class ProjectApplicationVO implements Serializable {
@ApiModelProperty("项目编码")
private String projectCode;

@ApiModelProperty("项目版本")
private Integer projectVersion;

private Long createBy;

private Long updateBy;


+ 47
- 27
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Переглянути файл

@@ -11,6 +11,7 @@ import java.util.stream.Stream;

import javax.servlet.http.HttpServletResponse;

import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ningdatech.basic.exception.BizException;
@@ -1052,7 +1053,7 @@ public class TodoCenterManage {
defaultDeclaredProjectManage.checkAmount(projectDto);

//修改项目内容
if(!modifyProject(projectDto)){
if(!modifyProject(projectDto,projectInfo)){
throw new BusinessException("调整项目失败!");
}

@@ -1070,42 +1071,60 @@ public class TodoCenterManage {
return dto.getInstanceId();
}

private Boolean modifyProject(ProjectDTO projectDto) {
/**
* 要改成 生成新版本号
* @param projectDto
* @return
*/
private Boolean modifyProject(ProjectDTO projectDto,Project oldProject) {
//先修改项目信息
Project project = new Project();
BeanUtils.copyProperties(projectDto,project);
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
BeanUtil.copyProperties(projectDto,project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
if(!projectService.updateById(project)){
throw new BusinessException("项目调整失败");
}
projectService.save(project);

ProjectInst oldInst = projectInstService.getOne(Wrappers.lambdaUpdate(ProjectInst.class)
.eq(ProjectInst::getProjectId, oldProject.getId())
.eq(ProjectInst::getInstCode, oldProject.getInstCode()));

String instCode = oldProject.getInstCode();
oldInst.setInstCode("EMPTY");
projectInstService.updateById(oldInst);

ProjectInst newPi = new ProjectInst();
newPi.setProjectId(project.getId());
newPi.setInstType(oldInst.getInstType());
newPi.setInstCode(instCode);
newPi.setCreatOn(LocalDateTime.now());
newPi.setUpdateOn(LocalDateTime.now());
projectInstService.save(newPi);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));

//再修改应用信息
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication()
? Boolean.TRUE : Boolean.FALSE;
Long projectDtoId = projectDto.getId();
Project projectInfo = projectService.getById(projectDtoId);
String instCode = projectInfo.getInstCode();
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode));
Integer instType = projectInst.getInstType();
if (InstTypeEnum.UNIT_INNER_AUDIT.getCode().equals(instType) ||
InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType) ||
InstTypeEnum.DEPT_UNITED_REVIEW.getCode().equals(instType)) {
//批量删除
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId, project.getId()));
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode()));
}else {
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
List<String> projectCodeList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, project.getProjectCode())
.eq(Project::getIsConstruct, Boolean.TRUE)).stream()
.map(Project::getProjectCode).collect(Collectors.toList());
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList)
.eq(ProjectApplication::getIsConstruct,Boolean.TRUE));
}

//批量删除
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,project.getVersion()));

if(isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())){
//批量添加
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
@@ -1119,6 +1138,7 @@ public class TodoCenterManage {
!InstTypeEnum.DEPT_UNITED_REVIEW.getCode().equals(instType)) {
projectApplication.setIsConstruct(Boolean.TRUE);
}
projectApplication.setProjectVersion(project.getVersion());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(applications);


+ 6
- 6
pmapi/src/main/resources/application-pre.yml Переглянути файл

@@ -193,16 +193,16 @@ yxt:

#省局联审 请求信息
provincial:
# host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign
host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
key: b5b2096953534a53991be4ea95f8cffa
secret: 1bec9b77134d4962ac466fbe9696b897
# host: http://223.4.72.75/prometheus-zhejiang_foreign
# pushUrl: /api/v1/foreign/importantPro
# detailUrl: /api/v1/foreign/importantProView
# key: b5b2096953534a53991be4ea95f8cffa
# secret: 1bec9b77134d4962ac466fbe9696b897
host: http://223.4.72.75/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
key: 7fb48b518c6044a5a44deddd11b445e3
secret: ced8fff70018413c9516c58f95885624


#天印服务器接口信息


+ 6
- 6
pmapi/src/main/resources/application-prod.yml Переглянути файл

@@ -193,16 +193,16 @@ yxt:

#省局联审 请求信息
provincial:
# host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign
host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
key: b5b2096953534a53991be4ea95f8cffa
secret: 1bec9b77134d4962ac466fbe9696b897
# host: http://223.4.72.75/prometheus-zhejiang_foreign
# pushUrl: /api/v1/foreign/importantPro
# detailUrl: /api/v1/foreign/importantProView
# key: b5b2096953534a53991be4ea95f8cffa
# secret: 1bec9b77134d4962ac466fbe9696b897
host: http://223.4.72.75/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
key: 7fb48b518c6044a5a44deddd11b445e3
secret: ced8fff70018413c9516c58f95885624


#天印服务器接口信息


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