From 203d17c0f3fa43d2ad1142c13afcbb9aad6389fa Mon Sep 17 00:00:00 2001 From: huchuansai Date: Wed, 3 Sep 2025 10:40:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=98=AF=C3=A5=C2=AF=E9=9A=8F=C3=A5=20?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlayClerkUserReviewInfoServiceImpl.java | 3 + .../controller/WxCustomController.java | 132 ++++++------------ .../weichat/service/WxCustomMpService.java | 40 +++--- 3 files changed, 71 insertions(+), 104 deletions(-) diff --git a/play-admin/src/main/java/com/starry/admin/modules/clerk/service/impl/PlayClerkUserReviewInfoServiceImpl.java b/play-admin/src/main/java/com/starry/admin/modules/clerk/service/impl/PlayClerkUserReviewInfoServiceImpl.java index 9c0ac46..c55ec2d 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/clerk/service/impl/PlayClerkUserReviewInfoServiceImpl.java +++ b/play-admin/src/main/java/com/starry/admin/modules/clerk/service/impl/PlayClerkUserReviewInfoServiceImpl.java @@ -163,6 +163,9 @@ public class PlayClerkUserReviewInfoServiceImpl userInfo.setClerkState("1"); userInfo.setId(entity.getClerkId()); userInfo.setAlbum(entity.getAlbum()); + if(entity.getSex().equals("0")){ + userInfo.setSex("2"); + } playClerkUserInfoService.update(userInfo); clerkCommodityService.initClerkCommodity(userInfo.getId()); } diff --git a/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxCustomController.java b/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxCustomController.java index 20c4e79..8c36fde 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxCustomController.java +++ b/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxCustomController.java @@ -3,6 +3,7 @@ package com.starry.admin.modules.weichat.controller; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.starry.admin.common.aspect.CustomUserLogin; import com.starry.admin.common.conf.ThreadLocalRequestDetail; import com.starry.admin.common.exception.CustomException; @@ -57,6 +58,7 @@ import io.swagger.annotations.ApiResponses; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; +import java.util.List; import java.util.Objects; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; @@ -126,8 +128,7 @@ public class WxCustomController { /** * 根据店员ID查询店员详细信息 * - * @param id - * 店员ID + * @param id 店员ID * @return 店员详细信息 */ @ApiOperation(value = "查询店员详细信息", notes = "根据店员ID查询店员的详细信息") @@ -184,8 +185,7 @@ public class WxCustomController { @ApiResponses({@ApiResponse(code = 200, message = "操作成功")}) @CustomUserLogin @PostMapping("/updateHideLevelState") - public R updateHideLevelState( - @ApiParam(value = "隐藏等级状态信息", required = true) @Validated @RequestBody PlayCustomHideLevelStateEditVo vo) { + public R updateHideLevelState(@ApiParam(value = "隐藏等级状态信息", required = true) @Validated @RequestBody PlayCustomHideLevelStateEditVo vo) { vo.setId(ThreadLocalRequestDetail.getCustomUserInfo().getId()); PlayCustomUserInfoEntity entity = new PlayCustomUserInfoEntity(); BeanUtils.copyProperties(vo, entity); @@ -200,8 +200,7 @@ public class WxCustomController { @ApiResponses({@ApiResponse(code = 200, message = "操作成功")}) @CustomUserLogin @PostMapping("/updateHideRankingState") - public R updateHideRankingState( - @ApiParam(value = "隐藏排名状态信息", required = true) @Validated @RequestBody PlayCustomHideRankingStateEditVo vo) { + public R updateHideRankingState(@ApiParam(value = "隐藏排名状态信息", required = true) @Validated @RequestBody PlayCustomHideRankingStateEditVo vo) { vo.setId(ThreadLocalRequestDetail.getCustomUserInfo().getId()); PlayCustomUserInfoEntity entity = new PlayCustomUserInfoEntity(); BeanUtils.copyProperties(vo, entity); @@ -216,8 +215,7 @@ public class WxCustomController { @ApiResponses({@ApiResponse(code = 200, message = "操作成功"), @ApiResponse(code = 998, message = "余额不足")}) @CustomUserLogin @PostMapping("/order/reward") - public R rewardToOrder( - @ApiParam(value = "打赏信息", required = true) @Validated @RequestBody PlayOrderInfoRewardAdd vo) { + public R rewardToOrder(@ApiParam(value = "打赏信息", required = true) @Validated @RequestBody PlayOrderInfoRewardAdd vo) { MoneyUtils.verificationTypeIsNormal(vo.getMoney()); String userId = ThreadLocalRequestDetail.getCustomUserInfo().getId(); PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(userId); @@ -226,14 +224,9 @@ public class WxCustomController { } String orderId = IdUtils.getUuid(); // 记录订单信息 - playOrderInfoService.createOrderInfo(orderId, playOrderInfoService.getOrderNo(), "3", "2", "2", "0", "1", "", - "0", BigDecimal.ZERO, "", "", "0", new BigDecimal(vo.getMoney()), new BigDecimal(vo.getMoney()), - BigDecimal.ZERO, userId, vo.getClerkId(), vo.getWeiChatCode(), new ArrayList<>(), vo.getRemark(), "", - "", ""); + playOrderInfoService.createOrderInfo(orderId, playOrderInfoService.getOrderNo(), "3", "2", "2", "0", "1", "", "0", BigDecimal.ZERO, "", "", "0", new BigDecimal(vo.getMoney()), new BigDecimal(vo.getMoney()), BigDecimal.ZERO, userId, vo.getClerkId(), vo.getWeiChatCode(), new ArrayList<>(), vo.getRemark(), "", "", ""); // 顾客减少余额 - customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), - customUserInfo.getAccountBalance().subtract(new BigDecimal(vo.getMoney())), "1", "打赏", - new BigDecimal(vo.getMoney()), BigDecimal.ZERO, orderId); + customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(new BigDecimal(vo.getMoney())), "1", "打赏", new BigDecimal(vo.getMoney()), BigDecimal.ZERO, orderId); return R.ok("成功"); } @@ -254,17 +247,12 @@ public class WxCustomController { } String orderId = IdUtils.getUuid(); // 记录订单信息 - playOrderInfoService.createOrderInfo(orderId, playOrderInfoService.getOrderNo(), "3", "2", "2", "1", "1", - giftInfo.getId(), "0", giftInfo.getPrice(), "", giftInfo.getName(), - String.valueOf(vo.getGiftQuantity()), money, money, BigDecimal.ZERO, userId, vo.getClerkId(), - vo.getWeiChatCode(), new ArrayList<>(), vo.getRemark(), "", "", ""); + playOrderInfoService.createOrderInfo(orderId, playOrderInfoService.getOrderNo(), "3", "2", "2", "1", "1", giftInfo.getId(), "0", giftInfo.getPrice(), "", giftInfo.getName(), String.valueOf(vo.getGiftQuantity()), money, money, BigDecimal.ZERO, userId, vo.getClerkId(), vo.getWeiChatCode(), new ArrayList<>(), vo.getRemark(), "", "", ""); // 顾客减少余额 - 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); // 陪聊增加余额 // 修改顾客和礼物消息 - PlayCustomGiftInfoEntity customGiftInfoEntity = playCustomGiftInfoService - .selectByGiftIdAndCustomId(vo.getGiftId(), userId); + PlayCustomGiftInfoEntity customGiftInfoEntity = playCustomGiftInfoService.selectByGiftIdAndCustomId(vo.getGiftId(), userId); if (customGiftInfoEntity == null) { customGiftInfoEntity = new PlayCustomGiftInfoEntity(); customGiftInfoEntity.setGiffId(vo.getGiftId()); @@ -277,8 +265,7 @@ public class WxCustomController { } // 修改陪玩和礼物数据 - PlayClerkGiftInfoEntity clerkGiftInfoEntity = playClerkGiftInfoService.selectByGiftIdAndClerkId(vo.getGiftId(), - vo.getClerkId()); + PlayClerkGiftInfoEntity clerkGiftInfoEntity = playClerkGiftInfoService.selectByGiftIdAndClerkId(vo.getGiftId(), vo.getClerkId()); if (clerkGiftInfoEntity == null) { clerkGiftInfoEntity = new PlayClerkGiftInfoEntity(); clerkGiftInfoEntity.setGiffId(vo.getGiftId()); @@ -296,24 +283,20 @@ public class WxCustomController { /** * 新增指定订单 * - * @param vo - * 指定订单查询对象 + * @param vo 指定订单查询对象 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 16:31 **/ @ApiOperation(value = "商品下单", notes = "顾客购买店员服务商品") - @ApiResponses({@ApiResponse(code = 200, message = "操作成功"), @ApiResponse(code = 998, message = "余额不足"), - @ApiResponse(code = 500, message = "请求参数异常")}) + @ApiResponses({@ApiResponse(code = 200, message = "操作成功"), @ApiResponse(code = 998, message = "余额不足"), @ApiResponse(code = 500, message = "请求参数异常")}) @CustomUserLogin @PostMapping("/order/commodity") - public R commodityToOrdder( - @ApiParam(value = "商品订单信息", required = true) @Validated @RequestBody PlayOrderInfoCommodityAdd vo) { + public R commodityToOrdder(@ApiParam(value = "商品订单信息", required = true) @Validated @RequestBody PlayOrderInfoCommodityAdd vo) { String customId = ThreadLocalRequestDetail.getCustomUserInfo().getId(); PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId()); - PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(vo.getCommodityId(), - clerkUserInfo.getLevelId()); + PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(vo.getCommodityId(), clerkUserInfo.getLevelId()); BigDecimal couponMoney = BigDecimal.ZERO; for (String couponId : vo.getCouponIds()) { @@ -321,10 +304,8 @@ public class WxCustomController { if (Objects.isNull(couponDetailsEntity)) { throw new CustomException("优惠券不存在"); } - PlayCouponInfoEntity couponInfo = playCouponInfoService - .selectPlayCouponInfoById(couponDetailsEntity.getCouponId()); - String couponReasonForUnavailableUse = playCouponInfoService.getCouponReasonForUnavailableUse(couponInfo, - "0", vo.getCommodityId(), vo.getCommodityQuantity(), commodityInfo.getCommodityPrice()); + PlayCouponInfoEntity couponInfo = playCouponInfoService.selectPlayCouponInfoById(couponDetailsEntity.getCouponId()); + String couponReasonForUnavailableUse = playCouponInfoService.getCouponReasonForUnavailableUse(couponInfo, "0", vo.getCommodityId(), vo.getCommodityQuantity(), commodityInfo.getCommodityPrice()); if (StrUtil.isNotBlank(couponReasonForUnavailableUse)) { throw new CustomException("优惠券不可用"); } @@ -348,25 +329,18 @@ public class WxCustomController { String orderId = IdUtils.getUuid(); String orderNo = playOrderInfoService.getOrderNo(); // 记录订单信息 - playOrderInfoService.createOrderInfo(orderId, orderNo, "0", "2", "0", "", "1", commodityInfo.getCommodityId(), - "1", commodityInfo.getCommodityPrice(), commodityInfo.getServiceDuration(), - commodityInfo.getCommodityName(), String.valueOf(vo.getCommodityQuantity()), money, money, - BigDecimal.ZERO, customId, clerkUserInfo.getId(), vo.getWeiChatCode(), vo.getCouponIds(), - vo.getRemark(), "", "", ""); + playOrderInfoService.createOrderInfo(orderId, orderNo, "0", "2", "0", "", "1", commodityInfo.getCommodityId(), "1", commodityInfo.getCommodityPrice(), commodityInfo.getServiceDuration(), commodityInfo.getCommodityName(), String.valueOf(vo.getCommodityQuantity()), money, money, BigDecimal.ZERO, customId, clerkUserInfo.getId(), vo.getWeiChatCode(), vo.getCouponIds(), vo.getRemark(), "", "", ""); // 顾客减少余额 - 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(), orderNo, - money.toString(), commodityInfo.getCommodityName()); + wxCustomMpService.sendCreateOrderMessage(clerkUserInfo.getTenantId(), clerkUserInfo.getOpenid(), orderNo, money.toString(), commodityInfo.getCommodityName()); return R.ok("成功"); } /** * 新增随机订单 * - * @param vo - * 随机单创建对象 + * @param vo 随机单创建对象 * @return R */ @CustomUserLogin @@ -375,23 +349,20 @@ public class WxCustomController { // 验证当前顾客余额是否充足 String customId = ThreadLocalRequestDetail.getCustomUserInfo().getId(); PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(customId); - PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(vo.getCommodityId(), - vo.getLevelId()); + PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(vo.getCommodityId(), vo.getLevelId()); BigDecimal money = commodityInfo.getCommodityPrice().multiply(new BigDecimal(vo.getCommodityQuantity())); if (money.compareTo(customUserInfo.getAccountBalance()) > 0) { throw new ServiceException("余额不足", 998); } String orderId = IdUtils.getUuid(); + String orderNo = playOrderInfoService.getOrderNo(); // 记录订单信息 - playOrderInfoService.createOrderInfo(orderId, playOrderInfoService.getOrderNo(), "0", "2", "1", "", "1", - commodityInfo.getCommodityId(), "1", commodityInfo.getCommodityPrice(), - commodityInfo.getServiceDuration(), commodityInfo.getCommodityName(), - String.valueOf(vo.getCommodityQuantity()), money, money, BigDecimal.ZERO, customId, "", - vo.getWeiChatCode(), vo.getCouponIds(), vo.getRemark(), vo.getSex(), vo.getLevelId(), - vo.getExcludeHistory()); + playOrderInfoService.createOrderInfo(orderId, orderNo, "0", "2", "1", "", "1", commodityInfo.getCommodityId(), "1", commodityInfo.getCommodityPrice(), commodityInfo.getServiceDuration(), commodityInfo.getCommodityName(), String.valueOf(vo.getCommodityQuantity()), money, money, BigDecimal.ZERO, customId, "", vo.getWeiChatCode(), vo.getCouponIds(), vo.getRemark(), vo.getSex(), vo.getLevelId(), vo.getExcludeHistory()); // 顾客减少余额 - 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); + // 给全部店员发送通知 + List clerkList = clerkUserInfoService.list(Wrappers.lambdaQuery(PlayClerkUserInfoEntity.class).isNotNull(PlayClerkUserInfoEntity::getOpenid).eq(PlayClerkUserInfoEntity::getLevelId, vo.getLevelId()).eq(PlayClerkUserInfoEntity::getClerkState, "1").eq(PlayClerkUserInfoEntity::getSex, vo.getSex())); + wxCustomMpService.sendCreateOrderMessageBatch(clerkList, orderNo, money.toString(), commodityInfo.getCommodityName()); // 记录订单,指定指定未接单后,进行退款处理 overdueOrderHandlerTask.enqueue(orderId + "_" + SecurityUtils.getTenantId()); // 下单成功后,先根据用户条件进行随机分配 @@ -401,8 +372,7 @@ public class WxCustomController { /** * 顾客分页查询本人订单列表 * - * @param vo - * 订单列表分页查询对象 + * @param vo 订单列表分页查询对象 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -418,8 +388,7 @@ public class WxCustomController { /** * 顾客分页查询本人订单详细信息 * - * @param id - * 订单ID + * @param id 订单ID * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -427,16 +396,14 @@ public class WxCustomController { @CustomUserLogin @GetMapping("/order/queryById") public R queryById(@RequestParam("id") String id) { - PlayCustomOrderDetailsReturnVo vo = playOrderInfoService - .customSelectOrderDetails(ThreadLocalRequestDetail.getCustomUserInfo().getId(), id); + PlayCustomOrderDetailsReturnVo vo = playOrderInfoService.customSelectOrderDetails(ThreadLocalRequestDetail.getCustomUserInfo().getId(), id); return R.ok(vo); } /** * 顾客-完成订单 * - * @param id - * 订单ID + * @param id 订单ID * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -451,8 +418,7 @@ public class WxCustomController { /** * 顾客取消订单 * - * @param vo - * 订单取消对象 + * @param vo 订单取消对象 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -460,16 +426,14 @@ public class WxCustomController { @CustomUserLogin @PostMapping("/order/cancellation") public R cancellationOrder(@Validated @RequestBody PlayOrderCancellationVo vo) { - playOrderInfoService.updateStateTo4("0", ThreadLocalRequestDetail.getCustomUserInfo().getId(), vo.getOrderId(), - vo.getRefundReason(), vo.getImages()); + playOrderInfoService.updateStateTo4("0", ThreadLocalRequestDetail.getCustomUserInfo().getId(), vo.getOrderId(), vo.getRefundReason(), vo.getImages()); return R.ok("取消成功"); } /** * 新增订单评价信息 * - * @param vo - * 订单评价信息实体 + * @param vo 订单评价信息实体 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -490,8 +454,7 @@ public class WxCustomController { /** * 根据订单ID查询当前顾客对当前人的评价 * - * @param orderId - * 订单ID + * @param orderId 订单ID * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -499,8 +462,7 @@ public class WxCustomController { @CustomUserLogin @GetMapping("/order/evaluate/queryByOrderId") public R addOrderEvaluateByOrderId(@RequestParam("id") String orderId) { - PlayOrderEvaluateInfoEntity orderEvaluateInfo = playOrderEvaluateInfoService - .queryCustomToOrderEvaluateInfo(ThreadLocalRequestDetail.getCustomUserInfo().getId(), orderId); + PlayOrderEvaluateInfoEntity orderEvaluateInfo = playOrderEvaluateInfoService.queryCustomToOrderEvaluateInfo(ThreadLocalRequestDetail.getCustomUserInfo().getId(), orderId); if (orderEvaluateInfo == null) { throw new CustomException("当前订单未评价"); } @@ -510,8 +472,7 @@ public class WxCustomController { /** * 新增订单投诉信息 * - * @param vo - * 订单评价信息实体 + * @param vo 订单评价信息实体 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -532,8 +493,7 @@ public class WxCustomController { /** * 顾客新增留言 * - * @param vo - * 顾客新增留言对象 + * @param vo 顾客新增留言对象 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -559,8 +519,7 @@ public class WxCustomController { @GetMapping("/leave/queryPermission") public R queryLeavePermission() { // 不允许留言的原因,如果原因为空,说明允许留言 - String noMessagesAllowedReason = playCustomLeaveMsgService - .queryNoMessagesAllowedReason(ThreadLocalRequestDetail.getCustomUserInfo().getId()); + String noMessagesAllowedReason = playCustomLeaveMsgService.queryNoMessagesAllowedReason(ThreadLocalRequestDetail.getCustomUserInfo().getId()); if (StringUtils.isEmpty(noMessagesAllowedReason)) { JSONObject jsonObject = new JSONObject(); jsonObject.put("permission", true); @@ -577,8 +536,7 @@ public class WxCustomController { /** * 顾客修改对陪玩的关注状态 * - * @param vo - * 陪玩的关注状态对象 + * @param vo 陪玩的关注状态对象 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 @@ -587,16 +545,14 @@ public class WxCustomController { @PostMapping("/followState/update") public R followStateUpdate(@Validated @RequestBody PlayClerkFollowStateUpdate vo) { PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId()); - playCustomFollowInfoService.updateFollowState(ThreadLocalRequestDetail.getCustomUserInfo().getId(), - clerkUserInfo.getId(), vo.getFollowState()); + playCustomFollowInfoService.updateFollowState(ThreadLocalRequestDetail.getCustomUserInfo().getId(), clerkUserInfo.getId(), vo.getFollowState()); return R.ok("修改成功"); } /** * 顾客查询已关注陪聊列表 * - * @param vo - * 陪玩的关注状态对象 + * @param vo 陪玩的关注状态对象 * @return com.starry.common.result.R * @author admin * @since 2024/5/8 15:57 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 8d80847..b548dd0 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.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.service.WxPayService; @@ -31,6 +32,7 @@ import me.chanjar.weixin.mp.bean.template.WxMpTemplateData; import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage; import me.chanjar.weixin.mp.config.impl.WxMpMapConfigImpl; import org.apache.commons.lang3.StringUtils; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; /** @@ -51,6 +53,8 @@ public class WxCustomMpService { private IPlayPersonnelAdminInfoService playPersonnelAdminInfoService; @Resource private IPlayClerkUserInfoService clerkUserInfoService; + @Resource + private ThreadPoolTaskExecutor executor; /** * 支付成功回调地址 @@ -103,8 +107,7 @@ public class WxCustomMpService { /** * 充值成功-发送微信消息 * - * @param order - * 订单信息 + * @param order 订单信息 */ public void sendBalanceMessage(PlayOrderInfoEntity order) { PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(order.getPurchaserBy()); @@ -124,20 +127,27 @@ public class WxCustomMpService { } } + public void sendCreateOrderMessageBatch(List clerkList, String orderNo, String string, String commodityName) { + if (CollectionUtils.isEmpty(clerkList)) return; + + executor.execute(() -> { + clerkList.parallelStream().forEach(ca -> { + sendCreateOrderMessage(ca.getTenantId(), ca.getOpenid(), orderNo, string, commodityName); + }); + }); + } + /** * 顾客下指定单后,给店员发新订单通知 通过微信公众号发送消息 * - * @param tenantId - * 租户ID - * @param openId - * 消息接收人openID - * @param orderNo - * 消息内容-订单编号 + * @param tenantId 租户ID + * @param openId 消息接收人openID + * @param orderNo 消息内容-订单编号 * @param money * @param commodityName */ public void sendCreateOrderMessage(String tenantId, String openId, String orderNo, String money, - String commodityName) { + String commodityName) { SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(tenantId); WxMpTemplateMessage templateMessage = getWxMpTemplateMessage(tenant.getXindingdanshoulitongzhiTemplateId(), @@ -194,7 +204,7 @@ public class WxCustomMpService { } public void sendCheckMessage(PlayClerkUserReviewInfoEntity entity, PlayClerkUserInfoEntity userInfo, - String reviewState) { + String reviewState) { String touser = userInfo.getOpenid(); SysTenantEntity tenant = tenantService.selectSysTenantByTenantId(userInfo.getTenantId()); @@ -258,12 +268,9 @@ public class WxCustomMpService { /** * 获取微信发啥消息模板 * - * @param templateId - * 消息模板ID - * @param toUser - * 发送目标用户ID - * @param url - * 消息回调地址 + * @param templateId 消息模板ID + * @param toUser 发送目标用户ID + * @param url 消息回调地址 * @return WxMpTemplateMessage */ public WxMpTemplateMessage getWxMpTemplateMessage(String templateId, String toUser, String url) { @@ -358,4 +365,5 @@ public class WxCustomMpService { } + }