From aad4473d016780ab66ab77ecd6a198d6a9b53c42 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期三, 27 三月 2024 17:12:29 +0800
Subject: [PATCH] 2024-03-27 朱宝民 优化Application下获取交易汇总记录接口

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java |    5 +
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml                         |   18 +++
 pipIrr-platform/pipIrr-global/pom.xml                                                                 |    6 +
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml                                                    |   36 +++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java        |   18 +++
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java     |   32 +++++-
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml                             |    9 +
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml                            |    4 
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java                    |    2 
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java     |   86 +++++++++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java |   10 +
 pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml                                                    |    3 
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java     |    1 
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java       |   46 +++++++++
 14 files changed, 263 insertions(+), 13 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/pom.xml b/pipIrr-platform/pipIrr-global/pom.xml
index a2dcd29..ed3c376 100644
--- a/pipIrr-platform/pipIrr-global/pom.xml
+++ b/pipIrr-platform/pipIrr-global/pom.xml
@@ -134,6 +134,12 @@
             <artifactId>easyexcel</artifactId>
             <version>3.1.0</version>
         </dependency>
+        <!--OkHttp-->
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>4.9.2</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java
index 76fe8c1..e895f37 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoClient.java
@@ -39,7 +39,7 @@
     private String villageName;
 
     @Schema(title = "鐗囧尯ID")
-    private String blockId;
+    private String blockid;
     @Schema(title = "鐗囧尯鍚嶇О")
     private String bolckName;
 
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml
index 81d2965..93e6e80 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml
@@ -31,7 +31,8 @@
 
   <select id="selectAll" resultMap="BaseResultMap">
     select
-    <include refid="part_Column_List" />
+<!--    <include refid="part_Column_List" />-->
+    <include refid="Base_Column_List" />
     from ba_block
   </select>
 
@@ -47,7 +48,7 @@
           header like concat('%', #{header}, '%') and
         </if>
         <if test="phone != null and phone != ''">
-          phone = '#{phone,jdbcType=VARCHAR}' and
+          phone = #{phone,jdbcType=VARCHAR} and
         </if>
         <if test="area != null">
           area = ${area} and
@@ -64,10 +65,10 @@
         name like concat('%', #{name}, '%') and
       </if>
       <if test="header != null and header != ''">
-        header = '#{header,jdbcType=VARCHAR}' and
+        header = #{header,jdbcType=VARCHAR} and
       </if>
       <if test="phone != null and phone != ''">
-        phone = '#{phone,jdbcType=VARCHAR}' and
+        phone = #{phone,jdbcType=VARCHAR} and
       </if>
       <if test="area != null">
         area = ${area} and
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml
index 5d33225..20c1c5e 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml
@@ -28,7 +28,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, countyId, townId, villageId, blockId, divideId, `name`, virtualId, clientNum, 
+    id, countyId, townId, villageId, blockid, divideId, `name`, virtualId, clientNum,
     districtNum, districtTitle, phone, idCard, area, typeId, address, remarks, `operator`, 
     operateDt, disabled, deleted
   </sql>
@@ -56,7 +56,7 @@
       operateDt, disabled, deleted
       )
     values (#{id,jdbcType=BIGINT}, #{countyid,jdbcType=BIGINT}, #{townid,jdbcType=BIGINT}, 
-      #{villageid,jdbcType=BIGINT}, #{blockid,jdbcType=BIGINT}, #{divideid,jdbcType=BIGINT}, 
+      #{villageid,jdbcType=BIGINT}, #{blockid,jdbcType=BIGINT}, #{divideid,jdbcType=BIGINT},
       #{name,jdbcType=VARCHAR}, #{virtualid,jdbcType=BIGINT}, #{clientnum,jdbcType=VARCHAR}, 
       #{districtnum,jdbcType=BIGINT}, #{districttitle,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, 
       #{idcard,jdbcType=VARCHAR}, #{area,jdbcType=DOUBLE}, #{typeid,jdbcType=BIGINT}, 
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml
index 77f0653..39504ec 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml
@@ -15,6 +15,9 @@
     <name>pipIrr-web-base</name>
     <description>web鍩虹淇℃伅绯荤粺</description>
 
+    <dependencies>
+
+    </dependencies>
 
     <build>
         <plugins>
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java
index 0979aad..2f6af24 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java
@@ -187,4 +187,5 @@
             return BaseResponseUtils.buildSuccess(true) ;
         }
     }
+
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml
index 8511298..e55dedd 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml
@@ -17,11 +17,47 @@
 
     <dependencies>
         <!--OkHttp-->
+<!--        <dependency>-->
+<!--            <groupId>com.squareup.okhttp3</groupId>-->
+<!--            <artifactId>okhttp</artifactId>-->
+<!--            <version>4.9.2</version>-->
+<!--        </dependency>-->
+        <!--  闃块噷浜戠煭淇′緷璧�  -->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.5.16</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+            <version>2.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <!--OkHttp-->
         <dependency>
             <groupId>com.squareup.okhttp3</groupId>
             <artifactId>okhttp</artifactId>
             <version>4.9.2</version>
         </dependency>
+
+        <!--redis鍦烘櫙鍚姩鍣�-->
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-data-redis</artifactId>-->
+<!--        </dependency>-->
+
+        <!-- redis 杩炴帴姹狅紝鏂扮増鏈繛鎺ユ睜lettuce -->
+<!--        <dependency>-->
+<!--            <groupId>org.apache.commons</groupId>-->
+<!--            <artifactId>commons-pool2</artifactId>-->
+<!--        </dependency>-->
     </dependencies>
 
     <build>
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java
index a427049..f8b120d 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/PipIrrSellApplication.java
@@ -4,6 +4,7 @@
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 
@@ -17,6 +18,7 @@
 @SpringBootApplication
 @EnableAspectJAutoProxy
 @EnableMultiDataSource
+@EnableConfigurationProperties
 @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrSell"})
 @MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"})
 public class PipIrrSellApplication {
@@ -25,4 +27,7 @@
         SpringApplication.run(PipIrrSellApplication.class, args);
     }
 
+
+
+
 }
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 0aed5d4..da7b028 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
@@ -1,5 +1,8 @@
 package com.dy.pipIrrSell.client;
 
+import com.alibaba.fastjson2.JSONObject;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
+import com.aliyuncs.exceptions.ClientException;
 import com.dy.common.aop.SsoAop;
 import com.dy.common.webUtil.BaseResponse;
 import com.dy.common.webUtil.BaseResponseUtils;
@@ -8,6 +11,9 @@
 import com.dy.pipIrrGlobal.pojoBa.BaClient;
 import com.dy.pipIrrGlobal.pojoSe.SeClient;
 import com.dy.pipIrrGlobal.voSe.VoClient;
+import com.dy.pipIrrSell.result.SellResultCode;
+import com.dy.pipIrrSell.sms.AliyunSmsSv;
+import com.dy.pipIrrSell.sms.RandomCode;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -38,6 +44,8 @@
 @RequiredArgsConstructor
 public class ClientCtrl {
     private final ClientSv clientSv;
+    private final AliyunSmsSv aliyunSmsSv;
+    //private final RedisUtils redisUtils;
 
     /**
      * 鑾峰彇鍐滄埛鍒楄〃
@@ -324,4 +332,82 @@
         }
         return BaseResponseUtils.buildSuccess(map_WaterTypes);
     }
+
+    /**
+     * 鍙戦�侀獙璇佺爜
+     * @param phoneNumber
+     * @return
+     */
+    @Operation(summary = "鍙戦�侀獙璇佺爜", description = "鍙戦�侀獙璇佺爜")
+    @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))}
+            )
+    })
+    @PostMapping(path = "send_sms")
+    @SsoAop()
+    public BaseResponse<Boolean> sendSms(@RequestParam(name = "phoneNumber", required = true) String phoneNumber) throws ClientException {
+        if(phoneNumber == null || phoneNumber.length() <= 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.PHONE_NUMBER_CANNOT_BE_NULL.getMessage());
+        }
+
+        // 鐢熸垚6浣嶉獙璇佺爜骞惰浆涓篔son鏍煎紡
+        String securityCode = String.valueOf(RandomCode.genCode());
+        JSONObject param = new JSONObject();
+        param.put("code", securityCode);
+        String templateParam = param.toJSONString();
+
+        //redisUtils.set(phoneNumber, securityCode, 60);
+
+        SendSmsResponse response = aliyunSmsSv.sendSms(phoneNumber, templateParam);
+        if (response.getCode().equals("OK")) {
+            // 鍙戦�佹垚鍔熷鐞嗛�昏緫
+            return BaseResponseUtils.buildSuccess(true) ;
+        } else {
+            // 鍙戦�佸け璐ュ鐞嗛�昏緫
+            return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_SEND_FAIL.getMessage()) ;
+        }
+    }
+
+    /**
+     * 鏍¢獙楠岃瘉鐮�
+     * @param phoneNumber
+     * @param code
+     * @return
+     * @throws ClientException
+     */
+    @Operation(summary = "鏍¢獙楠岃瘉鐮�", description = "鏍¢獙楠岃瘉鐮�")
+    @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))}
+            )
+    })
+    @PostMapping(path = "verify")
+    @SsoAop()
+    public BaseResponse<Boolean> verify(@RequestParam("phoneNumber") String phoneNumber, @RequestParam("code") String code) throws ClientException {
+        if(phoneNumber == null || phoneNumber.length() <= 0 || code == null || code.length() <=0) {
+            return BaseResponseUtils.buildFail(SellResultCode.VERIFY_PARAMS_INCOMPLETE.getMessage());
+        }
+
+        // redis涓敭涓嶅瓨鍦ㄦ垨閿�间笉瀛樺湪鍒欐彁绀烘牎楠屽け璐�
+        //if(!redisUtils.hasKey(phoneNumber) || redisUtils.get(phoneNumber) == null)
+        //    return BaseResponseUtils.buildFail(SellResultCode.CODE_VERIFY_FAIL.getMessage());
+        //
+        //String code_redis = redisUtils.get(phoneNumber).toString();
+        //System.out.println("--------------------: " + code_redis);
+        //
+        //if(code_redis != null && code_redis.equals(code)) {
+        //    return BaseResponseUtils.buildSuccess(true) ;
+        //}else {
+        //    return BaseResponseUtils.buildFail(SellResultCode.CODE_VERIFY_FAIL.getMessage());
+        //}
+
+            return BaseResponseUtils.buildSuccess(true);
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java
index 83c819e..7c6804d 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralSv.java
@@ -132,6 +132,12 @@
         DecimalFormat df = new DecimalFormat("0.00");
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 
+        Integer pageSize = vo.getPageSize();
+        Integer pageCurr = vo.getPageCurr();
+        // 璧峰绱㈠紩浣嶇疆
+        Integer startIndex = (pageCurr - 1) * pageSize;
+
+
         // 鎺ユ敹浼犲叆鍙傛暟锛氫氦鏄撹捣姝㈡棩鏈熴�佹敹閾跺憳ID
         JSONArray array_paymentSums = new JSONArray();
         Date timeStart = dateFormat.parse(vo.getTimeStart());
@@ -196,18 +202,34 @@
             totalRefund = totalRefund + Optional.ofNullable(job_summary.getFloat("refundAmount")).orElse(0f);
         }
 
-        Map map_record = new HashMap();
-        //map_record.put("itemTotal", itemTotal);
-        map_record.put("list", list);
-
         Map map_result = new HashMap();
         map_result.put("totalCount", totalCount);
         map_result.put("totalReceived", totalReceived);
         map_result.put("totalGift", totalGift);
         map_result.put("totalRefund", totalRefund);
 
+        // 鍒嗛〉鏍煎紡缁勮璁板綍鍒楄〃
+        Map map_record = new HashMap();
+        map_record.put("itemTotal", list.size());
+        map_record.put("pageCurr", pageCurr);
+        map_record.put("pageSize", pageSize);
+        map_record.put("pageTotal", (int)Math.ceil((double)list.size() / pageSize));
+        JSONArray array_record = (JSONArray) JSON.toJSON(list);
+        JSONArray array_record_page = (JSONArray)JSON.toJSON(array_record.subList(startIndex, Math.min(startIndex + pageSize, array_record.size())));
+        map_record.put("list", array_record_page);
+
+        // 鍒嗛〉鏍煎紡缁勮鏀粯鏂瑰紡鍒楄〃
+        Map map_paymentSums = new HashMap();
+        map_paymentSums.put("itemTotal", array_paymentSums.size());
+        map_paymentSums.put("pageCurr", pageCurr);
+        map_paymentSums.put("pageSize", pageSize);
+        map_paymentSums.put("pageTotal", (int)Math.ceil((double)array_paymentSums.size() / pageSize));
+        JSONArray array_paymentSums_page = (JSONArray) JSON.toJSON(array_paymentSums.subList(startIndex, Math.min(startIndex + pageSize, array_paymentSums.size())));
+        map_paymentSums.put("list", array_paymentSums_page);
+
+
         map_result.put("records", map_record);
-        map_result.put("paymentSums", array_paymentSums);
+        map_result.put("paymentSums", map_paymentSums);
 
         return map_result;
     }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
index 6209612..6e74215 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
@@ -121,7 +121,15 @@
      */
     No_GENERALS(100001, "娌℃湁绗﹀悎鏉′欢鐨勬�昏处璁板綍"),
     No_TRADE_SUMMARIES(100001, "娌℃湁绗﹀悎鏉′欢鐨勪氦鏄撴眹鎬昏褰�"),
-    No_TRADE_DETAILS(100001, "娌℃湁绗﹀悎鏉′欢鐨勪氦鏄撴槑缁�");
+    No_TRADE_DETAILS(100001, "娌℃湁绗﹀悎鏉′欢鐨勪氦鏄撴槑缁�"),
+
+    /**
+     * 寰俊鐢ㄦ埛
+     */
+    PHONE_NUMBER_CANNOT_BE_NULL(20001, "鎵嬫満鍙蜂笉鑳戒负绌�"),
+    SECURITY_CODE_SEND_FAIL(20001, "楠岃瘉鐮佸彂閫佸け璐�"),
+    VERIFY_PARAMS_INCOMPLETE(20001, "楠岃瘉鍙傛暟涓嶅畬鏁�"),
+    CODE_VERIFY_FAIL(20001, "楠岃瘉鐮佹牎楠屽け璐�");
 
     private final Integer code;
     private final String message;
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java
new file mode 100644
index 0000000..6012b0b
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/AliyunSmsSv.java
@@ -0,0 +1,46 @@
+package com.dy.pipIrrSell.sms;
+
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.profile.DefaultProfile;
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-22 15:30
+ * @LastEditTime 2024-03-22 15:30
+ * @Description 鍙戦�佺煭淇℃湇鍔$被
+ */
+
+@Service
+@Data
+@ConfigurationProperties(prefix = "aliyun.sms")
+public class AliyunSmsSv {
+    /**
+     * 璁块棶閿�
+     * 璁块棶绉橀挜
+     * 鐭俊绛惧悕鍚嶇О
+     * 鐭俊妯℃澘Code
+     */
+    private String smsAccessKeyId;
+    private String smsAccessKeySecret;
+    private String smsSignName;
+    private String smsTemplateCode;
+
+    public SendSmsResponse sendSms(String phoneNumber, String templateParam) throws ClientException {
+        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", smsAccessKeyId, smsAccessKeySecret);
+        DefaultAcsClient client = new DefaultAcsClient(profile);
+
+        SendSmsRequest request = new SendSmsRequest();
+        request.setSignName(smsSignName);
+        request.setTemplateCode(smsTemplateCode);
+        request.setPhoneNumbers(phoneNumber);
+        request.setTemplateParam(templateParam);
+        SendSmsResponse response = client.getAcsResponse(request);
+        return response;
+    }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java
new file mode 100644
index 0000000..f2049c8
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/sms/RandomCode.java
@@ -0,0 +1,18 @@
+package com.dy.pipIrrSell.sms;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-22 15:34
+ * @LastEditTime 2024-03-22 15:34
+ * @Description
+ */
+
+/**
+ * 鐢熸垚6浣嶉殢鏈烘暟
+ */
+public class RandomCode {
+    public static int genCode(){
+        int code = (int)((Math.random() * 9 + 1) * 100000);
+        return code;
+    }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml
index ae78be9..a0f8af1 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml
@@ -16,3 +16,21 @@
       idSuffix: ${pipIrr.sell.idSuffix}
       #ConfigListener涓簲鐢�
       #configFileNames: config-global.xml,config-demo.xml
+#闃块噷鐭俊鏈嶅姟
+aliyun:
+  sms:
+    sms-access-key-id: LTAI5tPCmHqfyJ9YnoPorEwt
+    sms-access-key-secret: sU2CoLdNgcjnf5uPPU2dY7NNGNvOIX
+    sms-template-code: SMS_460776024
+    sms-sign-name: 澶х鑺傛按
+  #redis
+  redis:
+    host: localhost
+    #password:鎴戞槸娌¢厤缃瘑鐮佺殑
+    port: 6379
+    database: 6 #鎿嶄綔鐨勬槸6鍙锋暟鎹簱
+    pool:
+      max-active: 8 #鏈�澶ц繛鎺ユ暟
+      max-wait: -1 #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂� -1琛ㄧず鏃犻檺
+      max-idle: 4 #杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+      min-idle: 0 #杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
\ No newline at end of file

--
Gitblit v1.8.0