Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system
# Conflicts: # dl-module-base/src/main/java/cn/iocoder/yudao/module/app/customer/admin/CustomerMainApi.java
This commit is contained in:
commit
d720dfdf2a
@ -87,8 +87,11 @@ public class BaseConstants {
|
|||||||
public static final String GENERAL_YES = "1";
|
public static final String GENERAL_YES = "1";
|
||||||
/**会员充值*/
|
/**会员充值*/
|
||||||
public static final String ORDER_HYCZ = "1";
|
public static final String ORDER_HYCZ = "1";
|
||||||
|
|
||||||
/**维修服务*/
|
/**维修服务*/
|
||||||
public static final String ORDER_WXFW = "2";
|
public static final String ORDER_WXFW = "2";
|
||||||
|
/**维修服务*/
|
||||||
|
public static final String ORDER_KKYL = "3";
|
||||||
/**订单店铺名称*/
|
/**订单店铺名称*/
|
||||||
public static final String ORDER_TENANT_NAME = "蓝安集团";
|
public static final String ORDER_TENANT_NAME = "蓝安集团";
|
||||||
|
|
||||||
|
@ -8,9 +8,13 @@ import cn.iocoder.yudao.module.conf.entity.BaseType;
|
|||||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.entity.MemberLevel;
|
||||||
|
import cn.iocoder.yudao.module.member.service.MemberLevelService;
|
||||||
|
import cn.iocoder.yudao.module.member.vo.MemberLevelPageReqVO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -18,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,6 +37,8 @@ public class CustomerMainApi {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CustomerMainService customerMainService;
|
private CustomerMainService customerMainService;
|
||||||
|
@Resource
|
||||||
|
private MemberLevelService levelService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询当前登录客户信息
|
* 查询当前登录客户信息
|
||||||
@ -44,6 +52,12 @@ public class CustomerMainApi {
|
|||||||
return success(customerMainService.getUserCustomer());
|
return success(customerMainService.getUserCustomer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/allMember")
|
||||||
|
@Operation(summary = "获得全部会员")
|
||||||
|
public CommonResult<List<MemberLevel>> getLevelAll(MemberLevelPageReqVO pageReqVO) {
|
||||||
|
return success(levelService.queryListAll(pageReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据车辆ID反查用户信息
|
* 根据车辆ID反查用户信息
|
||||||
*
|
*
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.custom.service;
|
|||||||
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
|
import cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.entity.MemberCoupon;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@ -34,8 +35,7 @@ public interface CustomerBalanceChangeService extends IService<CustomerBalanceCh
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化变动记录
|
* 初始化变动记录
|
||||||
* @author PQZ
|
*
|
||||||
* @date 10:09 2024/9/21
|
|
||||||
* @param cusId 客户id
|
* @param cusId 客户id
|
||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
* @param couponId 关联卡券id
|
* @param couponId 关联卡券id
|
||||||
@ -46,7 +46,9 @@ public interface CustomerBalanceChangeService extends IService<CustomerBalanceCh
|
|||||||
* @param remBalance 变动后剩余积分/次数
|
* @param remBalance 变动后剩余积分/次数
|
||||||
* @param reason 变动原因
|
* @param reason 变动原因
|
||||||
* @return cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange
|
* @return cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange
|
||||||
**/
|
* @author PQZ
|
||||||
|
* @date 10:09 2024/9/21
|
||||||
|
**/
|
||||||
CustomerBalanceChange initChange(String cusId, Long userId, String couponId, String changeType, String changeMain, String changeRule, BigDecimal changeBalance, BigDecimal remBalance, String reason);
|
CustomerBalanceChange initChange(String cusId, Long userId, String couponId, String changeType, String changeMain, String changeRule, BigDecimal changeBalance, BigDecimal remBalance, String reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,6 +59,20 @@ public interface CustomerBalanceChangeService extends IService<CustomerBalanceCh
|
|||||||
*/
|
*/
|
||||||
IPage<CustomerBalanceChangeRespVO> queryListPage(CustomerBalanceChangePageReqVO pageReqVO, Page<CustomerBalanceChangeRespVO> page);
|
IPage<CustomerBalanceChangeRespVO> queryListPage(CustomerBalanceChangePageReqVO pageReqVO, Page<CustomerBalanceChangeRespVO> page);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换变动记录
|
||||||
|
*
|
||||||
|
* @param cusId 客户id
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param activeName 活动名称
|
||||||
|
* @param couponList 卡券集合
|
||||||
|
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange>
|
||||||
|
* @author PQZ
|
||||||
|
* @date 21:58 2024/9/24
|
||||||
|
**/
|
||||||
|
List<CustomerBalanceChange> transChange(String cusId, Long userId, String activeName, List<MemberCoupon> couponList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户id和卡券id查询积分、卡券的变动记录
|
* 通过用户id和卡券id查询积分、卡券的变动记录
|
||||||
*
|
*
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.custom.service;
|
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.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.CustomerCouponRespVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerCouponSaveReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerCouponSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.entity.MemberCoupon;
|
||||||
|
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,6 +26,24 @@ public interface CustomerCouponService extends IService<CustomerCoupon> {
|
|||||||
**/
|
**/
|
||||||
void couponVerification(CustomerCouponSaveReqVO saveReqVO);
|
void couponVerification(CustomerCouponSaveReqVO saveReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开卡有礼回调
|
||||||
|
* @author PQZ
|
||||||
|
* @date 21:50 2024/9/24
|
||||||
|
* @param orderInfo RepairOrderInfo
|
||||||
|
**/
|
||||||
|
void couponCallBack(RepairOrderInfo orderInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡券实体转换
|
||||||
|
*
|
||||||
|
* @param couponList MemberCoupon集合
|
||||||
|
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerCoupon>
|
||||||
|
* @author PQZ
|
||||||
|
* @date 11:01 2024/9/21
|
||||||
|
**/
|
||||||
|
List<CustomerCoupon> transCoupon(String activeId, String cusId, Long userId, List<MemberCoupon> couponList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户卡券
|
* 删除用户卡券
|
||||||
*
|
*
|
||||||
|
@ -86,7 +86,7 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
|||||||
//需要保存的参与活动日志
|
//需要保存的参与活动日志
|
||||||
CustomerActive customerActive = new CustomerActive();
|
CustomerActive customerActive = new CustomerActive();
|
||||||
//需保保存的用户卡券领取内容
|
//需保保存的用户卡券领取内容
|
||||||
List<CustomerCoupon> customerCouponList;
|
List<CustomerCoupon> customerCouponList = null;
|
||||||
//需保保存的用户积分余额信息
|
//需保保存的用户积分余额信息
|
||||||
CustomerBalance balance;
|
CustomerBalance balance;
|
||||||
|
|
||||||
@ -95,10 +95,10 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
|||||||
if (GENERAL_YES.equals(active.getIsPack())) {
|
if (GENERAL_YES.equals(active.getIsPack())) {
|
||||||
/*2.1 打包领取情况*/
|
/*2.1 打包领取情况*/
|
||||||
List<MemberCoupon> couponList = active.getCouponList();
|
List<MemberCoupon> couponList = active.getCouponList();
|
||||||
//抓换卡券信息
|
//转换卡券信息
|
||||||
customerCouponList = transCoupon(active.getId(), customer.getId(), customer.getUserId(), couponList);
|
customerCouponList = customerCouponService.transCoupon(active.getId(), customer.getId(), customer.getUserId(), couponList);
|
||||||
//转换日志信息
|
//转换日志信息
|
||||||
changeList = transChange(customer.getId(), customer.getUserId(), active.getName(), couponList);
|
changeList = changeService.transChange(customer.getId(), customer.getUserId(), active.getName(), couponList);
|
||||||
} else {
|
} else {
|
||||||
/*2.2 非打包领取情况*/
|
/*2.2 非打包领取情况*/
|
||||||
//选中卡券校验
|
//选中卡券校验
|
||||||
@ -107,14 +107,37 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
|||||||
}
|
}
|
||||||
//查询出当前选中的卡券及附属卡券
|
//查询出当前选中的卡券及附属卡券
|
||||||
List<String> ids = saveReqVO.getSelectCoupon().stream().map(MemberCoupon::getId).collect(Collectors.toList());
|
List<String> ids = saveReqVO.getSelectCoupon().stream().map(MemberCoupon::getId).collect(Collectors.toList());
|
||||||
List<MemberCoupon> couponList = couponService.listByIds(ids, true);
|
//查询选中卡片信息
|
||||||
|
List<MemberCoupon> couponList = couponService.listByIds(ids, false);
|
||||||
|
couponList.forEach(item -> {
|
||||||
|
RepairOrderInfo orderInfo = new RepairOrderInfo();
|
||||||
|
orderInfo.setOrderNo(System.currentTimeMillis() + Math.abs(item.getId().hashCode() % 1000) + "");
|
||||||
|
orderInfo.setGoodsId(item.getId());
|
||||||
|
orderInfo.setActiveId(active.getId());
|
||||||
|
orderInfo.setGoodsTitle(active.getName());
|
||||||
|
orderInfo.setTenantName(ORDER_TENANT_NAME);
|
||||||
|
orderInfo.setGoodsType(ORDER_KKYL);
|
||||||
|
orderInfo.setUserId(customer.getUserId());
|
||||||
|
orderInfo.setCusId(customer.getId());
|
||||||
|
orderInfo.setCusName(customer.getCusName());
|
||||||
|
orderInfo.setCusPhone(customer.getPhoneNumber());
|
||||||
|
orderInfo.setGoodsPrice(item.getAmount());
|
||||||
|
orderInfo.setPayMoney(item.getAmount());
|
||||||
|
orderInfo.setOrderTime(LocalDateTime.now());
|
||||||
|
orderInfo.setIsOnline("01");
|
||||||
|
orderInfo.setOrderStatus("0");
|
||||||
|
orderInfo.setPayType(saveReqVO.getAccountType());
|
||||||
|
repairOrderInfoService.save(orderInfo);
|
||||||
|
});
|
||||||
//转换卡券信息
|
//转换卡券信息
|
||||||
customerCouponList = transCoupon(active.getId(), customer.getId(), customer.getUserId(), couponList);
|
// customerCouponList = transCoupon(active.getId(), customer.getId(), customer.getUserId(), couponList);
|
||||||
//转换日志信息
|
//转换日志信息
|
||||||
changeList = transChange(customer.getId(), customer.getUserId(), active.getName(), couponList);
|
// changeList = transChange(customer.getId(), customer.getUserId(), active.getName(), couponList);
|
||||||
}
|
}
|
||||||
//保存用户卡券
|
//保存用户卡券
|
||||||
customerCouponService.saveBatch(customerCouponList);
|
if (null != customerCouponList){
|
||||||
|
customerCouponService.saveBatch(customerCouponList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*3、活动关联充值规则处理*/
|
/*3、活动关联充值规则处理*/
|
||||||
@ -168,54 +191,10 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 卡券实体转换
|
|
||||||
*
|
|
||||||
* @param couponList MemberCoupon集合
|
|
||||||
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerCoupon>
|
|
||||||
* @author PQZ
|
|
||||||
* @date 11:01 2024/9/21
|
|
||||||
**/
|
|
||||||
List<CustomerCoupon> transCoupon(String activeId, String cusId, Long userId, List<MemberCoupon> couponList) {
|
|
||||||
List<CustomerCoupon> transList = new ArrayList<>();
|
|
||||||
couponList.forEach(item -> {
|
|
||||||
CustomerCoupon coupon = new CustomerCoupon();
|
|
||||||
coupon.setCusId(cusId);
|
|
||||||
coupon.setUserId(userId);
|
|
||||||
coupon.setActiveId(activeId);
|
|
||||||
coupon.setCouponId(item.getId());
|
|
||||||
coupon.setAmount(item.getAmount());
|
|
||||||
coupon.setBalance(item.getAmount());
|
|
||||||
coupon.setUnitPrice(item.getUnitPrice());
|
|
||||||
coupon.setOutRule(item.getOutRule());
|
|
||||||
coupon.setIsValid(GENERAL_YES);
|
|
||||||
transList.add(coupon);
|
|
||||||
});
|
|
||||||
return transList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 卡券转换记录
|
|
||||||
*
|
|
||||||
* @param cusId 客户id
|
|
||||||
* @param userId 用户id
|
|
||||||
* @param activeName 活动名称
|
|
||||||
* @param couponList 卡券集合
|
|
||||||
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange>
|
|
||||||
* @author PQZ
|
|
||||||
* @date 11:20 2024/9/21
|
|
||||||
**/
|
|
||||||
List<CustomerBalanceChange> transChange(String cusId, Long userId, String activeName, List<MemberCoupon> couponList) {
|
|
||||||
List<CustomerBalanceChange> transList = new ArrayList<>();
|
|
||||||
couponList.forEach(item -> {
|
|
||||||
CustomerBalanceChange change = changeService.initChange(cusId,
|
|
||||||
userId, item.getId(), BALANCE_CHANGE_TYPE_ZS, BALANCE_CHANGE_MAIN_KQ,
|
|
||||||
item.getOutRule(), item.getAmount(), item.getAmount(), "参加" + activeName + "活动领取");
|
|
||||||
transList.add(change);
|
|
||||||
});
|
|
||||||
return transList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.custom.service.CustomerBalanceChangeService;
|
|||||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangePageReqVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeRespVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeSaveReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerBalanceChangeSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.entity.MemberCoupon;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -18,8 +19,12 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.common.BaseConstants.BALANCE_CHANGE_MAIN_KQ;
|
||||||
|
import static cn.iocoder.yudao.common.BaseConstants.BALANCE_CHANGE_TYPE_ZS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户积分(余额)、卡券变动记录 Service 实现类
|
* 用户积分(余额)、卡券变动记录 Service 实现类
|
||||||
*
|
*
|
||||||
@ -96,6 +101,29 @@ public class CustomerBalanceChangeServiceImpl extends ServiceImpl<CustomerBalanc
|
|||||||
return customerBalanceChangeMapper.queryListPage(pageReqVO, page);
|
return customerBalanceChangeMapper.queryListPage(pageReqVO, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换变动记录
|
||||||
|
*
|
||||||
|
* @param cusId 客户id
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param activeName 活动名称
|
||||||
|
* @param couponList 卡券集合
|
||||||
|
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerBalanceChange>
|
||||||
|
* @author PQZ
|
||||||
|
* @date 21:58 2024/9/24
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<CustomerBalanceChange> transChange(String cusId, Long userId, String activeName, List<MemberCoupon> couponList) {
|
||||||
|
List<CustomerBalanceChange> transList = new ArrayList<>();
|
||||||
|
couponList.forEach(item -> {
|
||||||
|
CustomerBalanceChange change = initChange(cusId,
|
||||||
|
userId, item.getId(), BALANCE_CHANGE_TYPE_ZS, BALANCE_CHANGE_MAIN_KQ,
|
||||||
|
item.getOutRule(), item.getAmount(), item.getAmount(), "参加" + activeName + "活动领取");
|
||||||
|
transList.add(change);
|
||||||
|
});
|
||||||
|
return transList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户id和卡券id查询积分、卡券的变动记录
|
* 通过用户id和卡券id查询积分、卡券的变动记录
|
||||||
*
|
*
|
||||||
|
@ -10,6 +10,9 @@ import cn.iocoder.yudao.module.custom.service.CustomerCouponService;
|
|||||||
import cn.iocoder.yudao.module.custom.vo.CustomerCouponPageReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerCouponPageReqVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerCouponSaveReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerCouponSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.entity.MemberCoupon;
|
||||||
|
import cn.iocoder.yudao.module.member.service.MemberCouponService;
|
||||||
|
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -17,6 +20,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||||
@ -34,6 +38,9 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
|
|||||||
private CustomerCouponMapper customerCouponMapper;
|
private CustomerCouponMapper customerCouponMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private CustomerBalanceChangeService changeService;
|
private CustomerBalanceChangeService changeService;
|
||||||
|
@Resource
|
||||||
|
private MemberCouponService couponService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,6 +75,52 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开卡有礼回调
|
||||||
|
*
|
||||||
|
* @param orderInfo RepairOrderInfo
|
||||||
|
* @author PQZ
|
||||||
|
* @date 21:50 2024/9/24
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void couponCallBack(RepairOrderInfo orderInfo) {
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
ids.add(orderInfo.getGoodsId());
|
||||||
|
//查询选中卡片信息
|
||||||
|
List<MemberCoupon> couponList = couponService.listByIds(ids, true);
|
||||||
|
List<CustomerCoupon> customerCouponList = transCoupon(orderInfo.getActiveId(), orderInfo.getCusId(), orderInfo.getUserId(), couponList);
|
||||||
|
List<CustomerBalanceChange> changeList = changeService.transChange(orderInfo.getCusId(), orderInfo.getUserId(), orderInfo.getGoodsTitle(), couponList);
|
||||||
|
saveBatch(customerCouponList);
|
||||||
|
changeService.saveBatch(changeList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡券实体转换
|
||||||
|
*
|
||||||
|
* @param couponList MemberCoupon集合
|
||||||
|
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CustomerCoupon>
|
||||||
|
* @author PQZ
|
||||||
|
* @date 11:01 2024/9/21
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<CustomerCoupon> transCoupon(String activeId, String cusId, Long userId, List<MemberCoupon> couponList) {
|
||||||
|
List<CustomerCoupon> transList = new ArrayList<>();
|
||||||
|
couponList.forEach(item -> {
|
||||||
|
CustomerCoupon coupon = new CustomerCoupon();
|
||||||
|
coupon.setCusId(cusId);
|
||||||
|
coupon.setUserId(userId);
|
||||||
|
coupon.setActiveId(activeId);
|
||||||
|
coupon.setCouponId(item.getId());
|
||||||
|
coupon.setAmount(item.getAmount());
|
||||||
|
coupon.setBalance(item.getAmount());
|
||||||
|
coupon.setUnitPrice(item.getUnitPrice());
|
||||||
|
coupon.setOutRule(item.getOutRule());
|
||||||
|
coupon.setIsValid(GENERAL_YES);
|
||||||
|
transList.add(coupon);
|
||||||
|
});
|
||||||
|
return transList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteCustomerCoupon(String id) {
|
public void deleteCustomerCoupon(String id) {
|
||||||
// 删除
|
// 删除
|
||||||
|
@ -41,6 +41,8 @@ public class CustomerMainRespVO extends CustomerMain {
|
|||||||
private BigDecimal forzeBalance;
|
private BigDecimal forzeBalance;
|
||||||
/**累计充值额度*/
|
/**累计充值额度*/
|
||||||
private BigDecimal allBalance;
|
private BigDecimal allBalance;
|
||||||
|
/**会员权益*/
|
||||||
|
private String userEquity;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -15,7 +15,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员等级 Service 实现类
|
* 会员等级 Service 实现类
|
||||||
@ -88,9 +90,8 @@ public class MemberLevelServiceImpl extends ServiceImpl<MemberLevelMapper, Membe
|
|||||||
public List<MemberLevel> queryListAll(MemberLevelPageReqVO pageReqVO) {
|
public List<MemberLevel> queryListAll(MemberLevelPageReqVO pageReqVO) {
|
||||||
|
|
||||||
QueryWrapper<MemberLevel> q = new QueryWrapper<>();
|
QueryWrapper<MemberLevel> q = new QueryWrapper<>();
|
||||||
q.eq("status","01");
|
|
||||||
List<MemberLevel> memberLevels = this.levelMapper.selectList(q);
|
List<MemberLevel> memberLevels = this.levelMapper.selectList(q);
|
||||||
return memberLevels;
|
return memberLevels.stream().sorted(Comparator.comparing(MemberLevel::getSort)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||||
import cn.iocoder.yudao.module.custom.service.CustomerBalanceService;
|
import cn.iocoder.yudao.module.custom.service.CustomerBalanceService;
|
||||||
|
import cn.iocoder.yudao.module.custom.service.CustomerCouponService;
|
||||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoMapper;
|
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoMapper;
|
||||||
@ -35,8 +36,7 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.common.BaseConstants.GENERAL_YES;
|
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||||
import static cn.iocoder.yudao.common.BaseConstants.ORDER_HYCZ;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修模块 订单 Service 实现类
|
* 维修模块 订单 Service 实现类
|
||||||
@ -52,6 +52,8 @@ public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMappe
|
|||||||
@Resource
|
@Resource
|
||||||
@Lazy
|
@Lazy
|
||||||
private CustomerBalanceService balanceService;
|
private CustomerBalanceService balanceService;
|
||||||
|
@Resource
|
||||||
|
private CustomerCouponService couponService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WechatPayConfig wechatPayConfig;
|
private WechatPayConfig wechatPayConfig;
|
||||||
@ -85,8 +87,8 @@ public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMappe
|
|||||||
if (ORDER_HYCZ.equals(orderInfo.getGoodsType())){
|
if (ORDER_HYCZ.equals(orderInfo.getGoodsType())){
|
||||||
//会员充值回调
|
//会员充值回调
|
||||||
balanceService.balanceCallback(orderInfo);
|
balanceService.balanceCallback(orderInfo);
|
||||||
} else {
|
} else if (ORDER_KKYL.equals(orderInfo.getGoodsType())){
|
||||||
// TODO: 2024/9/24 维修服务回调
|
couponService.couponCallBack(orderInfo);
|
||||||
}
|
}
|
||||||
orderInfo.setOrderStatus(GENERAL_YES);
|
orderInfo.setOrderStatus(GENERAL_YES);
|
||||||
orderInfo.setPayTime(LocalDateTime.now());
|
orderInfo.setPayTime(LocalDateTime.now());
|
||||||
|
@ -105,6 +105,7 @@
|
|||||||
main.STATUS AS STATUS,
|
main.STATUS AS STATUS,
|
||||||
group_concat( item.ser_content ) AS serContents,
|
group_concat( item.ser_content ) AS serContents,
|
||||||
memberLevel.NAME AS levelName,
|
memberLevel.NAME AS levelName,
|
||||||
|
memberLevel.user_equity AS userEquity,
|
||||||
COALESCE(bcb.balance, 0.00) AS balance,
|
COALESCE(bcb.balance, 0.00) AS balance,
|
||||||
COALESCE(bcb.forze_balance, 0.00) AS forzeBalance,
|
COALESCE(bcb.forze_balance, 0.00) AS forzeBalance,
|
||||||
COALESCE(bcb.all_balance, 0.00) AS allBalance
|
COALESCE(bcb.all_balance, 0.00) AS allBalance
|
||||||
|
Loading…
Reference in New Issue
Block a user