昨日回访量与营销比修改

This commit is contained in:
Lenovo 2024-07-20 10:57:49 +08:00
parent c068d1e5dc
commit 61d2ca3f88
6 changed files with 50 additions and 12 deletions

View File

@ -39,18 +39,20 @@ public class MeituanController {
@GetMapping("/refresh") @GetMapping("/refresh")
public R refresh(){ public R refresh(){
iMeituanService.getComments(SecurityUtils.getUsername()); iMeituanService.getComments(SecurityUtils.getUsername());
iMeituanService.getReturnInfo(null);
return R.ok(); return R.ok();
} }
@GetMapping("/getComment") @GetMapping("/getComment")
public R getComment(Long id){ public R getComment(Long id){
iMeituanService.getComment(id); iMeituanService.getComment(id);
iMeituanService.getReturnInfo(id);
return R.ok(); return R.ok();
} }
@GetMapping("/getReturnInfo") @GetMapping("/getReturnInfo")
public R getReturnInfo(){ public R getReturnInfo(){
iMeituanService.getReturnInfo(); iMeituanService.getReturnInfo(null);
return R.ok(); return R.ok();
} }

View File

@ -5,6 +5,7 @@ import com.ruoyi.business.domain.BusStoreDayInfo;
import com.ruoyi.business.domain.BusStoreExcelInfo; import com.ruoyi.business.domain.BusStoreExcelInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -63,4 +64,6 @@ public interface BusStoreDayHistoryInfoMapper
*/ */
public int deleteBusStoreDayHistoryInfoByIds(Long[] ids); public int deleteBusStoreDayHistoryInfoByIds(Long[] ids);
BusStoreDayHistoryInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT); BusStoreDayHistoryInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT);
List<BusStoreDayHistoryInfo> selectBusStoreDayHistoryInfoListByDate(@Param("id") Long id,@Param("date") String date);
} }

View File

@ -54,7 +54,7 @@ public interface IMeituanService {
String mtgsigInfo(String orderId,String regionId,String regionVersion); String mtgsigInfo(String orderId,String regionId,String regionVersion);
String getStoreName(String cookie); String getStoreName(String cookie);
void getReturnInfo(); void getReturnInfo(Long id);
String getComment(Long id); String getComment(Long id);
} }

View File

@ -41,6 +41,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 采集美团数据service * 采集美团数据service
@ -396,6 +397,7 @@ public class MeituanServiceImpl implements IMeituanService {
list.add(orderInfo); list.add(orderInfo);
} }
if (list.size() > 0) { if (list.size() > 0) {
List<BusOrderInfo> newList = list.stream().collect(Collectors.toMap(BusOrderInfo::getDayseq, p->p,(p1, p2)->p1)).values().stream().collect(Collectors.toList());
// list.stream().sorted(Comparator.comparing(OrderInfo::getDaySeq)).collect(Collectors.toList()); // list.stream().sorted(Comparator.comparing(OrderInfo::getDaySeq)).collect(Collectors.toList());
// int integral = iBusAgentInfoService.getIntegralByAccount(busStoreInfoMapper.getBindUserByStoreCode(wmPoiId)); // int integral = iBusAgentInfoService.getIntegralByAccount(busStoreInfoMapper.getBindUserByStoreCode(wmPoiId));
// for (OrderInfo orderInfo : list) { // for (OrderInfo orderInfo : list) {
@ -405,9 +407,9 @@ public class MeituanServiceImpl implements IMeituanService {
// busOrderInfoMapper.insertBusOrderInfo(busOrderInfo); // busOrderInfoMapper.insertBusOrderInfo(busOrderInfo);
// priPhoneInfo(busOrderInfo.getId(),orderInfo.getWmOrderViewId(),cookie); // priPhoneInfo(busOrderInfo.getId(),orderInfo.getWmOrderViewId(),cookie);
// } // }
busOrderInfoMapper.batchInsertOrder(list); busOrderInfoMapper.batchInsertOrder(newList);
priPhoneInfo(list,cookie); priPhoneInfo(newList,cookie);
} }
pageNum += 1; pageNum += 1;
JSONObject jo = merchantOrders(pageNum, date, cookie); JSONObject jo = merchantOrders(pageNum, date, cookie);
@ -645,11 +647,14 @@ public class MeituanServiceImpl implements IMeituanService {
} }
@Override @Override
public void getReturnInfo() { public void getReturnInfo(Long id) {
getComments(null); // getComments(null);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime date = LocalDateTime.now().minusDays(1); LocalDateTime date = LocalDateTime.now().minusDays(1);
BusStoreInfo storeInfo = new BusStoreInfo(); BusStoreInfo storeInfo = new BusStoreInfo();
if (id != null){
storeInfo.setId(id);
}
List<BusStoreInfo> storeInfoList = busStoreInfoMapper.selectBusStoreInfoList(storeInfo); List<BusStoreInfo> storeInfoList = busStoreInfoMapper.selectBusStoreInfoList(storeInfo);
for (BusStoreInfo busStoreInfo : storeInfoList) { for (BusStoreInfo busStoreInfo : storeInfoList) {
List<BusReturnVisitInfo> list = busReturnVisitInfoMapper.selectBusReturnVisitInfoListByDate(busStoreInfo.getStoreCode(), date.format(dateTimeFormatter)); List<BusReturnVisitInfo> list = busReturnVisitInfoMapper.selectBusReturnVisitInfoListByDate(busStoreInfo.getStoreCode(), date.format(dateTimeFormatter));
@ -659,15 +664,34 @@ public class MeituanServiceImpl implements IMeituanService {
if (list1.size() == 1) { if (list1.size() == 1) {
busStoreDayInfo = list1.get(0); busStoreDayInfo = list1.get(0);
busStoreDayInfo.setLastReturnVisitNum(list.size()); busStoreDayInfo.setLastReturnVisitNum(list.size());
int a = busStoreDayInfo.getLastPositiveReviewsNum();//todo 好评-五星
int b = busStoreDayInfo.getLastReturnVisitNum();
if (a != 0 && b != 0) {
busStoreDayInfo.setLastReturnVisitRate(getRate(a,b));
} else {
busStoreDayInfo.setLastReturnVisitRate("0");
}
busStoreDayInfoMapper.updateBusStoreDayInfo(busStoreDayInfo); busStoreDayInfoMapper.updateBusStoreDayInfo(busStoreDayInfo);
List<BusStoreDayHistoryInfo> list2 = busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoListByDate(storeInfo.getId(),date.format(dateTimeFormatter));
if (list2.size() > 0){
BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo();
BeanUtils.copyProperties(busStoreDayInfo, target);
target.setId(list2.get(0).getId());
busStoreDayHistoryInfoMapper.updateBusStoreDayHistoryInfo(target);
}else {
BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo(); BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo();
BeanUtils.copyProperties(busStoreDayInfo, target); BeanUtils.copyProperties(busStoreDayInfo, target);
target.setId(null); target.setId(null);
busStoreDayHistoryInfoMapper.insertBusStoreDayHistoryInfo(target); busStoreDayHistoryInfoMapper.insertBusStoreDayHistoryInfo(target);
}
}
}
}
} private String getRate(int a, int b){
} java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
return df.format(((double) a / b)*100);
} }
/** /**

View File

@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBusStoreDayHistoryInfoList" parameterType="com.ruoyi.business.domain.BusStoreExcelInfo" resultType="com.ruoyi.business.domain.BusStoreExcelInfo"> <select id="selectBusStoreDayHistoryInfoList" parameterType="com.ruoyi.business.domain.BusStoreExcelInfo" resultType="com.ruoyi.business.domain.BusStoreExcelInfo">
<include refid="selectBusStoreDayHistoryInfoVo1"/> <include refid="selectBusStoreDayHistoryInfoVo1"/>
<where> <where>
DATE_FORMAT(a.create_time,'%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d') DATE_FORMAT(a.create_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY),'%Y-%m-%d')
and b.self_delivery_status != '3' and b.self_delivery_status != '3'
<if test="storeList != null"> <if test="storeList != null">
and a.store_id in and a.store_id in
@ -112,6 +112,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBusStoreDayHistoryInfoVo"/> <include refid="selectBusStoreDayHistoryInfoVo"/>
where store_id = #{id} and create_time between #{sT} and #{eT} where store_id = #{id} and create_time between #{sT} and #{eT}
</select> </select>
<select id="selectBusStoreDayHistoryInfoListByDate"
resultType="com.ruoyi.business.domain.BusStoreDayHistoryInfo">
<include refid="selectBusStoreDayHistoryInfoVo"/>
<where>
<if test="date != null and date != '' "> DATE_FORMAT(create_time,'%Y-%m-%d') = #{date}</if>
<if test="id != null and id != '' "> and store_id = #{id}</if>
</where>
</select>
</mapper> </mapper>

View File

@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBusStoreInfoVo"/> <include refid="selectBusStoreInfoVo"/>
<where> <where>
self_delivery_status != '3' self_delivery_status != '3'
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="platformType != null and platformType != ''"> and platform_type = #{platformType}</if> <if test="platformType != null and platformType != ''"> and platform_type = #{platformType}</if>
<if test="storeCode != null and storeCode != ''"> and store_code = #{storeCode}</if> <if test="storeCode != null and storeCode != ''"> and store_code = #{storeCode}</if>
<if test="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if> <if test="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>