From 4e034ef310ebbd45b4ef7c044c96698ac5cd6370 Mon Sep 17 00:00:00 2001 From: hucs Date: Tue, 6 Aug 2024 14:03:50 +0800 Subject: [PATCH] fix --- .../PlayPersonnelGroupInfoServiceImpl.java | 2 +- .../platform/entity/SysTenantEntity.java | 2 + .../weichat/controller/WxClerkController.java | 11 +++++ .../weichat/service/WxCustomMpService.java | 40 ++++++++++++++++++- 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/play-admin/src/main/java/com/starry/admin/modules/personnel/service/impl/PlayPersonnelGroupInfoServiceImpl.java b/play-admin/src/main/java/com/starry/admin/modules/personnel/service/impl/PlayPersonnelGroupInfoServiceImpl.java index 7a956dd..6031389 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/personnel/service/impl/PlayPersonnelGroupInfoServiceImpl.java +++ b/play-admin/src/main/java/com/starry/admin/modules/personnel/service/impl/PlayPersonnelGroupInfoServiceImpl.java @@ -132,7 +132,7 @@ public class PlayPersonnelGroupInfoServiceImpl extends ServiceImpl { private String sdxddtzTemplateId; // 认证申请审核通知模板id private String rzsqshtxTemplateId; + // 认证申请通知for管理员 + private String rzsqAdminTemplateId; } diff --git a/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxClerkController.java b/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxClerkController.java index 46d784a..792539f 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxClerkController.java +++ b/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxClerkController.java @@ -31,6 +31,7 @@ import com.starry.admin.modules.weichat.entity.gift.PlayClerkGiftReturnVo; import com.starry.admin.modules.weichat.entity.order.PlayClerkOrderDetailsReturnVo; import com.starry.admin.modules.weichat.entity.order.PlayClerkOrderInfoQueryVo; import com.starry.admin.modules.weichat.entity.order.PlayClerkOrderListReturnVo; +import com.starry.admin.modules.weichat.service.WxCustomMpService; import com.starry.admin.modules.weichat.service.WxCustomUserService; import com.starry.admin.utils.SecurityUtils; import com.starry.admin.utils.SmsUtils; @@ -103,6 +104,8 @@ public class WxClerkController { private IPlayPersonnelGroupInfoService playPersonnelGroupInfoService; @Resource private SmsUtils smsUtils; + @Resource + private WxCustomMpService wxCustomMpService; /** @@ -208,6 +211,14 @@ public class WxClerkController { entity.setClerkId(clerkId); entity.setAddTime(LocalDateTime.now()); playClerkUserReviewInfoService.create(entity); + wxCustomMpService.sendClerkApplyNoticeForAdmin(userInfo); + return R.ok("申请成功"); + } + + @PostMapping("/user/add/test") + public R test() { + PlayClerkUserInfoEntity userInfo = playClerkUserInfoService.selectById("ILbjarTt"); + wxCustomMpService.sendClerkApplyNoticeForAdmin(userInfo); return R.ok("申请成功"); } diff --git a/play-admin/src/main/java/com/starry/admin/modules/weichat/service/WxCustomMpService.java b/play-admin/src/main/java/com/starry/admin/modules/weichat/service/WxCustomMpService.java index 9983ce5..2a04dcd 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/weichat/service/WxCustomMpService.java +++ b/play-admin/src/main/java/com/starry/admin/modules/weichat/service/WxCustomMpService.java @@ -2,6 +2,7 @@ package com.starry.admin.modules.weichat.service; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; @@ -9,9 +10,12 @@ import com.starry.admin.common.exception.CustomException; import com.starry.admin.common.play.wx.WeChatConstants; import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity; import com.starry.admin.modules.clerk.module.entity.PlayClerkUserReviewInfoEntity; +import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService; import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity; import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService; import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity; +import com.starry.admin.modules.personnel.module.entity.PlayPersonnelAdminInfoEntity; +import com.starry.admin.modules.personnel.service.IPlayPersonnelAdminInfoService; import com.starry.admin.modules.platform.entity.SysTenantEntity; import com.starry.admin.modules.platform.service.impl.SysTenantServiceImpl; import com.starry.admin.utils.SecurityUtils; @@ -25,10 +29,10 @@ 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; +import java.util.Objects; /** * @author admin @@ -44,6 +48,10 @@ public class WxCustomMpService { private SysTenantServiceImpl tenantService; @Resource private IPlayCustomUserInfoService customUserInfoService; + @Resource + private IPlayPersonnelAdminInfoService playPersonnelAdminInfoService; + @Resource + private IPlayClerkUserInfoService clerkUserInfoService; public WxMpService proxyWxMpService() { @@ -219,6 +227,36 @@ public class WxCustomMpService { } + public void sendClerkApplyNoticeForAdmin(PlayClerkUserInfoEntity entity) { + SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(entity.getTenantId()); + String template_id = tenant.getRzsqAdminTemplateId(); + String tenantKey = tenant.getTenantKey(); + String url = "http://" + tenantKey + ".july.hucs.top/clerk/"; + List adminInfoEntityList = playPersonnelAdminInfoService.list(Wrappers.lambdaQuery(PlayPersonnelAdminInfoEntity.class).select(PlayPersonnelAdminInfoEntity::getSysUserId)); + for (PlayPersonnelAdminInfoEntity adminInfoEntity : adminInfoEntityList) { + PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.getOne(Wrappers.lambdaQuery(PlayClerkUserInfoEntity.class).eq(PlayClerkUserInfoEntity::getSysUserId, adminInfoEntity.getSysUserId()), false); + if (Objects.isNull(clerkUserInfo)) { + continue; + } + WxMpTemplateMessage templateMessage = new WxMpTemplateMessage(); + templateMessage.setTemplateId(template_id); + templateMessage.setToUser(clerkUserInfo.getOpenid()); + templateMessage.setUrl(url); + List data = new ArrayList<>(); + data.add(new WxMpTemplateData("phone_number15", entity.getPhone())); + data.add(new WxMpTemplateData("thing11", entity.getNickname())); + data.add(new WxMpTemplateData("thing3", "有新的店员提交了审核,请前去查看")); + templateMessage.setData(data); + try { + proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage); + } catch (WxErrorException e) { + log.error(e.getMessage(), e); + + } + } + + } + // 发送新订单通知给店员 // public void sendNewOrderMessageForClerk(PlayClerkUserInfoEntity clerkUserInfo, String orderNo, String commodityName, BigDecimal money) { // String touser = clerkUserInfo.getOpenid();