@@ -3,6 +3,7 @@ package com.hz.pm.api.projectlib.handle; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import lombok.Data; | |||
@@ -28,6 +29,8 @@ public final class HandleParamContext { | |||
private List<PurchaseInst> purchaseInstList; | |||
private List<ProjectStatusChange> projectStatusChanges; | |||
private StepStatusEnum preStepStatus; | |||
} |
@@ -209,6 +209,7 @@ public class DeclaredRecordManage { | |||
.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(), | |||
ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode(), | |||
ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode()) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.select(Project::getId, Project::getProjectCode, Project::getStage, Project::getStatus, Project::getCreateOn); | |||
if (!buildProjectLibPermission(pQuery, user)) { | |||
return PageVo.empty(); | |||
@@ -218,7 +219,7 @@ public class DeclaredRecordManage { | |||
} | |||
List<Project> projects = projectService.list(pQuery); | |||
Map<String, Project> projectMap = BizUtils.groupFirstMap(projects, Project::getProjectCode, | |||
Comparator.comparing(Project::getCreateOn).reversed()); | |||
Comparator.comparing(Project::getCreateOn).thenComparing(Project::getNewest).reversed()); | |||
query.and(q1 -> q1.isNull(MhProject::getProjectCode) | |||
.or(!projects.isEmpty(), q2 -> q2.in(MhProject::getProjectCode, projectMap.keySet()))); | |||
Page<MhProject> page = mhProjectService.page(req.page(), query); | |||
@@ -1,7 +1,5 @@ | |||
package com.hz.pm.api.scheduler.task; | |||
import lombok.AllArgsConstructor; | |||
import lombok.NoArgsConstructor; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.core.env.Environment; | |||
@@ -14,7 +12,7 @@ import org.springframework.core.env.Environment; | |||
* @since 13:20 2024/3/14 | |||
*/ | |||
@RequiredArgsConstructor | |||
public abstract class ReminderTask { | |||
public abstract class AbstractReminderTask { | |||
public static final String PREFIX = "reminder-task"; | |||
public static final String CRON = "cron"; |
@@ -1,117 +0,0 @@ | |||
package com.hz.pm.api.scheduler.task; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.http.HttpStatus; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.ProjectDeclareConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.provincial.model.res.ProcessCommentRes; | |||
import com.hz.pm.api.provincial.model.res.ProvincialProjectRes; | |||
import com.hz.pm.api.provincial.model.res.SjApiResponse; | |||
import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; | |||
import com.hz.pm.api.scheduler.contants.TaskContant; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import java.net.InetAddress; | |||
import java.net.UnknownHostException; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
/** | |||
* @Classname CheckProvincialReviewResultTask | |||
* @Description 去获取省级联审结果任务 | |||
* @Date 2023/3/16 10:12 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
@Component | |||
@RequiredArgsConstructor | |||
public class CheckProvincialReviewResultTask { | |||
private final IJoinReviewProvincialBureauService reviewProvincialBureauService; | |||
private final IProjectService projectService; | |||
private final ProjectStateMachineUtil projectStateMachineUtil; | |||
@Value("${hostname:}") | |||
private String HOST_NAME; | |||
@Value("${spring.profiles.active}") | |||
private String active; | |||
@Scheduled(cron = "0 */1 * * * ?") | |||
public void statusFlow() throws UnknownHostException { | |||
if(BizConst.DEV.equals(active)){ | |||
log.info("测试环境 省局 接口 暂时关闭"); | |||
return; | |||
} | |||
// | |||
if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { | |||
//1. 定时取 省级部门联审中的项目 去取项目 | |||
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getStage, ProjectStatus.NOT_APPROVED.getCode()) | |||
.eq(Project::getStatus, ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) | |||
.ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) | |||
.eq(Project::getAreaCode, RegionConst.RC_HZ) | |||
.eq(Project::getNewest,Boolean.TRUE) | |||
.orderByAsc(Project::getCreateOn)); | |||
log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); | |||
if(CollUtil.isEmpty(projectList)){ | |||
log.info("没有正在省级联审中的项目!"); | |||
return; | |||
} | |||
//遍历 | |||
for(Project project: projectList){ | |||
try{ | |||
SjApiResponse apiResponse = reviewProvincialBureauService.processInfo(project.getProjectCode()); | |||
log.info("项目 【{}】 去获取省局联审结果 :{}",project.getId(),apiResponse); | |||
if(Objects.isNull(apiResponse) || !Integer.valueOf(HttpStatus.HTTP_OK).equals(apiResponse.getCode())){ | |||
log.info("项目 【{}】 去获取省局联审结果失败",project.getId()); | |||
continue; | |||
} | |||
ProvincialProjectRes projectRes = JSON.parseObject(JSON.toJSONString(apiResponse.getData()), | |||
ProvincialProjectRes.class); | |||
if(CollUtil.isNotEmpty(projectRes.getProcessComment())){ | |||
List<ProcessCommentRes> processComments = projectRes.getProcessComment(); | |||
log.info("此项目 【{}】 返回了审批信息",projectRes.getProjectId()); | |||
//取到最后一个审批元素 | |||
ProcessCommentRes lastProcessComment = processComments.get(processComments.size() - 1); | |||
//最后一个 节点 nodeId 是结束 说明已经批完 | |||
if(StringUtils.isNotBlank(lastProcessComment.getStepName()) && | |||
TaskContant.ProvinceReview.END_STEP.equals(lastProcessComment.getStepName())){ | |||
//在省级联审 才调状态机 否则 只改变 联审结果 | |||
if(ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals( | |||
project.getStatus())){ | |||
projectStateMachineUtil.pass(project); | |||
} | |||
log.info("已经审批完成 进入下一状态"); | |||
} | |||
project.setUpdateOn(LocalDateTime.now()); | |||
//保存审核结果 | |||
project.setSjlsResult(CollUtil.isNotEmpty(projectRes.getProcessComment()) | |||
? JSON.toJSONString(projectRes.getProcessComment()) : StringUtils.EMPTY); | |||
projectService.updateById(project); | |||
}else{ | |||
log.info("此项目 【{}】 还没有审批信息",projectRes.getProjectId()); | |||
} | |||
}catch (Exception e){ | |||
log.error("项目审核信息获取异常 projectId:【" + project.getId() + "】 异常内容:" + e.getMessage()); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -44,7 +44,7 @@ import static com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum.DECLARED_ | |||
*/ | |||
@Slf4j | |||
@Component | |||
public class DeclaredRecordReminderTask extends ReminderTask { | |||
public class DeclaredRecordAbstractReminderTask extends AbstractReminderTask { | |||
private final IProjectService projectService; | |||
private final IMhTodoRecordService todoRecordService; | |||
@@ -55,14 +55,14 @@ public class DeclaredRecordReminderTask extends ReminderTask { | |||
private final IMhProjectService mhProjectService; | |||
public DeclaredRecordReminderTask(Environment environment, | |||
IProjectService projectService, | |||
IMhTodoRecordService todoRecordService, | |||
MhApiClient mhApiClient, | |||
MHTodoClient mhTodoClient, | |||
MhUnitCache mhUnitCache, | |||
UserInfoHelper userInfoHelper, | |||
IMhProjectService mhProjectService) { | |||
public DeclaredRecordAbstractReminderTask(Environment environment, | |||
IProjectService projectService, | |||
IMhTodoRecordService todoRecordService, | |||
MhApiClient mhApiClient, | |||
MHTodoClient mhTodoClient, | |||
MhUnitCache mhUnitCache, | |||
UserInfoHelper userInfoHelper, | |||
IMhProjectService mhProjectService) { | |||
super(environment); | |||
this.projectService = projectService; | |||
this.todoRecordService = todoRecordService; |
@@ -1,96 +0,0 @@ | |||
package com.hz.pm.api.irs; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.irs.service.IRefreshTokenService; | |||
import com.hz.pm.api.common.util.HttpUtil; | |||
import com.hz.pm.api.common.util.Md5Util; | |||
import com.hz.pm.api.irs.model.dto.ForwardDTO; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.junit.Test; | |||
import org.springframework.http.*; | |||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||
import org.springframework.web.client.RestTemplate; | |||
import javax.annotation.Resource; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
/** | |||
* @Classname CoreTest | |||
* @Description | |||
* @Date 2023/8/31 17:21 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
public class CoreTest {//extends AppTests | |||
// @Value("${irs.core-biz.appKey}") | |||
private String appKey = "A331101453557202109017383"; | |||
// @Value("${irs.core-biz.appSecret}") | |||
private String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||
// @Value("${irs.core-biz.url}") | |||
private String coreBizUrl = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm"; | |||
// @Value("${irs.core-biz.interfaceName}") | |||
private String interfaceName = "Fc3re2cq7r64Qfa7"; | |||
@Resource | |||
private IRefreshTokenService refreshTokenService; | |||
// @Value("${irs.interface-refresh.request-token-url}") | |||
private String govRequestTokenUrl; | |||
// @Value("${irs.interface-refresh.refresh-token-url}") | |||
private String govRefreshTokenUrl; | |||
@Test | |||
public void searchCoreBiz() { | |||
long requestTime = System.currentTimeMillis(); | |||
String businessName = ""; | |||
String orgCode = ""; | |||
Integer limit = 10; | |||
Integer page = 1; | |||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, | |||
HttpMethod.POST.name()); | |||
// String secret = "15345863c0fb4a85a28b2b467e5e6253"; | |||
// String secret = appSecret; | |||
// String secret = RefreshKeyUtil.getRequestSecret(appKey, appSecret,requestTime); | |||
// String secret = RefreshKeyUtil.refreshSecret(appKey, "78cde959148b4335b8eba556f9c8c7bf",requestTime); | |||
System.out.println("secret:" + secret); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
restTemplate = new RestTemplate(); | |||
} | |||
ForwardDTO dto = new ForwardDTO(); | |||
Map<String,Object> map = Maps.newHashMap(); | |||
map.put("dingCode",orgCode); | |||
map.put("matterName",(StringUtils.isNotBlank(businessName)?businessName:StringUtils.EMPTY)); | |||
map.put("useState",1); | |||
map.put("limit",limit); | |||
map.put("page",page); | |||
map.put("appKey",appKey); | |||
dto.setData(map); | |||
dto.setUrl(coreBizUrl); | |||
dto.setSecret(secret); | |||
dto.setAppKey(appKey); | |||
dto.setSecret(secret); | |||
dto.setRequestTime(requestTime); | |||
String sign = Md5Util.hash(appKey + secret + requestTime); | |||
dto.setSign(sign); | |||
HttpHeaders headers = new HttpHeaders(); | |||
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); | |||
headers.setContentType(type); | |||
headers.add("Accept", MediaType.APPLICATION_JSON.toString()); | |||
HttpEntity<ForwardDTO> formEntity = new HttpEntity<ForwardDTO>(dto, headers); | |||
String url = "http://10.53.168.41:38088/open/api/v1/project-receive/forward"; | |||
ResponseEntity<String> forEntity = restTemplate.postForEntity(url,formEntity, String.class); | |||
String body = forEntity.getBody(); | |||
System.out.println(body); | |||
} | |||
} |
@@ -1,80 +0,0 @@ | |||
package com.hz.pm.api.irs; | |||
import com.alibaba.fastjson.JSON; | |||
import com.hz.pm.api.common.util.CryptUtils; | |||
import com.hz.pm.api.common.util.HttpUtil; | |||
import liquibase.util.MD5Util; | |||
import org.junit.Test; | |||
import org.springframework.http.ResponseEntity; | |||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||
import org.springframework.web.client.RestTemplate; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLEncoder; | |||
import java.security.NoSuchAlgorithmException; | |||
import java.util.Objects; | |||
/** | |||
* @Classname IrsTest2 | |||
* @Description | |||
* @Date 2023/7/20 10:48 | |||
* @Author PoffyZhang | |||
*/ | |||
public class IrsTest2 { | |||
@Test | |||
public void test() throws UnsupportedEncodingException, NoSuchAlgorithmException { | |||
String appSecret = "e066f496194540afa829c66983d4710e"; | |||
String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; | |||
String dataName = URLEncoder.encode("丽水市大数据","UTF-8"); | |||
long timestamp = System.currentTimeMillis(); | |||
String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp); | |||
String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey + | |||
"&sign=" + sign + "&requestTime=" + timestamp; | |||
RestTemplate restTemplate = new RestTemplate(); | |||
System.out.println("url:" + url); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
System.out.println(JSON.toJSONString(forEntity)); | |||
} | |||
@Test | |||
public void refreshToken() throws NoSuchAlgorithmException { | |||
long timestamp = System.currentTimeMillis(); | |||
String appSecret = "e066f496194540afa829c66983d4710e"; | |||
String appKey = "8fb070a1f1194b2ebffdc6f596bb8a96"; | |||
String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
restTemplate = new RestTemplate(); | |||
} | |||
String url = "https://interface.ls.local/a/api/refreshTokenKey?appKey=" + appKey + | |||
"&requestTime=" + timestamp + "&sign=" + sign; | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
System.out.println(forEntity.getBody()); | |||
} | |||
@Test | |||
public void test3() throws NoSuchAlgorithmException { | |||
String timestamp = "1689841393364"; | |||
String appSecret = "f12a6f2e9fc143fcbe4622295db097fd"; | |||
String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96"; | |||
String sign1 = MD5Util.computeMD5(appkey + appSecret + timestamp); | |||
String sign2 = CryptUtils.MD5Encode(appkey + appSecret + timestamp); | |||
System.out.println(sign1); | |||
System.out.println(sign2); | |||
} | |||
@Test | |||
public void test4(){ | |||
long timestamp = 1690354109541L; | |||
long now = System.currentTimeMillis(); | |||
System.out.println( (timestamp - now)/1000 + "s"); | |||
} | |||
} |
@@ -1,90 +0,0 @@ | |||
package com.hz.pm.api.irs; | |||
import com.ningdatech.irs.service.IRefreshTokenService; | |||
import com.hz.pm.api.AppTests; | |||
import com.hz.pm.api.common.util.CryptUtils; | |||
import com.hz.pm.api.common.util.HttpUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.junit.Test; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.http.ResponseEntity; | |||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||
import org.springframework.web.client.RestTemplate; | |||
import javax.annotation.Resource; | |||
import java.security.NoSuchAlgorithmException; | |||
import java.util.Objects; | |||
/** | |||
* @Classname irsTest3 | |||
* @Description | |||
* @Date 2023/7/25 9:52 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
public class irsTest3 extends AppTests { | |||
@Resource | |||
private IRefreshTokenService refreshTokenService; | |||
@Value("${irs.interface-local-refresh.request-token-url}") | |||
private String requestTokenUrl; | |||
@Value("${irs.interface-local-refresh.refresh-token-url}") | |||
private String refreshTokenUrl; | |||
@Value("${irs.interface-refresh.request-token-url}") | |||
private String govRequestTokenUrl; | |||
@Value("${irs.interface-refresh.refresh-token-url}") | |||
private String govRefreshTokenUrl; | |||
@Test | |||
public void test1() throws NoSuchAlgorithmException { | |||
long timestamp = System.currentTimeMillis(); | |||
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||
String appKey = "A331101453557202109017383"; | |||
String dataName = "大数据管理局"; | |||
String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
restTemplate = new RestTemplate(); | |||
} | |||
String url = "https://interface.ls.local/a/api/shared/1689239219101?" + | |||
"data_name=" + dataName + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
System.out.println(forEntity.getBody()); | |||
} | |||
@Test | |||
public void test2() throws NoSuchAlgorithmException { | |||
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); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
restTemplate = new RestTemplate(); | |||
} | |||
String appId = "A331123467587202307014177"; | |||
String updateTime = "2023-07-26 00:00:00"; | |||
String capCode = timestamp + updateTime + appId; | |||
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + | |||
"dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + | |||
"&sign=" + sign + "&appKey=" + appKey + | |||
"&capCode=abc&appId=abc&capTime=" + timestamp + | |||
"&appId=" + appId + "&updateTime=" + updateTime; | |||
log.info("url :{}",url); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
log.info(forEntity.getBody()); | |||
} | |||
} |
@@ -1,59 +0,0 @@ | |||
package com.hz.pm.api.irs; | |||
import com.ningdatech.irs.service.IRefreshTokenService; | |||
import com.hz.pm.api.AppTests; | |||
import com.hz.pm.api.common.util.CryptUtils; | |||
import com.hz.pm.api.common.util.HttpUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.junit.Test; | |||
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.client.RestTemplate; | |||
import javax.annotation.Resource; | |||
import java.security.NoSuchAlgorithmException; | |||
import java.util.Objects; | |||
/** | |||
* @Classname irsTest3 | |||
* @Description | |||
* @Date 2023/7/25 9:52 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
public class irsTest4 extends AppTests { | |||
@Resource | |||
private IRefreshTokenService refreshTokenService; | |||
@Value("${irs.interface-refresh.request-token-url}") | |||
private String govRequestTokenUrl; | |||
@Value("${irs.interface-refresh.refresh-token-url}") | |||
private String govRefreshTokenUrl; | |||
@Test | |||
public void test1() throws NoSuchAlgorithmException { | |||
long timestamp = System.currentTimeMillis(); | |||
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||
String appKey = "A331101453557202109017383"; | |||
String dataName = "大数据管理局"; | |||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name()); | |||
String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
restTemplate = new RestTemplate(); | |||
} | |||
String url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" + | |||
"dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" + | |||
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
System.out.println(forEntity.getBody()); | |||
} | |||
} |
@@ -1,123 +0,0 @@ | |||
package com.hz.pm.api.provincial; | |||
import cn.hutool.crypto.SecureUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.AppTests; | |||
import com.hz.pm.api.common.model.constant.ProjectDeclareConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; | |||
import com.hz.pm.api.projectdeclared.manage.PrequalificationDeclaredProjectManage; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; | |||
import com.hz.pm.api.staging.contants.StagingContant; | |||
import com.hz.pm.api.staging.model.entity.ProjectStaging; | |||
import com.hz.pm.api.staging.service.IProjectStagingService; | |||
import com.ningdatech.file.service.FileService; | |||
import com.wflow.exception.BusinessException; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import java.io.UnsupportedEncodingException; | |||
import java.security.InvalidKeyException; | |||
import java.security.NoSuchAlgorithmException; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @Classname Test | |||
* @Description | |||
* @Date 2023/3/2 16:14 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
public class Test extends AppTests {// | |||
@Autowired | |||
private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | |||
@Autowired | |||
private IProjectService projectService; | |||
@Autowired | |||
private IProjectApplicationService applicationService; | |||
@Autowired | |||
private FileService fileService; | |||
@Autowired | |||
private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | |||
@Autowired | |||
private IProjectStagingService projectStagingService; | |||
@org.junit.Test | |||
public void test() throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { | |||
// Long timeStamp = System.currentTimeMillis()/1000; | |||
Long timeStamp = 1677750055L; | |||
String key = "7196317343a64e67895dc0375c098fe7"; | |||
String url = "/api/v1/foreign/importantProView"; | |||
String methed = "POST"; | |||
String bytesToSign = methed + "\n" + url + "\n" + timeStamp + "\n" + key; | |||
log.info("" + bytesToSign); | |||
String secret = "75152a97f20e4c4c854dc6301cf72ad4"; | |||
String str = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign, false); | |||
log.info("" + str); | |||
} | |||
@org.junit.Test | |||
public void Test3333() { | |||
String url = "http://devplat.oss-cn-hangzhou.aliyuncs.com/2023/04/13/5b2e1ef734e14437ba350ef97202c5b7.pdf?Expires=1681367401&OSSAccessKeyId=LTAI4GL7uypycnBjiRn55rMG&Signature=5PbIhpHNZvA2o8xYy8Ujw9Ibhl8%3D"; | |||
String s = "Expires"; | |||
System.out.println(url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY)); | |||
} | |||
@Value("${spring.profiles.active}") | |||
private String active; | |||
@org.junit.Test | |||
public void Test4444() { | |||
// 对接省级联审的接口 | |||
Project p = projectService.getById(448); | |||
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectId, p.getId())); | |||
if (!joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(p, applications, fileService, active))) { | |||
throw new BusinessException("提交省级部门联审失败"); | |||
} | |||
System.out.println("成功"); | |||
} | |||
@org.junit.Test | |||
public void test5() { | |||
//1. 定时取 项目暂存表的数据 去进行状态继续流转 | |||
List<ProjectStaging> stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) | |||
.eq(ProjectStaging::getDead, Boolean.FALSE) | |||
.le(ProjectStaging::getNextTime, LocalDateTime.now()) | |||
.le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) | |||
.orderByAsc(ProjectStaging::getProjectId)); | |||
log.info("需要状态流转的项目 size:{} :{}", stagingList.size(), JSON.toJSONString(stagingList)); | |||
} | |||
@org.junit.Test | |||
public void test6() { | |||
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getStage, ProjectStatus.NOT_APPROVED.getCode()) | |||
.eq(Project::getStatus, ProjectStatus.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) | |||
.ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) | |||
.eq(Project::getAreaCode, RegionConst.RC_HZ) | |||
.orderByAsc(Project::getCreateOn)); | |||
log.info("需要去查询省级联审结果的项目 size:{}", projectList.size()); | |||
} | |||
} |