|
|
@@ -61,11 +61,16 @@ public class TemplateCommonServiceImpl implements TemplateCommonService {
|
|
|
|
|
|
private final GoodsDonSkuMapper goodsDonSkuMapper;
|
|
|
|
|
|
- public void newOderSendMsgByType(OrderDon order, GoodsDon goodsDon, GoodsDonSku sku, User user, String toPeople) throws Exception {
|
|
|
+ public void newOderSendMsgByType(OrderDon order, GoodsDon goodsDon, GoodsDonSku sku, User user, String toPeople, Boolean isCustomer) throws Exception {
|
|
|
if (!EnvCommonService.active.equals(envCommonService.getEnv())) {
|
|
|
Long userId = order.getUserId();
|
|
|
String openId = toPeople;
|
|
|
- WxAppTemplateView wxAppTemplateView = this.getWxAppByUserId(userId, TemplateEnum.NEW_ORDER_TEMPLATE.getDesc());
|
|
|
+ WxAppTemplateView wxAppTemplateView = null;
|
|
|
+ if (isCustomer) {
|
|
|
+ wxAppTemplateView = this.getCustomerTemplateView(TemplateEnum.NEW_ORDER_TEMPLATE.getDesc());
|
|
|
+ } else {
|
|
|
+ wxAppTemplateView = this.getWxAppByUserId(userId, TemplateEnum.NEW_ORDER_TEMPLATE.getDesc());
|
|
|
+ }
|
|
|
if (wxAppTemplateView != null) {
|
|
|
WxMpTemplateMessage templateMessage = new WxMpTemplateMessage()
|
|
|
.setToUser(Optional.ofNullable(wxAppTemplateView.getOpenId()).orElse(openId))
|
|
|
@@ -114,6 +119,14 @@ public class TemplateCommonServiceImpl implements TemplateCommonService {
|
|
|
return wxAppTemplateView;
|
|
|
}
|
|
|
|
|
|
+ public WxAppTemplateView getCustomerTemplateView(String templateMark) {
|
|
|
+ WxAppTemplateView wxAppTemplateView = beanSearcher.searchFirst(WxAppTemplateView.class, MapUtils.builder()
|
|
|
+ .field(WxAppTemplateView::getRemark, templateMark)
|
|
|
+ .field(WxAppTemplateView::getAppId, weChatConfig.getAppid())
|
|
|
+ .field(WxAppTemplateView::getType, EnvCommonService.active_prd).build());
|
|
|
+ return wxAppTemplateView;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void sendWxGzhQrCodeSuccessMsg(User user) throws Exception {
|
|
|
if (!EnvCommonService.active.equals(envCommonService.getEnv())) {
|
|
|
@@ -174,13 +187,12 @@ public class TemplateCommonServiceImpl implements TemplateCommonService {
|
|
|
@Override
|
|
|
public void emptySendMsgNotify(OrderDon orderDon, String toPeople) throws Exception {
|
|
|
if (!EnvCommonService.active.equals(envCommonService.getEnv())) {
|
|
|
- Long userId = orderDon.getUserId();
|
|
|
String openId = toPeople;
|
|
|
- WxAppTemplateView wxAppTemplateView = this.getWxAppByUserId(userId, TemplateEnum.EMPTY_TEMPLATE.getDesc());
|
|
|
+ WxAppTemplateView wxAppTemplateView = this.getCustomerTemplateView(TemplateEnum.EMPTY_TEMPLATE.getDesc());
|
|
|
if (wxAppTemplateView != null) {
|
|
|
User u = userMapper.selectById(orderDon.getUserId());
|
|
|
WxMpTemplateMessage templateMessage = new WxMpTemplateMessage()
|
|
|
- .setToUser(Optional.ofNullable(wxAppTemplateView.getOpenId()).orElse(openId))
|
|
|
+ .setToUser(openId)
|
|
|
.setTemplateId(wxAppTemplateView.getTemplateId())
|
|
|
//TODO
|
|
|
.setUrl(" ");
|