This commit is contained in:
PQZ 2024-09-20 22:59:42 +08:00
parent 8ead3de94c
commit 629b6ad13e
20 changed files with 303 additions and 120 deletions

View File

@ -55,4 +55,23 @@ public class BaseConstants {
public static final String ARCHIVES_TYPE = "archives_type";
/**卡片关联关系主表*/
public static final String ACTIVE_RULE_COUPON_ACTIVE = "dl_active_main";
/**卡券积分变更记录-充值*/
public static final String BALANCE_CHANGE_TYPE_CZ = "cz";
/**卡券积分变更记录-退款*/
public static final String BALANCE_CHANGE_TYPE_TK = "tk";
/**卡券积分变更记录-消费*/
public static final String BALANCE_CHANGE_TYPE_XF = "xf";
/**卡券积分变更记录-赠送*/
public static final String BALANCE_CHANGE_TYPE_ZS = "zs";
/**卡券积分变更记录-卡券核销*/
public static final String BALANCE_CHANGE_TYPE_KQHX = "kqhx";
/**卡券积分变更主体-余额*/
public static final String BALANCE_CHANGE_MAIN_YE = "ye";
/**卡券积分变更主体-卡券*/
public static final String BALANCE_CHANGE_MAIN_KQ = "kq";
/**卡券积分变更核销规则-计次*/
public static final String BALANCE_CHANGE_RULE_JC = "jc";
/**卡券积分变更核销规则-金额*/
public static final String BALANCE_CHANGE_RULE_ME = "je";
}

View File

@ -1,22 +1,22 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
import cn.iocoder.yudao.module.custom.service.CustomerBalanceChangeService;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -29,45 +29,24 @@ public class CustomerBalanceChangeController {
@Resource
private CustomerBalanceChangeService customerBalanceChangeService;
@PostMapping("/create")
@Operation(summary = "创建用户积分(余额)、卡券变动记录")
@PreAuthorize("@ss.hasPermission('base:customer-balance-change:create')")
public CommonResult<String> createCustomerBalanceChange(@Valid @RequestBody CustomerBalanceChangeSaveReqVO createReqVO) {
return success(customerBalanceChangeService.createCustomerBalanceChange(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新用户积分(余额)、卡券变动记录")
@PreAuthorize("@ss.hasPermission('base:customer-balance-change:update')")
public CommonResult<Boolean> updateCustomerBalanceChange(@Valid @RequestBody CustomerBalanceChangeSaveReqVO updateReqVO) {
customerBalanceChangeService.updateCustomerBalanceChange(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除用户积分(余额)、卡券变动记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:customer-balance-change:delete')")
public CommonResult<Boolean> deleteCustomerBalanceChange(@RequestParam("id") String id) {
customerBalanceChangeService.deleteCustomerBalanceChange(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得用户积分(余额)、卡券变动记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:customer-balance-change:query')")
public CommonResult<CustomerBalanceChangeRespVO> getCustomerBalanceChange(@RequestParam("id") String id) {
CustomerBalanceChange customerBalanceChange = customerBalanceChangeService.getCustomerBalanceChange(id);
return success(BeanUtils.toBean(customerBalanceChange, CustomerBalanceChangeRespVO.class));
}
/**
* 分页查询变更记录
*
* @param pageReqVO CustomerBalanceChangePageReqVO实体
* @param pageNo 分页参数
* @param pageSize 分页参数
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
* @author PQZ
* @date 22:37 2024/9/20
**/
@GetMapping("/page")
@Operation(summary = "获得用户积分(余额)、卡券变动记录分页")
@PreAuthorize("@ss.hasPermission('base:customer-balance-change:query')")
public CommonResult<PageResult<CustomerBalanceChangeRespVO>> getCustomerBalanceChangePage(@Valid CustomerBalanceChangePageReqVO pageReqVO) {
PageResult<CustomerBalanceChange> pageResult = customerBalanceChangeService.getCustomerBalanceChangePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CustomerBalanceChangeRespVO.class));
public CommonResult<IPage<?>> getCustomerBalanceChangePage(CustomerBalanceChangePageReqVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<CustomerBalanceChangeRespVO> page = new Page<>(pageNo, pageSize);
return success(customerBalanceChangeService.queryListPage(pageReqVO,page));
}

View File

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.custom.service.CustomerBalanceService;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceSaveReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;

View File

@ -44,6 +44,13 @@ public class CustomerCouponController {
return success(true);
}
/**
* 删除用户卡券
* @author PQZ
* @date 22:57 2024/9/20
* @param id TODO
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
**/
@DeleteMapping("/delete")
@Operation(summary = "删除用户卡券")
@Parameter(name = "id", description = "编号", required = true)
@ -53,13 +60,19 @@ public class CustomerCouponController {
return success(true);
}
/**
* 获取卡券信息及当前消费记录
* @author PQZ
* @date 22:56 2024/9/20
* @param id 用户卡券id
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO>
**/
@GetMapping("/get")
@Operation(summary = "获得用户卡券")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:customer-coupon:query')")
public CommonResult<CustomerCouponRespVO> getCustomerCoupon(@RequestParam("id") String id) {
CustomerCoupon customerCoupon = customerCouponService.getCustomerCoupon(id);
return success(BeanUtils.toBean(customerCoupon, CustomerCouponRespVO.class));
return success(customerCouponService.getCustomerCoupon(id));
}
@GetMapping("/page")

View File

@ -55,18 +55,10 @@ public class CustomerBalanceChange extends TenantBaseDO {
* 变动金额
*/
private BigDecimal changeBalance;
/**
* 变动次数
*/
private Integer changeNum;
/**
* 变动后剩余积分
*/
private BigDecimal remBalance;
/**
* 变动后剩余次数
*/
private Integer remNum;
/**
* 变动原因
*/

View File

@ -1,8 +1,13 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 用户积分余额卡券变动记录 Mapper
@ -12,6 +17,14 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerBalanceChangeMapper extends BaseMapper<CustomerBalanceChange> {
/**
* @param entity CustomerBalanceChangePageReqVO实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO>
* @author PQZ
* @date 22:40 2024/9/20
**/
IPage<CustomerBalanceChangeRespVO> queryListPage(@Param("entity") CustomerBalanceChangePageReqVO entity, Page<CustomerBalanceChangeRespVO> page);
}

View File

@ -1,8 +1,12 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.CustomerCoupon;
import cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户积分余额 Mapper
@ -12,6 +16,14 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerCouponMapper extends BaseMapper<CustomerCoupon> {
/**
* 根据用户id获取卡券信息
*
* @param cusId 用户id
* @return java.util.List<cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO>
* @author PQZ
* @date 20:44 2024/9/20
**/
List<CustomerCouponRespVO> listByCusId(@Param("cusId") String cusId);
}

View File

@ -1,12 +1,14 @@
package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeSaveReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
/**
* 用户积分余额卡券变动记录 Service 接口
@ -16,34 +18,20 @@ import javax.validation.Valid;
public interface CustomerBalanceChangeService extends IService<CustomerBalanceChange> {
/**
* 创建用户积分余额卡券变动记录
*
* @param createReqVO 创建信息
* @return 编号
*/
String createCustomerBalanceChange(@Valid CustomerBalanceChangeSaveReqVO createReqVO);
* @param cusId 客户id
* @param userId 用户id
* @param couponId 关联卡券id
* @param changeType 变动类型
* @param changeMain 变动主体
* @param changeRule 变动规则
* @param changeBalance 变动积分/次数
* @param remBalance 变动后剩余积分/次数
* @param reason 变动原因
* @author PQZ
* @date 21:54 2024/9/20
**/
void saveChange(String cusId, Integer userId, String couponId, String changeType, String changeMain, String changeRule, BigDecimal changeBalance, BigDecimal remBalance, String reason);
/**
* 更新用户积分余额卡券变动记录
*
* @param updateReqVO 更新信息
*/
void updateCustomerBalanceChange(@Valid CustomerBalanceChangeSaveReqVO updateReqVO);
/**
* 删除用户积分余额卡券变动记录
*
* @param id 编号
*/
void deleteCustomerBalanceChange(String id);
/**
* 获得用户积分余额卡券变动记录
*
* @param id 编号
* @return 用户积分余额卡券变动记录
*/
CustomerBalanceChange getCustomerBalanceChange(String id);
/**
* 获得用户积分余额卡券变动记录分页
@ -51,6 +39,17 @@ public interface CustomerBalanceChangeService extends IService<CustomerBalanceCh
* @param pageReqVO 分页查询
* @return 用户积分余额卡券变动记录分页
*/
PageResult<CustomerBalanceChange> getCustomerBalanceChangePage(CustomerBalanceChangePageReqVO pageReqVO);
IPage<CustomerBalanceChangeRespVO> queryListPage(CustomerBalanceChangePageReqVO pageReqVO, Page<CustomerBalanceChangeRespVO> page);
/**
* 通过用户id和卡券id查询积分卡券的变动记录
*
* @param cusId 用户id
* @param couponId 卡券id
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange>
* @author PQZ
* @date 22:48 2024/9/20
**/
List<CustomerBalanceChange> getCouponChange(String cusId, String couponId);
}

View File

@ -3,10 +3,12 @@ package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.custom.entity.CustomerCoupon;
import cn.iocoder.yudao.module.custom.vo.CustomerCouponPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerCouponSaveReqVO;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.util.List;
/**
* 用户卡券 Service 接口
@ -38,12 +40,13 @@ public interface CustomerCouponService extends IService<CustomerCoupon> {
void deleteCustomerCoupon(String id);
/**
* 获得用户卡券
*
* @param id 编号
* @return 用户卡券
*/
CustomerCoupon getCustomerCoupon(String id);
* 获取用户卡券信息及卡券变动信息
* @author PQZ
* @date 22:51 2024/9/20
* @param id 用户卡券id
* @return cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO
**/
CustomerCouponRespVO getCustomerCoupon(String id);
/**
* 获得用户卡券分页
@ -53,4 +56,13 @@ public interface CustomerCouponService extends IService<CustomerCoupon> {
*/
PageResult<CustomerCoupon> getCustomerCouponPage(CustomerCouponPageReqVO pageReqVO);
/**
* 根据用户id获取卡券信息
* @author PQZ
* @date 20:43 2024/9/20
* @param cusId 用户id
* @return java.util.List<cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO>
**/
List<CustomerCouponRespVO> listByCusId(String cusId);
}

View File

@ -2,16 +2,23 @@ package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
import cn.iocoder.yudao.module.custom.mapper.CustomerBalanceChangeMapper;
import cn.iocoder.yudao.module.custom.service.CustomerBalanceChangeService;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeSaveReqVO;
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 org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
/**
* 用户积分余额卡券变动记录 Service 实现类
@ -25,38 +32,64 @@ public class CustomerBalanceChangeServiceImpl extends ServiceImpl<CustomerBalanc
@Resource
private CustomerBalanceChangeMapper customerBalanceChangeMapper;
/**
* @param cusId 客户id
* @param userId 用户id
* @param couponId 关联卡券id
* @param changeType 变动类型
* @param changeMain 变动主体
* @param changeRule 变动规则
* @param changeBalance 变动积分/次数
* @param remBalance 变动后剩余积分/次数
* @param reason 变动原因
* @author PQZ
* @date 21:54 2024/9/20
**/
@Override
public String createCustomerBalanceChange(CustomerBalanceChangeSaveReqVO createReqVO) {
// 插入
CustomerBalanceChange customerBalanceChange = BeanUtils.toBean(createReqVO, CustomerBalanceChange.class);
customerBalanceChangeMapper.insert(customerBalanceChange);
// 返回
return customerBalanceChange.getId();
public void saveChange(String cusId, Integer userId, String couponId, String changeType, String changeMain, String changeRule, BigDecimal changeBalance, BigDecimal remBalance, String reason) {
CustomerBalanceChange change = new CustomerBalanceChange();
change.setCusId(cusId);
change.setUserId(userId);
change.setCouponId(couponId);
change.setChangeType(changeType);
change.setChangeMain(changeMain);
change.setChangeRule(changeRule);
change.setChangeBalance(changeBalance);
change.setRemBalance(remBalance);
change.setReason(reason);
save(change);
}
/**
* 获得用户积分余额卡券变动记录分页
*
* @param pageReqVO 分页查询
* @param page 分页参数
* @return 用户积分余额卡券变动记录分页
*/
@Override
public void updateCustomerBalanceChange(CustomerBalanceChangeSaveReqVO updateReqVO) {
// 更新
CustomerBalanceChange updateObj = BeanUtils.toBean(updateReqVO, CustomerBalanceChange.class);
customerBalanceChangeMapper.updateById(updateObj);
public IPage<CustomerBalanceChangeRespVO> queryListPage(CustomerBalanceChangePageReqVO pageReqVO, Page<CustomerBalanceChangeRespVO> page) {
return customerBalanceChangeMapper.queryListPage(pageReqVO, page);
}
/**
* 通过用户id和卡券id查询积分卡券的变动记录
*
* @param cusId 用户id
* @param couponId 卡券id
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange>
* @author PQZ
* @date 22:48 2024/9/20
**/
@Override
public void deleteCustomerBalanceChange(String id) {
// 删除
customerBalanceChangeMapper.deleteById(id);
public List<CustomerBalanceChange> getCouponChange(String cusId, String couponId) {
LambdaQueryWrapper<CustomerBalanceChange> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CustomerBalanceChange::getCusId,cusId)
.eq(CustomerBalanceChange::getCouponId,couponId)
.eq(BaseDO::getDeleted,'0');
return list(lambdaQueryWrapper);
}
@Override
public CustomerBalanceChange getCustomerBalanceChange(String id) {
return customerBalanceChangeMapper.selectById(id);
}
@Override
public PageResult<CustomerBalanceChange> getCustomerBalanceChangePage(CustomerBalanceChangePageReqVO pageReqVO) {
return null;
}
}

View File

@ -2,16 +2,20 @@ package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
import cn.iocoder.yudao.module.custom.entity.CustomerCoupon;
import cn.iocoder.yudao.module.custom.mapper.CustomerCouponMapper;
import cn.iocoder.yudao.module.custom.service.CustomerBalanceChangeService;
import cn.iocoder.yudao.module.custom.service.CustomerCouponService;
import cn.iocoder.yudao.module.custom.vo.CustomerCouponPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerCouponSaveReqVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
/**
* 用户卡券 Service 实现类
@ -24,6 +28,8 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
@Resource
private CustomerCouponMapper customerCouponMapper;
@Resource
private CustomerBalanceChangeService changeService;
@Override
public String createCustomerCoupon(CustomerCouponSaveReqVO createReqVO) {
@ -48,10 +54,20 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
}
/**
* 获取用户卡券信息及卡券变动信息
* @author PQZ
* @date 22:51 2024/9/20
* @param id 用户卡券id
* @return cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO
**/
@Override
public CustomerCoupon getCustomerCoupon(String id) {
return customerCouponMapper.selectById(id);
public CustomerCouponRespVO getCustomerCoupon(String id) {
CustomerCoupon coupon = getById(id);
CustomerCouponRespVO result = BeanUtils.toBean(coupon,CustomerCouponRespVO.class);
List<CustomerBalanceChange> changeList = changeService.getCouponChange(coupon.getCusId(),coupon.getCouponId());
result.setChangeList(changeList);
return result;
}
@Override
@ -59,4 +75,17 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
return null;
}
/**
* 根据用户id获取卡券信息
*
* @param cusId 用户id
* @return java.util.List<cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO>
* @author PQZ
* @date 20:43 2024/9/20
**/
@Override
public List<CustomerCouponRespVO> listByCusId(String cusId) {
return customerCouponMapper.listByCusId(cusId);
}
}

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.service.CustomerCouponService;
import cn.iocoder.yudao.module.custom.service.CustomerItemService;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.*;
@ -70,6 +71,8 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
private PermissionApi permissionApi;
@Resource
private DeptApi deptApi;
@Resource
private CustomerCouponService customerCouponService;
/**
* 客户管理分页列表查询
@ -181,6 +184,9 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
/*4、标签信息*/
List<BusiLabel> labelList = busiLabelService.listByMainId(id);
result.setLabelList(labelList);
/*5、卡券信息*/
List<CustomerCouponRespVO> couponList = customerCouponService.listByCusId(id);
result.setCouponList(couponList);
return result;
}

View File

@ -18,5 +18,4 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
public class CustomerCouponPageReqVO extends CustomerCoupon {
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
import cn.iocoder.yudao.module.custom.entity.CustomerCoupon;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@ -13,6 +14,35 @@ import com.alibaba.excel.annotation.*;
@Data
@ExcelIgnoreUnannotated
public class CustomerCouponRespVO extends CustomerCoupon {
/**
* 卡券名称
*/
private String couponName;
/**
* 卡券类型保养卡服务券礼包券
*/
private String couponType;
/**
* 适用车型数据字典
*/
private String carModel;
/**
* 开始有效期
*/
private LocalDateTime beginTime;
/**
* 结束有效期
*/
private LocalDateTime endTime;
/**
* 效果图片
*/
private String image;
/**
* 来源活动名称
*/
private String activeName;
private List<CustomerBalanceChange> changeList;
}

View File

@ -12,5 +12,4 @@ import java.math.BigDecimal;
public class CustomerCouponSaveReqVO extends CustomerCoupon {
}

View File

@ -29,6 +29,8 @@ public class CustomerMainRespVO extends CustomerMain {
List<BusiLabel> labelList;
/**车辆品牌型号数组*/
List<String> brandAndModel;
/**关联卡券信息*/
List<CustomerCouponRespVO> couponList;
/**会员名称 */
private String levelName;
/**是否车主0否1是*/

View File

@ -15,5 +15,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ActiveMainPageReqVO extends ActiveMain {
/**用于判断是否查询当前时间段可参与的活动*/
private String isNow;
}

View File

@ -9,4 +9,23 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryListPage" resultType="cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO">
SELECT
bcbc.*
FROM
base_customer_balance_change bcbc
<where>
bcbc.delete = '0'
<if test="entity.cusId != null and entity.cusId != ''">
AND bcbc.cus_id = #{entity.cusId}
</if>
<if test="entity.userId != null">
AND bcbc.user_id = #{entity.userId}
</if>
<if test="entity.couponId != null and entity.couponId != ''">
AND bcbc.coupon_id = #{entity.couponId}
</if>
</where>
</select>
</mapper>

View File

@ -9,4 +9,24 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="listByCusId" resultType="cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO">
SELECT
bcc.*,
dmc.`name` AS couponName,
dmc.type AS couponType,
dmc.car_model AS carModel,
dmc.begin_time AS beginTime,
dmc.end_time AS endTime,
dmc.image AS image,
dam.NAME AS activeName
FROM
base_customer_coupon bcc
LEFT JOIN dl_member_coupon dmc ON bcc.coupon_id = dmc.id
AND dmc.deleted = 0
LEFT JOIN dl_active_main dam ON bcc.active_id = dam.id
AND dam.deleted = 0
WHERE
bcc.cus_id = #{cusId}
AND bcc.deleted = 0
</select>
</mapper>

View File

@ -16,6 +16,10 @@
dl_active_main dam
<where>
dam.deleted = 0
<if test="entity.isNow != null and entity.isNow == 1">
AND begin_time &lt;= NOW()
AND end_time &gt;= NOW()
</if>
<if test="entity.name != null and entity.name != ''">
and dam.name like concat('%', #{entity.name}, '%')
</if>