Commit 251202cd by 吕明尚

自动任务增加判断

parent b8c40ad0
package share.web.controller.system;
import cn.hutool.json.JSONObject;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.domain.R;
import share.common.enums.ReceiptRdeisEnum;
import share.system.domain.vo.SessionVo;
import share.system.service.QPService;
import java.text.SimpleDateFormat;
@RestController
@RequestMapping("/chessCards")
......@@ -23,7 +17,6 @@ import java.text.SimpleDateFormat;
public class QPController {
@Autowired
private QPService qpService;
RedisTemplate redisTemplate = new RedisTemplate();
//通过authCode,获取授权的session
@GetMapping("/oauthToken")
......
......@@ -2,19 +2,19 @@ package share.common.enums;
public enum PlatformTypeEnum {
//1:自营,2:美团
SELF("1", "自营"),
MEITUAN("2", "美团"),
TIKTOK("3", "抖音");
SELF(1, "自营"),
MEITUAN(2, "美团"),
TIKTOK(3, "抖音");
private String code;
private Integer code;
private String name;
public String getCode() {
public Integer getCode() {
return code;
}
public void setCode(String code) {
public void setCode(Integer code) {
this.code = code;
}
......@@ -27,7 +27,7 @@ public enum PlatformTypeEnum {
}
PlatformTypeEnum(String code, String name) {
PlatformTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
......
......@@ -112,14 +112,14 @@ public class RedisTask {
if (!CollectionUtils.isEmpty(coupons)) {
for (SConsumerCoupon coupon : coupons) {
//美团复验券
if (ObjectUtil.isNotEmpty(coupon.getDealId())) {
if (ObjectUtil.isNotEmpty(coupon.getDealId()) && coupon.getPlatformType().equals(PlatformTypeEnum.MEITUAN.getCode())) {
TuangouReceiptGetConsumedReponseEntity getconsumed = qpService.getconsumed(coupon.getCouponCode(),
stores.stream().filter(store -> store.getId().equals(coupon.getStoreId())).findFirst().get().getOpenShopUuid());
if (getconsumed == null) {
expiredCoupons.add(coupon.getId());
}
logger.info("券码:{}->查询结束:{}", coupon.getCouponCode(), getconsumed);
} else if (StringUtils.isNoneEmpty(coupon.getSkuId())) {
} else if (StringUtils.isNoneEmpty(coupon.getSkuId()) && coupon.getPlatformType().equals(PlatformTypeEnum.MEITUAN.getCode())) {
//抖音复验券
JSONObject object = tiktokService.certificateGet(coupon.getCouponCode());
JSONObject certificate = object.getJSONObject("certificate");
......
package share.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 优惠券领取记录对象 s_consumer_coupon
*
......@@ -131,7 +129,7 @@ public class SConsumerCoupon extends BaseEntity
/** 平台类型(1:自营,2:美团) */
@Excel(name = "平台类型(1:自营,2:美团 3: 抖音)")
private String platformType;
private Integer platformType;
/** 有效期开始 */
@JsonFormat(pattern = "yyyy-MM-dd")
......
package share.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
* 优惠券对象 s_coupon
*
......@@ -126,7 +124,7 @@ public class SCoupon extends BaseEntity
/**
* 第三方平台类型(1:自营,2:美团)
*/
@Excel(name = "第三方平台类型(1:自营,2:美团)")
@Excel(name = "第三方平台类型(1:自营,2:美团,3: 抖音)")
private Integer platformType;
/** 优惠券数量 */
......
package share.system.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.Arrays;
import java.util.stream.Collectors;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import share.common.enums.*;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.StringUtils;
import share.system.domain.*;
import share.system.domain.vo.FrontTokenComponent;
......@@ -23,6 +18,10 @@ import share.system.mapper.SConsumerCouponMapper;
import share.system.request.CouponRequest;
import share.system.service.*;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 优惠券领取记录Service业务层处理
*
......@@ -402,7 +401,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setOrderType(sCoupon.getOrderType());
newSConsumerCoupon.setPackIds(sCoupon.getPackIds());
newSConsumerCoupon.setSourceType(SourceTypeEnum.GIVE.getCode());
newSConsumerCoupon.setPlatformType(String.valueOf(sCoupon.getPlatformType()));
newSConsumerCoupon.setPlatformType(sCoupon.getPlatformType());
newSConsumerCoupon.setStartDate(sCoupon.getStartDate());
newSConsumerCoupon.setEndDate(sCoupon.getEndDate());
newSConsumerCoupon.setRemark(sCoupon.getRemark());
......
......@@ -15,10 +15,7 @@ import org.springframework.util.ObjectUtils;
import share.common.core.page.PageDomain;
import share.common.core.page.TableDataInfo;
import share.common.core.page.TableSupport;
import share.common.enums.CouponTypeEnum;
import share.common.enums.RoomType;
import share.common.enums.StoreType;
import share.common.enums.YesNoEnum;
import share.common.enums.*;
import share.common.utils.DateUtils;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SCoupon;
......@@ -113,7 +110,14 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
sCoupon.setMaxDuration(DEFAULT_MAX_DURATION);
sCoupon.setMinPrice(new BigDecimal("0.00"));
sCoupon.setCreateTime(DateUtils.getNowDate());
SCoupon sCouponList = sCouponMapper.selectByDealgroupId(sCoupon.getDealgroupId());
SCoupon sCouponList = null;
if (sCoupon.getPlatformType().equals(PlatformTypeEnum.MEITUAN.getCode())) {
sCouponList = sCouponMapper.selectByDealgroupId(sCoupon.getDealgroupId());
} else if (sCoupon.getPlatformType().equals(PlatformTypeEnum.TIKTOK.getCode())) {
LambdaQueryWrapper<SCoupon> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SCoupon::getSkuId, sCoupon.getSkuId());
sCouponList = sCouponMapper.selectOne(wrapper);
}
if (ObjectUtils.isEmpty(sCouponList)) {
return sCouponMapper.insertSCoupon(sCoupon);
} else {
......
......@@ -387,12 +387,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
byId = consumerCouponService.getById(request.getCouponId());
if (Objects.nonNull(byId)) {
if (byId.getUseStatus().equals(UserStatusEnum.UNUSED.getCode())) {
if (StringUtils.isNotEmpty(byId.getCouponCode()) && ObjectUtil.isNotEmpty(byId.getDealId())) {
if (StringUtils.isNotEmpty(byId.getCouponCode()) && ObjectUtil.isNotEmpty(byId.getDealId()) && byId.getPlatformType().equals(PlatformTypeEnum.MEITUAN.getCode())) {
TuangouReceiptGetConsumedReponseEntity getconsumed = qpService.getconsumed(byId.getCouponCode(), stores.stream().filter(store -> store.getId().equals(byId.getStoreId())).findFirst().get().getOpenShopUuid());
if (getconsumed == null) {
throw new RuntimeException("优惠券异常,请稍后再试");
}
} else if (StringUtils.isNoneEmpty(byId.getSkuId())) {
} else if (StringUtils.isNoneEmpty(byId.getSkuId()) && byId.getPlatformType().equals(PlatformTypeEnum.TIKTOK.getCode())) {
//抖音复验券
JSONObject object = tiktokService.certificateGet(byId.getCouponCode());
JSONObject certificate = object.getJSONObject("certificate");
......
......@@ -170,7 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderType != null">#{orderType},</if>
<if test="packIds != null">#{packIds},</if>
<if test="dealgroupId != null">#{dealgroupId},</if>
<if test="skuId != null">#{skuId}</if>
<if test="skuId != null">#{skuId},</if>
<if test="storeIds != null">#{storeIds},</if>
</trim>
</insert>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment