Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system
This commit is contained in:
commit
163a582dd0
@ -6,7 +6,9 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.conf.entity.BaseType;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerActiveService;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import cn.iocoder.yudao.module.member.entity.MemberLevel;
|
||||
import cn.iocoder.yudao.module.member.service.MemberLevelService;
|
||||
@ -15,10 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -39,6 +38,8 @@ public class CustomerMainApi {
|
||||
private CustomerMainService customerMainService;
|
||||
@Resource
|
||||
private MemberLevelService levelService;
|
||||
@Resource
|
||||
private CustomerActiveService activeService;
|
||||
|
||||
/**
|
||||
* 查询当前登录客户信息
|
||||
@ -70,4 +71,20 @@ public class CustomerMainApi {
|
||||
public CommonResult<?> getCustomerByCarId(@RequestParam("carId")String carId) {
|
||||
return success(customerMainService.getCustomerByCarId(carId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 参加活动
|
||||
*
|
||||
* @param createReqVO CustomerActiveSaveReqVO
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 9:49 2024/9/21
|
||||
**/
|
||||
@PostMapping("/attendActive")
|
||||
@Operation(summary = "参加活动")
|
||||
public CommonResult<Boolean> attendActive(@RequestBody CustomerActiveSaveReqVO createReqVO) {
|
||||
activeService.attendActive(createReqVO);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.custom.vo.CustomerActivePageReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerActiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.vo.ActiveMainRespVO;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -26,9 +27,17 @@ public interface CustomerActiveService extends IService<CustomerActive> {
|
||||
* @author PQZ
|
||||
* @date 9:57 2024/9/21
|
||||
**/
|
||||
void attendActive(CustomerActiveSaveReqVO saveReqVO);
|
||||
RepairOrderInfo attendActive(CustomerActiveSaveReqVO saveReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 用户参与活动
|
||||
* @author PQZ
|
||||
* @date 10:18 2024/9/27
|
||||
* @param saveReqVO CustomerActiveSaveReqVO实体
|
||||
**/
|
||||
void cusAttendActive(CustomerActiveSaveReqVO saveReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户参与活动记录
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.custom.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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;
|
||||
@ -75,7 +76,7 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void attendActive(CustomerActiveSaveReqVO saveReqVO) {
|
||||
public RepairOrderInfo attendActive(CustomerActiveSaveReqVO saveReqVO) {
|
||||
/*1、基础数据初始化*/
|
||||
//当前客户信息
|
||||
CustomerMainRespVO customer = customerMainService.getCustomerById(saveReqVO.getCusId());
|
||||
@ -89,6 +90,8 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
List<CustomerCoupon> customerCouponList = null;
|
||||
//需保保存的用户积分余额信息
|
||||
CustomerBalance balance;
|
||||
//要返回的订单数据
|
||||
RepairOrderInfo resultOrder = null;
|
||||
|
||||
/*2、活动关联卡券处理*/
|
||||
if (GENERAL_YES.equals(active.getIsCoupon())) {
|
||||
@ -109,7 +112,8 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
List<String> ids = saveReqVO.getSelectCoupon().stream().map(MemberCoupon::getId).collect(Collectors.toList());
|
||||
//查询选中卡片信息
|
||||
List<MemberCoupon> couponList = couponService.listByIds(ids, false);
|
||||
couponList.forEach(item -> {
|
||||
if (CollectionUtil.isNotEmpty(couponList)){
|
||||
MemberCoupon item = couponList.get(0);
|
||||
RepairOrderInfo orderInfo = new RepairOrderInfo();
|
||||
orderInfo.setOrderNo(System.currentTimeMillis() + Math.abs(item.getId().hashCode() % 1000) + "");
|
||||
orderInfo.setGoodsId(item.getId());
|
||||
@ -128,7 +132,12 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
orderInfo.setOrderStatus("0");
|
||||
orderInfo.setPayType(saveReqVO.getAccountType());
|
||||
repairOrderInfoService.save(orderInfo);
|
||||
});
|
||||
resultOrder = repairOrderInfoService.getById(orderInfo.getId());
|
||||
}
|
||||
|
||||
// couponList.forEach(item -> {
|
||||
//
|
||||
// });
|
||||
//转换卡券信息
|
||||
// customerCouponList = transCoupon(active.getId(), customer.getId(), customer.getUserId(), couponList);
|
||||
//转换日志信息
|
||||
@ -172,6 +181,7 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
orderInfo.setOrderStatus("0");
|
||||
orderInfo.setPayType(saveReqVO.getAccountType());
|
||||
repairOrderInfoService.save(orderInfo);
|
||||
resultOrder = repairOrderInfoService.getById(orderInfo.getId());
|
||||
//保存余额信息
|
||||
// balanceService.updateByCusId(balance);
|
||||
}
|
||||
@ -188,13 +198,23 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
/*5、保存变动日志*/
|
||||
//保存变动日志
|
||||
changeService.saveBatch(changeList);
|
||||
|
||||
return resultOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户参与活动
|
||||
*
|
||||
* @param saveReqVO CustomerActiveSaveReqVO实体
|
||||
* @author PQZ
|
||||
* @date 10:18 2024/9/27
|
||||
**/
|
||||
@Override
|
||||
public void cusAttendActive(CustomerActiveSaveReqVO saveReqVO) {
|
||||
RepairOrderInfo repairOrderInfo = attendActive(saveReqVO);
|
||||
if (null != repairOrderInfo){
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@ public class RepairOrderInfoController {
|
||||
|
||||
/**
|
||||
* 统计未入账和已入账(最简版)
|
||||
*
|
||||
*6
|
||||
* @author 小李
|
||||
* @date 18:52 2024/9/25
|
||||
**/
|
||||
|
Loading…
Reference in New Issue
Block a user