1;短信公用方法加默认话术(字典中配置)

2;饿了么推送URL回调URL
3;店铺倒序
This commit is contained in:
wangshuai 2024-07-23 16:16:38 +08:00
parent 18bb013925
commit a88f865b6f
4 changed files with 76 additions and 26 deletions

View File

@ -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\"}";
}
}

View File

@ -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()
// 除上面外的所有请求全部需要鉴权认证

View File

@ -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) {

View File

@ -95,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="saleBindTime != null "> and sale_bind_time = #{saleBindTime}</if>
<if test="beginTime != null and endTime != null"> and bind_time between #{beginTime} and #{endTime}</if>
</where>
ORDER BY bind_time desc
</select>
<select id="selectBusStoreInfoById" parameterType="Long" resultMap="BusStoreInfoResult">