修复余额充值bug等
This commit is contained in:
@@ -14,7 +14,11 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
|||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.KVEntity;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.shop.entity.Goods;
|
||||||
|
import com.gxwebsoft.shop.param.GoodsParam;
|
||||||
|
import com.gxwebsoft.shop.service.GoodsService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@@ -22,9 +26,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -49,6 +51,8 @@ public class MpController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private MpFieldService mpFieldService;
|
private MpFieldService mpFieldService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private GoodsService goodsService;
|
||||||
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@ApiOperation("获取小程序信息")
|
@ApiOperation("获取小程序信息")
|
||||||
@@ -204,6 +208,31 @@ public class MpController extends BaseController {
|
|||||||
mpFieldService.save(field);
|
mpFieldService.save(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取首页数据")
|
||||||
|
@GetMapping("/index")
|
||||||
|
public ApiResult<?> index(GoodsParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
final HashMap<String, Object> layout = new HashMap<>();
|
||||||
|
// 瀑布流商品数据
|
||||||
|
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().ne(Goods::getCategoryParent, "外卖").last("limit 10"));
|
||||||
|
final List<Goods> foods = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getCategoryParent, "外卖").last("limit 10"));
|
||||||
|
// List<Goods> evenNumbers = new ArrayList<>();
|
||||||
|
// List<Goods> oddNumbers = new ArrayList<>();
|
||||||
|
// for (Goods g : goods) {
|
||||||
|
// final int index = goods.indexOf(g);
|
||||||
|
// if (index % 2 == 0) {
|
||||||
|
// evenNumbers.add(g);
|
||||||
|
// } else {
|
||||||
|
// oddNumbers.add(g);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
layout.put("goods",goods);
|
||||||
|
layout.put("foods", foods);
|
||||||
|
|
||||||
|
return success(layout);
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
||||||
@ApiOperation("清除缓存")
|
@ApiOperation("清除缓存")
|
||||||
@DeleteMapping("/clearSiteInfo/{key}")
|
@DeleteMapping("/clearSiteInfo/{key}")
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ public class GoodsController extends BaseController {
|
|||||||
return success(goodsService.listRel(param));
|
return success(goodsService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:goods:list')")
|
|
||||||
@ApiOperation("根据id查询商品记录表")
|
@ApiOperation("根据id查询商品记录表")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<Goods> get(@PathVariable("id") Integer id) {
|
public ApiResult<Goods> get(@PathVariable("id") Integer id) {
|
||||||
|
|||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
|
import com.gxwebsoft.shop.entity.UserBalanceLog;
|
||||||
|
import com.gxwebsoft.shop.service.RechargeOrderService;
|
||||||
|
import com.gxwebsoft.shop.entity.RechargeOrder;
|
||||||
|
import com.gxwebsoft.shop.param.RechargeOrderParam;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.shop.service.UserBalanceLogService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.gxwebsoft.common.core.constants.BalanceConstants.BALANCE_ADMIN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值订单表控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-26 23:18:48
|
||||||
|
*/
|
||||||
|
@Api(tags = "会员充值订单表管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/shop/recharge-order")
|
||||||
|
public class RechargeOrderController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private RechargeOrderService rechargeOrderService;
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
@Resource
|
||||||
|
private UserBalanceLogService userBalanceLogService;
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:rechargeOrder:save')")
|
||||||
|
@ApiOperation("会员充值")
|
||||||
|
@PostMapping("/recharge")
|
||||||
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
|
public ApiResult<?> recharge(@RequestBody RechargeOrder rechargeOrder) {
|
||||||
|
// 充值
|
||||||
|
User user = userService.getById(rechargeOrder.getUserId());
|
||||||
|
BigDecimal balance = user.getBalance().add(rechargeOrder.getPayPrice());
|
||||||
|
user.setBalance(balance);
|
||||||
|
userService.updateById(user);
|
||||||
|
// 保存充值记录
|
||||||
|
rechargeOrder.setOrderNo(Long.toString(IdUtil.getSnowflakeNextId()));
|
||||||
|
rechargeOrder.setBalance(balance);
|
||||||
|
if (rechargeOrderService.save(rechargeOrder)) {
|
||||||
|
// 记录余额明细
|
||||||
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
|
userBalanceLog.setUserId(rechargeOrder.getUserId());
|
||||||
|
userBalanceLog.setScene(BALANCE_ADMIN);
|
||||||
|
userBalanceLog.setMoney(rechargeOrder.getPayPrice());
|
||||||
|
userBalanceLog.setBalance(balance);
|
||||||
|
userBalanceLog.setComments("操作人:" + getLoginUser().getNickname());
|
||||||
|
userBalanceLog.setRemark(rechargeOrder.getComments());
|
||||||
|
userBalanceLog.setMerchantCode(rechargeOrder.getMerchantCode());
|
||||||
|
userBalanceLogService.save(userBalanceLog);
|
||||||
|
return success("充值成功", user);
|
||||||
|
}
|
||||||
|
return fail("充值失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:rechargeOrder:list')")
|
||||||
|
@ApiOperation("分页查询会员充值订单表")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<RechargeOrder>> page(RechargeOrderParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(rechargeOrderService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:rechargeOrder:list')")
|
||||||
|
@ApiOperation("查询全部会员充值订单表")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<RechargeOrder>> list(RechargeOrderParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(rechargeOrderService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:rechargeOrder:list')")
|
||||||
|
@ApiOperation("根据id查询会员充值订单表")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<RechargeOrder> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(rechargeOrderService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加会员充值订单表")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody RechargeOrder rechargeOrder) {
|
||||||
|
// 记录当前登录用户id
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
rechargeOrder.setUserId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
if (rechargeOrderService.save(rechargeOrder)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改会员充值订单表")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody RechargeOrder rechargeOrder) {
|
||||||
|
if (rechargeOrderService.updateById(rechargeOrder)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除会员充值订单表")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (rechargeOrderService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:rechargeOrder:save')")
|
||||||
|
@ApiOperation("批量充值")
|
||||||
|
@PostMapping("/batchRecharge")
|
||||||
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
|
public ApiResult<?> batchRecharge(@RequestBody List<RechargeOrder> list) {
|
||||||
|
if (rechargeOrderService.saveBatch(list)) {
|
||||||
|
String nickname = getLoginUser().getNickname();
|
||||||
|
ArrayList<User> users = new ArrayList<>(list.size());
|
||||||
|
ArrayList<UserBalanceLog> logs = new ArrayList<>(list.size());
|
||||||
|
|
||||||
|
list.forEach(d -> {
|
||||||
|
User user = userService.getByIdRel(d.getUserId());
|
||||||
|
BigDecimal balance = user.getBalance().add(d.getPayPrice());
|
||||||
|
user.setBalance(balance);
|
||||||
|
users.add(user);
|
||||||
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
|
userBalanceLog.setUserId(d.getUserId());
|
||||||
|
userBalanceLog.setScene(BALANCE_ADMIN);
|
||||||
|
userBalanceLog.setMoney(d.getPayPrice());
|
||||||
|
userBalanceLog.setBalance(balance);
|
||||||
|
userBalanceLog.setComments("操作人:" + nickname);
|
||||||
|
userBalanceLog.setRemark(d.getComments());
|
||||||
|
userBalanceLog.setMerchantCode(d.getMerchantCode());
|
||||||
|
logs.add(userBalanceLog);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 批量充值
|
||||||
|
userService.updateBatchById(users);
|
||||||
|
// 记录余额明细
|
||||||
|
userBalanceLogService.saveBatch(logs);
|
||||||
|
return success("充值成功");
|
||||||
|
}
|
||||||
|
return fail("充值失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:rechargeOrder:update')")
|
||||||
|
@ApiOperation("批量修改会员充值订单表")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<RechargeOrder> batchParam) {
|
||||||
|
if (batchParam.update(rechargeOrderService, "order_id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:rechargeOrder:remove')")
|
||||||
|
@ApiOperation("批量删除会员充值订单表")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (rechargeOrderService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -61,7 +61,7 @@ public class UsersController extends BaseController {
|
|||||||
return success(usersService.getByIdRel(id));
|
return success(usersService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:users:list')")
|
@PreAuthorize("hasAnyAuthority('sys:auth:user')")
|
||||||
@ApiOperation("根据手机查询用户")
|
@ApiOperation("根据手机查询用户")
|
||||||
@GetMapping("/getByPhone")
|
@GetMapping("/getByPhone")
|
||||||
public ApiResult<Users> getByPhone(UsersParam param) {
|
public ApiResult<Users> getByPhone(UsersParam param) {
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.gxwebsoft.shop.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值订单表
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-26 23:18:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "RechargeOrder对象", description = "会员充值订单表")
|
||||||
|
@TableName("shop_recharge_order")
|
||||||
|
public class RechargeOrder implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单ID")
|
||||||
|
@TableId(value = "order_id", type = IdType.AUTO)
|
||||||
|
private Integer orderId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "充值方式(10自定义金额 20套餐充值)")
|
||||||
|
private Integer rechargeType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机构id")
|
||||||
|
private Integer organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "充值套餐ID")
|
||||||
|
private Integer planId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户支付金额")
|
||||||
|
private BigDecimal payPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "赠送金额")
|
||||||
|
private BigDecimal giftMoney;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实际到账金额")
|
||||||
|
private BigDecimal actualMoney;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户可用余额")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付方式(微信/支付宝)")
|
||||||
|
private String payMethod;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付状态(10待支付 20已支付)")
|
||||||
|
private Integer payStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "付款时间")
|
||||||
|
private Integer payTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "第三方交易记录ID")
|
||||||
|
private Integer tradeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "来源客户端 (APP、H5、小程序等)")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所属门店ID")
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户编码")
|
||||||
|
private String merchantCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "注册时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.shop.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.shop.entity.RechargeOrder;
|
||||||
|
import com.gxwebsoft.shop.param.RechargeOrderParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值订单表Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-26 23:18:48
|
||||||
|
*/
|
||||||
|
public interface RechargeOrderMapper extends BaseMapper<RechargeOrder> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<RechargeOrder>
|
||||||
|
*/
|
||||||
|
List<RechargeOrder> selectPageRel(@Param("page") IPage<RechargeOrder> page,
|
||||||
|
@Param("param") RechargeOrderParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<RechargeOrder> selectListRel(@Param("param") RechargeOrderParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
|
|
||||||
<!-- 查询过期订单 -->
|
<!-- 查询过期订单 -->
|
||||||
<select id="selectExpirationOrder" resultType="com.gxwebsoft.shop.entity.Order">
|
<select id="selectExpirationOrder" resultType="com.gxwebsoft.shop.entity.Order">
|
||||||
SELECT * from shop_order where pay_status = 0 AND order_status = 0 AND expiration_time <= #{param.expirationTime}
|
SELECT * from shop_order where type = 1 AND pay_status = 0 AND order_status = 0 AND expiration_time <= #{param.expirationTime}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 更明过期订单的状态 -->
|
<!-- 更明过期订单的状态 -->
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<?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="com.gxwebsoft.shop.mapper.RechargeOrderMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM shop_recharge_order a
|
||||||
|
<where>
|
||||||
|
<if test="param.orderId != null">
|
||||||
|
AND a.order_id = #{param.orderId}
|
||||||
|
</if>
|
||||||
|
<if test="param.orderNo != null">
|
||||||
|
AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.userId != null">
|
||||||
|
AND a.user_id = #{param.userId}
|
||||||
|
</if>
|
||||||
|
<if test="param.rechargeType != null">
|
||||||
|
AND a.recharge_type = #{param.rechargeType}
|
||||||
|
</if>
|
||||||
|
<if test="param.organizationId != null">
|
||||||
|
AND a.organization_id = #{param.organizationId}
|
||||||
|
</if>
|
||||||
|
<if test="param.planId != null">
|
||||||
|
AND a.plan_id = #{param.planId}
|
||||||
|
</if>
|
||||||
|
<if test="param.payPrice != null">
|
||||||
|
AND a.pay_price = #{param.payPrice}
|
||||||
|
</if>
|
||||||
|
<if test="param.giftMoney != null">
|
||||||
|
AND a.gift_money = #{param.giftMoney}
|
||||||
|
</if>
|
||||||
|
<if test="param.actualMoney != null">
|
||||||
|
AND a.actual_money = #{param.actualMoney}
|
||||||
|
</if>
|
||||||
|
<if test="param.balance != null">
|
||||||
|
AND a.balance = #{param.balance}
|
||||||
|
</if>
|
||||||
|
<if test="param.payMethod != null">
|
||||||
|
AND a.pay_method LIKE CONCAT('%', #{param.payMethod}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.payStatus != null">
|
||||||
|
AND a.pay_status = #{param.payStatus}
|
||||||
|
</if>
|
||||||
|
<if test="param.payTime != null">
|
||||||
|
AND a.pay_time = #{param.payTime}
|
||||||
|
</if>
|
||||||
|
<if test="param.tradeId != null">
|
||||||
|
AND a.trade_id = #{param.tradeId}
|
||||||
|
</if>
|
||||||
|
<if test="param.platform != null">
|
||||||
|
AND a.platform LIKE CONCAT('%', #{param.platform}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.shopId != null">
|
||||||
|
AND a.shop_id = #{param.shopId}
|
||||||
|
</if>
|
||||||
|
<if test="param.sortNumber != null">
|
||||||
|
AND a.sort_number = #{param.sortNumber}
|
||||||
|
</if>
|
||||||
|
<if test="param.comments != null">
|
||||||
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.status != null">
|
||||||
|
AND a.status = #{param.status}
|
||||||
|
</if>
|
||||||
|
<if test="param.deleted != null">
|
||||||
|
AND a.deleted = #{param.deleted}
|
||||||
|
</if>
|
||||||
|
<if test="param.deleted == null">
|
||||||
|
AND a.deleted = 0
|
||||||
|
</if>
|
||||||
|
<if test="param.merchantCode != null">
|
||||||
|
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.RechargeOrder">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.RechargeOrder">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.gxwebsoft.shop.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值订单表查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-26 23:18:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "RechargeOrderParam对象", description = "会员充值订单表查询参数")
|
||||||
|
public class RechargeOrderParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer orderId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "充值方式(10自定义金额 20套餐充值)")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer rechargeType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机构id")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "充值套餐ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer planId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户支付金额")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal payPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "赠送金额")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal giftMoney;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实际到账金额")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal actualMoney;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户可用余额")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付方式(微信/支付宝)")
|
||||||
|
private String payMethod;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付状态(10待支付 20已支付)")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer payStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "付款时间")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer payTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "第三方交易记录ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer tradeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "来源客户端 (APP、H5、小程序等)")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所属门店ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户编码")
|
||||||
|
private String merchantCode;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gxwebsoft.shop.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.shop.entity.RechargeOrder;
|
||||||
|
import com.gxwebsoft.shop.param.RechargeOrderParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值订单表Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-26 23:18:48
|
||||||
|
*/
|
||||||
|
public interface RechargeOrderService extends IService<RechargeOrder> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<RechargeOrder>
|
||||||
|
*/
|
||||||
|
PageResult<RechargeOrder> pageRel(RechargeOrderParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<RechargeOrder>
|
||||||
|
*/
|
||||||
|
List<RechargeOrder> listRel(RechargeOrderParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param orderId 订单ID
|
||||||
|
* @return RechargeOrder
|
||||||
|
*/
|
||||||
|
RechargeOrder getByIdRel(Integer orderId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -53,7 +53,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|||||||
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||||
d.setGoodsSpec(goodsSpecs.get(0));
|
d.setGoodsSpec(goodsSpecs.get(0));
|
||||||
}
|
}
|
||||||
d.setGoodsSkus(collectSkus.get(d.getGoodsId()));
|
// d.setGoodsSkus(collectSkus.get(d.getGoodsId()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.shop.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.shop.mapper.RechargeOrderMapper;
|
||||||
|
import com.gxwebsoft.shop.service.RechargeOrderService;
|
||||||
|
import com.gxwebsoft.shop.entity.RechargeOrder;
|
||||||
|
import com.gxwebsoft.shop.param.RechargeOrderParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值订单表Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-26 23:18:48
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RechargeOrderServiceImpl extends ServiceImpl<RechargeOrderMapper, RechargeOrder> implements RechargeOrderService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<RechargeOrder> pageRel(RechargeOrderParam param) {
|
||||||
|
PageParam<RechargeOrder, RechargeOrderParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
List<RechargeOrder> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RechargeOrder> listRel(RechargeOrderParam param) {
|
||||||
|
List<RechargeOrder> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<RechargeOrder, RechargeOrderParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RechargeOrder getByIdRel(Integer orderId) {
|
||||||
|
RechargeOrderParam param = new RechargeOrderParam();
|
||||||
|
param.setOrderId(orderId);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -71,6 +71,7 @@ public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements
|
|||||||
integralLog.setOldMoney(old);
|
integralLog.setOldMoney(old);
|
||||||
integralLog.setNewMoney(news);
|
integralLog.setNewMoney(news);
|
||||||
integralLog.setCreateTime(DateUtil.currentSeconds());
|
integralLog.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
integralLog.setInfo("消费获取积分");
|
||||||
if (order.getType().equals(1)) {
|
if (order.getType().equals(1)) {
|
||||||
integralLog.setInfo("预订场地获得积分");
|
integralLog.setInfo("预订场地获得积分");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class OrderInfoTask extends BaseController {
|
|||||||
final int minute = DateUtil.minute(DateUtil.date());
|
final int minute = DateUtil.minute(DateUtil.date());
|
||||||
final int second = DateUtil.second(DateUtil.date());
|
final int second = DateUtil.second(DateUtil.date());
|
||||||
final String startTime = String.format("%02d", hour).concat(":").concat(String.format("%02d", minute)).concat(":").concat(String.format("%02d", second));
|
final String startTime = String.format("%02d", hour).concat(":").concat(String.format("%02d", minute)).concat(":").concat(String.format("%02d", second));
|
||||||
final List<OrderInfo> list = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getTenantId,10150).eq(OrderInfo::getOrderStatus, 0).ne(OrderInfo::getMerchantId,3028).eq(OrderInfo::getDateTime,DateUtil.today()).lt(OrderInfo::getStartTime,startTime));
|
final List<OrderInfo> list = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getOrderStatus, 0).ne(OrderInfo::getMerchantId,3028).eq(OrderInfo::getDateTime,DateUtil.today()).lt(OrderInfo::getStartTime,startTime));
|
||||||
list.forEach(d -> {
|
list.forEach(d -> {
|
||||||
d.setOrderStatus(1);
|
d.setOrderStatus(1);
|
||||||
order.setOrderId(d.getOrderId());
|
order.setOrderId(d.getOrderId());
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.shop.service.OrderService;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -32,17 +33,20 @@ public class OrderTask extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 自动处理过期订单任务
|
* 自动处理过期订单任务
|
||||||
*/
|
*/
|
||||||
// @Scheduled(fixedDelay = 2000, initialDelay = 2000)
|
@Scheduled(fixedDelay = 2000, initialDelay = 2000)
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public void settledExpirationOrder() {
|
public void settledExpirationOrder() {
|
||||||
final OrderParam p = new OrderParam();
|
final OrderParam p = new OrderParam();
|
||||||
p.setOrderStatus(0);
|
p.setOrderStatus(0);
|
||||||
p.setExpirationTime(DateUtil.date());
|
p.setExpirationTime(DateUtil.date());
|
||||||
final List<Order> list = orderMapper.selectExpirationOrder(p);
|
final List<Order> list = orderMapper.selectExpirationOrder(p);
|
||||||
|
System.out.println("自动处理过期订单list = " + list);
|
||||||
list.forEach(d -> {
|
list.forEach(d -> {
|
||||||
d.setOrderStatus(2);
|
d.setOrderStatus(2);
|
||||||
});
|
});
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
orderService.updateBatchById(list);
|
orderService.updateBatchById(list);
|
||||||
System.out.println("自动处理过期订单 = " + list.size());
|
System.out.println("自动处理过期订单 = " + list.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ShopGenerator {
|
|||||||
// "shop_spec_value",
|
// "shop_spec_value",
|
||||||
// "shop_goods",
|
// "shop_goods",
|
||||||
// "shop_goods_spec",
|
// "shop_goods_spec",
|
||||||
"shop_goods_sku",
|
// "shop_goods_sku",
|
||||||
// "shop_goods_category",
|
// "shop_goods_category",
|
||||||
// "shop_goods_coupon",
|
// "shop_goods_coupon",
|
||||||
// "shop_goods_description",
|
// "shop_goods_description",
|
||||||
@@ -77,6 +77,7 @@ public class ShopGenerator {
|
|||||||
// "shop_users",
|
// "shop_users",
|
||||||
// "shop_user_address",
|
// "shop_user_address",
|
||||||
// "shop_user_balance_log"
|
// "shop_user_balance_log"
|
||||||
|
"shop_recharge_order"
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
private static final String[] TABLE_PREFIX = new String[]{
|
private static final String[] TABLE_PREFIX = new String[]{
|
||||||
|
|||||||
Reference in New Issue
Block a user