Commit 811b37e3 by 吕明尚

Merge branch 'dev' into test

parents cbd6cbd6 1c69cb22
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.GiftAmountLog;
import share.system.domain.vo.GiftAmountLogVo;
import share.system.service.GiftAmountLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 赠送金额日志Controller
*
* @author wuwenlong
* @date 2024-10-08
*/
@RestController
@RequestMapping("/system/giftAmountLog")
public class GiftAmountLogController extends BaseController {
@Autowired
private GiftAmountLogService giftAmountLogService;
/**
* 查询赠送金额日志列表
*/
@PreAuthorize("@ss.hasPermi('system:giftAmountLog:list')")
@GetMapping("/list")
public TableDataInfo list(GiftAmountLogVo giftAmountLog) {
startPage();
List<GiftAmountLogVo> list = giftAmountLogService.selectGiftAmountLogList(giftAmountLog);
return getDataTable(list);
}
/**
* 导出赠送金额日志列表
*/
@PreAuthorize("@ss.hasPermi('system:giftAmountLog:export')")
@Log(title = "赠送金额日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, GiftAmountLogVo giftAmountLog) {
List<GiftAmountLogVo> list = giftAmountLogService.selectGiftAmountLogList(giftAmountLog);
ExcelUtil<GiftAmountLogVo> util = new ExcelUtil<GiftAmountLogVo>(GiftAmountLogVo.class);
util.exportExcel(response, list, "赠送金额日志数据");
}
/**
* 获取赠送金额日志详细信息
*/
@PreAuthorize("@ss.hasPermi('system:giftAmountLog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(giftAmountLogService.selectGiftAmountLogById(id));
}
/**
* 新增赠送金额日志
*/
@PreAuthorize("@ss.hasPermi('system:giftAmountLog:add')")
@Log(title = "赠送金额日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody GiftAmountLog giftAmountLog) {
return toAjax(giftAmountLogService.insertGiftAmountLog(giftAmountLog));
}
/**
* 修改赠送金额日志
*/
@PreAuthorize("@ss.hasPermi('system:giftAmountLog:edit')")
@Log(title = "赠送金额日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody GiftAmountLog giftAmountLog) {
return toAjax(giftAmountLogService.updateGiftAmountLog(giftAmountLog));
}
/**
* 删除赠送金额日志
*/
@PreAuthorize("@ss.hasPermi('system:giftAmountLog:remove')")
@Log(title = "赠送金额日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(giftAmountLogService.deleteGiftAmountLogByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.RechargeAmountLog;
import share.system.domain.vo.RechargeAmountLogVo;
import share.system.service.RechargeAmountLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充值金额日志Controller
*
* @author wuwenlong
* @date 2024-10-08
*/
@RestController
@RequestMapping("/system/rechargeAmountLog")
public class RechargeAmountLogController extends BaseController {
@Autowired
private RechargeAmountLogService rechargeAmountLogService;
/**
* 查询充值金额日志列表
*/
@PreAuthorize("@ss.hasPermi('system:rechargeAmountLog:list')")
@GetMapping("/list")
public TableDataInfo list(RechargeAmountLogVo rechargeAmountLog) {
startPage();
List<RechargeAmountLogVo> list = rechargeAmountLogService.selectRechargeAmountLogList(rechargeAmountLog);
return getDataTable(list);
}
/**
* 导出充值金额日志列表
*/
@PreAuthorize("@ss.hasPermi('system:rechargeAmountLog:export')")
@Log(title = "充值金额日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RechargeAmountLogVo rechargeAmountLog) {
List<RechargeAmountLogVo> list = rechargeAmountLogService.selectRechargeAmountLogList(rechargeAmountLog);
ExcelUtil<RechargeAmountLogVo> util = new ExcelUtil<RechargeAmountLogVo>(RechargeAmountLogVo.class);
util.exportExcel(response, list, "充值金额日志数据");
}
/**
* 获取充值金额日志详细信息
*/
@PreAuthorize("@ss.hasPermi('system:rechargeAmountLog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(rechargeAmountLogService.selectRechargeAmountLogById(id));
}
/**
* 新增充值金额日志
*/
@PreAuthorize("@ss.hasPermi('system:rechargeAmountLog:add')")
@Log(title = "充值金额日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RechargeAmountLog rechargeAmountLog) {
return toAjax(rechargeAmountLogService.insertRechargeAmountLog(rechargeAmountLog));
}
/**
* 修改充值金额日志
*/
@PreAuthorize("@ss.hasPermi('system:rechargeAmountLog:edit')")
@Log(title = "充值金额日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RechargeAmountLog rechargeAmountLog) {
return toAjax(rechargeAmountLogService.updateRechargeAmountLog(rechargeAmountLog));
}
/**
* 删除充值金额日志
*/
@PreAuthorize("@ss.hasPermi('system:rechargeAmountLog:remove')")
@Log(title = "充值金额日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(rechargeAmountLogService.deleteRechargeAmountLogByIds(ids));
}
}
...@@ -13,7 +13,9 @@ public enum ReceiptRdeisEnum { ...@@ -13,7 +13,9 @@ public enum ReceiptRdeisEnum {
//房间15分钟过期 //房间15分钟过期
ROOM_EXPIRE_TIME(9, "ROOM_EXPIRE_TIME."), ROOM_EXPIRE_TIME(9, "ROOM_EXPIRE_TIME."),
ORDER_CANCEL_PAY(10, "ORDER_CANCEL_PAY."), ORDER_CANCEL_PAY(10, "ORDER_CANCEL_PAY."),
EQUITY_MEMBERS_TIME(11, "EQUITY_MEMBERS_TIME.") EQUITY_MEMBERS_TIME(11, "EQUITY_MEMBERS_TIME."),
MONTHLY_CARD(12, "MONTHLY_CARD."),
SECONDARY_CARD(13, "SECONDARY_CARD.")
; ;
......
...@@ -35,8 +35,8 @@ public class ConsumerSecondaryCardController extends BaseController { ...@@ -35,8 +35,8 @@ public class ConsumerSecondaryCardController extends BaseController {
} }
@GetMapping("/query") @GetMapping("/query")
public AjaxResult selectByConsumerId() { public AjaxResult selectByConsumerId(Long packId) {
return success(consumerSecondaryCardService.selectByConsumerId()); return success(consumerSecondaryCardService.selectByPaclId(packId));
} }
} }
...@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse; import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity; import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.val;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -33,7 +32,6 @@ import share.system.domain.vo.MqttxVo; ...@@ -33,7 +32,6 @@ import share.system.domain.vo.MqttxVo;
import share.system.service.*; import share.system.service.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -116,6 +114,12 @@ public class RedisTask { ...@@ -116,6 +114,12 @@ public class RedisTask {
@Autowired @Autowired
private EquityFundExcessService equityFundExcessService; private EquityFundExcessService equityFundExcessService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
//15分钟的常量 //15分钟的常量
final long FIFTEEN_MINUTES = 60 * 15; final long FIFTEEN_MINUTES = 60 * 15;
...@@ -780,4 +784,42 @@ public class RedisTask { ...@@ -780,4 +784,42 @@ public class RedisTask {
}); });
logger.debug("AutoUpdateOpenid:自动更新用户unionid结束"); logger.debug("AutoUpdateOpenid:自动更新用户unionid结束");
} }
@XxlJob("AutomaticallyMonthlyCard")
public void AutomaticallyMonthlyCard() {
logger.debug("AutomaticallyMonthlyCard:自动结束月卡开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.MONTHLY_CARD.getValue() + "*");
if (keys.size() == 0) return;
keys.stream().forEach(key -> {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
Long consumerMonthlyCardId = jsonObject.getLong("consumerMonthlyCardId");
if (expirationTime.getTime() < new Date().getTime()) {
consumerMonthlyCardService.removeById(consumerMonthlyCardId);
redisUtil.delete(key);
}
});
logger.debug("AutomaticallyMonthlyCard:自动结束月卡结束");
}
@XxlJob("AutomaticallySecondaryCard")
public void AutomaticallySecondaryCard() {
logger.debug("AutomaticallySecondaryCard:自动结束次卡开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.SECONDARY_CARD.getValue() + "*");
if (keys.size() == 0) return;
keys.stream().forEach(key -> {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
Long consumerSecondaryCardId = jsonObject.getLong("consumerSecondaryCardId");
if (expirationTime.getTime() < new Date().getTime()) {
consumerSecondaryCardService.removeById(consumerSecondaryCardId);
redisUtil.delete(key);
}
});
logger.debug("AutomaticallySecondaryCard:自动结束次卡结束");
}
} }
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -10,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; ...@@ -10,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity; import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -51,7 +50,7 @@ public class ConsumerMonthlyCard extends BaseEntity { ...@@ -51,7 +50,7 @@ public class ConsumerMonthlyCard extends BaseEntity {
* 免费时长 * 免费时长
*/ */
@Excel(name = "免费时长") @Excel(name = "免费时长")
private Long freeDuration; private BigDecimal freeDuration;
/** /**
* 月卡天数 * 月卡天数
...@@ -69,7 +68,10 @@ public class ConsumerMonthlyCard extends BaseEntity { ...@@ -69,7 +68,10 @@ public class ConsumerMonthlyCard extends BaseEntity {
/** /**
* 删除标记:1-删除,0-正常 * 删除标记:1-删除,0-正常
*/ */
private Long isDelete; //逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Integer isDelete;
@Override @Override
......
...@@ -39,6 +39,18 @@ public class ConsumerWallet extends BaseEntity { ...@@ -39,6 +39,18 @@ public class ConsumerWallet extends BaseEntity {
private BigDecimal balance; private BigDecimal balance;
/** /**
* 充值金额
*/
@Excel(name = "充值金额")
private BigDecimal rechargeAmount;
/**
* 赠送金额
*/
@Excel(name = "赠送金额")
private BigDecimal giftAmount;
/**
* 时长 * 时长
*/ */
@Excel(name = "时长") @Excel(name = "时长")
......
package share.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 赠送金额日志对象 s_gift_amount_log
*
* @author wuwenlong
* @date 2024-10-08
*/
@Data
public class GiftAmountLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
* 用户id
*/
private Long consumerId;
/**
* 当前金额
*/
@Excel(name = "当前金额")
private BigDecimal currentAmount;
/**
* 变动金额
*/
@Excel(name = "变动金额")
private BigDecimal variableAmount;
/**
* 操作类型
*/
@Excel(name = "操作类型")
private Integer operationType;
/**
* 操作时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime;
/**
* 是否删除
*/
private Long isDelete;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("consumerId", getConsumerId())
.append("currentAmount", getCurrentAmount())
.append("variableAmount", getVariableAmount())
.append("operationType", getOperationType())
.append("operationTime", getOperationTime())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
...@@ -43,7 +43,7 @@ public class MonthlyCardConf extends BaseEntity { ...@@ -43,7 +43,7 @@ public class MonthlyCardConf extends BaseEntity {
* 免费时长 * 免费时长
*/ */
@Excel(name = "免费时长") @Excel(name = "免费时长")
private Long freeDuration; private BigDecimal freeDuration;
/** /**
* 月卡天数 * 月卡天数
......
...@@ -3,12 +3,16 @@ package share.system.domain; ...@@ -3,12 +3,16 @@ package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity; import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/** /**
* 月卡使用记录对象 s_monthly_card_log * 月卡使用记录对象 s_monthly_card_log
* *
...@@ -47,13 +51,27 @@ public class MonthlyCardLog extends BaseEntity { ...@@ -47,13 +51,27 @@ public class MonthlyCardLog extends BaseEntity {
* 使用时长 * 使用时长
*/ */
@Excel(name = "使用时长") @Excel(name = "使用时长")
private Long useDuration; private BigDecimal useDuration;
/** /**
* 剩余时长 * 剩余时长
*/ */
@Excel(name = "剩余时长") @Excel(name = "剩余时长")
private Long residueDuration; private BigDecimal residueDuration;
/**
* 操作类型
*/
@Excel(name = "操作类型")
private Integer operationType;
/**
* 操作时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime;
/** /**
* 删除标记:1-删除,0-正常 * 删除标记:1-删除,0-正常
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 充值金额日志对象 s_recharge_amount_log
*
* @author wuwenlong
* @date 2024-10-08
*/
@Data
public class RechargeAmountLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
* 用户id
*/
@Excel(name = "用户id")
private Long consumerId;
/**
* 当前金额
*/
@Excel(name = "当前金额")
private BigDecimal currentAmount;
/**
* 变动金额
*/
@Excel(name = "变动金额")
private BigDecimal variableAmount;
/**
* 操作类型
*/
@Excel(name = "操作类型")
private Integer operationType;
/**
* 操作时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime;
/**
* 是否删除
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Long isDelete;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("consumerId", getConsumerId())
.append("currentAmount", getCurrentAmount())
.append("variableAmount", getVariableAmount())
.append("operationType", getOperationType())
.append("operationTime", getOperationTime())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
...@@ -81,6 +81,12 @@ public class SOrder extends BaseEntity ...@@ -81,6 +81,12 @@ public class SOrder extends BaseEntity
@Excel(name = "优惠券金额") @Excel(name = "优惠券金额")
private BigDecimal couponPrice; private BigDecimal couponPrice;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "订单总价") @Excel(name = "订单总价")
private BigDecimal totalPrice; private BigDecimal totalPrice;
...@@ -99,6 +105,12 @@ public class SOrder extends BaseEntity ...@@ -99,6 +105,12 @@ public class SOrder extends BaseEntity
@Excel(name = "使用余额") @Excel(name = "使用余额")
private BigDecimal balance; private BigDecimal balance;
@Excel(name = "充值金额")
private BigDecimal rechargeAmount;
@Excel(name = "赠送金额")
private BigDecimal giftAmount;
@Excel(name = "优惠比例") @Excel(name = "优惠比例")
private BigDecimal discountRatio; private BigDecimal discountRatio;
......
...@@ -3,12 +3,15 @@ package share.system.domain; ...@@ -3,12 +3,15 @@ package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity; import share.common.core.domain.BaseEntity;
import java.util.Date;
/** /**
* 次卡使用记录对象 s_secondary_card_log * 次卡使用记录对象 s_secondary_card_log
* *
...@@ -62,6 +65,20 @@ public class SecondaryCardLog extends BaseEntity { ...@@ -62,6 +65,20 @@ public class SecondaryCardLog extends BaseEntity {
private Long residueCount; private Long residueCount;
/** /**
* 操作类型
*/
@Excel(name = "操作类型")
private Integer operationType;
/**
* 操作时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime;
/**
* 删除标记:1-删除,0-正常 * 删除标记:1-删除,0-正常
*/ */
//逻辑删除注解(0 未删除 1 已删除) //逻辑删除注解(0 未删除 1 已删除)
......
...@@ -19,4 +19,8 @@ public class ConsumerSecondaryCardVo extends ConsumerSecondaryCard { ...@@ -19,4 +19,8 @@ public class ConsumerSecondaryCardVo extends ConsumerSecondaryCard {
private String confName; private String confName;
//次卡金额 //次卡金额
private BigDecimal confAmount; private BigDecimal confAmount;
//是否适用当前套餐
private Integer isUse;
//原因
private String reason;
} }
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.GiftAmountLog;
@Data
public class GiftAmountLogVo extends GiftAmountLog {
private String nickName;
private String avatar;
private String phone;
}
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.RechargeAmountLog;
@Data
public class RechargeAmountLogVo extends RechargeAmountLog {
private String nickName;
private String avatar;
private String phone;
}
...@@ -2,9 +2,10 @@ package share.system.domain.vo; ...@@ -2,9 +2,10 @@ package share.system.domain.vo;
import lombok.Data; import lombok.Data;
import share.system.domain.ConsumerMember; import share.system.domain.ConsumerMember;
import share.system.domain.ConsumerWallet;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import java.util.List;
/** /**
* @className: share.system.domain.vo.SConsumerVo * @className: share.system.domain.vo.SConsumerVo
* @description: 会员 * @description: 会员
...@@ -46,7 +47,8 @@ public class SConsumerVo extends SConsumer { ...@@ -46,7 +47,8 @@ public class SConsumerVo extends SConsumer {
private Long newId; private Long newId;
private List<ConsumerMonthlyCardVo> monthlyCardList;
private List<ConsumerSecondaryCardVo> secondaryCardList;
} }
...@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardMapper extends BaseMapper<ConsumerMonthlyCar ...@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardMapper extends BaseMapper<ConsumerMonthlyCar
*/ */
public int deleteConsumerMonthlyCardByIds(Long[] ids); public int deleteConsumerMonthlyCardByIds(Long[] ids);
ConsumerMonthlyCardVo selectByConsumerId(ConsumerMonthlyCardVo consumerMemberVo); List<ConsumerMonthlyCardVo> selectByConsumerId(ConsumerMonthlyCardVo consumerMemberVo);
} }
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.GiftAmountLog;
import share.system.domain.vo.GiftAmountLogVo;
import java.util.List;
/**
* 赠送金额日志Mapper接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public interface GiftAmountLogMapper extends BaseMapper<GiftAmountLog> {
/**
* 查询赠送金额日志
*
* @param id 赠送金额日志主键
* @return 赠送金额日志
*/
public GiftAmountLog selectGiftAmountLogById(Long id);
/**
* 查询赠送金额日志列表
*
* @param giftAmountLog 赠送金额日志
* @return 赠送金额日志集合
*/
public List<GiftAmountLogVo> selectGiftAmountLogList(GiftAmountLogVo giftAmountLog);
/**
* 新增赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public int insertGiftAmountLog(GiftAmountLog giftAmountLog);
/**
* 修改赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public int updateGiftAmountLog(GiftAmountLog giftAmountLog);
/**
* 删除赠送金额日志
*
* @param id 赠送金额日志主键
* @return 结果
*/
public int deleteGiftAmountLogById(Long id);
/**
* 批量删除赠送金额日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGiftAmountLogByIds(Long[] ids);
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.RechargeAmountLog;
import share.system.domain.vo.RechargeAmountLogVo;
import java.util.List;
/**
* 充值金额日志Mapper接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public interface RechargeAmountLogMapper extends BaseMapper<RechargeAmountLog> {
/**
* 查询充值金额日志
*
* @param id 充值金额日志主键
* @return 充值金额日志
*/
public RechargeAmountLog selectRechargeAmountLogById(Long id);
/**
* 查询充值金额日志列表
*
* @param rechargeAmountLog 充值金额日志
* @return 充值金额日志集合
*/
public List<RechargeAmountLogVo> selectRechargeAmountLogList(RechargeAmountLogVo rechargeAmountLog);
/**
* 新增充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public int insertRechargeAmountLog(RechargeAmountLog rechargeAmountLog);
/**
* 修改充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public int updateRechargeAmountLog(RechargeAmountLog rechargeAmountLog);
/**
* 删除充值金额日志
*
* @param id 充值金额日志主键
* @return 结果
*/
public int deleteRechargeAmountLogById(Long id);
/**
* 批量删除充值金额日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRechargeAmountLogByIds(Long[] ids);
}
...@@ -89,4 +89,12 @@ public class CreateOrderRequest { ...@@ -89,4 +89,12 @@ public class CreateOrderRequest {
@ApiModelProperty(value = "使用时长") @ApiModelProperty(value = "使用时长")
private BigDecimal duration; private BigDecimal duration;
//次卡ID
@ApiModelProperty(value = "次卡ID")
private Long secondaryCardId;
//月卡ID
@ApiModelProperty(value = "月卡ID")
private Long monthlyCardId;
} }
...@@ -54,4 +54,12 @@ public class OrderComputedPriceRequest { ...@@ -54,4 +54,12 @@ public class OrderComputedPriceRequest {
@ApiModelProperty(value = "标签id") @ApiModelProperty(value = "标签id")
private Long roomLabelId; private Long roomLabelId;
//次卡ID
@ApiModelProperty(value = "次卡ID")
private Long secondaryCardId;
//月卡ID
@ApiModelProperty(value = "月卡ID")
private Long monthlyCardId;
} }
...@@ -68,5 +68,12 @@ public class ComputedOrderPriceResponse implements Serializable { ...@@ -68,5 +68,12 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty(value = "剩余余额") @ApiModelProperty(value = "剩余余额")
private BigDecimal remainingBalance; private BigDecimal remainingBalance;
//次卡ID
@ApiModelProperty(value = "次卡ID")
private Long secondaryCardId;
//月卡ID
@ApiModelProperty(value = "月卡ID")
private Long monthlyCardId;
} }
...@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard ...@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard
*/ */
public int deleteConsumerMonthlyCardById(Long id); public int deleteConsumerMonthlyCardById(Long id);
ConsumerMonthlyCardVo selectByConsumerId(); List<ConsumerMonthlyCardVo> selectByConsumerId();
} }
...@@ -62,4 +62,6 @@ public interface ConsumerSecondaryCardService extends IService<ConsumerSecondary ...@@ -62,4 +62,6 @@ public interface ConsumerSecondaryCardService extends IService<ConsumerSecondary
public int deleteConsumerSecondaryCardById(Long id); public int deleteConsumerSecondaryCardById(Long id);
List<ConsumerSecondaryCardVo> selectByConsumerId(); List<ConsumerSecondaryCardVo> selectByConsumerId();
List<ConsumerSecondaryCardVo> selectByPaclId(Long packId);
} }
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.GiftAmountLog;
import share.system.domain.vo.GiftAmountLogVo;
import java.util.List;
/**
* 赠送金额日志Service接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public interface GiftAmountLogService extends IService<GiftAmountLog> {
/**
* 查询赠送金额日志
*
* @param id 赠送金额日志主键
* @return 赠送金额日志
*/
public GiftAmountLog selectGiftAmountLogById(Long id);
/**
* 查询赠送金额日志列表
*
* @param giftAmountLog 赠送金额日志
* @return 赠送金额日志集合
*/
public List<GiftAmountLogVo> selectGiftAmountLogList(GiftAmountLogVo giftAmountLog);
/**
* 新增赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public int insertGiftAmountLog(GiftAmountLog giftAmountLog);
/**
* 修改赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
public int updateGiftAmountLog(GiftAmountLog giftAmountLog);
/**
* 批量删除赠送金额日志
*
* @param ids 需要删除的赠送金额日志主键集合
* @return 结果
*/
public int deleteGiftAmountLogByIds(Long[] ids);
/**
* 删除赠送金额日志信息
*
* @param id 赠送金额日志主键
* @return 结果
*/
public int deleteGiftAmountLogById(Long id);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.RechargeAmountLog;
import share.system.domain.vo.RechargeAmountLogVo;
import java.util.List;
/**
* 充值金额日志Service接口
*
* @author wuwenlong
* @date 2024-10-08
*/
public interface RechargeAmountLogService extends IService<RechargeAmountLog> {
/**
* 查询充值金额日志
*
* @param id 充值金额日志主键
* @return 充值金额日志
*/
public RechargeAmountLog selectRechargeAmountLogById(Long id);
/**
* 查询充值金额日志列表
*
* @param rechargeAmountLog 充值金额日志
* @return 充值金额日志集合
*/
public List<RechargeAmountLogVo> selectRechargeAmountLogList(RechargeAmountLogVo rechargeAmountLog);
/**
* 新增充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public int insertRechargeAmountLog(RechargeAmountLog rechargeAmountLog);
/**
* 修改充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
public int updateRechargeAmountLog(RechargeAmountLog rechargeAmountLog);
/**
* 批量删除充值金额日志
*
* @param ids 需要删除的充值金额日志主键集合
* @return 结果
*/
public int deleteRechargeAmountLogByIds(Long[] ids);
/**
* 删除充值金额日志信息
*
* @param id 充值金额日志主键
* @return 结果
*/
public int deleteRechargeAmountLogById(Long id);
}
...@@ -95,7 +95,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -95,7 +95,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
} }
@Override @Override
public ConsumerMonthlyCardVo selectByConsumerId() { public List<ConsumerMonthlyCardVo> selectByConsumerId() {
SConsumer info = sConsumerService.getInfo(); SConsumer info = sConsumerService.getInfo();
ConsumerMonthlyCardVo vo = new ConsumerMonthlyCardVo(); ConsumerMonthlyCardVo vo = new ConsumerMonthlyCardVo();
vo.setConsumerId(info.getId()); vo.setConsumerId(info.getId());
......
package share.system.service.impl; package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import share.system.domain.ConsumerSecondaryCard; import share.system.domain.ConsumerSecondaryCard;
import share.system.domain.SConsumer; import share.system.domain.SConsumer;
import share.system.domain.SPack;
import share.system.domain.vo.ConsumerSecondaryCardVo; import share.system.domain.vo.ConsumerSecondaryCardVo;
import share.system.mapper.ConsumerSecondaryCardMapper; import share.system.mapper.ConsumerSecondaryCardMapper;
import share.system.service.ConsumerSecondaryCardService; import share.system.service.ConsumerSecondaryCardService;
import share.system.service.IPackService;
import share.system.service.SConsumerService; import share.system.service.SConsumerService;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* 用户次卡Service业务层处理 * 用户次卡Service业务层处理
...@@ -25,6 +33,8 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond ...@@ -25,6 +33,8 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
private ConsumerSecondaryCardMapper consumerSecondaryCardMapper; private ConsumerSecondaryCardMapper consumerSecondaryCardMapper;
@Autowired @Autowired
private SConsumerService sConsumerService; private SConsumerService sConsumerService;
@Autowired
private IPackService packService;
/** /**
* 查询用户次卡 * 查询用户次卡
...@@ -97,8 +107,32 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond ...@@ -97,8 +107,32 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
@Override @Override
public List<ConsumerSecondaryCardVo> selectByConsumerId() { public List<ConsumerSecondaryCardVo> selectByConsumerId() {
SConsumer info = sConsumerService.getInfo(); SConsumer info = sConsumerService.getInfo();
if (ObjectUtil.isNull(info)) {
throw new BaseException("您的登录已过期,请先登录");
}
ConsumerSecondaryCardVo vo = new ConsumerSecondaryCardVo(); ConsumerSecondaryCardVo vo = new ConsumerSecondaryCardVo();
vo.setConsumerId(info.getId()); vo.setConsumerId(info.getId());
return consumerSecondaryCardMapper.selectByConsumerId(vo); return consumerSecondaryCardMapper.selectByConsumerId(vo);
} }
@Override
public List<ConsumerSecondaryCardVo> selectByPaclId(Long packId) {
SConsumer info = sConsumerService.getInfo();
if (ObjectUtil.isNull(info)) {
throw new BaseException("您的登录已过期,请先登录");
}
Map<Long, SPack> packMap = packService.list().stream().collect(Collectors.toMap(SPack::getId, Function.identity()));
ConsumerSecondaryCardVo vo = new ConsumerSecondaryCardVo();
vo.setConsumerId(info.getId());
List<ConsumerSecondaryCardVo> consumerSecondaryCardVos = consumerSecondaryCardMapper.selectByConsumerId(vo);
consumerSecondaryCardVos.stream().forEach(item -> {
if (item.getPackId().equals(packId)) {
item.setIsUse(YesNoEnum.yes.getIndex());
} else {
item.setIsUse(YesNoEnum.no.getIndex());
item.setReason("当前次卡适用于" + packMap.get(item.getPackId()).getName() + "套餐" + ",不适用于" + packMap.get(packId).getName() + "套餐");
}
});
return consumerSecondaryCardVos;
}
} }
...@@ -59,6 +59,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -59,6 +59,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
private ISConsumerCouponService consumerCouponService; private ISConsumerCouponService consumerCouponService;
@Autowired @Autowired
private ISysConfigService sysConfigService; private ISysConfigService sysConfigService;
@Autowired
private RechargeAmountLogService rechargeAmountLogService;
@Autowired
private GiftAmountLogService giftAmountLogService;
/** /**
* 查询会员钱包 * 查询会员钱包
...@@ -153,6 +157,26 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -153,6 +157,26 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
balanceLog.setCreateTime(new Date()); balanceLog.setCreateTime(new Date());
balanceLogService.save(balanceLog); balanceLogService.save(balanceLog);
} }
if (consumerWallet.getRechargeAmount().compareTo(new BigDecimal(0)) > 0) {
RechargeAmountLog rechargeAmountLog = new RechargeAmountLog();
rechargeAmountLog.setConsumerId(consumerWallet.getConsumerId());
rechargeAmountLog.setCurrentAmount(new BigDecimal(0));
rechargeAmountLog.setVariableAmount(consumerWallet.getRechargeAmount());
rechargeAmountLog.setOperationType(YesNoEnum.yes.getIndex());
rechargeAmountLog.setOperationTime(new Date());
rechargeAmountLog.setCreateTime(new Date());
rechargeAmountLogService.save(rechargeAmountLog);
}
if (consumerWallet.getGiftAmount().compareTo(new BigDecimal(0)) > 0) {
GiftAmountLog giftAmountLog = new GiftAmountLog();
giftAmountLog.setConsumerId(consumerWallet.getConsumerId());
giftAmountLog.setCurrentAmount(new BigDecimal(0));
giftAmountLog.setVariableAmount(consumerWallet.getGiftAmount());
giftAmountLog.setOperationType(YesNoEnum.yes.getIndex());
giftAmountLog.setOperationTime(new Date());
giftAmountLog.setCreateTime(new Date());
giftAmountLogService.save(giftAmountLog);
}
if (consumerWallet.getRemainingDuration().compareTo(new BigDecimal(0)) > 0) { if (consumerWallet.getRemainingDuration().compareTo(new BigDecimal(0)) > 0) {
DurationLog durationLog = new DurationLog(); DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(consumerWallet.getConsumerId()); durationLog.setConsumerId(consumerWallet.getConsumerId());
...@@ -206,6 +230,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -206,6 +230,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
public boolean editConsumerWallet(ConsumerWallet consumerWallet, Recharge recharge, ConsumerMember one) { public boolean editConsumerWallet(ConsumerWallet consumerWallet, Recharge recharge, ConsumerMember one) {
BigDecimal divide = new BigDecimal(0); BigDecimal divide = new BigDecimal(0);
BigDecimal oldBalance = consumerWallet.getBalance(); BigDecimal oldBalance = consumerWallet.getBalance();
BigDecimal oldRechargeAmount = consumerWallet.getRechargeAmount();
BigDecimal oldGiftAmount = consumerWallet.getGiftAmount();
BigDecimal oldDuration = consumerWallet.getRemainingDuration(); BigDecimal oldDuration = consumerWallet.getRemainingDuration();
BigDecimal oldIntegral = consumerWallet.getRemainingIntegral(); BigDecimal oldIntegral = consumerWallet.getRemainingIntegral();
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime"); String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
...@@ -222,8 +248,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -222,8 +248,10 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
logger.debug("修改会员用户"); logger.debug("修改会员用户");
consumerWallet.setBalance(consumerWallet.getBalance().add(recharge.getRechargeAmount())); consumerWallet.setBalance(consumerWallet.getBalance().add(recharge.getRechargeAmount()));
consumerWallet.setRechargeAmount(consumerWallet.getRechargeAmount().add(recharge.getRechargeAmount()));
if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) { if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) {
consumerWallet.setBalance(consumerWallet.getBalance().add(recharge.getGiveAmount())); consumerWallet.setBalance(consumerWallet.getBalance().add(recharge.getGiveAmount()));
consumerWallet.setGiftAmount(consumerWallet.getGiftAmount().add(recharge.getGiveAmount()));
} }
if (rechargeConf.getGiveType().contains(GiveTypeEnum.DURATION.getIndex())) { if (rechargeConf.getGiveType().contains(GiveTypeEnum.DURATION.getIndex())) {
BigDecimal duration = consumerWallet.getRemainingDuration().add(rechargeConf.getGiveDuration()); BigDecimal duration = consumerWallet.getRemainingDuration().add(rechargeConf.getGiveDuration());
...@@ -247,6 +275,28 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -247,6 +275,28 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
balanceLogService.save(balanceLog); balanceLogService.save(balanceLog);
logger.debug("新增余额日志"); logger.debug("新增余额日志");
} }
if (consumerWallet.getRechargeAmount().compareTo(new BigDecimal(0)) > 0) {
RechargeAmountLog rechargeAmountLog = new RechargeAmountLog();
rechargeAmountLog.setConsumerId(consumerWallet.getConsumerId());
rechargeAmountLog.setCurrentAmount(oldRechargeAmount);
rechargeAmountLog.setVariableAmount(consumerWallet.getRechargeAmount().subtract(oldRechargeAmount));
rechargeAmountLog.setOperationType(YesNoEnum.yes.getIndex());
rechargeAmountLog.setOperationTime(new Date());
rechargeAmountLog.setCreateTime(new Date());
rechargeAmountLogService.save(rechargeAmountLog);
logger.debug("新增充值金额日志");
}
if (consumerWallet.getGiftAmount().compareTo(new BigDecimal(0)) > 0) {
GiftAmountLog giftAmountLog = new GiftAmountLog();
giftAmountLog.setConsumerId(consumerWallet.getConsumerId());
giftAmountLog.setCurrentAmount(oldGiftAmount);
giftAmountLog.setVariableAmount(consumerWallet.getGiftAmount().subtract(oldGiftAmount));
giftAmountLog.setOperationType(YesNoEnum.yes.getIndex());
giftAmountLog.setOperationTime(new Date());
giftAmountLog.setCreateTime(new Date());
giftAmountLogService.save(giftAmountLog);
logger.debug("新增赠送金额日志");
}
if (consumerWallet.getRemainingDuration().compareTo(new BigDecimal(0)) > 0) { if (consumerWallet.getRemainingDuration().compareTo(new BigDecimal(0)) > 0) {
DurationLog durationLog = new DurationLog(); DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(consumerWallet.getConsumerId()); durationLog.setConsumerId(consumerWallet.getConsumerId());
......
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.GiftAmountLog;
import share.system.domain.vo.GiftAmountLogVo;
import share.system.mapper.GiftAmountLogMapper;
import share.system.service.GiftAmountLogService;
import java.util.List;
/**
* 赠送金额日志Service业务层处理
*
* @author wuwenlong
* @date 2024-10-08
*/
@Service
public class GiftAmountLogServiceImpl extends ServiceImpl<GiftAmountLogMapper, GiftAmountLog> implements GiftAmountLogService {
@Autowired
private GiftAmountLogMapper giftAmountLogMapper;
/**
* 查询赠送金额日志
*
* @param id 赠送金额日志主键
* @return 赠送金额日志
*/
@Override
public GiftAmountLog selectGiftAmountLogById(Long id) {
return giftAmountLogMapper.selectGiftAmountLogById(id);
}
/**
* 查询赠送金额日志列表
*
* @param giftAmountLog 赠送金额日志
* @return 赠送金额日志
*/
@Override
public List<GiftAmountLogVo> selectGiftAmountLogList(GiftAmountLogVo giftAmountLog) {
return giftAmountLogMapper.selectGiftAmountLogList(giftAmountLog);
}
/**
* 新增赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
@Override
public int insertGiftAmountLog(GiftAmountLog giftAmountLog) {
giftAmountLog.setCreateTime(DateUtils.getNowDate());
return giftAmountLogMapper.insertGiftAmountLog(giftAmountLog);
}
/**
* 修改赠送金额日志
*
* @param giftAmountLog 赠送金额日志
* @return 结果
*/
@Override
public int updateGiftAmountLog(GiftAmountLog giftAmountLog) {
giftAmountLog.setUpdateTime(DateUtils.getNowDate());
return giftAmountLogMapper.updateGiftAmountLog(giftAmountLog);
}
/**
* 批量删除赠送金额日志
*
* @param ids 需要删除的赠送金额日志主键
* @return 结果
*/
@Override
public int deleteGiftAmountLogByIds(Long[] ids) {
return giftAmountLogMapper.deleteGiftAmountLogByIds(ids);
}
/**
* 删除赠送金额日志信息
*
* @param id 赠送金额日志主键
* @return 结果
*/
@Override
public int deleteGiftAmountLogById(Long id) {
return giftAmountLogMapper.deleteGiftAmountLogById(id);
}
}
package share.system.service.impl; package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum; import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException; import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil; import share.common.utils.BaseUtil;
...@@ -24,7 +27,9 @@ import share.system.response.MonthlyyCardPayResultResponse; ...@@ -24,7 +27,9 @@ import share.system.response.MonthlyyCardPayResultResponse;
import share.system.service.*; import share.system.service.*;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 月卡订单Service业务层处理 * 月卡订单Service业务层处理
...@@ -44,6 +49,8 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap ...@@ -44,6 +49,8 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
private MonthlyCardConfService monthlyCardConfService; private MonthlyCardConfService monthlyCardConfService;
@Autowired @Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService; private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
private RedisUtil redisUtil;
/** /**
* 查询月卡订单 * 查询月卡订单
...@@ -170,6 +177,18 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap ...@@ -170,6 +177,18 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
consumerMonthlyCard.setMonthlyCardDays(byId.getMonthlyCardDays()); consumerMonthlyCard.setMonthlyCardDays(byId.getMonthlyCardDays());
consumerMonthlyCard.setCreateTime(new Date()); consumerMonthlyCard.setCreateTime(new Date());
consumerMonthlyCardService.save(consumerMonthlyCard); consumerMonthlyCardService.save(consumerMonthlyCard);
Map<String, String> map = new HashMap<>();
map.put("consumerMonthlyCardId", String.valueOf(consumerMonthlyCard.getId()));
map.put("expirationTime", consumerMonthlyCard.getExpirationDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.MONTHLY_CARD.getValue() + consumerMonthlyCard.getId(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
} }
@Override @Override
......
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.RechargeAmountLog;
import share.system.domain.vo.RechargeAmountLogVo;
import share.system.mapper.RechargeAmountLogMapper;
import share.system.service.RechargeAmountLogService;
import java.util.List;
/**
* 充值金额日志Service业务层处理
*
* @author wuwenlong
* @date 2024-10-08
*/
@Service
public class RechargeAmountLogServiceImpl extends ServiceImpl<RechargeAmountLogMapper, RechargeAmountLog> implements RechargeAmountLogService {
@Autowired
private RechargeAmountLogMapper rechargeAmountLogMapper;
/**
* 查询充值金额日志
*
* @param id 充值金额日志主键
* @return 充值金额日志
*/
@Override
public RechargeAmountLog selectRechargeAmountLogById(Long id) {
return rechargeAmountLogMapper.selectRechargeAmountLogById(id);
}
/**
* 查询充值金额日志列表
*
* @param rechargeAmountLog 充值金额日志
* @return 充值金额日志
*/
@Override
public List<RechargeAmountLogVo> selectRechargeAmountLogList(RechargeAmountLogVo rechargeAmountLog) {
return rechargeAmountLogMapper.selectRechargeAmountLogList(rechargeAmountLog);
}
/**
* 新增充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
@Override
public int insertRechargeAmountLog(RechargeAmountLog rechargeAmountLog) {
rechargeAmountLog.setCreateTime(DateUtils.getNowDate());
return rechargeAmountLogMapper.insertRechargeAmountLog(rechargeAmountLog);
}
/**
* 修改充值金额日志
*
* @param rechargeAmountLog 充值金额日志
* @return 结果
*/
@Override
public int updateRechargeAmountLog(RechargeAmountLog rechargeAmountLog) {
rechargeAmountLog.setUpdateTime(DateUtils.getNowDate());
return rechargeAmountLogMapper.updateRechargeAmountLog(rechargeAmountLog);
}
/**
* 批量删除充值金额日志
*
* @param ids 需要删除的充值金额日志主键
* @return 结果
*/
@Override
public int deleteRechargeAmountLogByIds(Long[] ids) {
return rechargeAmountLogMapper.deleteRechargeAmountLogByIds(ids);
}
/**
* 删除充值金额日志信息
*
* @param id 充值金额日志主键
* @return 结果
*/
@Override
public int deleteRechargeAmountLogById(Long id) {
return rechargeAmountLogMapper.deleteRechargeAmountLogById(id);
}
}
...@@ -223,9 +223,11 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i ...@@ -223,9 +223,11 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
ConsumerWallet consumerWallet = new ConsumerWallet(); ConsumerWallet consumerWallet = new ConsumerWallet();
consumerWallet.setConsumerId(recharge.getConsumerId()); consumerWallet.setConsumerId(recharge.getConsumerId());
consumerWallet.setBalance(recharge.getRechargeAmount()); consumerWallet.setBalance(recharge.getRechargeAmount());
consumerWallet.setRechargeAmount(recharge.getRechargeAmount());
if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) { if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) {
BigDecimal balance = recharge.getRechargeAmount().add(rechargeConf.getGiveAmount()); BigDecimal balance = recharge.getRechargeAmount().add(rechargeConf.getGiveAmount());
consumerWallet.setBalance(balance); consumerWallet.setBalance(balance);
consumerWallet.setGiftAmount(rechargeConf.getGiveAmount());
} }
if (rechargeConf.getGiveType().contains(GiveTypeEnum.DURATION.getIndex())) { if (rechargeConf.getGiveType().contains(GiveTypeEnum.DURATION.getIndex())) {
consumerWallet.setRemainingDuration(rechargeConf.getGiveDuration()); consumerWallet.setRemainingDuration(rechargeConf.getGiveDuration());
......
...@@ -25,7 +25,6 @@ import share.common.utils.DateUtils; ...@@ -25,7 +25,6 @@ import share.common.utils.DateUtils;
import share.common.utils.StringUtils; import share.common.utils.StringUtils;
import share.system.domain.*; import share.system.domain.*;
import share.system.domain.vo.*; import share.system.domain.vo.*;
import share.system.mapper.ConsumerMemberMapper;
import share.system.mapper.SConsumerMapper; import share.system.mapper.SConsumerMapper;
import share.system.mapper.SStoreConsumerMapper; import share.system.mapper.SStoreConsumerMapper;
import share.system.request.RegisterThirdSConsumerRequest; import share.system.request.RegisterThirdSConsumerRequest;
...@@ -63,6 +62,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -63,6 +62,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
private MemberConfigService memberConfigService; private MemberConfigService memberConfigService;
@Autowired @Autowired
private MemberProgressLogService memberProgressLogService; private MemberProgressLogService memberProgressLogService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired @Autowired
...@@ -214,6 +217,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -214,6 +217,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
BeanUtils.copyProperties(currentUser, vo); BeanUtils.copyProperties(currentUser, vo);
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, currentUser.getId())); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, currentUser.getId()));
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, currentUser.getId())); ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, currentUser.getId()));
List<ConsumerSecondaryCardVo> consumerSecondaryCardVos = consumerSecondaryCardService.selectByConsumerId();
List<ConsumerMonthlyCardVo> consumerMonthlyCardVo = consumerMonthlyCardService.selectByConsumerId();
if (ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerMember)) {
vo.setConsumerMember(consumerMember); vo.setConsumerMember(consumerMember);
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())); MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
...@@ -277,9 +282,12 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -277,9 +282,12 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
} else { } else {
vo.setIsManage(true); vo.setIsManage(true);
} }
if (!CollectionUtils.isEmpty(consumerSecondaryCardVos)) {
vo.setSecondaryCardList(consumerSecondaryCardVos);
}
if (!CollectionUtils.isEmpty(consumerMonthlyCardVo)) {
vo.setMonthlyCardList(consumerMonthlyCardVo);
}
return vo; return vo;
} }
...@@ -350,10 +358,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -350,10 +358,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Override @Override
public TableDataInfo selectConsumernotById(SConsumerVo sConsumer) { public TableDataInfo selectConsumernotById(SConsumerVo sConsumer) {
List<ConsumerMember> consumerMembers = consumerMemberService List<ConsumerMember> consumerMembers = consumerMemberService
.list(new LambdaQueryWrapper<ConsumerMember>() .list(new LambdaQueryWrapper<ConsumerMember>()
.eq(ConsumerMember::getIsRights,YesNoEnum.yes.getIndex()) .eq(ConsumerMember::getIsRights, YesNoEnum.yes.getIndex())
.ne(ConsumerMember::getConsumerId,sConsumer.getNewId())); .ne(ConsumerMember::getConsumerId, sConsumer.getNewId()));
List<Long> collect = consumerMembers.stream().map(ConsumerMember::getConsumerId).collect(Collectors.toList()); List<Long> collect = consumerMembers.stream().map(ConsumerMember::getConsumerId).collect(Collectors.toList());
LambdaQueryWrapper<SConsumer> uSConsumer = new LambdaQueryWrapper<SConsumer>(); LambdaQueryWrapper<SConsumer> uSConsumer = new LambdaQueryWrapper<SConsumer>();
if (StringUtils.isNotEmpty(sConsumer.getPhone())){ if (StringUtils.isNotEmpty(sConsumer.getPhone())){
......
...@@ -172,6 +172,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -172,6 +172,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired @Autowired
private RechargeService rechargeService; private RechargeService rechargeService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
private MonthlyCardLogService monthlyCardLogService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private SecondaryCardLogService secondaryCardLogService;
@Autowired @Autowired
private SharingActivitiesService sharingActivitiesService; private SharingActivitiesService sharingActivitiesService;
...@@ -436,6 +444,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -436,6 +444,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SOrder sOrder = getInfoException(request.getOrderNo()); SOrder sOrder = getInfoException(request.getOrderNo());
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId())); ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId())); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId()));
ConsumerMonthlyCard consumerMonthlyCard = consumerMonthlyCardService.getById(sOrder.getMonthlyCardId());
ConsumerSecondaryCard consumerSecondaryCard = consumerSecondaryCardService.getById(sOrder.getSecondaryCardId());
SOrder oldSOrder = new SOrder(); SOrder oldSOrder = new SOrder();
BeanUtils.copyProperties(sOrder, oldSOrder); BeanUtils.copyProperties(sOrder, oldSOrder);
if (ObjectUtils.isEmpty(sOrder)) { if (ObjectUtils.isEmpty(sOrder)) {
...@@ -511,7 +521,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -511,7 +521,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//退款 //退款
if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) { if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) {
try { try {
refundExtracted(consumerWallet, sOrder, consumerMember); if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
}
orderRefundService.refundOp(request, sOrder); orderRefundService.refundOp(request, sOrder);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -519,7 +533,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -519,7 +533,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
} else { } else {
refundExtracted(consumerWallet, sOrder, consumerMember); if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
}
sOrder.setStatus(OrderStatusEnum.CANCEL.getCode()); sOrder.setStatus(OrderStatusEnum.CANCEL.getCode());
sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode()); sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode());
sOrder.setRefundReasonTime(cn.hutool.core.date.DateUtil.date()); sOrder.setRefundReasonTime(cn.hutool.core.date.DateUtil.date());
...@@ -903,6 +921,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -903,6 +921,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId())); ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId())); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
ConsumerMonthlyCard consumerMonthlyCard = consumerMonthlyCardService.getById(request.getMonthlyCardId());
ConsumerSecondaryCard consumerSecondaryCard = consumerSecondaryCardService.getById(request.getSecondaryCardId());
List<SStore> stores = storeService.list(); List<SStore> stores = storeService.list();
SRoom room = roomService.getById(request.getRoomId()); SRoom room = roomService.getById(request.getRoomId());
SStore sStore = storeService.getById(request.getStoreId()); SStore sStore = storeService.getById(request.getStoreId());
...@@ -959,7 +979,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -959,7 +979,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
response.setOrderNo(sOrder.getOrderNo()); response.setOrderNo(sOrder.getOrderNo());
sOrder.setPayStatus(YesNoEnum.yes.getIndex()); sOrder.setPayStatus(YesNoEnum.yes.getIndex());
sOrder.setPayTime(DateUtils.getNowDate()); sOrder.setPayTime(DateUtils.getNowDate());
creatExtracted(consumerWallet, sOrder, consumerMember); if (ObjectUtils.isEmpty(request.getMonthlyCardId()) && ObjectUtils.isEmpty(request.getSecondaryCardId())) {
creatExtracted(consumerWallet, sOrder, consumerMember);
} else {
creatExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard);
}
} else { } else {
// response = orderPayService.payment(sOrder); // response = orderPayService.payment(sOrder);
// 扫呗聚合支付 // 扫呗聚合支付
...@@ -1110,14 +1135,38 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1110,14 +1135,38 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) { if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog(); BalanceLog balanceLog = new BalanceLog();
RechargeAmountLog rechargeAmountLog = new RechargeAmountLog();
GiftAmountLog giftAmountLog = new GiftAmountLog();
balanceLog.setConsumerId(sOrder.getConsumerId()); balanceLog.setConsumerId(sOrder.getConsumerId());
balanceLog.setVariableAmount(sOrder.getBalance()); rechargeAmountLog.setConsumerId(sOrder.getConsumerId());
giftAmountLog.setConsumerId(sOrder.getConsumerId());
balanceLog.setCurrentBalance(consumerWallet.getBalance()); balanceLog.setCurrentBalance(consumerWallet.getBalance());
rechargeAmountLog.setCurrentAmount(consumerWallet.getRechargeAmount());
giftAmountLog.setCurrentAmount(consumerWallet.getGiftAmount());
balanceLog.setVariableAmount(sOrder.getBalance());
balanceLog.setOperationType(YesNoEnum.no.getIndex()); balanceLog.setOperationType(YesNoEnum.no.getIndex());
rechargeAmountLog.setOperationType(YesNoEnum.no.getIndex());
giftAmountLog.setOperationType(YesNoEnum.no.getIndex());
balanceLog.setOperationTime(new Date()); balanceLog.setOperationTime(new Date());
rechargeAmountLog.setOperationTime(new Date());
giftAmountLog.setOperationTime(new Date());
balanceLog.setCreateTime(new Date()); balanceLog.setCreateTime(new Date());
balanceLogService.save(balanceLog); rechargeAmountLog.setCreateTime(new Date());
giftAmountLog.setCreateTime(new Date());
//计算充值金额和余额的比例
BigDecimal divide = consumerWallet.getRechargeAmount().divide(consumerWallet.getBalance(), 2, RoundingMode.HALF_UP);
//余额乘充值金额比例
BigDecimal oldRechargeAmount = consumerWallet.getBalance().multiply(divide);
BigDecimal oldGiftAmount = consumerWallet.getBalance().subtract(oldRechargeAmount);
rechargeAmountLog.setVariableAmount(oldRechargeAmount);
giftAmountLog.setVariableAmount(oldGiftAmount);
consumerWallet.setBalance(consumerWallet.getBalance().subtract(sOrder.getBalance())); consumerWallet.setBalance(consumerWallet.getBalance().subtract(sOrder.getBalance()));
consumerWallet.setRechargeAmount(consumerWallet.getRechargeAmount().subtract(oldRechargeAmount));
consumerWallet.setGiftAmount(consumerWallet.getGiftAmount().subtract(oldGiftAmount));
sOrder.setRechargeAmount(oldRechargeAmount);
sOrder.setGiftAmount(oldGiftAmount);
balanceLogService.save(balanceLog);
consumerWalletService.updateById(consumerWallet); consumerWalletService.updateById(consumerWallet);
} }
} }
...@@ -1245,6 +1294,42 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1245,6 +1294,42 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void creatExtracted(ConsumerMonthlyCard consumerMonthlyCard, SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
if (consumerMonthlyCard.getFreeDuration().compareTo(sOrder.getDuration()) >= 0) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().subtract(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.no.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
}
if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId()) && !ObjectUtils.isEmpty(sOrder.getPackId())) {
if (sOrder.getPackId().equals(consumerSecondaryCard.getPackId())) {
consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() - 1);
SecondaryCardLog secondaryCardLog = new SecondaryCardLog();
secondaryCardLog.setConsumerSecondaryCardId(sOrder.getSecondaryCardId());
secondaryCardLog.setConsumerId(consumerSecondaryCard.getConsumerId());
secondaryCardLog.setPhone(sOrder.getConsumerPhone());
secondaryCardLog.setPackId(sOrder.getPackId());
secondaryCardLog.setUsageCount(1L);
secondaryCardLog.setResidueCount(Long.valueOf(consumerSecondaryCard.getNumber()));
secondaryCardLog.setOperationType(YesNoEnum.no.getIndex());
secondaryCardLog.setOperationTime(new Date());
secondaryCardLog.setCreateTime(new Date());
consumerSecondaryCardService.updateById(consumerSecondaryCard);
secondaryCardLogService.save(secondaryCardLog);
}
}
}
private void refundExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) { private void refundExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) { if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) {
...@@ -1262,14 +1347,30 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1262,14 +1347,30 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) { if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog(); BalanceLog balanceLog = new BalanceLog();
RechargeAmountLog rechargeAmountLog = new RechargeAmountLog();
GiftAmountLog giftAmountLog = new GiftAmountLog();
balanceLog.setConsumerId(sOrder.getConsumerId()); balanceLog.setConsumerId(sOrder.getConsumerId());
balanceLog.setVariableAmount(sOrder.getBalance()); rechargeAmountLog.setConsumerId(sOrder.getConsumerId());
giftAmountLog.setConsumerId(sOrder.getConsumerId());
balanceLog.setCurrentBalance(consumerWallet.getBalance()); balanceLog.setCurrentBalance(consumerWallet.getBalance());
rechargeAmountLog.setCurrentAmount(consumerWallet.getRechargeAmount());
giftAmountLog.setCurrentAmount(consumerWallet.getGiftAmount());
balanceLog.setVariableAmount(sOrder.getBalance());
rechargeAmountLog.setVariableAmount(sOrder.getRechargeAmount());
giftAmountLog.setVariableAmount(sOrder.getGiftAmount());
balanceLog.setOperationType(YesNoEnum.yes.getIndex()); balanceLog.setOperationType(YesNoEnum.yes.getIndex());
rechargeAmountLog.setOperationType(YesNoEnum.yes.getIndex());
giftAmountLog.setOperationType(YesNoEnum.yes.getIndex());
balanceLog.setOperationTime(new Date()); balanceLog.setOperationTime(new Date());
rechargeAmountLog.setOperationTime(new Date());
giftAmountLog.setOperationTime(new Date());
balanceLog.setCreateTime(new Date()); balanceLog.setCreateTime(new Date());
balanceLogService.save(balanceLog); rechargeAmountLog.setCreateTime(new Date());
giftAmountLog.setCreateTime(new Date());
consumerWallet.setBalance(consumerWallet.getBalance().add(sOrder.getBalance())); consumerWallet.setBalance(consumerWallet.getBalance().add(sOrder.getBalance()));
consumerWallet.setRechargeAmount(consumerWallet.getRechargeAmount().add(sOrder.getRechargeAmount()));
consumerWallet.setGiftAmount(consumerWallet.getGiftAmount().add(sOrder.getGiftAmount()));
balanceLogService.save(balanceLog);
consumerWalletService.updateById(consumerWallet); consumerWalletService.updateById(consumerWallet);
} }
} }
...@@ -1438,6 +1539,40 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1438,6 +1539,40 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// } // }
} }
private void refundExtracted(ConsumerMonthlyCard consumerMonthlyCard, SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().add(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.yes.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId()) && !ObjectUtils.isEmpty(sOrder.getPackId())) {
if (sOrder.getPackId().equals(consumerSecondaryCard.getPackId())) {
consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() + 1);
SecondaryCardLog secondaryCardLog = new SecondaryCardLog();
secondaryCardLog.setConsumerSecondaryCardId(sOrder.getSecondaryCardId());
secondaryCardLog.setConsumerId(consumerSecondaryCard.getConsumerId());
secondaryCardLog.setPhone(sOrder.getConsumerPhone());
secondaryCardLog.setPackId(sOrder.getPackId());
secondaryCardLog.setUsageCount(1L);
secondaryCardLog.setResidueCount(Long.valueOf(consumerSecondaryCard.getNumber()));
secondaryCardLog.setOperationType(YesNoEnum.yes.getIndex());
secondaryCardLog.setOperationTime(new Date());
secondaryCardLog.setCreateTime(new Date());
consumerSecondaryCardService.updateById(consumerSecondaryCard);
secondaryCardLogService.save(secondaryCardLog);
}
}
}
private String lockOrder(CreateOrderRequest request) throws BaseException { private String lockOrder(CreateOrderRequest request) throws BaseException {
try { try {
//自旋10次,每次等待1秒 //自旋10次,每次等待1秒
...@@ -1927,6 +2062,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1927,6 +2062,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId())); ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId())); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId()));
ConsumerMonthlyCard consumerMonthlyCard = consumerMonthlyCardService.getById(sOrder.getMonthlyCardId());
ConsumerSecondaryCard consumerSecondaryCard = consumerSecondaryCardService.getById(sOrder.getSecondaryCardId());
logger.debug("订单查询预约时间是否干涉"); logger.debug("订单查询预约时间是否干涉");
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(SOrder::getOrderNo, sOrder.getOrderNo()); queryWrapper.ne(SOrder::getOrderNo, sOrder.getOrderNo());
...@@ -1986,7 +2123,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1986,7 +2123,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5, deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} }
refundExtracted(consumerWallet, sOrder, consumerMember); if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
}
} }
} else { } else {
...@@ -2017,7 +2158,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2017,7 +2158,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (sOrder.getIsDelete().equals(YesNoEnum.yes.getIndex()) && sOrder.getPayStatus().equals(YesNoEnum.yes.getIndex())) { if (sOrder.getIsDelete().equals(YesNoEnum.yes.getIndex()) && sOrder.getPayStatus().equals(YesNoEnum.yes.getIndex())) {
sOrder.setIsDelete(YesNoEnum.no.getIndex()); sOrder.setIsDelete(YesNoEnum.no.getIndex());
} }
creatExtracted(consumerWallet, sOrder, consumerMember); if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
creatExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard);
} else {
creatExtracted(consumerWallet, sOrder, consumerMember);
}
baseMapper.updateSOrder(sOrder); baseMapper.updateSOrder(sOrder);
unLockOrder(sOrder.getRoomId()); unLockOrder(sOrder.getRoomId());
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) { if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
...@@ -2125,6 +2270,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2125,6 +2270,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SOrder sOrder = getInfoException(request.getOrderNo()); SOrder sOrder = getInfoException(request.getOrderNo());
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId())); ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId())); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId()));
ConsumerMonthlyCard consumerMonthlyCard = consumerMonthlyCardService.getById(sOrder.getMonthlyCardId());
ConsumerSecondaryCard consumerSecondaryCard = consumerSecondaryCardService.getById(sOrder.getSecondaryCardId());
if (!YesNoEnum.yes.getIndex().equals(sOrder.getPayStatus())) { if (!YesNoEnum.yes.getIndex().equals(sOrder.getPayStatus())) {
throw new BaseException("未支付无法退款"); throw new BaseException("未支付无法退款");
} }
...@@ -2170,7 +2317,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2170,7 +2317,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5, deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} }
refundExtracted(consumerWallet, sOrder, consumerMember); if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
}
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -2197,7 +2348,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2197,7 +2348,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
try { try {
sOrder.setRefundReason(request.getRefundReason()); sOrder.setRefundReason(request.getRefundReason());
updateById(sOrder); updateById(sOrder);
refundExtracted(consumerWallet, sOrder, consumerMember); if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
}
//微信退款 //微信退款
// if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) { // if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) {
// 退款task, 定时任务退优惠券 // 退款task, 定时任务退优惠券
...@@ -2480,10 +2635,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2480,10 +2635,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Activity activity = null; Activity activity = null;
ConsumerMember consumerMember = null; ConsumerMember consumerMember = null;
ConsumerWallet consumerWallet = null; ConsumerWallet consumerWallet = null;
ConsumerMonthlyCard consumerMonthlyCard = null;
List<ConsumerSecondaryCard> consumerSecondaryCardList = null;
LambdaQueryWrapper<Activity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Activity> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId())); consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId()));
consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId())); consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
consumerMonthlyCard = consumerMonthlyCardService.getOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()));
consumerSecondaryCardList = consumerSecondaryCardService.list(new LambdaQueryWrapper<ConsumerSecondaryCard>().eq(ConsumerSecondaryCard::getConsumerId, user.getId())
.ne(ConsumerSecondaryCard::getNumber, YesNoEnum.no.getIndex())
);
if (ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerMember)) {
queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex()); queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex());
// if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) { // if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
...@@ -2532,6 +2693,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2532,6 +2693,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount()); priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember);
} }
if (ObjectUtil.isNotEmpty(consumerMonthlyCard)) {
totalFee = getBigDecimal(consumerMonthlyCard, timeLong, priceResponse, totalPrice, room);
}
} else { } else {
SPack byId = packService.getById(roomLabel.getPackId()); SPack byId = packService.getById(roomLabel.getPackId());
if (!ObjectUtils.isEmpty(byId) && byId.getIsOpen().equals(YesNoEnum.yes.getIndex())) { if (!ObjectUtils.isEmpty(byId) && byId.getIsOpen().equals(YesNoEnum.yes.getIndex())) {
...@@ -2549,6 +2713,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2549,6 +2713,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount()); priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
} }
if (CollectionUtils.isNotEmpty(consumerSecondaryCardList)) {
totalFee = getBigDecimal(consumerSecondaryCardList, priceResponse, byId, payPrice);
}
// if(ObjectUtil.isNotEmpty(consumerMonthlyCard)){
// totalFee = getBigDecimal(consumerMonthlyCard,timeLong,priceResponse,totalFee,room);
// }
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId); // totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
} else { } else {
...@@ -2566,6 +2736,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2566,6 +2736,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount()); priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember);
} }
if (ObjectUtil.isNotEmpty(consumerMonthlyCard)) {
totalFee = getBigDecimal(consumerMonthlyCard, timeLong, priceResponse, totalPrice, room);
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room); // totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
} }
...@@ -2586,6 +2759,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2586,6 +2759,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount()); priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request); totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
} }
if (CollectionUtils.isNotEmpty(consumerSecondaryCardList)) {
totalFee = getBigDecimal(consumerSecondaryCardList, priceResponse, byId, payPrice);
}
} }
priceResponse.setTotalFee(payPrice); priceResponse.setTotalFee(payPrice);
...@@ -2914,6 +3090,46 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2914,6 +3090,46 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return payPrice; return payPrice;
} }
private BigDecimal getBigDecimal(ConsumerMonthlyCard consumerMonthlyCard, BigDecimal timeLong,
ComputedOrderPriceResponse priceResponse, BigDecimal totalFee, SRoom room) {
if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) >= 0) {
priceResponse.setDuration(timeLong);
priceResponse.setRemainingDuration(consumerMonthlyCard.getFreeDuration().subtract(timeLong));
priceResponse.setDiscount(BigDecimal.ZERO);
totalFee = new BigDecimal(0);
priceResponse.setMemberDiscount(new BigDecimal(0.00));
priceResponse.setTotalFeeNow(priceResponse.getTotalFee());
priceResponse.setPayFee(BigDecimal.ZERO);
priceResponse.setMonthlyCardId(consumerMonthlyCard.getId());
} else if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) < 0) {
priceResponse.setDuration(consumerMonthlyCard.getFreeDuration());
priceResponse.setRemainingDuration(new BigDecimal(0));
BigDecimal remainingBalance = consumerMonthlyCard.getFreeDuration().multiply(room.getPrice());
remainingBalance = totalFee.subtract(remainingBalance);
priceResponse.setTotalFeeNow(remainingBalance);
priceResponse.setMemberDiscount(totalFee.subtract(remainingBalance));
totalFee = remainingBalance;
priceResponse.setPayFee(remainingBalance);
priceResponse.setMonthlyCardId(consumerMonthlyCard.getId());
}
return totalFee;
}
private BigDecimal getBigDecimal(List<ConsumerSecondaryCard> consumerSecondaryCardList,
ComputedOrderPriceResponse priceResponse, SPack byId, BigDecimal payPrice) {
//获取集合中次数最少的次卡,次数不低于0
ConsumerSecondaryCard consumerSecondaryCard = consumerSecondaryCardList.stream().min(Comparator.comparing(ConsumerSecondaryCard::getNumber)).get();
if (consumerSecondaryCard.getPackId().equals(byId.getId())) {
priceResponse.setDiscount(BigDecimal.ZERO);
priceResponse.setMemberDiscount(BigDecimal.ZERO);
priceResponse.setTotalFeeNow(payPrice);
priceResponse.setPayFee(BigDecimal.ZERO);
priceResponse.setSecondaryCardId(consumerSecondaryCard.getId());
payPrice = BigDecimal.ZERO;
}
return payPrice;
}
private BigDecimal computeTotalPrice(Long packId, BigDecimal totalPrice) { private BigDecimal computeTotalPrice(Long packId, BigDecimal totalPrice) {
SPack pack = packService.getById(packId); SPack pack = packService.getById(packId);
if (Objects.isNull(pack)) { if (Objects.isNull(pack)) {
......
package share.system.service.impl; package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum; import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException; import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil; import share.common.utils.BaseUtil;
...@@ -23,7 +26,9 @@ import share.system.response.SecondaryCardOrderPayResultResponse; ...@@ -23,7 +26,9 @@ import share.system.response.SecondaryCardOrderPayResultResponse;
import share.system.service.*; import share.system.service.*;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 次卡购买记录Service业务层处理 * 次卡购买记录Service业务层处理
...@@ -43,6 +48,8 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde ...@@ -43,6 +48,8 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
private SecondaryCardConfService secondaryCardConfService; private SecondaryCardConfService secondaryCardConfService;
@Autowired @Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService; private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private RedisUtil redisUtil;
/** /**
* 查询次卡购买记录 * 查询次卡购买记录
...@@ -160,6 +167,18 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde ...@@ -160,6 +167,18 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
consumerSecondaryCard.setNumber(secondaryCardConf.getNumber()); consumerSecondaryCard.setNumber(secondaryCardConf.getNumber());
consumerSecondaryCard.setCreateTime(new Date()); consumerSecondaryCard.setCreateTime(new Date());
consumerSecondaryCardService.save(consumerSecondaryCard); consumerSecondaryCardService.save(consumerSecondaryCard);
Map<String, String> map = new HashMap<>();
map.put("consumerSecondaryCardId", String.valueOf(consumerSecondaryCard.getId()));
map.put("expirationTime", consumerSecondaryCard.getExpirationDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.SECONDARY_CARD.getValue() + consumerSecondaryCard.getId(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
} }
@Override @Override
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
<result property="avatar" column="avatar"/> <result property="avatar" column="avatar"/>
<result property="phone" column="phone"/> <result property="phone" column="phone"/>
<result property="balance" column="balance"/> <result property="balance" column="balance"/>
<result property="rechargeAmount" column="recharge_amount"/>
<result property="giftAmount" column="gift_amount"/>
<result property="remainingDuration" column="remaining_duration"/> <result property="remainingDuration" column="remaining_duration"/>
<result property="remainingIntegral" column="remaining_integral"/> <result property="remainingIntegral" column="remaining_integral"/>
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete"/>
...@@ -27,6 +29,8 @@ ...@@ -27,6 +29,8 @@
select id, select id,
consumer_id, consumer_id,
balance, balance,
recharge_amount,
gift_amount,
remaining_duration, remaining_duration,
remaining_integral, remaining_integral,
is_delete, is_delete,
...@@ -47,6 +51,8 @@ ...@@ -47,6 +51,8 @@
c.phone, c.phone,
c.avatar, c.avatar,
w.balance, w.balance,
w.recharge_amount,
w.gift_amount,
w.remaining_duration, w.remaining_duration,
w.remaining_integral, w.remaining_integral,
w.is_delete, w.is_delete,
...@@ -80,6 +86,8 @@ ...@@ -80,6 +86,8 @@
c.phone, c.phone,
c.avatar, c.avatar,
w.balance, w.balance,
w.recharge_amount,
w.gift_amount,
w.remaining_duration, w.remaining_duration,
w.remaining_integral, w.remaining_integral,
w.is_delete, w.is_delete,
...@@ -109,6 +117,8 @@ ...@@ -109,6 +117,8 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consumerId != null">consumer_id,</if> <if test="consumerId != null">consumer_id,</if>
<if test="balance != null">balance,</if> <if test="balance != null">balance,</if>
<if test="rechargeAmount != null">recharge_amount,</if>
<if test="giftAmount != null">gift_amount,</if>
<if test="remainingDuration != null">remaining_duration,</if> <if test="remainingDuration != null">remaining_duration,</if>
<if test="remainingIntegral != null">remaining_integral,</if> <if test="remainingIntegral != null">remaining_integral,</if>
<if test="isDelete != null">is_delete,</if> <if test="isDelete != null">is_delete,</if>
...@@ -123,6 +133,8 @@ ...@@ -123,6 +133,8 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if> <if test="consumerId != null">#{consumerId},</if>
<if test="balance != null">#{balance},</if> <if test="balance != null">#{balance},</if>
<if test="rechargeAmount != null">#{rechargeAmount},</if>
<if test="giftAmount != null">#{giftAmount},</if>
<if test="remainingDuration != null">#{remainingDuration},</if> <if test="remainingDuration != null">#{remainingDuration},</if>
<if test="remainingIntegral != null">#{remainingIntegral},</if> <if test="remainingIntegral != null">#{remainingIntegral},</if>
<if test="isDelete != null">#{isDelete},</if> <if test="isDelete != null">#{isDelete},</if>
...@@ -141,6 +153,8 @@ ...@@ -141,6 +153,8 @@
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</if> <if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="balance != null">balance = #{balance},</if> <if test="balance != null">balance = #{balance},</if>
<if test="rechargeAmount != null">recharge_amount = #{rechargeAmount},</if>
<if test="giftAmount != null">gift_amount = #{giftAmount},</if>
<if test="remainingDuration != null">remaining_duration = #{remainingDuration},</if> <if test="remainingDuration != null">remaining_duration = #{remainingDuration},</if>
<if test="remainingIntegral != null">remaining_integral = #{remainingIntegral},</if> <if test="remainingIntegral != null">remaining_integral = #{remainingIntegral},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if> <if test="isDelete != null">is_delete = #{isDelete},</if>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.GiftAmountLogMapper">
<resultMap type="GiftAmountLogVo" id="GiftAmountLogResult">
<result property="id" column="id"/>
<result property="consumerId" column="consumer_id"/>
<result property="nickName" column="nick_name"/>
<result property="phone" column="phone"/>
<result property="avatar" column="avatar"/>
<result property="currentAmount" column="current_amount"/>
<result property="variableAmount" column="variable_amount"/>
<result property="operationType" column="operation_type"/>
<result property="operationTime" column="operation_time"/>
<result property="isDelete" column="is_delete"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectGiftAmountLogVo">
select id,
consumer_id,
current_amount,
variable_amount,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_gift_amount_log
</sql>
<select id="selectGiftAmountLogList" parameterType="GiftAmountLogVo" resultMap="GiftAmountLogResult">
select b.id,
b.consumer_id,
c.nick_name,
c.phone,
c.avatar,
b.variable_amount,
b.current_amount,
b.operation_type,
b.operation_time,
b. is_delete,
b. create_by,
b. create_time,
b. update_by,
b.update_time,
b. remark
from s_gift_amount_log b join s_consumer c on b.consumer_id = c.id
<where>
<if test="nickName != null and nickName != ''">and c.nick_name like concat('%', #{nickName},'%')</if>
<if test="phone != null and phone != ''">and c.phone like concat('%', #{phone},'%')</if>
</where>
ORDER BY b.operation_time DESC
</select>
<select id="selectGiftAmountLogById" parameterType="Long" resultMap="GiftAmountLogResult">
<include refid="selectGiftAmountLogVo"/>
where id = #{id}
</select>
<insert id="insertGiftAmountLog" parameterType="GiftAmountLog" useGeneratedKeys="true" keyProperty="id">
insert into s_gift_amount_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consumerId != null">consumer_id,</if>
<if test="currentAmount != null">current_amount,</if>
<if test="variableAmount != null">variable_amount,</if>
<if test="operationType != null">operation_type,</if>
<if test="operationTime != null">operation_time,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if>
<if test="currentAmount != null">#{currentAmount},</if>
<if test="variableAmount != null">#{variableAmount},</if>
<if test="operationType != null">#{operationType},</if>
<if test="operationTime != null">#{operationTime},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateGiftAmountLog" parameterType="GiftAmountLog">
update s_gift_amount_log
<trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="currentAmount != null">current_amount = #{currentAmount},</if>
<if test="variableAmount != null">variable_amount = #{variableAmount},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="operationTime != null">operation_time = #{operationTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGiftAmountLogById" parameterType="Long">
delete
from s_gift_amount_log
where id = #{id}
</delete>
<delete id="deleteGiftAmountLogByIds" parameterType="String">
delete from s_gift_amount_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<result property="phone" column="phone"/> <result property="phone" column="phone"/>
<result property="useDuration" column="use_duration"/> <result property="useDuration" column="use_duration"/>
<result property="residueDuration" column="residue_duration"/> <result property="residueDuration" column="residue_duration"/>
<result property="operationType" column="operation_type"/>
<result property="operationTime" column="operation_time"/>
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
...@@ -30,6 +32,8 @@ ...@@ -30,6 +32,8 @@
phone, phone,
use_duration, use_duration,
residue_duration, residue_duration,
operation_type,
operation_time,
is_delete, is_delete,
create_by, create_by,
create_time, create_time,
...@@ -50,6 +54,8 @@ ...@@ -50,6 +54,8 @@
l.phone, l.phone,
l.use_duration, l.use_duration,
l.residue_duration, l.residue_duration,
l.operation_type,
l.operation_time,
l.is_delete, l.is_delete,
l.create_by, l.create_by,
l.create_time, l.create_time,
...@@ -65,6 +71,7 @@ ...@@ -65,6 +71,7 @@
<if test="phone != null and phone != ''">and l.phone = #{phone}</if> <if test="phone != null and phone != ''">and l.phone = #{phone}</if>
<if test="useDuration != null ">and l.use_duration = #{useDuration}</if> <if test="useDuration != null ">and l.use_duration = #{useDuration}</if>
<if test="residueDuration != null ">and l.residue_duration = #{residueDuration}</if> <if test="residueDuration != null ">and l.residue_duration = #{residueDuration}</if>
order by l.create_time
</select> </select>
<select id="selectMonthlyCardLogById" parameterType="Long" resultMap="MonthlyCardLogResult"> <select id="selectMonthlyCardLogById" parameterType="Long" resultMap="MonthlyCardLogResult">
...@@ -86,6 +93,8 @@ ...@@ -86,6 +93,8 @@
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="operationType != null">operation_type,</if>
<if test="operationTime != null">operation_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerMonthlyCardId != null">#{consumerMonthlyCardId},</if> <if test="consumerMonthlyCardId != null">#{consumerMonthlyCardId},</if>
...@@ -99,6 +108,8 @@ ...@@ -99,6 +108,8 @@
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="operationType != null">#{operationType},</if>
<if test="operationTime != null">#{operationTime},</if>
</trim> </trim>
</insert> </insert>
...@@ -116,6 +127,8 @@ ...@@ -116,6 +127,8 @@
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="operationTime != null">operation_time = #{operationTime},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.RechargeAmountLogMapper">
<resultMap type="RechargeAmountLogVo" id="RechargeAmountLogResult">
<result property="id" column="id"/>
<result property="consumerId" column="consumer_id"/>
<result property="nickName" column="nick_name"/>
<result property="phone" column="phone"/>
<result property="avatar" column="avatar"/>
<result property="currentAmount" column="current_amount"/>
<result property="variableAmount" column="variable_amount"/>
<result property="operationType" column="operation_type"/>
<result property="operationTime" column="operation_time"/>
<result property="isDelete" column="is_delete"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectRechargeAmountLogVo">
select id,
consumer_id,
current_amount,
variable_amount,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
update_by,
update_time,
remark
from s_recharge_amount_log
</sql>
<select id="selectRechargeAmountLogList" parameterType="RechargeAmountLogVo" resultMap="RechargeAmountLogResult">
select b.id,
b.consumer_id,
c.nick_name,
c.phone,
c.avatar,
b.variable_amount,
b.current_amount,
b.operation_type,
b.operation_time,
b. is_delete,
b. create_by,
b. create_time,
b. update_by,
b.update_time,
b. remark
from s_recharge_amount_log b join s_consumer c on b.consumer_id = c.id
<where>
<if test="nickName != null and nickName != ''">and c.nick_name like concat('%', #{nickName},'%')</if>
<if test="phone != null and phone != ''">and c.phone like concat('%', #{phone},'%')</if>
<if test="currentAmount != null ">and b.current_amount = #{currentAmount}</if>
<if test="variableAmount != null ">and b.variable_amount = #{variableAmount}</if>
</where>
ORDER BY b.operation_time DESC
</select>
<select id="selectRechargeAmountLogById" parameterType="Long" resultMap="RechargeAmountLogResult">
<include refid="selectRechargeAmountLogVo"/>
where id = #{id}
</select>
<insert id="insertRechargeAmountLog" parameterType="RechargeAmountLog" useGeneratedKeys="true" keyProperty="id">
insert into s_recharge_amount_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consumerId != null">consumer_id,</if>
<if test="currentAmount != null">current_amount,</if>
<if test="variableAmount != null">variable_amount,</if>
<if test="operationType != null">operation_type,</if>
<if test="operationTime != null">operation_time,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if>
<if test="currentAmount != null">#{currentAmount},</if>
<if test="variableAmount != null">#{variableAmount},</if>
<if test="operationType != null">#{operationType},</if>
<if test="operationTime != null">#{operationTime},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateRechargeAmountLog" parameterType="RechargeAmountLog">
update s_recharge_amount_log
<trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="currentAmount != null">current_amount = #{currentAmount},</if>
<if test="variableAmount != null">variable_amount = #{variableAmount},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="operationTime != null">operation_time = #{operationTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRechargeAmountLogById" parameterType="Long">
delete
from s_recharge_amount_log
where id = #{id}
</delete>
<delete id="deleteRechargeAmountLogByIds" parameterType="String">
delete from s_recharge_amount_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -21,9 +21,13 @@ ...@@ -21,9 +21,13 @@
<result property="packPrice" column="pack_price"/> <result property="packPrice" column="pack_price"/>
<result property="couponId" column="coupon_id"/> <result property="couponId" column="coupon_id"/>
<result property="couponPrice" column="coupon_price"/> <result property="couponPrice" column="coupon_price"/>
<result property="secondaryCardId" column="secondary_card_id"/>
<result property="monthlyCardId" column="monthly_card_id"/>
<result property="totalPrice" column="total_price"/> <result property="totalPrice" column="total_price"/>
<result property="duration" column="duration"/> <result property="duration" column="duration"/>
<result property="balance" column="balance"/> <result property="balance" column="balance"/>
<result property="rechargeAmount" column="recharge_amount"/>
<result property="giftAmount" column="gift_amount"/>
<result property="discountRatio" column="discount_ratio"/> <result property="discountRatio" column="discount_ratio"/>
<result property="payPrice" column="pay_price"/> <result property="payPrice" column="pay_price"/>
<result property="payTime" column="pay_time"/> <result property="payTime" column="pay_time"/>
...@@ -63,10 +67,14 @@ ...@@ -63,10 +67,14 @@
pack_price, pack_price,
coupon_id, coupon_id,
coupon_price, coupon_price,
secondary_card_id,
monthly_card_id,
total_price, total_price,
pay_price, pay_price,
duration, duration,
balance, balance,
recharge_amount,
gift_amount,
discount_ratio, discount_ratio,
pay_time, pay_time,
time_long, time_long,
...@@ -106,10 +114,14 @@ ...@@ -106,10 +114,14 @@
pack_price, pack_price,
coupon_id, coupon_id,
coupon_price, coupon_price,
secondary_card_id,
monthly_card_id,
total_price, total_price,
pay_price, pay_price,
duration, duration,
balance, balance,
recharge_amount,
gift_amount,
discount_ratio, discount_ratio,
pay_time, pay_time,
time_long, time_long,
...@@ -149,10 +161,14 @@ ...@@ -149,10 +161,14 @@
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if> <if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if> <if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if> <if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="secondaryCardId != null and secondaryCardId != ''">and secondary_card_id = #{secondaryCardId}</if>
<if test="monthlyCardId != null and monthlyCardId != ''">and monthly_card_id = #{monthlyCardId}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if> <if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if> <if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if> <if test="duration != null and duration != ''">and duration = #{duration}</if>
<if test="balance != null and balance != ''">and balance = #{balance}</if> <if test="balance != null and balance != ''">and balance = #{balance}</if>
<if test="rechargeAmount != null and rechargeAmount != ''">and recharge_amount = #{rechargeAmount}</if>
<if test="giftAmount != null and giftAmount !=''">and gift_amount = #{giftAmount}</if>
<if test="discountRatio != null and discountRatio != ''">and discount_ratio = #{discountRatio}</if> <if test="discountRatio != null and discountRatio != ''">and discount_ratio = #{discountRatio}</if>
<if test="startPayTime != null"> <if test="startPayTime != null">
and DATE_FORMAT(pay_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startPayTime}, '%Y-%m-%d') and DATE_FORMAT(pay_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startPayTime}, '%Y-%m-%d')
...@@ -225,11 +241,15 @@ ...@@ -225,11 +241,15 @@
s.consumer_phone, s.consumer_phone,
s.duration, s.duration,
s.balance, s.balance,
s.recharge_amount,
s.gift_amount,
s.discount_ratio, s.discount_ratio,
s.pack_id, s.pack_id,
s.pack_price, s.pack_price,
s.coupon_id, s.coupon_id,
s.coupon_price, s.coupon_price,
s.secondary_card_id,
s.monthly_card_id,
s.total_price, s.total_price,
s.pay_price, s.pay_price,
s.discount_ratio, s.discount_ratio,
...@@ -273,11 +293,15 @@ ...@@ -273,11 +293,15 @@
s.consumer_phone, s.consumer_phone,
s.duration, s.duration,
s.balance, s.balance,
s.recharge_amount,
s.gift_amount,
s.discount_ratio, s.discount_ratio,
s.pack_id, s.pack_id,
s.pack_price, s.pack_price,
s.coupon_id, s.coupon_id,
s.coupon_price, s.coupon_price,
s.secondary_card_id,
s.monthly_card_id,
s.total_price, s.total_price,
s.pay_price, s.pay_price,
s.discount_ratio, s.discount_ratio,
...@@ -339,6 +363,8 @@ ...@@ -339,6 +363,8 @@
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if> <if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if> <if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if> <if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="secondaryCardId != null and secondaryCardId != ''">and secondary_card_id = #{secondaryCardId}</if>
<if test="monthlyCardId != null and monthlyCardId != ''">and monthly_card_id = #{monthlyCardId}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if> <if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if> <if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if> <if test="duration != null and duration != ''">and duration = #{duration}</if>
...@@ -401,6 +427,8 @@ ...@@ -401,6 +427,8 @@
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if> <if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if> <if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if> <if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="secondaryCardId != null and secondaryCardId != ''">and secondary_card_id = #{secondaryCardId}</if>
<if test="monthlyCardId != null and monthlyCardId != ''">and monthly_card_id = #{monthlyCardId}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if> <if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if> <if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if> <if test="duration != null and duration != ''">and duration = #{duration}</if>
...@@ -480,6 +508,10 @@ ...@@ -480,6 +508,10 @@
<if test="discountRatio != null and discountRatio != ''">discount_ratio,</if> <if test="discountRatio != null and discountRatio != ''">discount_ratio,</if>
<if test="duration != null and duration != ''">duration,</if> <if test="duration != null and duration != ''">duration,</if>
<if test="balance != null and balance != '' ">balance,</if> <if test="balance != null and balance != '' ">balance,</if>
<if test="rechargeAmount != null and rechargeAmount != ''">recharge_amount,</if>
<if test="giftAmount != null and giftAmount != ''">gift_amount,</if>
<if test="secondaryCardId != null and secondaryCardId != ''">secondary_card_id,</if>
<if test="monthlyCardId != null and monthlyCardId != ''">monthly_card_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNo != null">#{orderNo},</if> <if test="orderNo != null">#{orderNo},</if>
...@@ -517,6 +549,10 @@ ...@@ -517,6 +549,10 @@
<if test="discountRatio != null">#{discountRatio},</if> <if test="discountRatio != null">#{discountRatio},</if>
<if test="duration != null">#{duration},</if> <if test="duration != null">#{duration},</if>
<if test="balance != null">#{balance},</if> <if test="balance != null">#{balance},</if>
<if test="rechargeAmount != null">#{rechargeAmount},</if>
<if test="giftAmount != null">#{giftAmount},</if>
<if test="secondaryCardId != null">#{secondary_card_id},</if>
<if test="monthlyCardId != null">#{monthly_card_id},</if>
</trim> </trim>
</insert> </insert>
...@@ -559,6 +595,10 @@ ...@@ -559,6 +595,10 @@
<if test="discountRatio != null">discount_ratio = #{discountRatio},</if> <if test="discountRatio != null">discount_ratio = #{discountRatio},</if>
<if test="duration != null">duration = #{duration},</if> <if test="duration != null">duration = #{duration},</if>
<if test="balance != null">balance = #{balance},</if> <if test="balance != null">balance = #{balance},</if>
<if test="rechargeAmount != null">recharge_amount = #{rechargeAmount},</if>
<if test="giftAmount != null">gift_amount = #{giftAmount},</if>
<if test="monthlyCardId != null">monthly_card_id = #{monthlyCardId},</if>
<if test="secondaryCardId != null">secondary_card_id = #{secondaryCardId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
<result property="packPrice" column="pack_price"/> <result property="packPrice" column="pack_price"/>
<result property="usageCount" column="usage_count"/> <result property="usageCount" column="usage_count"/>
<result property="residueCount" column="residue_count"/> <result property="residueCount" column="residue_count"/>
<result property="operationType" column="operation_type"/>
<result property="operationTime" column="operation_time"/>
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
...@@ -34,6 +36,8 @@ ...@@ -34,6 +36,8 @@
pack_id, pack_id,
usage_count, usage_count,
residue_count, residue_count,
operation_type,
operation_time,
is_delete, is_delete,
create_by, create_by,
create_time, create_time,
...@@ -57,6 +61,8 @@ ...@@ -57,6 +61,8 @@
p.price as 'pack_price', p.price as 'pack_price',
l.usage_count, l.usage_count,
l.residue_count, l.residue_count,
l.operation_type,
l.operation_time,
l.is_delete, l.is_delete,
l.create_by, l.create_by,
l.create_time, l.create_time,
...@@ -74,6 +80,7 @@ ...@@ -74,6 +80,7 @@
<if test="packId != null ">and l.pack_id = #{packId}</if> <if test="packId != null ">and l.pack_id = #{packId}</if>
<if test="usageCount != null ">and l.usage_count = #{usageCount}</if> <if test="usageCount != null ">and l.usage_count = #{usageCount}</if>
<if test="residueCount != null ">and l.residue_count = #{residueCount}</if> <if test="residueCount != null ">and l.residue_count = #{residueCount}</if>
order by l.create_time
</select> </select>
<select id="selectSecondaryCardLogById" parameterType="Long" resultMap="SecondaryCardLogResult"> <select id="selectSecondaryCardLogById" parameterType="Long" resultMap="SecondaryCardLogResult">
...@@ -96,6 +103,8 @@ ...@@ -96,6 +103,8 @@
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="operationType != null">operation_type,</if>
<if test="operationTime != null">operation_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerSecondaryCardId != null">#{consumerSecondaryCardId},</if> <if test="consumerSecondaryCardId != null">#{consumerSecondaryCardId},</if>
...@@ -110,6 +119,8 @@ ...@@ -110,6 +119,8 @@
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="operationType != null">#{operationType},</if>
<if test="operationTime != null">#{operationTime},</if>
</trim> </trim>
</insert> </insert>
...@@ -128,6 +139,8 @@ ...@@ -128,6 +139,8 @@
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="operationTime != null">operation_time = #{operationTime},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment