Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop

This commit is contained in:
Chopper711 2023-05-06 16:32:48 +08:00
commit fac10debd5
4 changed files with 93 additions and 84 deletions

View File

@ -39,7 +39,6 @@ public class WechatMessageExecute implements OrderStatusChangeEvent, TradeEvent
public void orderChange(OrderMessage orderMessage) { public void orderChange(OrderMessage orderMessage) {
switch (orderMessage.getNewStatus()) { switch (orderMessage.getNewStatus()) {
case PAID:
case UNDELIVERED: case UNDELIVERED:
case DELIVERED: case DELIVERED:
case STAY_PICKED_UP: case STAY_PICKED_UP:

View File

@ -217,7 +217,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
connectQueryDTO.getUnionType()) connectQueryDTO.getUnionType())
.eq(CharSequenceUtil.isNotEmpty(connectQueryDTO.getUnionId()), Connect::getUnionId, .eq(CharSequenceUtil.isNotEmpty(connectQueryDTO.getUnionId()), Connect::getUnionId,
connectQueryDTO.getUnionId()); connectQueryDTO.getUnionId());
return this.getOne(queryWrapper); return this.getOne(queryWrapper,false);
} }
@Override @Override

View File

@ -200,8 +200,9 @@ public class KdniaoPlugin implements LogisticsPlugin {
JSONObject obj = JSONObject.parseObject(result); JSONObject obj = JSONObject.parseObject(result);
log.info("电子面单响应:{}", result); log.info("电子面单响应:{}", result);
if (!"100".equals(obj.getString("ResultCode"))) { if (!"100".equals(obj.getString("ResultCode"))) {
resultMap.put("Reason",obj.getString("Reason")); // resultMap.put("Reason",obj.getString("Reason"));
return resultMap; throw new ServiceException(obj.getString("Reason"));
// return resultMap;
} }
JSONObject orderJson = JSONObject.parseObject(obj.getString("Order")); JSONObject orderJson = JSONObject.parseObject(obj.getString("Order"));

View File

@ -9,7 +9,6 @@ import cn.lili.common.exception.ServiceException;
import cn.lili.common.utils.DateUtil; import cn.lili.common.utils.DateUtil;
import cn.lili.common.utils.StringUtils; import cn.lili.common.utils.StringUtils;
import cn.lili.modules.connect.entity.Connect; import cn.lili.modules.connect.entity.Connect;
import cn.lili.modules.connect.entity.enums.ConnectEnum;
import cn.lili.modules.connect.entity.enums.SourceEnum; import cn.lili.modules.connect.entity.enums.SourceEnum;
import cn.lili.modules.connect.service.ConnectService; import cn.lili.modules.connect.service.ConnectService;
import cn.lili.modules.member.entity.dto.ConnectQueryDTO; import cn.lili.modules.member.entity.dto.ConnectQueryDTO;
@ -79,16 +78,22 @@ public class WechatMessageUtil {
if (order == null) { if (order == null) {
throw new ServiceException("订单" + sn + "不存在,发送微信公众号消息错误"); throw new ServiceException("订单" + sn + "不存在,发送微信公众号消息错误");
} }
if (ClientTypeEnum.H5.name().equals(order.getClientType())) {
//获取微信消息 //获取微信消息
LambdaQueryWrapper<WechatMessage> wechatMessageQueryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<WechatMessage> wechatMessageQueryWrapper = new LambdaQueryWrapper();
wechatMessageQueryWrapper.eq(WechatMessage::getOrderStatus, order.getOrderStatus()); wechatMessageQueryWrapper.eq(WechatMessage::getOrderStatus, order.getOrderStatus());
WechatMessage wechatMessage = wechatMessageService.getOne(wechatMessageQueryWrapper); WechatMessage wechatMessage = wechatMessageService.getOne(wechatMessageQueryWrapper);
if (wechatMessage == null) { if (wechatMessage == null) {
log.error("未配置微信公众号消息");
return; return;
} }
Connect connect = connectService.queryConnect( Connect connect = connectService.queryConnect(
ConnectQueryDTO.builder().userId(order.getMemberId()).unionType(ConnectEnum.WECHAT.name()).build() ConnectQueryDTO.builder()
.userId(order.getMemberId())
.unionType(SourceEnum.WECHAT_OFFIACCOUNT_OPEN_ID.name())
.build()
); );
if (connect == null) { if (connect == null) {
return; return;
@ -122,6 +127,7 @@ public class WechatMessageUtil {
log.error("消息发送请求:" + map.get("data")); log.error("消息发送请求:" + map.get("data"));
} }
} }
}
/** /**
* 发送微信消息 * 发送微信消息
@ -135,6 +141,8 @@ public class WechatMessageUtil {
if (order == null) { if (order == null) {
throw new ServiceException("订单" + sn + "不存在,发送订阅消息错误"); throw new ServiceException("订单" + sn + "不存在,发送订阅消息错误");
} }
if (ClientTypeEnum.WECHAT_MP.name().equals(order.getClientType())) {
//获取微信消息 //获取微信消息
LambdaQueryWrapper<WechatMPMessage> wechatMPMessageQueryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<WechatMPMessage> wechatMPMessageQueryWrapper = new LambdaQueryWrapper();
wechatMPMessageQueryWrapper.eq(WechatMPMessage::getOrderStatus, order.getOrderStatus()); wechatMPMessageQueryWrapper.eq(WechatMPMessage::getOrderStatus, order.getOrderStatus());
@ -174,7 +182,7 @@ public class WechatMessageUtil {
log.error("微信消息发送错误", e); log.error("微信消息发送错误", e);
} }
JSONObject json = new JSONObject(content); JSONObject json = new JSONObject(content);
log.info("微信消息发送结果:" + content); log.info("微信小程序消息发送结果:" + content);
String errorMessage = json.getStr("errmsg"); String errorMessage = json.getStr("errmsg");
String errcode = json.getStr("errcode"); String errcode = json.getStr("errcode");
//发送失败 //发送失败
@ -184,6 +192,7 @@ public class WechatMessageUtil {
log.error("消息发送请求:" + map.get("data")); log.error("消息发送请求:" + map.get("data"));
} }
} }
}
/** /**
* 构造数据中所需的内容 * 构造数据中所需的内容