一键同步

This commit is contained in:
wangshuai 2024-07-23 02:38:19 +08:00
parent 4083ec2b04
commit b8f9fef5bc
7 changed files with 91 additions and 25 deletions

View File

@ -46,8 +46,8 @@ public class MeituanController {
@Async @Async
@GetMapping("/refresh") @GetMapping("/refresh")
public R refresh(){ public R refresh(){
// iMeituanService.getReturnInfo(null);//店铺id
iMeituanService.getComments(null); iMeituanService.getComments(null);
iMeituanService.getReturnInfo(null);//店铺id
return R.ok(); return R.ok();
} }
@ -57,7 +57,6 @@ public class MeituanController {
@GetMapping("/getComment") @GetMapping("/getComment")
public R getComment(Long id){ public R getComment(Long id){
iMeituanService.getComment(id);//店铺id iMeituanService.getComment(id);//店铺id
iMeituanService.getReturnInfo(id);//店铺id
return R.ok(); return R.ok();
} }

View File

@ -62,4 +62,6 @@ public interface BusStoreDayInfoMapper
*/ */
public int deleteBusStoreDayInfoByIds(Long[] ids); public int deleteBusStoreDayInfoByIds(Long[] ids);
BusStoreDayInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT); BusStoreDayInfo getByDate(@Param("id") Long id, @Param("sT") String sT, @Param("eT") String eT);
List<BusStoreDayInfo> selectBusStoreDayInfoListByDate(@Param("storeId") Long storeId,@Param("date") String date);
} }

View File

@ -26,7 +26,10 @@ public interface BusStoreInfoMapper
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 店铺信息集合 * @return 店铺信息集合
*/ */
public List<BusStoreInfo> selectBusStoreInfoListA(BusStoreInfo busStoreInfo);
public List<BusStoreInfo> selectBusStoreInfoList(BusStoreInfo busStoreInfo); public List<BusStoreInfo> selectBusStoreInfoList(BusStoreInfo busStoreInfo);
int lastUserIntegralNum(@Param("agentAccount") String agentAccount,@Param("startTime") String startTime,@Param("endTime") String endTime); int lastUserIntegralNum(@Param("agentAccount") String agentAccount,@Param("startTime") String startTime,@Param("endTime") String endTime);
/** /**

View File

@ -216,7 +216,7 @@ public class MeituanServiceImpl implements IMeituanService {
if(accountName != null){ if(accountName != null){
busStoreInfo.setBindUser(SecurityUtils.getUsername()); busStoreInfo.setBindUser(SecurityUtils.getUsername());
} }
List<BusStoreInfo> busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo); List<BusStoreInfo> busStoreInfoList = busStoreInfoMapper.selectBusStoreInfoListA(busStoreInfo);
for (BusStoreInfo store : busStoreInfoList) { for (BusStoreInfo store : busStoreInfoList) {
Boolean flag1 = getScoreOne(store); Boolean flag1 = getScoreOne(store);
if (!flag1) { if (!flag1) {
@ -228,7 +228,11 @@ public class MeituanServiceImpl implements IMeituanService {
} }
Boolean flag3 = yesterdayCountOne(store); Boolean flag3 = yesterdayCountOne(store);
if (!flag3) { if (!flag3) {
System.out.println("获取昨日统计信息返回错误..."); System.out.println("获取昨日单量信息返回错误...");
}
Boolean flag4 = updateDayInfo(store);
if (!flag4) {
System.out.println("获取昨日营销信息返回错误...");
} }
} }
return "ok"; return "ok";
@ -690,32 +694,30 @@ public class MeituanServiceImpl implements IMeituanService {
@Override @Override
public void getReturnInfo(Long id) { public void getReturnInfo(Long id) {
// 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(2);
BusStoreInfo storeInfo = new BusStoreInfo(); BusStoreInfo storeInfo = new BusStoreInfo();
if (id != null){ if (id != null){
storeInfo.setId(id); storeInfo.setId(id);
} }
List<BusStoreInfo> storeInfoList = busStoreInfoMapper.selectBusStoreInfoList(storeInfo); List<BusStoreInfo> storeInfoList = busStoreInfoMapper.selectBusStoreInfoListA(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));
BusStoreDayInfo busStoreDayInfo = new BusStoreDayInfo(); // BusStoreDayInfo busStoreDayInfo = new BusStoreDayInfo();
busStoreDayInfo.setStoreId(busStoreInfo.getId()); // busStoreDayInfo.setStoreId(busStoreInfo.getId());
List<BusStoreDayInfo> list1 = busStoreDayInfoMapper.selectBusStoreDayInfoList(busStoreDayInfo); List<BusStoreDayInfo> list1 = busStoreDayInfoMapper.selectBusStoreDayInfoListByDate(busStoreInfo.getId(),date.format(dateTimeFormatter));
if (list1.size() == 1) { if (list1.size() == 1) {
busStoreDayInfo = list1.get(0); BusStoreDayInfo busStoreDayInfo = list1.get(0);
busStoreDayInfo.setLastReturnVisitNum(list.size()); // busStoreDayInfo.setLastReturnVisitNum(list.size());
int a = busStoreDayInfo.getLastPositiveReviewsNum();//todo 好评-五星 // int a = busStoreDayInfo.getLastPositiveReviewsNum();//todo 好评-五星
int b = busStoreDayInfo.getLastReturnVisitNum(); // int b = busStoreDayInfo.getLastReturnVisitNum();
if (a != 0 && b != 0) { // if (a != 0 && b != 0) {
busStoreDayInfo.setLastReturnVisitRate(getRate(a,b)); // busStoreDayInfo.setLastReturnVisitRate(getRate(a,b));
} else { // } else {
busStoreDayInfo.setLastReturnVisitRate("0"); // busStoreDayInfo.setLastReturnVisitRate("0");
} // }
busStoreDayInfo.setCreateTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant())); // busStoreDayInfo.setCreateTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant()));
busStoreDayInfoMapper.updateBusStoreDayInfo(busStoreDayInfo); // busStoreDayInfoMapper.updateBusStoreDayInfo(busStoreDayInfo);
List<BusStoreDayHistoryInfo> list2 = busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoListByDate(busStoreInfo.getId(),date.format(dateTimeFormatter)); List<BusStoreDayHistoryInfo> list2 = busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoListByDate(busStoreInfo.getId(),date.format(dateTimeFormatter));
if (list2.size() > 0){ if (list2.size() > 0){
BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo(); BusStoreDayHistoryInfo target = new BusStoreDayHistoryInfo();
@ -731,6 +733,7 @@ public class MeituanServiceImpl implements IMeituanService {
} }
} }
} }
getComments(null);
} }
private String getRate(int a, int b){ private String getRate(int a, int b){
@ -738,6 +741,30 @@ public class MeituanServiceImpl implements IMeituanService {
return df.format(((double) a / b)*100); return df.format(((double) a / b)*100);
} }
@Transactional(rollbackFor = Exception.class)
public Boolean updateDayInfo(BusStoreInfo store){
String date = LocalDateTime.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<BusReturnVisitInfo> llll = busReturnVisitInfoMapper.selectBusReturnVisitInfoListByDate(store.getStoreCode(),date);
BusStoreDayInfo busStoreDayInfo = new BusStoreDayInfo();
busStoreDayInfo.setStoreId(store.getId());
List<BusStoreDayInfo> ll = busStoreDayInfoService.selectBusStoreDayInfoList(busStoreDayInfo);
int a = ll.get(0).getLastPositiveReviewsNum();//todo 好评-五星
int b = llll.size();
busStoreDayInfo.setId(ll.get(0).getId());
busStoreDayInfo.setLastOrderNum(ll.get(0).getLastOrderNum());
busStoreDayInfo.setLastPositiveReviewsNum(a);
busStoreDayInfo.setLastFiveStarReviewsNum(ll.get(0).getLastFiveStarReviewsNum());
busStoreDayInfo.setLastReturnVisitNum(b);
busStoreDayInfo.setScore(ll.get(0).getScore());
if (a != 0 && b != 0) {
busStoreDayInfo.setLastReturnVisitRate(getRate(a,b));
} else {
busStoreDayInfo.setLastReturnVisitRate("0");
}
busStoreDayInfo.setCreateTime(Date.from(LocalDateTime.now().minusDays(1).atZone(ZoneId.systemDefault()).toInstant()));
busStoreDayInfoService.updateBusStoreDayInfo(busStoreDayInfo);
return true;
}
/** /**
* 获取评分单条 * 获取评分单条
* *
@ -832,8 +859,8 @@ public class MeituanServiceImpl implements IMeituanService {
return false; return false;
} }
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
int code = jsonObject.getInteger(("code")); String code = jsonObject.getString(("code"));
if (code != 0) { if ("1001".equals(code)) {
System.out.println(result); System.out.println(result);
store.setGrantStatus("2"); store.setGrantStatus("2");
busStoreInfoService.updateBusStoreInfo(store); busStoreInfoService.updateBusStoreInfo(store);

View File

@ -99,5 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBusStoreDayInfoVo"/> <include refid="selectBusStoreDayInfoVo"/>
where store_id = #{id} and DATE_SUB(create_time, INTERVAL 1 DAY) between #{sT} and #{eT} where store_id = #{id} and DATE_SUB(create_time, INTERVAL 1 DAY) between #{sT} and #{eT}
</select> </select>
<select id="selectBusStoreDayInfoListByDate" resultType="com.ruoyi.business.domain.BusStoreDayInfo">
<include refid="selectBusStoreDayInfoVo"/>
<where> DATE_FORMAT(create_time,'%Y-%m-%d') = #{date}
<if test="storeId != null "> and store_id = #{storeId}</if>
</where>
</select>
</mapper> </mapper>

View File

@ -34,6 +34,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, platform_type, store_code, store_name, store_account, store_password, store_cookie, store_belong, grant_status, return_visit_status, bind_id, bind_user, bind_time, update_id, update_user, update_time, self_delivery_status, return_visit_user_range, sale_bind_id, sale_bind_name, sale_bind_time, price,marketing_channels from bus_store_info select id, platform_type, store_code, store_name, store_account, store_password, store_cookie, store_belong, grant_status, return_visit_status, bind_id, bind_user, bind_time, update_id, update_user, update_time, self_delivery_status, return_visit_user_range, sale_bind_id, sale_bind_name, sale_bind_time, price,marketing_channels from bus_store_info
</sql> </sql>
<select id="selectBusStoreInfoListA" parameterType="BusStoreInfo" resultMap="BusStoreInfoResult">
<include refid="selectBusStoreInfoVo"/>
<where>
<if test="id != null and id != ''"> and id = #{id}</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="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
<if test="storeAccount != null and storeAccount != ''"> and store_account = #{storeAccount}</if>
<if test="storePassword != null and storePassword != ''"> and store_password = #{storePassword}</if>
<if test="storeCookie != null and storeCookie != ''"> and store_cookie = #{storeCookie}</if>
<if test="storeBelong != null and storeBelong != ''"> and store_belong = #{storeBelong}</if>
<if test="grantStatus != null and grantStatus != ''"> and grant_status = #{grantStatus}</if>
<if test="returnVisitStatus != null and returnVisitStatus != ''"> and return_visit_status = #{returnVisitStatus}</if>
<if test="bindId != null "> and bind_id = #{bindId}</if>
<if test="bindUser != null and bindUser != ''"> and bind_user = #{bindUser}</if>
<if test="bindTime != null "> and bind_time = #{bindTime}</if>
<if test="updateId != null "> and update_id = #{updateId}</if>
<if test="updateUser != null "> and update_user = #{updateUser}</if>
<if test="selfDeliveryStatus != null and selfDeliveryStatus != ''"> and self_delivery_status = #{selfDeliveryStatus}</if>
<if test="marketingChannels != null and marketingChannels != ''"> and marketing_channels = #{marketingChannels}</if>
<if test="returnVisitUserRange != null and returnVisitUserRange != ''"> and return_visit_user_range = #{returnVisitUserRange}</if>
<if test="saleBindId != null "> and sale_bind_id = #{saleBindId}</if>
<if test="saleBindName != null and saleBindName != ''"> and sale_bind_name like concat('%', #{saleBindName}, '%')</if>
<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>
</select>
<select id="lastUserIntegralNum" parameterType="java.lang.String" resultType="java.lang.Integer"> <select id="lastUserIntegralNum" parameterType="java.lang.String" resultType="java.lang.Integer">
select ifnull(sum(integral_update_num),0) from bus_integral_record select ifnull(sum(integral_update_num),0) from bus_integral_record
where account = #{agentAccount} and update_type = '消耗账分' where account = #{agentAccount} and update_type = '消耗账分'

View File

@ -614,6 +614,7 @@ export default {
handleOpen(row) { handleOpen(row) {
this.queryParams.id = row.id; this.queryParams.id = row.id;
getMtUrl(this.queryParams).then(response => { getMtUrl(this.queryParams).then(response => {
this.queryParams.id = undefined
window.open(response.msg,"_blank"); window.open(response.msg,"_blank");
}); });
}, },