Kaynağa Gözat

退回和应用匹配版本号

master
PoffyZhang 1 yıl önce
ebeveyn
işleme
dae723aa2c
8 değiştirilmiş dosya ile 89 ekleme ve 57 silme
  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. +12
    -12
      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. +31
    -26
      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 Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

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

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

private Long createBy;
private Long updateBy;
}

+ 12
- 12
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Dosyayı Görüntüle

@@ -358,14 +358,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 +374,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);
@@ -490,7 +486,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 +500,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 +544,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 +557,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 +683,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 +773,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 Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

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

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

private Long createBy;

private Long updateBy;


+ 31
- 26
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Dosyayı Görüntüle

@@ -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,14 +1071,31 @@ 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);

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;
@@ -1086,26 +1104,12 @@ public class TodoCenterManage {
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 +1123,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 Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

@@ -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


#天印服务器接口信息


Yükleniyor…
İptal
Kaydet