diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/ElemeController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/ElemeController.java
new file mode 100644
index 0000000..5b746bb
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/ElemeController.java
@@ -0,0 +1,24 @@
+package com.ruoyi.business.controller;
+
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/eleme")
+public class ElemeController {
+
+
+ @GetMapping("/message_receive")
+ public String msg() {
+ return "{\"message\":\"ok\"}";
+ }
+
+
+ @GetMapping("/accredit")
+ public String accredit() {
+ return "{\"message\":\"ok\"}";
+ }
+}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index d2991ce..50bd6ab 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -136,6 +136,7 @@ public class SecurityConfig
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
.antMatchers(HttpMethod.POST,"/mt/cookies").permitAll()
.antMatchers("/test/**").permitAll()
+ .antMatchers("/eleme/message_receive").permitAll()
// .antMatchers("/mt/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java
index 3bb8b2f..b1fbbbc 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java
@@ -8,6 +8,7 @@ import com.ruoyi.business.mapper.BusReturnVisitInfoMapper;
import com.ruoyi.business.service.*;
import com.ruoyi.common.config.BusTencentProperties;
import com.ruoyi.common.utils.HttpClientUtilT;
+import com.ruoyi.system.mapper.SysDictDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@@ -52,6 +53,9 @@ public class AiServiceImpl implements IAiService {
@Autowired
private BusTencentProperties busTencentProperties;
+ @Autowired
+ private SysDictDataMapper sysDictDataMapper;
+
private String userSn = "SYSUSER|8398f13f3feccef770ee4d465fe22fbf";
private String aiUserSn = "SYSUSER|2665bcca63a2b5c724095fa01dce0470";
@@ -314,30 +318,34 @@ public class AiServiceImpl implements IAiService {
}
// 话术判断 08:00 10:00 11:30 13:30 18:00 20:00
String content = "";
- LocalTime time1 = LocalTime.of(6, 00, 00);
- LocalTime time2 = LocalTime.of(10, 00, 00);
- LocalTime time3 = LocalTime.of(14, 00, 00);
- LocalTime time4 = LocalTime.of(17, 00, 00);
- if (time1.isBefore(orderTime) && orderTime.isBefore(time2)) {
- if(busStoreConfigInfo.getContent1()==null){
- continue;
+ if("AI".equals(busStoreInfo.getMarketingChannels())){
+ LocalTime time1 = LocalTime.of(6, 00, 00);
+ LocalTime time2 = LocalTime.of(10, 00, 00);
+ LocalTime time3 = LocalTime.of(14, 00, 00);
+ LocalTime time4 = LocalTime.of(17, 00, 00);
+ if (time1.isBefore(orderTime) && orderTime.isBefore(time2)) {
+ if(busStoreConfigInfo.getContent1()==null){
+ continue;
+ }
+ content = busStoreConfigInfo.getContent1();
+ } else if (time2.isBefore(orderTime) && orderTime.isBefore(time3)) {
+ if(busStoreConfigInfo.getContent2()==null){
+ continue;
+ }
+ content = busStoreConfigInfo.getContent2();
+ } else if (time3.isBefore(orderTime) && orderTime.isBefore(time4)) {
+ if(busStoreConfigInfo.getContent3()==null){
+ continue;
+ }
+ content = busStoreConfigInfo.getContent3();
+ } else {
+ if(busStoreConfigInfo.getContent4()==null){
+ continue;
+ }
+ content = busStoreConfigInfo.getContent4();
}
- content = busStoreConfigInfo.getContent1();
- } else if (time2.isBefore(orderTime) && orderTime.isBefore(time3)) {
- if(busStoreConfigInfo.getContent2()==null){
- continue;
- }
- content = busStoreConfigInfo.getContent2();
- } else if (time3.isBefore(orderTime) && orderTime.isBefore(time4)) {
- if(busStoreConfigInfo.getContent3()==null){
- continue;
- }
- content = busStoreConfigInfo.getContent3();
- } else {
- if(busStoreConfigInfo.getContent4()==null){
- continue;
- }
- content = busStoreConfigInfo.getContent4();
+ }else if("sms".equals(busStoreInfo.getMarketingChannels())){
+ content = sysDictDataMapper.selectDictLabel("bus_default_sms_script","default_script");
}
if(busReturnVisitInfoMapper.returnVisitInfoList(busOrderInfo.getPrivcyPhone()).size()>0){
continue;
@@ -366,7 +374,7 @@ public class AiServiceImpl implements IAiService {
if("AI".equals(busStoreInfo.getMarketingChannels())){
sendAiTask(content,busOrderInfo);
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
- sendSmsTask(busOrderInfo);
+ sendSmsTask(content,busOrderInfo);
}else{
sendAiTask(content,busOrderInfo);
}
@@ -397,8 +405,24 @@ public class AiServiceImpl implements IAiService {
}
}
- private void sendSmsTask(BusOrderInfo busOrderInfo) {
-
+ private synchronized void sendSmsTask(String content, BusOrderInfo busOrderInfo) {
+ try {
+ String phoneNo = busOrderInfo.getPrivcyPhone().split(",")[0];//#分机号#
+ content = content.replaceAll("#分机号#",busOrderInfo.getPrivcyPhone().split(",")[1]);
+// String ss = "{\"taskId\":\"202203170025799000001\",\"message\":\"success\",\"timestamp\":1647481716818,\"status\":\"00\",\"tag\":\"\"}";
+// com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(ss);
+ com.alibaba.fastjson.JSONObject jsonObject = busTencentProperties.smsCredential(phoneNo,content);
+ System.out.println(jsonObject);
+ if("00".equals(jsonObject.getString("status"))){
+ //定时任务15天之前的删除记录 todo
+ BusFifteenInfo fifteenInfo = new BusFifteenInfo();
+ fifteenInfo.setCustomId(busOrderInfo.getCustomId());
+ fifteenInfo.setLastVisitTime(LocalDateTime.now().toString());
+ fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
+ }
+ } catch (Exception e) {
+ System.out.println("建立sendSmsTask错误: " + e.getMessage());
+ }
}
private void addAiTaskTest(String apiKey, String content, BusOrderInfo busOrderInfo) {
diff --git a/ruoyi-system/src/main/resources/mapper/business/BusStoreInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/business/BusStoreInfoMapper.xml
index aae64f3..d41d6b8 100644
--- a/ruoyi-system/src/main/resources/mapper/business/BusStoreInfoMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/business/BusStoreInfoMapper.xml
@@ -95,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and sale_bind_time = #{saleBindTime}
and bind_time between #{beginTime} and #{endTime}
+ ORDER BY bind_time desc