1;短信、ai账分切分-个人账户显示

This commit is contained in:
wangshuai 2024-08-09 11:58:00 +08:00
parent 596de3b497
commit 69708a890e
12 changed files with 76 additions and 30 deletions

View File

@ -97,8 +97,12 @@ public class BusStoreInfoController extends BaseController {
@GetMapping("/getNowIntegral")
public AjaxResult getNowIntegral() {
String username = SecurityUtils.getLoginUser().getUsername();
Map<String, String> map = new HashMap();
if("admin".equals(username)){
return AjaxResult.success("-");
map.put("nowSmsIntegral","-");
map.put("nowAiIntegral","-");
return AjaxResult.success(map);
// return AjaxResult.success("-");
}
BusAgentInfo info = new BusAgentInfo();
info.setAgentAccount(SecurityUtils.getLoginUser().getUsername());
@ -106,7 +110,10 @@ public class BusStoreInfoController extends BaseController {
List<BusAgentInfo> list = agentInfoService.selectBusAgentInfoList(info);
if(list.size() == 1){
BusAgentInfo temp = agentInfoService.selectBusAgentInfoList(info).get(0);
return AjaxResult.success(temp.getAiDurationBalance());
map.put("nowSmsIntegral",temp.getAiDurationBalance()+"");
map.put("nowAiIntegral",temp.getAiRealTimeNum()+"");
return AjaxResult.success(map);
// return AjaxResult.success(temp.getAiDurationBalance());
}
throw new ServiceException("查询代理人积分异常!");
}

View File

@ -60,4 +60,6 @@ public interface BusSmsInfoMapper
public int deleteBusSmsInfoByIds(Long[] ids);
BusSmsInfo selectBusSmsInfoByNum(String limitNum);
void updateBusSmsRechargeNum(Long id);
}

View File

@ -68,4 +68,6 @@ public interface BusStoreDayHistoryInfoMapper
List<BusStoreDayHistoryInfo> selectBusStoreDayHistoryInfoListByDate(@Param("id") Long id,@Param("date") String date);
void insertBatchStoreDayHistoryInfo(@Param("addList") List<BusStoreDayHistoryInfo> addList);
void updateBatchStoreDayHistoryInfo(@Param("editList") List<BusStoreDayHistoryInfo> editList);
}

View File

@ -75,7 +75,6 @@ public class AiConsumer {
// 拼好饭
if ("N".equals(busStoreConfigInfo.getIsSpliceOrder())) { // 开启拼好饭订单过滤(不营销拼好饭)
if ("2".equals(busOrderInfo.getIsPhf())) {//
System.out.println("拼好饭拦截成功");
return;
}
}
@ -87,7 +86,6 @@ public class AiConsumer {
int count = Integer.valueOf(busOrderInfo.getOrderCount());
if (busStoreConfigInfo.getMaxOrderNum() < count
|| count < busStoreConfigInfo.getMinOrderNum()) {
System.out.println("下单次数拦截成功");
return;
}
// 营销时间区间
@ -97,7 +95,6 @@ public class AiConsumer {
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
@ -111,36 +108,30 @@ public class AiConsumer {
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;
}
}
@ -150,7 +141,6 @@ public class AiConsumer {
busBanOperateInfo.setBanStatus("1");
List<BusBanOperateInfo> list1 = iBusBanOperateInfoService.selectBusBanOperateInfoList(busBanOperateInfo);
if (list1.size() > 0) {
System.out.println("黑名单拦截成功");
return;
}
BusReturnVisitInfo returnVisitInfo = new BusReturnVisitInfo();
@ -160,7 +150,7 @@ public class AiConsumer {
List<BusFifteenInfo> listInfo = fifteenInfoService.selectBusFifteenInfoList(fifteenInfo);
if (listInfo.size() != 0) {
System.out.println("15天拦截=====================");
log.error("15天拦截=====================");
BusAgentInfo busAgentInfo = agentInfo;
BusIntegralRecord record = new BusIntegralRecord();
int a = 1;
@ -221,7 +211,7 @@ public class AiConsumer {
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
}else{
System.out.println("未配置营销渠道=====================");
log.error("未配置营销渠道=====================");
return;
}
}

View File

@ -8,6 +8,7 @@ import com.ruoyi.business.mapper.BusReturnVisitInfoMapper;
import com.ruoyi.business.mapper.BusSmsInfoMapper;
import com.ruoyi.business.service.*;
import com.ruoyi.common.config.BusTencentProperties;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.HttpClientUtilT;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDictDataMapper;
@ -316,10 +317,10 @@ public class AiServiceImpl implements IAiService {
}
@Override
@Transactional(rollbackFor = ServiceException.class)
public void sendSmsTask(String content, BusOrderInfo busOrderInfo) {
lock.lock();
try {
BusSmsInfo busSmsInfo = new BusSmsInfo();
String limitNum = Optional.ofNullable(redisTemplate.opsForValue().get("limitNum")).orElse(null);
BusSmsInfo busSmsInfo1 = busSmsInfoMapper.selectBusSmsInfoByNum(limitNum);
if(busSmsInfo1 == null){
@ -337,9 +338,7 @@ public class AiServiceImpl implements IAiService {
redisTemplate.opsForValue().set("limitNum",busSmsInfo1.getLimitNum()+"");
redisTemplate.opsForValue().set("totalNum",busSmsInfo1.getTotalNum()+"");
}
busSmsInfo.setId(busSmsInfo1.getId());
busSmsInfo.setRechargeNum(busSmsInfo1.getRechargeNum()+1);
busSmsInfoMapper.updateBusSmsInfo(busSmsInfo);
busSmsInfoMapper.updateBusSmsRechargeNum(busSmsInfo1.getId());
String phoneNo = busOrderInfo.getPrivcyPhone().split(",")[0];//#分机号#
content = content.replaceAll("分机号",busOrderInfo.getPrivcyPhone().split(",")[1]);
@ -353,6 +352,7 @@ public class AiServiceImpl implements IAiService {
} catch (Exception e) {
e.printStackTrace();
log.error("建立sendSmsTask错误 ",e.getMessage());
throw new ServiceException("短信发送失败!");
}finally {
lock.unlock();
}

View File

@ -365,7 +365,7 @@ public class MeituanServiceImpl implements IMeituanService {
JSONArray array = jsonObject.getJSONArray("data");
JSONObject one = array.getJSONObject(3);
String total = one.getString("base");
log.error("昨日订单量总数",total);
log.error("昨日订单量总数"+total);
BusStoreInfo store = new BusStoreInfo();
store.setStoreCode(wmPoiId);
List<BusStoreInfo> list = busStoreInfoService.selectBusStoreInfoList(store);
@ -900,11 +900,20 @@ public class MeituanServiceImpl implements IMeituanService {
target.setId(null);
target.setCreateTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant()));
addList.add(target);
}else{
BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo();
BeanUtils.copyProperties(busStoreDayInfo, target);
target.setId(null);
target.setCreateTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant()));
editList.add(target);
}
}
if(addList.size()>0){
busStoreDayHistoryInfoMapper.insertBatchStoreDayHistoryInfo(addList);
}
if(editList.size()>0){
busStoreDayHistoryInfoMapper.updateBatchStoreDayHistoryInfo(editList);
}
}
private String getRate(int a, int b){

View File

@ -72,7 +72,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="platform != null and platform != ''"> and platform = #{platform}</if>
<if test="updateType != null and updateType != ''"> and update_type = #{updateType}</if>
<if test="integralUpdateTime != null "> and DATE_FORMAT(Integral_update_time,'%Y-%m-%d') = DATE_FORMAT(#{integralUpdateTime},'%Y-%m-%d')</if>
<if test="integralUpdateTime == null "> and DATE_FORMAT(Integral_update_time,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d')</if>
<if test="agentRemark != null and agentRemark != ''"> and agent_remark = #{agentRemark}</if>
<if test="agentAccount != null">
and account in

View File

@ -89,6 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateBusSmsRechargeNum" parameterType="Long">
update bus_sms_info set recharge_num = recharge_num+1 where id = #{id}
</update>
<delete id="deleteBusSmsInfoById" parameterType="Long">
delete from bus_sms_info where id = #{id}

View File

@ -151,6 +151,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateBatchStoreDayHistoryInfo">
<foreach collection="editList" item="item" separator=";">
update bus_store_day_history_info
<trim prefix="SET" suffixOverrides=",">
<if test="item.storeId != null">store_id = #{item.storeId},</if>
<if test="item.lastOrderNum != null">last_order_num = #{item.lastOrderNum},</if>
<if test="item.lastPositiveReviewsNum != null">last_positive_reviews_num = #{item.lastPositiveReviewsNum},</if>
<if test="item.lastFiveStarReviewsNum != null">last_five_star_reviews_num = #{item.lastFiveStarReviewsNum},</if>
<if test="item.lastReturnVisitNum != null">last_return_visit_num = #{item.lastReturnVisitNum},</if>
<if test="item.lastReturnVisitRate != null">last_return_visit_rate = #{item.lastReturnVisitRate},</if>
<if test="item.todayReturnVisitNum != null">today_return_visit_num = #{item.todayReturnVisitNum},</if>
<if test="item.score != null">score = #{item.score},</if>
<if test="item.createTime != null">create_time = #{item.createTime},</if>
</trim>
where id = #{item.id}
</foreach>
</update>
<delete id="deleteBusStoreDayHistoryInfoById" parameterType="Long">
delete from bus_store_day_history_info where id = #{id}

View File

@ -140,7 +140,7 @@
<el-form-item label="开启数量" ><span>{{map.openCount}}</span></el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="当前账分:"><span>{{nowIntegral}}</span></el-form-item>
<!-- <el-form-item label="当前账分:"><span>{{nowIntegral}}</span></el-form-item> -->
</el-col>
</el-row>
@ -173,6 +173,8 @@
v-hasPermi="['system:role:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5" class="top-right-btn"><el-button size="mini" type="error">当前普通账分{{nowAiIntegral}}</el-button></el-col>
<el-col :span="1.5" class="top-right-btn"><el-button size="mini" type="error">当前安全账分{{nowSmsIntegral}}</el-button></el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -424,7 +426,8 @@ export default {
meituanUrl: "https://e.waimai.meituan.com?ABC="+this.$store.state.user.name+":1",
//
loading: true,
nowIntegral: 0,
nowSmsIntegral: 0,
nowAiIntegral: 0,
//
ids: [],
//
@ -520,7 +523,10 @@ export default {
},
getNowIntegral() {
nowIntegral().then(response => {
this.nowIntegral = response.data;
// this.nowSmsIntegral = response.data;
// this.nowAiIntegral = '-';
this.nowSmsIntegral = response.data.nowSmsIntegral;
this.nowAiIntegral = response.data.nowAiIntegral;
}
);
},

View File

@ -140,7 +140,7 @@
<el-form-item label="开启数量:"><span>{{map.openCount}}</span></el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="当前账分:"><span>{{nowIntegral}}</span></el-form-item>
<!-- <el-form-item label="当前账分:"><span>{{nowIntegral}}</span></el-form-item> -->
</el-col>
</el-row>
@ -189,7 +189,8 @@
@click="projectType"
>默认话术</el-button>
</el-col>
<!-- <el-col :span="1.5" class="top-right-btn"><el-button size="mini" type="error">当前账分{{nowIntegral}}</el-button></el-col> -->
<el-col :span="1.5" class="top-right-btn"><el-button size="mini" type="error">当前普通账分{{nowAiIntegral}}</el-button></el-col>
<el-col :span="1.5" class="top-right-btn"><el-button size="mini" type="error">当前安全账分{{nowSmsIntegral}}</el-button></el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -505,7 +506,8 @@ export default {
//
title: "",
title1: "",
nowIntegral: 0,
nowSmsIntegral: 0,
nowAiIntegral: 0,
//
open: false,
open1: false,
@ -630,7 +632,10 @@ export default {
},
getNowIntegral() {
nowIntegral().then(response => {
this.nowIntegral = response.data;
// this.nowSmsIntegral = response.data;
// this.nowAiIntegral = '-';
this.nowSmsIntegral = response.data.nowSmsIntegral;
this.nowAiIntegral = response.data.nowAiIntegral;
}
);
},

View File

@ -142,7 +142,7 @@
<el-form-item label="开启数量" ><span>{{map.openCount}}</span></el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="当前账分:"><span>{{nowIntegral}}</span></el-form-item>
<!-- <el-form-item label="当前账分:"><span>{{nowIntegral}}</span></el-form-item> -->
</el-col>
</el-row>
@ -174,6 +174,8 @@
@click="handleExport"
>导出</el-button>
</el-col>
<el-col :span="1.5" class="top-right-btn"><el-button size="mini" type="error">当前普通账分{{nowAiIntegral}}</el-button></el-col>
<el-col :span="1.5" class="top-right-btn"><el-button size="mini" type="error">当前安全账分{{nowSmsIntegral}}</el-button></el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -285,7 +287,8 @@ export default {
//
ids: [],
dateRange: [],
nowIntegral: 0,
nowSmsIntegral: 0,
nowAiIntegral: 0,
//
single: true,
//
@ -399,7 +402,10 @@ export default {
},
getNowIntegral() {
nowIntegral().then(response => {
this.nowIntegral = response.data;
// this.nowSmsIntegral = response.data;
// this.nowAiIntegral = '-';
this.nowSmsIntegral = response.data.nowSmsIntegral;
this.nowAiIntegral = response.data.nowAiIntegral;
}
);
},