From b0115ff5564f4080d16d57a547dab0ee9c66ba10 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期四, 13 六月 2024 22:34:37 +0800
Subject: [PATCH] 2024-06-13 朱宝民 微信支付接口
---
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java | 140 ++++++++++++++++++++++++++++++++--------------
1 files changed, 96 insertions(+), 44 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java
index d93184e..7d16dba 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java
@@ -13,6 +13,7 @@
import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.voSe.VoClient;
+import com.dy.pipIrrGlobal.voSe.VoClientWechat;
import com.dy.pipIrrSell.client.dto.CodeVerifyDTO;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.sms.AliyunSmsSv;
@@ -353,6 +354,55 @@
}
/**
+ * 鏍规嵁鏉慖D鑾峰彇12浣嶈鏀垮尯鍒�
+ * @param villageId
+ * @return
+ */
+ @Operation(summary = "鏍规嵁鏉慖D鑾峰彇12浣嶈鏀垮尯鍒�", description = "鏍规嵁鏉慖D鑾峰彇12浣嶈鏀垮尯鍒�")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = Boolean.class))}
+ )
+ })
+ @GetMapping(path = "district")
+ @SsoAop()
+ public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "鏉戠紪鍙蜂笉鑳戒负绌�") Long villageId){
+ /**
+ * 鑾峰彇5绾ц鏀垮尯鍒掍俊鎭�
+ */
+ Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
+ if(map_districts.size() <= 0) {
+ return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎");
+ }
+
+ String provinceNum = map_districts.get("provinceNum").toString();
+ String cityNum = map_districts.get("cityNum").toString();
+ String countyNum = map_districts.get("countyNum").toString();
+ String townNum = map_districts.get("townNum").toString();
+ String villageNum = map_districts.get("villageNum").toString();
+
+ // 鐢熸垚12浣�5绾ц鏀垮尯鍒掔紪鐮佷覆鍙婂悕绉颁覆
+ Long districtNum = Long.parseLong(provinceNum + cityNum + countyNum + townNum + villageNum);
+ //鑾峰彇椤圭洰缂栫爜
+ String projectNo = clientSv.getItemValue("projectNo");
+ //杞负int
+ Integer projectNo1 = Integer.valueOf(projectNo);
+ //杞负16杩涘埗
+// String projectNo2 = Integer.toHexString(projectNo1);
+// log.info(projectNo2);
+ String projectNo3 = String.format("%02x", projectNo1);
+ log.info(projectNo3);
+
+ Map map = new HashMap();
+ map.put("districtNum", districtNum);
+ map.put("projectNo",projectNo3);
+ return BaseResponseUtils.buildSuccess(map);
+ }
+
+ /**
* 鍙戦�侀獙璇佺爜
* @param phoneNumber
* @return
@@ -406,10 +456,10 @@
/**
* 鏍¢獙楠岃瘉鐮�
- * @param phoneNumber
- * @param code
+ * @param po
+ * @param bindingResult
* @return
- * @throws ClientException
+ * @throws IOException
*/
@Operation(summary = "鏍¢獙楠岃瘉鐮�", description = "鏍¢獙楠岃瘉鐮�")
@ApiResponses(value = {
@@ -479,51 +529,53 @@
}
/**
- * 鏍规嵁鏉慖D鑾峰彇12浣嶈鏀垮尯鍒�
- * @param villageId
+ * 鑾峰彇鍐滄埛鍩烘湰淇℃伅锛屽皬绋嬪簭棣栭〉浣跨敤
+ * @param sessionId
* @return
*/
- @Operation(summary = "鏍规嵁鏉慖D鑾峰彇12浣嶈鏀垮尯鍒�", description = "鏍规嵁鏉慖D鑾峰彇12浣嶈鏀垮尯鍒�")
- @ApiResponses(value = {
- @ApiResponse(
- responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
- description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
- content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
- schema = @Schema(implementation = Boolean.class))}
- )
- })
- @GetMapping(path = "district")
+ @GetMapping(path = "/simple_info")
@SsoAop()
- public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "鏉戠紪鍙蜂笉鑳戒负绌�") Long villageId){
- /**
- * 鑾峰彇5绾ц鏀垮尯鍒掍俊鎭�
- */
- Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
- if(map_districts.size() <= 0) {
- return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎");
+ public BaseResponse<VoClientWechat> getSimpleClientInfo(@RequestParam Long sessionId){
+ try {
+ VoClientWechat res = clientSv.getSimpleClientInfo(sessionId, null);
+ return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鏌ヨ鍐滄埛寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage()) ;
+ }
+ }
+
+ /**
+ * 鐧诲綍鍑瘉鐧诲綍
+ * @param code 涓存椂鐧诲綍鍑瘉
+ * @return
+ */
+ @GetMapping(path = "/code_login")
+ @SsoAop()
+ public BaseResponse<VoClientWechat> codeLogin(@RequestParam String code) throws IOException {
+
+ // 鐧诲綍鍑瘉鏍¢獙
+ Map<String, Object> queryParams = new HashMap<>();
+ queryParams.put("appid", appid);
+ queryParams.put("secret", secret);
+ queryParams.put("js_code", code);
+ queryParams.put("grant_type", grantType);
+ Map<String, String> headerParams = new HashMap<>();
+ JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams);
+
+ String openId = job.getString("openid");
+ if(openId == null) {
+ return BaseResponseUtils.buildFail(SellResultCode.LOGIN_FAIL.getMessage());
}
- String provinceNum = map_districts.get("provinceNum").toString();
- String cityNum = map_districts.get("cityNum").toString();
- String countyNum = map_districts.get("countyNum").toString();
- String townNum = map_districts.get("townNum").toString();
- String villageNum = map_districts.get("villageNum").toString();
-
- // 鐢熸垚12浣�5绾ц鏀垮尯鍒掔紪鐮佷覆鍙婂悕绉颁覆
- Long districtNum = Long.parseLong(provinceNum + cityNum + countyNum + townNum + villageNum);
- //鑾峰彇椤圭洰缂栫爜
- String projectNo = clientSv.getItemValue("projectNo");
- //杞负int
- Integer projectNo1 = Integer.valueOf(projectNo);
- //杞负16杩涘埗
-// String projectNo2 = Integer.toHexString(projectNo1);
-// log.info(projectNo2);
- String projectNo3 = String.format("%02x", projectNo1);
- log.info(projectNo3);
-
- Map map = new HashMap();
- map.put("districtNum", districtNum);
- map.put("projectNo",projectNo3);
- return BaseResponseUtils.buildSuccess(map);
+ try {
+ VoClientWechat res = clientSv.getSimpleClientInfo(null, openId);
+ return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鏌ヨ鍐滄埛寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage()) ;
+ }
}
+
+
}
--
Gitblit v1.8.0