This commit is contained in:
hucs
2024-08-01 18:26:23 +08:00
parent 06b7978a74
commit fc69d764d5
3 changed files with 36 additions and 2 deletions

View File

@@ -143,9 +143,13 @@ public class SysTenantEntity extends BaseEntity<SysTenantEntity> {
*/
private String remarks;
// 充值成功通知模板id
private String czcgtzTemplateId;
// 下单通知模板id
private String xdcgtzTemplateId;
// 收到新订单通知模板id
private String sdxddtzTemplateId;
// 认证申请审核通知模板id
private String rzsqshtxTemplateId;
}

View File

@@ -308,6 +308,7 @@ public class WxCustomController {
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.sendNewOrderMessageForClerk(clerkUserInfo, orderNo, commodityInfo.getCommodityName(), money);
return R.ok("成功");
}

View File

@@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -153,6 +154,7 @@ public class WxCustomMpService {
}
}
/**
* 通过微信公众号发送消息
*
@@ -216,4 +218,31 @@ public class WxCustomMpService {
}
}
// 发送新订单通知给店员
public void sendNewOrderMessageForClerk(PlayClerkUserInfoEntity clerkUserInfo, String orderNo, String commodityName, BigDecimal money) {
String touser = clerkUserInfo.getOpenid();
SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(clerkUserInfo.getTenantId());
String tenantKey = tenant.getTenantKey();
String url = "http://" + tenantKey + ".july.hucs.top/user/";
String template_id = tenant.getSdxddtzTemplateId();
WxMpTemplateMessage templateMessage = new WxMpTemplateMessage();
templateMessage.setTemplateId(template_id);
templateMessage.setToUser(touser);
templateMessage.setUrl(url);
List<WxMpTemplateData> data = new ArrayList<>();
data.add(new WxMpTemplateData("thing6", commodityName));
data.add(new WxMpTemplateData("time5", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
data.add(new WxMpTemplateData("time7", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")));
data.add(new WxMpTemplateData("character_string2", orderNo));
data.add(new WxMpTemplateData("amount8", money.toString()));
templateMessage.setData(data);
try {
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
} catch (WxErrorException e) {
log.error(e.getMessage(), e);
}
}
}