增加回访15天记录

This commit is contained in:
Lenovo 2024-07-08 15:18:09 +08:00
parent e9a9653c07
commit 2989e9f6b2
10 changed files with 390 additions and 36 deletions

View File

@ -4,19 +4,16 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.business.domain.BusAiInfo;
import com.ruoyi.business.domain.BusFifteenInfo;
import com.ruoyi.business.domain.BusOrderInfo;
import com.ruoyi.business.domain.SysCookie;
import com.ruoyi.business.service.IAiService;
import com.ruoyi.business.service.IBusAiInfoService;
import com.ruoyi.business.service.IBusOrderInfoService;
import com.ruoyi.business.service.IMeituanService;
import com.ruoyi.business.service.*;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.HttpClientUtilT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -31,21 +28,26 @@ public class AiController {
@Autowired
private IAiService aiService;
@Autowired
private IBusOrderInfoService orderInfoService;
@Autowired
private IBusFifteenInfoService fifteenInfoService;
@GetMapping(value = "/addAiTask")
public R addAiTask(String phoneNum, String virtualPhone) throws Exception
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String[] phone = {"14745230752,0269","14743647579,5126","14743668724,5124"};
// ,"15710735021,0938","15702041692,5116","14745230954,7539","18688423029,4964"
// ,"14743659441,5088","14750080943,8848","14745230804,5906"
String[] phone = {"14743668724,5124","15702041692,5116","18688423029,4964"
,"14743659441,5088","14750080943,8848"};
for (String ss :phone){
String[] ph = ss.split(",");
aiService.addAiTask("外卖商户","客户",ph[0], ph[1]);
BusOrderInfo temp = new BusOrderInfo();
temp.setPrivcyPhone(ss);
temp = orderInfoService.selectBusOrderInfoList(temp).get(0);
BusFifteenInfo fifteenInfo = new BusFifteenInfo();
fifteenInfo.setCustomId(temp.getCustomId());
List<BusFifteenInfo> list = fifteenInfoService.selectBusFifteenInfoList(fifteenInfo);
if (list.size() == 0) {
aiService.addAiTask("外卖商户", "客户", ss.split(",")[0], ss.split(",")[1]);
}
}
// List<BusOrderInfo> list = orderInfoService.selectBusOrderInfoList(orderInfo);
@ -59,12 +61,6 @@ public class AiController {
return R.ok();
}
@GetMapping(value = "/appendAiTask")
public R appendAiTask(String phoneNum, String virtualPhone)
{
return aiService.appendAiTask(phoneNum, virtualPhone);
}
@GetMapping(value = "/queryAiTask")
public void queryAiTask()
{

View File

@ -50,7 +50,10 @@ public class MeituanController {
*/
@GetMapping("/getOrders")
public R orders(String wmPoiId, String date, String cookie) {
return iMeituanService.orderInfo(wmPoiId, date, cookie);
String ck = "WEBDFPID=1720313779673YKASQECfd79fef3d01d5e9aadc18ccd4d0c95072894-1720313779673-1720313779673YKASQECfd79fef3d01d5e9aadc18ccd4d0c95072894; _lxsdk_cuid=1908ab11622c8-05c631efe52fbf-26031d51-1fa400-1908ab11623c8; _lxsdk=1908ab11622c8-05c631efe52fbf-26031d51-1fa400-1908ab11623c8; device_uuid=!add95b49-6d31-414c-b096-458e40b710e0; uuid_update=true; shopCategory=food; JSESSIONID=166osatxa3vej17siwfi3kfzso; logan_session_token=y5xcyzjk6epwp80j79nx; acctId=160394866; token=0vqM7ZAhWG5gEXioWJq2CpJTDb5vmeQ64StlZHudt6Pk*; wmPoiId=18277065; isOfflineSelfOpen=0; city_id=440100; isChain=0; ignore_set_router_proxy=false; region_id=1000440100; region_version=1687236854; set_info=%7B%22ignoreSetRouterProxy%22%3Afalse%2C%22region_id%22%3A%221000440100%22%2C%22region_version%22%3A1687236854%2C%22wmPoiId%22%3A18277065%7D; bsid=LA-NjGQthUuIAYmATre3dMUaeO3fwl-hrGQwBLxOUSxeJmBKyXpk1tC7WdiUH4UoqHDtHHYPiymWJM5KJ80Vag; city_location_id=440100; location_id=440103; wpush_server_url=wss%3A%2F%2Fwpush.meituan.com; has_not_waimai_poi=0; _lxsdk_s=1908ab11624-5f4-1f2-8a6%7C%7C5";
String d = "2024-07-07";
String poiId = "18277065";
return iMeituanService.orderInfo(poiId, d, ck);
}

View File

@ -0,0 +1,66 @@
package com.ruoyi.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 回访记录15天信息对象 bus_fifteen_info
*
* @author ruoyi
* @date 2024-07-08
*/
public class BusFifteenInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 顾客ID */
@Excel(name = "顾客ID")
private String customId;
/** 上次回访时间 */
private String lastVisitTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCustomId(String customId)
{
this.customId = customId;
}
public String getCustomId()
{
return customId;
}
public void setLastVisitTime(String lastVisitTime)
{
this.lastVisitTime = lastVisitTime;
}
public String getLastVisitTime()
{
return lastVisitTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("customId", getCustomId())
.append("lastVisitTime", getLastVisitTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.BusFifteenInfo;
/**
* 回访记录15天信息Mapper接口
*
* @author ruoyi
* @date 2024-07-08
*/
public interface BusFifteenInfoMapper
{
/**
* 查询回访记录15天信息
*
* @param id 回访记录15天信息主键
* @return 回访记录15天信息
*/
public BusFifteenInfo selectBusFifteenInfoById(Long id);
/**
* 查询回访记录15天信息列表
*
* @param busFifteenInfo 回访记录15天信息
* @return 回访记录15天信息集合
*/
public List<BusFifteenInfo> selectBusFifteenInfoList(BusFifteenInfo busFifteenInfo);
/**
* 新增回访记录15天信息
*
* @param busFifteenInfo 回访记录15天信息
* @return 结果
*/
public int insertBusFifteenInfo(BusFifteenInfo busFifteenInfo);
/**
* 修改回访记录15天信息
*
* @param busFifteenInfo 回访记录15天信息
* @return 结果
*/
public int updateBusFifteenInfo(BusFifteenInfo busFifteenInfo);
/**
* 删除回访记录15天信息
*
* @param id 回访记录15天信息主键
* @return 结果
*/
public int deleteBusFifteenInfoById(Long id);
/**
* 批量删除回访记录15天信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBusFifteenInfoByIds(Long[] ids);
}

View File

@ -16,7 +16,7 @@ public interface IAiService
* @param virtualPhone
*/
R addAiTask(String storeName,String remark,String phoneNo,String virtualPhone);
R appendAiTask(String phoneNo,String virtualPhone);
// R appendAiTask(String phoneNo,String virtualPhone);
void queryAiTask();
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.business.service;
import java.util.List;
import com.ruoyi.business.domain.BusFifteenInfo;
/**
* 回访记录15天信息Service接口
*
* @author ruoyi
* @date 2024-07-08
*/
public interface IBusFifteenInfoService
{
/**
* 查询回访记录15天信息
*
* @param id 回访记录15天信息主键
* @return 回访记录15天信息
*/
public BusFifteenInfo selectBusFifteenInfoById(Long id);
/**
* 查询回访记录15天信息列表
*
* @param busFifteenInfo 回访记录15天信息
* @return 回访记录15天信息集合
*/
public List<BusFifteenInfo> selectBusFifteenInfoList(BusFifteenInfo busFifteenInfo);
/**
* 新增回访记录15天信息
*
* @param busFifteenInfo 回访记录15天信息
* @return 结果
*/
public int insertBusFifteenInfo(BusFifteenInfo busFifteenInfo);
/**
* 修改回访记录15天信息
*
* @param busFifteenInfo 回访记录15天信息
* @return 结果
*/
public int updateBusFifteenInfo(BusFifteenInfo busFifteenInfo);
/**
* 批量删除回访记录15天信息
*
* @param ids 需要删除的回访记录15天信息主键集合
* @return 结果
*/
public int deleteBusFifteenInfoByIds(Long[] ids);
/**
* 删除回访记录15天信息信息
*
* @param id 回访记录15天信息主键
* @return 结果
*/
public int deleteBusFifteenInfoById(Long id);
}

View File

@ -3,11 +3,9 @@ package com.ruoyi.business.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.business.domain.BusAgentInfo;
import com.ruoyi.business.domain.BusAiInfo;
import com.ruoyi.business.domain.BusOrderInfo;
import com.ruoyi.business.domain.BusStoreInfo;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.mapper.BusAgentInfoMapper;
import com.ruoyi.business.mapper.BusFifteenInfoMapper;
import com.ruoyi.business.service.*;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.HttpClientUtilT;
@ -35,6 +33,8 @@ public class AiServiceImpl implements IAiService
private IBusStoreInfoService storeInfoService;
@Autowired
private IBusAgentInfoService agentInfoService;
@Autowired
private IBusFifteenInfoService fifteenInfoService;
private static String aKey;
private static String uSn;
@ -59,12 +59,12 @@ public class AiServiceImpl implements IAiService
System.out.println("login 返回:===========apikey,userSn,projectSn============="+apiKey+","+userSn+","+projectSn);
String projectSn1 = projectSn.split(",")[1];
aKey = apiKey;
uSn = userSn;
pSn = projectSn1;
// aKey = apiKey;
// uSn = userSn;
// pSn = projectSn1;
String requestJson = "{\"api_key\": \""+apiKey+"\",\"user_sn\": \""+userSn+"\",\"source\": \""+storeName+"\",\"project_sn\": \""+projectSn1+"\",\"ai_user_sn\": \"SYSUSER|2665bcca63a2b5c724095fa01dce0470\",\"is_zidong\": \"on\",\"client_info_json\": {\"data\": [{\"姓名\": \""+storeName+"\",\"电话\": \""+phoneNo+"\",\"备注\": \"客户\",\"虚拟分机号\": \""+virtualPhone+"\"}]},\"is_open_second_dialing\": \"1\",\n" +
"\"is_open_remove_duplication\": \"0\",\"dial_task_main_sn\": \"20240621203741220560000000000034\",\"is_append\": \"0\"}";
"\"is_open_remove_duplication\": \"0\",\"is_append\": \"0\"}";
String requestUrl = "https://ai002.ciopaas.com/api/addJsonOfAsync";
String requestResult = HttpClientUtilT.doPostJson(requestUrl,header,requestJson);
JSONObject jo = JSONObject.parseObject(requestResult);
@ -73,14 +73,16 @@ public class AiServiceImpl implements IAiService
String taskMainId = data1.getString("dial_task_main_id");
String taskMainSn = data1.getString("dial_task_main_sn");
dialTaskMainSn = taskMainSn;
// dialTaskMainSn = taskMainSn;
// JSONArray jsonArray = jsonObject.getJSONArray("list");
// JSONObject joo = jsonArray.getJSONObject(0);
// String taskMainSn1 = joo.getString("dial_task_main_sn");
// System.out.println(taskMainSn1);
System.out.println("建立任务返回: ============taskMainId,taskMainSn==========="+taskMainId+","+taskMainSn);
return R.ok(taskMainSn);
appendAiTask(phoneNo,virtualPhone,apiKey,userSn,projectSn,taskMainSn);
return R.ok();
} else {
System.out.println("建立任务接口返回错误: " + jo.toString());
}
@ -90,8 +92,7 @@ public class AiServiceImpl implements IAiService
return R.fail();
}
@Override
public R appendAiTask(String phoneNo, String virtualPhone) {
public R appendAiTask(String phoneNo, String virtualPhone,String aKey, String uSn,String pSn,String dialTaskMainSn) {
String requestJson = "{\"api_key\": \""+aKey+"\",\"user_sn\": \""+uSn+"\",\"source\": \"测试任务\",\"project_sn\": \""+pSn+"\",\"ai_user_sn\": \"SYSUSER|2665bcca63a2b5c724095fa01dce0470\",\"is_zidong\": \"on\",\"client_info_json\": {\"data\": [{\"姓名\": \"ws测试\",\"电话\": \""+phoneNo+"\",\"备注\": \"门店新客\",\"虚拟分机号\": \""+virtualPhone+"\"}]},\"is_open_second_dialing\": \"1\",\n" +
"\"is_open_remove_duplication\": \"0\",\"dial_task_main_sn\": \""+dialTaskMainSn+"\",\"is_append\": \"1\"}";
String requestUrl = "https://ai002.ciopaas.com/api/addJsonOfAsync";
@ -164,8 +165,10 @@ public class AiServiceImpl implements IAiService
aiInfo.setSource(source);
try {
aiInfoService.insertBusAiInfo(aiInfo);
if (Integer.valueOf(talktimes) > 0) {
long saveId = aiInfo.getId();
reduceIntegral(saveId);
}
}catch (Exception e) {
System.out.println(id+"duplicate");
}
@ -200,5 +203,12 @@ public class AiServiceImpl implements IAiService
}
}
}
//定时任务15天后删除记录 todo
BusFifteenInfo fifteenInfo = new BusFifteenInfo();
fifteenInfo.setCustomId(temp.get(0).getCustomId());
fifteenInfo.setLastVisitTime(aiInfo.getDisconnectedAt());
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
}
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.business.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusFifteenInfoMapper;
import com.ruoyi.business.domain.BusFifteenInfo;
import com.ruoyi.business.service.IBusFifteenInfoService;
/**
* 回访记录15天信息Service业务层处理
*
* @author ruoyi
* @date 2024-07-08
*/
@Service
public class BusFifteenInfoServiceImpl implements IBusFifteenInfoService
{
@Autowired
private BusFifteenInfoMapper busFifteenInfoMapper;
/**
* 查询回访记录15天信息
*
* @param id 回访记录15天信息主键
* @return 回访记录15天信息
*/
@Override
public BusFifteenInfo selectBusFifteenInfoById(Long id)
{
return busFifteenInfoMapper.selectBusFifteenInfoById(id);
}
/**
* 查询回访记录15天信息列表
*
* @param busFifteenInfo 回访记录15天信息
* @return 回访记录15天信息
*/
@Override
public List<BusFifteenInfo> selectBusFifteenInfoList(BusFifteenInfo busFifteenInfo)
{
return busFifteenInfoMapper.selectBusFifteenInfoList(busFifteenInfo);
}
/**
* 新增回访记录15天信息
*
* @param busFifteenInfo 回访记录15天信息
* @return 结果
*/
@Override
public int insertBusFifteenInfo(BusFifteenInfo busFifteenInfo)
{
return busFifteenInfoMapper.insertBusFifteenInfo(busFifteenInfo);
}
/**
* 修改回访记录15天信息
*
* @param busFifteenInfo 回访记录15天信息
* @return 结果
*/
@Override
public int updateBusFifteenInfo(BusFifteenInfo busFifteenInfo)
{
return busFifteenInfoMapper.updateBusFifteenInfo(busFifteenInfo);
}
/**
* 批量删除回访记录15天信息
*
* @param ids 需要删除的回访记录15天信息主键
* @return 结果
*/
@Override
public int deleteBusFifteenInfoByIds(Long[] ids)
{
return busFifteenInfoMapper.deleteBusFifteenInfoByIds(ids);
}
/**
* 删除回访记录15天信息信息
*
* @param id 回访记录15天信息主键
* @return 结果
*/
@Override
public int deleteBusFifteenInfoById(Long id)
{
return busFifteenInfoMapper.deleteBusFifteenInfoById(id);
}
}

View File

@ -220,14 +220,14 @@ public class MeituanServiceImpl implements IMeituanService {
Object o = array.get(i);
JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o));
JSONObject order0 = oj.getJSONObject("orderInfo");
JSONObject commonInfo = oj.getJSONObject("commonInfo");
JSONObject order1 = order0.getJSONObject("orderInfo");
JSONObject expectTimeVo = order1.getJSONObject("expectTimeVo");
JSONObject userInfo = order1.getJSONObject("userInfo");
String daySeq = order1.getString("dayseq");
String wmOrderViewId = order1.getString("wmOrderViewId");
String expectTime = expectTimeVo.getString("expectTimeFmt");
String statusDesc = order1.getString("statusDesc");
String userId = userInfo.getString("wmUserId");
String userId = commonInfo.getString("wmUserId");
String redisDaySeq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null);
if (redisDaySeq == null) {
redisTemplate.opsForValue().set(key, daySeq);
@ -240,7 +240,10 @@ public class MeituanServiceImpl implements IMeituanService {
break;
}
}
orderInfo.setId(new Random().nextLong());
String s = String.valueOf(new Random().nextLong());
String nextId = s.substring(1,s.length());
orderInfo.setId(Long.valueOf(nextId));
orderInfo.setStoreCode(wmPoiId);
orderInfo.setDayseq(daySeq);
orderInfo.setOrderNo(wmOrderViewId);
orderInfo.setCompleteTime(expectTime);

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.BusFifteenInfoMapper">
<resultMap type="BusFifteenInfo" id="BusFifteenInfoResult">
<result property="id" column="id" />
<result property="customId" column="custom_id" />
<result property="lastVisitTime" column="last_visit_time" />
</resultMap>
<sql id="selectBusFifteenInfoVo">
select id, custom_id, last_visit_time from bus_fifteen_info
</sql>
<select id="selectBusFifteenInfoList" parameterType="BusFifteenInfo" resultMap="BusFifteenInfoResult">
<include refid="selectBusFifteenInfoVo"/>
<where>
<if test="customId != null and customId != ''"> and custom_id = #{customId}</if>
<if test="lastVisitTime != null "> and last_visit_time = #{lastVisitTime}</if>
</where>
</select>
<select id="selectBusFifteenInfoById" parameterType="Long" resultMap="BusFifteenInfoResult">
<include refid="selectBusFifteenInfoVo"/>
where id = #{id}
</select>
<insert id="insertBusFifteenInfo" parameterType="BusFifteenInfo" useGeneratedKeys="true" keyProperty="id">
insert into bus_fifteen_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customId != null">custom_id,</if>
<if test="lastVisitTime != null">last_visit_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customId != null">#{customId},</if>
<if test="lastVisitTime != null">#{lastVisitTime},</if>
</trim>
</insert>
<update id="updateBusFifteenInfo" parameterType="BusFifteenInfo">
update bus_fifteen_info
<trim prefix="SET" suffixOverrides=",">
<if test="customId != null">custom_id = #{customId},</if>
<if test="lastVisitTime != null">last_visit_time = #{lastVisitTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBusFifteenInfoById" parameterType="Long">
delete from bus_fifteen_info where id = #{id}
</delete>
<delete id="deleteBusFifteenInfoByIds" parameterType="String">
delete from bus_fifteen_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>