张延森 6 年前
父节点
当前提交
66e4db3235

+ 1
- 1
pom.xml 查看文件

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju.welcome</groupId>
12 12
 	<artifactId>mainbiz</artifactId>
13
-	<version>v4.0.0</version>
13
+	<version>v4.0.1</version>
14 14
 	<name>mainbiz</name>
15 15
 	<description>com.huiju.welcome main service</description>
16 16
 

+ 29
- 0
src/main/java/com.huiju.welcome/config/SMSProperties.java 查看文件

@@ -0,0 +1,29 @@
1
+package com.huiju.welcome.config;
2
+
3
+
4
+import lombok.Data;
5
+import org.springframework.boot.context.properties.ConfigurationProperties;
6
+
7
+@Data
8
+@ConfigurationProperties(prefix = "sms")
9
+public class SMSProperties {
10
+    String url;
11
+    String method;
12
+    String contentType;
13
+    Captcha captcha;
14
+
15
+    @Data
16
+    public static class Template {
17
+        String code;
18
+        String tel;
19
+        String[] params;
20
+    }
21
+
22
+    @Data
23
+    public static class Captcha {
24
+        String code;
25
+        Integer expire;
26
+        Integer size;
27
+        String sign;
28
+    }
29
+}

+ 21
- 7
src/main/java/com.huiju.welcome/controller/TaGoodsOrdersController.java 查看文件

@@ -6,19 +6,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.huiju.welcome.common.base.BaseController;
8 8
 import com.huiju.welcome.common.base.ResponseBean;
9
-import com.huiju.welcome.model.SysUser;
10
-import com.huiju.welcome.model.TaGoodsOrders;
11
-import com.huiju.welcome.model.TaGoodsOrdersDetail;
12
-import com.huiju.welcome.model.TdGoodsType;
13
-import com.huiju.welcome.service.ISysUserService;
14
-import com.huiju.welcome.service.ITaGoodsOrdersDetailService;
15
-import com.huiju.welcome.service.ITaGoodsOrdersService;
9
+import com.huiju.welcome.model.*;
10
+import com.huiju.welcome.service.*;
16 11
 import com.huiju.welcome.utils.JWTUtils;
17 12
 import com.huiju.welcome.utils.StatusUtils;
18 13
 import com.huiju.welcome.utils.StringUtils;
19 14
 import io.swagger.annotations.ApiImplicitParams;
20 15
 import io.swagger.annotations.ApiOperation;
21 16
 import io.swagger.models.auth.In;
17
+import org.apache.http.HttpStatus;
22 18
 import org.slf4j.Logger;
23 19
 import org.slf4j.LoggerFactory;
24 20
 import org.springframework.beans.factory.annotation.Autowired;
@@ -49,6 +45,10 @@ public class TaGoodsOrdersController extends BaseController {
49 45
     public ITaGoodsOrdersDetailService iTaGoodsOrdersDetailService;
50 46
     @Autowired
51 47
     public ISysUserService iSysUserService;
48
+    @Autowired
49
+    public ITaMainUsherRecordService iTaMainUsherRecordService;
50
+    @Autowired
51
+    public ITaCustomerService iTaCustomerService;
52 52
 
53 53
 
54 54
     /**
@@ -70,6 +70,20 @@ public class TaGoodsOrdersController extends BaseController {
70 70
             Integer recId = iTaGoodsOrdersService.getRecIdByCustomerIdCurrentDate(taGoodsOrders.getCustomerId());
71 71
             if(recId != null){
72 72
                 taGoodsOrders.setRecId(recId);
73
+            } else {
74
+                //
75
+                TaCustomer cust = iTaCustomerService.getById(taGoodsOrders.getCustomerId());
76
+                if (cust != null) {
77
+                    boolean ok = iTaMainUsherRecordService.newRecordByConsultant(cust, null);
78
+
79
+                    if (!ok) {
80
+                        return ResponseBean.error("更新客户到访失败", HttpStatus.SC_INTERNAL_SERVER_ERROR);
81
+                    }
82
+                    recId = iTaGoodsOrdersService.getRecIdByCustomerIdCurrentDate(taGoodsOrders.getCustomerId());
83
+                    taGoodsOrders.setRecId(recId);
84
+                } else {
85
+                    return ResponseBean.error("关联客户信息失败", HttpStatus.SC_INTERNAL_SERVER_ERROR);
86
+                }
73 87
             }
74 88
             Boolean flag = iTaGoodsOrdersService.save(taGoodsOrders);
75 89
 

+ 19
- 0
src/main/java/com.huiju.welcome/controller/TaTransactionRecordController.java 查看文件

@@ -1,12 +1,16 @@
1 1
 package com.huiju.welcome.controller;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 7
 import com.huiju.welcome.common.base.BaseController;
7 8
 import com.huiju.welcome.common.base.ResponseBean;
9
+import com.huiju.welcome.model.TaCustomer;
8 10
 import com.huiju.welcome.model.TaTransactionRecord;
11
+import com.huiju.welcome.service.ITaCustomerService;
9 12
 import com.huiju.welcome.service.ITaTransactionRecordService;
13
+import com.huiju.welcome.utils.StatusUtils;
10 14
 import org.slf4j.Logger;
11 15
 import org.slf4j.LoggerFactory;
12 16
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +39,9 @@ public class TaTransactionRecordController extends BaseController {
35 39
     @Autowired
36 40
     public ITaTransactionRecordService iTaTransactionRecordService;
37 41
 
42
+    @Autowired
43
+    public ITaCustomerService iTaCustomerService;
44
+
38 45
 
39 46
     /**
40 47
      * 分页查询列表
@@ -70,6 +77,12 @@ public class TaTransactionRecordController extends BaseController {
70 77
     public ResponseBean taTransactionRecordAdd(@RequestBody TaTransactionRecord taTransactionRecord){
71 78
         ResponseBean responseBean = new ResponseBean();
72 79
         try {
80
+            // 反更新客户表
81
+            UpdateWrapper<TaCustomer> wrapper = new UpdateWrapper<>();
82
+            wrapper.eq("customer_id", taTransactionRecord.getCustomerId());
83
+            wrapper.set("status", StatusUtils.BizDone);
84
+            iTaCustomerService.update(new TaCustomer(), wrapper);
85
+
73 86
             if (iTaTransactionRecordService.save(taTransactionRecord)){
74 87
                 responseBean.addSuccess(taTransactionRecord);
75 88
             }else {
@@ -114,6 +127,12 @@ public class TaTransactionRecordController extends BaseController {
114 127
                                         @RequestBody TaTransactionRecord taTransactionRecord){
115 128
         ResponseBean responseBean = new ResponseBean();
116 129
         try {
130
+            // 反更新客户表
131
+            UpdateWrapper<TaCustomer> wrapper = new UpdateWrapper<>();
132
+            wrapper.eq("customer_id", taTransactionRecord.getCustomerId());
133
+            wrapper.set("status", StatusUtils.BizDone);
134
+            iTaCustomerService.update(new TaCustomer(), wrapper);
135
+
117 136
             taTransactionRecord.setRecordId(id);
118 137
             if (iTaTransactionRecordService.updateById(taTransactionRecord)){
119 138
                 responseBean.addSuccess(taTransactionRecord);

+ 21
- 8
src/main/java/com.huiju.welcome/controller/TaWechatUserController.java 查看文件

@@ -12,14 +12,12 @@ import com.huiju.welcome.model.TaWechatUser;
12 12
 import com.huiju.welcome.service.ISysUserService;
13 13
 import com.huiju.welcome.service.ITaPersonService;
14 14
 import com.huiju.welcome.service.ITaWechatUserService;
15
-import com.huiju.welcome.utils.CommConstant;
16
-import com.huiju.welcome.utils.JWTUtils;
17
-import com.huiju.welcome.utils.MiniApp;
18
-import com.huiju.welcome.utils.StatusUtils;
15
+import com.huiju.welcome.utils.*;
19 16
 import org.apache.http.HttpStatus;
20 17
 import org.slf4j.Logger;
21 18
 import org.slf4j.LoggerFactory;
22 19
 import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.beans.factory.annotation.Value;
23 21
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
24 22
 import org.springframework.web.bind.annotation.*;
25 23
 
@@ -54,6 +52,9 @@ public class TaWechatUserController extends BaseController {
54 52
     @Autowired
55 53
     private ISysUserService iSysUserService;
56 54
 
55
+    @Autowired
56
+    private SMSUtils smsUtils;
57
+
57 58
     @GetMapping("/login")
58 59
     public ResponseBean login(@RequestParam String code) {
59 60
         ResponseBean resp = miniApp.getOpenid(code);
@@ -103,6 +104,16 @@ public class TaWechatUserController extends BaseController {
103 104
         return ResponseBean.success(map);
104 105
     }
105 106
 
107
+    @PostMapping("/captcha")
108
+    public ResponseBean sendCaptcha(@RequestParam String tel) {
109
+        boolean success = smsUtils.sendCaptcha(tel);
110
+        if (success) {
111
+            return ResponseBean.success("发送验证码成功");
112
+        } else {
113
+            return ResponseBean.error("验证码发送失败, 请重试", HttpStatus.SC_INTERNAL_SERVER_ERROR);
114
+        }
115
+    }
116
+
106 117
     @PostMapping("/bind")
107 118
     public ResponseBean bind(@RequestBody String paramStr, HttpServletRequest request) {
108 119
         String userId = JWTUtils.getSubject(request);
@@ -128,10 +139,12 @@ public class TaWechatUserController extends BaseController {
128 139
             return ResponseBean.error("绑定参数为空或者非法", HttpStatus.SC_BAD_REQUEST);
129 140
         }
130 141
 
131
-        // todo
132
-        // 先简单验证
133
-        if (!"1234".equals(captcha)) {
134
-            return ResponseBean.error("绑定参数为空或者非法", HttpStatus.SC_BAD_REQUEST);
142
+        // 校验短信验证码, 当前年度为万能码
143
+        LocalDateTime now = LocalDateTime.now();
144
+        if (!String.valueOf(now.getYear()).equals(captcha)) {
145
+            if (!smsUtils.checkCaptcha(phone, captcha)) {
146
+                return ResponseBean.error("验证码不正确或已过期", HttpStatus.SC_BAD_REQUEST);
147
+            }
135 148
         }
136 149
 
137 150
         SysUser sysUser = iSysUserService.getByPhone(phone);

+ 3
- 7
src/main/java/com.huiju.welcome/service/impl/TaCarRecordServiceImpl.java 查看文件

@@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.huiju.welcome.mapper.TaCarRecordMapper;
8 8
 import com.huiju.welcome.model.*;
9 9
 import com.huiju.welcome.service.*;
10
-import com.huiju.welcome.utils.AliFaceUtils;
11
-import com.huiju.welcome.utils.CommConstant;
12
-import com.huiju.welcome.utils.StatusUtils;
13
-import com.huiju.welcome.utils.TencentFaceUtils;
10
+import com.huiju.welcome.utils.*;
14 11
 import com.tencentcloudapi.common.exception.TencentCloudSDKException;
15 12
 import com.tencentcloudapi.iai.v20180301.models.Candidate;
16 13
 import org.slf4j.Logger;
@@ -226,11 +223,10 @@ public class TaCarRecordServiceImpl extends ServiceImpl<TaCarRecordMapper, TaCar
226 223
     @Override
227 224
     public List<TaCarRecord> getTimeline() {
228 225
         LocalDateTime now = LocalDateTime.now();
226
+        String dayBegin = DateUtils.localDatetime2day(now) + " 00:00:00";
229 227
 
230
-        // 四小时内
231
-        LocalDateTime fourHour = now.minusHours(4);
232 228
         QueryWrapper<TaCarRecord> query = new QueryWrapper<>();
233
-        query.ge("create_date", fourHour);
229
+        query.ge("create_date", dayBegin);
234 230
         query.groupBy("plate_number");
235 231
         query.orderByDesc("create_date");
236 232
         List<TaCarRecord> result = taCarRecordMapper.selectList(query);

+ 11
- 11
src/main/java/com.huiju.welcome/service/impl/TaCustomerServiceImpl.java 查看文件

@@ -315,37 +315,37 @@ public class TaCustomerServiceImpl extends ServiceImpl<TaCustomerMapper, TaCusto
315 315
         List<SysDict> dictList = iSysDictService.list();
316 316
         dictList.stream().forEach(e -> {
317 317
             //对比数据重新赛值
318
-            if (e.getId().equals(taCustomer.getNowArea())){
318
+            if (null != taCustomer.getNowArea() && e.getId().equals(taCustomer.getNowArea())){
319 319
                 taCustomer.setNowAreaLable(e.getLabel());
320 320
             }
321
-            if (e.getId().equals(taCustomer.getFamilyWork())){
321
+            if (null != taCustomer.getFamilyWork() && e.getId().equals(taCustomer.getFamilyWork())){
322 322
                 taCustomer.setFamilyWorkLable(e.getLabel());
323 323
             }
324
-            if (e.getId().equals(Integer.valueOf(taCustomer.getFamilyIndustry()))){
324
+            if (null != taCustomer.getFamilyIndustry() && e.getId().equals(Integer.valueOf(taCustomer.getFamilyIndustry()))){
325 325
                 taCustomer.setFamilyIndustryLable(e.getLabel());
326 326
             }
327
-            if (e.getId().equals(Integer.valueOf(taCustomer.getFamilyDuty()))){
327
+            if (null != taCustomer.getFamilyDuty() && e.getId().equals(Integer.valueOf(taCustomer.getFamilyDuty()))){
328 328
                 taCustomer.setFamilyDutyLable(e.getLabel());
329 329
             }
330
-            if (e.getId().equals(taCustomer.getHousePurchasing())){
330
+            if (null != taCustomer.getHousePurchasing() && e.getId().equals(taCustomer.getHousePurchasing())){
331 331
                 taCustomer.setHousePurchasingLable(e.getLabel());
332 332
             }
333
-            if (e.getId().equals(taCustomer.getHouseProperty())){
333
+            if (null != taCustomer.getHouseProperty() && e.getId().equals(taCustomer.getHouseProperty())){
334 334
                 taCustomer.setHousePropertyLable(e.getLabel());
335 335
             }
336
-            if (e.getId().equals(taCustomer.getHouseLivingArea())){
336
+            if (null != taCustomer.getHouseLivingArea() && e.getId().equals(taCustomer.getHouseLivingArea())){
337 337
                 taCustomer.setHouseLivingAreaLable(e.getLabel());
338 338
             }
339
-            if (e.getId().equals(taCustomer.getHouseType())){
339
+            if (null != taCustomer.getHouseType() && e.getId().equals(taCustomer.getHouseType())){
340 340
                 taCustomer.setHouseTypeLable(e.getLabel());
341 341
             }
342
-            if (e.getId().equals(taCustomer.getFamilyStructure())){
342
+            if (null != taCustomer.getFamilyStructure() && e.getId().equals(taCustomer.getFamilyStructure())){
343 343
                 taCustomer.setFamilyStructureLable(e.getLabel());
344 344
             }
345
-            if (e.getId().equals(taCustomer.getCustomerAge())){
345
+            if (null != taCustomer.getCustomerAge() && e.getId().equals(taCustomer.getCustomerAge())){
346 346
                 taCustomer.setCustomerAgeLable(e.getLabel());
347 347
             }
348
-            if (e.getId().equals(Integer.valueOf(taCustomer.getFavorLevel()))){
348
+            if (null != taCustomer.getFavorLevel() && e.getId().equals(Integer.valueOf(taCustomer.getFavorLevel()))){
349 349
                 taCustomer.setFavorLevelLable(e.getLabel());
350 350
             }
351 351
         });

+ 12
- 8
src/main/java/com.huiju.welcome/service/impl/TaMainUsherRecordServiceImpl.java 查看文件

@@ -465,14 +465,15 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
465 465
                 return false;
466 466
             }
467 467
         } else {
468
+            TaMainUsherRecord origin = taMainUsherRecordMapper.selectById(taMainUsherRecord.getRecId());
468 469
             String remark = taMainUsherRecord.getRemark();
469 470
         
470 471
             if (null == remark) {
471
-                remark = taCustomer.getRemark();
472
+                remark = origin.getRemark();
473
+            }
474
+            else if (!StringUtils.isEmpty(origin.getRemark()) && !remark.equals(origin.getRemark())) {
475
+                remark += "\n\n---" + DateUtils.cutSecond(LocalDateTime.now())+ "---" + "\n" + origin.getRemark();
472 476
             }
473
-            //else if (!StringUtils.isEmpty(taCustomer.getRemark())) {
474
-            //    remark += "\n\n---" + DateUtils.cutSecond(LocalDateTime.now())+ "---" + "\n" + taCustomer.getRemark();
475
-            //}
476 477
             taMainUsherRecord.setRemark(remark);
477 478
         
478 479
             int row = taMainUsherRecordMapper.updateById(taMainUsherRecord);
@@ -485,10 +486,13 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
485 486
 	        queryWrapper.eq("rec_id",taMainUsherRecord.getRecId());
486 487
 	        taFollowupRecordMapper.delete(queryWrapper);
487 488
         }
488
-	    for (TaFollowupRecord follow : taFollowupRecordList) {
489
-		    follow.setRecId(taMainUsherRecord.getRecId());
490
-		    taFollowupRecordMapper.insert(follow);
491
-	    }
489
+
490
+        if (null != taFollowupRecordList) {
491
+            for (TaFollowupRecord follow : taFollowupRecordList) {
492
+                follow.setRecId(taMainUsherRecord.getRecId());
493
+                taFollowupRecordMapper.insert(follow);
494
+            }
495
+        }
492 496
     
493 497
         return true;
494 498
     }

+ 3
- 3
src/main/java/com.huiju.welcome/service/impl/TaVisitingLogServiceImpl.java 查看文件

@@ -14,6 +14,7 @@ import com.huiju.welcome.model.TaVisitingLog;
14 14
 import com.huiju.welcome.service.ITaDeviceService;
15 15
 import com.huiju.welcome.service.ITaPersonService;
16 16
 import com.huiju.welcome.service.ITaVisitingLogService;
17
+import com.huiju.welcome.utils.DateUtils;
17 18
 import org.springframework.beans.factory.annotation.Autowired;
18 19
 import org.springframework.stereotype.Service;
19 20
 
@@ -63,11 +64,10 @@ public class TaVisitingLogServiceImpl extends ServiceImpl<TaVisitingLogMapper, T
63 64
     @Override
64 65
     public ResponseBean getTimeline() {
65 66
         LocalDateTime now = LocalDateTime.now();
67
+        String todayBegin = DateUtils.localDatetime2day(now) + " 00:00:00";
66 68
 
67
-        // 四小时内
68
-        LocalDateTime fourHour = now.minusHours(4);
69 69
         QueryWrapper<TaVisitingLog> query4 = new QueryWrapper<>();
70
-        query4.ge("visite_date", fourHour);
70
+        query4.ge("visite_date", todayBegin);
71 71
         query4.groupBy("real_person");
72 72
         query4.orderByDesc("visite_date");
73 73
         List<TaVisitingLog> fourHourList = taVisitingLogMapper.selectList(query4);

+ 1
- 0
src/main/java/com.huiju.welcome/utils/CommConstant.java 查看文件

@@ -4,6 +4,7 @@ public class CommConstant {
4 4
     public final static String IDENTITY_CONSULTANT = "consultant";
5 5
     public final static String IDENTITY_FIRSTUSHER = "first-usher";
6 6
     public final static String IDENTITY_MAINUSHER = "main-usher";
7
+    public final static String IDENTITY_BARUSHER = "bar-usher";
7 8
 
8 9
     public final static String PAGE_MY_CUSTOMER = "pages/client/myclient/myclient";
9 10
 

+ 128
- 0
src/main/java/com.huiju.welcome/utils/SMSUtils.java 查看文件

@@ -0,0 +1,128 @@
1
+package com.huiju.welcome.utils;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.huiju.welcome.config.SMSProperties;
5
+import lombok.Data;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
9
+import org.springframework.context.annotation.Configuration;
10
+import org.springframework.http.*;
11
+import org.springframework.web.client.RestTemplate;
12
+
13
+import java.time.LocalDateTime;
14
+import java.util.*;
15
+
16
+@Slf4j
17
+@Configuration
18
+@EnableConfigurationProperties(SMSProperties.class)
19
+public class SMSUtils {
20
+    // 短信服务配置
21
+    SMSProperties smsProperties;
22
+
23
+    Map<String, Phone> allPhones;
24
+
25
+    @Autowired
26
+    public SMSUtils(SMSProperties properties) {
27
+        smsProperties = properties;
28
+        allPhones = new HashMap<>();
29
+    }
30
+
31
+    /**
32
+     * 发送验证码到 tel
33
+     * @param tel
34
+     * @return
35
+     */
36
+    public boolean sendCaptcha(String tel) {
37
+        Phone phone = allPhones.get(tel);
38
+        if (null == phone) {
39
+            phone = new Phone();
40
+            phone.setTel(tel);
41
+        }
42
+
43
+        phone.setCaptcha(genCaptcha(smsProperties.getCaptcha().getSize()));
44
+        phone.setExpire(LocalDateTime.now().plusSeconds(smsProperties.getCaptcha().getExpire()));
45
+        allPhones.put(tel, phone);
46
+
47
+        log.info("发送手机 {} 验证码 {}", tel, phone.getCaptcha());
48
+
49
+        String[] params = { phone.getCaptcha(), smsProperties.getCaptcha().getSign() };
50
+        return sendMessage(smsProperties.getCaptcha().getCode(), tel, params);
51
+    }
52
+
53
+    /**
54
+     * 校验验证码
55
+     * @param tel
56
+     * @param smsCaptcha
57
+     * @return
58
+     */
59
+    public boolean checkCaptcha(String tel, String smsCaptcha) {
60
+        Phone phone = allPhones.get(tel);
61
+        if (null == phone) {
62
+            log.error("手机号 {} 的验证码未找到", tel);
63
+            return false;
64
+        }
65
+
66
+        if (null == smsCaptcha || !smsCaptcha.equals(phone.getCaptcha())) {
67
+            log.error("手机号 {} 校验验证码出错, 正确: {}, 错误: {}", tel, phone.getCaptcha(), smsCaptcha);
68
+            return false;
69
+        }
70
+
71
+        LocalDateTime now = LocalDateTime.now();
72
+        if (now.isAfter(phone.getExpire())) {
73
+            log.error("手机号 {} 的验证码已过期", tel);
74
+            return false;
75
+        }
76
+
77
+        // 如果验证成功, 则从缓存中删除
78
+        allPhones.remove(tel);
79
+        return true;
80
+    }
81
+
82
+    private String genCaptcha(int length) {
83
+        List<String> nums = new ArrayList<>();
84
+        for (int i = 0; i < length; i ++) {
85
+            int rand = (new Random()).nextInt(10);
86
+            nums.add(String.valueOf(rand));
87
+        }
88
+        return String.join("", nums);
89
+    }
90
+
91
+    private boolean sendMessage(String code, String tel, String[] params) {
92
+        // 发送内容
93
+        SMSProperties.Template message = new SMSProperties.Template();
94
+        message.setCode(code);
95
+        message.setTel(tel);
96
+        message.setParams(params);
97
+
98
+        // 构造 request
99
+        HttpHeaders headers = new HttpHeaders();
100
+        headers.setContentType(MediaType.parseMediaType(smsProperties.getContentType()));
101
+//        String body = JSONObject.toJSONString(message);
102
+        HttpMethod method = HttpMethod.resolve(smsProperties.getMethod());
103
+        HttpEntity requestEntity = new HttpEntity(message, headers);
104
+
105
+        RestTemplate template = new RestTemplate();
106
+        HttpEntity<String> response = template.exchange(
107
+                smsProperties.getUrl(),
108
+                method,
109
+                requestEntity,
110
+                String.class,
111
+                new Object()
112
+        );
113
+
114
+        if (((ResponseEntity<String>) response).getStatusCodeValue() != HttpStatus.OK.value()) {
115
+            log.error("请求发送短信验证码失败: {}", response.toString());
116
+            return false;
117
+        }
118
+
119
+        return true;
120
+    }
121
+
122
+    @Data
123
+    public static class Phone {
124
+        String tel;
125
+        String captcha;
126
+        LocalDateTime expire;
127
+    }
128
+}

+ 24
- 2
src/main/resources/application.yml 查看文件

@@ -1,7 +1,7 @@
1 1
 spring:
2 2
   datasource:
3 3
     driver-class-name: com.mysql.cj.jdbc.Driver
4
-#    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/welcome3?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
4
+#    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/welcome3?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
5 5
 #    username: welcome
6 6
 #    password: s190QU2#z%hdU%^FPkY9qjls
7 7
     url: jdbc:mysql://47.101.36.130:3306/welcome3?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
@@ -72,4 +72,26 @@ tencent:
72 72
   secretKey: oKhohKlwsSowqa5KM8drpX1FCtLfmhMq
73 73
   iai:
74 74
     region: ap-shanghai
75
-    group: default
75
+    group: default
76
+
77
+# 手机短信服务
78
+sms:
79
+  url: http://micservice.ycjcjy.com/sms
80
+  method: POST
81
+  contentType: "application/json;charset=UTF-8"
82
+  template:
83
+    code:
84
+    tel:
85
+    params:
86
+
87
+  # 以下为各模板 code
88
+  # 验证码
89
+  captcha:
90
+    # 模板 code
91
+    code: "0301"
92
+    # 有效时间 秒
93
+    expire: 120
94
+    # 验证码长度
95
+    size: 4
96
+    # 短信签名
97
+    sign: AI智慧案场

+ 1
- 1
src/main/resources/mapper/TaCustomerMapper.xml 查看文件

@@ -64,7 +64,7 @@
64 64
             *
65 65
         FROM
66 66
             ta_customer t
67
-        WHERE t.status = 1
67
+        WHERE t.status &gt; 0
68 68
             <if test="consultantId !=null">
69 69
               AND t.consultant_id = #{consultantId}
70 70
             </if>