|
@@ -3,6 +3,7 @@ package com.ydd.module.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.ydd.api.DeliveryService;
|
|
|
import com.ydd.common.core.domain.entity.SysUser;
|
|
|
import com.ydd.common.core.page.PageResult;
|
|
|
import com.ydd.common.enums.DeliveryTypeEnums;
|
|
@@ -23,6 +24,8 @@ import com.ydd.module.service.*;
|
|
|
import com.ydd.system.mapper.SysConfigMapper;
|
|
|
import com.ydd.system.service.ISysConfigService;
|
|
|
|
|
|
+import com.ydd.third.common.dto.FengniaoV3Token;
|
|
|
+import com.ydd.third.common.vo.ResObject;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -55,8 +58,8 @@ public class DspDeliveryServiceImpl extends ServiceImpl<DspDeliveryMapper, DspDe
|
|
|
|
|
|
@Resource
|
|
|
private IMemberService iMemberService;
|
|
|
-// @Resource
|
|
|
-// private FengniaoClient fengniaoClient;
|
|
|
+ @Resource
|
|
|
+ private DeliveryService fengniaoClient;
|
|
|
@Resource
|
|
|
private IMemberConfigService iMemberConfigService;
|
|
|
@Resource
|
|
@@ -407,63 +410,6 @@ public class DspDeliveryServiceImpl extends ServiceImpl<DspDeliveryMapper, DspDe
|
|
|
}
|
|
|
|
|
|
|
|
|
- //达达和点我达特殊处理
|
|
|
- /*if (info.getType().equals(DeliveryTypeEnums.DADA.getType()) ||
|
|
|
- info.getType().equals(DeliveryTypeEnums.DADA_YZ.getType()) ||
|
|
|
- info.getType().equals(DeliveryTypeEnums.DWD.getType()) ||
|
|
|
- info.getType().equals(DeliveryTypeEnums.FENG_NIAO.getType()) ||
|
|
|
- info.getType().equals(DeliveryTypeEnums.HUO_LA_LA.getType()) ||
|
|
|
- info.getType().equals(DeliveryTypeEnums.MEI_TUAN.getType())||
|
|
|
- info.getType().equals(DeliveryTypeEnums.SHAN_SONG.getType()) ||
|
|
|
- info.getType().equals(DeliveryTypeEnums.SHUN_FENG.getType())) {
|
|
|
- ShopDelivery sd = iShopDeliveryService.getOne(new QueryWrapper<ShopDelivery>().eq("merchant_id", member.getMerchantId()).eq("delivery_id", delivery.getId())
|
|
|
- .eq("deleted", IsDeleteEnum.NORMAL.status).eq("shop_id", shopId).eq("bind_status",1));
|
|
|
- if (info.getType().equals(DeliveryTypeEnums.DADA.getType()) || info.getType().equals(DeliveryTypeEnums.DADA_YZ.getType())){
|
|
|
- if (sd != null&&sd.getThirdShopId()!=null){
|
|
|
- info.setShopId(sd.getThirdShopId());
|
|
|
- if (isMine == 1){
|
|
|
- if (info.getType().equals(DeliveryTypeEnums.DADA.getType())){
|
|
|
- info.setShopId(sd.getDadaShopNo());
|
|
|
- info.setDadaThirdShopId(sd.getThirdShopId());
|
|
|
- }else {
|
|
|
- info.setShopId(sd.getDadaYzShopNo());
|
|
|
- info.setDadaThirdShopId(sd.getThirdShopId());
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
- //如果默认店铺被删了,则取列表第一个
|
|
|
- List<ShopDelivery> deliveries = iShopDeliveryService.list(new QueryWrapper<ShopDelivery>().eq("merchant_id", member.getMerchantId()).eq("delivery_id", delivery.getId())
|
|
|
- .eq("deleted", IsDeleteEnum.NORMAL.status).isNotNull("third_shop_id"));
|
|
|
- if (CollectionUtils.isNotEmpty(deliveries)){
|
|
|
- info.setShopId(deliveries.get(0).getThirdShopId());
|
|
|
- if (isMine == 1){
|
|
|
- if (info.getType().equals(DeliveryTypeEnums.DADA.getType())){
|
|
|
- info.setShopId(deliveries.get(0).getDadaShopNo());
|
|
|
- info.setDadaThirdShopId(deliveries.get(0).getThirdShopId());
|
|
|
- }else {
|
|
|
- info.setShopId(deliveries.get(0).getDadaYzShopNo());
|
|
|
- info.setDadaThirdShopId(deliveries.get(0).getThirdShopId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-// if (sd != null&&sd.getThirdShopId()!=null &&(info.getType().equals(DeliveryTypeEnums.DADA.getType()) ||
|
|
|
-// info.getType().equals(DeliveryTypeEnums.DADA_YZ.getType()) )) {
|
|
|
-// info.setShopId(sd.getThirdShopId());
|
|
|
-// }
|
|
|
- if(sd != null&&sd.getThirdShopId()!=null &&(info.getType().equals(DeliveryTypeEnums.FENG_NIAO.getType()) ||
|
|
|
- info.getType().equals(DeliveryTypeEnums.HUO_LA_LA.getType())|| info.getType().equals(DeliveryTypeEnums.MEI_TUAN.getType()))){
|
|
|
- info.setThirdShopId(sd.getThirdShopId());
|
|
|
- }
|
|
|
- if (DeliveryTypeEnums.SHAN_SONG.getType().equals(info.getType())) {
|
|
|
- if(sd != null && sd.getThirdShopId() != null){
|
|
|
- info.setShopId(sd.getThirdShopId());
|
|
|
- } else {
|
|
|
- info.setShopId(null);
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
}
|
|
|
if ((delivery.getType().equals(DeliveryTypeEnums.DADA.getType()) || delivery.getType().equals(DeliveryTypeEnums.DADA_YZ.getType())) && member.getMemberType().equals(MemberTypeEnum.PERSON.type)){
|
|
|
info.setIsMerchant(StatusEnum.SHOW.status);
|
|
@@ -485,29 +431,29 @@ public class DspDeliveryServiceImpl extends ServiceImpl<DspDeliveryMapper, DspDe
|
|
|
List<DspDelivery> dspDeliveries = baseMapper.selectDspDeliverysByTime();
|
|
|
return dspDeliveries;
|
|
|
}
|
|
|
-// @Override
|
|
|
-// public void fengNiaoTask() {
|
|
|
-// try {
|
|
|
-// List<DspDelivery> deliverys = baseMapper.selectDspDeliverysByTime();
|
|
|
-// if (deliverys != null && deliverys.size() > 0) {
|
|
|
-// for (DspDelivery delivery : deliverys) {
|
|
|
-// if ((System.currentTimeMillis()-delivery.getCreateTime().getTime())/1000>delivery.getReExpireIn()){
|
|
|
-// log.error("蜂鸟刷新token商户id:"+delivery.getShopId()+"刷新token失败,token过期");
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// ResObject<FengniaoV3Token> resObject = fengniaoClient.refreshToken(delivery.getRefreshToken(), delivery.getShopId());
|
|
|
-// delivery.setExpiresIn(resObject.getData().getExpireIn());
|
|
|
-// delivery.setRefreshToken(resObject.getData().getRefreshToken());
|
|
|
-// delivery.setAuthToken(resObject.getData().getAccessToken());
|
|
|
-// delivery.setCreateTime(new Date());
|
|
|
-// baseMapper.updateById(delivery);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// log.error("蜂鸟刷新token定时任务出现异常", e);
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public void fengNiaoTask() {
|
|
|
+ try {
|
|
|
+ List<DspDelivery> deliverys = baseMapper.selectDspDeliverysByTime();
|
|
|
+ if (deliverys != null && deliverys.size() > 0) {
|
|
|
+ for (DspDelivery delivery : deliverys) {
|
|
|
+ if ((System.currentTimeMillis()-delivery.getCreateTime().getTime())/1000>delivery.getReExpireIn()){
|
|
|
+ log.error("蜂鸟刷新token商户id:"+delivery.getShopId()+"刷新token失败,token过期");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ResObject<FengniaoV3Token> resObject = fengniaoClient.fengniaoRefreshToken(delivery.getRefreshToken(), delivery.getShopId());
|
|
|
+ delivery.setExpiresIn(resObject.getData().getExpireIn());
|
|
|
+ delivery.setRefreshToken(resObject.getData().getRefreshToken());
|
|
|
+ delivery.setAuthToken(resObject.getData().getAccessToken());
|
|
|
+ delivery.setCreateTime(new Date());
|
|
|
+ baseMapper.updateById(delivery);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("蜂鸟刷新token定时任务出现异常", e);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 查询门店没有绑定的运力
|