diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index a34549d..9b0c04e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -1,5 +1,8 @@ package com.ningdatech.pmapi.ding.controller; +import com.alibaba.fastjson.JSON; +import com.ningdatech.pmapi.common.util.CryptUtils; +import com.ningdatech.pmapi.common.util.RefreshKeyUtil; import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask; import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; @@ -7,7 +10,11 @@ import com.ningdatech.pmapi.organization.manage.ProcDefManage; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import org.springframework.web.client.RestTemplate; + +import java.security.NoSuchAlgorithmException; /** *

@@ -80,4 +87,27 @@ public class DingInfoPullController { public String init() { return procDefManage.init(); } + + @ApiOperation(value = "系统流程配置初始化", notes = "系统流程配置初始化") + @GetMapping("/search") + public String testApp() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String areaCode = "331123"; + String appScret = "496f0f2a19994f76b4fd9dae087366c7"; + String appKey = "A331101453557202109017383"; + String appCode = "A331123467587202307014170"; + + String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret); + String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm?" + + "requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&name=&" + + "pageSize=10&deptCode=&areaCode=" + areaCode + "&pageNum=1&appCode=" + appCode; + log.info(url); + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + + log.info(JSON.toJSONString(forEntity)); + + return JSON.toJSONString(forEntity); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java index 6981dd5..cc79497 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java @@ -5,13 +5,11 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; import com.ningdatech.pmapi.common.enumeration.CommonEnum; +import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.CryptUtils; import com.ningdatech.pmapi.common.util.RefreshKeyUtil; -import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; -import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; -import com.ningdatech.pmapi.irs.model.dto.ApiSearchResult; -import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; +import com.ningdatech.pmapi.irs.model.dto.*; import com.ningdatech.pmapi.irs.model.res.ApiResponse; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; @@ -154,38 +152,43 @@ public class AppIrsManage { public ApiApplySearchResult searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException { long timestamp = System.currentTimeMillis(); String appCode = apply.getAppId(); - + String areaCode = RegionContant.LS_SC_CODE; String requestSecret = RefreshKeyUtil.getRequestSecret(searchAppKey, searchAppScret); String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + searchAppKey + "&" + - "pageSize=10&pageNum=1&appCode=" + appCode; + "pageSize=10&pageNum=1&appCode=" + appCode + + "&areaCode=" + areaCode + "&deptCode=&name="; + log.info("url : {}",url); RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, ApiSearchResult.class); + ResponseEntity forEntity = restTemplate.getForEntity(url, ApiDTO.class); log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); - if(Objects.nonNull(forEntity.getBody()) && CollUtil.isNotEmpty(forEntity.getBody().getApiApplySearchResult())){ - return forEntity.getBody().getApiApplySearchResult().get(0); + if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getDatas()) + && CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){ + return forEntity.getBody().getDatas().getApiApplySearchResult().get(0); } return null; } public List searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { long timestamp = System.currentTimeMillis(); - + String areaCode = RegionContant.LS_SC_CODE; String requestSecret = RefreshKeyUtil.getRequestSecret(searchAppKey, searchAppScret); String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + searchAppKey + "&" + - "pageSize=100&pageNum=1"; + "pageSize=100&pageNum=1&areaCode=" + areaCode + + "&deptCode=&name="; RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, ApiSearchResult.class); + ResponseEntity forEntity = restTemplate.getForEntity(url, ApiDTO.class); log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); - if(Objects.nonNull(forEntity.getBody()) && CollUtil.isNotEmpty(forEntity.getBody().getApiApplySearchResult())){ - return forEntity.getBody().getApiApplySearchResult(); + if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getDatas()) + && CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){ + return forEntity.getBody().getDatas().getApiApplySearchResult(); } return Collections.emptyList(); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java new file mode 100644 index 0000000..b09265e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.irs.model.dto; + +import lombok.Data; +import org.apache.poi.ss.formula.functions.T; + +import java.util.List; + +/** + * @Classname ApiDTO + * @Description + * @Date 2023/7/13 18:03 + * @Author PoffyZhang + */ +@Data +public class ApiDTO { + private String code; + private String msg; + private String data; + private ApiSearchResult datas; +}