From db46827872aaf6d0394a83097443a3905fae2a40 Mon Sep 17 00:00:00 2001 From: admin <1752476835@qq.com> Date: Sun, 25 Aug 2024 23:58:37 +0800 Subject: [PATCH] fix --- .../controller/PlayOrderInfoController.java | 20 +-- .../mapper/PlayOrderRandomInfoMapper.java | 16 --- .../module/entity/PlayOrderInfoEntity.java | 17 +++ .../entity/PlayOrderRandomInfoEntity.java | 97 ------------- .../module/vo/PlayOrderDetailsReturnVo.java | 18 ++- .../order/service/IPlayOrderInfoService.java | 12 +- .../service/IPlayOrderRandomInfoService.java | 83 ----------- .../impl/PlayOrderInfoServiceImpl.java | 81 +++++++---- .../impl/PlayOrderRandomInfoServiceImpl.java | 136 ------------------ .../controller/WxCustomController.java | 33 +---- .../controller/WxOrderInfoController.java | 15 +- 11 files changed, 113 insertions(+), 415 deletions(-) delete mode 100644 play-admin/src/main/java/com/starry/admin/modules/order/mapper/PlayOrderRandomInfoMapper.java delete mode 100644 play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderRandomInfoEntity.java delete mode 100644 play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderRandomInfoService.java delete mode 100644 play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderRandomInfoServiceImpl.java diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/controller/PlayOrderInfoController.java b/play-admin/src/main/java/com/starry/admin/modules/order/controller/PlayOrderInfoController.java index 30782bf..2c744c2 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/order/controller/PlayOrderInfoController.java +++ b/play-admin/src/main/java/com/starry/admin/modules/order/controller/PlayOrderInfoController.java @@ -4,10 +4,8 @@ import com.starry.admin.common.exception.CustomException; import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity; import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService; import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity; -import com.starry.admin.modules.order.module.entity.PlayOrderRandomInfoEntity; import com.starry.admin.modules.order.module.vo.*; import com.starry.admin.modules.order.service.IPlayOrderInfoService; -import com.starry.admin.modules.order.service.IPlayOrderRandomInfoService; import com.starry.admin.modules.order.service.IPlayOrderRefundInfoService; import com.starry.admin.modules.shop.module.vo.PlayCommodityInfoVo; import com.starry.admin.modules.shop.service.IPlayCommodityInfoService; @@ -35,11 +33,10 @@ import java.math.BigDecimal; public class PlayOrderInfoController { @Resource private IPlayOrderInfoService orderInfoService; - @Resource - private IPlayOrderRandomInfoService playOrderRandomInfoService; @Resource private WxCustomMpService wxCustomMpService; + @Resource private IPlayClerkUserInfoService playClerkUserInfoService; @@ -133,20 +130,17 @@ public class PlayOrderInfoController { if (!"1".equals(orderInfo.getPlaceType())) { throw new CustomException("订单类型错误,无法重新抢单"); } - PlayOrderRandomInfoEntity randomInfoEntity = new PlayOrderRandomInfoEntity(); - randomInfoEntity.setId(vo.getOrderId()); - randomInfoEntity.setSex(vo.getSex()); - randomInfoEntity.setLevelId(vo.getLevelId()); - randomInfoEntity.setExcludeHistory(vo.getExcludeHistory()); - randomInfoEntity.setRemark(vo.getRemark()); - playOrderRandomInfoService.update(randomInfoEntity); PlayOrderInfoEntity updateOrderInfo = new PlayOrderInfoEntity(); - updateOrderInfo.setId(orderInfo.getId()); + updateOrderInfo.setSex(vo.getSex()); + updateOrderInfo.setLevelId(vo.getLevelId()); + updateOrderInfo.setExcludeHistory(vo.getExcludeHistory()); + updateOrderInfo.setRemark(vo.getRemark()); + updateOrderInfo.setId(vo.getOrderId()); updateOrderInfo.setOrderStatus("0"); updateOrderInfo.setAcceptBy(""); updateOrderInfo.setEstimatedRevenueRatio(0); updateOrderInfo.setEstimatedRevenue(BigDecimal.ZERO); - randomInfoEntity.setRemark(vo.getRemark()); + updateOrderInfo.setRemark(vo.getRemark()); return R.ok(orderInfoService.update(updateOrderInfo)); } diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/mapper/PlayOrderRandomInfoMapper.java b/play-admin/src/main/java/com/starry/admin/modules/order/mapper/PlayOrderRandomInfoMapper.java deleted file mode 100644 index a92e677..0000000 --- a/play-admin/src/main/java/com/starry/admin/modules/order/mapper/PlayOrderRandomInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.starry.admin.modules.order.mapper; - - -import com.github.yulichang.base.MPJBaseMapper; -import com.starry.admin.modules.order.module.entity.PlayOrderRandomInfoEntity; - -/** - * 随机单列表Mapper接口 - * - * @author admin - * @since 2024-05-29 - */ -public interface PlayOrderRandomInfoMapper extends MPJBaseMapper { - - -} diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderInfoEntity.java b/play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderInfoEntity.java index 04b5aad..5c109e1 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderInfoEntity.java +++ b/play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderInfoEntity.java @@ -297,6 +297,23 @@ public class PlayOrderInfoEntity extends BaseEntity { */ private String ordersExpiredState; + + /** + * 随机单要求-店员性别(0:未知;1:男;2:女) + */ + private String sex; + + /** + * 随机单要求-店员等级ID + */ + private String levelId; + + /** + * 随机单要求-是否排除下单过的成员(0:不排除;1:排除) + */ + private String excludeHistory; + + public PlayOrderInfoEntity() { diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderRandomInfoEntity.java b/play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderRandomInfoEntity.java deleted file mode 100644 index 41f7957..0000000 --- a/play-admin/src/main/java/com/starry/admin/modules/order/module/entity/PlayOrderRandomInfoEntity.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.starry.admin.modules.order.module.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.starry.admin.common.conf.StringTypeHandler; -import com.starry.common.domain.BaseEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 随机单列表对象 play_order_random_info - * - * @author admin - * @since 2024-05-29 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName(value = "play_order_random_info", autoResultMap = true) -public class PlayOrderRandomInfoEntity extends BaseEntity { - - - /** - * UUID - */ - private String id; - - /** - * 租户ID - */ - private String tenantId; - - /** - * 店员性别(0:未知;1:男;2:女) - */ - private String sex; - - /** - * 店员等级ID - */ - private String levelId; - - /** - * 标签列表 - */ - @TableField(typeHandler = StringTypeHandler.class) - private List labels; - - /** - * 商品ID - */ - private String commodityId; - - /** - * 商品单价 - */ - private BigDecimal commodityPrice; - - /** - * 商品属性-服务时长 - **/ - private String serviceDuration; - - /** - * 商品名称 - */ - private String commodityName; - - /** - * 商品数量 - */ - private String commodityNumber; - - /** - * 微信号 - */ - private String weiChatCode; - - /** - * 是否排除下单过的成员(0:不排除;1:排除) - */ - private String excludeHistory; - - /** - * 备注 - */ - private String remark; - - /** - * 下单人 - */ - private String purchaserBy; - - -} diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/module/vo/PlayOrderDetailsReturnVo.java b/play-admin/src/main/java/com/starry/admin/modules/order/module/vo/PlayOrderDetailsReturnVo.java index 6e68cb2..ee98c91 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/order/module/vo/PlayOrderDetailsReturnVo.java +++ b/play-admin/src/main/java/com/starry/admin/modules/order/module/vo/PlayOrderDetailsReturnVo.java @@ -164,7 +164,6 @@ public class PlayOrderDetailsReturnVo { */ private String firstOrder; - /** * 是否评价(1:已评价;0:未评价) */ @@ -175,5 +174,22 @@ public class PlayOrderDetailsReturnVo { */ private String complaint = "0"; + /** + * 预计收入 + */ + private BigDecimal estimatedRevenue; + + /** + * 店员收入比例 + */ + private Integer estimatedRevenueRatio; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + + } \ No newline at end of file diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderInfoService.java b/play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderInfoService.java index 6e2ce4c..0325c2e 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderInfoService.java +++ b/play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderInfoService.java @@ -64,10 +64,13 @@ public interface IPlayOrderInfoService extends IService { * @param weiChatCode 订单微信号码 * @param couponIds 优惠券ID列表 * @param remark 订单备注 + * @param clerkSex 随机单要求-店员性别(0:未知;1:男;2:女) + * @param clerkLevelId 随机单要求-店员等级ID + * @param excludeHistory 随机单要求-是否排除下单过的成员(0:不排除;1:排除) * @author admin * @since 2024/6/3 10:53 **/ - void createOrderInfo(String orderId, String orderNo, String orderState, String orderType, String placeType, String rewardType, String firstOrder, String commodityId, String commodityType, BigDecimal commodityPrice, String serviceDuration, String commodityName, String commodityNumber, BigDecimal orderMoney, BigDecimal finalAmount, BigDecimal discountAmount, String purchaserBy, String acceptBy, String weiChatCode, List couponIds, String remark); + void createOrderInfo(String orderId, String orderNo, String orderState, String orderType, String placeType, String rewardType, String firstOrder, String commodityId, String commodityType, BigDecimal commodityPrice, String serviceDuration, String commodityName, String commodityNumber, BigDecimal orderMoney, BigDecimal finalAmount, BigDecimal discountAmount, String purchaserBy, String acceptBy, String weiChatCode, List couponIds, String remark, String clerkSex, String clerkLevelId, String excludeHistory); /** @@ -150,7 +153,7 @@ public interface IPlayOrderInfoService extends IService { /** - * 根据订单ID查询订单评价信息 + * 根据订单ID查询订单信息 * * @param orderId 订单ID * @return 订单信息 @@ -308,10 +311,11 @@ public interface IPlayOrderInfoService extends IService { /** * 查询未接单的订单 * - * @param vo 查询对象 + * @param vo 查询对象 + * @param clerkId 店员ID * @return 订单列表 */ - IPage selectRandomOrderByPage(PlayOrderInfoRandomQueryVo vo); + IPage selectRandomOrderByPage(PlayOrderInfoRandomQueryVo vo, String clerkId); /** * 分页获取打赏动态 diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderRandomInfoService.java b/play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderRandomInfoService.java deleted file mode 100644 index ed5a0e5..0000000 --- a/play-admin/src/main/java/com/starry/admin/modules/order/service/IPlayOrderRandomInfoService.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.starry.admin.modules.order.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.starry.admin.modules.order.module.entity.PlayOrderRandomInfoEntity; -import com.starry.admin.modules.weichat.entity.order.PlayClerkRandomOrderDetailReturnVo; -import com.starry.admin.modules.weichat.entity.order.PlayOrderInfoRandomQueryVo; -import com.starry.admin.modules.weichat.entity.order.PlayRandomOrderInfoReturnVo; - -/** - * 随机单列表Service接口 - * - * @author admin - * @since 2024-05-29 - */ -public interface IPlayOrderRandomInfoService extends IService { - /** - * 查询随机单列表 - * - * @param id 随机单列表主键 - * @return 随机单列表 - */ - PlayOrderRandomInfoEntity selectPlayOrderRandomInfoById(String id); - - /** - * 查询随机单列表列表 - * - * @param playOrderRandomInfo 随机单列表 - * @return 随机单列表集合 - */ - IPage selectPlayOrderRandomInfoByPage(PlayOrderRandomInfoEntity playOrderRandomInfo); - - /** - * 分页查询随机单列表 - * - * @param vo 随机单分页查询订单对象 - * @return 随机单列表集合 - */ - IPage selectByPage(PlayOrderInfoRandomQueryVo vo); - - /** - * 查询随机单详情 - * - * @param id 订单ID - * @param clerkId 店员ID - * @return com.starry.admin.modules.weichat.entity.order.PlayClerkOrderListReturnVo - * @author admin - * @since 2024/5/30 9:55 - **/ - PlayClerkRandomOrderDetailReturnVo clerkSelectOrderDetails(String id, String clerkId); - - /** - * 新增随机单列表 - * - * @param playOrderRandomInfo 随机单列表 - * @return 结果 - */ - boolean create(PlayOrderRandomInfoEntity playOrderRandomInfo); - - /** - * 修改随机单列表 - * - * @param playOrderRandomInfo 随机单列表 - * @return 结果 - */ - boolean update(PlayOrderRandomInfoEntity playOrderRandomInfo); - - /** - * 批量删除随机单列表 - * - * @param ids 需要删除的随机单列表主键集合 - * @return 结果 - */ - int deletePlayOrderRandomInfoByIds(String[] ids); - - /** - * 删除随机单列表信息 - * - * @param id 随机单列表主键 - * @return 结果 - */ - int deletePlayOrderRandomInfoById(String id); -} diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderInfoServiceImpl.java b/play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderInfoServiceImpl.java index 888ef1a..826c3c6 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderInfoServiceImpl.java +++ b/play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderInfoServiceImpl.java @@ -9,15 +9,22 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.starry.admin.common.exception.CustomException; import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity; import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity; +import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService; import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService; import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity; import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity; import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService; import com.starry.admin.modules.order.mapper.PlayOrderInfoMapper; import com.starry.admin.modules.order.module.constant.OrderConstant; -import com.starry.admin.modules.order.module.entity.*; +import com.starry.admin.modules.order.module.entity.PlayOrderComplaintInfoEntity; +import com.starry.admin.modules.order.module.entity.PlayOrderEvaluateInfoEntity; +import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity; +import com.starry.admin.modules.order.module.entity.PlayOrderRefundInfoEntity; import com.starry.admin.modules.order.module.vo.*; -import com.starry.admin.modules.order.service.*; +import com.starry.admin.modules.order.service.IPlayOrderComplaintInfoService; +import com.starry.admin.modules.order.service.IPlayOrderEvaluateInfoService; +import com.starry.admin.modules.order.service.IPlayOrderInfoService; +import com.starry.admin.modules.order.service.IPlayOrderRefundInfoService; import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService; import com.starry.admin.modules.shop.module.vo.PlayCouponDetailsReturnVo; import com.starry.admin.modules.shop.service.IPlayCouponDetailsService; @@ -36,7 +43,10 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Random; import java.util.stream.Collectors; import static com.starry.admin.modules.order.module.constant.OrderConstant.ORDER_STATUS_2; @@ -67,8 +77,7 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl getTotalOrderInfo(String tenantId) { @@ -87,7 +99,7 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl couponIds, String remark) { + public void createOrderInfo(String orderId, String orderNo, String orderState, String orderType, String placeType, String rewardType, String firstOrder, String commodityId, String commodityType, BigDecimal commodityPrice, String serviceDuration, String commodityName, String commodityNumber, BigDecimal orderMoney, BigDecimal finalAmount, BigDecimal discountAmount, String purchaserBy, String acceptBy, String weiChatCode, List couponIds, String remark, String clerkSex, String clerkLevelId, String excludeHistory) { PlayOrderInfoEntity entity = new PlayOrderInfoEntity(); entity.setId(orderId); entity.setOrderNo(orderNo); @@ -116,6 +128,11 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl selectRandomOrderByPage(PlayOrderInfoRandomQueryVo vo) { + public IPage selectRandomOrderByPage(PlayOrderInfoRandomQueryVo vo, String clerkId) { + PlayClerkUserInfoEntity entity = playClerkUserInfoService.getById(clerkId); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(PlayOrderInfoEntity::getPlaceType, "1"); lambdaQueryWrapper.eq(PlayOrderInfoEntity::getOrderStatus, "0"); + lambdaQueryWrapper.eq(PlayOrderInfoEntity::getLevelId, entity.getLevelId()); + lambdaQueryWrapper.eq(PlayOrderInfoEntity::getSex, entity.getSex()); + lambdaQueryWrapper.eq(PlayOrderInfoEntity::getExcludeHistory, "0").or(wrapper1 -> wrapper1.ne(PlayOrderInfoEntity::getAcceptBy, clerkId).and(wrapper2 -> wrapper2.eq(PlayOrderInfoEntity::getExcludeHistory, 1))); return this.baseMapper.selectPage(new Page<>(vo.getPageNum(), vo.getPageSize()), lambdaQueryWrapper); } @@ -432,7 +453,7 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl lambdaQueryWrapper = new MPJLambdaWrapper(); + MPJLambdaWrapper lambdaQueryWrapper = new MPJLambdaWrapper<>(); // 查询主表全部字段 lambdaQueryWrapper.selectAll(PlayOrderInfoEntity.class); // 查询顾客表 @@ -478,18 +499,7 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl clerkIdList = playClerkGroupInfoService.getValidClerkIdList(SecurityUtils.getLoginUser(), vo.getClerkNickName()); lambdaQueryWrapper.in(PlayOrderInfoEntity::getAcceptBy, clerkIdList); - - - Page page = this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayOrderInfoReturnVo.class, lambdaQueryWrapper); - page.getRecords().forEach(ca -> { - if ("1".equals(ca.getPlaceType())) { - PlayOrderRandomInfoEntity randomInfo = playOrderRandomInfoService.getById(ca.getId()); - if (Objects.nonNull(randomInfo)) { - ca.setLabels(randomInfo.getLabels()); - } - } - }); - return page; + return this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayOrderInfoReturnVo.class, lambdaQueryWrapper); } @@ -642,6 +652,26 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PlayOrderInfoEntity::getAcceptBy, acceptBy); + if ("1".equals(orderInfo.getExcludeHistory()) && this.baseMapper.selectOne(lambdaQueryWrapper) != null) { + throw new CustomException("只有未接单的店员才可接单"); + } + } PlayOrderInfoEntity entity = new PlayOrderInfoEntity(orderId, OrderConstant.ORDER_STATUS_1); entity.setAcceptBy(acceptBy); entity.setAcceptTime(LocalDateTime.now()); @@ -650,9 +680,8 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl images) { PlayOrderInfoEntity orderInfo = this.selectOrderInfoById(orderId); - if ("0".equals(operatorByType)) { - if (!orderInfo.getPurchaserBy().equals(operatorBy)) { + if ("0".equals(operatorByType) && !operatorBy.equals(orderInfo.getPurchaserBy())) { throw new CustomException("只能操作本人订单"); - } } - if ("1".equals(operatorByType)) { - if (!orderInfo.getAcceptBy().equals(operatorBy)) { + if ("1".equals(operatorByType) && !operatorBy.equals(orderInfo.getAcceptBy())) { throw new CustomException("只能操作本人订单"); - } } // 取消订单(必须订单未接单或者为开始状态) if (!orderInfo.getOrderStatus().equals(OrderConstant.ORDER_STATUS_0) && !orderInfo.getOrderStatus().equals(OrderConstant.ORDER_STATUS_1)) { diff --git a/play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderRandomInfoServiceImpl.java b/play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderRandomInfoServiceImpl.java deleted file mode 100644 index 1a0ee44..0000000 --- a/play-admin/src/main/java/com/starry/admin/modules/order/service/impl/PlayOrderRandomInfoServiceImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.starry.admin.modules.order.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.yulichang.wrapper.MPJLambdaWrapper; -import com.starry.admin.modules.order.mapper.PlayOrderRandomInfoMapper; -import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity; -import com.starry.admin.modules.order.module.entity.PlayOrderRandomInfoEntity; -import com.starry.admin.modules.order.module.vo.ClerkEstimatedRevenueVo; -import com.starry.admin.modules.order.service.IPlayOrderInfoService; -import com.starry.admin.modules.order.service.IPlayOrderRandomInfoService; -import com.starry.admin.modules.weichat.entity.order.PlayClerkRandomOrderDetailReturnVo; -import com.starry.admin.modules.weichat.entity.order.PlayOrderInfoRandomQueryVo; -import com.starry.admin.modules.weichat.entity.order.PlayRandomOrderInfoReturnVo; -import com.starry.common.utils.IdUtils; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.Arrays; - -/** - * 随机单列表Service业务层处理 - * - * @author admin - * @since 2024-05-29 - */ -@Service -public class PlayOrderRandomInfoServiceImpl extends ServiceImpl implements IPlayOrderRandomInfoService { - @Resource - private PlayOrderRandomInfoMapper playOrderRandomInfoMapper; - - @Resource - private IPlayOrderInfoService playOrderInfoService; - - /** - * 查询随机单列表 - * - * @param id 随机单列表主键 - * @return 随机单列表 - */ - @Override - public PlayOrderRandomInfoEntity selectPlayOrderRandomInfoById(String id) { - return this.baseMapper.selectById(id); - } - - /** - * 查询随机单列表列表 - * - * @param playOrderRandomInfo 随机单列表 - * @return 随机单列表 - */ - @Override - public IPage selectPlayOrderRandomInfoByPage(PlayOrderRandomInfoEntity playOrderRandomInfo) { - Page page = new Page<>(1, 10); - return this.baseMapper.selectPage(page, new LambdaQueryWrapper()); - } - - - @Override - public PlayClerkRandomOrderDetailReturnVo clerkSelectOrderDetails(String id, String clerkId) { - MPJLambdaWrapper lambdaWrapper = new MPJLambdaWrapper<>(); - lambdaWrapper.selectAll(PlayOrderRandomInfoEntity.class); - lambdaWrapper.selectAll(PlayOrderInfoEntity.class); - lambdaWrapper.leftJoin(PlayOrderInfoEntity.class, PlayOrderInfoEntity::getId, PlayOrderRandomInfoEntity::getId); - lambdaWrapper.eq(PlayOrderRandomInfoEntity::getId, id); - PlayClerkRandomOrderDetailReturnVo vo = this.baseMapper.selectJoinOne(PlayClerkRandomOrderDetailReturnVo.class, lambdaWrapper); - - PlayOrderInfoEntity orderInfo = playOrderInfoService.selectOrderInfoById(id); - ClerkEstimatedRevenueVo estimatedRevenueVo = playOrderInfoService.getClerkEstimatedRevenue(clerkId, orderInfo.getCouponIds(), orderInfo.getPlaceType(), orderInfo.getFirstOrder(), orderInfo.getFinalAmount()); - vo.setEstimatedRevenue(estimatedRevenueVo.getRevenueAmount()); - vo.setEstimatedRevenueRatio(estimatedRevenueVo.getRevenueRatio()); - return vo; - } - - @Override - public IPage selectByPage(PlayOrderInfoRandomQueryVo vo) { - MPJLambdaWrapper lambdaWrapper = new MPJLambdaWrapper<>(); - // 查询随机单全部字段 - lambdaWrapper.selectAll(PlayOrderRandomInfoEntity.class); - // 订单表 - lambdaWrapper.selectAll(PlayOrderInfoEntity.class); - lambdaWrapper.leftJoin(PlayOrderInfoEntity.class, PlayOrderInfoEntity::getId, PlayOrderRandomInfoEntity::getId); - lambdaWrapper.eq(PlayOrderInfoEntity::getOrderStatus, "0"); - return this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayRandomOrderInfoReturnVo.class, lambdaWrapper); - } - - /** - * 新增随机单列表 - * - * @param playOrderRandomInfo 随机单列表 - * @return 结果 - */ - @Override - public boolean create(PlayOrderRandomInfoEntity playOrderRandomInfo) { - if (StrUtil.isBlankIfStr(playOrderRandomInfo.getId())) { - playOrderRandomInfo.setId(IdUtils.getUuid()); - } - return save(playOrderRandomInfo); - } - - /** - * 修改随机单列表 - * - * @param playOrderRandomInfo 随机单列表 - * @return 结果 - */ - @Override - public boolean update(PlayOrderRandomInfoEntity playOrderRandomInfo) { - return updateById(playOrderRandomInfo); - } - - /** - * 批量删除随机单列表 - * - * @param ids 需要删除的随机单列表主键 - * @return 结果 - */ - @Override - public int deletePlayOrderRandomInfoByIds(String[] ids) { - return playOrderRandomInfoMapper.deleteBatchIds(Arrays.asList(ids)); - } - - /** - * 删除随机单列表信息 - * - * @param id 随机单列表主键 - * @return 结果 - */ - @Override - public int deletePlayOrderRandomInfoById(String id) { - return playOrderRandomInfoMapper.deleteById(id); - } -} 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 71f357b..866b10e 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 @@ -23,11 +23,9 @@ 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.PlayOrderEvaluateInfoEntity; import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity; -import com.starry.admin.modules.order.module.entity.PlayOrderRandomInfoEntity; import com.starry.admin.modules.order.service.IPlayOrderComplaintInfoService; import com.starry.admin.modules.order.service.IPlayOrderEvaluateInfoService; import com.starry.admin.modules.order.service.IPlayOrderInfoService; -import com.starry.admin.modules.order.service.IPlayOrderRandomInfoService; import com.starry.admin.modules.shop.module.entity.PlayClerkGiftInfoEntity; import com.starry.admin.modules.shop.module.entity.PlayCouponInfoEntity; import com.starry.admin.modules.shop.module.entity.PlayGiftInfoEntity; @@ -105,8 +103,6 @@ public class WxCustomController { @Resource private IPlayOrderEvaluateInfoService playOrderEvaluateInfoService; - @Resource - private IPlayOrderRandomInfoService playOrderRandomInfoService; @Resource private IPlayCustomGiftInfoService playCustomGiftInfoService; @@ -206,19 +202,14 @@ public class WxCustomController { MoneyUtils.verificationTypeIsNormal(vo.getMoney()); String userId = ThreadLocalRequestDetail.getCustomUserInfo().getId(); PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(userId); - PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId()); if (new BigDecimal(vo.getMoney()).compareTo(customUserInfo.getAccountBalance()) > 0) { throw new ServiceException("余额不足", 998); } 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.createRewardOrder(orderId, new BigDecimal(vo.getMoney()), new BigDecimal(vo.getMoney()), userId, clerkUserInfo.getId(), vo.getRemark(), vo.getWeiChatCode()); + 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); - // 陪聊增加余额 - // clerkUserInfoService.updateAccountBalanceById(clerkUserInfo.getId(), clerkUserInfo.getAccountBalance(), clerkUserInfo.getAccountBalance().add(new BigDecimal(vo.getMoney())), "2", "打赏", new BigDecimal(vo.getMoney()), orderId); return R.ok("成功"); } @@ -232,20 +223,16 @@ public class WxCustomController { String userId = ThreadLocalRequestDetail.getCustomUserInfo().getId(); PlayGiftInfoEntity giftInfo = giftInfoService.selectPlayGiftInfoById(vo.getGiftId()); PlayCustomUserInfoEntity customUserInfo = customUserInfoService.selectById(userId); - PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(vo.getClerkId()); BigDecimal money = giftInfo.getPrice().multiply(new BigDecimal(vo.getGiftQuantity())); if (money.compareTo(customUserInfo.getAccountBalance()) > 0) { throw new ServiceException("余额不足", 998); } 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.createGiftOrder(orderId, vo.getGiftId(), giftInfo.getPrice(), String.valueOf(vo.getGiftQuantity()), money, money, userId, clerkUserInfo.getId(), vo.getRemark(), vo.getWeiChatCode()); + 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); // 陪聊增加余额 - // clerkUserInfoService.updateAccountBalanceById(clerkUserInfo.getId(), clerkUserInfo.getAccountBalance(), clerkUserInfo.getAccountBalance().add(money), "2", "赠送礼物", money, orderId); // 修改顾客和礼物消息 PlayCustomGiftInfoEntity customGiftInfoEntity = playCustomGiftInfoService.selectByGiftIdAndCustomId(vo.getGiftId(), userId); if (customGiftInfoEntity == null) { @@ -311,12 +298,11 @@ 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); // 发送通知给店员 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("成功"); } @@ -339,19 +325,8 @@ public class WxCustomController { throw new ServiceException("余额不足", 998); } String orderId = IdUtils.getUuid(); - - PlayOrderRandomInfoEntity orderRandomInfo = ConvertUtil.entityToVo(vo, PlayOrderRandomInfoEntity.class); - orderRandomInfo.setCommodityId(commodityInfo.getCommodityId()); - orderRandomInfo.setCommodityName(commodityInfo.getCommodityName()); - orderRandomInfo.setCommodityPrice(commodityInfo.getCommodityPrice()); - orderRandomInfo.setCommodityNumber(String.valueOf(vo.getCommodityQuantity())); - orderRandomInfo.setServiceDuration(commodityInfo.getServiceDuration()); - orderRandomInfo.setId(orderId); - playOrderRandomInfoService.create(orderRandomInfo); // 记录订单信息 - 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()); - - // playOrderInfoService.createRandomOrder(orderId, customUserInfo.getId(), commodityInfo.getCommodityPrice(), String.valueOf(vo.getCommodityQuantity()), commodityInfo.getServiceDuration(), commodityInfo.getCommodityName(), money, money, customId, vo.getRemark(), vo.getWeiChatCode()); + 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()); // 顾客减少余额 customUserInfoService.updateAccountBalanceById(customUserInfo.getId(), customUserInfo.getAccountBalance(), customUserInfo.getAccountBalance().subtract(money), "1", "下单-随机单", money, BigDecimal.ZERO, orderId); // 记录订单,指定指定未接单后,进行退款处理 diff --git a/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxOrderInfoController.java b/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxOrderInfoController.java index 8c356dd..5bb18ff 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxOrderInfoController.java +++ b/play-admin/src/main/java/com/starry/admin/modules/weichat/controller/WxOrderInfoController.java @@ -9,11 +9,14 @@ import com.starry.admin.modules.order.module.entity.PlayOrderContinueInfoEntity; import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity; import com.starry.admin.modules.order.module.vo.PlayOrderContinueQueryVo; import com.starry.admin.modules.order.module.vo.PlayOrderContinueReturnVo; +import com.starry.admin.modules.order.module.vo.PlayOrderDetailsReturnVo; import com.starry.admin.modules.order.module.vo.PlayOrderReviewStateEditVo; import com.starry.admin.modules.order.service.IPlayOrderContinueInfoService; import com.starry.admin.modules.order.service.IPlayOrderInfoService; -import com.starry.admin.modules.order.service.IPlayOrderRandomInfoService; -import com.starry.admin.modules.weichat.entity.order.*; +import com.starry.admin.modules.weichat.entity.order.PlayOrderInfoContinueAdd; +import com.starry.admin.modules.weichat.entity.order.PlayOrderInfoContinueQueryVo; +import com.starry.admin.modules.weichat.entity.order.PlayOrderInfoRandomQueryVo; +import com.starry.admin.modules.weichat.entity.order.PlayRewardOrderQueryVo; import com.starry.common.result.R; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; @@ -41,10 +44,6 @@ public class WxOrderInfoController { private IPlayOrderContinueInfoService playOrderContinueInfoService; - @Resource - private IPlayOrderRandomInfoService playOrderRandomInfoService; - - /** * 续单申请-店员发起 * @@ -89,7 +88,7 @@ public class WxOrderInfoController { @ClerkUserLogin @PostMapping("/clerk/selectRandomOrderByPage") public R selectUnacceptedOrderByPage(@Validated @RequestBody PlayOrderInfoRandomQueryVo vo) { - return R.ok(playOrderRandomInfoService.selectByPage(vo)); + return R.ok(playOrderInfoService.selectRandomOrderByPage(vo,ThreadLocalRequestDetail.getClerkUserInfo().getId())); } /** @@ -101,7 +100,7 @@ public class WxOrderInfoController { @ClerkUserLogin @GetMapping("/clerk/selectRandomOrderById") public R selectUnacceptedOrderByPage(@RequestParam("id") String id) { - PlayClerkRandomOrderDetailReturnVo vo = playOrderRandomInfoService.clerkSelectOrderDetails(id,ThreadLocalRequestDetail.getClerkUserInfo().getId()); + PlayOrderDetailsReturnVo vo = playOrderInfoService.selectById(id); if (vo == null) { throw new CustomException("订单不存在"); }