记得上下班打卡 | git大法好,push需谨慎

Commit 03d9755f authored by jiangxiulong's avatar jiangxiulong

Merge remote-tracking branch 'origin/new_member' into new_member

parents 4e6efd42 2bf4db0b
...@@ -20,4 +20,5 @@ public class OrderScriptDto { ...@@ -20,4 +20,5 @@ public class OrderScriptDto {
String userId; String userId;
Integer number; Integer number;
String couponCode; String couponCode;
Integer couponType;
} }
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<result column="number" property="number"/> <result column="number" property="number"/>
<result column="user_id" property="userId"/> <result column="user_id" property="userId"/>
<result column="coupon_code" property="couponCode"/> <result column="coupon_code" property="couponCode"/>
<result column="coupon_type" property="couponType"/>
</resultMap> </resultMap>
<select id="getPerformanceRefundOrderStatis" resultType="java.util.HashMap"> <select id="getPerformanceRefundOrderStatis" resultType="java.util.HashMap">
...@@ -267,7 +268,8 @@ ...@@ -267,7 +268,8 @@
ticket_id, ticket_id,
number, number,
user_id, user_id,
oc.coupon_code oc.coupon_code,
oc.coupon_type
from (SELECT ot.mid, from (SELECT ot.mid,
order_tickets_id, order_tickets_id,
order_code, order_code,
...@@ -278,9 +280,8 @@ ...@@ -278,9 +280,8 @@
FROM kylin_order_tickets AS ot FROM kylin_order_tickets AS ot
inner JOIN kylin_order_ticket_status AS ots ON ots.order_id = ot.order_tickets_id inner JOIN kylin_order_ticket_status AS ots ON ots.order_id = ot.order_tickets_id
inner JOIN kylin_order_ticket_relations AS otr ON otr.order_id = ot.order_tickets_id inner JOIN kylin_order_ticket_relations AS otr ON otr.order_id = ot.order_tickets_id
WHERE status = 0 AND NOW() > DATE_SUB(ot.created_at,INTERVAL -(pay_countdown_minute+1) MINUTE)) as s WHERE status = 0 AND NOW() > DATE_SUB(ot.created_at, INTERVAL -(pay_countdown_minute + 1) MINUTE)) as s
left JOIN kylin_order_coupons AS oc ON oc.order_id = s.order_tickets_id where oc.coupon_type != 101 or left JOIN kylin_order_coupons AS oc ON oc.order_id = s.order_tickets_id
oc.coupon_code is null
<if test="userId!=''"> <if test="userId!=''">
AND user_id = #{userId} AND user_id = #{userId}
</if> </if>
......
...@@ -147,7 +147,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService { ...@@ -147,7 +147,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
for (CandyUserCouponBasicDto dtoItem : dtoList) { for (CandyUserCouponBasicDto dtoItem : dtoList) {
CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, priceTotal, performanceId, timeId, ticketId); CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, priceTotal, performanceId, timeId, ticketId);
if (type == 1) { if (type == 1) {
if (baseVo.getState().equals(3) || dtoItem.getState().equals(5)) { if (baseVo.getState().equals(3) || dtoItem.getState().equals(5) || dtoItem.getState().equals(21)) {
continue; continue;
} }
} else if (type == 2) { } else if (type == 2) {
...@@ -215,9 +215,8 @@ public class CandyCouponServiceImpl implements ICandyCouponService { ...@@ -215,9 +215,8 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
for (CandyUserCouponBasicDto dtoItem : dtoList) { for (CandyUserCouponBasicDto dtoItem : dtoList) {
CandyCouponVo baseVo = CouponBaseUtil.getGoodCouponUserVo(dtoItem, priceTotal, goodId, dtoList.size()); CandyCouponVo baseVo = CouponBaseUtil.getGoodCouponUserVo(dtoItem, priceTotal, goodId, dtoList.size());
if (type == 1) { if (type == 1) {
if (baseVo.getState().equals(3) || dtoItem.getState().equals(5)) { if (baseVo.getState().equals(3) || dtoItem.getState().equals(5) || dtoItem.getState().equals(21)) {
continue; continue;
} }
} else if (type == 2) { } else if (type == 2) {
...@@ -477,7 +476,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService { ...@@ -477,7 +476,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
//删除code redis //删除code redis
redisDataUtils.delCouponByCode(ccode); redisDataUtils.delCouponByCode(ccode);
//添加baseDto -> baseDtoList //添加baseDto -> baseDtoList
redisDataUtils.addCouponByUid(uid, baseDto,userCreateTime); redisDataUtils.addCouponByUid(uid, baseDto, userCreateTime);
//入库 //入库
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> objsUserCoupon = CollectionUtil.linkedListObjectArr(), LinkedList<Object[]> objsUserCoupon = CollectionUtil.linkedListObjectArr(),
...@@ -523,7 +522,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService { ...@@ -523,7 +522,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
String uid = CurrentUtil.getCurrentUid(); String uid = CurrentUtil.getCurrentUid();
LocalDateTime userCreateTime; LocalDateTime userCreateTime;
try { try {
userCreateTime =DateUtil.Formatter.yyyyMMddHHmmssTrim.parse(CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_UCREATED).toString()); userCreateTime = DateUtil.Formatter.yyyyMMddHHmmssTrim.parse(CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_UCREATED).toString());
} catch (Exception e) { } catch (Exception e) {
userCreateTime = null; userCreateTime = null;
} }
......
...@@ -177,6 +177,7 @@ public class CouponBaseUtil { ...@@ -177,6 +177,7 @@ public class CouponBaseUtil {
voRules.setBusiId(ruleItem.getBusiId()); voRules.setBusiId(ruleItem.getBusiId());
voRules.setBusiName(ruleItem.getBusiName()); voRules.setBusiName(ruleItem.getBusiName());
rulesVoList.add(voRules); rulesVoList.add(voRules);
System.out.println(dtoItem.getUcouponId());
switch (ruleItem.getUseScope()) { switch (ruleItem.getUseScope()) {
case 80://商品 case 80://商品
isTarget = isTargetCoupon(ruleItem.getBusiId(), dtoItem.getCouType(), goodId, priceTotal, dtoItem.getValOver()); isTarget = isTargetCoupon(ruleItem.getBusiId(), dtoItem.getCouType(), goodId, priceTotal, dtoItem.getValOver());
......
...@@ -529,12 +529,7 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService { ...@@ -529,12 +529,7 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
int status = getStatus; int status = getStatus;
if (null != ticketItem) { if (null != ticketItem) {
// 判断售罄 // 判断售罄
boolean isSellOut = dataUtils.ticketIsSoldOut(ticketItem.getTicketsId()); if (6 == getStatus || 8 == getStatus || 9 == getStatus || 10 == getStatus) {
if (isSellOut) {
getStatus = 8;
status = 8;
}
if (6 == getStatus || 9 == getStatus || 10 == getStatus) {
String timeStart = ticketItem.getTimeStart(); String timeStart = ticketItem.getTimeStart();
String timeEnd = ticketItem.getTimeEnd(); String timeEnd = ticketItem.getTimeEnd();
String nowTime = DateUtil.getNowTime(); String nowTime = DateUtil.getNowTime();
...@@ -548,6 +543,11 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService { ...@@ -548,6 +543,11 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
} }
} }
} }
boolean isSellOut = dataUtils.ticketIsSoldOut(ticketItem.getTicketsId());
if (isSellOut) {
status = 8;
}
} }
return status; return status;
} }
......
...@@ -15,13 +15,11 @@ import com.liquidnet.service.kylin.mapper.KylinOrderTaskMapper; ...@@ -15,13 +15,11 @@ import com.liquidnet.service.kylin.mapper.KylinOrderTaskMapper;
import com.liquidnet.service.kylin.mapper.KylinOrderTicketRelationsMapper; import com.liquidnet.service.kylin.mapper.KylinOrderTicketRelationsMapper;
import com.liquidnet.service.kylin.mapper.KylinOrderTicketStatusMapper; import com.liquidnet.service.kylin.mapper.KylinOrderTicketStatusMapper;
import com.liquidnet.service.kylin.mapper.KylinOrderTicketsMapper; import com.liquidnet.service.kylin.mapper.KylinOrderTicketsMapper;
import com.liquidnet.service.platform.service.impl.candy.PlatformCandyCouponService;
import com.liquidnet.service.platform.service.impl.candy.PlatformCandyUserCouponService; import com.liquidnet.service.platform.service.impl.candy.PlatformCandyUserCouponService;
import com.liquidnet.service.platform.utils.DataUtils; import com.liquidnet.service.platform.utils.DataUtils;
import com.liquidnet.service.platform.utils.QueueUtils; import com.liquidnet.service.platform.utils.QueueUtils;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter; import org.springframework.data.mongodb.core.convert.MongoConverter;
...@@ -71,7 +69,8 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K ...@@ -71,7 +69,8 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K
HashMap<String, Integer> mapSurplusGeneral = new HashMap<>(); HashMap<String, Integer> mapSurplusGeneral = new HashMap<>();
ArrayList<String> orderDataList = CollectionUtil.arrayListString(); ArrayList<String> orderDataList = CollectionUtil.arrayListString();
ArrayList<String> orderIdList = CollectionUtil.arrayListString(); ArrayList<String> orderIdList = CollectionUtil.arrayListString();
HashMap<String, Object> mapMongo = new HashMap<>(); HashMap<String, Object> mapMongo = CollectionUtil.mapStringObject();
HashMap<String, String> orderTicketId = CollectionUtil.mapStringString();
ArrayList<String> couponDataList = CollectionUtil.arrayListString(); ArrayList<String> couponDataList = CollectionUtil.arrayListString();
ArrayList<String> couponIdList = CollectionUtil.arrayListString(); ArrayList<String> couponIdList = CollectionUtil.arrayListString();
...@@ -82,13 +81,19 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K ...@@ -82,13 +81,19 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K
mapMongo.put("status", KylinTableStatusConst.ORDER_STATUS2); mapMongo.put("status", KylinTableStatusConst.ORDER_STATUS2);
mapMongo.put("updatedAt", DateUtil.Formatter.yyyyMMddHHmmssSSS.format(now)); mapMongo.put("updatedAt", DateUtil.Formatter.yyyyMMddHHmmssSSS.format(now));
mapMongo.put("changeDate", now); mapMongo.put("changeDate", now);
orderDataList.add(item.getOrderTicketsId() + "," + item.getUserId()); if (!orderTicketId.containsKey(item.getOrderTicketsId())) {
orderIdList.add(item.getOrderTicketsId()); orderTicketId.put(item.getOrderTicketsId(), item.getOrderTicketsId());
couponDataList.add(item.getCouponCode() + "," + item.getUserId()); orderDataList.add(item.getOrderTicketsId() + "," + item.getUserId());
couponIdList.add(item.getCouponCode()); orderIdList.add(item.getOrderTicketsId());
mapSurplusGeneral.put(item.getTicketId(), mapSurplusGeneral.get(item.getTicketId()) == null ? item.getNumber() : mapSurplusGeneral.get(item.getTicketId()) + item.getNumber()); mapSurplusGeneral.put(item.getTicketId(), mapSurplusGeneral.get(item.getTicketId()) == null ? item.getNumber() : mapSurplusGeneral.get(item.getTicketId()) + item.getNumber());
}
if (item.getCouponType() != null) {
if (item.getCouponType() != 101) {
couponDataList.add(item.getCouponCode() + "," + item.getUserId());
couponIdList.add(item.getCouponCode());
}
}
} catch (Exception e) { } catch (Exception e) {
log.debug("CHECK TIME SYNC = " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
...@@ -96,7 +101,6 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K ...@@ -96,7 +101,6 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K
} }
} }
currentTime = System.currentTimeMillis() - currentTime; currentTime = System.currentTimeMillis() - currentTime;
log.debug("FOR 循环 -> time:" + (currentTime) + "毫秒");
if (orderDataList.size() > 0) { if (orderDataList.size() > 0) {
//mysql //mysql
...@@ -147,11 +151,11 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K ...@@ -147,11 +151,11 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K
break; break;
} }
} }
log.debug("MQLIST SIZE = " + mqList.size());
queueUtils.sendMsgByRedis(MQConst.KylinQueue.SQL_ORDER_CLOSE.getKey(), OrderCloseMapping.get(mqList)); queueUtils.sendMsgByRedis(MQConst.KylinQueue.SQL_ORDER_CLOSE.getKey(), OrderCloseMapping.get(mqList));
} }
if (couponIdList.size() > 0) {
platformCandyUserCouponService.useBackCoupon(couponDataList, couponIdList); platformCandyUserCouponService.useBackCoupon(couponDataList, couponIdList);
}
} }
return true; return true;
} }
...@@ -159,7 +163,7 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K ...@@ -159,7 +163,7 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K
public boolean checkTransferOrder(Integer minute) { public boolean checkTransferOrder(Integer minute) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
List<KylinOrderTask> task = orderTaskMapper.selectList( List<KylinOrderTask> task = orderTaskMapper.selectList(
Wrappers.lambdaQuery(KylinOrderTask.class).eq(KylinOrderTask::getStatus, 10).last("and NOW() > DATE_SUB(created_at,INTERVAL -("+minute+") MINUTE)") Wrappers.lambdaQuery(KylinOrderTask.class).eq(KylinOrderTask::getStatus, 10).last("and NOW() > DATE_SUB(created_at,INTERVAL -(" + minute + ") MINUTE)")
); );
ArrayList<String> orderIdList = CollectionUtil.arrayListString(); ArrayList<String> orderIdList = CollectionUtil.arrayListString();
for (KylinOrderTask item : task) { for (KylinOrderTask item : task) {
...@@ -190,7 +194,7 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K ...@@ -190,7 +194,7 @@ public class DMCheckOrderTimeImpl extends ServiceImpl<KylinOrderTicketsMapper, K
orderTicketRelations.setUpdatedAt(now); orderTicketRelations.setUpdatedAt(now);
orderTicketRelationsMapper.update(orderTicketRelations, new UpdateWrapper<KylinOrderTicketRelations>().in("order_id", orderIdList)); orderTicketRelationsMapper.update(orderTicketRelations, new UpdateWrapper<KylinOrderTicketRelations>().in("order_id", orderIdList));
// mysql 删除持久化数据 // mysql 删除持久化数据
orderTaskMapper.delete(Wrappers.lambdaQuery(KylinOrderTask.class).eq(KylinOrderTask::getStatus, 10).last("and NOW() > DATE_SUB(created_at,INTERVAL -("+minute+") MINUTE)")); orderTaskMapper.delete(Wrappers.lambdaQuery(KylinOrderTask.class).eq(KylinOrderTask::getStatus, 10).last("and NOW() > DATE_SUB(created_at,INTERVAL -(" + minute + ") MINUTE)"));
//处理原订单redis //处理原订单redis
int forSize = 500; int forSize = 500;
int forCount = orderIdList.size() % forSize == 0 ? orderIdList.size() / forSize : (orderIdList.size() / forSize) + 1; int forCount = orderIdList.size() % forSize == 0 ? orderIdList.size() / forSize : (orderIdList.size() / forSize) + 1;
......
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