订单完善以及退款相关
This commit is contained in:
parent
ee42441178
commit
ea6289bd36
|
@ -1,9 +1,13 @@
|
||||||
package com.ruoyi.bst.booth.domain;
|
package com.ruoyi.bst.booth.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.device.domain.Device;
|
||||||
|
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class BoothVO extends Booth{
|
public class BoothVO extends Booth{
|
||||||
|
|
||||||
|
@ -23,4 +27,9 @@ public class BoothVO extends Booth{
|
||||||
@ApiModelProperty("店铺ID")
|
@ApiModelProperty("店铺ID")
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
|
|
||||||
|
@Excel(name = "卡座设备")
|
||||||
|
@ApiModelProperty("卡座设备")
|
||||||
|
private List<DeviceVO> devices;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,12 +178,15 @@ public class BoothServiceImpl implements BoothService
|
||||||
@Override
|
@Override
|
||||||
public int lighting(BoothVO booth,Long userId) {
|
public int lighting(BoothVO booth,Long userId) {
|
||||||
|
|
||||||
|
// 操作校验
|
||||||
|
ServiceUtil.assertion(booth.getStoreId()==null,"当前卡座未绑定店铺");
|
||||||
|
ServiceUtil.assertion(booth.getExpiredTime().isBefore(LocalDateTime.now()), "请重新绑定卡座");
|
||||||
|
|
||||||
// 判断当前用户是否在该店铺下有余额
|
// 判断当前用户是否在该店铺下有余额
|
||||||
LightingNumVO vo = lightingNumMapper.selectLightingNumByUserId(userId,booth.getStoreId());
|
LightingNumVO vo = lightingNumMapper.selectLightingNumByUserId(userId,booth.getStoreId());
|
||||||
ServiceUtil.assertion(vo == null,"请先购买余额");
|
ServiceUtil.assertion(vo == null,"请先购买余额");
|
||||||
ServiceUtil.assertion(vo.getNumber()<=0,"余额不足,请充值");
|
ServiceUtil.assertion(vo.getNumber()<=0,"余额不足,请充值");
|
||||||
|
|
||||||
|
|
||||||
// 爆灯
|
// 爆灯
|
||||||
Integer result = transactionTemplate.execute(status -> {
|
Integer result = transactionTemplate.execute(status -> {
|
||||||
|
|
||||||
|
@ -199,6 +202,7 @@ public class BoothServiceImpl implements BoothService
|
||||||
// 新建变化记录表
|
// 新建变化记录表
|
||||||
ChangeRecord changeRecord = new ChangeRecord();
|
ChangeRecord changeRecord = new ChangeRecord();
|
||||||
changeRecord.setBstType(ChangeRecordBstType.LIGHTING.getCode());
|
changeRecord.setBstType(ChangeRecordBstType.LIGHTING.getCode());
|
||||||
|
changeRecord.setBstId(booth.getBoothId());
|
||||||
changeRecord.setUserId(userId);
|
changeRecord.setUserId(userId);
|
||||||
changeRecord.setStoreId(booth.getStoreId());
|
changeRecord.setStoreId(booth.getStoreId());
|
||||||
changeRecord.setNumber(1);
|
changeRecord.setNumber(1);
|
||||||
|
|
|
@ -9,20 +9,14 @@ import lombok.Getter;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ChangeRecordBstType {
|
public enum ChangeRecordBstType {
|
||||||
|
|
||||||
ORDER("ORDER", "订单"),
|
|
||||||
WITHDRAW("WITHDRAW", "提现"),
|
|
||||||
LIGHTING("LIGHTING", "爆灯"),
|
LIGHTING("LIGHTING", "爆灯"),
|
||||||
SMS("SMS", "短信");
|
RECHARGE("RECHARGE", "充值"),
|
||||||
|
GIFT("GIFT", "赠送"),
|
||||||
|
REFUND("REFUND", "退款");
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public static ChangeRecordBstType parseByBonusBstType(String bstType) {
|
|
||||||
if (LightingBstType.ORDER.getType().equals(bstType)) {
|
|
||||||
return ORDER;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
<if test="query.userId != null "> and user_id = #{query.userId}</if>
|
<if test="query.userId != null "> and bcr.user_id = #{query.userId}</if>
|
||||||
<if test="query.storeId != null "> and store_id = #{query.storeId}</if>
|
<if test="query.storeId != null "> and bcr.store_id = #{query.storeId}</if>
|
||||||
<if test="query.number != null "> and number = #{query.number}</if>
|
<if test="query.number != null "> and bcr.number = #{query.number}</if>
|
||||||
<if test="query.beforeNum != null "> and before_num = #{query.beforeNum}</if>
|
<if test="query.beforeNum != null "> and bcr.before_num = #{query.beforeNum}</if>
|
||||||
<if test="query.afterNum != null "> and after_num = #{query.afterNum}</if>
|
<if test="query.afterNum != null "> and bcr.after_num = #{query.afterNum}</if>
|
||||||
<if test="query.bstType != null and query.bstType != ''"> and bst_type = #{query.bstType}</if>
|
<if test="query.bstType != null and query.bstType != ''"> and bcr.bst_type = #{query.bstType}</if>
|
||||||
<if test="query.bstId != null "> and bst_id = #{query.bstId}</if>
|
<if test="query.bstId != null "> and bcr.bst_id = #{query.bstId}</if>
|
||||||
<if test="query.reason != null and query.reason != ''"> and reason = #{query.reason}</if>
|
<if test="query.reason != null and query.reason != ''"> and bcr.reason = #{query.reason}</if>
|
||||||
<if test="query.userName != null "> and bs.user_name like concat('%',#{query.userName},'%') </if>
|
<if test="query.userName != null "> and bs.user_name like concat('%',#{query.userName},'%') </if>
|
||||||
<if test="query.storeName != null "> and bs.store_name like concat('%',#{query.storeName},'%')</if>
|
<if test="query.storeName != null "> and bs.store_name like concat('%',#{query.storeName},'%')</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
||||||
|
|
|
@ -11,5 +11,7 @@ public class DeviceQuery extends DeviceVO{
|
||||||
@ApiModelProperty("设备id列表")
|
@ApiModelProperty("设备id列表")
|
||||||
private List<Long> deviceIds;
|
private List<Long> deviceIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("店铺id")
|
||||||
|
private Long storeId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,17 +93,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
from bst_device bd
|
from bst_device bd
|
||||||
left join bst_model bm on bd.model_id = bm.model_id
|
left join bst_model bm on bd.model_id = bm.model_id
|
||||||
left join sys_user su on bd.user_id = su.user_id
|
left join sys_user su on bd.user_id = su.user_id
|
||||||
left join bst_booth bb on bd.booth_id = bb.user_id
|
left join bst_booth bb on bd.booth_id = bb.booth_id
|
||||||
left join bst_part bp on bb.part_id = bp.part_id
|
left join bst_part bp on bb.part_id = bp.part_id
|
||||||
left join bst_store bs on bp.store_id = bs.store_id
|
left join bst_store bs on bp.store_id = bs.store_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
<if test="query.deviceNo != null and query.deviceNo != ''"> and bd.device_no = #{query.deviceNo}</if>
|
<if test="query.deviceNo != null and query.deviceNo != ''"> and bd.device_no = #{query.deviceNo}</if>
|
||||||
|
<if test="query.storeId != null and query.storeId != ''"> and bs.store_id = #{query.storeId}</if>
|
||||||
<if test="query.boothId != null "> and bd.booth_id = #{query.boothId}</if>
|
<if test="query.boothId != null "> and bd.booth_id = #{query.boothId}</if>
|
||||||
<if test="query.userId != null "> and bd.user_id = #{query.userId}</if>
|
<if test="query.userId != null "> and bd.user_id = #{query.userId}</if>
|
||||||
<if test="query.modelId != null "> and bd.model_id = #{query.modelId}</if>
|
<if test="query.modelId != null "> and bd.model_id = #{query.modelId}</if>
|
||||||
<if test="query.deviceName != null and query.deviceName != ''"> and bd.device_name like concat('%', #{query.deviceName}, '%')</if>
|
<if test="query.deviceName != null and query.deviceName != ''"> and bd.device_name like concat('%', #{query.deviceName}, '%')</if>
|
||||||
|
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name like concat('%', #{query.storeName}, '%')</if>
|
||||||
<if test="query.mac != null and query.mac != ''"> and bd.mac = #{query.mac}</if>
|
<if test="query.mac != null and query.mac != ''"> and bd.mac = #{query.mac}</if>
|
||||||
<if test="query.mac2 != null and query.mac2 != ''"> and bd.mac2 = #{query.mac2}</if>
|
<if test="query.mac2 != null and query.mac2 != ''"> and bd.mac2 = #{query.mac2}</if>
|
||||||
<if test="query.totalElectriQuantity != null "> and bd.total_electri_quantity = #{query.totalElectriQuantity}</if>
|
<if test="query.totalElectriQuantity != null "> and bd.total_electri_quantity = #{query.totalElectriQuantity}</if>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ruoyi.bst.lightingNum.domain.dto;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.interfaces.LogBizParam;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GiftLightingNumDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("店铺ID")
|
||||||
|
private Long storeId;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty("爆灯次数")
|
||||||
|
@NotNull(message = "爆灯次数不能为空")
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
}
|
|
@ -4,9 +4,12 @@ import java.util.List;
|
||||||
import com.ruoyi.bst.lightingNum.domain.LightingNum;
|
import com.ruoyi.bst.lightingNum.domain.LightingNum;
|
||||||
import com.ruoyi.bst.lightingNum.domain.LightingNumVO;
|
import com.ruoyi.bst.lightingNum.domain.LightingNumVO;
|
||||||
import com.ruoyi.bst.lightingNum.domain.LightingNumQuery;
|
import com.ruoyi.bst.lightingNum.domain.LightingNumQuery;
|
||||||
|
import com.ruoyi.bst.lightingNum.domain.dto.GiftLightingNumDTO;
|
||||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 爆灯次数列表Service接口
|
* 爆灯次数列表Service接口
|
||||||
*
|
*
|
||||||
|
@ -78,4 +81,6 @@ public interface LightingNumService
|
||||||
|
|
||||||
|
|
||||||
public int reduceLightingNumByQuery(@Param("data") LightingNum data,@Param("query") OrderQuery query);
|
public int reduceLightingNumByQuery(@Param("data") LightingNum data,@Param("query") OrderQuery query);
|
||||||
|
|
||||||
|
int giftLightingNum(@Valid GiftLightingNumDTO dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,19 @@ package com.ruoyi.bst.lightingNum.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.bst.changeRecord.domain.ChangeRecord;
|
||||||
|
import com.ruoyi.bst.changeRecord.domain.enums.ChangeRecordBstType;
|
||||||
|
import com.ruoyi.bst.changeRecord.mapper.ChangeRecordMapper;
|
||||||
|
import com.ruoyi.bst.changeRecord.service.ChangeRecordService;
|
||||||
|
import com.ruoyi.bst.lightingNum.domain.dto.GiftLightingNumDTO;
|
||||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||||
|
import com.ruoyi.bst.store.domain.StoreVO;
|
||||||
|
import com.ruoyi.bst.store.service.StoreService;
|
||||||
|
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
|
import com.ruoyi.system.user.service.UserService;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -27,6 +36,16 @@ public class LightingNumServiceImpl implements LightingNumService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private LightingNumMapper lightingNumMapper;
|
private LightingNumMapper lightingNumMapper;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private StoreService storeService;
|
||||||
|
@Autowired
|
||||||
|
private LightingNumService lightingNumService;
|
||||||
|
@Autowired
|
||||||
|
private ChangeRecordService changeRecordService;
|
||||||
|
@Autowired
|
||||||
|
private ChangeRecordMapper changeRecordMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询爆灯次数列表
|
* 查询爆灯次数列表
|
||||||
|
@ -126,4 +145,25 @@ public class LightingNumServiceImpl implements LightingNumService
|
||||||
public int reduceLightingNumByQuery( LightingNum data, OrderQuery query) {
|
public int reduceLightingNumByQuery( LightingNum data, OrderQuery query) {
|
||||||
return lightingNumMapper.reduceLightingNum(data,query);
|
return lightingNumMapper.reduceLightingNum(data,query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int giftLightingNum(GiftLightingNumDTO dto) {
|
||||||
|
Long storeId = dto.getStoreId();
|
||||||
|
Integer number = dto.getNumber();
|
||||||
|
|
||||||
|
// 校验店铺是否存在
|
||||||
|
StoreVO store = storeService.selectStoreById(storeId);
|
||||||
|
ServiceUtil.assertion(store == null,"当前店铺不存在");
|
||||||
|
|
||||||
|
UserVO user = null;
|
||||||
|
// 校验用户是否存在
|
||||||
|
if (dto.getPhone() != null) {
|
||||||
|
user = userService.selectUserByPhonenumber(dto.getPhone());
|
||||||
|
ServiceUtil.assertion(user == null,"当前用户不存在");
|
||||||
|
}else {
|
||||||
|
user = userService.selectUserById(dto.getUserId());
|
||||||
|
}
|
||||||
|
// 增加用户爆灯次数并生成记录
|
||||||
|
return userService.addLightingNum( user.getUserId(), storeId, number,ChangeRecordBstType.GIFT.getCode(),storeId,"商户赠送爆灯次数"+number);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,14 @@ public class Order extends BaseEntity
|
||||||
@ApiModelProperty("套餐ID")
|
@ApiModelProperty("套餐ID")
|
||||||
private Long suitId;
|
private Long suitId;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "套餐次数")
|
@Excel(name = "套餐次数")
|
||||||
@ApiModelProperty("套餐次数")
|
@ApiModelProperty("套餐次数")
|
||||||
private Integer suitNum;
|
private Integer suitNum;
|
||||||
|
|
||||||
|
@Excel(name = "已退款次数")
|
||||||
|
@ApiModelProperty("已退款次数")
|
||||||
|
private Integer refundNum;
|
||||||
|
|
||||||
@Excel(name = "套餐金额", readConverterExp = "单=位:元")
|
@Excel(name = "套餐金额", readConverterExp = "单=位:元")
|
||||||
@ApiModelProperty("套餐金额")
|
@ApiModelProperty("套餐金额")
|
||||||
private BigDecimal suitAmount;
|
private BigDecimal suitAmount;
|
||||||
|
|
|
@ -89,4 +89,6 @@ public interface OrderMapper
|
||||||
int updateByQuery(@Param("data") Order data, @Param("query") OrderQuery query);
|
int updateByQuery(@Param("data") Order data, @Param("query") OrderQuery query);
|
||||||
|
|
||||||
OrderVO selectOrderByBstId(@Param("bstId") Long bstId);
|
OrderVO selectOrderByBstId(@Param("bstId") Long bstId);
|
||||||
|
|
||||||
|
int addRefundNum(@Param("id") Long id, @Param("number") Integer number);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.bst.order.service;
|
package com.ruoyi.bst.order.service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.bst.order.domain.Order;
|
import com.ruoyi.bst.order.domain.Order;
|
||||||
import com.ruoyi.bst.order.domain.OrderVO;
|
import com.ruoyi.bst.order.domain.OrderVO;
|
||||||
|
@ -7,6 +8,7 @@ import com.ruoyi.bst.order.domain.OrderQuery;
|
||||||
import com.ruoyi.bst.order.domain.dto.OrderCreateDTO;
|
import com.ruoyi.bst.order.domain.dto.OrderCreateDTO;
|
||||||
import com.ruoyi.bst.order.domain.dto.OrderRefundDTO;
|
import com.ruoyi.bst.order.domain.dto.OrderRefundDTO;
|
||||||
import com.ruoyi.bst.pay.domain.vo.DoPayVO;
|
import com.ruoyi.bst.pay.domain.vo.DoPayVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单列表Service接口
|
* 订单列表Service接口
|
||||||
|
@ -118,4 +120,12 @@ public interface OrderService
|
||||||
*/
|
*/
|
||||||
public int refund(OrderRefundDTO dto);
|
public int refund(OrderRefundDTO dto);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加退款的爆灯次数
|
||||||
|
* @param id 支付单ID
|
||||||
|
* @param number 退款爆灯数
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int addRefundNum(Long id, Integer number);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,6 @@ public class OrderPayHandler implements PayHandler {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 支付成功后处理
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPaySuccess(PayVO pay) {
|
public boolean onPaySuccess(PayVO pay) {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.ruoyi.bst.channel.domain.ChannelVO;
|
||||||
import com.ruoyi.bst.channel.domain.enums.ChannelApiType;
|
import com.ruoyi.bst.channel.domain.enums.ChannelApiType;
|
||||||
import com.ruoyi.bst.channel.service.ChannelConverter;
|
import com.ruoyi.bst.channel.service.ChannelConverter;
|
||||||
import com.ruoyi.bst.channel.service.ChannelService;
|
import com.ruoyi.bst.channel.service.ChannelService;
|
||||||
|
import com.ruoyi.bst.order.service.OrderService;
|
||||||
import com.ruoyi.bst.pay.domain.Pay;
|
import com.ruoyi.bst.pay.domain.Pay;
|
||||||
import com.ruoyi.bst.pay.domain.PayQuery;
|
import com.ruoyi.bst.pay.domain.PayQuery;
|
||||||
import com.ruoyi.bst.pay.domain.PayVO;
|
import com.ruoyi.bst.pay.domain.PayVO;
|
||||||
|
@ -75,6 +76,8 @@ public class PayServiceImpl implements PayService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RefundConverter refundConverter;
|
private RefundConverter refundConverter;
|
||||||
|
@Autowired
|
||||||
|
private OrderService orderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询支付订单
|
* 查询支付订单
|
||||||
|
@ -492,6 +495,10 @@ public class PayServiceImpl implements PayService {
|
||||||
int addRefunding = payMapper.addRefundingAmount(dto.getId(), dto.getRefundAmount());
|
int addRefunding = payMapper.addRefundingAmount(dto.getId(), dto.getRefundAmount());
|
||||||
ServiceUtil.assertion(addRefunding != 1, "记录退款中的金额失败");
|
ServiceUtil.assertion(addRefunding != 1, "记录退款中的金额失败");
|
||||||
|
|
||||||
|
// 增加退款的次数
|
||||||
|
int addRefundNum = orderService.addRefundNum(dto.getId(),dto.getNumber());
|
||||||
|
ServiceUtil.assertion(addRefundNum != 1, "记录退款中的次数失败");
|
||||||
|
|
||||||
// 创建退款订单
|
// 创建退款订单
|
||||||
Refund refundPo = refundConverter.toPo(dto, pay);
|
Refund refundPo = refundConverter.toPo(dto, pay);
|
||||||
int refund = refundService.createRefund(refundPo);
|
int refund = refundService.createRefund(refundPo);
|
||||||
|
|
|
@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
br.pay_id,
|
br.pay_id,
|
||||||
br.amount,
|
br.amount,
|
||||||
br.create_time,
|
br.create_time,
|
||||||
|
br.number,
|
||||||
br.status,
|
br.status,
|
||||||
br.reason,
|
br.reason,
|
||||||
br.user_id,
|
br.user_id,
|
||||||
|
|
|
@ -40,7 +40,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<sql id="selectUserVo">
|
<sql id="selectUserVo">
|
||||||
select
|
select
|
||||||
u.user_id,
|
u.user_id,
|
||||||
u.agent_id,
|
|
||||||
u.point,
|
u.point,
|
||||||
u.dept_id,
|
u.dept_id,
|
||||||
u.user_name,
|
u.user_name,
|
||||||
|
@ -65,7 +64,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
u.balance,
|
u.balance,
|
||||||
u.withdraw_service_type,
|
u.withdraw_service_type,
|
||||||
u.withdraw_service_value,
|
u.withdraw_service_value,
|
||||||
u.area_id,
|
|
||||||
u.bonus_delay,
|
u.bonus_delay,
|
||||||
d.dept_id,
|
d.dept_id,
|
||||||
d.parent_id,
|
d.parent_id,
|
||||||
|
|
|
@ -244,6 +244,16 @@ public interface UserService
|
||||||
public int addLightingNum(Order order);
|
public int addLightingNum(Order order);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param storeId 店铺ID
|
||||||
|
* @param number 爆灯次数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int addLightingNum(Long userId, Long storeId, Integer number ,String bstType , Long bstId ,String reason);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 减少余额
|
* 减少余额
|
||||||
|
|
|
@ -700,6 +700,12 @@ public class UserServiceImpl implements UserService
|
||||||
Long userId = order.getUserId();
|
Long userId = order.getUserId();
|
||||||
Integer number = order.getSuitNum();
|
Integer number = order.getSuitNum();
|
||||||
Long storeId = order.getStoreId();
|
Long storeId = order.getStoreId();
|
||||||
|
Long orderId = order.getId();
|
||||||
|
return addLightingNum(userId, storeId, number, ChangeRecordBstType.RECHARGE.getCode(),orderId,"用户充值,订单次数增加"+number);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int addLightingNum(Long userId, Long storeId, Integer number ,String bstType ,Long bstId ,String reason) {
|
||||||
if (userId == null || number == null || storeId == null) {
|
if (userId == null || number == null || storeId == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -739,22 +745,17 @@ public class UserServiceImpl implements UserService
|
||||||
record.setUserId(userId);
|
record.setUserId(userId);
|
||||||
record.setStoreId(storeId);
|
record.setStoreId(storeId);
|
||||||
record.setNumber(number);
|
record.setNumber(number);
|
||||||
if (lightingNumber == 0){
|
record.setBeforeNum(lightingNumber);
|
||||||
record.setBeforeNum(0);
|
|
||||||
}else {
|
|
||||||
record.setBeforeNum(lightingNumber);
|
|
||||||
}
|
|
||||||
record.setAfterNum(lightingNumber+number);
|
record.setAfterNum(lightingNumber+number);
|
||||||
record.setBstId(order.getId());
|
record.setBstId(bstId);
|
||||||
record.setBstType(ChangeRecordBstType.ORDER.getCode());
|
record.setReason(reason);
|
||||||
record.setReason("用户充值,爆灯次数增加"+number);
|
record.setBstType(bstType);
|
||||||
record.setCreateTime(DateUtils.getNowDate());
|
record.setCreateTime(DateUtils.getNowDate());
|
||||||
int recordInsert = changeRecordMapper.insertChangeRecord(record);
|
int recordInsert = changeRecordMapper.insertChangeRecord(record);
|
||||||
ServiceUtil.assertion(recordInsert != 1, "新增爆灯次数记录失败");
|
ServiceUtil.assertion(recordInsert != 1, "新增爆灯次数记录失败");
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
});
|
});
|
||||||
|
|
||||||
return result == null ? 0 : result;
|
return result == null ? 0 : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,8 @@ public class AppBoothController extends BaseController {
|
||||||
}
|
}
|
||||||
BoothVO booth = boothService.selectBoothByBoothId(boothId);
|
BoothVO booth = boothService.selectBoothByBoothId(boothId);
|
||||||
ServiceUtil.assertion(booth==null,"当前卡座信息不存在");
|
ServiceUtil.assertion(booth==null,"当前卡座信息不存在");
|
||||||
ServiceUtil.assertion(booth.getStoreId()==null,"当前卡座未绑定店铺");
|
|
||||||
ServiceUtil.assertion(booth.getUserId()==null,"请先绑定该卡座后再进行操作");
|
ServiceUtil.assertion(booth.getUserId()==null,"请先绑定该卡座后再进行操作");
|
||||||
ServiceUtil.assertion(booth.getExpiredTime().isBefore(LocalDateTime.now()), "请重新绑定卡座");
|
ServiceUtil.assertion(!booth.getUserId().equals(getUserId()),"您无权操作当前卡座设备");
|
||||||
ServiceUtil.assertion(!booth.getUserId().equals(getUserId()),"您操作当前卡座设备");
|
|
||||||
return toAjax(boothService.lighting(booth,getUserId()));
|
return toAjax(boothService.lighting(booth,getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.bst.changeRecord.domain.ChangeRecordQuery;
|
||||||
|
import com.ruoyi.bst.changeRecord.domain.enums.ChangeRecordBstType;
|
||||||
|
import com.ruoyi.bst.changeRecord.service.ChangeRecordService;
|
||||||
|
import com.ruoyi.bst.channel.domain.ChannelQuery;
|
||||||
|
import com.ruoyi.bst.channel.service.ChannelService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.domain.JsonViewProfile;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/changeRecord")
|
||||||
|
public class AppChangRecordController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChangeRecordService changeRecordService;
|
||||||
|
|
||||||
|
@ApiOperation("获取使用记录列表")
|
||||||
|
@GetMapping("/lightingRecord")
|
||||||
|
public TableDataInfo lightingRecord(ChangeRecordQuery query) {
|
||||||
|
startPage();
|
||||||
|
PageHelper.orderBy("create_time desc");
|
||||||
|
query.setUserId(getUserId());
|
||||||
|
query.setBstType(ChangeRecordBstType.LIGHTING.getCode());
|
||||||
|
return getDataTable(changeRecordService.selectChangeRecordList(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取充值记录列表")
|
||||||
|
@GetMapping("/rechargeRecord")
|
||||||
|
public TableDataInfo rechargeRecord(ChangeRecordQuery query) {
|
||||||
|
startPage();
|
||||||
|
PageHelper.orderBy("create_time desc");
|
||||||
|
query.setUserId(getUserId());
|
||||||
|
query.setBstType(ChangeRecordBstType.RECHARGE.getCode());
|
||||||
|
return getDataTable(changeRecordService.selectChangeRecordList(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.booth.domain.BoothVO;
|
||||||
|
import com.ruoyi.bst.booth.service.BoothService;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.User;
|
||||||
|
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.enums.LogBizType;
|
||||||
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
|
import com.ruoyi.system.user.service.UserConverter;
|
||||||
|
import com.ruoyi.system.user.service.UserService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/user")
|
||||||
|
@Slf4j
|
||||||
|
public class AppUserController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@ApiOperation("用户编辑基础信息")
|
||||||
|
@PutMapping("/editInfo")
|
||||||
|
public AjaxResult editInfo(@RequestBody User user) {
|
||||||
|
UserVO vo = new UserVO();
|
||||||
|
vo.setNickName(user.getNickName());
|
||||||
|
vo.setSex(user.getSex());
|
||||||
|
return toAjax(userService.updateUser(vo));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -92,7 +92,15 @@ public class BoothController extends BaseController {
|
||||||
@PreAuthorize("@ss.hasPermi('bst:booth:query')")
|
@PreAuthorize("@ss.hasPermi('bst:booth:query')")
|
||||||
@GetMapping(value = "/{boothId}")
|
@GetMapping(value = "/{boothId}")
|
||||||
public AjaxResult getInfo(@PathVariable("boothId") Long boothId) {
|
public AjaxResult getInfo(@PathVariable("boothId") Long boothId) {
|
||||||
return success(boothService.selectBoothByBoothId(boothId, true));
|
BoothVO booth = boothService.selectBoothByBoothId(boothId, true);
|
||||||
|
// 查询卡座下的设备信息
|
||||||
|
DeviceQuery deviceQuery = new DeviceQuery();
|
||||||
|
deviceQuery.setBoothId(boothId);
|
||||||
|
List<DeviceVO> devices = deviceService.selectDeviceList(deviceQuery);
|
||||||
|
if (devices != null && !devices.isEmpty()) {
|
||||||
|
booth.setDevices(devices);
|
||||||
|
}
|
||||||
|
return success(booth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,18 +3,23 @@ package com.ruoyi.web.bst;
|
||||||
import com.ruoyi.bst.lightingNum.domain.LightingNum;
|
import com.ruoyi.bst.lightingNum.domain.LightingNum;
|
||||||
import com.ruoyi.bst.lightingNum.domain.LightingNumQuery;
|
import com.ruoyi.bst.lightingNum.domain.LightingNumQuery;
|
||||||
import com.ruoyi.bst.lightingNum.domain.LightingNumVO;
|
import com.ruoyi.bst.lightingNum.domain.LightingNumVO;
|
||||||
|
import com.ruoyi.bst.lightingNum.domain.dto.GiftLightingNumDTO;
|
||||||
import com.ruoyi.bst.lightingNum.service.LightingNumService;
|
import com.ruoyi.bst.lightingNum.service.LightingNumService;
|
||||||
|
import com.ruoyi.bst.store.service.StoreValidator;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.user.service.UserValidator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
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.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +34,10 @@ public class LightingNumController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private LightingNumService lightingNumService;
|
private LightingNumService lightingNumService;
|
||||||
|
@Autowired
|
||||||
|
private StoreValidator storeValidator;
|
||||||
|
@Autowired
|
||||||
|
private UserValidator userValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询爆灯次数列表列表
|
* 查询爆灯次数列表列表
|
||||||
|
@ -69,14 +78,29 @@ public class LightingNumController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改爆灯次数列表
|
* 修改爆灯次数
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('bst:lightingNum:edit')")
|
@PreAuthorize("@ss.hasPermi('bst:lightingNum:edit')")
|
||||||
@Log(title = "爆灯次数列表", businessType = BusinessType.UPDATE)
|
@Log(title = "修改爆灯次数", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody LightingNum lightingNum)
|
public AjaxResult edit(@RequestBody LightingNum lightingNum)
|
||||||
{
|
{
|
||||||
return toAjax(lightingNumService.updateLightingNum(lightingNum));
|
return toAjax(lightingNumService.updateLightingNum(lightingNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送用户爆灯次数
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bst:lightingNum:gift')")
|
||||||
|
@Log(title = "赠送用户爆灯次数", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/giftLightingNum")
|
||||||
|
public AjaxResult giftLightingNum(@Valid @RequestBody GiftLightingNumDTO dto)
|
||||||
|
{
|
||||||
|
// 权限校验
|
||||||
|
if (!storeValidator.canEdit(dto.getStoreId())){
|
||||||
|
return error("您无权限操作当前店铺信息");
|
||||||
|
}
|
||||||
|
return toAjax(lightingNumService.giftLightingNum(dto));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user