Commit ad1a5cdc by 吕明尚

Merge branch 'test'

parents dea1ce7b 3aedc4f8
......@@ -89,4 +89,12 @@ public class ConsumerWalletController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(consumerWalletService.deleteConsumerWalletByIds(ids));
}
/**
* 赠送时长
*/
@PostMapping("/giveDuration")
public AjaxResult giveDuration(@RequestBody ConsumerWallet consumerWallet) {
return toAjax(consumerWalletService.giveDuration(consumerWallet));
}
}
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));
}
}
......@@ -41,7 +41,7 @@ public class SOrderController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:order:list')")
@GetMapping("/list")
public TableDataInfoVo list(SOrder sOrder)
public TableDataInfoVo list(SOrderVo sOrder)
{
startPage();
List<SOrder> list = sOrderService.selectSOrderList(sOrder);
......@@ -71,7 +71,7 @@ public class SOrderController extends BaseController
@PreAuthorize("@ss.hasPermi('system:order:export')")
@Log(title = "订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SOrder sOrder)
public void export(HttpServletResponse response, SOrderVo sOrder)
{
List<SOrderVo> list = sOrderService.exportList(sOrder);
ExcelUtil<SOrderVo> util = new ExcelUtil<SOrderVo>(SOrderVo.class);
......
......@@ -76,6 +76,7 @@ public class SRoomController extends BaseController
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sRoomService.selectSRoomById(id));
}
......
......@@ -10,7 +10,6 @@ import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.SecondaryCardConf;
import share.system.domain.vo.SecondaryCardConfVo;
import share.system.service.SecondaryCardConfService;
import javax.servlet.http.HttpServletResponse;
......@@ -33,9 +32,9 @@ public class SecondaryCardConfController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:secondaryCardConf:list')")
@GetMapping("/list")
public TableDataInfo list(SecondaryCardConfVo secondaryCardConf) {
public TableDataInfo list(SecondaryCardConf secondaryCardConf) {
startPage();
List<SecondaryCardConfVo> list = secondaryCardConfService.selectSecondaryCardConfList(secondaryCardConf);
List<SecondaryCardConf> list = secondaryCardConfService.selectSecondaryCardConfList(secondaryCardConf);
return getDataTable(list);
}
......@@ -45,9 +44,9 @@ public class SecondaryCardConfController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:secondaryCardConf:export')")
@Log(title = "次卡配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SecondaryCardConfVo secondaryCardConf) {
List<SecondaryCardConfVo> list = secondaryCardConfService.selectSecondaryCardConfList(secondaryCardConf);
ExcelUtil<SecondaryCardConfVo> util = new ExcelUtil<SecondaryCardConfVo>(SecondaryCardConfVo.class);
public void export(HttpServletResponse response, SecondaryCardConf secondaryCardConf) {
List<SecondaryCardConf> list = secondaryCardConfService.selectSecondaryCardConfList(secondaryCardConf);
ExcelUtil<SecondaryCardConf> util = new ExcelUtil<SecondaryCardConf>(SecondaryCardConf.class);
util.exportExcel(response, list, "次卡配置数据");
}
......
......@@ -176,6 +176,7 @@
<artifactId>xstream</artifactId>
<version>1.4.9</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -13,7 +13,9 @@ public enum ReceiptRdeisEnum {
//房间15分钟过期
ROOM_EXPIRE_TIME(9, "ROOM_EXPIRE_TIME."),
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.")
;
......
package share.common.utils;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Objects;
/**
* @ClassName RedisLockUtil
* @Description 使用redis做锁
* @Author Wangyujie
* @Version V1.1.0
*/
@Component
public class RedisLockUtil {
@Resource
RedisTemplate<String, Object> redisTemplate;
/**
* 获取锁Key
*
* @param prefix 前缀
* @param name 名称
* @return
*/
public static String getFullKey(String prefix, String name) {
return prefix + "_" + name;
}
/**
* 获取锁,true 则得到锁,false 已被锁定
*
* @param lockName 锁名称
* @param lockExoire 锁时间毫秒
* @return
*/
public Boolean getLock(String lockName, Integer lockExoire) {
return (Boolean) redisTemplate.execute((RedisCallback<?>) connection -> {
// 获取时间毫秒值
long expireAt = System.currentTimeMillis() + lockExoire + 1;
// 获取锁
Boolean acquire = connection.setNX(lockName.getBytes(), String.valueOf(expireAt).getBytes());
if (acquire) {
return true;
} else {
byte[] bytes = connection.get(lockName.getBytes());
// 非空判断
if (Objects.nonNull(bytes) && bytes.length > 0) {
long expireTime = Long.parseLong(new String(bytes));
// 如果锁已经过期
if (expireTime < System.currentTimeMillis()) {
// 重新加锁,防止死锁
byte[] set = connection.getSet(lockName.getBytes(),
String.valueOf(System.currentTimeMillis() + lockExoire + 1).getBytes());
return Long.parseLong(new String(set)) < System.currentTimeMillis();
}
}
}
return false;
});
}
/**
* 删除锁
*
* @param lockName
*/
public void delLock(String lockName) {
redisTemplate.delete(lockName);
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.system.domain.vo.ConsumerMonthlyCardVo;
import share.system.request.MonthlyCardRequest;
import share.system.service.ConsumerMonthlyCardService;
import java.util.List;
......@@ -39,4 +39,11 @@ public class ConsumerMonthlyCardController extends BaseController {
public AjaxResult selectByConsumerId() {
return success(consumerMonthlyCardService.selectByConsumerId());
}
//查询可用卡类
@PostMapping("/queryCardType")
public AjaxResult queryCardType(@RequestBody @Validated MonthlyCardRequest monthlyCardRequest) {
return success(consumerMonthlyCardService.queryCardType(monthlyCardRequest));
}
}
......@@ -35,8 +35,8 @@ public class ConsumerSecondaryCardController extends BaseController {
}
@GetMapping("/query")
public AjaxResult selectByConsumerId() {
return success(consumerSecondaryCardService.selectByConsumerId());
public AjaxResult selectByConsumerId(Long packId) {
return success(consumerSecondaryCardService.selectByPaclId(packId));
}
}
......@@ -5,8 +5,9 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController;
import share.common.core.domain.R;
import share.common.core.page.TableDataInfo;
import share.system.domain.vo.SecondaryCardConfVo;
import share.system.domain.SecondaryCardConf;
import share.system.service.SecondaryCardConfService;
import java.util.List;
......@@ -27,10 +28,18 @@ public class SecondaryCardConfController extends BaseController {
* 查询次卡配置列表
*/
@GetMapping("/list")
public TableDataInfo list(SecondaryCardConfVo secondaryCardConf) {
public TableDataInfo list(SecondaryCardConf secondaryCardConf) {
startPage();
List<SecondaryCardConfVo> list = secondaryCardConfService.selectSecondaryCardConfList(secondaryCardConf);
List<SecondaryCardConf> list = secondaryCardConfService.selectSecondaryCardConfList(secondaryCardConf);
return getDataTable(list);
}
/**
* 查询次卡配置列表
*/
@GetMapping("/query")
public R<List<SecondaryCardConf>> query() {
return R.ok(secondaryCardConfService.selectSecondaryCardConfList(null));
}
}
......@@ -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.tuangou.entity.TuangouReceiptGetConsumedReponseEntity;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -33,7 +32,6 @@ import share.system.domain.vo.MqttxVo;
import share.system.service.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
......@@ -116,6 +114,12 @@ public class RedisTask {
@Autowired
private EquityFundExcessService equityFundExcessService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
//15分钟的常量
final long FIFTEEN_MINUTES = 60 * 15;
......@@ -780,4 +784,42 @@ public class RedisTask {
});
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;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
......@@ -10,6 +8,7 @@ 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;
/**
......@@ -51,7 +50,7 @@ public class ConsumerMonthlyCard extends BaseEntity {
* 免费时长
*/
@Excel(name = "免费时长")
private Long freeDuration;
private BigDecimal freeDuration;
/**
* 月卡天数
......@@ -69,7 +68,10 @@ public class ConsumerMonthlyCard extends BaseEntity {
/**
* 删除标记:1-删除,0-正常
*/
private Long isDelete;
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Integer isDelete;
@Override
......
......@@ -3,11 +3,10 @@ package share.system.domain;
import com.baomidou.mybatisplus.annotation.*;
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;
/**
......@@ -46,16 +45,16 @@ public class ConsumerSecondaryCard extends BaseEntity {
private String phone;
/**
* 套餐id
* 单次时长
*/
@Excel(name = "套餐id")
private Long packId;
@Excel(name = "单次时长")
private Integer singleDuration;
// /**
// * 次卡有效期
// */
// @Excel(name = "次卡有效期")
// private Long validityPeriod;
/**
* 单次金额
*/
@Excel(name = "单次金额")
private BigDecimal singleAmount;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "次卡有效期", width = 30, dateFormat = "yyyy-MM-dd")
......@@ -75,23 +74,4 @@ public class ConsumerSecondaryCard extends BaseEntity {
@TableField(select = false)
private Integer isDelete;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("secondaryCardConfId", getSecondaryCardConfId())
.append("consumerId", getConsumerId())
.append("phone", getPhone())
.append("packId", getPackId())
.append("expirationDate", getExpirationDate())
.append("number", getNumber())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
......@@ -39,6 +39,18 @@ public class ConsumerWallet extends BaseEntity {
private BigDecimal balance;
/**
* 充值金额
*/
@Excel(name = "充值金额")
private BigDecimal rechargeAmount;
/**
* 赠送金额
*/
@Excel(name = "赠送金额")
private BigDecimal giftAmount;
/**
* 时长
*/
@Excel(name = "时长")
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
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
@TableName(value = "s_gift_amount_log")
public class GiftAmountLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(type = IdType.AUTO)
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 HH:mm:ss")
@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 {
* 免费时长
*/
@Excel(name = "免费时长")
private Long freeDuration;
private BigDecimal freeDuration;
/**
* 月卡天数
......
......@@ -3,12 +3,16 @@ package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
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_monthly_card_log
*
......@@ -47,13 +51,27 @@ public class MonthlyCardLog extends BaseEntity {
* 使用时长
*/
@Excel(name = "使用时长")
private Long useDuration;
private BigDecimal useDuration;
/**
* 剩余时长
*/
@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-正常
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
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
@TableName(value = "s_recharge_amount_log")
public class RechargeAmountLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 用户id
*/
@Excel(name = "用户id")
private Long consumerId;
@Excel(name = "门店ID")
private Long storeId;
@Excel(name = "房间ID")
private Long roomId;
@Excel(name = "是否消费", dictType = "store_is_use_coupon")
private Integer isConsumption;
/**
* 当前金额
*/
@Excel(name = "当前金额")
private BigDecimal currentAmount;
/**
* 变动金额
*/
@Excel(name = "变动金额")
private BigDecimal variableAmount;
/**
* 操作类型
*/
@Excel(name = "操作类型")
private Integer operationType;
/**
* 操作时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operationTime;
/**
* 是否删除
*/
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Long isDelete;
}
package share.system.domain;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 保洁记录对象 s_clean_records
*
* @author ruoyi
* @date 2023-09-28
*/
@Data
public class SCleanRecords extends BaseEntity
{
private static final long serialVersionUID = 1L;
......@@ -25,12 +25,40 @@ public class SCleanRecords extends BaseEntity
@TableId(type = IdType.AUTO)
private Long id;
/**
* 门店名称
*/
@Excel(name = "门店名称")
@TableField(exist = false)
private String storeName;
/** 门店ID */
private Long storeId;
/**
* 房间名称
*/
@Excel(name = "房间名称")
@TableField(exist = false)
private String roomName;
/** 房间ID */
private Long roomId;
/**
* 保洁员姓名
*/
@Excel(name = "保洁员姓名")
@TableField(exist = false)
private String cleanName;
/**
* 保洁员手机号
*/
@Excel(name = "保洁员手机号")
@TableField(exist = false)
private String phone;
/** 保洁人员ID */
private Long consumerId;
......@@ -40,7 +68,7 @@ public class SCleanRecords extends BaseEntity
private Date startDate;
/** 保洁前照片 */
@Excel(name = "保洁前照片")
// @Excel(name = "保洁前照片")
private String startImage;
/** 结束时间 */
......@@ -48,35 +76,29 @@ public class SCleanRecords extends BaseEntity
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endDate;
/**
* 下单开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@TableField(select = false)
private Date startTime;
/**
* 下单结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@TableField(select = false)
private Date endTime;
/** 保洁后照片 */
@Excel(name = "保洁后照片")
// @Excel(name = "保洁后照片")
private String endImage;
/** 保洁状态:0:未保洁,1:保洁中,2:已保洁 */
@Excel(name = "保洁状态")
@Excel(name = "保洁状态", dictType = "clean_records_status")
private Integer status;
/**
* 门店名称
*/
@TableField(exist = false)
private String storeName;
/**
* 房间名称
*/
@TableField(exist = false)
private String roomName;
/**
* 保洁员姓名
*/
@TableField(exist = false)
private String cleanName;
/**
* 保洁员手机号
*/
@TableField(exist = false)
private String phone;
@TableField(exist = false)
private SRoom sRoom;
......@@ -84,152 +106,4 @@ public class SCleanRecords extends BaseEntity
@TableField(exist = false)
private SStore sStore;
public SRoom getsRoom() {
return sRoom;
}
public void setsRoom(SRoom sRoom) {
this.sRoom = sRoom;
}
public SStore getsStore() {
return sStore;
}
public void setsStore(SStore sStore) {
this.sStore = sStore;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setRoomId(Long roomId)
{
this.roomId = roomId;
}
public Long getRoomId()
{
return roomId;
}
public void setConsumerId(Long consumerId)
{
this.consumerId = consumerId;
}
public Long getConsumerId()
{
return consumerId;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public Date getStartDate()
{
return startDate;
}
public void setStartImage(String startImage)
{
this.startImage = startImage;
}
public String getStartImage()
{
return startImage;
}
public void setEndDate(Date endDate)
{
this.endDate = endDate;
}
public Date getEndDate()
{
return endDate;
}
public void setEndImage(String endImage)
{
this.endImage = endImage;
}
public String getEndImage()
{
return endImage;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public Long getStoreId() {
return storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getCleanName() {
return cleanName;
}
public void setCleanName(String cleanName) {
this.cleanName = cleanName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("storeId", getStoreId())
.append("roomId", getRoomId())
.append("consumerId", getConsumerId())
.append("startDate", getStartDate())
.append("startImage", getStartImage())
.append("endDate", getEndDate())
.append("endImage", getEndImage())
.append("status", getStatus())
.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
@Excel(name = "优惠券金额")
private BigDecimal couponPrice;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "订单总价")
private BigDecimal totalPrice;
......@@ -99,6 +105,12 @@ public class SOrder extends BaseEntity
@Excel(name = "使用余额")
private BigDecimal balance;
@Excel(name = "充值金额")
private BigDecimal rechargeAmount;
@Excel(name = "赠送金额")
private BigDecimal giftAmount;
@Excel(name = "优惠比例")
private BigDecimal discountRatio;
......
......@@ -129,4 +129,8 @@ public class SRoom extends BaseEntity
@TableField(exist = false)
private Integer queryNotRoomStat;
/** 房间类型文本录入 */
@Excel(name = "房间类型文本录入")
private String textInput;
}
......@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
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;
......@@ -40,10 +38,16 @@ public class SecondaryCardConf extends BaseEntity {
private BigDecimal secondaryCardAmount;
/**
* 套餐id
* 单次时长
*/
@Excel(name = "套餐id")
private Long packId;
@Excel(name = "单次时长")
private Integer singleDuration;
/**
* 单次金额
*/
@Excel(name = "单次金额")
private BigDecimal singleAmount;
/**
* 次卡有效期
......@@ -66,21 +70,4 @@ public class SecondaryCardConf extends BaseEntity {
private Long isDelete;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("secondaryCardAmount", getSecondaryCardAmount())
.append("packId", getPackId())
.append("validityPeriod", getValidityPeriod())
.append("number", getNumber())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
......@@ -3,12 +3,15 @@ package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
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.util.Date;
/**
* 次卡使用记录对象 s_secondary_card_log
*
......@@ -43,11 +46,6 @@ public class SecondaryCardLog extends BaseEntity {
@Excel(name = "用户手机号")
private String phone;
/**
* 套餐id
*/
@Excel(name = "套餐id")
private Long packId;
/**
* 使用次数
......@@ -62,6 +60,20 @@ public class SecondaryCardLog extends BaseEntity {
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-正常
*/
//逻辑删除注解(0 未删除 1 已删除)
......@@ -77,7 +89,6 @@ public class SecondaryCardLog extends BaseEntity {
.append("consumerSecondaryCardId", getConsumerSecondaryCardId())
.append("consumerId", getConsumerId())
.append("phone", getPhone())
.append("packId", getPackId())
.append("usageCount", getUsageCount())
.append("residueCount", getResidueCount())
.append("isDelete", getIsDelete())
......
......@@ -11,12 +11,12 @@ public class ConsumerSecondaryCardVo extends ConsumerSecondaryCard {
private String nickName;
//用户头像
private String avatar;
//套餐名称
private String packName;
//套餐金额
private BigDecimal packPrice;
//配置名称
private String confName;
//次卡金额
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;
}
......@@ -130,6 +130,10 @@ public class OrderVo {
private BigDecimal balance;
private BigDecimal rechargeAmount;
private BigDecimal giftAmount;
private BigDecimal discountRatio;
......
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.RechargeAmountLog;
@Data
public class RechargeAmountLogVo extends RechargeAmountLog {
private String storeName;
private String roomName;
private String nickName;
private String avatar;
private String phone;
}
......@@ -2,9 +2,10 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerMember;
import share.system.domain.ConsumerWallet;
import share.system.domain.SConsumer;
import java.util.List;
/**
* @className: share.system.domain.vo.SConsumerVo
* @description: 会员
......@@ -46,7 +47,8 @@ public class SConsumerVo extends SConsumer {
private Long newId;
private List<ConsumerMonthlyCardVo> monthlyCardList;
private List<ConsumerSecondaryCardVo> secondaryCardList;
}
......@@ -119,6 +119,12 @@ public class SOrderVo
@Excel(name = "使用余额")
private BigDecimal balance;
@Excel(name = "充值金额")
private BigDecimal rechargeAmount;
@Excel(name = "赠送金额")
private BigDecimal giftAmount;
@ApiModelProperty(value = "优惠比例")
@Excel(name = "优惠比例")
private BigDecimal discountRatio;
......@@ -276,4 +282,27 @@ public class SOrderVo
//是否可以申请退款
@ApiModelProperty(name = "是否可以申请退款")
private Boolean isRefund;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "历史订单号")
private String historicalOrderNo;
/**
* 支付开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@TableField(select = false)
private Date startPayTime;
/**
* 支付结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@TableField(select = false)
private Date endPayTime;
}
......@@ -164,6 +164,10 @@ public class SRoomVo extends BaseEntity
*/
private Integer orderType;
/** 房间类型文本录入 */
@Excel(name = "房间类型文本录入")
private String textInput;
@Override
public String toString() {
......
......@@ -76,7 +76,7 @@ public class SStoreVo extends BaseEntity
private String storeType;
@ApiModelProperty(value = "距离(KM)")
private String distance;
private Double distance;
@ApiModelProperty(value = "房间列表")
private List<SRoomVo> roomVoList;
......
......@@ -11,10 +11,7 @@ public class SecondaryCardLogVo extends SecondaryCardLog {
private String nickName;
//用户头像
private String avatar;
//套餐名称
private String packName;
//套餐金额
private BigDecimal packPrice;
//配置名称
private String confName;
//次卡金额
......
......@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardMapper extends BaseMapper<ConsumerMonthlyCar
*/
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);
}
......@@ -2,6 +2,7 @@ package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SOrder;
import share.system.domain.vo.SOrderVo;
import java.util.HashMap;
import java.util.List;
......@@ -28,7 +29,7 @@ public interface SOrderMapper extends BaseMapper<SOrder>
* @param sOrder 订单
* @return 订单集合
*/
public List<SOrder> selectSOrderList(SOrder sOrder);
public List<SOrder> selectSOrderList(SOrderVo sOrder);
/**
* 新增订单
......@@ -72,7 +73,7 @@ public interface SOrderMapper extends BaseMapper<SOrder>
List<SOrder> selectSOrderByStoreIdAndMaxTime(SOrder order);
HashMap<String, Object> sumPrice(SOrder sOrder);
HashMap<String, Object> sumPrice(SOrderVo sOrder);
List<Long> couponIds(SOrder sOrder);
List<Long> couponIds(SOrderVo sOrder);
}
......@@ -2,7 +2,6 @@ package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SecondaryCardConf;
import share.system.domain.vo.SecondaryCardConfVo;
import java.util.List;
......@@ -27,7 +26,7 @@ public interface SecondaryCardConfMapper extends BaseMapper<SecondaryCardConf> {
* @param secondaryCardConf 次卡配置
* @return 次卡配置集合
*/
public List<SecondaryCardConfVo> selectSecondaryCardConfList(SecondaryCardConfVo secondaryCardConf);
public List<SecondaryCardConf> selectSecondaryCardConfList(SecondaryCardConf secondaryCardConf);
/**
* 新增次卡配置
......
......@@ -89,4 +89,12 @@ public class CreateOrderRequest {
@ApiModelProperty(value = "使用时长")
private BigDecimal duration;
//次卡ID
@ApiModelProperty(value = "次卡ID")
private Long secondaryCardId;
//月卡ID
@ApiModelProperty(value = "月卡ID")
private Long monthlyCardId;
}
package share.system.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "MonthlyCardRequest对象", description = "查询可用次卡对象")
public class MonthlyCardRequest {
@ApiModelProperty(value = "门店ID", required = true)
@NotNull(message = "门店ID不能为空")
private Long storeId;
@ApiModelProperty(value = "房间ID", required = true)
@NotNull(message = "房间ID不能为空")
private Long roomId;
@ApiModelProperty(value = "套餐ID")
private Long packId;
@ApiModelProperty(value = "标签id")
private Long roomLabelId;
}
......@@ -54,4 +54,12 @@ public class OrderComputedPriceRequest {
@ApiModelProperty(value = "标签id")
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 {
@ApiModelProperty(value = "剩余余额")
private BigDecimal remainingBalance;
//次卡ID
@ApiModelProperty(value = "次卡ID")
private Long secondaryCardId;
//月卡ID
@ApiModelProperty(value = "月卡ID")
private Long monthlyCardId;
}
......@@ -26,9 +26,9 @@ public class OrderStatisticsResponse {
private BigDecimal platformFee = BigDecimal.ZERO;
//平台退款
private BigDecimal platformRefundFee = BigDecimal.ZERO;
//用户充值
//赠送余额消费
private BigDecimal rechargeFee = BigDecimal.ZERO;
//用户充值退款
//赠送余额退款
private BigDecimal rechargeRefundFee = BigDecimal.ZERO;
//充值余额支付
private BigDecimal rechargeBalance = BigDecimal.ZERO;
......
......@@ -3,8 +3,10 @@ package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.ConsumerMonthlyCard;
import share.system.domain.vo.ConsumerMonthlyCardVo;
import share.system.request.MonthlyCardRequest;
import java.util.List;
import java.util.Map;
/**
* 用户月卡Service接口
......@@ -61,5 +63,7 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard
*/
public int deleteConsumerMonthlyCardById(Long id);
ConsumerMonthlyCardVo selectByConsumerId();
List<ConsumerMonthlyCardVo> selectByConsumerId();
Map<String, List<Long>> queryCardType(MonthlyCardRequest monthlyCardRequest);
}
......@@ -62,4 +62,6 @@ public interface ConsumerSecondaryCardService extends IService<ConsumerSecondary
public int deleteConsumerSecondaryCardById(Long id);
List<ConsumerSecondaryCardVo> selectByConsumerId();
List<ConsumerSecondaryCardVo> selectByPaclId(Long packId);
}
......@@ -70,4 +70,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> {
boolean editConsumerWallet(ConsumerWallet consumerWallet, Recharge recharge, ConsumerMember one);
void accumulatedConsumptionStatistics(Long consumerId);
int giveDuration(ConsumerWallet consumerWallet);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.ConsumerMember;
import share.system.domain.ConsumerWallet;
import share.system.domain.EquityMembersOrder;
import share.system.domain.vo.EquityMembersOrderVo;
import share.system.request.CreateEquityMembersRequest;
import share.system.response.EquityMembersResultResponse;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -74,4 +77,6 @@ public interface EquityMembersOrderService extends IService<EquityMembersOrder>
EquityMembersOrder getByEquityOrderNo(String equityOrderNo);
EquityMembersOrderVo queryEquityMembersOrderInfoByNo(String equityOrderNo);
void addConsumerMember(Long consumerId, BigDecimal giftPoints, ConsumerMember consumerMember, ConsumerWallet consumerWallet);
}
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);
}
......@@ -39,7 +39,7 @@ public interface ISOrderService extends IService<SOrder>
* @param sOrder 订单
* @return 订单集合
*/
public List<SOrder> selectSOrderList(SOrder sOrder);
public List<SOrder> selectSOrderList(SOrderVo sOrder);
/**
* 查询订单列表
......@@ -193,7 +193,7 @@ public interface ISOrderService extends IService<SOrder>
int modifyOrder(SOrderDto sOrderDto);
TableDataInfoVo pageList(TableDataInfo dataTable, SOrder sOrder);
TableDataInfoVo pageList(TableDataInfo dataTable, SOrderVo sOrder);
/**
* 订单退款(人工退款)
......@@ -209,7 +209,7 @@ public interface ISOrderService extends IService<SOrder>
Boolean changeRoom(SOrderDto dto);
List<SOrderVo> exportList(SOrder sOrder);
List<SOrderVo> exportList(SOrderVo sOrder);
List<SOrder> selectSOrderByMaxTime(SOrder orderQuery);
......@@ -217,7 +217,7 @@ public interface ISOrderService extends IService<SOrder>
OrderStatisticsResponse statistics(OrderStatisticsRequest request);
List<Long> couponIds(SOrder sOrder);
List<Long> couponIds(SOrderVo sOrder);
List<OrderVo> statisticsOrderList(OrderStatisticsRequest request);
}
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);
}
......@@ -2,7 +2,6 @@ package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SecondaryCardConf;
import share.system.domain.vo.SecondaryCardConfVo;
import java.util.List;
......@@ -27,7 +26,7 @@ public interface SecondaryCardConfService extends IService<SecondaryCardConf> {
* @param secondaryCardConf 次卡配置
* @return 次卡配置集合
*/
public List<SecondaryCardConfVo> selectSecondaryCardConfList(SecondaryCardConfVo secondaryCardConf);
public List<SecondaryCardConf> selectSecondaryCardConfList(SecondaryCardConf secondaryCardConf);
/**
* 新增次卡配置
......
package share.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import share.system.domain.ConsumerMonthlyCard;
import share.system.domain.SConsumer;
import share.system.domain.*;
import share.system.domain.vo.ConsumerMonthlyCardVo;
import share.system.mapper.ConsumerMonthlyCardMapper;
import share.system.service.ConsumerMonthlyCardService;
import share.system.service.SConsumerService;
import share.system.request.MonthlyCardRequest;
import share.system.service.*;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
/**
* 用户月卡Service业务层处理
......@@ -25,6 +30,16 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
private ConsumerMonthlyCardMapper consumerMonthlyCardMapper;
@Autowired
private SConsumerService sConsumerService;
@Autowired
private ConsumerMemberService consumerMemberService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private RoomLabelService roomLabelService;
@Autowired
private IPackService packService;
@Autowired
private ISRoomService roomService;
/**
* 查询用户月卡
......@@ -95,10 +110,86 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
}
@Override
public ConsumerMonthlyCardVo selectByConsumerId() {
public List<ConsumerMonthlyCardVo> selectByConsumerId() {
SConsumer info = sConsumerService.getInfo();
ConsumerMonthlyCardVo vo = new ConsumerMonthlyCardVo();
vo.setConsumerId(info.getId());
return consumerMonthlyCardMapper.selectByConsumerId(vo);
}
@Override
public Map<String, List<Long>> queryCardType(MonthlyCardRequest monthlyCardRequest) {
SConsumer user = sConsumerService.getInfo();
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()).eq(ConsumerMember::getIsRights
, YesNoEnum.yes.getIndex()));
ConsumerMonthlyCard consumerMonthlyCard = null;
List<ConsumerSecondaryCard> consumerSecondaryCard = null;
Map<String, List<Long>> map = new HashMap<>();
List<Long> consumerMonthlyCardList = new ArrayList<>();
List<Long> consumerSecondaryCardList = new ArrayList<>();
if (ObjectUtil.isNotEmpty(consumerMember)) {
SRoom room = roomService.getById(monthlyCardRequest.getRoomId());
consumerMonthlyCard = baseMapper.selectOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()));
consumerSecondaryCard = consumerSecondaryCardService.list(new LambdaQueryWrapper<ConsumerSecondaryCard>().eq(ConsumerSecondaryCard::getConsumerId, user.getId()).orderByAsc(ConsumerSecondaryCard::getNumber));
if (!ObjectUtils.isEmpty(monthlyCardRequest.getRoomLabelId())) {
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(monthlyCardRequest.getRoomLabelId());
if (ObjectUtils.isEmpty(roomLabel.getPackId())) {
//标签没绑定套餐
if (ObjectUtil.isNotEmpty(consumerMonthlyCard)) {
consumerMonthlyCardList.add(consumerMonthlyCard.getId());
map.put("consumerMonthlyCard", consumerMonthlyCardList);
}
if (CollectionUtil.isNotEmpty(consumerSecondaryCard)) {
//过滤时长相等的
consumerSecondaryCard.stream().forEach(item -> {
if (Objects.equals(item.getSingleDuration(), Integer.valueOf(roomLabel.getPromotionDuration()))
&& item.getSingleAmount().compareTo(new BigDecimal(roomLabel.getPromotionDuration()).multiply(room.getPrice())) >= 0) {
consumerSecondaryCardList.add(item.getId());
map.put("consumerSecondaryCard", consumerSecondaryCardList);
}
});
}
return map;
} else {
SPack byId = packService.getById(roomLabel.getPackId());
//标签绑定了套餐,套餐也开启了
if (!ObjectUtils.isEmpty(byId) && byId.getIsOpen().equals(YesNoEnum.yes.getIndex())) {
if (CollectionUtil.isNotEmpty(consumerSecondaryCard)) {
//过滤时长相等的
consumerSecondaryCard.stream().forEach(item -> {
if (Objects.equals(item.getSingleDuration(), Integer.valueOf(byId.getDuration()))
&& item.getSingleAmount().compareTo(byId.getPrice()) >= 0) {
consumerSecondaryCardList.add(item.getId());
map.put("consumerSecondaryCard", consumerSecondaryCardList);
}
});
}
return map;
//标签绑定了套餐,套餐没开启,小时
} else {
if (ObjectUtil.isNotEmpty(consumerMonthlyCard)) {
consumerMonthlyCardList.add(consumerMonthlyCard.getId());
map.put("consumerMonthlyCard", consumerMonthlyCardList);
}
return map;
}
}
} else if (!ObjectUtils.isEmpty(monthlyCardRequest.getPackId())) {
//通宵和早间套餐
SPack pack = packService.getById(monthlyCardRequest.getPackId());
if (CollectionUtil.isNotEmpty(consumerSecondaryCard)) {
//过滤时长相等的
consumerSecondaryCard.stream().forEach(item -> {
if (Objects.equals(item.getSingleDuration(), Integer.valueOf(pack.getDuration()))
&& item.getSingleAmount().compareTo(pack.getPrice()) >= 0) {
consumerSecondaryCardList.add(item.getId());
map.put("consumerSecondaryCard", consumerSecondaryCardList);
}
});
}
}
}
return new HashMap<>();
}
}
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
import share.system.domain.ConsumerSecondaryCard;
import share.system.domain.SConsumer;
import share.system.domain.SPack;
import share.system.domain.vo.ConsumerSecondaryCardVo;
import share.system.mapper.ConsumerSecondaryCardMapper;
import share.system.service.ConsumerSecondaryCardService;
import share.system.service.IPackService;
import share.system.service.SConsumerService;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 用户次卡Service业务层处理
......@@ -25,6 +32,8 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
private ConsumerSecondaryCardMapper consumerSecondaryCardMapper;
@Autowired
private SConsumerService sConsumerService;
@Autowired
private IPackService packService;
/**
* 查询用户次卡
......@@ -97,8 +106,32 @@ public class ConsumerSecondaryCardServiceImpl extends ServiceImpl<ConsumerSecond
@Override
public List<ConsumerSecondaryCardVo> selectByConsumerId() {
SConsumer info = sConsumerService.getInfo();
if (ObjectUtil.isNull(info)) {
throw new BaseException("您的登录已过期,请先登录");
}
ConsumerSecondaryCardVo vo = new ConsumerSecondaryCardVo();
vo.setConsumerId(info.getId());
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;
}
}
package share.system.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil;
import share.common.enums.*;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.*;
import share.system.domain.vo.EquityFundExcessVo;
import share.system.domain.vo.EquityFundLogVo;
import share.system.mapper.EquityFundExcessMapper;
import share.system.mapper.SConsumerMapper;
import share.system.service.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 权益金过度Service业务层处理
*
......@@ -254,6 +252,7 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
queryWrapper.eq(DurationLog::getDurationType, DurationTypeEnum.SHARE.getCode());
List<DurationLog> durationLogs = durationLogService.list(queryWrapper);
if (YesNoEnum.yes.getIndex().equals(sOrderList.size()) && YesNoEnum.no.getIndex().equals(durationLogs.size())) {
addNewConsumer(sOrder.getConsumerId());
LambdaQueryWrapper<ConsumerWallet> consumerWalletLambdaQueryWrapper = new LambdaQueryWrapper<>();
consumerWalletLambdaQueryWrapper.eq(ConsumerWallet::getConsumerId, sharingActivities.getUid());
ConsumerWallet consumerWallet = consumerWalletService.getOne(consumerWalletLambdaQueryWrapper);
......@@ -291,6 +290,7 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
newDurationLog.setVariableDuration(anHour);
newDurationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
newDurationLog.setOperationType(YesNoEnum.yes.getIndex());
newDurationLog.setDurationType(DurationTypeEnum.SHARE.getCode());
newDurationLog.setOperationTime(DateUtils.getNowDate());
durationLogService.insertDurationLog(newDurationLog);
}
......@@ -345,4 +345,30 @@ public class EquityFundExcessServiceImpl extends ServiceImpl<EquityFundExcessMap
}
}
}
private void addNewConsumer(Long consumerId) {
//新增用户为普通会员
ConsumerWallet wallet = new ConsumerWallet();
wallet.setConsumerId(consumerId);
wallet.setBalance(BigDecimal.ZERO);
wallet.setRechargeAmount(BigDecimal.ZERO);
wallet.setGiftAmount(BigDecimal.ZERO);
wallet.setRemainingDuration(BigDecimal.ZERO);
wallet.setRemainingIntegral(BigDecimal.ZERO);
wallet.setEquityFund(BigDecimal.ZERO);
wallet.setAccumulateEquityFund(BigDecimal.ZERO);
wallet.setCreateTime(new Date());
ConsumerMember consumerMember = new ConsumerMember();
consumerMember.setConsumerId(consumerId);
consumerMember.setMembershipLevel(0L);
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
consumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setIsRecharge(YesNoEnum.no.getIndex());
consumerMember.setIsRights(YesNoEnum.no.getIndex());
consumerMember.setCreateTime(new Date());
consumerWalletService.save(wallet);
consumerMemberService.save(consumerMember);
}
}
......@@ -216,18 +216,24 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, consumerMember.getExpirationDate())),
Integer.parseInt(expirationDateEquityMembership)));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember, consumerWallet, memberConfigServiceOne);
consumerMemberService.updateConsumerMember(consumerMember);
// extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember, consumerWallet, memberConfigServiceOne);
addConsumerMember(equityMembersOrder.getConsumerId(), equityMembersOrderConfig.getGiftPoints(), consumerMember, consumerWallet);
consumerMemberService.updateById(consumerMember);
logger.debug("权益会员原来的基础上增加有效期");
} else {
consumerMember.setIsRights(YesNoEnum.yes.getIndex());
//修改会员类型为权益会员
// consumerMember.setMemberType(MemberTypeEnum.RIGHTS.getIndex());
// consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
addConsumerMember(equityMembersOrder.getConsumerId(), equityMembersOrderConfig.getGiftPoints(), consumerMember, consumerWallet);
ConsumerMember newConsumerMember = new ConsumerMember();
newConsumerMember.setConsumerId(equityMembersOrder.getConsumerId());
newConsumerMember.setIsRights(YesNoEnum.yes.getIndex());
newConsumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
Integer.parseInt(expirationDateEquityMembership)));
consumerMember.setExpirationDate(DateUtils.addYears(DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, new Date())),
Integer.parseInt(expirationDateEquityMembership)));
extracted(equityMembersOrder, equityMembersOrderConfig, consumerMember, consumerWallet, memberConfigServiceOne);
consumerMemberService.updateConsumerMember(consumerMember);
newConsumerMember.setId(consumerMember.getId());
consumerMemberService.updateById(newConsumerMember);
if (consumerMember.getIsRights().equals(YesNoEnum.no.getIndex()) && consumerMember.getIsRecharge().equals(YesNoEnum.no.getIndex())) {
consumerWalletService.accumulatedConsumptionStatistics(equityMembersOrder.getConsumerId());
}
logger.debug("修改会员类型为权益会员");
}
Map<String, String> map = new HashMap<>();
......@@ -261,31 +267,35 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
updateEquityMembersOrder(equityMembersOrder);
}
private void extracted(EquityMembersOrder equityMembersOrder, EquityMembersOrderConfig equityMembersOrderConfig,
ConsumerMember consumerMember, ConsumerWallet consumerWallet, MemberConfig memberConfigServiceOne) {
@Override
public void addConsumerMember(Long consumerId, BigDecimal giftPoints,
ConsumerMember consumerMember, ConsumerWallet consumerWallet) {
logger.debug("积分新增,会员进度新增开始");
String expirationDateEquityMembership = sysConfigService.selectConfigByKey("expirationDateEquityMembership");
if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.ZERO) > 0) {
if (giftPoints.compareTo(BigDecimal.ZERO) > 0) {
MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog.setConsumerId(equityMembersOrder.getConsumerId());
memberProgressLog.setConsumerId(consumerId);
memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
consumerMember.setMembershipProgress(equityMembersOrderConfig.getGiftPoints().add(consumerMember.getMembershipProgress()));
memberProgressLog.setVariableProgress(equityMembersOrderConfig.getGiftPoints());
memberProgressLog.setVariableProgress(giftPoints);
memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLog.setOperationTime(new Date());
memberProgressLog.setCreateTime(new Date());
memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), Integer.parseInt(expirationDateEquityMembership)));
consumerMember.setMembershipProgress(giftPoints.add(consumerMember.getMembershipProgress()));
IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(equityMembersOrder.getConsumerId());
integralLog.setCurrentIntegral(consumerMember.getMembershipProgress());
consumerWallet.setRemainingIntegral(consumerWallet.getRemainingIntegral().add(equityMembersOrderConfig.getGiftPoints()));
integralLog.setVariableIntegral(equityMembersOrderConfig.getGiftPoints());
integralLog.setConsumerId(consumerId);
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
integralLog.setVariableIntegral(giftPoints);
integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setOperationTime(new Date());
integralLog.setCreateTime(new Date());
consumerWallet.setRemainingIntegral(consumerWallet.getRemainingIntegral().add(giftPoints));
integralLogService.save(integralLog);
memberProgressLogService.save(memberProgressLog);
consumerWalletService.updateById(consumerWallet);
consumerMemberService.updateById(consumerMember);
}
//查询当前会员类型和下一级的会员配置
MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
......@@ -296,8 +306,10 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
if (ObjectUtil.isNotEmpty(one) && consumerMember.getMembershipProgress().compareTo(BigDecimal.valueOf(one.getLimitRequirements())) >= 0) {
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
// consumerMember.setMemberConfigId(one.getId());
consumerMemberService.updateConsumerMember(consumerMember);
}
}
logger.debug("积分新增,会员进度新增结束");
}
@Override
public Boolean cancelPay(String equityOrderNo) {
......
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;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
import share.common.utils.DateUtils;
import share.common.utils.bean.BeanUtils;
import share.system.domain.ConsumerMonthlyCard;
import share.system.domain.MonthlyCardConf;
import share.system.domain.MonthlyCardOrder;
import share.system.domain.SConsumer;
import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.MonthlyCardOrderVo;
import share.system.mapper.MonthlyCardOrderMapper;
......@@ -24,7 +24,9 @@ import share.system.response.MonthlyyCardPayResultResponse;
import share.system.service.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 月卡订单Service业务层处理
......@@ -44,6 +46,14 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
private MonthlyCardConfService monthlyCardConfService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private ConsumerWalletService consumerWalletService;
@Autowired
private ConsumerMemberService consumerMemberService;
@Autowired
private EquityMembersOrderService equityMembersOrderService;
/**
* 查询月卡订单
......@@ -161,15 +171,30 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
public void paymentSuccessful(MonthlyCardOrder monthlyCardOrder) {
updateById(monthlyCardOrder);
ConsumerMonthlyCard consumerMonthlyCard = new ConsumerMonthlyCard();
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, monthlyCardOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, monthlyCardOrder.getConsumerId()));
MonthlyCardConf byId = monthlyCardConfService.getById(monthlyCardOrder.getMonthlyCardConfId());
consumerMonthlyCard.setMonthlyCardConfId(byId.getId());
consumerMonthlyCard.setConsumerId(monthlyCardOrder.getConsumerId());
consumerMonthlyCard.setPhone(monthlyCardOrder.getPhone());
consumerMonthlyCard.setExpirationDate(DateUtils.addYears(new Date(), byId.getMonthlyCardDays().intValue()));
consumerMonthlyCard.setExpirationDate(DateUtils.addDays(new Date(), byId.getMonthlyCardDays().intValue()));
consumerMonthlyCard.setFreeDuration(byId.getFreeDuration());
consumerMonthlyCard.setMonthlyCardDays(byId.getMonthlyCardDays());
consumerMonthlyCard.setCreateTime(new Date());
consumerMonthlyCardService.save(consumerMonthlyCard);
equityMembersOrderService.addConsumerMember(monthlyCardOrder.getConsumerId(), monthlyCardOrder.getMonthlyCardAmount(), consumerMember, consumerWallet);
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
......
......@@ -32,6 +32,7 @@ import share.common.core.redis.RedisUtil;
import share.common.enums.*;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
import share.common.utils.RedisLockUtil;
import share.system.domain.SConsumer;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SCoupon;
......@@ -77,6 +78,9 @@ public class QPServiceImpl implements QPService {
private RedisUtil redisUtil;
@Autowired
private RedisLockUtil redisLockUtil;
@Autowired
private ISStoreService storeService;
//默认门槛时长
......@@ -106,6 +110,8 @@ public class QPServiceImpl implements QPService {
if (ObjectUtil.isNull(user)) {
throw new BaseException("您的登录已过期,请先登录");
}
Boolean lock = redisLockUtil.getLock(String.valueOf(user.getId()), 1000);
if (lock) {
LambdaQueryWrapper<SStore> sStoreLambdaQueryWrapper = new LambdaQueryWrapper<>();
sStoreLambdaQueryWrapper.eq(SStore::getId, storeId);
SStore sStore = storeService.getOne(sStoreLambdaQueryWrapper);
......@@ -115,8 +121,6 @@ public class QPServiceImpl implements QPService {
if (StringUtils.isEmpty(sStore.getOpenShopUuid())) {
throw new Exception("门店未授权,请联系客服");
}
//验券准备
TuangouReceiptPrepareResponseEntity prepare = prepare(code.trim(), sStore.getOpenShopUuid(), status);
//查询领取记录表
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SConsumerCoupon::getCouponCode, code);
......@@ -126,6 +130,8 @@ public class QPServiceImpl implements QPService {
if (ObjectUtils.isNotEmpty(unUsedCoupon)) {
throw new Exception("该券码已被使用");
}
//验券准备
TuangouReceiptPrepareResponseEntity prepare = prepare(code.trim(), sStore.getOpenShopUuid(), status);
//根据优惠卷名称查询优惠劵配置 查询list,取第一个
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(user.getId());
......@@ -209,6 +215,8 @@ public class QPServiceImpl implements QPService {
qpService.consume(code.trim(), 1, sStore.getOpenShopUuid(), status);
return "验劵成功";
}
throw new RuntimeException("验劵失败");
}
@Override
public List<TuangouReceiptReverseConsumeResponseEntity> reverseconsumeByUser(Long id) {
......
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);
}
}
......@@ -175,19 +175,16 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
extracted(recharge);
} else {
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, recharge.getConsumerId()));
if (one.getIsRecharge().equals(YesNoEnum.yes.getIndex())) {
consumerWalletService.editConsumerWallet(consumerWallet, recharge, one);
} else if (one.getIsRights().equals(YesNoEnum.yes.getIndex())) {
if (ObjectUtil.isEmpty(consumerWallet)) {
extracted(recharge);
} else {
//修改会员钱包
consumerWalletService.editConsumerWallet(consumerWallet, recharge, one);
ConsumerMember consumerMember = new ConsumerMember();
consumerMember.setIsRecharge(YesNoEnum.yes.getIndex());
consumerMember.setId(one.getId());
consumerMemberService.updateConsumerMember(consumerMember);
if (one.getIsRecharge().equals(YesNoEnum.no.getIndex()) && one.getIsRights().equals(YesNoEnum.no.getIndex())) {
consumerWalletService.accumulatedConsumptionStatistics(recharge.getConsumerId());
}
}
one.setIsRecharge(YesNoEnum.yes.getIndex());
consumerMemberService.updateConsumerMember(one);
}
updateRecharge(recharge);
}
......@@ -223,9 +220,11 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
ConsumerWallet consumerWallet = new ConsumerWallet();
consumerWallet.setConsumerId(recharge.getConsumerId());
consumerWallet.setBalance(recharge.getRechargeAmount());
consumerWallet.setRechargeAmount(recharge.getRechargeAmount());
if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) {
BigDecimal balance = recharge.getRechargeAmount().add(rechargeConf.getGiveAmount());
consumerWallet.setBalance(balance);
consumerWallet.setGiftAmount(rechargeConf.getGiveAmount());
}
if (rechargeConf.getGiveType().contains(GiveTypeEnum.DURATION.getIndex())) {
consumerWallet.setRemainingDuration(rechargeConf.getGiveDuration());
......
......@@ -70,8 +70,8 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
if (sCleanRecords != null) {
SStore store = sStoreMapper.selectSStoreById(sCleanRecords.getStoreId());
SRoom room = sRoomMapper.selectSRoomById(sCleanRecords.getRoomId());
sCleanRecords.setsStore(store);
sCleanRecords.setsRoom(room);
sCleanRecords.setSStore(store);
sCleanRecords.setSRoom(room);
}
return sCleanRecords;
}
......@@ -251,12 +251,12 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
cleanRecordsList.forEach(item -> {
SStore store = storeMap.get(item.getStoreId());
if (store != null) {
item.setsStore(store);
item.setSStore(store);
item.setStoreName(store.getName());
}
SRoom room = roomMap.get(item.getRoomId());
if (room != null) {
item.setsRoom(room);
item.setSRoom(room);
item.setRoomName(room.getName());
}
});
......@@ -302,8 +302,8 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
}
//取创建时间最远的
SCleanRecords records = sCleanRecords.stream().min(Comparator.comparing(SCleanRecords::getCreateTime)).get();
records.setsRoom(sRoomMapper.selectById(records.getRoomId()));
records.setsStore(sStoreMapper.selectById(records.getStoreId()));
records.setSRoom(sRoomMapper.selectById(records.getRoomId()));
records.setSStore(sStoreMapper.selectById(records.getStoreId()));
return records;
}
......@@ -475,6 +475,11 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
// 断电
deviceOpService.openOrCloseDevice(records.getRoomId(), records.getPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_10.getCode());
} else {
SRoom room = new SRoom();
room.setId(records.getRoomId());
room.setStatus(RoomStatusEnum.HOLD.getValue());
roomService.updateById(room);
}
return index;
}
......
......@@ -25,7 +25,6 @@ import share.common.utils.DateUtils;
import share.common.utils.StringUtils;
import share.system.domain.*;
import share.system.domain.vo.*;
import share.system.mapper.ConsumerMemberMapper;
import share.system.mapper.SConsumerMapper;
import share.system.mapper.SStoreConsumerMapper;
import share.system.request.RegisterThirdSConsumerRequest;
......@@ -63,6 +62,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
private MemberConfigService memberConfigService;
@Autowired
private MemberProgressLogService memberProgressLogService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
......@@ -214,6 +217,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
BeanUtils.copyProperties(currentUser, vo);
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::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)) {
vo.setConsumerMember(consumerMember);
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
......@@ -277,9 +282,12 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
} else {
vo.setIsManage(true);
}
if (!CollectionUtils.isEmpty(consumerSecondaryCardVos)) {
vo.setSecondaryCardList(consumerSecondaryCardVos);
}
if (!CollectionUtils.isEmpty(consumerMonthlyCardVo)) {
vo.setMonthlyCardList(consumerMonthlyCardVo);
}
return vo;
}
......@@ -352,8 +360,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
public TableDataInfo selectConsumernotById(SConsumerVo sConsumer) {
List<ConsumerMember> consumerMembers = consumerMemberService
.list(new LambdaQueryWrapper<ConsumerMember>()
.eq(ConsumerMember::getIsRights,YesNoEnum.yes.getIndex())
.ne(ConsumerMember::getConsumerId,sConsumer.getNewId()));
.eq(ConsumerMember::getIsRights, YesNoEnum.yes.getIndex())
.ne(ConsumerMember::getConsumerId, sConsumer.getNewId()));
List<Long> collect = consumerMembers.stream().map(ConsumerMember::getConsumerId).collect(Collectors.toList());
LambdaQueryWrapper<SConsumer> uSConsumer = new LambdaQueryWrapper<SConsumer>();
if (StringUtils.isNotEmpty(sConsumer.getPhone())){
......
......@@ -27,6 +27,7 @@ import share.system.mapper.SStoreMapper;
import share.system.request.SStoreRequest;
import share.system.service.*;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -323,7 +324,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
double distance = geo.calcDistance(nowPoint, geo.makePoint(Double.parseDouble(o.getLongitude()), Double.parseDouble(o.getLatitude()))) * DistanceUtils.DEG_TO_KM;
SStoreVo vo = new SStoreVo();
BeanUtils.copyProperties(o, vo);
vo.setDistance(distance + "");
//截取2位小数
vo.setDistance(new BigDecimal(distance).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
// 计算当天预定最后预定时间
SOrder order = orderMap.get(vo.getId());
if (order != null) {
......@@ -350,7 +352,6 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
});
//排序条件 getStatus()从小到大并且getDistance()从小到大
voList.sort(Comparator.comparing(SStoreVo::getStatus).thenComparing(SStoreVo::getDistance));
// voList.stream().sorted(Comparator.comparing(storeVo -> Double.parseDouble(storeVo.getDistance()))).collect(Collectors.toList());
}
return voList;
}
......
......@@ -5,7 +5,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.SecondaryCardConf;
import share.system.domain.vo.SecondaryCardConfVo;
import share.system.mapper.SecondaryCardConfMapper;
import share.system.service.SecondaryCardConfService;
......@@ -40,7 +39,7 @@ public class SecondaryCardConfServiceImpl extends ServiceImpl<SecondaryCardConfM
* @return 次卡配置
*/
@Override
public List<SecondaryCardConfVo> selectSecondaryCardConfList(SecondaryCardConfVo secondaryCardConf) {
public List<SecondaryCardConf> selectSecondaryCardConfList(SecondaryCardConf secondaryCardConf) {
return secondaryCardConfMapper.selectSecondaryCardConfList(secondaryCardConf);
}
......
......@@ -4,9 +4,7 @@ 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.SConsumer;
import share.system.domain.SecondaryCardLog;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SecondaryCardLogVo;
import share.system.mapper.SecondaryCardLogMapper;
import share.system.service.SecondaryCardLogService;
......@@ -43,8 +41,6 @@ public class SecondaryCardLogServiceImpl extends ServiceImpl<SecondaryCardLogMap
*/
@Override
public List<SecondaryCardLogVo> selectSecondaryCardLogList(SecondaryCardLogVo secondaryCardLog) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
secondaryCardLog.setConsumerId(user.getId());
return secondaryCardLogMapper.selectSecondaryCardLogList(secondaryCardLog);
}
......
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
import share.common.utils.DateUtils;
import share.common.utils.bean.BeanUtils;
import share.system.domain.ConsumerSecondaryCard;
import share.system.domain.SConsumer;
import share.system.domain.SecondaryCardConf;
import share.system.domain.SecondaryCardOrder;
import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SecondaryCardOrderVo;
import share.system.mapper.SecondaryCardOrderMapper;
......@@ -23,7 +23,9 @@ import share.system.response.SecondaryCardOrderPayResultResponse;
import share.system.service.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 次卡购买记录Service业务层处理
......@@ -43,6 +45,14 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
private SecondaryCardConfService secondaryCardConfService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private ConsumerWalletService consumerWalletService;
@Autowired
private ConsumerMemberService consumerMemberService;
@Autowired
private EquityMembersOrderService equityMembersOrderService;
/**
* 查询次卡购买记录
......@@ -150,16 +160,32 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
@Override
public void paymentSuccessful(SecondaryCardOrder secondaryCardOrder) {
updateById(secondaryCardOrder);
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, secondaryCardOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, secondaryCardOrder.getConsumerId()));
ConsumerSecondaryCard consumerSecondaryCard = new ConsumerSecondaryCard();
SecondaryCardConf secondaryCardConf = secondaryCardConfService.getById(secondaryCardOrder.getSecondaryCardConfId());
consumerSecondaryCard.setSecondaryCardConfId(secondaryCardOrder.getSecondaryCardConfId());
consumerSecondaryCard.setConsumerId(secondaryCardOrder.getConsumerId());
consumerSecondaryCard.setPhone(secondaryCardOrder.getPhone());
consumerSecondaryCard.setPackId(secondaryCardConf.getPackId());
consumerSecondaryCard.setSingleAmount(secondaryCardConf.getSingleAmount());
consumerSecondaryCard.setSingleDuration(secondaryCardConf.getSingleDuration());
consumerSecondaryCard.setExpirationDate(DateUtils.addYears(new Date(), secondaryCardConf.getValidityPeriod()));
consumerSecondaryCard.setNumber(secondaryCardConf.getNumber());
consumerSecondaryCard.setCreateTime(new Date());
consumerSecondaryCardService.save(consumerSecondaryCard);
equityMembersOrderService.addConsumerMember(secondaryCardOrder.getConsumerId(), secondaryCardOrder.getSecondaryCardAmount(), consumerMember, consumerWallet);
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
......
......@@ -20,6 +20,7 @@ import org.springframework.util.CollectionUtils;
import share.common.core.redis.RedisUtil;
import share.common.enums.*;
import share.common.exception.base.BaseException;
import share.common.utils.RedisLockUtil;
import share.system.domain.SConsumer;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SCoupon;
......@@ -54,6 +55,9 @@ public class TiktokServiceImpl implements TiktokService {
private RedisUtil redisUtil;
@Autowired
private RedisLockUtil redisLockUtil;
@Autowired
private ISStoreService storeService;
@Autowired
......@@ -356,6 +360,8 @@ public class TiktokServiceImpl implements TiktokService {
if (ObjectUtil.isNull(user)) {
throw new BaseException("您的登录已过期,请先登录");
}
Boolean lock = redisLockUtil.getLock(String.valueOf(user.getId()), 1000);
if (lock) {
LambdaQueryWrapper<SStore> sStoreLambdaQueryWrapper = new LambdaQueryWrapper<>();
sStoreLambdaQueryWrapper.eq(SStore::getId, storeId);
SStore sStore = storeService.getOne(sStoreLambdaQueryWrapper);
......@@ -480,6 +486,8 @@ public class TiktokServiceImpl implements TiktokService {
}
return "验卷成功";
}
throw new RuntimeException("验劵失败");
}
@Override
public List<TiktokPoi> poiList() {
......
......@@ -78,6 +78,7 @@
<select id="selectByConsumerId" resultMap="ConsumerMonthlyCardResult">
select c.id,
c.monthly_card_conf_id,
c1.name as 'conf_name', c1.monthly_card_amount as 'conf_amount',
c.consumer_id,
c2.nick_name,
c2.avatar,
......@@ -93,6 +94,7 @@
c.remark
from s_consumer_monthly_card c
join s_consumer c2 on c.consumer_id = c2.id
join s_monthly_card_conf c1 on c.monthly_card_conf_id = c1.id
where c.is_delete = 0
and c.consumer_id = #{consumerId}
</select>
......
......@@ -13,9 +13,8 @@
<result property="nickName" column="nick_name"/>
<result property="avatar" column="avatar"/>
<result property="phone" column="phone"/>
<result property="packId" column="pack_id"/>
<result property="packName" column="pack_name"/>
<result property="packPrice" column="pack_price"/>
<result property="singleDuration" column="single_duration"/>
<result property="singleAmount" column="single_amount"/>
<result property="expirationDate" column="expiration_date"/>
<result property="number" column="number"/>
<result property="isDelete" column="is_delete"/>
......@@ -31,7 +30,8 @@
secondary_card_conf_id,
consumer_id,
phone,
pack_id,
single_duration,
single_amount,
expiration_date,
number,
is_delete,
......@@ -51,11 +51,10 @@
c.phone,
m.nick_name,
m.avatar,
p.name as 'pack_name',
p.price as 'pack_price',
c2.name as 'conf_name',
c2.secondary_card_amount as 'conf_amount',
c. pack_id,
c.single_duration,
c.single_amount,
c.expiration_date,
c.number,
c.is_delete,
......@@ -65,13 +64,14 @@
c.update_time,
c. remark
from s_consumer_secondary_card c join s_consumer m on c.consumer_id = m.id
join s_pack p on c.pack_id = p.id join s_secondary_card_conf c2 on c.secondary_card_conf_id = c2.id
join s_secondary_card_conf c2 on c.secondary_card_conf_id = c2.id
where
c.is_delete = 0
<if test="secondaryCardConfId != null ">and c.secondary_card_conf_id = #{secondaryCardConfId}</if>
<if test="consumerId != null ">and c.consumer_id = #{consumerId}</if>
<if test="phone != null and phone != ''">and c.phone = #{phone}</if>
<if test="packId != null ">and c.pack_id = #{packId}</if>
<if test="singleDuration != null ">and c.single_duration = #{singleDuration}</if>
<if test="singleAmount != null ">and c.single_amount = #{singleAmount}</if>
<if test="expirationDate != null ">and c.expiration_date = #{expirationDate}</if>
<if test="number != null ">and c.number = #{number}</if>
</select>
......@@ -87,7 +87,9 @@
c.phone,
m.nick_name,
m.avatar,
c.pack_id,
s.name as 'conf_name', s.secondary_card_amount as 'conf_amount',
c.single_duration,
c.single_amount,
c.expiration_date,
c.number,
c.is_delete,
......@@ -98,6 +100,7 @@
c.remark
from s_consumer_secondary_card c
join s_consumer m on c.consumer_id = m.id
join s_secondary_card_conf s on c.secondary_card_conf_id = s.id
where c.is_delete = 0
and c.consumer_id = #{consumerId}
</select>
......@@ -109,7 +112,8 @@
<if test="secondaryCardConfId != null">secondary_card_conf_id,</if>
<if test="consumerId != null">consumer_id,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="packId != null">pack_id,</if>
<if test="singleDuration != null">single_duration,</if>
<if test="singleAmount != null">single_amount,</if>
<if test="expirationDate != null">expiration_date,</if>
<if test="number != null">number,</if>
<if test="isDelete != null">is_delete,</if>
......@@ -123,7 +127,8 @@
<if test="secondaryCardConfId != null">#{secondaryCardConfId},</if>
<if test="consumerId != null">#{consumerId},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="packId != null">#{packId},</if>
<if test="singleDuration != null">#{singleDuration},</if>
<if test="singleAmount != null">#{singleAmount},</if>
<if test="expirationDate != null">#{expiration_date},</if>
<if test="number != null">#{number},</if>
<if test="isDelete != null">#{isDelete},</if>
......@@ -141,7 +146,8 @@
<if test="secondaryCardConfId != null">secondary_card_conf_id = #{secondaryCardConfId},</if>
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="packId != null">pack_id = #{packId},</if>
<if test="singleDuration != null">single_duration = #{singleDuration},</if>
<if test="singleAmount != null">single_amount = #{singleAmount},</if>
<if test="expirationDate != null">expiration_date = #{expirationDate},</if>
<if test="number != null">number = #{number},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
......
......@@ -11,6 +11,8 @@
<result property="avatar" column="avatar"/>
<result property="phone" column="phone"/>
<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="remainingIntegral" column="remaining_integral"/>
<result property="isDelete" column="is_delete"/>
......@@ -27,6 +29,8 @@
select id,
consumer_id,
balance,
recharge_amount,
gift_amount,
remaining_duration,
remaining_integral,
is_delete,
......@@ -47,6 +51,8 @@
c.phone,
c.avatar,
w.balance,
w.recharge_amount,
w.gift_amount,
w.remaining_duration,
w.remaining_integral,
w.is_delete,
......@@ -80,6 +86,8 @@
c.phone,
c.avatar,
w.balance,
w.recharge_amount,
w.gift_amount,
w.remaining_duration,
w.remaining_integral,
w.is_delete,
......@@ -109,6 +117,8 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consumerId != null">consumer_id,</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="remainingIntegral != null">remaining_integral,</if>
<if test="isDelete != null">is_delete,</if>
......@@ -123,6 +133,8 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</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="remainingIntegral != null">#{remainingIntegral},</if>
<if test="isDelete != null">#{isDelete},</if>
......@@ -141,6 +153,8 @@
<trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</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="remainingIntegral != null">remaining_integral = #{remainingIntegral},</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 @@
<result property="phone" column="phone"/>
<result property="useDuration" column="use_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="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
......@@ -30,6 +32,8 @@
phone,
use_duration,
residue_duration,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
......@@ -50,6 +54,8 @@
l.phone,
l.use_duration,
l.residue_duration,
l.operation_type,
l.operation_time,
l.is_delete,
l.create_by,
l.create_time,
......@@ -65,6 +71,7 @@
<if test="phone != null and phone != ''">and l.phone = #{phone}</if>
<if test="useDuration != null ">and l.use_duration = #{useDuration}</if>
<if test="residueDuration != null ">and l.residue_duration = #{residueDuration}</if>
order by l.create_time
</select>
<select id="selectMonthlyCardLogById" parameterType="Long" resultMap="MonthlyCardLogResult">
......@@ -86,6 +93,8 @@
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="operationType != null">operation_type,</if>
<if test="operationTime != null">operation_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerMonthlyCardId != null">#{consumerMonthlyCardId},</if>
......@@ -99,6 +108,8 @@
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="operationType != null">#{operationType},</if>
<if test="operationTime != null">#{operationTime},</if>
</trim>
</insert>
......@@ -116,6 +127,8 @@
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</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>
where id = #{id}
</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="storeId" column="store_id"/>
<result property="storeName" column="store_name"/>
<result property="roomId" column="room_id"/>
<result property="roomName" column="room_name"/>
<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="isConsumption" column="is_consumption"/>
<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,
store_id,
room_id,
is_consumption,
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,
b.store_id,
s.name as 'store_name',
b.room_id,
r.name as 'room_name',
b.is_consumption,
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
left join s_store s on b.store_id = s.id
left join s_room r on b.room_id = r.id
<where>
<if test="nickName != null and nickName != ''">and c.nick_name like concat('%', #{nickName},'%')</if>
<if test="storeName != null and storeName != ''">and s.name like concat('%', #{storeName},'%')</if>
<if test="roomName != null and roomName != ''">and r.name like concat('%', #{roomName},'%')</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>
<if test="storeId != null ">and b.store_id = #{storeId}</if>
<if test="roomId != null ">and b.room_id = #{roomId}</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
......@@ -40,16 +40,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSCleanRecordsList" parameterType="SCleanRecords" resultMap="SCleanRecordsResult">
<include refid="selectSCleanRecordsVo"/>
<where>
<if test="startDate != null "> and t1.start_date = #{startDate}</if>
<!-- <if test="startDate != null "> and t1.start_date = #{startDate}</if>-->
<!-- <if test="endDate != null "> and t1.end_date = #{endDate}</if>-->
<if test="startImage != null and startImage != ''"> and t1.start_image = #{startImage}</if>
<if test="endDate != null "> and t1.end_date = #{endDate}</if>
<if test="endImage != null and endImage != ''"> and t1.end_image = #{endImage}</if>
<if test="status != null "> and t1.status = #{status}</if>
<if test="consumerId != null"> and t1.consumer_id = #{consumerId}</if>
<if test="roomId != null"> and t1.room_id = #{roomId}</if>
<if test="storeId != null"> and t1.store_id = #{storeId}</if>
<if test="createTime != null ">
and DATE_FORMAT(t1.create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime}, '%Y-%m-%d')
<!-- <if test="createTime != null ">-->
<!-- and DATE_FORMAT(t1.create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime}, '%Y-%m-%d')-->
<!-- </if>-->
<if test="startTime != null">
and DATE_FORMAT(t1.create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null">
and DATE_FORMAT(t1.create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
<if test="startDate != null">
and DATE_FORMAT(t1.start_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null">
and DATE_FORMAT(t1.end_date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
</where>
order by create_time desc
......
......@@ -127,6 +127,7 @@
left join s_store_consumer t2 on t2.consumer_id = t1.id
where t1.role_type = '1'
and t2.position = '1'
and t2.store_id = #{storeId}
and t1.id in (select consumer_id from s_store_consumer where store_id = #{storeId} and position = '1')
</select>
......
......@@ -26,6 +26,7 @@
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="roomStat" column="room_stat" />
<result property="textInput" column="text_input" />
</resultMap>
<sql id="selectSRoomVo">
......@@ -49,7 +50,8 @@
update_by,
update_time,
remark,
room_stat
room_stat,
text_input
from s_room
</sql>
......@@ -71,8 +73,6 @@
<if test="params2 != null and params2 != ''"> and params2 = #{params2}</if>
<if test="roomStat != null">and room_stat = #{roomStat}</if>
<if test="queryNotRoomStat != null ">and room_stat != #{queryNotRoomStat}</if>
</where>
order by sort desc
</select>
......@@ -105,6 +105,7 @@
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="roomStat != null">room_stat,</if>
<if test="textInput != null">text_input</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sort != null">#{sort},</if>
......@@ -127,6 +128,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="roomStat != null">#{roomStat},</if>
<if test="textInput != null">#{textInput}</if>
</trim>
</insert>
......@@ -153,6 +155,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="roomStat != null">room_stat = #{roomStat},</if>
<if test="textInput != null">text_input = #{textInput}</if>
</trim>
where id = #{id}
</update>
......
......@@ -4,13 +4,12 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.SecondaryCardConfMapper">
<resultMap type="SecondaryCardConfVo" id="SecondaryCardConfResult">
<resultMap type="SecondaryCardConf" id="SecondaryCardConfResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="secondaryCardAmount" column="secondary_card_amount"/>
<result property="packId" column="pack_id"/>
<result property="packName" column="pack_name"/>
<result property="packPrice" column="pack_price"/>
<result property="singleDuration" column="single_duration"/>
<result property="singleAmount" column="single_amount"/>
<result property="validityPeriod" column="validity_period"/>
<result property="number" column="number"/>
<result property="isDelete" column="is_delete"/>
......@@ -25,7 +24,8 @@
select id,
name,
secondary_card_amount,
pack_id,
single_duration,
single_amount,
validity_period,
number,
is_delete,
......@@ -37,13 +37,12 @@
from s_secondary_card_conf
</sql>
<select id="selectSecondaryCardConfList" parameterType="SecondaryCardConfVo" resultMap="SecondaryCardConfResult">
<select id="selectSecondaryCardConfList" parameterType="SecondaryCardConf" resultMap="SecondaryCardConfResult">
select c.id,
c.name,
c.secondary_card_amount,
c.pack_id,
p.name as pack_name,
p.price as pack_price,
c.single_duration,
c.single_amount,
c.validity_period,
c.number,
c.is_delete,
......@@ -52,11 +51,12 @@
c.update_by,
c.update_time,
c.remark
from s_secondary_card_conf c join s_pack p on c.pack_id = p.id
from s_secondary_card_conf c
where c.is_delete = 0
<if test="name != null and name != ''">and c.name like concat('%', #{name}, '%')</if>
<if test="secondaryCardAmount != null ">and c.secondary_card_amount = #{secondaryCardAmount}</if>
<if test="packId != null ">and c.pack_id = #{packId}</if>
<if test="singleDuration != null ">and c.single_duration = #{singleDuration}</if>
<if test="singleAmount != null ">and c.single_amount = #{singleAmount}</if>
<if test="validityPeriod != null ">and c.validity_period = #{validityPeriod}</if>
<if test="number != null ">and c.number = #{number}</if>
</select>
......@@ -71,7 +71,8 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="secondaryCardAmount != null">secondary_card_amount,</if>
<if test="packId != null">pack_id,</if>
<if test="singleDuration != null">single_duration,</if>
<if test="singleAmount != null">single_amount,</if>
<if test="validityPeriod != null">validity_period,</if>
<if test="number != null">number,</if>
<if test="isDelete != null">is_delete,</if>
......@@ -84,7 +85,8 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="secondaryCardAmount != null">#{secondaryCardAmount},</if>
<if test="packId != null">#{packId},</if>
<if test="singleDuration != null">#{singleDuration},</if>
<if test="singleAmount != null">#{singleAmount},</if>
<if test="validityPeriod != null">#{validityPeriod},</if>
<if test="number != null">#{number},</if>
<if test="isDelete != null">#{isDelete},</if>
......@@ -101,7 +103,8 @@
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="secondaryCardAmount != null">secondary_card_amount = #{secondaryCardAmount},</if>
<if test="packId != null">pack_id = #{packId},</if>
<if test="singleDuration != null">single_duration = #{singleDuration},</if>
<if test="singleAmount != null">single_amount = #{singleAmount},</if>
<if test="validityPeriod != null">validity_period = #{validityPeriod},</if>
<if test="number != null">number = #{number},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
......
......@@ -13,11 +13,10 @@
<result property="nickName" column="nick_name"/>
<result property="avatar" column="avatar"/>
<result property="phone" column="phone"/>
<result property="packId" column="pack_id"/>
<result property="packName" column="pack_name"/>
<result property="packPrice" column="pack_price"/>
<result property="usageCount" column="usage_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="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
......@@ -31,9 +30,10 @@
consumer_secondary_card_id,
consumer_id,
phone,
pack_id,
usage_count,
residue_count,
operation_type,
operation_time,
is_delete,
create_by,
create_time,
......@@ -52,18 +52,17 @@
c.nick_name as 'nick_name',
c.avatar,
l.phone,
l.pack_id,
p.name as 'pack_name',
p.price as 'pack_price',
l.usage_count,
l.residue_count,
l.operation_type,
l.operation_time,
l.is_delete,
l.create_by,
l.create_time,
l. update_by,
l.update_time,
l.remark
from s_secondary_card_log l join s_pack p on l.pack_id = p.id join s_consumer c on l.consumer_id = c.id
from s_secondary_card_log l join s_consumer c on l.consumer_id = c.id
join s_consumer_secondary_card s on l.consumer_secondary_card_id = s.id join s_secondary_card_conf c1 on
s.secondary_card_conf_id = c1.id
where l.is_delete = 0
......@@ -71,9 +70,10 @@
</if>
<if test="consumerId != null ">and l.consumer_id = #{consumerId}</if>
<if test="phone != null and phone != ''">and l.phone = #{phone}</if>
<if test="packId != null ">and l.pack_id = #{packId}</if>
<if test="usageCount != null ">and l.usage_count = #{usageCount}</if>
<if test="residueCount != null ">and l.residue_count = #{residueCount}</if>
order by l.create_time
</select>
<select id="selectSecondaryCardLogById" parameterType="Long" resultMap="SecondaryCardLogResult">
......@@ -87,7 +87,7 @@
<if test="consumerSecondaryCardId != null">consumer_secondary_card_id,</if>
<if test="consumerId != null">consumer_id,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="packId != null">pack_id,</if>
<if test="usageCount != null">usage_count,</if>
<if test="residueCount != null">residue_count,</if>
<if test="isDelete != null">is_delete,</if>
......@@ -96,12 +96,14 @@
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="operationType != null">operation_type,</if>
<if test="operationTime != null">operation_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerSecondaryCardId != null">#{consumerSecondaryCardId},</if>
<if test="consumerId != null">#{consumerId},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="packId != null">#{packId},</if>
<if test="usageCount != null">#{usageCount},</if>
<if test="residueCount != null">#{residueCount},</if>
<if test="isDelete != null">#{isDelete},</if>
......@@ -110,6 +112,8 @@
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="operationType != null">#{operationType},</if>
<if test="operationTime != null">#{operationTime},</if>
</trim>
</insert>
......@@ -119,7 +123,7 @@
<if test="consumerSecondaryCardId != null">consumer_secondary_card_id = #{consumerSecondaryCardId},</if>
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="packId != null">pack_id = #{packId},</if>
<if test="usageCount != null">usage_count = #{usageCount},</if>
<if test="residueCount != null">residue_count = #{residueCount},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
......@@ -128,6 +132,8 @@
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</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>
where id = #{id}
</update>
......
......@@ -62,8 +62,6 @@
o. secondary_card_conf_id,
c.name as 'conf_name',
c.secondary_card_amount as 'conf_amount',
p.name as pack_name,
p.price as pack_price,
o. consumer_id,
c1.nick_name as 'nick_name',
c1.avatar,
......@@ -78,7 +76,7 @@
o. update_time,
o. remark
from s_secondary_card_order o join s_secondary_card_conf c on o.secondary_card_conf_id = c.id
join s_consumer c1 on o.consumer_id = c1.id join s_pack p on p.id = c.pack_id
join s_consumer c1 on o.consumer_id = c1.id
where o.is_delete = 0
<if test="secondaryCardNo != null and secondaryCardNo != ''">and o.secondary_card_no = #{secondaryCardNo}
</if>
......
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
</component>
</module>
\ No newline at end of file
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