2026-03-03后台功能需求
1,积分流水以及订单新增导出,新增时间搜索 2,优化后台划拨福利包
This commit is contained in:
@@ -136,7 +136,7 @@ public class BenefitPackageSendPointProcessor implements BasicProcessor {
|
||||
.setSourceId(pkg.getId())
|
||||
.setSourceDetail(JSONObject.toJSONString(pkg))
|
||||
.setIsComplete(0)
|
||||
.setStatisticalDate(new Date())
|
||||
.setStatisticalDate(DateUtil.getToday())
|
||||
.setRemark(pkg.getPackageName() + "每日福利积分产出")
|
||||
);
|
||||
|
||||
|
||||
@@ -32,13 +32,14 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.redis.debounce.RedisDebounce;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.annotation.IsAdmin;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.common.manager.CommonUserManager;
|
||||
import org.springblade.modules.common.pojo.vo.CommonImportUserBackOrderError;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -53,6 +54,7 @@ import org.springblade.core.excel.util.ExcelUtil;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 用户订单 控制器
|
||||
@@ -67,6 +69,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
public class CommonUserOrderController extends BladeController {
|
||||
|
||||
private final ICommonUserOrderService orderService;
|
||||
private final CommonUserManager commonUserManager;
|
||||
|
||||
/**
|
||||
* 用户订单 详情
|
||||
@@ -162,11 +165,28 @@ public class CommonUserOrderController extends BladeController {
|
||||
* 用户订单 确认收款
|
||||
*/
|
||||
@PostMapping("/confirm-payment")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@ApiOperationSupport(order = 10)
|
||||
@Operation(summary = "确认收款", description = "传入order")
|
||||
public R confirmPayment(@Valid @RequestBody CommonUserOrderEntity order) {
|
||||
return R.status(orderService.confirmPayment(order.getId()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/exportOrderToExcel")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "导出用户订单")
|
||||
public void exportFlowToExcel(@RequestParam String account , @RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<CommonUserOrderExcel> excelList = commonUserManager.exportUserOrderToExcel(account ,searchDateRange);
|
||||
ExcelUtil.export(response, "用户积分流水日志" + org.springblade.core.tool.utils.DateUtil.time(), "用户订单日志", excelList, CommonUserOrderExcel.class);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("import-user-back-order")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@Operation(summary = "批量导入补单", description = "传入excel")
|
||||
public R<List<CommonImportUserBackOrderError>> importUserBackOrder(MultipartFile file) {
|
||||
return R.data(commonUserManager.importUserBackOrder(file));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,21 +7,19 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.annotation.IsAdmin;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.common.excel.CommonUserPointLogExcel;
|
||||
import org.springblade.modules.common.manager.CommonUserManager;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
|
||||
import org.springblade.modules.common.wrapper.CommonUserPointLogWrapper;
|
||||
import org.springblade.modules.common.service.ICommonUserPointLogService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -41,6 +39,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
public class CommonUserPointLogController extends BladeController {
|
||||
|
||||
private final ICommonUserPointLogService commonUserPointLogService;
|
||||
private final CommonUserManager commonUserManager;
|
||||
|
||||
/**
|
||||
* 用户商城积分流水表 详情
|
||||
@@ -115,4 +114,14 @@ public class CommonUserPointLogController extends BladeController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/exportFlowToExcel")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出用户佣金流水")
|
||||
public void exportFlowToExcel(@RequestParam String account , @RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<CommonUserPointLogExcel> excelList = commonUserManager.exportUserPointToExcel(account ,searchDateRange);
|
||||
ExcelUtil.export(response, "用户积分流水日志" + org.springblade.core.tool.utils.DateUtil.time(), "用户积分流水日志", excelList, CommonUserPointLogExcel.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import org.springblade.modules.common.wrapper.UserSmsLogWrapper;
|
||||
import org.springblade.modules.common.service.IUserSmsLogService;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserSmsLogVO;
|
||||
import org.springblade.modules.common.wrapper.CommonUserSmsLogWrapper;
|
||||
import org.springblade.modules.common.service.ICommonUserSmsLogService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -31,9 +31,9 @@ import java.util.Map;
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("common/usersmslog")
|
||||
@Tag(name = "用户短信日志", description = "用户短信日志接口")
|
||||
public class UserSmsLogController extends BladeController {
|
||||
public class CommonUserSmsLogController extends BladeController {
|
||||
|
||||
private final IUserSmsLogService userSmsLogService;
|
||||
private final ICommonUserSmsLogService userSmsLogService;
|
||||
|
||||
/**
|
||||
* 用户短信日志 详情
|
||||
@@ -41,9 +41,9 @@ public class UserSmsLogController extends BladeController {
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入userSmsLog")
|
||||
public R<UserSmsLogVO> detail(UserSmsLogEntity userSmsLog) {
|
||||
UserSmsLogEntity detail = userSmsLogService.getOne(Condition.getQueryWrapper(userSmsLog));
|
||||
return R.data(UserSmsLogWrapper.build().entityVO(detail));
|
||||
public R<CommonUserSmsLogVO> detail(CommonUserSmsLogEntity userSmsLog) {
|
||||
CommonUserSmsLogEntity detail = userSmsLogService.getOne(Condition.getQueryWrapper(userSmsLog));
|
||||
return R.data(CommonUserSmsLogWrapper.build().entityVO(detail));
|
||||
}
|
||||
/**
|
||||
* 用户短信日志 分页
|
||||
@@ -51,9 +51,9 @@ public class UserSmsLogController extends BladeController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入userSmsLog")
|
||||
public R<IPage<UserSmsLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userSmsLog, Query query) {
|
||||
IPage<UserSmsLogEntity> pages = userSmsLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userSmsLog, UserSmsLogEntity.class));
|
||||
return R.data(UserSmsLogWrapper.build().pageVO(pages));
|
||||
public R<IPage<CommonUserSmsLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userSmsLog, Query query) {
|
||||
IPage<CommonUserSmsLogEntity> pages = userSmsLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userSmsLog, CommonUserSmsLogEntity.class));
|
||||
return R.data(CommonUserSmsLogWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,8 +62,8 @@ public class UserSmsLogController extends BladeController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入userSmsLog")
|
||||
public R<IPage<UserSmsLogVO>> page(UserSmsLogVO userSmsLog, Query query) {
|
||||
IPage<UserSmsLogVO> pages = userSmsLogService.selectUserSmsLogPage(Condition.getPage(query), userSmsLog);
|
||||
public R<IPage<CommonUserSmsLogVO>> page(CommonUserSmsLogVO userSmsLog, Query query) {
|
||||
IPage<CommonUserSmsLogVO> pages = userSmsLogService.selectUserSmsLogPage(Condition.getPage(query), userSmsLog);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class UserSmsLogController extends BladeController {
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入userSmsLog")
|
||||
public R save(@Valid @RequestBody UserSmsLogEntity userSmsLog) {
|
||||
public R save(@Valid @RequestBody CommonUserSmsLogEntity userSmsLog) {
|
||||
return R.status(userSmsLogService.save(userSmsLog));
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class UserSmsLogController extends BladeController {
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入userSmsLog")
|
||||
public R update(@Valid @RequestBody UserSmsLogEntity userSmsLog) {
|
||||
public R update(@Valid @RequestBody CommonUserSmsLogEntity userSmsLog) {
|
||||
return R.status(userSmsLogService.updateById(userSmsLog));
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class UserSmsLogController extends BladeController {
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入userSmsLog")
|
||||
public R submit(@Valid @RequestBody UserSmsLogEntity userSmsLog) {
|
||||
public R submit(@Valid @RequestBody CommonUserSmsLogEntity userSmsLog) {
|
||||
return R.status(userSmsLogService.saveOrUpdate(userSmsLog));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.springblade.modules.common.eums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
public enum PaymentType {
|
||||
|
||||
ALI(1, "支付宝"),
|
||||
WECHAT(2, "微信"),
|
||||
OFFLINE(99, "线下支付");
|
||||
|
||||
private final int code;
|
||||
private final String name;
|
||||
|
||||
PaymentType(int code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// ========== 静态映射:code -> enum ==========
|
||||
|
||||
private static final Map<Integer, PaymentType> BY_CODE = Stream.of(values())
|
||||
.collect(Collectors.toUnmodifiableMap(PaymentType::getCode, Function.identity()));
|
||||
|
||||
/**
|
||||
* 根据整型状态码获取对应的枚举(严格模式)
|
||||
*
|
||||
* @throws IllegalArgumentException 如果状态码无效
|
||||
*/
|
||||
public static PaymentType fromCode(int code) {
|
||||
PaymentType status = BY_CODE.get(code);
|
||||
if (status == null) {
|
||||
throw new IllegalArgumentException("无效的支付状态码: " + code);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全版本:无效状态码返回 null
|
||||
*/
|
||||
public static PaymentType fromCodeOrNull(int code) {
|
||||
return BY_CODE.get(code);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.springblade.modules.common.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ColumnWidth(16)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class CommonUserBackOrderExcel {
|
||||
|
||||
@ExcelProperty("订单号")
|
||||
private Long orderNo;
|
||||
|
||||
@ExcelProperty("实际支付金额")
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,30 +1,5 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.excel;
|
||||
|
||||
package org.springblade.modules.common.excel;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -34,6 +9,8 @@ import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
|
||||
@@ -48,130 +25,63 @@ import java.io.Serial;
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
@Accessors(chain = true)
|
||||
public class CommonUserOrderExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("主键")
|
||||
@ExcelProperty(value = "订单号")
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("用户id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 收件人手机号
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收件人手机号")
|
||||
|
||||
@ExcelProperty(value = "下单账号")
|
||||
private String account;
|
||||
|
||||
@ExcelProperty(value = "电话")
|
||||
private String consigneePhone;
|
||||
/**
|
||||
* 收件人
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收件人")
|
||||
|
||||
@ExcelProperty(value = "收货人")
|
||||
private String consignee;
|
||||
/**
|
||||
* 订单类型
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("订单类型")
|
||||
private String orderType;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("商品编号")
|
||||
private String itemCode;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("商品名称")
|
||||
private String itemName;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("图片")
|
||||
private String imageUrl;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("数量")
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 收货地址(实物商品必填,虚拟商品可为空)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("收货地址(实物商品必填,虚拟商品可为空)")
|
||||
|
||||
@ExcelProperty(value = "收货地址")
|
||||
private String deliveryAddress;
|
||||
/**
|
||||
* 快递公司名称
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("快递公司名称")
|
||||
private String expressCompany;
|
||||
/**
|
||||
* 快递单号(物流单号)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("快递单号(物流单号)")
|
||||
|
||||
@ExcelProperty(value = "商品名称")
|
||||
private String itemName;
|
||||
|
||||
@ExcelProperty(value = "商品图片")
|
||||
private String imageUrl;
|
||||
|
||||
@ExcelProperty(value = "商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ExcelProperty(value = "商品规格")
|
||||
private String specs;
|
||||
|
||||
@ExcelProperty(value = "物流单号")
|
||||
private String expressNo;
|
||||
/**
|
||||
* 订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款")
|
||||
private Integer orderStatus;
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("订单金额")
|
||||
|
||||
@ExcelProperty(value = "订单状态")
|
||||
private String orderStatus;
|
||||
|
||||
@ExcelProperty(value = "订单金额")
|
||||
private BigDecimal totalAmount;
|
||||
/**
|
||||
* 实际支付金额
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("实际支付金额")
|
||||
|
||||
@ExcelProperty(value = "实际支付")
|
||||
private BigDecimal actualAmount;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("支付方式")
|
||||
private Integer paymentType;
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("支付时间")
|
||||
|
||||
@ExcelProperty(value = "支付方式")
|
||||
private String paymentType;
|
||||
|
||||
@ExcelProperty(value = "支付时间")
|
||||
private Date paymentTime;
|
||||
/**
|
||||
* 支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)")
|
||||
private Integer paymentStatus;
|
||||
/**
|
||||
* 支付凭证编号
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("支付凭证编号")
|
||||
private String paymentTrack;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("")
|
||||
private Integer isDeleted;
|
||||
|
||||
@ExcelProperty(value = "支付状态")
|
||||
private String paymentStatus;
|
||||
|
||||
@ExcelProperty(value = "下单时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.springblade.modules.common.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class CommonUserPointLogExcel implements Serializable {
|
||||
|
||||
@ExcelProperty("账号")
|
||||
private String account;
|
||||
|
||||
@ExcelProperty("金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ExcelProperty("上一笔金额")
|
||||
private BigDecimal lastAmount;
|
||||
|
||||
|
||||
@ExcelProperty("收入/支出")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("统计时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package org.springblade.modules.common.manager;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.modules.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.eums.OrderStatus;
|
||||
import org.springblade.modules.common.eums.PaymentStatus;
|
||||
import org.springblade.modules.common.eums.PaymentType;
|
||||
import org.springblade.modules.common.event.PaymentSuccessEvent;
|
||||
import org.springblade.modules.common.excel.CommonUserBackOrderExcel;
|
||||
import org.springblade.modules.common.excel.CommonUserOrderExcel;
|
||||
import org.springblade.modules.common.excel.CommonUserPointLogExcel;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonImportUserBackOrderError;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.common.service.ICommonUserPointLogService;
|
||||
|
||||
import org.springblade.modules.common.service.ICommonUserPointService;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class CommonUserManager {
|
||||
private final IUserService userService;
|
||||
private final ICommonUserPointLogService commonUserPointLogService;
|
||||
private final ICommonUserOrderService commonUserOrderService;
|
||||
private final ApplicationEventPublisher eventPublisher;
|
||||
private final ICommonUserPointService userPointService;
|
||||
|
||||
public List<CommonUserPointLogExcel> exportUserPointToExcel(String account, List<String> searchDateRange) {
|
||||
|
||||
Assert.isTrue(StringUtils.hasLength(account), "请选择账号");
|
||||
|
||||
User user = userService.getOne(
|
||||
Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getAccount, account)
|
||||
);
|
||||
Assert.notNull(user, "账号不存在");
|
||||
Date startDate = null ;
|
||||
Date endDate = null ;
|
||||
if (searchDateRange == null){
|
||||
throw new RuntimeException("请选择时间范围");
|
||||
}
|
||||
|
||||
startDate = DateUtil.convertFromString(searchDateRange.get(0), "yyyy-MM-dd hh:mm:ss");
|
||||
endDate = DateUtil.convertFromString(searchDateRange.get(1), "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
if (startDate.getTime() >=endDate.getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
List<CommonUserPointLogEntity> pointLogList = commonUserPointLogService.list(
|
||||
Wrappers.lambdaQuery(CommonUserPointLogEntity.class)
|
||||
.eq(CommonUserPointLogEntity::getIsComplete, 1)
|
||||
.eq(CommonUserPointLogEntity::getUserId, user.getId())
|
||||
.ge(CommonUserPointLogEntity::getCreateTime, startDate)
|
||||
.lt(CommonUserPointLogEntity::getCreateTime, endDate)
|
||||
.orderByDesc(CommonUserPointLogEntity::getCreateTime)
|
||||
);
|
||||
|
||||
List<CommonUserPointLogExcel> excelList = new ArrayList<>();
|
||||
|
||||
pointLogList.forEach(pointLog -> {
|
||||
|
||||
CommonUserPointLogExcel pointLogExcel = new CommonUserPointLogExcel();
|
||||
|
||||
pointLogExcel.setAccount(user.getAccount());
|
||||
pointLogExcel.setAmount(pointLog.getAmount());
|
||||
pointLogExcel.setLastAmount(pointLog.getLastAmount());
|
||||
pointLogExcel.setType(pointLog.getType() == 1 ? "收入" : "支出");
|
||||
pointLogExcel.setCreateTime(pointLog.getCreateTime());
|
||||
pointLogExcel.setRemark(pointLog.getRemark());
|
||||
|
||||
excelList.add(pointLogExcel);
|
||||
|
||||
});
|
||||
|
||||
return excelList;
|
||||
|
||||
}
|
||||
|
||||
public List<CommonUserOrderExcel> exportUserOrderToExcel(String account, List<String> searchDateRange) {
|
||||
Assert.isTrue(StringUtils.hasLength(account), "请选择账号");
|
||||
|
||||
User user = userService.getOne(
|
||||
Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getAccount, account)
|
||||
);
|
||||
Assert.notNull(user, "账号不存在");
|
||||
Date startDate = null ;
|
||||
Date endDate = null ;
|
||||
if (searchDateRange == null){
|
||||
throw new RuntimeException("请选择时间范围");
|
||||
}
|
||||
|
||||
startDate = DateUtil.convertFromString(searchDateRange.get(0), "yyyy-MM-dd hh:mm:ss");
|
||||
endDate = DateUtil.convertFromString(searchDateRange.get(1), "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
if (startDate.getTime() >=endDate.getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
List<CommonUserOrderVO> commonUserOrderList = commonUserOrderService.exportUserOrderToExcel(user.getId(), startDate, endDate);
|
||||
|
||||
List<CommonUserOrderExcel> excelList = new ArrayList<>();
|
||||
|
||||
commonUserOrderList.forEach(order -> {
|
||||
|
||||
CommonUserOrderExcel commonUserOrderExcel = new CommonUserOrderExcel();
|
||||
commonUserOrderExcel.setId(order.getId());
|
||||
commonUserOrderExcel.setAccount(order.getAccount());
|
||||
commonUserOrderExcel.setConsigneePhone(order.getConsigneePhone());
|
||||
commonUserOrderExcel.setConsignee(order.getConsignee());
|
||||
commonUserOrderExcel.setDeliveryAddress(order.getDeliveryAddress());
|
||||
commonUserOrderExcel.setItemName(order.getItemName());
|
||||
commonUserOrderExcel.setImageUrl(order.getImageUrl());
|
||||
commonUserOrderExcel.setQuantity(order.getQuantity());
|
||||
|
||||
|
||||
JSONArray specsJsonArray = JSONArray.parse(JSONArray.toJSONString(order.getSpecs()));
|
||||
List<String> specsJsonString = new ArrayList<>();
|
||||
specsJsonArray.forEach(spec -> {
|
||||
JSONObject specJsonObject = (JSONObject) spec;
|
||||
specsJsonString.add(specJsonObject.getString("attr") + ":" + specJsonObject.getString("value"));
|
||||
});
|
||||
|
||||
commonUserOrderExcel.setSpecs(JSONArray.toJSONString(specsJsonString));
|
||||
commonUserOrderExcel.setTotalAmount(order.getTotalAmount());
|
||||
commonUserOrderExcel.setActualAmount(order.getActualAmount());
|
||||
commonUserOrderExcel.setPaymentType(PaymentType.fromCodeOrNull(order.getPaymentType()).getName());
|
||||
commonUserOrderExcel.setPaymentTime(order.getPaymentTime());
|
||||
commonUserOrderExcel.setPaymentStatus(PaymentStatus.fromCodeOrNull(order.getPaymentStatus()).getDescription());
|
||||
commonUserOrderExcel.setCreateTime(order.getCreateTime());
|
||||
|
||||
excelList.add(commonUserOrderExcel);
|
||||
|
||||
});
|
||||
|
||||
return excelList;
|
||||
}
|
||||
|
||||
public List<CommonImportUserBackOrderError> importUserBackOrder(MultipartFile file) {
|
||||
|
||||
List<CommonUserBackOrderExcel> read = ExcelUtil.read(file, CommonUserBackOrderExcel.class);
|
||||
|
||||
List<CommonImportUserBackOrderError> errorExcelList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
int row = i + 2;
|
||||
|
||||
CommonUserBackOrderExcel backOrderExcel = read.get(i);
|
||||
|
||||
if (backOrderExcel.getOrderNo() == null || backOrderExcel.getActualAmount() == null){
|
||||
log.error("第{}行错误 ,订单号或金额必填", row);
|
||||
|
||||
errorExcelList.add(
|
||||
new CommonImportUserBackOrderError()
|
||||
.setOrderNo(backOrderExcel.getOrderNo())
|
||||
.setAmount(backOrderExcel.getActualAmount())
|
||||
.setErrorMsg("第"+ row +"行错误 ,订单号或金额必填")
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
CommonUserOrderEntity userOrder = commonUserOrderService.getById(backOrderExcel.getOrderNo());
|
||||
|
||||
if (userOrder == null){
|
||||
log.error("第{}行错误 ,订单号不存在", row);
|
||||
|
||||
errorExcelList.add(
|
||||
new CommonImportUserBackOrderError()
|
||||
.setOrderNo(backOrderExcel.getOrderNo())
|
||||
.setAmount(backOrderExcel.getActualAmount())
|
||||
.setErrorMsg("第"+ row +"行错误 ,订单号不存在")
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (userOrder.getPaymentStatus() != 0){
|
||||
|
||||
log.error("第{}行错误 ,订单:{}", row , PaymentStatus.fromCodeOrNull(userOrder.getPaymentStatus()).getDescription());
|
||||
errorExcelList.add(
|
||||
new CommonImportUserBackOrderError()
|
||||
.setOrderNo(backOrderExcel.getOrderNo())
|
||||
.setAmount(backOrderExcel.getActualAmount())
|
||||
.setErrorMsg("第"+ row +"行错误 ,订单:" + PaymentStatus.fromCodeOrNull(userOrder.getPaymentStatus()).getDescription())
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (userOrder.getOrderStatus() >= 1){
|
||||
log.error("第{}行错误 ,订单:已支付 ", row );
|
||||
errorExcelList.add(
|
||||
new CommonImportUserBackOrderError()
|
||||
.setOrderNo(backOrderExcel.getOrderNo())
|
||||
.setAmount(backOrderExcel.getActualAmount())
|
||||
.setErrorMsg("第"+ row +"行错误 ,订单:已支付")
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (userOrder.getActualAmount().compareTo(backOrderExcel.getActualAmount()) != 0){
|
||||
log.error("第{}行错误 ,订单金额不一致", row);
|
||||
errorExcelList.add(
|
||||
new CommonImportUserBackOrderError()
|
||||
.setOrderNo(backOrderExcel.getOrderNo())
|
||||
.setAmount(backOrderExcel.getActualAmount())
|
||||
.setErrorMsg("第"+ row +"行错误 ,订单金额不一致")
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
boolean updated = commonUserOrderService.update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
|
||||
.set(CommonUserOrderEntity::getOrderStatus, OrderStatus.PAID.getCode())
|
||||
.set(CommonUserOrderEntity::getPaymentStatus, PaymentStatus.PAID.getCode())
|
||||
.set(CommonUserOrderEntity::getPaymentTime, new Date())
|
||||
.eq(CommonUserOrderEntity::getId, userOrder.getId())
|
||||
.eq(CommonUserOrderEntity::getPaymentType, 99)
|
||||
.eq(CommonUserOrderEntity::getOrderStatus, 0)
|
||||
.eq(CommonUserOrderEntity::getPaymentStatus, 0)
|
||||
.eq(CommonUserOrderEntity::getIsDeleted, 0)
|
||||
);
|
||||
if (!updated) {
|
||||
log.error("第{}行错误 ,订单号提交失败", row);
|
||||
errorExcelList.add(
|
||||
new CommonImportUserBackOrderError()
|
||||
.setOrderNo(backOrderExcel.getOrderNo())
|
||||
.setAmount(backOrderExcel.getActualAmount())
|
||||
.setErrorMsg("第"+ row +"行错误 ,订单号提交,请刷新重试")
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
userPointService.grantPointsByUserOrder(userOrder);
|
||||
|
||||
eventPublisher.publishEvent(new PaymentSuccessEvent(userOrder.getId(), userOrder.getUserId(), BusinessModule.SELF_OPERATED_MALL));
|
||||
|
||||
}
|
||||
|
||||
return errorExcelList;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -62,4 +64,5 @@ public interface CommonUserOrderMapper extends BaseMapper<CommonUserOrderEntity>
|
||||
*/
|
||||
List<CommonUserOrderExcel> exportOrder(@Param("ew") Wrapper<CommonUserOrderEntity> queryWrapper);
|
||||
|
||||
List<CommonUserOrderVO> selectOrderExcelList(Long userId, Date startDate, Date endDate);
|
||||
}
|
||||
|
||||
@@ -32,11 +32,18 @@
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="CommonUserOrderResultMap" type="org.springblade.modules.common.pojo.vo.CommonUserOrderVO">
|
||||
<id property="id" column="id"/>
|
||||
<result property="specs" column="specs" typeHandler="org.springblade.common.handler.PgJsonbTypeHandler"/>
|
||||
|
||||
<select id="selectOrderPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserOrderVO">
|
||||
select uo.*, bu.account as account
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectOrderPage" resultMap="CommonUserOrderResultMap">
|
||||
select uo.*, bu.account as account , mp.specs
|
||||
from user_order uo
|
||||
left join blade_user bu on uo.user_id = bu.id
|
||||
left join mall_product mp ON CAST(uo.item_code AS BIGINT) = mp.id
|
||||
where uo.is_deleted = 0
|
||||
<if test="order.id != null">
|
||||
and uo.id = #{order.id}
|
||||
@@ -53,6 +60,12 @@
|
||||
<if test="order.orderStatus != null">
|
||||
and uo.order_status = #{order.orderStatus}
|
||||
</if>
|
||||
|
||||
<if test="order.startDate != null">
|
||||
and uo.create_time >= #{order.startDate}
|
||||
and uo.create_time < #{order.endDate}
|
||||
</if>
|
||||
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@@ -69,4 +82,24 @@
|
||||
FROM user_order ${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectOrderExcelList" resultMap="CommonUserOrderResultMap">
|
||||
select uo.*, bu.account as account , mp.specs as specs
|
||||
from user_order uo
|
||||
left join blade_user bu on uo.user_id = bu.id
|
||||
left join mall_product mp ON CAST(uo.item_code AS BIGINT) = mp.id
|
||||
where uo.is_deleted = 0
|
||||
and uo.payment_status = 1
|
||||
|
||||
<if test="userId != null">
|
||||
and uo.user_id = #{userId}
|
||||
</if>
|
||||
|
||||
<if test="startDate != null">
|
||||
and uo.create_time >= #{startDate}
|
||||
and uo.create_time < #{endDate}
|
||||
</if>
|
||||
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.springblade.modules.common.mapper;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserSmsLogVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
public interface UserSmsLogMapper extends BaseMapper<UserSmsLogEntity> {
|
||||
public interface CommonUserSmsLogMapper extends BaseMapper<CommonUserSmsLogEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
@@ -21,6 +21,6 @@ public interface UserSmsLogMapper extends BaseMapper<UserSmsLogEntity> {
|
||||
* @param userSmsLog 查询参数
|
||||
* @return List<UserSmsLogVO>
|
||||
*/
|
||||
List<UserSmsLogVO> selectUserSmsLogPage(IPage page, UserSmsLogVO userSmsLog);
|
||||
List<CommonUserSmsLogVO> selectUserSmsLogPage(IPage page, CommonUserSmsLogVO userSmsLog);
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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="org.springblade.modules.common.mapper.UserSmsLogMapper">
|
||||
<mapper namespace="org.springblade.modules.common.mapper.CommonUserSmsLogMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="userSmsLogResultMap" type="org.springblade.modules.common.pojo.entity.UserSmsLogEntity">
|
||||
<resultMap id="userSmsLogResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="sms_type" property="smsType"/>
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.dto;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
@@ -38,7 +38,7 @@ import java.io.Serial;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserSmsLogDTO extends UserSmsLogEntity {
|
||||
public class CommonUserSmsLogDTO extends CommonUserSmsLogEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.io.Serial;
|
||||
@Schema(description = "UserSmsLog对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class UserSmsLogEntity extends BaseEntity {
|
||||
public class CommonUserSmsLogEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CommonImportUserBackOrderError implements Serializable {
|
||||
|
||||
private Long orderNo;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private String errorMsg;
|
||||
|
||||
|
||||
}
|
||||
@@ -25,13 +25,13 @@
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户订单 视图实体类
|
||||
@@ -86,4 +86,18 @@ public class CommonUserOrderVO implements Serializable {
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private List<CommonUserOrderVO.Spec> specs;
|
||||
|
||||
private List<String> searchDateRange;
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
|
||||
@Data
|
||||
public static class Spec implements Serializable {
|
||||
|
||||
private String attr;
|
||||
|
||||
private String value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户短信日志 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CommonUserSmsLogVO extends CommonUserSmsLogEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户短信日志 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserSmsLogVO extends UserSmsLogEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -37,6 +37,8 @@ import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||
import org.springblade.modules.common.excel.CommonUserOrderExcel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -55,7 +57,7 @@ public interface ICommonUserOrderService extends IService<CommonUserOrderEntity>
|
||||
*/
|
||||
IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order);
|
||||
|
||||
|
||||
List<CommonUserOrderVO> exportUserOrderToExcel(Long userId , Date startDate , Date endDate);
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.springblade.modules.common.service;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserSmsLogVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springblade.core.mp.base.BaseService;
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
public interface IUserSmsLogService extends BaseService<UserSmsLogEntity> {
|
||||
public interface ICommonUserSmsLogService extends BaseService<CommonUserSmsLogEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
@@ -19,7 +19,7 @@ public interface IUserSmsLogService extends BaseService<UserSmsLogEntity> {
|
||||
* @param userSmsLog 查询参数
|
||||
* @return IPage<UserSmsLogVO>
|
||||
*/
|
||||
IPage<UserSmsLogVO> selectUserSmsLogPage(IPage<UserSmsLogVO> page, UserSmsLogVO userSmsLog);
|
||||
IPage<CommonUserSmsLogVO> selectUserSmsLogPage(IPage<CommonUserSmsLogVO> page, CommonUserSmsLogVO userSmsLog);
|
||||
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.jsonwebtoken.lang.Assert;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.core.redis.debounce.RedisDebounce;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.modules.api.request.CreateOrderRequest;
|
||||
@@ -83,9 +84,24 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
|
||||
@Override
|
||||
public IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order) {
|
||||
|
||||
if (order.getSearchDateRange() != null){
|
||||
order.setStartDate(DateUtil.convertFromString(order.getSearchDateRange().get(0), "yyyy-MM-dd hh:mm:ss"));
|
||||
order.setEndDate(DateUtil.convertFromString(order.getSearchDateRange().get(1), "yyyy-MM-dd hh:mm:ss"));
|
||||
if (order.getStartDate().getTime() >= order.getEndDate().getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
}
|
||||
|
||||
return page.setRecords(baseMapper.selectOrderPage(page, order));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonUserOrderVO> exportUserOrderToExcel(Long userId , Date startDate , Date endDate) {
|
||||
|
||||
return baseMapper.selectOrderExcelList(userId, startDate , endDate);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CommonUserOrderExcel> exportOrder(Wrapper<CommonUserOrderEntity> queryWrapper) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserSmsLogVO;
|
||||
import org.springblade.modules.common.mapper.CommonUserSmsLogMapper;
|
||||
import org.springblade.modules.common.service.ICommonUserSmsLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
|
||||
/**
|
||||
* 用户短信日志 服务实现类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Service
|
||||
public class CommonUserSmsLogServiceImpl extends BaseServiceImpl<CommonUserSmsLogMapper, CommonUserSmsLogEntity> implements ICommonUserSmsLogService {
|
||||
|
||||
@Override
|
||||
public IPage<CommonUserSmsLogVO> selectUserSmsLogPage(IPage<CommonUserSmsLogVO> page, CommonUserSmsLogVO userSmsLog) {
|
||||
return page.setRecords(baseMapper.selectUserSmsLogPage(page, userSmsLog));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import org.springblade.modules.common.mapper.UserSmsLogMapper;
|
||||
import org.springblade.modules.common.service.IUserSmsLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
|
||||
/**
|
||||
* 用户短信日志 服务实现类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Service
|
||||
public class UserSmsLogServiceImpl extends BaseServiceImpl<UserSmsLogMapper, UserSmsLogEntity> implements IUserSmsLogService {
|
||||
|
||||
@Override
|
||||
public IPage<UserSmsLogVO> selectUserSmsLogPage(IPage<UserSmsLogVO> page, UserSmsLogVO userSmsLog) {
|
||||
return page.setRecords(baseMapper.selectUserSmsLogPage(page, userSmsLog));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.springblade.modules.common.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserSmsLogVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户短信日志 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
public class CommonUserSmsLogWrapper extends BaseEntityWrapper<CommonUserSmsLogEntity, CommonUserSmsLogVO> {
|
||||
|
||||
public static CommonUserSmsLogWrapper build() {
|
||||
return new CommonUserSmsLogWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonUserSmsLogVO entityVO(CommonUserSmsLogEntity userSmsLog) {
|
||||
CommonUserSmsLogVO userSmsLogVO = Objects.requireNonNull(BeanUtil.copyProperties(userSmsLog, CommonUserSmsLogVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(userSmsLog.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(userSmsLog.getUpdateUser());
|
||||
//userSmsLogVO.setCreateUserName(createUser.getName());
|
||||
//userSmsLogVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return userSmsLogVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户短信日志 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
public class UserSmsLogWrapper extends BaseEntityWrapper<UserSmsLogEntity, UserSmsLogVO> {
|
||||
|
||||
public static UserSmsLogWrapper build() {
|
||||
return new UserSmsLogWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserSmsLogVO entityVO(UserSmsLogEntity userSmsLog) {
|
||||
UserSmsLogVO userSmsLogVO = Objects.requireNonNull(BeanUtil.copyProperties(userSmsLog, UserSmsLogVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(userSmsLog.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(userSmsLog.getUpdateUser());
|
||||
//userSmsLogVO.setCreateUserName(createUser.getName());
|
||||
//userSmsLogVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return userSmsLogVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.springblade.modules.market.constant;
|
||||
|
||||
public interface BladeMarketConstant {
|
||||
|
||||
|
||||
String BENEFIT_PACK_ALLOCATE_NUMBER = "market.benefit.pack.allocate.number";
|
||||
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import org.springblade.modules.market.wrapper.MarketBenefitPackageWrapper;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@@ -110,5 +109,13 @@ public class MarketBenefitPackageController extends BladeController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/revokeBenefitPackInfo")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "后台划拨福利包撤回", description = "传入id")
|
||||
public R revokeBenefitPackInfo( @RequestParam Long id) {
|
||||
return R.status(userMarketBenefitPackageService.revokeBenefitPackInfo(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,13 +4,17 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.market.excel.MarketBenefitPackageLogExcel;
|
||||
import org.springblade.modules.market.manager.MarketUserManager;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageLogEntity;
|
||||
@@ -20,7 +24,7 @@ import org.springblade.modules.market.service.IMarketBenefitPackageLogService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,6 +40,7 @@ import java.util.Map;
|
||||
public class MarketBenefitPackageLogController extends BladeController {
|
||||
|
||||
private final IMarketBenefitPackageLogService userMarketBenefitPackageLogService;
|
||||
private final MarketUserManager marketUserManager;
|
||||
|
||||
/**
|
||||
* 划拨积分记录 详情
|
||||
@@ -110,5 +115,14 @@ public class MarketBenefitPackageLogController extends BladeController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/exportFlowToExcel")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出划拨福利包日志")
|
||||
public void exportFlowToExcel(@RequestParam String account , @RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<MarketBenefitPackageLogExcel> excelList = marketUserManager.exportBenefitPackageLogToExcel(account ,searchDateRange);
|
||||
ExcelUtil.export(response, "导出划拨福利包日志" + org.springblade.core.tool.utils.DateUtil.time(), "导出划拨福利包日志", excelList, MarketBenefitPackageLogExcel.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,13 +4,17 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.market.excel.MarketBenefitPointLogExcel;
|
||||
import org.springblade.modules.market.manager.MarketUserPointManager;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -19,6 +23,7 @@ import org.springblade.modules.market.wrapper.MarketBenefitPointLogWrapper;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -34,6 +39,7 @@ import java.util.Map;
|
||||
public class MarketBenefitPointLogController extends BladeController {
|
||||
|
||||
private final IMarketBenefitPointLogService marketBenefitPointLogService;
|
||||
private final MarketUserPointManager userPointManager;
|
||||
|
||||
/**
|
||||
* 用户福利值流水表 详情
|
||||
@@ -108,5 +114,16 @@ public class MarketBenefitPointLogController extends BladeController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/exportFlowToExcel")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出福利积分流水")
|
||||
public void exportFlowToExcel(@RequestParam String account , @RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<MarketBenefitPointLogExcel> excelList = userPointManager.exportBenefitPointToExcel(account ,searchDateRange);
|
||||
ExcelUtil.export(response, "福利积分流水日志" + org.springblade.core.tool.utils.DateUtil.time(), "福利积分流水日志", excelList, MarketBenefitPointLogExcel.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,13 +4,17 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.market.excel.MarketCashCouponLogExcel;
|
||||
import org.springblade.modules.market.manager.MarketUserPointManager;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -19,6 +23,7 @@ import org.springblade.modules.market.wrapper.MarketCashCouponLogWrapper;
|
||||
import org.springblade.modules.market.service.IMarketCashCouponLogService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -34,6 +39,7 @@ import java.util.Map;
|
||||
public class MarketCashCouponLogController extends BladeController {
|
||||
|
||||
private final IMarketCashCouponLogService marketCashCouponLogService;
|
||||
private final MarketUserPointManager userPointManager;
|
||||
|
||||
/**
|
||||
* 用户现金券流水表 详情
|
||||
@@ -107,6 +113,15 @@ public class MarketCashCouponLogController extends BladeController {
|
||||
return R.status(marketCashCouponLogService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@GetMapping("/exportFlowToExcel")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出现金券流水")
|
||||
public void exportFlowToExcel(@RequestParam String account , @RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<MarketCashCouponLogExcel> excelList = userPointManager.exportCashCouponToExcel(account ,searchDateRange);
|
||||
ExcelUtil.export(response, "现金券流水日志" + org.springblade.core.tool.utils.DateUtil.time(), "现金券流水日志", excelList, MarketCashCouponLogExcel.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.market.manager.MarketUserManager;
|
||||
import org.springblade.modules.market.pojo.vo.UserAllPointInfoVO;
|
||||
import org.springblade.modules.market.pojo.vo.UserBenefitPackCountVO;
|
||||
import org.springblade.modules.market.pojo.vo.UserMallSpendVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
@@ -44,6 +48,8 @@ import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||
import org.springblade.modules.market.wrapper.MarketInfoWrapper;
|
||||
import org.springblade.modules.market.service.IMarketInfoService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
/**
|
||||
* 用户拓展信息表 控制器
|
||||
@@ -58,6 +64,7 @@ import java.util.Map;
|
||||
public class MarketInfoController extends BladeController {
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final MarketUserManager marketUserManager;
|
||||
|
||||
/**
|
||||
* 用户拓展信息表 详情
|
||||
@@ -139,4 +146,29 @@ public class MarketInfoController extends BladeController {
|
||||
return R.status(temp);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/benefitPackCountByUser")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "用户福利包统计", description = "传入userId")
|
||||
public R<List<UserBenefitPackCountVO>> benefitPackCountByUser(@RequestParam Long userId) {
|
||||
return R.data(marketUserManager.benefitPackCountByUser(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/getUserPointInfo")
|
||||
@ApiOperationSupport(order = 10)
|
||||
@Operation(summary = "用户积分信息", description = "传入userId")
|
||||
public R<UserAllPointInfoVO> getUserPointInfo(@RequestParam Long userId) {
|
||||
return R.data(marketUserManager.getUserPointInfo(userId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getUserMallSpend")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "用户商城消费累计", description = "传入userId")
|
||||
public R<UserMallSpendVO> getUserMallSpend(@RequestParam Long userId) {
|
||||
return R.data(marketUserManager.getUserMallSpend(userId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,14 +4,18 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.market.excel.MarketUserCommissionLogExcel;
|
||||
import org.springblade.modules.market.manager.MarketUserPointManager;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionLogEntity;
|
||||
@@ -20,6 +24,7 @@ import org.springblade.modules.market.wrapper.MarketUserCommissionLogWrapper;
|
||||
import org.springblade.modules.market.service.IMarketUserCommissionLogService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -36,6 +41,7 @@ import java.util.Map;
|
||||
public class MarketUserCommissionLogController extends BladeController {
|
||||
|
||||
private final IMarketUserCommissionLogService userCommissionLogService;
|
||||
private final MarketUserPointManager userPointManager;
|
||||
|
||||
/**
|
||||
* 用户佣金流水表 详情
|
||||
@@ -109,5 +115,14 @@ public class MarketUserCommissionLogController extends BladeController {
|
||||
return R.status(userCommissionLogService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@GetMapping("/exportFlowToExcel")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出用户佣金流水")
|
||||
public void exportFlowToExcel(@RequestParam String account , @RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<MarketUserCommissionLogExcel> excelList = userPointManager.exportUserCommissionToExcel(account ,searchDateRange);
|
||||
ExcelUtil.export(response, "用户佣金流水日志" + org.springblade.core.tool.utils.DateUtil.time(), "用户佣金流水日志", excelList, MarketUserCommissionLogExcel.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.springblade.modules.market.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class MarketBenefitPackageLogExcel implements Serializable {
|
||||
|
||||
@ExcelProperty("账号")
|
||||
private String phone;
|
||||
|
||||
@ExcelProperty("福利包名称")
|
||||
private String packageName;
|
||||
|
||||
@ExcelProperty("数量数量")
|
||||
private Integer giveNumber;
|
||||
|
||||
|
||||
@ExcelProperty("福利包来源")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("统计时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.springblade.modules.market.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class MarketBenefitPointLogExcel implements Serializable {
|
||||
|
||||
@ExcelProperty("账号")
|
||||
private String account;
|
||||
|
||||
@ExcelProperty("金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ExcelProperty("上一笔金额")
|
||||
private BigDecimal lastAmount;
|
||||
|
||||
@ExcelProperty("手续费")
|
||||
private BigDecimal fee;
|
||||
|
||||
@ExcelProperty("收入/支出")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("统计时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.springblade.modules.market.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class MarketCashCouponLogExcel implements Serializable {
|
||||
|
||||
@ExcelProperty("账号")
|
||||
private String account;
|
||||
|
||||
@ExcelProperty("金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ExcelProperty("上一笔金额")
|
||||
private BigDecimal lastAmount;
|
||||
|
||||
|
||||
@ExcelProperty("收入/支出")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("统计时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.springblade.modules.market.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class MarketUserCommissionLogExcel implements Serializable {
|
||||
|
||||
@ExcelProperty("账号")
|
||||
private String account;
|
||||
|
||||
@ExcelProperty("金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ExcelProperty("上一笔金额")
|
||||
private BigDecimal lastAmount;
|
||||
|
||||
|
||||
@ExcelProperty("收入/支出")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("统计时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -12,17 +12,25 @@ import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
||||
|
||||
import org.springblade.modules.api.vo.MarketPackageTemplateVO;
|
||||
import org.springblade.modules.api.vo.UserAssetsApiVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.common.service.ICommonUserPointService;
|
||||
import org.springblade.modules.market.convert.MarketUserMarketBenefitPackageConvert;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.excel.MarketBenefitPackageLogExcel;
|
||||
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
|
||||
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
|
||||
import org.springblade.modules.market.pojo.entity.*;
|
||||
import org.springblade.modules.market.pojo.vo.UserAllPointInfoVO;
|
||||
import org.springblade.modules.market.pojo.vo.UserBenefitPackCountVO;
|
||||
import org.springblade.modules.market.pojo.vo.UserMallSpendVO;
|
||||
import org.springblade.modules.market.service.*;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -44,6 +52,10 @@ public class MarketUserManager {
|
||||
private final IMarketCashCouponService marketCashCouponService;
|
||||
private final IMarketUserCommissionService commissionService;
|
||||
|
||||
private final ICommonUserPointService commonUserPointService;
|
||||
|
||||
private final ICommonUserOrderService commonUserOrderService;
|
||||
|
||||
public List<MarketDirectInfoApiVO> findUserPackList() {
|
||||
Long userId = AuthUtil.getUserId();
|
||||
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||
@@ -238,6 +250,12 @@ public class MarketUserManager {
|
||||
throw new RuntimeException("记录福利包日志失败");
|
||||
}
|
||||
|
||||
//todo 给上级赠送 10% 的福利积分
|
||||
// 是否开启给上级返佣
|
||||
// 获取返佣比例
|
||||
// 获取上级
|
||||
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -268,4 +286,121 @@ public class MarketUserManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<UserBenefitPackCountVO> benefitPackCountByUser(Long userId) {
|
||||
|
||||
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||
|
||||
List<UserBenefitPackCountVO> benefitPackCountList = new ArrayList<>();
|
||||
|
||||
List<MarketBenefitPackageTemplateEntity> templateEntityList = benefitPackageTemplateService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageTemplateEntity.class)
|
||||
.orderByAsc(MarketBenefitPackageTemplateEntity::getId)
|
||||
);
|
||||
|
||||
List<MarketBenefitPackageEntity> packageEntityList = benefitPackageService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
|
||||
.select(MarketBenefitPackageEntity::getPackageId)
|
||||
.eq(MarketBenefitPackageEntity::getUserId, userId)
|
||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||
.orderByDesc(MarketBenefitPackageEntity::getId)
|
||||
);
|
||||
|
||||
templateEntityList.forEach(templateEntity -> {
|
||||
|
||||
long count = packageEntityList.stream().filter(packageEntity -> packageEntity.getPackageId().equals(templateEntity.getId())).count();
|
||||
|
||||
benefitPackCountList.add(
|
||||
new UserBenefitPackCountVO()
|
||||
.setPackName(templateEntity.getPackageName())
|
||||
.setCount(count)
|
||||
);
|
||||
});
|
||||
|
||||
return benefitPackCountList;
|
||||
}
|
||||
|
||||
public UserAllPointInfoVO getUserPointInfo(Long userId) {
|
||||
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||
UserAllPointInfoVO userAllPointInfo = new UserAllPointInfoVO();
|
||||
|
||||
userAllPointInfo.setUserPoint(commonUserPointService.getById(userId).getAmount());
|
||||
userAllPointInfo.setBenefitPoint(marketBenefitPointService.getById(userId).getAmount());
|
||||
userAllPointInfo.setCashCoupon(marketCashCouponService.getById(userId).getAmount());
|
||||
userAllPointInfo.setUserPoint(commissionService.getById(userId).getAmount());
|
||||
|
||||
return userAllPointInfo;
|
||||
|
||||
}
|
||||
|
||||
public UserMallSpendVO getUserMallSpend(Long userId) {
|
||||
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||
|
||||
List<CommonUserOrderEntity> list = commonUserOrderService.list(
|
||||
Wrappers.lambdaQuery(CommonUserOrderEntity.class)
|
||||
.eq(CommonUserOrderEntity::getUserId, userId)
|
||||
.eq(CommonUserOrderEntity::getPaymentStatus, 1)
|
||||
.orderByDesc(CommonUserOrderEntity::getId)
|
||||
);
|
||||
if (list.isEmpty()){
|
||||
return new UserMallSpendVO();
|
||||
}
|
||||
|
||||
BigDecimal totalAmount = list.stream().map(CommonUserOrderEntity::getActualAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
return new UserMallSpendVO().setAmount(totalAmount);
|
||||
|
||||
}
|
||||
|
||||
public List<MarketBenefitPackageLogExcel> exportBenefitPackageLogToExcel(String account, List<String> searchDateRange) {
|
||||
Assert.isTrue(StringUtils.hasLength(account), "请选择账号");
|
||||
|
||||
User user = userService.getOne(
|
||||
Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getAccount, account)
|
||||
);
|
||||
Assert.notNull(user, "账号不存在");
|
||||
Date startDate = null ;
|
||||
Date endDate = null ;
|
||||
if (searchDateRange == null){
|
||||
throw new RuntimeException("请选择时间范围");
|
||||
}
|
||||
|
||||
startDate = DateUtil.convertFromString(searchDateRange.get(0), "yyyy-MM-dd hh:mm:ss");
|
||||
endDate = DateUtil.convertFromString(searchDateRange.get(1), "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
if (startDate.getTime() >=endDate.getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
List<MarketBenefitPackageLogEntity> pointLogList = benefitPackageLogService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageLogEntity.class)
|
||||
.eq(MarketBenefitPackageLogEntity::getUserId, user.getId())
|
||||
.ge(MarketBenefitPackageLogEntity::getCreateTime, startDate)
|
||||
.lt(MarketBenefitPackageLogEntity::getCreateTime, endDate)
|
||||
.orderByDesc(MarketBenefitPackageLogEntity::getCreateTime)
|
||||
);
|
||||
|
||||
List<MarketBenefitPackageLogExcel> excelList = new ArrayList<>();
|
||||
|
||||
pointLogList.forEach(pointLog -> {
|
||||
|
||||
MarketBenefitPackageLogExcel pointLogExcel = new MarketBenefitPackageLogExcel();
|
||||
|
||||
pointLogExcel.setPhone(user.getAccount());
|
||||
pointLogExcel.setPackageName(pointLog.getPackageName());
|
||||
pointLogExcel.setGiveNumber(pointLog.getGiveNumber());
|
||||
pointLogExcel.setType(pointLog.getType() == 1 ? "积分兑换" : "后台划拨");
|
||||
pointLogExcel.setCreateTime(pointLog.getCreateTime());
|
||||
pointLogExcel.setRemark(pointLog.getRemark());
|
||||
|
||||
excelList.add(pointLogExcel);
|
||||
|
||||
});
|
||||
|
||||
return excelList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.modules.api.vo.MarketUserBenefitPointLogVO;
|
||||
import org.springblade.modules.api.vo.MarketUserCashCouponLogVO;
|
||||
import org.springblade.modules.api.vo.MarketUserCommissionLogVO;
|
||||
import org.springblade.modules.market.convert.MarketUserMarketInfoConvert;
|
||||
import org.springblade.modules.market.excel.MarketBenefitPointLogExcel;
|
||||
import org.springblade.modules.market.excel.MarketCashCouponLogExcel;
|
||||
import org.springblade.modules.market.excel.MarketUserCommissionLogExcel;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionLogEntity;
|
||||
@@ -22,8 +26,12 @@ import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@@ -106,4 +114,164 @@ public class MarketUserPointManager {
|
||||
return pageResult.convert(MarketUserMarketInfoConvert.INSTANCE::convertMarketUserCommissionLogVO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<MarketBenefitPointLogExcel> exportBenefitPointToExcel(String account , List<String> searchDateRange) {
|
||||
|
||||
Assert.isTrue(StringUtils.hasLength(account), "请选择账号");
|
||||
|
||||
User user = userService.getOne(
|
||||
Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getAccount, account)
|
||||
);
|
||||
Assert.notNull(user, "账号不存在");
|
||||
Date startDate = null ;
|
||||
Date endDate = null ;
|
||||
if (searchDateRange == null){
|
||||
throw new RuntimeException("请选择时间范围");
|
||||
}
|
||||
|
||||
startDate = DateUtil.convertFromString(searchDateRange.get(0), "yyyy-MM-dd hh:mm:ss");
|
||||
endDate = DateUtil.convertFromString(searchDateRange.get(1), "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
if (startDate.getTime() >=endDate.getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
List<MarketBenefitPointLogEntity> pointLogList = marketBenefitPointLogService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPointLogEntity.class)
|
||||
.eq(MarketBenefitPointLogEntity::getIsComplete, 1)
|
||||
.eq(MarketBenefitPointLogEntity::getUserId, user.getId())
|
||||
.ge(MarketBenefitPointLogEntity::getCreateTime, startDate)
|
||||
.lt(MarketBenefitPointLogEntity::getCreateTime, endDate)
|
||||
.orderByDesc(MarketBenefitPointLogEntity::getCreateTime)
|
||||
);
|
||||
|
||||
List<MarketBenefitPointLogExcel> excelList = new ArrayList<>();
|
||||
|
||||
pointLogList.forEach(pointLog -> {
|
||||
|
||||
MarketBenefitPointLogExcel pointLogExcel = new MarketBenefitPointLogExcel();
|
||||
|
||||
pointLogExcel.setAccount(user.getAccount());
|
||||
pointLogExcel.setAmount(pointLog.getAmount());
|
||||
pointLogExcel.setLastAmount(pointLog.getLastAmount());
|
||||
pointLogExcel.setFee(pointLog.getFee());
|
||||
pointLogExcel.setType(pointLog.getType() == 1 ? "收入" : "支出");
|
||||
pointLogExcel.setCreateTime(pointLog.getCreateTime());
|
||||
pointLogExcel.setRemark(pointLog.getRemark());
|
||||
|
||||
excelList.add(pointLogExcel);
|
||||
|
||||
|
||||
});
|
||||
|
||||
return excelList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<MarketCashCouponLogExcel> exportCashCouponToExcel(String account, List<String> searchDateRange) {
|
||||
|
||||
Assert.isTrue(StringUtils.hasLength(account), "请选择账号");
|
||||
|
||||
User user = userService.getOne(
|
||||
Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getAccount, account)
|
||||
);
|
||||
Assert.notNull(user, "账号不存在");
|
||||
Date startDate = null ;
|
||||
Date endDate = null ;
|
||||
if (searchDateRange == null){
|
||||
throw new RuntimeException("请选择时间范围");
|
||||
}
|
||||
|
||||
startDate = DateUtil.convertFromString(searchDateRange.get(0), "yyyy-MM-dd hh:mm:ss");
|
||||
endDate = DateUtil.convertFromString(searchDateRange.get(1), "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
if (startDate.getTime() >=endDate.getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
List<MarketCashCouponLogEntity> pointLogList = marketCashCouponLogService.list(
|
||||
Wrappers.lambdaQuery(MarketCashCouponLogEntity.class)
|
||||
.eq(MarketCashCouponLogEntity::getIsComplete, 1)
|
||||
.eq(MarketCashCouponLogEntity::getUserId, user.getId())
|
||||
.ge(MarketCashCouponLogEntity::getCreateTime, startDate)
|
||||
.lt(MarketCashCouponLogEntity::getCreateTime, endDate)
|
||||
.orderByDesc(MarketCashCouponLogEntity::getCreateTime)
|
||||
);
|
||||
|
||||
List<MarketCashCouponLogExcel> excelList = new ArrayList<>();
|
||||
|
||||
pointLogList.forEach(pointLog -> {
|
||||
|
||||
MarketCashCouponLogExcel pointLogExcel = new MarketCashCouponLogExcel();
|
||||
|
||||
pointLogExcel.setAccount(user.getAccount());
|
||||
pointLogExcel.setAmount(pointLog.getAmount());
|
||||
pointLogExcel.setLastAmount(pointLog.getLastAmount());
|
||||
pointLogExcel.setType(pointLog.getType() == 1 ? "收入" : "支出");
|
||||
pointLogExcel.setCreateTime(pointLog.getCreateTime());
|
||||
pointLogExcel.setRemark(pointLog.getRemark());
|
||||
|
||||
excelList.add(pointLogExcel);
|
||||
|
||||
});
|
||||
|
||||
return excelList;
|
||||
|
||||
}
|
||||
|
||||
public List<MarketUserCommissionLogExcel> exportUserCommissionToExcel(String account, List<String> searchDateRange) {
|
||||
|
||||
Assert.isTrue(StringUtils.hasLength(account), "请选择账号");
|
||||
|
||||
User user = userService.getOne(
|
||||
Wrappers.lambdaQuery(User.class)
|
||||
.eq(User::getAccount, account)
|
||||
);
|
||||
Assert.notNull(user, "账号不存在");
|
||||
Date startDate = null ;
|
||||
Date endDate = null ;
|
||||
if (searchDateRange == null){
|
||||
throw new RuntimeException("请选择时间范围");
|
||||
}
|
||||
|
||||
startDate = DateUtil.convertFromString(searchDateRange.get(0), "yyyy-MM-dd hh:mm:ss");
|
||||
endDate = DateUtil.convertFromString(searchDateRange.get(1), "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
if (startDate.getTime() >=endDate.getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
List<MarketUserCommissionLogEntity> pointLogList = marketUserCommissionLogService.list(
|
||||
Wrappers.lambdaQuery(MarketUserCommissionLogEntity.class)
|
||||
.eq(MarketUserCommissionLogEntity::getIsComplete, 1)
|
||||
.eq(MarketUserCommissionLogEntity::getUserId, user.getId())
|
||||
.ge(MarketUserCommissionLogEntity::getCreateTime, startDate)
|
||||
.lt(MarketUserCommissionLogEntity::getCreateTime, endDate)
|
||||
.orderByDesc(MarketUserCommissionLogEntity::getCreateTime)
|
||||
);
|
||||
|
||||
List<MarketUserCommissionLogExcel> excelList = new ArrayList<>();
|
||||
|
||||
pointLogList.forEach(pointLog -> {
|
||||
|
||||
MarketUserCommissionLogExcel pointLogExcel = new MarketUserCommissionLogExcel();
|
||||
|
||||
pointLogExcel.setAccount(user.getAccount());
|
||||
pointLogExcel.setAmount(pointLog.getAmount());
|
||||
pointLogExcel.setLastAmount(pointLog.getLastAmount());
|
||||
pointLogExcel.setType(pointLog.getType() == 1 ? "收入" : "支出");
|
||||
pointLogExcel.setCreateTime(pointLog.getCreateTime());
|
||||
pointLogExcel.setRemark(pointLog.getRemark());
|
||||
|
||||
excelList.add(pointLogExcel);
|
||||
|
||||
});
|
||||
|
||||
return excelList;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ public interface MarketBenefitPackageLogMapper extends BaseMapper<MarketBenefitP
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param userMarketBenefitPackageLog 查询参数
|
||||
* @param packLog 查询参数
|
||||
* @return List<UserMarketBenefitPackageLogVO>
|
||||
*/
|
||||
List<MarketBenefitPackageLogVO> selectUserMarketBenefitPackageLogPage(IPage page, MarketBenefitPackageLogVO userMarketBenefitPackageLog);
|
||||
List<MarketBenefitPackageLogVO> selectUserMarketBenefitPackageLogPage(IPage page, MarketBenefitPackageLogVO packLog);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,20 @@
|
||||
|
||||
|
||||
<select id="selectUserMarketBenefitPackageLogPage" resultMap="userMarketBenefitPackageLogResultMap">
|
||||
select * from user_market_benefit_package_log where is_deleted = 0
|
||||
select
|
||||
*
|
||||
from user_market_benefit_package_log
|
||||
where is_deleted = 0
|
||||
<if test="packLog.phone != null">
|
||||
and phone = #{packLog.phone}
|
||||
</if>
|
||||
|
||||
<if test="packLog.startDate != null">
|
||||
and statistical_date >= #{packLog.startDate}
|
||||
and statistical_date < #{packLog.endDate}
|
||||
</if>
|
||||
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
<if test="pointLog.account != null">
|
||||
and bu.account = #{pointLog.account}
|
||||
</if>
|
||||
|
||||
<if test="pointLog.startDate != null">
|
||||
and bpl.statistical_date >= #{pointLog.startDate}
|
||||
and bpl.statistical_date < #{pointLog.endDate}
|
||||
</if>
|
||||
|
||||
order by bpl.id desc
|
||||
</select>
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.springblade.modules.market.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@@ -48,4 +49,6 @@ public interface MarketInfoMapper extends BaseMapper<MarketInfoEntity> {
|
||||
*/
|
||||
List<MarketInfoVO> selectMarketInfoPage(IPage page, MarketInfoVO marketInfo);
|
||||
|
||||
List<Long> selectAncestorIds(@Param("userId") Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -28,4 +28,37 @@
|
||||
order by bu.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAncestorIds" resultType="java.lang.Long">
|
||||
WITH RECURSIVE referral_ancestors AS (
|
||||
-- 锚点:获取当前用户的直接父级
|
||||
SELECT
|
||||
umi.id,
|
||||
umi.pid,
|
||||
1 AS depth
|
||||
FROM user_market_info umi
|
||||
WHERE umi.id = (
|
||||
SELECT pid
|
||||
FROM user_market_info
|
||||
WHERE id = #{userId}
|
||||
)
|
||||
AND umi.is_deleted = 0
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- 递归:向上追溯
|
||||
SELECT
|
||||
u.id,
|
||||
u.pid,
|
||||
ra.depth + 1
|
||||
FROM user_market_info u
|
||||
INNER JOIN referral_ancestors ra ON u.id = ra.pid
|
||||
WHERE ra.depth < 350
|
||||
AND u.is_deleted = 0
|
||||
)
|
||||
SELECT id
|
||||
FROM referral_ancestors
|
||||
ORDER BY depth
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -79,7 +79,6 @@ public class MarketBenefitPointLogEntity extends BaseEntity {
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "统计时间")
|
||||
private Date statisticalDate;
|
||||
/**
|
||||
* 备注
|
||||
|
||||
@@ -1,28 +1,3 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -32,7 +7,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
@@ -46,7 +21,7 @@ import java.io.Serial;
|
||||
@Schema(description = "UserCommissionLog对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class MarketUserCommissionLogEntity extends TenantEntity {
|
||||
public class MarketUserCommissionLogEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -1,34 +1,11 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageLogEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 划拨积分记录 视图实体类
|
||||
@@ -42,4 +19,8 @@ public class MarketBenefitPackageLogVO extends MarketBenefitPackageLogEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<String> searchDateRange;
|
||||
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
}
|
||||
|
||||
@@ -1,34 +1,12 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户福利值流水表 视图实体类
|
||||
@@ -44,4 +22,9 @@ public class MarketBenefitPointLogVO extends MarketBenefitPointLogEntity {
|
||||
|
||||
private String account;
|
||||
|
||||
private List<String> searchDateRange;
|
||||
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserAllPointInfoVO implements Serializable {
|
||||
|
||||
private BigDecimal userPoint = BigDecimal.ZERO;
|
||||
private BigDecimal benefitPoint = BigDecimal.ZERO;
|
||||
private BigDecimal cashCoupon = BigDecimal.ZERO;
|
||||
private BigDecimal userCommission = BigDecimal.ZERO;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserBenefitPackCountVO implements Serializable {
|
||||
|
||||
private String packName;
|
||||
private Long count;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserMallSpendVO implements Serializable {
|
||||
|
||||
private BigDecimal amount = BigDecimal.ZERO;
|
||||
|
||||
|
||||
}
|
||||
@@ -25,4 +25,6 @@ public interface IMarketBenefitPackageService extends BaseService<MarketBenefitP
|
||||
|
||||
|
||||
IPage<org.springblade.modules.api.vo.MarketBenefitPackageVO> findUserPackList(IPage<MarketBenefitPackageEntity> page, org.springblade.modules.api.vo.MarketBenefitPackageVO userMarketBenefitPackage , Long userId);
|
||||
|
||||
boolean revokeBenefitPackInfo(Long id);
|
||||
}
|
||||
|
||||
@@ -22,5 +22,4 @@ public interface IMarketBenefitPointLogService extends BaseService<MarketBenefit
|
||||
IPage<MarketBenefitPointLogVO> selectCommonBenefitPointLogPage(IPage<MarketBenefitPointLogVO> page, MarketBenefitPointLogVO commonBenefitPointLog);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户拓展信息表 服务类
|
||||
*
|
||||
@@ -50,4 +52,6 @@ public interface IMarketInfoService extends BaseService<MarketInfoEntity> {
|
||||
boolean initInfo(User user, User invitor);
|
||||
|
||||
boolean resetPassword(String userIds);
|
||||
|
||||
List<Long> selectAncestorIds(Long userId);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageLogVO;
|
||||
import org.springblade.modules.market.mapper.MarketBenefitPackageLogMapper;
|
||||
@@ -18,8 +19,17 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
public class MarketBenefitPackageLogServiceImpl extends BaseServiceImpl<MarketBenefitPackageLogMapper, MarketBenefitPackageLogEntity> implements IMarketBenefitPackageLogService {
|
||||
|
||||
@Override
|
||||
public IPage<MarketBenefitPackageLogVO> selectUserMarketBenefitPackageLogPage(IPage<MarketBenefitPackageLogVO> page, MarketBenefitPackageLogVO userMarketBenefitPackageLog) {
|
||||
return page.setRecords(baseMapper.selectUserMarketBenefitPackageLogPage(page, userMarketBenefitPackageLog));
|
||||
public IPage<MarketBenefitPackageLogVO> selectUserMarketBenefitPackageLogPage(IPage<MarketBenefitPackageLogVO> page, MarketBenefitPackageLogVO userBenefitPackLog) {
|
||||
|
||||
if (userBenefitPackLog.getSearchDateRange() != null){
|
||||
userBenefitPackLog.setStartDate(DateUtil.convertFromString(userBenefitPackLog.getSearchDateRange().get(0), "yyyy-MM-dd hh:mm:ss"));
|
||||
userBenefitPackLog.setEndDate(DateUtil.convertFromString(userBenefitPackLog.getSearchDateRange().get(1), "yyyy-MM-dd hh:mm:ss"));
|
||||
if (userBenefitPackLog.getStartDate().getTime() >= userBenefitPackLog.getEndDate().getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
}
|
||||
|
||||
return page.setRecords(baseMapper.selectUserMarketBenefitPackageLogPage(page, userBenefitPackLog));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.modules.market.convert.MarketUserMarketBenefitPackageConvert;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageVO;
|
||||
import org.springblade.modules.market.mapper.MarketBenefitPackageMapper;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageLogService;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -18,7 +24,9 @@ import java.util.Objects;
|
||||
* @since 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MarketBenefitPackageServiceImpl extends BaseServiceImpl<MarketBenefitPackageMapper, MarketBenefitPackageEntity> implements IMarketBenefitPackageService {
|
||||
private final IMarketBenefitPackageLogService marketBenefitPackageLogService;
|
||||
|
||||
@Override
|
||||
public IPage<MarketBenefitPackageVO> selectUserMarketBenefitPackagePage(IPage<MarketBenefitPackageVO> page, MarketBenefitPackageVO userMarketBenefitPackage) {
|
||||
@@ -41,4 +49,30 @@ public class MarketBenefitPackageServiceImpl extends BaseServiceImpl<MarketBenef
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
@Override
|
||||
public boolean revokeBenefitPackInfo(Long id) {
|
||||
MarketBenefitPackageEntity benefitPackage = getById(id);
|
||||
Assert.notNull(benefitPackage , "未找到该用户积分包信息");
|
||||
|
||||
Assert.isTrue(benefitPackage.getType() == 2 , "只允许后台划拨的福利包撤回");
|
||||
Assert.isTrue(benefitPackage.getStatus() == 2 , "福利包未激活或已完成");
|
||||
Assert.isTrue(benefitPackage.getOutDay() <= 0 , "该福利包已经开始产出 , 不能撤回");
|
||||
|
||||
MarketBenefitPackageLogEntity benefitPackageLog = marketBenefitPackageLogService.getOne(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageLogEntity.class)
|
||||
.eq(MarketBenefitPackageLogEntity::getUserPackageId, benefitPackage.getPackageId())
|
||||
.eq(MarketBenefitPackageLogEntity::getUserId, benefitPackage.getUserId())
|
||||
.orderByDesc(MarketBenefitPackageLogEntity::getId)
|
||||
.last("limit 1")
|
||||
|
||||
);
|
||||
|
||||
if (!removeById( id) || !marketBenefitPackageLogService.removeById(benefitPackageLog.getId())){
|
||||
throw new RuntimeException("撤回失败");
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.cache.ParamCache;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.modules.market.constant.BladeMarketConstant;
|
||||
import org.springblade.modules.market.pojo.vo.MarketImportBenefitPackageError;
|
||||
import org.springblade.modules.market.excel.BenefitPackageExcel;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
||||
@@ -24,6 +27,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -56,6 +60,11 @@ public class MarketBenefitPackageTemplateServiceImpl extends BaseServiceImpl<Mar
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
@Override
|
||||
public boolean allocatePackToUser(AllocatePackRequest request) {
|
||||
Assert.notNull(request.getPackId(), "福利包必选");
|
||||
Assert.notNull(request.getPhone(), "账号必填");
|
||||
Assert.notNull(request.getGiveNumber(), "数量必填");
|
||||
Assert.isTrue(StringUtils.hasLength(request.getRemark()), "备注必填");
|
||||
Assert.isTrue(request.getRemark().length() >= 6, "备注不少于6个字");
|
||||
|
||||
MarketBenefitPackageTemplateEntity packageTemplate = getById(request.getPackId());
|
||||
Assert.notNull(packageTemplate, "请选择正确的积分包");
|
||||
@@ -67,6 +76,28 @@ public class MarketBenefitPackageTemplateServiceImpl extends BaseServiceImpl<Mar
|
||||
Assert.notNull(user, "手机号不存在或已注销");
|
||||
|
||||
|
||||
Map<Long , Long> allocatePackNumberMap = JSONObject.parseObject(ParamCache.getValue(BladeMarketConstant.BENEFIT_PACK_ALLOCATE_NUMBER), new TypeReference<Map<Long, Long>>() {});
|
||||
|
||||
long packCount = userMarketBenefitPackageService.count(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
|
||||
.eq(MarketBenefitPackageEntity::getUserId, user.getId())
|
||||
.eq(MarketBenefitPackageEntity::getType, 2)
|
||||
.eq(MarketBenefitPackageEntity::getPackageId, packageTemplate.getId())
|
||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||
|
||||
);
|
||||
|
||||
if (packCount >= allocatePackNumberMap.get(packageTemplate.getId())){
|
||||
throw new RuntimeException(packageTemplate.getPackageName() + "已划拨数量达到上限:" + allocatePackNumberMap.get(packageTemplate.getId()) + "个");
|
||||
}
|
||||
|
||||
long canAllocatePackNumber = allocatePackNumberMap.get(packageTemplate.getId()) - packCount;
|
||||
|
||||
if (( canAllocatePackNumber ) < request.getGiveNumber()) {
|
||||
throw new RuntimeException(packageTemplate.getPackageName() + "剩余划拨数量:" + canAllocatePackNumber + "个");
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < request.getGiveNumber(); i++){
|
||||
MarketBenefitPackageEntity userPackageInfo = createUserPackageInfo(user ,packageTemplate, request.getRemark());
|
||||
if(!userMarketBenefitPackageService.save(userPackageInfo)){
|
||||
@@ -104,6 +135,8 @@ public class MarketBenefitPackageTemplateServiceImpl extends BaseServiceImpl<Mar
|
||||
benefitPackageExcelMap.put("1000" , 2019440172115402754L);
|
||||
benefitPackageExcelMap.put("10000" , 2019440263022747650L);
|
||||
|
||||
Map<Long , Long> allocatePackNumberMap = JSONObject.parseObject(ParamCache.getValue(BladeMarketConstant.BENEFIT_PACK_ALLOCATE_NUMBER), new TypeReference<Map<Long, Long>>() {});
|
||||
|
||||
// list to map
|
||||
Map<Long, MarketBenefitPackageTemplateEntity> benefitPackageTemplateMap = list()
|
||||
.stream()
|
||||
@@ -157,6 +190,7 @@ public class MarketBenefitPackageTemplateServiceImpl extends BaseServiceImpl<Mar
|
||||
}
|
||||
|
||||
Long packTemplateId = benefitPackageExcelMap.get(benefitPackageExcel.getBenefitPackage());
|
||||
MarketBenefitPackageTemplateEntity packageTemplate = benefitPackageTemplateMap.get(packTemplateId);
|
||||
|
||||
if (!benefitPackageTemplateMap.containsKey(packTemplateId)){
|
||||
log.error("第{}行, 福利包选择错误", row);
|
||||
@@ -172,23 +206,24 @@ public class MarketBenefitPackageTemplateServiceImpl extends BaseServiceImpl<Mar
|
||||
long benefitPackageCount = userMarketBenefitPackageService.count(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
|
||||
.eq(MarketBenefitPackageEntity::getUserId, user.getId())
|
||||
.in(MarketBenefitPackageEntity::getPackageId, List.of(2019440172115402754L ,2019440263022747650L))
|
||||
.eq(MarketBenefitPackageEntity::getPackageId, packTemplateId)
|
||||
.eq(MarketBenefitPackageEntity::getRemark, "后台批量划拨")
|
||||
|
||||
);
|
||||
|
||||
if (benefitPackageCount > 0){
|
||||
log.error("第{}行错误 ,该用户已存在该福利包", row);
|
||||
if (benefitPackageCount >= allocatePackNumberMap.get(packageTemplate.getId())){
|
||||
|
||||
log.error("第{}行错误: {} ,已划拨数量达到上限: {} 个" ,row, packageTemplate.getPackageName() ,allocatePackNumberMap.get(packageTemplate.getId()));
|
||||
errorExcelList.add(
|
||||
new MarketImportBenefitPackageError()
|
||||
.setAccount(benefitPackageExcel.getAccount())
|
||||
.setBenefitPackage(benefitPackageExcel.getBenefitPackage())
|
||||
.setErrorMsg("第"+ row +"行错误 ,该用户已存在该福利包")
|
||||
.setErrorMsg("第"+ row +"行错误: " + packageTemplate.getPackageName() + "已划拨数量达到上限:" + allocatePackNumberMap.get(packageTemplate.getId()) + "个")
|
||||
);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
MarketBenefitPackageTemplateEntity packageTemplate = benefitPackageTemplateMap.get(packTemplateId);
|
||||
|
||||
MarketBenefitPackageEntity userPackageInfo = createUserPackageInfo(user ,packageTemplate, "后台批量划拨");
|
||||
if(!userMarketBenefitPackageService.save(userPackageInfo)){
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBenefitPointLogVO;
|
||||
import org.springblade.modules.market.mapper.MarketBenefitPointLogMapper;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
@@ -15,10 +18,20 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
* @since 2026-02-12
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MarketBenefitPointLogServiceImpl extends BaseServiceImpl<MarketBenefitPointLogMapper, MarketBenefitPointLogEntity> implements IMarketBenefitPointLogService {
|
||||
|
||||
private final IUserService userService;
|
||||
|
||||
@Override
|
||||
public IPage<MarketBenefitPointLogVO> selectCommonBenefitPointLogPage(IPage<MarketBenefitPointLogVO> page, MarketBenefitPointLogVO commonBenefitPointLog) {
|
||||
if (commonBenefitPointLog.getSearchDateRange() != null){
|
||||
commonBenefitPointLog.setStartDate(DateUtil.convertFromString(commonBenefitPointLog.getSearchDateRange().get(0), "yyyy-MM-dd hh:mm:ss"));
|
||||
commonBenefitPointLog.setEndDate(DateUtil.convertFromString(commonBenefitPointLog.getSearchDateRange().get(1), "yyyy-MM-dd hh:mm:ss"));
|
||||
if (commonBenefitPointLog.getStartDate().getTime() >= commonBenefitPointLog.getEndDate().getTime()){
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
}
|
||||
return page.setRecords(baseMapper.selectCommonBenefitPointLogPage(page, commonBenefitPointLog));
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD;
|
||||
@@ -115,4 +116,9 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
||||
return userService.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toLongList(userIds)).eq(User::getUserType, UserType.APP.getCategory()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectAncestorIds(Long userId) {
|
||||
return this.baseMapper.selectAncestorIds(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springblade.core.oauth2.props.OAuth2Properties;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tenant.BladeTenantProperties;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.jackson.JsonUtil;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
@@ -33,8 +32,8 @@ import org.springblade.core.tool.utils.*;
|
||||
import org.springblade.modules.api.request.ForgetPwdSmsRequest;
|
||||
import org.springblade.modules.api.request.ResetPasswordRequest;
|
||||
import org.springblade.modules.auth.provider.UserType;
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.service.IUserSmsLogService;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserSmsLogEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserSmsLogService;
|
||||
import org.springblade.modules.resource.utils.AliyunDynpsService;
|
||||
import org.springblade.modules.system.excel.UserExcel;
|
||||
import org.springblade.modules.system.mapper.UserMapper;
|
||||
@@ -47,15 +46,11 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static org.springblade.common.constant.CommonConstant.*;
|
||||
import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE;
|
||||
import static org.springblade.core.oauth2.constant.OAuth2TokenConstant.USER_PHONE_NOT_FOUND;
|
||||
import static org.springblade.modules.auth.constant.BladeAuthConstant.INIT_PASSWD_VALUE;
|
||||
import static org.springblade.modules.auth.constant.BladeAuthConstant.SMS_SIMPLE_VALUE;
|
||||
import static org.springblade.modules.resource.utils.SmsUtil.SEND_FAIL;
|
||||
import static org.springblade.modules.resource.utils.SmsUtil.SEND_SUCCESS;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -76,7 +71,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
private final BladeRedis bladeRedis;
|
||||
private final OAuth2Properties properties;
|
||||
private final AliyunDynpsService dynpsService;
|
||||
private final IUserSmsLogService userSmsLogService;
|
||||
private final ICommonUserSmsLogService userSmsLogService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -651,10 +646,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
}
|
||||
|
||||
long count = userSmsLogService.count(
|
||||
Wrappers.lambdaQuery(UserSmsLogEntity.class)
|
||||
.eq(UserSmsLogEntity::getUserId, userInfo.getId())
|
||||
.eq(UserSmsLogEntity::getSmsType, 0)
|
||||
.eq(UserSmsLogEntity::getStatDate, org.springblade.common.utils.date.DateUtil.getToday())
|
||||
Wrappers.lambdaQuery(CommonUserSmsLogEntity.class)
|
||||
.eq(CommonUserSmsLogEntity::getUserId, userInfo.getId())
|
||||
.eq(CommonUserSmsLogEntity::getSmsType, 0)
|
||||
.eq(CommonUserSmsLogEntity::getStatDate, org.springblade.common.utils.date.DateUtil.getToday())
|
||||
);
|
||||
if (count > 0) {
|
||||
throw new ServiceException("今日发送次数已达上限,请明天再试!");
|
||||
@@ -663,7 +658,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
try {
|
||||
Boolean sendResult = dynpsService.sendSms(decryptedPhone);
|
||||
if (Boolean.TRUE.equals(sendResult)) {
|
||||
UserSmsLogEntity logEntity = new UserSmsLogEntity()
|
||||
CommonUserSmsLogEntity logEntity = new CommonUserSmsLogEntity()
|
||||
.setUserId(userInfo.getId())
|
||||
.setSmsType(0)
|
||||
.setContent("忘记密码-发送短信")
|
||||
|
||||
Reference in New Issue
Block a user