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