fix: 模板消息
This commit is contained in:
@@ -92,7 +92,7 @@ public class PlayOrderInfoController {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跟换店员
|
* 更换店员
|
||||||
*/
|
*/
|
||||||
//@PreAuthorize("@customSs.hasPermission('order:order:update')")
|
//@PreAuthorize("@customSs.hasPermission('order:order:update')")
|
||||||
@PostMapping("/orderEditAcceptBy")
|
@PostMapping("/orderEditAcceptBy")
|
||||||
@@ -101,7 +101,7 @@ public class PlayOrderInfoController {
|
|||||||
PlayClerkUserInfoEntity clerkUserInfo = playClerkUserInfoService.selectById(vo.getAcceptBy());
|
PlayClerkUserInfoEntity clerkUserInfo = playClerkUserInfoService.selectById(vo.getAcceptBy());
|
||||||
PlayOrderInfoEntity orderInfo = orderInfoService.selectOrderInfoById(vo.getOrderId());
|
PlayOrderInfoEntity orderInfo = orderInfoService.selectOrderInfoById(vo.getOrderId());
|
||||||
PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(orderInfo.getCommodityId(), clerkUserInfo.getLevelId());
|
PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(orderInfo.getCommodityId(), clerkUserInfo.getLevelId());
|
||||||
wxCustomMpService.sendCreateOrderMessage(clerkUserInfo.getTenantId(), clerkUserInfo.getOpenid(), clerkUserInfo.getNickname(), orderInfo.getOrderNo(), orderInfo.getId(), String.valueOf(orderInfo.getPurchaserTime()), orderInfo.getOrderMoney().toString(), commodityInfo.getCommodityName());
|
wxCustomMpService.sendCreateOrderMessage(clerkUserInfo.getTenantId(), clerkUserInfo.getOpenid(), orderInfo.getOrderNo(), orderInfo.getOrderMoney().toString(), commodityInfo.getCommodityName());
|
||||||
return R.ok("操作成功");
|
return R.ok("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.starry.admin.modules.order.module.vo.PlayOrderComplaintQueryVo;
|
|||||||
import com.starry.admin.modules.order.module.vo.PlayOrderComplaintReturnVo;
|
import com.starry.admin.modules.order.module.vo.PlayOrderComplaintReturnVo;
|
||||||
import com.starry.admin.modules.order.service.IPlayOrderComplaintInfoService;
|
import com.starry.admin.modules.order.service.IPlayOrderComplaintInfoService;
|
||||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
||||||
|
import com.starry.admin.modules.weichat.service.WxCustomMpService;
|
||||||
import com.starry.admin.utils.SecurityUtils;
|
import com.starry.admin.utils.SecurityUtils;
|
||||||
import com.starry.common.utils.IdUtils;
|
import com.starry.common.utils.IdUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -41,7 +42,8 @@ public class PlayOrderComplaintInfoServiceImpl extends ServiceImpl<PlayOrderComp
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayPersonnelGroupInfoService playClerkGroupInfoService;
|
private IPlayPersonnelGroupInfoService playClerkGroupInfoService;
|
||||||
|
@Resource
|
||||||
|
private WxCustomMpService wxCustomMpService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,6 +146,8 @@ public class PlayOrderComplaintInfoServiceImpl extends ServiceImpl<PlayOrderComp
|
|||||||
PlayOrderInfoEntity orderInfo = playOrderInfoService.selectOrderInfoById(playOrderComplaintInfo.getOrderId());
|
PlayOrderInfoEntity orderInfo = playOrderInfoService.selectOrderInfoById(playOrderComplaintInfo.getOrderId());
|
||||||
playOrderComplaintInfo.setClerkId(orderInfo.getAcceptBy());
|
playOrderComplaintInfo.setClerkId(orderInfo.getAcceptBy());
|
||||||
playOrderComplaintInfo.setCommodityId(orderInfo.getCommodityId());
|
playOrderComplaintInfo.setCommodityId(orderInfo.getCommodityId());
|
||||||
|
// 发送投诉消息给管理员以及客服
|
||||||
|
wxCustomMpService.sendComplaintMessage(playOrderComplaintInfo, orderInfo);
|
||||||
return save(playOrderComplaintInfo);
|
return save(playOrderComplaintInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -679,10 +679,8 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl<PlayOrderInfoMapper, P
|
|||||||
entity.setEstimatedRevenue(estimatedRevenueVo.getRevenueAmount());
|
entity.setEstimatedRevenue(estimatedRevenueVo.getRevenueAmount());
|
||||||
entity.setEstimatedRevenueRatio(estimatedRevenueVo.getRevenueRatio());
|
entity.setEstimatedRevenueRatio(estimatedRevenueVo.getRevenueRatio());
|
||||||
this.baseMapper.updateById(entity);
|
this.baseMapper.updateById(entity);
|
||||||
// 接单后,发送微信消息
|
|
||||||
PlayCustomUserInfoEntity customUserInfo = playCustomUserInfoService.selectById(orderInfo.getPurchaserBy());
|
|
||||||
|
|
||||||
wxCustomMpService.sendOrderMessage(customUserInfo.getTenantId(), customUserInfo.getOpenid(), "0", clerkUserInfoEntity.getNickname(), orderInfo.getOrderNo(), orderInfo.getId(), orderInfo.getOrderMoney().toString());
|
wxCustomMpService.sendOrderMessage(orderInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -735,6 +733,8 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl<PlayOrderInfoMapper, P
|
|||||||
PlayOrderInfoEntity entity2 = new PlayOrderInfoEntity(orderId, ORDER_STATUS_3);
|
PlayOrderInfoEntity entity2 = new PlayOrderInfoEntity(orderId, ORDER_STATUS_3);
|
||||||
entity2.setOrderEndTime(LocalDateTime.now());
|
entity2.setOrderEndTime(LocalDateTime.now());
|
||||||
this.baseMapper.updateById(entity2);
|
this.baseMapper.updateById(entity2);
|
||||||
|
// 发送消息
|
||||||
|
wxCustomMpService.sendOrderFinishMessage(this.selectOrderInfoById(orderId));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -772,9 +772,8 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl<PlayOrderInfoMapper, P
|
|||||||
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.getById(orderInfo.getPurchaserBy());
|
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.getById(orderInfo.getPurchaserBy());
|
||||||
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().add(orderInfo.getOrderMoney()), "3", "订单退款", orderInfo.getOrderMoney(), BigDecimal.ZERO, orderId);
|
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().add(orderInfo.getOrderMoney()), "3", "订单退款", orderInfo.getOrderMoney(), BigDecimal.ZERO, orderId);
|
||||||
// 取消订单后,记录退款信息
|
// 取消订单后,记录退款信息
|
||||||
playOrderRefundInfoService.add(orderId,orderInfo.getPurchaserBy(),orderInfo.getAcceptBy(),orderInfo.getPayMethod(),
|
playOrderRefundInfoService.add(orderId, orderInfo.getPurchaserBy(), orderInfo.getAcceptBy(), orderInfo.getPayMethod(), "0", orderInfo.getFinalAmount(), refundReason, operatorByType, operatorBy, "0", "0");
|
||||||
"0",
|
wxCustomMpService.sendOrderCancelMessage(orderInfo,refundReason);
|
||||||
orderInfo.getFinalAmount(),refundReason,operatorByType,operatorBy,"0","0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ public class SysTenantEntity extends BaseEntity<SysTenantEntity> {
|
|||||||
|
|
||||||
private String dingdantousuchuliTemplateId;
|
private String dingdantousuchuliTemplateId;
|
||||||
private String jiedanchenggongtongzhiTemplateId;
|
private String jiedanchenggongtongzhiTemplateId;
|
||||||
private String dingdanzhifuchenggongtongzhiTemplateId;
|
|
||||||
private String quxiaodingdantongzhiTemplateId;
|
private String quxiaodingdantongzhiTemplateId;
|
||||||
private String dingdanwanchengtongzhiTemplateId;
|
private String dingdanwanchengtongzhiTemplateId;
|
||||||
private String chongzhichenggongTemplateId;
|
private String chongzhichenggongTemplateId;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.starry.admin.modules.weichat.controller;
|
package com.starry.admin.modules.weichat.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@@ -302,7 +301,7 @@ public class WxCustomController {
|
|||||||
// 顾客减少余额
|
// 顾客减少余额
|
||||||
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(money), "1", "下单-指定单", money, BigDecimal.ZERO, orderId);
|
customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(money), "1", "下单-指定单", money, BigDecimal.ZERO, orderId);
|
||||||
// 发送通知给店员
|
// 发送通知给店员
|
||||||
wxCustomMpService.sendCreateOrderMessage(clerkUserInfo.getTenantId(), clerkUserInfo.getOpenid(), clerkUserInfo.getNickname(), orderNo, orderId, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"), money.toString(), commodityInfo.getCommodityName());
|
wxCustomMpService.sendCreateOrderMessage(clerkUserInfo.getTenantId(), clerkUserInfo.getOpenid(), orderNo, money.toString(), commodityInfo.getCommodityName());
|
||||||
return R.ok("成功");
|
return R.ok("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.starry.admin.modules.clerk.module.entity.PlayClerkUserReviewInfoEntit
|
|||||||
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
||||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||||
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||||
|
import com.starry.admin.modules.order.module.entity.PlayOrderComplaintInfoEntity;
|
||||||
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||||
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelAdminInfoEntity;
|
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelAdminInfoEntity;
|
||||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelAdminInfoService;
|
import com.starry.admin.modules.personnel.service.IPlayPersonnelAdminInfoService;
|
||||||
@@ -28,7 +29,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -54,7 +54,6 @@ public class WxCustomMpService {
|
|||||||
private IPlayClerkUserInfoService clerkUserInfoService;
|
private IPlayClerkUserInfoService clerkUserInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付成功回调地址
|
* 支付成功回调地址
|
||||||
*/
|
*/
|
||||||
@@ -113,9 +112,9 @@ public class WxCustomMpService {
|
|||||||
public void sendBalanceMessage(PlayOrderInfoEntity order) {
|
public void sendBalanceMessage(PlayOrderInfoEntity order) {
|
||||||
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(order.getPurchaserBy());
|
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(order.getPurchaserBy());
|
||||||
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(order.getTenantId());
|
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(order.getTenantId());
|
||||||
WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getCzcgtzTemplateId(), customUserInfo.getOpenid(), "http://" + tenant.getTenantKey() + ".july.hucs.top/user/");
|
WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getChongzhichenggongTemplateId(), customUserInfo.getOpenid(), "http://" + tenant.getTenantKey() + ".july.hucs.top/user/");
|
||||||
List<WxMpTemplateData> data = new ArrayList<>();
|
List<WxMpTemplateData> data = new ArrayList<>();
|
||||||
data.add(new WxMpTemplateData("time4", LocalDate.now().toString()));
|
data.add(new WxMpTemplateData("time4", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
||||||
data.add(new WxMpTemplateData("amount2", order.getOrderMoney().toString()));
|
data.add(new WxMpTemplateData("amount2", order.getOrderMoney().toString()));
|
||||||
data.add(new WxMpTemplateData("amount17", "0"));
|
data.add(new WxMpTemplateData("amount17", "0"));
|
||||||
data.add(new WxMpTemplateData("thing10", tenant.getTenantName()));
|
data.add(new WxMpTemplateData("thing10", tenant.getTenantName()));
|
||||||
@@ -134,71 +133,58 @@ public class WxCustomMpService {
|
|||||||
*
|
*
|
||||||
* @param tenantId 租户ID
|
* @param tenantId 租户ID
|
||||||
* @param openId 消息接收人openID
|
* @param openId 消息接收人openID
|
||||||
* @param nickName 消息内容-消息接收人昵称
|
|
||||||
* @param orderNo 消息内容-订单编号
|
* @param orderNo 消息内容-订单编号
|
||||||
* @param orderId 消息内容-订单ID
|
* @param money
|
||||||
* @param orderTime 消息内容-下单时间
|
* @param commodityName
|
||||||
* @param orderAmount 消息内容-订单金额
|
|
||||||
* @param commodityName 消息内容-服务项目名称
|
|
||||||
*/
|
*/
|
||||||
public void sendCreateOrderMessage(String tenantId, String openId, String nickName, String orderNo, String orderId, String orderTime, String orderAmount, String commodityName) {
|
public void sendCreateOrderMessage(String tenantId, String openId, String orderNo, String money, String commodityName) {
|
||||||
|
|
||||||
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(tenantId);
|
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(tenantId);
|
||||||
String template_id = tenant.getSdxddtzTemplateId();
|
WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getXindingdanshoulitongzhiTemplateId(), openId, "http://" + tenant.getTenantKey() + ".july.hucs.top/clerk/#/orderDetail/");
|
||||||
String tenantKey = tenant.getTenantKey();
|
|
||||||
String url = "http://" + tenantKey + ".july.hucs.top/clerk/#/orderDetail/" + orderId;
|
|
||||||
WxMpTemplateMessage templateMessage = new WxMpTemplateMessage();
|
|
||||||
templateMessage.setTemplateId(template_id);
|
|
||||||
templateMessage.setToUser(openId);
|
|
||||||
templateMessage.setUrl(url);
|
|
||||||
List<WxMpTemplateData> data = new ArrayList<>();
|
List<WxMpTemplateData> data = new ArrayList<>();
|
||||||
data.add(new WxMpTemplateData("time5", orderTime));
|
data.add(new WxMpTemplateData("time6", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
||||||
data.add(new WxMpTemplateData("thing6", commodityName));
|
data.add(new WxMpTemplateData("character_string9", orderNo));
|
||||||
data.add(new WxMpTemplateData("amount8", orderAmount));
|
data.add(new WxMpTemplateData("short_thing5", "陪聊下单"));
|
||||||
data.add(new WxMpTemplateData("thing12", nickName));
|
data.add(new WxMpTemplateData("thing11", commodityName));
|
||||||
data.add(new WxMpTemplateData("character_string2", orderNo));
|
data.add(new WxMpTemplateData("amount8", money));
|
||||||
data.add(new WxMpTemplateData("time7", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
|
||||||
templateMessage.setData(data);
|
templateMessage.setData(data);
|
||||||
try {
|
try {
|
||||||
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error("接单成功发送消息异常", e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店员接单后,通过微信公众号发送消息
|
* 店员接单后,通过微信公众号发送消息
|
||||||
*
|
*
|
||||||
* @param tenantId 租户ID
|
* @param orderInfo
|
||||||
* @param openId 消息接收人openID
|
|
||||||
* @param userType 用户类型,0:顾客,1:店员
|
|
||||||
* @param nickName 消息内容-消息接收人昵称
|
|
||||||
* @param orderNo 消息内容-订单编号
|
|
||||||
* @param orderId 消息内容-订单ID
|
|
||||||
* @param orderAmount 消息内容-订单金额
|
|
||||||
* @author admin
|
* @author admin
|
||||||
* @since 2024/7/31 10:51
|
* @since 2024/7/31 10:51
|
||||||
**/
|
**/
|
||||||
public void sendOrderMessage(String tenantId, String openId, String userType, String nickName, String orderNo, String orderId, String orderAmount) {
|
public void sendOrderMessage(PlayOrderInfoEntity orderInfo) {
|
||||||
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(tenantId);
|
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(orderInfo.getTenantId());
|
||||||
String template_id = tenant.getXdcgtzTemplateId();
|
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(orderInfo.getAcceptBy());
|
||||||
String tenantKey = tenant.getTenantKey();
|
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(orderInfo.getPurchaserBy());
|
||||||
String url = "http://" + tenantKey + ".july.hucs.top/" + ("0".equals(userType) ? "user/#/orderDetail/" : "clerk/#/orderDetail/") + orderId;
|
|
||||||
WxMpTemplateMessage templateMessage = new WxMpTemplateMessage();
|
WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getJiedanchenggongtongzhiTemplateId(), clerkUserInfo.getOpenid(), "http://" + tenant.getTenantKey() + ".july.hucs.top/clerk/#/orderDetail/" + orderInfo.getId());
|
||||||
templateMessage.setTemplateId(template_id);
|
|
||||||
templateMessage.setToUser(openId);
|
|
||||||
templateMessage.setUrl(url);
|
|
||||||
List<WxMpTemplateData> data = new ArrayList<>();
|
List<WxMpTemplateData> data = new ArrayList<>();
|
||||||
data.add(new WxMpTemplateData("amount2", orderAmount));
|
data.add(new WxMpTemplateData("character_string1", orderInfo.getOrderNo()));
|
||||||
data.add(new WxMpTemplateData("thing12", nickName));
|
data.add(new WxMpTemplateData("time2", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
||||||
data.add(new WxMpTemplateData("character_string5", orderNo));
|
|
||||||
data.add(new WxMpTemplateData("time4", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
|
||||||
templateMessage.setData(data);
|
templateMessage.setData(data);
|
||||||
try {
|
try {
|
||||||
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
templateMessage.setToUser(customUserInfo.getOpenid());
|
||||||
|
templateMessage.setUrl("http://" + tenant.getTenantKey() + ".july.hucs.top/user/#/orderDetail/" + orderInfo.getId());
|
||||||
|
try {
|
||||||
|
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -275,4 +261,75 @@ public class WxCustomMpService {
|
|||||||
templateMessage.setUrl(url);
|
templateMessage.setUrl(url);
|
||||||
return templateMessage;
|
return templateMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendComplaintMessage(PlayOrderComplaintInfoEntity info, PlayOrderInfoEntity orderInfo) {
|
||||||
|
|
||||||
|
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(info.getTenantId());
|
||||||
|
List<PlayPersonnelAdminInfoEntity> adminInfoEntityList = playPersonnelAdminInfoService.list(Wrappers.lambdaQuery(PlayPersonnelAdminInfoEntity.class).select(PlayPersonnelAdminInfoEntity::getSysUserId));
|
||||||
|
|
||||||
|
for (PlayPersonnelAdminInfoEntity adminInfo : adminInfoEntityList) {
|
||||||
|
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.getOne(Wrappers.lambdaQuery(PlayClerkUserInfoEntity.class).eq(PlayClerkUserInfoEntity::getSysUserId, adminInfo.getSysUserId()), false);
|
||||||
|
if (Objects.isNull(clerkUserInfo)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getDingdantousuchuliTemplateId(), clerkUserInfo.getOpenid(), "http://" + tenant.getTenantKey() + ".july.hucs.top/clerk/#/admin/order/complain-list");
|
||||||
|
List<WxMpTemplateData> data = new ArrayList<>();
|
||||||
|
data.add(new WxMpTemplateData("character_string", orderInfo.getOrderNo()));
|
||||||
|
data.add(new WxMpTemplateData("time2", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
||||||
|
templateMessage.setData(data);
|
||||||
|
try {
|
||||||
|
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
log.error("发送投诉消息异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendOrderFinishMessage(PlayOrderInfoEntity order) {
|
||||||
|
if (order.getPlaceType().equals("1") || order.getPlaceType().equals("2")) {
|
||||||
|
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(order.getTenantId());
|
||||||
|
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(order.getPurchaserBy());
|
||||||
|
WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getDingdanwanchengtongzhiTemplateId(), customUserInfo.getOpenid(), "http://" + tenant.getTenantKey() + ".july.hucs.top/user/#/orderDetail/" + order.getId());
|
||||||
|
List<WxMpTemplateData> data = new ArrayList<>();
|
||||||
|
data.add(new WxMpTemplateData("time18", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
||||||
|
data.add(new WxMpTemplateData("character_string8", order.getOrderNo()));
|
||||||
|
data.add(new WxMpTemplateData("thing13", order.getCommodityName()));
|
||||||
|
templateMessage.setData(data);
|
||||||
|
try {
|
||||||
|
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
log.error("订单完成发送消息异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendOrderCancelMessage(PlayOrderInfoEntity orderInfo, String refundReason) {
|
||||||
|
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(orderInfo.getTenantId());
|
||||||
|
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(orderInfo.getAcceptBy());
|
||||||
|
PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(orderInfo.getPurchaserBy());
|
||||||
|
|
||||||
|
WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getQuxiaodingdantongzhiTemplateId(), clerkUserInfo.getOpenid(), "http://" + tenant.getTenantKey() + ".july.hucs.top/clerk/#/orderDetail/" + orderInfo.getId());
|
||||||
|
List<WxMpTemplateData> data = new ArrayList<>();
|
||||||
|
data.add(new WxMpTemplateData("character_string2", orderInfo.getOrderNo()));
|
||||||
|
data.add(new WxMpTemplateData("thing5", StringUtils.isEmpty(refundReason) ? "已取消" : refundReason));
|
||||||
|
data.add(new WxMpTemplateData("time18", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
|
||||||
|
templateMessage.setData(data);
|
||||||
|
try {
|
||||||
|
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
templateMessage.setToUser(customUserInfo.getOpenid());
|
||||||
|
templateMessage.setUrl("http://" + tenant.getTenantKey() + ".july.hucs.top/user/#/orderDetail/" + orderInfo.getId());
|
||||||
|
try {
|
||||||
|
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user