Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c57a4ae545
|
|
@ -1,10 +1,7 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserEditDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
|
||||
import com.czg.account.dto.shopuser.*;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.ShopUserFlow;
|
||||
import com.czg.account.service.ShopUserFlowService;
|
||||
|
|
@ -86,7 +83,7 @@ public class ShopUserController {
|
|||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||
@SaAdminCheckPermission(value = "shopUser:list", name = "店铺用户列表")
|
||||
@GetMapping
|
||||
public CzgResult<Page<ShopUser>> list(String key, Integer isVip) {
|
||||
public CzgResult<Page<ShopUserDTO>> list(String key, Integer isVip) {
|
||||
return CzgResult.success(shopUserService.getPage(key, isVip));
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +100,7 @@ public class ShopUserController {
|
|||
if (id == null && userId == null) {
|
||||
return CzgResult.failure("id和userId不能重复为空");
|
||||
}
|
||||
return CzgResult.success(shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, StpKit.USER.getShopId()).eq(ShopUser::getId, id).eq(ShopUser::getUserId, userId)));
|
||||
return CzgResult.success(shopUserService.getDetail(id, userId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -54,8 +54,16 @@ public class PrintMqListener {
|
|||
}
|
||||
|
||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE})
|
||||
public void orderPrint(String orderId) {
|
||||
invokeFun("orderPrint", "java.order", orderId, (data) -> printerHandler.handler(data, PrinterHandler.PrintTypeEnum.ONE_AND_ORDER));
|
||||
public void orderPrint(String req) {
|
||||
invokeFun("orderPrint", "java.order", req, (data) -> {
|
||||
JSONObject jsonObject = JSONObject.parseObject(data);
|
||||
String orderId = jsonObject.getString("orderId");
|
||||
if (orderId == null) {
|
||||
throw new RuntimeException("订单打印失败,未传递orderId");
|
||||
}
|
||||
Boolean printOrder = jsonObject.getBoolean("printOrder");
|
||||
printerHandler.handler(orderId, printOrder != null && !printOrder ? PrinterHandler.PrintTypeEnum.ORDER : PrinterHandler.PrintTypeEnum.ONE_AND_ORDER);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.config;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -45,10 +46,11 @@ public class RabbitPublisher {
|
|||
/**
|
||||
* 订单打印消息
|
||||
* @param orderId 订单id
|
||||
* @param printOrder 是否打印结算单
|
||||
*/
|
||||
public void sendOrderPrintMsg(String orderId) {
|
||||
public void sendOrderPrintMsg(String orderId, boolean printOrder) {
|
||||
//厨房票
|
||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, orderId);
|
||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
|
||||
//前台票
|
||||
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.account.dto.shopuser;
|
||||
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ShopUserDTO extends ShopUser {
|
||||
private Long couponNum;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ import com.mybatisflex.core.service.IService;
|
|||
*/
|
||||
public interface ShopUserService extends IService<ShopUser> {
|
||||
|
||||
Page<ShopUser> getPage(String key, Integer isVip);
|
||||
Page<ShopUserDTO> getPage(String key, Integer isVip);
|
||||
|
||||
Boolean updateInfo(Long shopId, ShopUserEditDTO shopUserEditDTO);
|
||||
|
||||
|
|
@ -39,4 +39,6 @@ public interface ShopUserService extends IService<ShopUser> {
|
|||
boolean join(Long shopId, Long userId, ShopUserAddDTO shopUserAddDTO);
|
||||
|
||||
ShopUserDetailDTO getInfo(Long shopId, long userId);
|
||||
|
||||
ShopUser getDetail(Integer id, Integer userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.account.dto.shopuser.ShopUserDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO;
|
||||
|
|
@ -10,6 +11,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户储值会员 映射层。
|
||||
|
|
@ -19,9 +21,7 @@ import java.time.LocalDateTime;
|
|||
*/
|
||||
public interface ShopUserMapper extends BaseMapper<ShopUser> {
|
||||
|
||||
Page<ShopUser> selectPageByKeyAndIsVip();
|
||||
|
||||
long selectPageByKeyAndIsVip_COUNT();
|
||||
List<ShopUserDTO> selectPageByKeyAndIsVip(@Param("shopId") Long shopId, @Param("isVip") Integer isVip, @Param("key") String key);
|
||||
|
||||
int incrAccount(@Param("shopId") long shopId, @Param("id") Long id, @Param("time") LocalDateTime time, @Param("money") BigDecimal money);
|
||||
int decrAccount(@Param("shopId") long shopId, @Param("id") Long id, @Param("time") LocalDateTime time, @Param("money") BigDecimal money);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import com.czg.system.service.SysParamsService;
|
|||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.JoinQueryWrapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
|
|
@ -78,23 +80,9 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopUser> getPage(String key, Integer isVip) {
|
||||
JoinQueryWrapper queryWrapper = new JoinQueryWrapper().eq(ShopUser::getShopId, StpKit.USER.getShopId());
|
||||
if (StrUtil.isNotBlank(key)) {
|
||||
queryWrapper.and(q -> {
|
||||
q.like(ShopUser::getNickName, key).or(r -> {
|
||||
r.like(ShopUser::getPhone, key);
|
||||
});
|
||||
});
|
||||
|
||||
// queryWrapper.and(column(UserInfo::getNickName).like(key).or(column(UserInfo::getPhone).like(key)));
|
||||
}
|
||||
|
||||
if (isVip != null) {
|
||||
queryWrapper.eq(ShopUser::getIsVip, isVip);
|
||||
}
|
||||
queryWrapper.orderBy(ShopUser::getId, false);
|
||||
return mapper.xmlPaginate("selectPageByKeyAndIsVip", PageUtil.buildPage(), queryWrapper);
|
||||
public Page<ShopUserDTO> getPage(String key, Integer isVip) {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
return PageUtil.convert(new PageInfo<>(mapper.selectPageByKeyAndIsVip(StpKit.USER.getShopId(), isVip, key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -340,4 +328,13 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
shopUserDetailDTO.setPayPwd(userInfo.getPayPwd());
|
||||
return shopUserDetailDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopUser getDetail(Integer id, Integer userId) {
|
||||
ShopUser shopUser = getOne(new QueryWrapper().eq(ShopUser::getShopId, StpKit.USER.getShopId()).eq(ShopUser::getId, id).eq(ShopUser::getUserId, userId));
|
||||
long count = shopActivateCouponRecordService.count(new QueryWrapper().eq(ShopActivateCouponRecord::getShopUserId, shopUser.getId()).eq(ShopActivateCouponRecord::getStatus, 0));
|
||||
ShopUserDTO shopUserDTO = BeanUtil.copyProperties(shopUser, ShopUserDTO.class);
|
||||
shopUserDTO.setCouponNum(count);
|
||||
return shopUserDTO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,11 +48,23 @@
|
|||
on c.shop_id = b.shop_id and c.shop_user_id = b.id and c.`status` = 1
|
||||
where a.id = #{userId}
|
||||
</select>
|
||||
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.entity.ShopUser">
|
||||
select tb_shop_user.*
|
||||
from tb_shop_user
|
||||
left join tb_user_info on tb_user_info.id = tb_shop_user.user_id ${qwSql}
|
||||
limit ${pageOffset}, ${pageSize}
|
||||
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.dto.shopuser.ShopUserDTO">
|
||||
SELECT
|
||||
a.*, count(c.id) couponNum
|
||||
FROM
|
||||
tb_shop_user a
|
||||
LEFT JOIN tb_user_info b ON b.id = a.user_id
|
||||
left join tb_shop_activate_coupon_record c on c.shop_user_id=a.id and c.`status`=0
|
||||
|
||||
where a.shop_id=#{shopId}
|
||||
<if test="isVip != null">
|
||||
and a.is_vip=#{isVip}
|
||||
</if>
|
||||
<if test="key != null and key != ''">
|
||||
and (a.nick_name like concat('%', #{key}, '%') or a.phone like concat('%', #{key}, '%'))
|
||||
</if>
|
||||
GROUP BY a.id
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
<select id="selectPageByKeyAndIsVip_COUNT" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ public abstract class PrinterHandler {
|
|||
// 判断订单是否是先付费或者已结算
|
||||
if (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus())) {
|
||||
log.warn("此订单未支付或已取消, 订单信息: {}", orderInfo);
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
if (tbOrderDetailList.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
);
|
||||
if ("after-pay".equals(orderInfo.getPayMode())) {
|
||||
//发送打票信息 后付费推送多次 需要处理
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString());
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString(), false);
|
||||
} else {
|
||||
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
||||
}
|
||||
|
|
@ -706,7 +706,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update();
|
||||
// if (!"after-pay".equals(orderInfo.getPayMode())) {
|
||||
//发送打票信息
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString());
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString(), true);
|
||||
// }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class PayServiceImpl implements PayService {
|
|||
OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
|
||||
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
|
||||
//发送打票信息
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString());
|
||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId().toString(), true);
|
||||
throw new PaySuccessException();
|
||||
}
|
||||
return orderInfo;
|
||||
|
|
|
|||
Loading…
Reference in New Issue