去掉去掉mq注释,修复后台发货微信用户为空的问题

This commit is contained in:
hupeng
2020-01-14 18:01:08 +08:00
parent 854cc843b3
commit c020c4c190
2 changed files with 22 additions and 15 deletions

View File

@ -20,6 +20,7 @@ import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@ -38,6 +39,7 @@ import java.util.Map;
@Api(tags = "订单管理")
@RestController
@RequestMapping("api")
@Slf4j
public class YxStoreOrderController {
@Autowired
@ -164,21 +166,26 @@ public class YxStoreOrderController {
//模板消息通知
String siteUrl = RedisUtil.get("site_url");
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
if(ObjectUtil.isNotNull(wechatUser)){
YxWechatTemplate WechatTemplate = yxWechatTemplateService
.findByTempkey("OPENTM200565259");
Map<String,String> map = new HashMap<>();
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
map.put("keyword1",resources.getOrderId());//订单号
map.put("keyword2",expressDTO.getName());
map.put("keyword3",resources.getDeliveryId());
map.put("remark","yshop电商系统为你服务");
templateMessageService.sendWxMpTemplateMessage( wechatUser.getOpenid()
,WechatTemplate.getTempid(),
siteUrl+"/order/detail/"+resources.getOrderId(),map);
try{
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
if(ObjectUtil.isNotNull(wechatUser)){
YxWechatTemplate WechatTemplate = yxWechatTemplateService
.findByTempkey("OPENTM200565259");
Map<String,String> map = new HashMap<>();
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
map.put("keyword1",resources.getOrderId());//订单号
map.put("keyword2",expressDTO.getName());
map.put("keyword3",resources.getDeliveryId());
map.put("remark","yshop电商系统为你服务");
templateMessageService.sendWxMpTemplateMessage( wechatUser.getOpenid()
,WechatTemplate.getTempid(),
siteUrl+"/order/detail/"+resources.getOrderId(),map);
}
}catch (Exception e){
log.info("当前用户不是微信用户不能发送模板消息哦!");
}
return new ResponseEntity(HttpStatus.NO_CONTENT);
}