加入绿色积分配置
This commit is contained in:
parent
433013e9c3
commit
9ef74912a4
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,3 +6,5 @@ crmeb/LOG_HOME_IS_UNDEFINED
|
||||
*.
|
||||
*.
|
||||
.DS_Store
|
||||
/crmeb_log/
|
||||
/LOG_HOME_IS_UNDEFINED/
|
||||
|
113
app/REMARD.md
Normal file
113
app/REMARD.md
Normal file
@ -0,0 +1,113 @@
|
||||
# 目录结构
|
||||
|
||||
```
|
||||
|
||||
└─view uni-app存放根目录
|
||||
├── App.vue 文件主入口
|
||||
├── api 后台api调用地址
|
||||
│ ├── api.js 公共接口api
|
||||
│ ├── order.js 订单数据api
|
||||
│ ├── public.js 公共接口api
|
||||
│ ├── product.js 商品数据api
|
||||
│ ├── merchant.js 商户数据api
|
||||
│ └── user.js 用户信息api
|
||||
├── components 组件
|
||||
│ ├── accredit 授权弹窗
|
||||
│ ├── base 公共组件
|
||||
│ │ ├──easy-loadimage 图片懒加载
|
||||
│ │ ├──recommend 推荐商品
|
||||
│ │ ├──tui-skeleton 骨架屏
|
||||
│ │ ├──tui-drawer 抽屉弹窗
|
||||
│ ├── couponListWindow 优惠券列表弹框
|
||||
│ ├── cus-previewImg 查看规格轮播大图组件
|
||||
│ ├── goodList 主页和商品搜索页商品列表
|
||||
│ ├── jyf-parser 商品详情富文本解析器
|
||||
│ ├── merchantList 商户列表
|
||||
│ ├── merHome 商户头部信息
|
||||
│ ├── productConSwiper 商品详情banner
|
||||
│ ├── productWindow 商品详情sku弹出层
|
||||
│ ├── shareInfo 资讯详情分享
|
||||
│ ├── shareRedPackets 商品详情分销气泡
|
||||
│ ├── skeleton 骨架屏
|
||||
│ ├── userEvaluation 商品评价
|
||||
│ ├── WaterfallsFlow 瀑布流
|
||||
│ ├── WaterfallsFlowItem 瀑布流
|
||||
│ ├── navBar 头部导航小标
|
||||
│ ├── emptyPage 缺省图
|
||||
│ ├── vconsole.min.js 调试打印工具
|
||||
├── config 配置
|
||||
│ ├── app.js 请求地址和请求头配置
|
||||
│ ├── cache.js 缓存信息
|
||||
│ └── socket.js 套接字
|
||||
├── js_sdk JS-SDK
|
||||
│ └── Sansnn-uQRCode 二维码生成
|
||||
├── libs 执行子文件
|
||||
│ ├── apps.js 授权登录获取token
|
||||
│ ├── chat.js 聊天通信配置
|
||||
│ ├── iframe.js 判断是否是isIframe页面
|
||||
│ ├── login.js 登录
|
||||
│ ├── order.js 活动商品跳转和预下单
|
||||
│ ├── merchant.js 商户关注/取消
|
||||
│ ├── routine.js 微信小程序获取信息
|
||||
│ └── wechat.js 微信公众号获取信息
|
||||
├── main.js 项目入口文件
|
||||
├── manifest.json 应用配置文件
|
||||
├── mixins 混入
|
||||
│ └── SendVerifyCode.js 验证码
|
||||
├── package-lock.json 描述模块的版本信息,模块来源及依赖
|
||||
├── pages 页面目录
|
||||
│ ├── address 地址相关页
|
||||
│ ├── auth 作者
|
||||
│ ├── goods 商品相关页
|
||||
│ ├── goods_cate 商品分类页
|
||||
│ ├── index 首页
|
||||
│ ├── merchant 商户相关页
|
||||
│ ├── order_addcart 购物车
|
||||
│ ├── user 个人中心
|
||||
│ └── users 用户目录
|
||||
├── pages.json 页面文件的路径、窗口表现配置文件
|
||||
├── plugin 插件
|
||||
│ ├── animate 动画库
|
||||
│ ├── chat 聊天插件
|
||||
│ ├── clipboard 复制插件
|
||||
│ ├── dayjs 处理时间和日期的库
|
||||
│ ├── image-tools 图像转换工具
|
||||
│ └── jweixin-module 公众号H5的JS-SDK
|
||||
├── static 静态文件
|
||||
│ ├── css css样式目录
|
||||
│ ├── easy-loadimage 图片懒加载图片
|
||||
│ ├── html PC端打开时的html文件
|
||||
│ ├── iconfont iconfont
|
||||
│ ├── images 图片资源
|
||||
│ ├── img 图片资源
|
||||
│ └── tabBar 底部导航图片
|
||||
├── store vuex
|
||||
│ ├── getters.js store的计算属性
|
||||
│ ├── index.js store入口文件
|
||||
│ └── modules store的模块
|
||||
├── uni.scss uniapp自带的的scss文件
|
||||
├── unpackage 打包后的目录
|
||||
├── utils 公共的js模块
|
||||
│ ├── animationType.js APP端跳转样式
|
||||
│ ├── ase.js 滑块
|
||||
│ ├── crypto-js.js 滑块
|
||||
│ ├── base64src.js base64
|
||||
│ ├── consumerType.js 客服选择
|
||||
│ ├── cache.js 设置,读取,检测缓存
|
||||
│ ├── index.js 公共配置文件
|
||||
│ ├── permission.js 权限
|
||||
│ ├── request.js api请求方法
|
||||
│ ├── setTheme.js 设置主题色
|
||||
│ ├── SubscribeMessage.js 小程序订阅消息
|
||||
│ ├── util.js 工具函数
|
||||
│ └── validate.js 输入验证,函数防抖
|
||||
└── vue.config.js 主配置
|
||||
```
|
||||
|
||||
# 配置说明
|
||||
|
||||
配置说明
|
||||
下载模版用HBuilder X打开
|
||||
修改配置 config/app.js
|
||||
|
||||

|
@ -1,5 +1,6 @@
|
||||
package com.zbkj.admin.task.order;
|
||||
|
||||
import com.sun.xml.internal.bind.v2.TODO;
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.OrderTaskService;
|
||||
import org.slf4j.Logger;
|
||||
@ -11,16 +12,6 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 订单支付成功后置task任务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@ -33,6 +24,7 @@ public class OrderPaySuccessTask {
|
||||
@Autowired
|
||||
private OrderTaskService orderTaskService;
|
||||
|
||||
|
||||
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
|
||||
public void init() {
|
||||
logger.info("---OrderPaySuccessTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.zbkj.common.constants;
|
||||
|
||||
/**
|
||||
* 资金池记录相关常量
|
||||
*/
|
||||
public class BonusPoolRecordConstants {
|
||||
|
||||
// linkType 关联类型
|
||||
public static final String LINK_TYPE_ORDER = "order";
|
||||
public static final String LINK_TYPE_SIGN = "sign";
|
||||
public static final String LINK_TYPE_SYSTEM = "system";
|
||||
public static final String LINK_TYPE_ADMIN = "admin";
|
||||
|
||||
// type 类型:1-增加,2-扣减
|
||||
public static final Integer TYPE_ADD = 1;
|
||||
public static final Integer TYPE_SUB = 2;
|
||||
|
||||
// status 状态:1-创建/待处理, 2-冻结中, 3-完成, 4-失效
|
||||
public static final Integer STATUS_CREATE = 1;
|
||||
public static final Integer STATUS_FROZEN = 2;
|
||||
public static final Integer STATUS_COMPLETE = 3;
|
||||
public static final Integer STATUS_INVALID = 4;
|
||||
|
||||
// title 标题
|
||||
public static final String TITLE_ORDER_ADD = "订单奖励";
|
||||
public static final String TITLE_ORDER_REFUND = "订单退款扣除";
|
||||
public static final String TITLE_SIGN_ADD = "签到奖励";
|
||||
public static final String TITLE_ADMIN_ADD = "后台添加";
|
||||
public static final String TITLE_ADMIN_SUB = "后台扣除";
|
||||
public static final String TITLE_CONSUME = "消费抵扣"; // Example if bonus points can be spent
|
||||
|
||||
// System Config Keys (Make sure these exist in your system config table)
|
||||
public static final String CONFIG_KEY_BONUS_POOL_FROZEN_DAYS = "bonus_pool_frozen_days"; // Example key name
|
||||
|
||||
}
|
@ -1,16 +1,7 @@
|
||||
package com.zbkj.service.basics.bonusPool.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPool;
|
||||
import com.zbkj.service.basics.bonusPool.service.IBonusPoolService;
|
||||
import com.zbkj.service.basics.bonusPool.service.IBonusPoolRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@ -33,7 +24,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
@Api(tags="分红池")
|
||||
@RestController
|
||||
@RequestMapping("/bonusPool/bonusPool")
|
||||
public class BonusPoolController{
|
||||
public class BonusPoolRecordController{
|
||||
@Autowired
|
||||
private IBonusPoolService bonusPoolService;
|
||||
private IBonusPoolRecordService bonusPoolService;
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
package com.zbkj.service.basics.bonusPool.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 分红池
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-03-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("bonus_pool")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="bonus_pool对象", description="分红池")
|
||||
public class BonusPool implements Serializable {
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
/**用户id*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer uid;
|
||||
/**用户姓名*/
|
||||
@ApiModelProperty(value = "用户姓名")
|
||||
private String realName;
|
||||
/**用户电话*/
|
||||
@ApiModelProperty(value = "用户电话")
|
||||
private String userPhone;
|
||||
/**变动金额*/
|
||||
@ApiModelProperty(value = "变动金额")
|
||||
private java.math.BigDecimal amount;
|
||||
/**池剩余金额*/
|
||||
@ApiModelProperty(value = "池剩余金额")
|
||||
private java.math.BigDecimal balance;
|
||||
/**类型 1消费入池 2提现回流*/
|
||||
@ApiModelProperty(value = "类型 1消费入池 2提现回流")
|
||||
private String type;
|
||||
/**发生时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "发生时间")
|
||||
private Date createTime;
|
||||
/**订单id*/
|
||||
@ApiModelProperty(value = "订单id")
|
||||
private Integer orderId;
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.zbkj.service.basics.bonusPool.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal; // Import BigDecimal
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 资金池积分记录
|
||||
* @Author: Gemini
|
||||
* @Date: 2025-03-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("bonus_pool_record")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="BonusPoolRecord对象", description="资金池积分记录")
|
||||
public class BonusPoolRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "记录ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户UID")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "关联ID (例如: orderNo, '0' for sign/system)")
|
||||
private String linkId;
|
||||
|
||||
@ApiModelProperty(value = "关联类型 (例如: order, sign, system)")
|
||||
private String linkType;
|
||||
|
||||
@ApiModelProperty(value = "类型: 1-增加, 2-扣减")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "记录标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "变动金额/积分")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty(value = "变动后余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String mark;
|
||||
|
||||
@ApiModelProperty(value = "状态: 1-创建/待处理, 2-冻结中, 3-完成, 4-失效")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "冻结期时间 (天)")
|
||||
private Integer frozenTime;
|
||||
|
||||
@ApiModelProperty(value = "预计解冻时间戳 (毫秒)")
|
||||
private Long thawTime;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
package com.zbkj.service.basics.bonusPool.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPool;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPoolRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 分红池资金流水表 DAO 映射层
|
||||
*/
|
||||
@Mapper
|
||||
public interface BonusPoolDao extends BaseMapper<BonusPool> {
|
||||
public interface BonusPoolDao extends BaseMapper<BonusPoolRecord> {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -2,7 +2,7 @@ package com.zbkj.service.basics.bonusPool.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPool;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPoolRecord;
|
||||
|
||||
/**
|
||||
* @Description: 分红池
|
||||
@ -10,6 +10,6 @@ import com.zbkj.service.basics.bonusPool.entity.BonusPool;
|
||||
* @Date: 2025-03-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBonusPoolService extends IService<BonusPool>{
|
||||
public interface IBonusPoolRecordService extends IService<BonusPoolRecord>{
|
||||
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
package com.zbkj.service.basics.bonusPool.service.impl;
|
||||
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPool;
|
||||
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPoolRecord;
|
||||
import com.zbkj.service.basics.bonusPool.mapper.BonusPoolDao;
|
||||
import com.zbkj.service.basics.bonusPool.service.IBonusPoolService;
|
||||
import com.zbkj.service.basics.bonusPool.service.IBonusPoolRecordService;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -16,6 +15,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BonusPoolServiceImpl extends ServiceImpl<BonusPoolDao, BonusPool> implements IBonusPoolService {
|
||||
public class BonusPoolServiceImpl extends ServiceImpl<BonusPoolDao, BonusPoolRecord> implements IBonusPoolRecordService {
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import com.zbkj.common.request.UserExtractRequest;
|
||||
import com.zbkj.common.request.UserExtractSearchRequest;
|
||||
import com.zbkj.common.response.BalanceResponse;
|
||||
import com.zbkj.common.response.UserExtractResponse;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPool;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPoolRecord;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@ -18,7 +18,7 @@ import java.util.List;
|
||||
/**
|
||||
* CreditsExchangeService 接口
|
||||
*/
|
||||
public interface CreditsExchangeService extends IService<BonusPool> {
|
||||
public interface CreditsExchangeService extends IService<BonusPoolRecord> {
|
||||
|
||||
/**
|
||||
* 兑换总金额
|
||||
|
@ -6,15 +6,6 @@ import com.zbkj.common.response.OrderPayResultResponse;
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface OrderPayService{
|
||||
|
||||
|
@ -6,11 +6,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import com.zbkj.common.model.user.UserIntegralRecord;
|
||||
import com.zbkj.common.response.CreditsExchangeResponse;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPool;
|
||||
|
||||
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPoolRecord;
|
||||
import com.zbkj.service.basics.bonusPool.mapper.BonusPoolDao;
|
||||
import com.zbkj.service.basics.bonusPool.service.IBonusPoolService;
|
||||
|
||||
import com.zbkj.service.basics.bonusPool.service.IBonusPoolRecordService;
|
||||
import com.zbkj.service.dao.UserIntegralRecordDao;
|
||||
import com.zbkj.service.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -21,9 +22,9 @@ import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class CreditsExchangeServiceImpl extends ServiceImpl<BonusPoolDao, BonusPool> implements CreditsExchangeService {
|
||||
public class CreditsExchangeServiceImpl extends ServiceImpl<BonusPoolDao, BonusPoolRecord> implements CreditsExchangeService {
|
||||
@Autowired
|
||||
IBonusPoolService ibonusPoolService;
|
||||
IBonusPoolRecordService ibonusPoolService;
|
||||
@Autowired
|
||||
private UserIntegralRecordDao userIntegralRecordDao;
|
||||
|
||||
@ -55,11 +56,11 @@ public class CreditsExchangeServiceImpl extends ServiceImpl<BonusPoolDao, BonusP
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getCurrentBonusPool() {
|
||||
LambdaQueryWrapper<BonusPool> lqw = Wrappers.lambdaQuery();
|
||||
LambdaQueryWrapper<BonusPoolRecord> lqw = Wrappers.lambdaQuery();
|
||||
// 按创建时间降序排序,并限制结果数量为1
|
||||
lqw.orderByDesc(BonusPool::getCreateTime).last("LIMIT 1");
|
||||
lqw.orderByDesc(BonusPoolRecord::getCreateTime).last("LIMIT 1");
|
||||
// 获取最新记录
|
||||
BonusPool latestBonusPool = ibonusPoolService.getOne(lqw);
|
||||
BonusPoolRecord latestBonusPool = ibonusPoolService.getOne(lqw);
|
||||
if (latestBonusPool == null) {
|
||||
return BigDecimal.ZERO; // 或抛出自定义异常 throw new RuntimeException("分红池记录不存在");
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.utils.WxPayUtil;
|
||||
import com.zbkj.common.vo.*;
|
||||
import com.zbkj.service.basics.bonusPool.entity.BonusPoolRecord;
|
||||
import com.zbkj.service.delete.OrderUtils;
|
||||
import com.zbkj.service.service.*;
|
||||
import lombok.Data;
|
||||
@ -38,10 +39,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -940,6 +938,67 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
return integralRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化资金池积分增加记录 (基于订单)
|
||||
* @param storeOrder 关联的订单
|
||||
* @param newBalance 用户变动后的资金池余额
|
||||
* @param amount 本次变动的金额/积分
|
||||
* @param markType 用于生成备注的类型标识 (e.g., "order_give", "product_give")
|
||||
* @return BonusPoolRecord 实例
|
||||
*/
|
||||
private BonusPoolRecord bonusPoolRecordAddInit(StoreOrder storeOrder, BigDecimal newBalance, BigDecimal amount, String markType) {
|
||||
BonusPoolRecord record = new BonusPoolRecord();
|
||||
record.setUid(storeOrder.getUid());
|
||||
record.setLinkId(storeOrder.getOrderId()); // Use Order Number as linkId
|
||||
record.setLinkType(BonusPoolRecordConstants.LINK_TYPE_ORDER);
|
||||
record.setType(BonusPoolRecordConstants.TYPE_ADD);
|
||||
record.setTitle(BonusPoolRecordConstants.TITLE_ORDER_ADD); // Set appropriate title
|
||||
record.setAmount(amount);
|
||||
record.setBalance(newBalance); // Store the balance AFTER the change
|
||||
|
||||
// Generate Mark based on type
|
||||
String markFormat = "订单 %s 完成,奖励 %s 资金池积分"; // Default mark
|
||||
if ("product_give".equals(markType)) {
|
||||
markFormat = "订单 %s 商品奖励 %s 资金池积分";
|
||||
}
|
||||
record.setMark(StrUtil.format(markFormat, storeOrder.getOrderId(), amount));
|
||||
|
||||
Date currentTime = DateUtil.nowDateTime();
|
||||
record.setCreateTime(currentTime);
|
||||
record.setUpdateTime(currentTime);
|
||||
|
||||
// Handle freezing logic
|
||||
String frozenDaysStr = systemConfigService.getValueByKey(BonusPoolRecordConstants.CONFIG_KEY_BONUS_POOL_FROZEN_DAYS);
|
||||
int frozenDays = 0;
|
||||
try {
|
||||
if (StrUtil.isNotBlank(frozenDaysStr)) {
|
||||
frozenDays = Integer.parseInt(frozenDaysStr);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("Error parsing bonus pool frozen days config: {}", frozenDaysStr);
|
||||
frozenDays = 0; // Default to 0 if config is invalid
|
||||
}
|
||||
|
||||
record.setFrozenTime(frozenDays);
|
||||
|
||||
if (frozenDays > 0) {
|
||||
record.setStatus(BonusPoolRecordConstants.STATUS_FROZEN);
|
||||
// Calculate thaw time (end of the day 'frozenDays' from now)
|
||||
|
||||
Long thawTime = cn.hutool.core.date.DateUtil.current(false);
|
||||
// Optional: Set to end of day for clarity, e.g., 23:59:59. Adjust if precise time is needed.
|
||||
// thawDate = DateUtil.endOfDay(thawDate);
|
||||
record.setThawTime(thawTime); // Store as milliseconds timestamp
|
||||
} else {
|
||||
record.setStatus(BonusPoolRecordConstants.STATUS_COMPLETE); // Immediately complete if no freeze
|
||||
record.setThawTime(null); // No thaw time needed
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发送消息通知
|
||||
* 根据用户类型发送
|
||||
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.XML;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.request.SmsApplyTempRequest;
|
||||
@ -32,6 +31,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -608,4 +608,6 @@ public class SmsServiceImpl implements SmsService {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -480,6 +480,7 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
|
||||
if (execute) {
|
||||
// 发送用户确认收货管理员提醒短信
|
||||
SystemNotification notification = systemNotificationService.getByMark(NotifyConstants.RECEIPT_GOODS_ADMIN_MARK);
|
||||
@ -495,7 +496,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 发送消息通知
|
||||
pushMessageOrder(storeOrder, user);
|
||||
}
|
||||
|
@ -0,0 +1,83 @@
|
||||
//package com.zbkj.service.util;
|
||||
//
|
||||
//import com.aliyuncs.DefaultAcsClient;
|
||||
//import com.aliyuncs.IAcsClient;
|
||||
//import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
||||
//import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
//import com.aliyuncs.profile.DefaultProfile;
|
||||
//import com.aliyuncs.profile.IClientProfile;
|
||||
//
|
||||
///**
|
||||
// * Created on 17/6/7.
|
||||
// * 短信API产品的DEMO程序,工程中包含了一个SmsDemo类,直接通过
|
||||
// * 执行main函数即可体验短信产品API功能(只需要将AK替换成开通了云通信-短信产品功能的AK即可)
|
||||
// * 工程依赖了2个jar包(存放在工程的libs目录下)
|
||||
// * 1:aliyun-java-sdk-core.jar
|
||||
// * 2:aliyun-java-sdk-dysmsapi.jar
|
||||
// * <p>
|
||||
// * 备注:Demo工程编码采用UTF-8
|
||||
// * 国际短信发送请勿参照此DEMO
|
||||
// */
|
||||
//public class SmsSender {
|
||||
//
|
||||
// //产品名称:云通信短信API产品,开发者无需替换
|
||||
// private static final String product = "Dysmsapi"; // 无需修改
|
||||
// //产品域名,开发者无需替换
|
||||
// private static final String domain = "dysmsapi.aliyuncs.com"; // 无需修改
|
||||
//
|
||||
// private static final String accessKeyId = "XXXXXXXXX"; // 修改accessKeyId
|
||||
// private static final String accessKeySecret = "YYYYYYYYYYYYY"; // 修改accessKeySecret
|
||||
//
|
||||
// /**
|
||||
// * 短信发送
|
||||
// *
|
||||
// * @param phoneNumbers 待发送手机号,支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
|
||||
// * @param signName 短信签名-可在短信控制台中找到
|
||||
// * @param templateCode 短信模板编码-可在短信控制台中找到
|
||||
// * @param templateParam 模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 {\"name\":\"Tom\", \"code\":\"123\"}
|
||||
// * @return
|
||||
// */
|
||||
// public static SendSmsResponse sendSms(String phoneNumbers, String signName, String templateCode, String templateParam) {
|
||||
//
|
||||
// //可自助调整超时时间
|
||||
// System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||
// System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
||||
// SendSmsResponse sendSmsResponse = null;
|
||||
// try {
|
||||
// //初始化acsClient,暂不支持region化
|
||||
// IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
|
||||
// DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
|
||||
// IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||
//
|
||||
// //组装请求对象-具体描述见控制台-文档部分内容
|
||||
// SendSmsRequest request = new SendSmsRequest();
|
||||
// //必填:待发送手机号
|
||||
// request.setPhoneNumbers(phoneNumbers);
|
||||
// //必填:短信签名-可在短信控制台中找到
|
||||
// request.setSignName(signName);
|
||||
// //必填:短信模板-可在短信控制台中找到
|
||||
// request.setTemplateCode(templateCode);
|
||||
// //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${title}"时,此处的值为
|
||||
// request.setTemplateParam(templateParam);
|
||||
// //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||
// //request.setSmsUpExtendCode("90997");
|
||||
// //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
||||
//// request.setOutId("yourOutId");
|
||||
// sendSmsResponse = acsClient.getAcsResponse(request); // 发送短信,且返回结果
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// return sendSmsResponse;
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// //发短信
|
||||
// SendSmsResponse response = sendSms("13000000000","测试公司","SMS_11111111","{\"name\":\"Tom\", \"title\":\"123\"}");
|
||||
// System.out.println("短信接口返回的数据----------------");
|
||||
// System.out.println("Code=" + response.getCode());
|
||||
// System.out.println("Message=" + response.getMessage());
|
||||
// System.out.println("RequestId=" + response.getRequestId());
|
||||
// System.out.println("BizId=" + response.getBizId());
|
||||
//
|
||||
// }
|
||||
//}
|
@ -4,13 +4,12 @@
|
||||
|
||||
|
||||
<select id="calculateTotalPointsPool" resultType="java.math.BigDecimal">
|
||||
SELECT t1.balance
|
||||
FROM eb_user_integral_record t1
|
||||
SELECT uid, MAX(create_time) as latest_time
|
||||
FROM eb_user_integral_record
|
||||
GROUP BY uid
|
||||
) t2 ON t1.uid = t2.uid AND t1.create_time = t2.latest_time
|
||||
ORDER BY t1.uid;
|
||||
SELECT
|
||||
SUM( t1.balance ) AS total_balance
|
||||
FROM
|
||||
eb_user_integral_record t1
|
||||
JOIN ( SELECT uid, MAX( create_time ) AS latest_time FROM eb_user_integral_record GROUP BY uid ) t2 ON t1.uid = t2.uid
|
||||
AND t1.create_time = t2.latest_time;
|
||||
<!-- 可以根据需要添加WHERE条件,例如只计算状态为已完成的记录 -->
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
x
Reference in New Issue
Block a user