parent
7779ee2b69
commit
d03384efc2
|
@ -0,0 +1,125 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: youshi
|
||||
# 版本
|
||||
version: 3.8.7
|
||||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 文件路径 示例( Windows配置 F:/home/youshi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: F:/home/youshi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 根路径地址 https://youshi.bj.cn/prod-api http://localhost/dev-api
|
||||
baseUrl: http://localhost/dev-api
|
||||
|
||||
rocketmq:
|
||||
name-server: localhost:9876
|
||||
producer:
|
||||
group: abc
|
||||
send-message-timeout: 60000
|
||||
retry-times-when-send-failed: 3
|
||||
retry-times-when-send-async-failed: 3
|
||||
customized-trace-topic: ai
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping: /dev-api
|
||||
|
||||
schedule:
|
||||
enabled: false
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://bj-cdb-7ezuofce.sql.tencentcdb.com:21965/youshi_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: youshi
|
||||
password: youshi@2024
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
|
@ -1,5 +1,70 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: youshi
|
||||
# 版本
|
||||
version: 3.8.7
|
||||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 文件路径 示例( Windows配置 F:/home/youshi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: /home/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 根路径地址 https://youshi.bj.cn/prod-api http://localhost/dev-api
|
||||
baseUrl: https://youshi.bj.cn/prod-api
|
||||
|
||||
|
||||
rocketmq:
|
||||
name-server: 49.232.250.68:9876
|
||||
producer:
|
||||
group: abc
|
||||
send-message-timeout: 60000
|
||||
retry-times-when-send-failed: 3
|
||||
retry-times-when-send-async-failed: 3
|
||||
customized-trace-topic: ai
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: error
|
||||
org.springframework: warn
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: false
|
||||
# 请求前缀
|
||||
pathMapping: /prod-api
|
||||
|
||||
schedule:
|
||||
enabled: true
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 43.140.224.18
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: xxhy@2024
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
|
@ -42,7 +107,7 @@ spring:
|
|||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
enabled: false
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
|
@ -51,7 +116,7 @@ spring:
|
|||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
enabled: false
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
|
@ -0,0 +1,125 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: youshi
|
||||
# 版本
|
||||
version: 3.8.7
|
||||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 文件路径 示例( Windows配置 F:/home/youshi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: F:/home/youshi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 根路径地址 https://youshi.bj.cn/prod-api http://localhost/dev-api
|
||||
baseUrl: http://localhost/dev-api
|
||||
|
||||
rocketmq:
|
||||
name-server: 49.232.250.68:9876
|
||||
producer:
|
||||
group: abc
|
||||
send-message-timeout: 60000
|
||||
retry-times-when-send-failed: 3
|
||||
retry-times-when-send-async-failed: 3
|
||||
customized-trace-topic: ai
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping: /dev-api
|
||||
|
||||
schedule:
|
||||
enabled: false
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 49.232.250.68
|
||||
# 端口,默认
|
||||
port: 16379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: MjJUyaRZ_HDgZ2w_6XxK
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://bj-cdb-7ezuofce.sql.tencentcdb.com:21965/youshi_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: youshi
|
||||
password: youshi@2024
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
|
@ -1,20 +1,3 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: youshi
|
||||
# 版本
|
||||
version: 3.8.7
|
||||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 文件路径 示例( Windows配置 F:/home/youshi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: /home/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 根路径地址 https://youshi.bj.cn/prod-api http://localhost/dev-api
|
||||
baseUrl: https://youshi.bj.cn/prod-api
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
|
@ -33,21 +16,6 @@ server:
|
|||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
rocketmq:
|
||||
name-server: 49.232.250.68:9876
|
||||
producer:
|
||||
group: abc
|
||||
send-message-timeout: 60000
|
||||
retry-times-when-send-failed: 3
|
||||
retry-times-when-send-async-failed: 3
|
||||
customized-trace-topic: ai
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
|
@ -63,7 +31,9 @@ spring:
|
|||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
# active: test
|
||||
active: prod
|
||||
# active: dev
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
@ -76,33 +46,6 @@ spring:
|
|||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 43.140.224.18
|
||||
# host: 49.232.250.68
|
||||
# host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# port: 16379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: xxhy@2024
|
||||
# password: MjJUyaRZ_HDgZ2w_6XxK
|
||||
# password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# token配置
|
||||
token:
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.quartz.JobKey;
|
|||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.common.constant.ScheduleConstants;
|
||||
|
@ -31,6 +32,9 @@ public class SysJobServiceImpl implements ISysJobService
|
|||
@Autowired
|
||||
private SysJobMapper jobMapper;
|
||||
|
||||
@Value("${schedule.enabled}")
|
||||
private Boolean scheduleEnabled;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
|
||||
*/
|
||||
|
@ -38,10 +42,12 @@ public class SysJobServiceImpl implements ISysJobService
|
|||
public void init() throws SchedulerException, TaskException
|
||||
{
|
||||
scheduler.clear();
|
||||
List<SysJob> jobList = jobMapper.selectJobAll();
|
||||
for (SysJob job : jobList)
|
||||
{
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
if(scheduleEnabled){
|
||||
List<SysJob> jobList = jobMapper.selectJobAll();
|
||||
for (SysJob job : jobList)
|
||||
{
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,5 +60,5 @@ public interface IMeituanService {
|
|||
void getReturnInfo(Long id);
|
||||
|
||||
String getComment(Long id);
|
||||
String receiveTime(String storeCode,String cookie,String orderNo);
|
||||
String receiveTime(String getUrl,String storeCode,String cookie,String orderNo);
|
||||
}
|
||||
|
|
|
@ -63,213 +63,164 @@ public class AiConsumer {
|
|||
BusStoreInfo busStoreInfo = mqDataInfo.getStoreInfo();
|
||||
BusOrderInfo busOrderInfo = mqDataInfo.getBusOrderInfo();
|
||||
BusStoreConfigInfo busStoreConfigInfo = mqDataInfo.getBusStoreConfigInfo();
|
||||
// try {
|
||||
// if ("2".equals(busStoreInfo.getReturnVisitStatus())) {
|
||||
// System.out.println("未开启营销的跳出");
|
||||
// return;// 未开启营销的跳出
|
||||
// }
|
||||
// // 配置规则
|
||||
// BusStoreConfigInfo busStoreConfigInfo = new BusStoreConfigInfo();
|
||||
// busStoreConfigInfo.setStoreCode(busStoreInfo.getStoreCode());
|
||||
// busStoreConfigInfo = iBusStoreConfigInfoService.selectBusStoreConfigInfoList(busStoreConfigInfo).get(0);
|
||||
//
|
||||
// List<BusOrderInfo> list = new ArrayList<>();
|
||||
// if ("1".equals(busStoreInfo.getSelfDeliveryStatus())) {
|
||||
// System.out.println("自动营销");
|
||||
// list = orderInfoService.selectBusOrderInfoListToAi(busStoreInfo.getStoreCode(), mqDataInfo.getT1(), mqDataInfo.getT2());
|
||||
// } else if ("2".equals(busStoreInfo.getSelfDeliveryStatus())) {
|
||||
// System.out.println("自配送营销");
|
||||
// LocalDateTime dateTime = LocalDateTime.parse(mqDataInfo.getNow(), dateTimeFormatter);
|
||||
// LocalDateTime tN = dateTime.minusMinutes(busStoreConfigInfo.getSelfDeliveryDuration());
|
||||
// String time = tN.format(dateTimeFormatter);
|
||||
// // 自配送前推时间处理
|
||||
// list = orderInfoService.selectBusZpsOrderInfoListToAi(busStoreInfo.getStoreCode(), time);
|
||||
// }
|
||||
// if (list.size() == 0) return;
|
||||
//
|
||||
// BusAgentInfo agentInfo = agentInfoService.selectBusAgentInfoById(busStoreInfo.getBindId());
|
||||
// List<BusOrderInfo> newList = list.stream().distinct().collect(Collectors.toList());
|
||||
// if (agentInfo == null || "2".equals(agentInfo.getDelStatus())) {
|
||||
// return;
|
||||
// }
|
||||
//// int cha = agentInfoL.get(0).getAiDurationBalance() - agentInfoL.get(0).getAiRealTimeNum();
|
||||
// int cha = agentInfo.getAiDurationBalance();
|
||||
// if (cha < list.size()&&(cha - 1)>0) {
|
||||
// list.subList(0, cha - 1);
|
||||
// System.out.println("积分不足截取部分订单营销");
|
||||
// agentInfo.setAiRealTimeNum(agentInfo.getAiDurationBalance());
|
||||
// } else if(cha < 0){
|
||||
// return;
|
||||
// }
|
||||
//// agentInfoService.updateBusAgentInfo(agentInfoL.get(0));
|
||||
//// } else break;
|
||||
// for (BusOrderInfo busOrderInfo : newList) {
|
||||
try {
|
||||
if(busReturnVisitInfoMapper.returnVisitInfoList(busOrderInfo.getPrivcyPhone())>0){
|
||||
return;
|
||||
}
|
||||
// 拼好饭
|
||||
if ("N".equals(busStoreConfigInfo.getIsSpliceOrder())) { // 否:开启拼好饭订单过滤(不营销拼好饭)
|
||||
if ("2".equals(busOrderInfo.getIsPhf())) {//否:
|
||||
System.out.println("拼好饭拦截成功");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 下单次数
|
||||
if (StringUtils.isEmpty(busOrderInfo.getOrderCount())){
|
||||
return;
|
||||
}
|
||||
int count = Integer.valueOf(busOrderInfo.getOrderCount());
|
||||
if (busStoreConfigInfo.getMaxOrderNum() < count
|
||||
|| count < busStoreConfigInfo.getMinOrderNum()) {
|
||||
System.out.println("下单次数拦截成功");
|
||||
return;
|
||||
}
|
||||
// 营销时间区间
|
||||
LocalTime start = LocalTime.parse(busStoreConfigInfo.getStartTime());
|
||||
LocalTime end = LocalTime.parse(busStoreConfigInfo.getEndTime());
|
||||
// 时区
|
||||
// ZoneId zoneId = ZoneId.systemDefault();
|
||||
LocalDateTime orderDateTime = LocalDateTime.parse(busOrderInfo.getCompleteTime(), dateTimeFormatter);
|
||||
// LocalDateTime orderDateTime = busOrderInfo.getOrderTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
LocalTime orderTime = orderDateTime.toLocalTime();
|
||||
if (orderTime.isBefore(start) || end.isBefore(orderTime)) {
|
||||
System.out.println("营销时间区间拦截成功");
|
||||
return;
|
||||
}
|
||||
// 话术判断 08:00 10:00 11:30 13:30 18:00 20:00
|
||||
String content = "";
|
||||
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){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术1");
|
||||
content = busStoreConfigInfo.getContent1();
|
||||
} else if (time2.isBefore(orderTime) && orderTime.isBefore(time3)) {
|
||||
if(busStoreConfigInfo.getContent2()==null){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术2");
|
||||
content = busStoreConfigInfo.getContent2();
|
||||
} else if (time3.isBefore(orderTime) && orderTime.isBefore(time4)) {
|
||||
if(busStoreConfigInfo.getContent3()==null){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术3");
|
||||
content = busStoreConfigInfo.getContent3();
|
||||
} else {
|
||||
if(busStoreConfigInfo.getContent4()==null){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术4");
|
||||
content = busStoreConfigInfo.getContent4();
|
||||
}
|
||||
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
|
||||
System.out.println("短信话术");
|
||||
content = sysDictDataMapper.selectDictLabel("bus_default_sms_script","default_script");
|
||||
}
|
||||
// 当日此店铺营销限额
|
||||
if ("1".equals(busStoreConfigInfo.getQuotaStatus()) && busStoreConfigInfo.getQuota() != 0){
|
||||
int quota = busReturnVisitInfoMapper.countByToday(busStoreInfo.getStoreCode());
|
||||
if (quota >= busStoreConfigInfo.getQuota()) {
|
||||
System.out.println("当日此店铺营销限额拦截成功");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//加入免运营订单-黑名单的 不营销跳出
|
||||
BusBanOperateInfo busBanOperateInfo = new BusBanOperateInfo();
|
||||
busBanOperateInfo.setBanOperateCode(busOrderInfo.getCustomId());
|
||||
busBanOperateInfo.setBanStatus("1");
|
||||
List<BusBanOperateInfo> list1 = iBusBanOperateInfoService.selectBusBanOperateInfoList(busBanOperateInfo);
|
||||
if (list1.size() > 0) {
|
||||
System.out.println("黑名单拦截成功");
|
||||
return;
|
||||
}
|
||||
BusReturnVisitInfo returnVisitInfo = new BusReturnVisitInfo();
|
||||
returnVisitInfo.setPhoneNumber(busOrderInfo.getPrivcyPhone());
|
||||
// redisTemplate.opsForValue().set(busStoreConfigInfo.getStoreCode() + now.format(dateTimeFormatterNow), quota + "");
|
||||
BusFifteenInfo fifteenInfo = new BusFifteenInfo();
|
||||
fifteenInfo.setCustomId(busOrderInfo.getCustomId());
|
||||
List<BusFifteenInfo> listInfo = fifteenInfoService.selectBusFifteenInfoList(fifteenInfo);
|
||||
|
||||
if (listInfo.size() != 0) {
|
||||
System.out.println("15天拦截=====================");
|
||||
BusAgentInfo busAgentInfo = agentInfo;
|
||||
int a = 1;
|
||||
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
||||
busAgentInfo.setAiDurationBalance(reduce);
|
||||
agentInfoService.updateBusAgentInfo(busAgentInfo);
|
||||
|
||||
BusIntegralRecord record = new BusIntegralRecord();
|
||||
record.setAccount(busAgentInfo.getAgentAccount());
|
||||
record.setIntegralUpdateTime(new Date());
|
||||
record.setUpdateType("消耗账分");
|
||||
record.setIntegralUpdateNum(a);
|
||||
record.setIntegralBalance(reduce);
|
||||
record.setRemark(busOrderInfo.getPrivcyPhone());
|
||||
record.setAgentRemark("其他");
|
||||
integralRecordService.insertBusIntegralRecord(record);
|
||||
returnVisitInfo.setIsCharging("其他");
|
||||
}else {
|
||||
if("AI".equals(busStoreInfo.getMarketingChannels())){
|
||||
aiService.sendAiTask(content,busOrderInfo);
|
||||
returnVisitInfo.setIsCharging("AI");
|
||||
//定时任务15天之前的删除记录 todo
|
||||
fifteenInfo.setCustomId(busOrderInfo.getCustomId());
|
||||
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
|
||||
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
|
||||
aiService.sendSmsTask(content,busOrderInfo);
|
||||
BusAgentInfo busAgentInfo =agentInfo;
|
||||
int a = 1;
|
||||
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
||||
busAgentInfo.setAiDurationBalance(reduce);
|
||||
agentInfoService.updateBusAgentInfo(busAgentInfo);
|
||||
|
||||
BusIntegralRecord record = new BusIntegralRecord();
|
||||
record.setAccount(busAgentInfo.getAgentAccount());
|
||||
record.setIntegralUpdateTime(new Date());
|
||||
record.setUpdateType("消耗账分");
|
||||
record.setIntegralUpdateNum(a);
|
||||
record.setIntegralBalance(reduce);
|
||||
record.setRemark(busOrderInfo.getPrivcyPhone());
|
||||
record.setAgentRemark("sms");
|
||||
integralRecordService.insertBusIntegralRecord(record);
|
||||
returnVisitInfo.setIsCharging("sms");
|
||||
//定时任务15天之前的删除记录 todo
|
||||
fifteenInfo.setCustomId(busOrderInfo.getCustomId());
|
||||
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
|
||||
}else{
|
||||
System.out.println("未配置营销渠道=====================");
|
||||
return;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断是否营销的依据!!!
|
||||
*/
|
||||
List<BusReturnVisitInfo> list2 = busReturnVisitInfoMapper.selectBusReturnVisitInfoList(returnVisitInfo);
|
||||
if (list2.size() > 0) {
|
||||
System.out.println("修改营销事件=====================");
|
||||
returnVisitInfo.setId(list2.get(0).getId());
|
||||
returnVisitInfo.setReturnVisitTime(new Date());
|
||||
busReturnVisitInfoMapper.updateBusReturnVisitInfo(returnVisitInfo);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
try {
|
||||
if(busReturnVisitInfoMapper.returnVisitInfoList(busOrderInfo.getPrivcyPhone())>0){
|
||||
return;
|
||||
}
|
||||
// 拼好饭
|
||||
if ("N".equals(busStoreConfigInfo.getIsSpliceOrder())) { // 否:开启拼好饭订单过滤(不营销拼好饭)
|
||||
if ("2".equals(busOrderInfo.getIsPhf())) {//否:
|
||||
System.out.println("拼好饭拦截成功");
|
||||
return;
|
||||
}
|
||||
// }
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
// 下单次数
|
||||
if (StringUtils.isEmpty(busOrderInfo.getOrderCount())){
|
||||
return;
|
||||
}
|
||||
int count = Integer.valueOf(busOrderInfo.getOrderCount());
|
||||
if (busStoreConfigInfo.getMaxOrderNum() < count
|
||||
|| count < busStoreConfigInfo.getMinOrderNum()) {
|
||||
System.out.println("下单次数拦截成功");
|
||||
return;
|
||||
}
|
||||
// 营销时间区间
|
||||
LocalTime start = LocalTime.parse(busStoreConfigInfo.getStartTime());
|
||||
LocalTime end = LocalTime.parse(busStoreConfigInfo.getEndTime());
|
||||
// 时区
|
||||
LocalDateTime orderDateTime = LocalDateTime.parse(busOrderInfo.getCompleteTime(), dateTimeFormatter);
|
||||
LocalTime orderTime = orderDateTime.toLocalTime();
|
||||
if (orderTime.isBefore(start) || end.isBefore(orderTime)) {
|
||||
System.out.println("营销时间区间拦截成功");
|
||||
return;
|
||||
}
|
||||
// 话术判断 08:00 10:00 11:30 13:30 18:00 20:00
|
||||
String content = "";
|
||||
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){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术1");
|
||||
content = busStoreConfigInfo.getContent1();
|
||||
} else if (time2.isBefore(orderTime) && orderTime.isBefore(time3)) {
|
||||
if(busStoreConfigInfo.getContent2()==null){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术2");
|
||||
content = busStoreConfigInfo.getContent2();
|
||||
} else if (time3.isBefore(orderTime) && orderTime.isBefore(time4)) {
|
||||
if(busStoreConfigInfo.getContent3()==null){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术3");
|
||||
content = busStoreConfigInfo.getContent3();
|
||||
} else {
|
||||
if(busStoreConfigInfo.getContent4()==null){
|
||||
return;
|
||||
}
|
||||
System.out.println("ai话术4");
|
||||
content = busStoreConfigInfo.getContent4();
|
||||
}
|
||||
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
|
||||
System.out.println("短信话术");
|
||||
content = sysDictDataMapper.selectDictLabel("bus_default_sms_script","default_script");
|
||||
}
|
||||
// 当日此店铺营销限额
|
||||
if ("1".equals(busStoreConfigInfo.getQuotaStatus()) && busStoreConfigInfo.getQuota() != 0){
|
||||
int quota = busReturnVisitInfoMapper.countByToday(busStoreInfo.getStoreCode());
|
||||
if (quota >= busStoreConfigInfo.getQuota()) {
|
||||
System.out.println("当日此店铺营销限额拦截成功");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//加入免运营订单-黑名单的 不营销跳出
|
||||
BusBanOperateInfo busBanOperateInfo = new BusBanOperateInfo();
|
||||
busBanOperateInfo.setBanOperateCode(busOrderInfo.getCustomId());
|
||||
busBanOperateInfo.setBanStatus("1");
|
||||
List<BusBanOperateInfo> list1 = iBusBanOperateInfoService.selectBusBanOperateInfoList(busBanOperateInfo);
|
||||
if (list1.size() > 0) {
|
||||
System.out.println("黑名单拦截成功");
|
||||
return;
|
||||
}
|
||||
BusReturnVisitInfo returnVisitInfo = new BusReturnVisitInfo();
|
||||
returnVisitInfo.setPhoneNumber(busOrderInfo.getPrivcyPhone());
|
||||
BusFifteenInfo fifteenInfo = new BusFifteenInfo();
|
||||
fifteenInfo.setCustomId(busOrderInfo.getCustomId());
|
||||
List<BusFifteenInfo> listInfo = fifteenInfoService.selectBusFifteenInfoList(fifteenInfo);
|
||||
|
||||
if (listInfo.size() != 0) {
|
||||
System.out.println("15天拦截=====================");
|
||||
BusAgentInfo busAgentInfo = agentInfo;
|
||||
int a = 1;
|
||||
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
||||
busAgentInfo.setAiDurationBalance(reduce);
|
||||
agentInfoService.updateBusAgentInfo(busAgentInfo);
|
||||
|
||||
BusIntegralRecord record = new BusIntegralRecord();
|
||||
record.setAccount(busAgentInfo.getAgentAccount());
|
||||
record.setIntegralUpdateTime(new Date());
|
||||
record.setUpdateType("消耗账分");
|
||||
record.setIntegralUpdateNum(a);
|
||||
record.setIntegralBalance(reduce);
|
||||
record.setRemark(busOrderInfo.getPrivcyPhone());
|
||||
record.setAgentRemark("其他");
|
||||
integralRecordService.insertBusIntegralRecord(record);
|
||||
returnVisitInfo.setIsCharging("其他");
|
||||
}else {
|
||||
if("AI".equals(busStoreInfo.getMarketingChannels())){
|
||||
aiService.sendAiTask(content,busOrderInfo);
|
||||
returnVisitInfo.setIsCharging("AI");
|
||||
//定时任务15天之前的删除记录 todo
|
||||
fifteenInfo.setCustomId(busOrderInfo.getCustomId());
|
||||
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
|
||||
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
|
||||
aiService.sendSmsTask(content,busOrderInfo);
|
||||
BusAgentInfo busAgentInfo =agentInfo;
|
||||
int a = 1;
|
||||
int reduce = busAgentInfo.getAiDurationBalance() - a;
|
||||
busAgentInfo.setAiDurationBalance(reduce);
|
||||
agentInfoService.updateBusAgentInfo(busAgentInfo);
|
||||
|
||||
BusIntegralRecord record = new BusIntegralRecord();
|
||||
record.setAccount(busAgentInfo.getAgentAccount());
|
||||
record.setIntegralUpdateTime(new Date());
|
||||
record.setUpdateType("消耗账分");
|
||||
record.setIntegralUpdateNum(a);
|
||||
record.setIntegralBalance(reduce);
|
||||
record.setRemark(busOrderInfo.getPrivcyPhone());
|
||||
record.setAgentRemark("sms");
|
||||
integralRecordService.insertBusIntegralRecord(record);
|
||||
returnVisitInfo.setIsCharging("sms");
|
||||
//定时任务15天之前的删除记录 todo
|
||||
fifteenInfo.setCustomId(busOrderInfo.getCustomId());
|
||||
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
|
||||
}else{
|
||||
System.out.println("未配置营销渠道=====================");
|
||||
return;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断是否营销的依据!!!
|
||||
*/
|
||||
List<BusReturnVisitInfo> list2 = busReturnVisitInfoMapper.selectBusReturnVisitInfoList(returnVisitInfo);
|
||||
if (list2.size() > 0) {
|
||||
System.out.println("修改营销事件=====================");
|
||||
returnVisitInfo.setId(list2.get(0).getId());
|
||||
returnVisitInfo.setReturnVisitTime(new Date());
|
||||
busReturnVisitInfoMapper.updateBusReturnVisitInfo(returnVisitInfo);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
System.out.println(("一共耗时time: " + (System.currentTimeMillis() - startTime) / 1000 + " s"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -461,7 +461,7 @@ public class MeituanServiceImpl implements IMeituanService {
|
|||
|
||||
orderInfo.setStoreName(storeInfo1.getStoreName());
|
||||
|
||||
String reachTime = receiveTime(wmPoiId,cookie,wmOrderViewId);
|
||||
String reachTime = receiveTime(getUrl,wmPoiId,cookie,wmOrderViewId);
|
||||
|
||||
orderInfo.setCompleteTime(date+" "+reachTime);
|
||||
orderInfo.setOrderStatus(statusDesc);
|
||||
|
@ -594,15 +594,15 @@ public class MeituanServiceImpl implements IMeituanService {
|
|||
jsonObject = JSONObject.parseObject(resp);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
// jsonObject.put("code","403");
|
||||
orderInfo(valueFromCookie("wmPoiId", cookie), date, cookie);
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String receiveTime(String storeCode,String cookie,String orderNo){
|
||||
CloseableHttpClient client = proxyHttpClient();
|
||||
public String receiveTime(String getUrl,String storeCode,String cookie,String orderNo){
|
||||
CloseableHttpClient client = proxyHttpClient(getUrl);
|
||||
String url = "https://e.waimai.meituan.com/api/logistics/logs";
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("region_id", valueFromCookie("region_id",cookie));
|
||||
|
@ -1053,6 +1053,8 @@ public class MeituanServiceImpl implements IMeituanService {
|
|||
|
||||
// private CloseableHttpClient proxyHttpClient() {
|
||||
private CloseableHttpClient proxyHttpClient(String ipPort) {
|
||||
// JDK 8u111版本后,目标页面为HTTPS协议,启用proxy用户密码鉴权
|
||||
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
|
||||
String proxyHost = ipPort.split(":")[0];
|
||||
int proxyPort = Integer.valueOf(ipPort.split(":")[1]);
|
||||
String username = proxyProperties.getAccount();
|
||||
|
@ -1105,6 +1107,8 @@ public class MeituanServiceImpl implements IMeituanService {
|
|||
// }
|
||||
}
|
||||
private CloseableHttpClient proxyHttpClient() {
|
||||
// JDK 8u111版本后,目标页面为HTTPS协议,启用proxy用户密码鉴权
|
||||
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
|
||||
String proxyHost = proxyProperties.getProxyAddr();
|
||||
int proxyPort = proxyProperties.getProxyPort();
|
||||
String username = proxyProperties.getAccount();
|
||||
|
|
Loading…
Reference in New Issue