领取优惠券操作

This commit is contained in:
19991905653 2024-04-12 13:35:02 +08:00
parent 3a90299b64
commit e86ec29a33
18 changed files with 259 additions and 185 deletions

View File

@ -79,8 +79,16 @@ public class OrderController {
private Result getYhqPara(){
return orderService.getYhqPara();
}
@GetMapping("/testPay")
private Result testPay(@RequestParam Integer orderId){
return orderService.testPay(orderId);
@GetMapping("/getYhqDouble")
private Result getYhqDouble(@RequestParam Integer orderId){
return orderService.getYhqDouble(orderId);
}
@PostMapping("/yhqDouble")
private Result yhqDouble(@RequestParam Integer conponsId){
return orderService.yhqDouble(conponsId);
}
// @GetMapping("/testPay")
// private Result testPay(@RequestParam Integer orderId){
// return orderService.testPay(orderId);
// }
}

View File

@ -7,8 +7,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
import com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper;
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
@ -49,11 +51,12 @@ public class UserContoller {
@Autowired
private TbShopUserMapper shopUserMapper;
@Autowired
private TbUserInfoMapper userInfoMapper;
@GetMapping("/userInfo")
public JSONObject userInfo(@RequestParam("openId") String openId ) throws Exception {
TbShopUser shopUser = shopUserMapper.selectByOpenId(openId);
TbUserInfo shopUser = userInfoMapper.selectByOpenId(openId);
JSONObject jsonObject = new JSONObject();
if (Objects.isNull(shopUser)){
jsonObject.put("status","fail");
@ -65,7 +68,7 @@ public class UserContoller {
JSONObject object = new JSONObject();
object.put("token",token);
object.put("userSign",userSign);
object.put("num",shopUser.getLevelConsume());
object.put("num",shopUser.getTotalScore());
jsonObject.put("status","success");
jsonObject.put("msg","成功");
jsonObject.put("data",object);
@ -77,10 +80,22 @@ public class UserContoller {
String userSign = jsonObject.getString("userSign");
return userService.modityIntegral(integralVo,userSign);
}
@GetMapping("/userIntegral")
@PostMapping("/userIntegral")
public JSONObject userIntegral(@RequestHeader String token,@RequestBody IntegralFlowVo integralFlowVo ) throws Exception {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userSign = jsonObject.getString("userSign");
return userService.userIntegral(integralFlowVo,userSign);
}
@PostMapping("/userAllIntegral")
public JSONObject userAllIntegral(@RequestBody IntegralFlowVo integralFlowVo ) throws Exception {
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
// String userSign = jsonObject.getString("userSign");
return userService.userAllIntegral(integralFlowVo,"userSign");
}
@PostMapping("/userAll")
public JSONObject userAll(@RequestBody IntegralFlowVo integralFlowVo ) throws Exception {
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
// String userSign = jsonObject.getString("userSign");
return userService.userAll(integralFlowVo,"userSign");
}
}

View File

@ -19,4 +19,6 @@ public interface TbReleaseFlowMapper {
int updateByPrimaryKey(TbReleaseFlow record);
List<TbReleaseFlow> selectByUserId(@Param("userId") String userId);
List<TbReleaseFlow> selectAll();
}

View File

@ -1,10 +1,14 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbUserCoupons;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface TbUserCouponsMapper {
int deleteByPrimaryKey(Integer id);
@ -19,4 +23,6 @@ public interface TbUserCouponsMapper {
int updateByPrimaryKey(TbUserCoupons record);
List<TbUserCoupons> selectByUserId(@Param("userId") String userId,@Param("status") String status);
TbUserCoupons selectByOrderId(@Param("orderId") Integer orderId);
}

View File

@ -4,6 +4,8 @@ import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface TbUserInfoMapper {
@ -38,4 +40,5 @@ public interface TbUserInfoMapper {
TbUserInfo selectByPhone(String phone);
List<TbUserInfo> selectAll();
}

View File

@ -1,38 +1,19 @@
package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class TbParams implements Serializable {
private Integer id;
private BigDecimal integralRatio;
private BigDecimal twoRatio;
private BigDecimal tradeRatio;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getIntegralRatio() {
return integralRatio;
}
public void setIntegralRatio(BigDecimal integralRatio) {
this.integralRatio = integralRatio;
}
public BigDecimal getTradeRatio() {
return tradeRatio;
}
public void setTradeRatio(BigDecimal tradeRatio) {
this.tradeRatio = tradeRatio;
}
}

View File

@ -1,9 +1,12 @@
package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class TbReleaseFlow implements Serializable {
private Integer id;
@ -12,68 +15,16 @@ public class TbReleaseFlow implements Serializable {
private BigDecimal num;
private String type;
private String operationType;
private String remark;
private String nickName;
private String fromSource;
private Date createTime;
private String createTr;
private String openId;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
public BigDecimal getNum() {
return num;
}
public void setNum(BigDecimal num) {
this.num = num;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public String getFromSource() {
return fromSource;
}
public void setFromSource(String fromSource) {
this.fromSource = fromSource == null ? null : fromSource.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -1,19 +1,24 @@
package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class TbUserCoupons implements Serializable {
private Integer id;
private String userId;
private Integer orderId;
private BigDecimal couponsPrice;
private BigDecimal couponsAmount;
private String status;
private String isDouble;
private Date createTime;
@ -22,68 +27,4 @@ public class TbUserCoupons implements Serializable {
private Date endTime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
public BigDecimal getCouponsPrice() {
return couponsPrice;
}
public void setCouponsPrice(BigDecimal couponsPrice) {
this.couponsPrice = couponsPrice;
}
public BigDecimal getCouponsAmount() {
return couponsAmount;
}
public void setCouponsAmount(BigDecimal couponsAmount) {
this.couponsAmount = couponsAmount;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
}

View File

@ -16,4 +16,5 @@ public class RedisCst {
public static final String PRODUCT = "PRODUCT:";
public static final String INTEGRAL_COIN_KEY = "INTEGRAL:COIN:KEY";
public static final String COUPONS_COIN_KEY = "COUPONS:COIN:KEY";
}

View File

@ -7,6 +7,7 @@ import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -40,7 +41,8 @@ public class IntegralService {
private TbReleaseFlowMapper integralFlowMapper;
@Autowired
private TbUserCouponsMapper userCouponsMapper;
@Autowired
private TbSplitAccountsMapper splitAccountsMapper;
@Transactional(rollbackFor = Exception.class)
public void integralAdd(JSONObject jsonObject) throws ParseException {
@ -66,18 +68,37 @@ public class IntegralService {
}else {
Integer orderId = jsonObject.getInteger("orderId");
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
if (StringUtils.isNotBlank(orderInfo.getUserCouponId())){
TbUserCoupons userCoupons = userCouponsMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getUserCouponId()));
if (Objects.nonNull(userCoupons)){
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
TbSplitAccounts splitAccounts = new TbSplitAccounts();
splitAccounts.setConponsAmount(userCoupons.getCouponsAmount());
splitAccounts.setCreateTime(new Date());
splitAccounts.setIsSplit("false");
splitAccounts.setMerchantId(Integer.valueOf(shopInfo.getMerchantId()));
splitAccounts.setShopId(shopInfo.getId());
splitAccounts.setOrderAmount(orderInfo.getPayAmount());
splitAccounts.setTradeDay(DateUtils.getDay());
splitAccounts.setOriginAmount(orderInfo.getOriginAmount());
splitAccountsMapper.insert(splitAccounts);
}
}
if (Objects.isNull(orderInfo)) {
throw new MsgException("该订单不存在");
log.error("该订单不存在");
return;
}
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
if (Objects.isNull(shopInfo) || !"true".equals(shopInfo.getIsOpenYhq())){
throw new MsgException("该店铺未开启优惠券功能");
log.error("该店铺未开启优惠券功能");
return;
}
TbParams params = tbShopUserMapper.selectParams();
TbUserCoupons userCoupons = new TbUserCoupons();
userCoupons.setUserId(orderInfo.getUserId());
userCoupons.setCouponsAmount(orderInfo.getPayAmount().multiply(params.getIntegralRatio()));
userCoupons.setStatus("0");
userCoupons.setOrderId(orderId);
userCoupons.setCouponsPrice(userCoupons.getCouponsAmount().multiply(new BigDecimal("0.5")));
userCoupons.setCreateTime(new Date());
userCoupons.setEndTime(DateUtils.getNewDate(new Date(),3,30));

View File

@ -79,6 +79,8 @@ public class OrderService {
private TbSystemCouponsMapper systemCouponsMapper;
@Autowired
private TbYhqParamsMapper yhqParamsMapper;
@Autowired
private TbShopUserMapper shopUserMapper;
/**
* 创建订单
*
@ -295,7 +297,9 @@ public class OrderService {
releaseFlow.setCreateTime(new Date());
releaseFlow.setFromSource("OWER");
releaseFlow.setUserId(userId);
releaseFlow.setOperationType("ADD");
releaseFlow.setType("EXCHANGEADD");
releaseFlow.setRemark("兑换增加");
releaseFlowMapper.insert(releaseFlow);
redisUtils.releaseLock(RedisCst.INTEGRAL_COIN_KEY + userId);
} else {
@ -359,4 +363,38 @@ public class OrderService {
producer.printCoupons(coupons.toJSONString());
return Result.success(CodeEnum.SUCCESS);
}
public Result getYhqDouble(Integer orderId) {
TbUserCoupons userCoupons = userCouponsMapper.selectByOrderId(orderId);
return Result.success(CodeEnum.SUCCESS,userCoupons);
}
@Transactional(rollbackFor = Exception.class)
public Result yhqDouble(Integer conponsId) {
TbUserCoupons userCoupons = userCouponsMapper.selectByPrimaryKey(conponsId);
if (Objects.isNull(userCoupons) || userCoupons.getIsDouble().equals("true")){
throw new MsgException("该优惠券翻倍已领取");
}
return Result.success(CodeEnum.SUCCESS);
}
private void modityDouble(Integer conponsId) throws ParseException {
boolean lock_coin = redisUtils.lock(RedisCst.COUPONS_COIN_KEY + conponsId, 5000, TimeUnit.MILLISECONDS);
if (lock_coin) {
TbUserCoupons userCoupons = userCouponsMapper.selectByPrimaryKey(conponsId);
if (Objects.isNull(userCoupons) || !userCoupons.getStatus().equals("0") || userCoupons.getIsDouble().equals("true")) {
throw new MsgException("该优惠券已翻倍");
}
TbParams params = shopUserMapper.selectParams();
userCoupons.setIsDouble("true");
userCoupons.setCouponsAmount(userCoupons.getCouponsAmount().multiply(params.getTwoRatio()));
userCoupons.setCouponsPrice(userCoupons.getCouponsPrice().multiply(params.getTwoRatio()));
userCoupons.setUpdateTime(new Date());
userCouponsMapper.updateByPrimaryKeySelective(userCoupons);
redisUtils.releaseLock(RedisCst.COUPONS_COIN_KEY + conponsId);
} else {
modityDouble(conponsId);
}
}
}

View File

@ -15,6 +15,7 @@ import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -32,7 +33,8 @@ public class UserService {
private TbShopUserMapper shopUserMapper;
@Autowired
private TbReleaseFlowMapper releaseFlowMapper;
@Autowired
private TbUserInfoMapper userInfoMapper;
@Autowired
RedisUtils redisUtils;
@ -65,7 +67,7 @@ public class UserService {
result.put("data", "");
return result;
}
boolean falg = updateIntegral(shopUser.getId(), integralVo.getNum(), integralVo.getType());
boolean falg = updateIntegral(shopUser.getUserId(), integralVo.getNum(), integralVo.getType());
if (!falg) {
JSONObject result = new JSONObject();
result.put("status", "fail");
@ -96,16 +98,16 @@ public class UserService {
boolean lock_coin = redisUtils.lock(RedisCst.INTEGRAL_COIN_KEY + userId, 5000, TimeUnit.MILLISECONDS);
if (lock_coin) {
TbShopUser tbShopUser = shopUserMapper.selectByPrimaryKey(userId);
TbUserInfo tbShopUser = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
boolean flag = true;
if (type.equals("sub")) {
if (N.gt(num, tbShopUser.getLevelConsume())) {
if (num.intValue() < tbShopUser.getTotalScore()) {
flag = false;
} else {
tbShopUser.setLevelConsume(tbShopUser.getLevelConsume().subtract(num));
tbShopUser.setTotalScore(tbShopUser.getTotalScore() - num.intValue());
}
} else if (type.equals("add")) {
tbShopUser.setLevelConsume(tbShopUser.getLevelConsume().add(num));
tbShopUser.setTotalScore(tbShopUser.getTotalScore() - num.intValue());
}
if (flag) {
TbReleaseFlow releaseFlow = new TbReleaseFlow();
@ -115,11 +117,15 @@ public class UserService {
releaseFlow.setUserId(userId);
if (type.equals("sub")) {
releaseFlow.setType("BUYSUB");
}else if (type.equals("sub")){
releaseFlow.setOperationType("SUB");
releaseFlow.setRemark("购买商品扣除");
} else if (type.equals("sub")) {
releaseFlow.setType("THREEADD");
releaseFlow.setOperationType("ADD");
releaseFlow.setRemark("退货增加");
}
releaseFlowMapper.insert(releaseFlow);
shopUserMapper.updateByPrimaryKeySelective(tbShopUser);
userInfoMapper.updateByPrimaryKeySelective(tbShopUser);
}
redisUtils.releaseLock(RedisCst.INTEGRAL_COIN_KEY + userId);
return flag;
@ -141,7 +147,7 @@ public class UserService {
result.put("data", "");
return result;
}
TbShopUser shopUser = shopUserMapper.selectByOpenId(integralFlowVo.getOpenId());
TbUserInfo shopUser = userInfoMapper.selectByOpenId(integralFlowVo.getOpenId());
if (Objects.isNull(shopUser)) {
JSONObject result = new JSONObject();
result.put("status", "fail");
@ -151,11 +157,65 @@ public class UserService {
}
PageHelper.startPage(integralFlowVo.getPage(), integralFlowVo.getPageSize());
PageHelper.orderBy("id DESC");
List<TbReleaseFlow> list = releaseFlowMapper.selectByUserId(shopUser.getId());
List<TbReleaseFlow> list = releaseFlowMapper.selectByUserId(shopUser.getId().toString());
for (TbReleaseFlow tbReleaseFlow:list){
tbReleaseFlow.setCreateTr(DateUtils.getStrTime(tbReleaseFlow.getCreateTime()));
}
JSONObject result = new JSONObject();
result.put("status", "success");
result.put("msg", "成功");
result.put("data",list);
result.put("data", list);
return result;
}
public JSONObject userAllIntegral(IntegralFlowVo integralFlowVo, String userSign) {
// JSONObject object = (JSONObject) JSONObject.toJSON(integralFlowVo);
// object.put("userSign", userSign);
// JSONObject jsonObject = JSONUtil.sortJSONObject(object, CacheMap.notOpenMap);
// System.out.println(jsonObject.toJSONString());
// String sign = MD5Util.encrypt(jsonObject.toJSONString());
// if (!sign.equals(integralFlowVo.getSign())) {
// JSONObject result = new JSONObject();
// result.put("status", "fail");
// result.put("msg", "签名验证失败");
// result.put("data", "");
// return result;
// }
PageHelper.startPage(integralFlowVo.getPage(), integralFlowVo.getPageSize());
PageHelper.orderBy("id DESC");
List<TbReleaseFlow> list = releaseFlowMapper.selectAll();
for (TbReleaseFlow tbReleaseFlow:list){
tbReleaseFlow.setCreateTr(DateUtils.getStrTime(tbReleaseFlow.getCreateTime()));
}
PageInfo pageInfo = new PageInfo(list);
JSONObject result = new JSONObject();
result.put("status", "success");
result.put("msg", "成功");
result.put("data", pageInfo);
return result;
}
public JSONObject userAll(IntegralFlowVo integralFlowVo, String userSign) {
// JSONObject object = (JSONObject) JSONObject.toJSON(integralFlowVo);
// object.put("userSign", userSign);
// JSONObject jsonObject = JSONUtil.sortJSONObject(object, CacheMap.notOpenMap);
// System.out.println(jsonObject.toJSONString());
// String sign = MD5Util.encrypt(jsonObject.toJSONString());
// if (!sign.equals(integralFlowVo.getSign())) {
// JSONObject result = new JSONObject();
// result.put("status", "fail");
// result.put("msg", "签名验证失败");
// result.put("data", "");
// return result;
// }
PageHelper.startPage(integralFlowVo.getPage(), integralFlowVo.getPageSize());
PageHelper.orderBy("id DESC");
List<TbUserInfo> list = userInfoMapper.selectAll();
PageInfo pageInfo = new PageInfo(list);
JSONObject result = new JSONObject();
result.put("status", "success");
result.put("msg", "成功");
result.put("data", pageInfo);
return result;
}
}

View File

@ -1,13 +1,7 @@
package com.chaozhanggui.system.cashierservice.task;
import com.chaozhanggui.system.cashierservice.dao.TbOrderInfoMapper;
import com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper;
import com.chaozhanggui.system.cashierservice.dao.TbWiningParamsMapper;
import com.chaozhanggui.system.cashierservice.dao.TbWiningUserMapper;
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.TbWiningParams;
import com.chaozhanggui.system.cashierservice.entity.TbWiningUser;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.NicknameGenerator;
import com.chaozhanggui.system.cashierservice.util.RandomUtil;
@ -33,15 +27,51 @@ public class TaskScheduler {
private TbWiningParamsMapper winingParamsMapper;
@Autowired
private TbUserInfoMapper userInfoMapper;
@Autowired
private TbReleaseFlowMapper releaseFlowMapper;
//更新订单状态
// @Scheduled(fixedRate = 1000, initialDelay = 5000)
// @Scheduled(fixedRate = 1000000)
public void orderStatus() throws InterruptedException {
System.out.println(DateUtils.getTime());
Thread.sleep(10000);
for (int i = 0;i<10;i++){
TbReleaseFlow releaseFlow = new TbReleaseFlow();
BigDecimal orderAmount = RandomUtil.getRandomBigDecimal(BigDecimal.ONE, new BigDecimal("100"));
releaseFlow.setNum(orderAmount);
releaseFlow.setCreateTime(new Date());
releaseFlow.setFromSource("OWER");
releaseFlow.setUserId("15");
releaseFlow.setOperationType("ADD");
releaseFlow.setType("EXCHANGEADD");
releaseFlow.setRemark("兑换增加");
releaseFlowMapper.insert(releaseFlow);
}
for (int i = 0;i<10;i++){
TbReleaseFlow releaseFlow = new TbReleaseFlow();
BigDecimal orderAmount = RandomUtil.getRandomBigDecimal(BigDecimal.ONE, new BigDecimal("100"));
releaseFlow.setNum(orderAmount);
releaseFlow.setCreateTime(new Date());
releaseFlow.setFromSource("OWER");
releaseFlow.setUserId("15");
releaseFlow.setOperationType("SUB");
releaseFlow.setType("BUYSUB");
releaseFlow.setRemark("购买商品扣除");
releaseFlowMapper.insert(releaseFlow);
}
for (int i = 0;i<10;i++){
TbReleaseFlow releaseFlow = new TbReleaseFlow();
BigDecimal orderAmount = RandomUtil.getRandomBigDecimal(BigDecimal.ONE, new BigDecimal("100"));
releaseFlow.setNum(orderAmount);
releaseFlow.setCreateTime(new Date());
releaseFlow.setFromSource("OWER");
releaseFlow.setOperationType("ADD");
releaseFlow.setUserId("15");
releaseFlow.setType("THREEADD");
releaseFlow.setRemark("退货增加");
releaseFlowMapper.insert(releaseFlow);
}
}
// @Scheduled(fixedRate = 1000)
@Scheduled(fixedRate = 200000)
public void winningUser() {
String day = DateUtils.getDay();
List<TbWiningParams> list = winingParamsMapper.selectAll();

View File

@ -7,4 +7,8 @@ public interface CacheMap {
Map<String,String> map = new HashMap(){{
put("sign","1");
}};
Map<String,String> notOpenMap = new HashMap(){{
put("sign","1");
put("openId","1");
}};
}

View File

@ -99,7 +99,9 @@ public class DateUtils {
public static String getTime() {
return sdfTime.format(new Date());
}
public static String getStrTime(Date date) {
return sdfTime.format(date);
}
/**
* @Title: compareDate
* @Description: TODO(日期比较如果s>=e 返回true 否则返回false)

View File

@ -8,10 +8,11 @@
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="from_source" jdbcType="VARCHAR" property="fromSource" />
<result column="operation_type" jdbcType="VARCHAR" property="operationType" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, num, type, remark, from_source, create_time
id, user_id, num, type, remark, from_source, create_time,operation_type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@ -23,17 +24,20 @@
parameterType="java.lang.String">
select * from tb_release_flow where user_id = #{userId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<select id="selectAll" resultType="com.chaozhanggui.system.cashierservice.entity.TbReleaseFlow">
select trf.*,tui.nick_name as nickName,tui.mini_app_open_id as openId from tb_release_flow trf left join tb_user_info tui on trf.user_id = tui.id
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_release_flow
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbReleaseFlow">
insert into tb_release_flow (id, user_id, num,
type, remark, from_source,
create_time)
create_time,operation_type)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{num,jdbcType=DECIMAL},
#{type,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{fromSource,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
#{createTime,jdbcType=TIMESTAMP}, #{operationType,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbReleaseFlow">
insert into tb_release_flow

View File

@ -7,12 +7,13 @@
<result column="coupons_price" jdbcType="DECIMAL" property="couponsPrice" />
<result column="coupons_amount" jdbcType="DECIMAL" property="couponsAmount" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="is_double" jdbcType="VARCHAR" property="isDouble" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, coupons_price, coupons_amount, status, create_time, update_time, end_time
id, user_id, coupons_price, coupons_amount, status, create_time, update_time, end_time,is_double
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@ -26,6 +27,9 @@
and status = #{status}
</if>
</select>
<select id="selectByOrderId" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons">
select * from tb_user_coupons where order_id = #{orderId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_user_coupons
where id = #{id,jdbcType=INTEGER}
@ -33,10 +37,10 @@
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons" useGeneratedKeys="true" keyProperty="id">
insert into tb_user_coupons (id, user_id, coupons_price,
coupons_amount, status, create_time,
update_time, end_time)
update_time, end_time,is_double)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{couponsPrice,jdbcType=DECIMAL},
#{couponsAmount,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP})
#{updateTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{isDouble,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons">
insert into tb_user_coupons

View File

@ -600,5 +600,8 @@
<select id="selectByPhone" resultMap="BaseResultMap">
select * from tb_user_info where telephone=#{phone} AND source_path='APP' AND user_id is null
</select>
<select id="selectAll" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
select * from tb_user_info
</select>
</mapper>