From 6f6c6a480d02b7c91e72821e29a937d5927e38cc Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期三, 19 六月 2024 17:48:21 +0800
Subject: [PATCH] 2024-06-19 朱宝民 迁移4个微信小程序接口

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java |  130 +++++++++++++++++++++++-------------------
 1 files changed, 71 insertions(+), 59 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 46cae34..35b198e 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
@@ -8,14 +8,16 @@
 import com.dy.pipIrrGlobal.pojoBa.BaClient;
 import com.dy.pipIrrGlobal.pojoSe.SeClient;
 import com.dy.pipIrrGlobal.voSe.VoClient;
+import com.dy.pipIrrSell.util.RestTemplateUtil;
+import com.dy.pipIrrSell.wechatpay.PayInfo;
 import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.responses.ApiResponses;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.MediaType;
@@ -35,10 +37,23 @@
 @Slf4j
 @Tag(name = "鍐滄埛绠$悊", description = "鍐滄埛鎿嶄綔")
 @RestController
-@RequestMapping(path="client")
+@RequestMapping(path = "client")
 @RequiredArgsConstructor
 public class ClientCtrl {
     private final ClientSv clientSv;
+    //private final RedisUtils redisUtils;
+    private final RestTemplateUtil restTemplateUtil;
+
+    private final String privateCertFileName = PayInfo.privateCertFileName;
+    private final String appid = PayInfo.appid;
+    private final String secret = PayInfo.secret;
+    private final String mchid = PayInfo.mchid;
+    private final String schema = PayInfo.schema;
+    private final String signType = PayInfo.signType;
+    private final String description = PayInfo.description;
+    private final String loginUrl = PayInfo.loginUrl;
+    private final String notifyUrl = PayInfo.notifyUrl;
+    private final String grantType = PayInfo.grantType;
 
     /**
      * 鑾峰彇鍐滄埛鍒楄〃
@@ -62,58 +77,6 @@
             return BaseResponseUtils.buildSuccess(res);
         } catch (Exception e) {
             log.error("鏌ヨ鍐滄埛寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
-        }
-    }
-
-    /**
-     * 鑾峰彇浜ゆ槗璁板綍
-     * @param vo
-     * @return
-     */
-    @Operation(summary = "鑾峰緱涓�椤典氦鏄撹褰�", description = "杩斿洖涓�椤典氦鏄撹褰�")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "杩斿洖涓�椤靛啘鎴锋暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = BaClient.class))}
-            )
-    })
-    @GetMapping(path = "getOperates")
-    @SsoAop()
-    public BaseResponse<Map> getOperates(QueryOperate vo){
-        try {
-           Map res = clientSv.getOperates(vo);
-            return BaseResponseUtils.buildSuccess(res);
-        } catch (Exception e) {
-            log.error("鏌ヨ浜ゆ槗璁板綍寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
-        }
-    }
-
-    /**
-     * 鑾峰彇浜ゆ槗姹囨�昏褰�
-     * @param vo
-     * @return
-     */
-    @Operation(summary = "鑾峰緱涓�椤典氦鏄撴眹鎬昏褰�", description = "杩斿洖涓�椤典氦鏄撴眹鎬昏褰�")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "杩斿洖涓�椤靛啘鎴锋暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = BaClient.class))}
-            )
-    })
-    @GetMapping(path = "getStatistics")
-    @SsoAop()
-    public BaseResponse<Map> getStatistics(QueryStatistic vo){
-        try {
-            Map res = clientSv.getStatistics(vo);
-            return BaseResponseUtils.buildSuccess(res);
-        } catch (Exception e) {
-            log.error("鏌ヨ浜ゆ槗姹囨�昏褰曞紓甯�", e);
             return BaseResponseUtils.buildException(e.getMessage()) ;
         }
     }
@@ -163,13 +126,13 @@
     @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
-    public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid DtoClient po, @Parameter(hidden = true) BindingResult bindingResult){
+    public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult) {
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
         // 鎺ユ敹鏉戠紪鍙凤紙涓婚敭锛�
-        Long villageId = po.getVillageid();
+        Long villageId = po.getVillageId();
 
         /**
          * 鑾峰彇5绾ц鏀垮尯鍒掍俊鎭�
@@ -229,7 +192,7 @@
     }
 
     /**
-     * 鐢熸垚10涓哄啘鎴风紪鍙�
+     * 鐢熸垚10浣嶅啘鎴风紪鍙�
      * 1. 鍒板啘鎴疯〃涓煡璇�6浣嶅尯鍒掍覆寮�澶寸殑鏈�澶х殑鍐滄埛缂栧彿
      * 2. 鏄惁鍙栧埌璁板綍
      *      2.1 鍙栧埌
@@ -273,13 +236,13 @@
     @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
-    public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid DtoClient po, @Parameter(hidden = true) BindingResult bindingResult){
+    public BaseResponse<Boolean> update(@RequestBody @Valid DtoClient po, BindingResult bindingResult){
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
         // 鎺ユ敹鏉戠紪鍙凤紙涓婚敭锛�
-        Long villageId = po.getVillageid();
+        Long villageId = po.getVillageId();
 
         /**
          * 鑾峰彇5绾ц鏀垮尯鍒掍俊鎭�
@@ -377,4 +340,53 @@
         }
         return BaseResponseUtils.buildSuccess(map_WaterTypes);
     }
+
+    /**
+     * 鏍规嵁鏉慖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);
+    }
 }

--
Gitblit v1.8.0