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

Commit e0bf13c9 authored by 胡佳晨's avatar 胡佳晨

Merge branch 'bug_order' into pre

parents 656bfbed a2daeae4
......@@ -27,7 +27,7 @@ public class GoblinMixAppDetailsVo implements Serializable, Cloneable {
private String intro;
@ApiModelProperty(position = 10, value = "封面图片地址")
private String coverPic;
@ApiModelProperty(position = 11, value = "商品视频地址/数字昌平视频地址")
@ApiModelProperty(position = 11, value = "展示类型为1[详情图片地址]展示类型为2[商品视频地址/数字藏品视频地址]")
private String video;
@ApiModelProperty(position = 12, value = "商品详情/藏品详情")
private String details;
......
......@@ -34,7 +34,7 @@ public class GoblinMixDetailsVo implements Serializable, Cloneable {
private String intro;
@ApiModelProperty(position = 10, value = "封面图片地址")
private String coverPic;
@ApiModelProperty(position = 11, value = "商品视频地址/数字昌平视频地址")
@ApiModelProperty(position = 11, value = "展示类型为1[详情图片地址]展示类型为2[商品视频地址/数字藏品视频地址]")
private String video;
@ApiModelProperty(position = 12, value = "商品详情/藏品详情")
private String details;
......
......@@ -25,7 +25,7 @@ public class GoblinMixDetailsParam implements Serializable, Cloneable {
private String intro;
@ApiModelProperty(position = 10, value = "封面图片地址")
private String coverPic;
@ApiModelProperty(position = 11, value = "商品视频地址/数字昌平视频地址")
@ApiModelProperty(position = 11, value = "展示类型为1[详情图片地址]展示类型为2[商品视频地址/数字藏品视频地址]")
private String video;
@ApiModelProperty(position = 12, value = "商品详情/藏品详情")
private String details;
......
......@@ -94,12 +94,16 @@ public class KylinRedisConst {
public static final String REDIS_WQ_ORDER_EXPRESS = "kylin:wq:pxress:order:";//万青补偿快递vo 订单填写快递地址
public static final String ACTIVE_TICKET_AR_TICKET = "kylin:active:ar:ticket:";//互动券
public static final String ACTIVE_TICKET_AR_USER = "kylin:active:ar:user:";//互动券 绑定的用户
public static final String ACTIVE_TICKET_AR_TICKET = "kylin:active:ar:ticket:";//互动券
public static final String ACTIVE_TICKET_AR_USER = "kylin:active:ar:user:";//互动券 绑定的用户
/**
* 巡演券
* eg:{kylin:c_rs:${couponId}, List<巡演ID>}
*/
public static final String COUPON_ROADSHOWS = "kylin:c_rs:";
public static final String COUPON_ROADSHOWS = "kylin:c_rs:";
public static final String COUPON_COUNT = "kylin:coupon:count:";//$key + $uid:$performance_id
public static final String MEMBER_COUNT = "kylin:member:count:";//$key + $uid:$performance_id
}
......@@ -76,6 +76,9 @@ public class PerformancePartnerVo implements Serializable, Cloneable {
@ApiModelProperty(value = "限购数量 0为不限购", example = "0")
private Integer limitCount;
@ApiModelProperty(value = "实名数量 0为不限购", example = "0")
private Integer idCount;
@ApiModelProperty(value = "是否提交 1提交 0不提交(不验证参数)", example = "0")
private Integer isSubmit;
......@@ -121,6 +124,10 @@ public class PerformancePartnerVo implements Serializable, Cloneable {
@ApiModelProperty(value = "是否保存", example = "")
private Integer isCreateSave;
public Integer getIdCount() {
return idCount==null?limitCount:idCount;
}
private static final PerformancePartnerVo obj = new PerformancePartnerVo();
public static PerformancePartnerVo getNew() {
......@@ -151,6 +158,7 @@ public class PerformancePartnerVo implements Serializable, Cloneable {
this.setNoticeImage(performances.getNoticeImage());
this.setIsTrueName(performanceStatus.getIsTrueName());
this.setLimitCount(performanceStatus.getLimitCount());
this.setIdCount(performanceStatus.getIdCount());
this.setStatus(performanceStatus.getStatus());
this.setMerchantId(kylinPerformanceRelations.getMerchantId());
this.setDescribes(performances.getDescribes());
......
......@@ -23,6 +23,10 @@ public class PerformanceStep2Param implements Serializable,Cloneable {
@NotNull(message = "不能为空")
private Integer limitCount;
@ApiModelProperty(value = "实名限购 0为不限购", example = "0")
@NotNull(message = "不能为空")
private Integer idCount;
@ApiModelProperty(value = "是否提交 1提交 0不提交(不验证参数)", example = "0")
@NotNull(message = "不能为空")
private Integer isSubmit;
......
......@@ -75,6 +75,10 @@ public class TicketCreateParam implements Serializable {
@NotNull(message = "限购数量不能为空")
private Integer limitCount;
@ApiModelProperty(value = "实名数量", example = "0")
@NotNull(message = "限购数量不能为空")
private Integer idCount;
@ApiModelProperty(value = "票种开售时间", example = "2020-12-01T12:00:00")
@NotNull(message = "票种开售时间不能为空")
private LocalDateTime timeStart;
......
......@@ -7,12 +7,13 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Data
@ApiModel
public class KylinTicketTimesVo {
public class KylinTicketTimesVo implements Serializable,Cloneable{
private Integer mid;
@ApiModelProperty(value = "主键")
......@@ -32,6 +33,15 @@ public class KylinTicketTimesVo {
@ApiModelProperty(value = "票种")
private List<KylinTicketVo> ticketList;
private static final KylinTicketTimesVo obj = new KylinTicketTimesVo();
public static KylinTicketTimesVo getNew() {
try {
return (KylinTicketTimesVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new KylinTicketTimesVo();
}
}
public void setTicketTimes(KylinTicketTimes ticketTimes) {
this.mid = ticketTimes.getMid();
this.ticketTimesId = ticketTimes.getTicketTimesId();
......
......@@ -18,7 +18,7 @@ import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
@Data
@ApiModel
public class KylinTicketVo implements Serializable,Cloneable{
public class KylinTicketVo implements Serializable, Cloneable {
private Integer mid;
@ApiModelProperty(value = "主键")
......@@ -79,6 +79,8 @@ public class KylinTicketVo implements Serializable,Cloneable{
private Integer isTrueName;
@ApiModelProperty(value = "限购张数")
private Integer limitCount;
@ApiModelProperty(value = "实名限购张数")
private Integer idCount;
@ApiModelProperty(value = "会员限购张数")
private Integer limitCountMember;
@ApiModelProperty(value = "是否会员专属 0 1")
......@@ -100,6 +102,10 @@ public class KylinTicketVo implements Serializable,Cloneable{
@ApiModelProperty(value = "总兑换库存")
private Integer totalExchange;
public Integer getIdCount() {
return idCount == null ? limitCount : idCount;
}
public void setTicket(KylinTickets ticket) {
this.mid = ticket.getMid();
this.ticketsId = ticket.getTicketsId();
......@@ -140,6 +146,7 @@ public class KylinTicketVo implements Serializable,Cloneable{
this.isStudent = ticketStatus.getIsStudent();
this.limitCountMember = ticketStatus.getMemberLimitCount();
this.limitCount = ticketStatus.getLimitCount();
this.idCount = ticketStatus.getIdCount();
this.counts = ticketStatus.getCounts();
this.sysDamai = ticketStatus.getSyncDamai();
this.isShowCode = ticketStatus.getIsShowCode();
......@@ -162,7 +169,7 @@ public class KylinTicketVo implements Serializable,Cloneable{
this.timeStart = ticket.getTimeStart();
this.timeEnd = ticket.getTimeEnd();
this.advanceMinuteMember = 5;
this.memberTimeStart = DateUtil.Formatter.yyyyMMddHHmmss.format(LocalDateTime.parse(ticket.getTimeStart(),DTF_YMD_HMS).plusMinutes(-5));
this.memberTimeStart = DateUtil.Formatter.yyyyMMddHHmmss.format(LocalDateTime.parse(ticket.getTimeStart(), DTF_YMD_HMS).plusMinutes(-5));
if (ticket.getTimeEndExpress() != null) {
this.timeEndExpress = ticket.getTimeEndExpress();
} else {
......@@ -187,6 +194,7 @@ public class KylinTicketVo implements Serializable,Cloneable{
this.isStudent = ticketStatus.getIsStudent();
this.limitCountMember = 1;
this.limitCount = ticketStatus.getLimitCount();
this.idCount = ticketStatus.getIdCount();
this.counts = ticketStatus.getCounts();
this.sysDamai = 0;
this.isShowCode = ticketStatus.getIsShowCode();
......@@ -196,6 +204,7 @@ public class KylinTicketVo implements Serializable,Cloneable{
}
private static final KylinTicketVo obj = new KylinTicketVo();
public static KylinTicketVo getNew() {
try {
return (KylinTicketVo) obj.clone();
......
......@@ -85,6 +85,8 @@ public class KylinPerformanceVo implements Serializable, Cloneable{
private Integer isTrueName;
@ApiModelProperty(value = "限购张数")
private Integer limitCount;
@ApiModelProperty(value = "实名数量 0为不限购")
private Integer idCount;
@ApiModelProperty(value = "会员限购张数")
private Integer limitCountMember;
@ApiModelProperty(value = "是否专属")
......@@ -130,6 +132,10 @@ public class KylinPerformanceVo implements Serializable, Cloneable{
@ApiModelProperty(value = "场地审核状态 [0-审核完成|1-待审核|2-已拒绝]", hidden = true)
private Integer fieldAuditStatus;
public Integer getIdCount() {
return idCount==null?limitCount:idCount;
}
private static final KylinPerformanceVo obj = new KylinPerformanceVo();
public static KylinPerformanceVo getNew() {
......@@ -209,6 +215,7 @@ public class KylinPerformanceVo implements Serializable, Cloneable{
this.isRecommend = performanceStatus.getIsRecommend();
this.isTrueName = performanceStatus.getIsTrueName();
this.limitCount = performanceStatus.getLimitCount();
this.idCount = performanceStatus.getIdCount();
this.limitCountMember = performanceStatus.getLimitCountMember();
this.sysDamai = performanceStatus.getSyncDamai();
this.isShow = performanceStatus.getIsShow();
......@@ -233,6 +240,7 @@ public class KylinPerformanceVo implements Serializable, Cloneable{
this.isRecommend = 0;
this.isTrueName = performanceStatus.getIsTrueName();
this.limitCount = performanceStatus.getLimitCount();
this.idCount = performanceStatus.getIdCount();
this.limitCountMember = 1;
this.sysDamai = 0;
this.isShow = performanceStatus.getIsShow();
......
......@@ -88,6 +88,9 @@ public class KylinPerformanceMisVo implements Cloneable{
@ApiModelProperty(value = "限购数量")
private Integer limitCount;
@ApiModelProperty(value = "实名限购数量")
private Integer idCount;
@ApiModelProperty(value = "限购数量")
private String createdAt;
......
......@@ -48,6 +48,9 @@ public class KylinTicketPartnerVo implements Serializable,Cloneable {
@ApiModelProperty(value = "限购数量", example = "0")
private Integer limitCount;
@ApiModelProperty(value = "限购数量", example = "0")
private Integer idCount;
@ApiModelProperty(value = "次数", example = "0")
private Integer counts;
......@@ -122,6 +125,10 @@ public class KylinTicketPartnerVo implements Serializable,Cloneable {
this.setSurplusGeneral(this.getTotalGeneral());
}
public Integer getIdCount() {
return idCount==null?limitCount:idCount;
}
private static final KylinTicketPartnerVo obj = new KylinTicketPartnerVo();
public static KylinTicketPartnerVo getNew() {
try {
......@@ -143,6 +150,7 @@ public class KylinTicketPartnerVo implements Serializable,Cloneable {
this.totalGeneral = ts.getTotalGeneral();
this.totalExchange = ts.getTotalExchange();
this.limitCount = ts.getLimitCount();
this.idCount = ts.getIdCount();
this.counts = ts.getCounts();
this.timeStart = DateUtil.Formatter.yyyyMMddHHmmss.format(t.getTimeStart());
this.timeEnd = DateUtil.Formatter.yyyyMMddHHmmss.format(t.getTimeEnd());
......
......@@ -142,8 +142,10 @@ public class ImportServiceImpl implements IImportService {
// 获取限购 实名
int ticketLimit = ticketData.getLimitCount();//普通票种限购
int ticketMemberLimit = ticketData.getLimitCountMember();//会员票种限购
int ticketIdCount = ticketData.getIdCount();//实名票种限购
int performanceLimit = performanceData.getLimitCount();//普通演出限购
int performanceMemberLimit = performanceData.getLimitCountMember();//会员演出限购
int performanceMemberLimit = 1;//会员演出限购
int performanceIdCount = performanceData.getIdCount();//实名演出限购
int isTrueName = ticketData.getIsTrueName();//是否演出实名
Integer isStudent = ticketData.getIsStudent();
String ticketType = "";
......@@ -184,7 +186,7 @@ public class ImportServiceImpl implements IImportService {
//限购判断 如果实名 则身份证维度限购 如果不实名则数量限购
if (isTrueName == 1) {
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, enterIdCode, performancesId, ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, 1, 1, 0, isTrueName);
String res1 = orderUtils.judgeOrderLimit(uid, enterIdCode, performancesId, ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, performanceIdCount, ticketLimit, ticketMemberLimit, ticketIdCount, 0, isTrueName);
if (!res1.equals("")) {
orderOutLineVo.setReason(res1);
vos.add(orderOutLineVo);
......@@ -192,7 +194,7 @@ public class ImportServiceImpl implements IImportService {
continue;
}
} else {
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, "", performancesId, ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, number, number, 0, isTrueName);
String res1 = orderUtils.judgeOrderLimit(uid, "", performancesId, ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, performanceIdCount, ticketLimit, ticketMemberLimit, ticketIdCount, 0, isTrueName);
if (!res1.equals("")) {
orderOutLineVo.setReason(res1);
vos.add(orderOutLineVo);
......
......@@ -271,43 +271,36 @@ public class DataUtils {
* @param buyCount 购买数量 大于 0 增加 小于 0 减少 对应 支付 退款表
*/
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKey;
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
int isTrueName = getPerformanceIsTrueName(performanceId);
// String useTime = "";
// HashMap<String, ArrayList<String>> allTicketId = new HashMap<>();
// for (int x = 0; x < vo.getTicketTimeList().size(); x++) {
// KylinTicketTimesVo timeItem = vo.getTicketTimeList().get(x);
// ArrayList<String> ticketList = new ArrayList<>();
// for (int y = 0; y < timeItem.getTicketList().size(); y++) {
// KylinTicketVo ticketItem = timeItem.getTicketList().get(y);
// if (ticketItem.getType() == 1) {
// ticketList.add(ticketItem.getTicketsId());
// }
// if (ticketItem.getTicketsId().equals(ticketId)) {
// useTime = ticketItem.getUseStart();
// }
// }
// allTicketId.put(timeItem.getUseStart(), ticketList);
// }
if (0 == isTrueName) {
redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
} else {
redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
}
String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
// String ticketUseTimeKey = ticketIdKey + ":" + KylinRedisConst.USE_TIME;
// redisDataSourceUtil.getRedisKylinUtil().set(ticketUseTimeKey, useTime);
redisKeyUid = KylinRedisConst.USERID_BUY_INFO + userId;
redisKeyIdCard = KylinRedisConst.IDCARD_BUY_INFO + idCard;
String performanceIdKeyUid = redisKeyUid + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKeyUid = redisKeyUid + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (isTrueName != 0) {
performanceIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
ticketIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
}
if (buyCount > 0) {
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKey, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKey, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKeyUid, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKeyUid, buyCount);
if (isTrueName != 0) {
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKeyIdCard, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKeyIdCard, buyCount);
}
} else {
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKey, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKey, Math.abs(buyCount));
if (isTrueName != 0) {
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKeyIdCard, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKeyIdCard, Math.abs(buyCount));
}
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKeyUid, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKeyUid, Math.abs(buyCount));
}
}
......
......@@ -62,7 +62,7 @@ public class MongoVoUtils {
KylinFields fields = new KylinFields();
SlimeFieldsVo fieldsVo = dataUtils.getFieldsVoByFieldId(p3.getFieldId());
String cityName =fieldsVo.getCityName();
fields.setCityId(null);
fields.setCityId(Integer.parseInt(fieldsVo.getCityId()));
fields.setLatitude(fieldsVo.getLatitude());
fields.setLongitude(fieldsVo.getLongitude());
fields.setCityName(cityName);
......
......@@ -18,93 +18,101 @@ public class OrderUtils {
private DataUtils dataUtils;
public String judgeOrderLimit(
int type,
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceLimitCount,
int performanceMemberLimitCount,
int performanceLimitIdCard,
int ticketLimitCount,
int ticketMemberLimitCount,
int performanceBuyCount,
int ticketBuyCount,
int ticketLimitIdCard,
int memberType,
int isTrueName
) {
Integer[] integers;
if (101 == type) {
integers = festivalOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
} else {
integers = roadShowOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
}
return judgeMemberType(performanceLimitCount, performanceMemberLimitCount, ticketLimitCount, ticketMemberLimitCount, memberType, integers[0], integers[1], isTrueName);
Integer[] integers = orderLimit(userId, idCard, performanceId, ticketId, isTrueName);
return judgeMemberType(performanceLimitCount, performanceMemberLimitCount, performanceLimitIdCard,
ticketLimitCount, ticketMemberLimitCount,ticketLimitIdCard,
memberType, integers[0], integers[1], integers[2], integers[3], isTrueName);
}
public Integer[] roadShowOrderLimit(
public Integer[] orderLimit(
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceBuyCount,
int ticketBuyCount,
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount += dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount += dataUtils.getIdCardTBuyCount(idCard, ticketId);
} else {//非实名
performanceBuyCount += dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = new Integer[2];
array[0] = performanceBuyCount;
array[1] = ticketBuyCount;
return array;
}
int performanceBuyCountUid = 0;
int ticketBuyCountUid = 0;
int performanceBuyCountIdCard = 0;
int ticketBuyCountIdCard = 0;
public Integer[] festivalOrderLimit(
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceBuyCount,
int ticketBuyCount,
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount += dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount += dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCountIdCard = dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCountIdCard = dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCountUid = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCountUid = dataUtils.getUserTBuyCount(userId, ticketId);
} else {//非实名
performanceBuyCount += dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
performanceBuyCountUid = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCountUid = dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = new Integer[2];
array[0] = performanceBuyCount;
array[1] = ticketBuyCount;
Integer[] array = new Integer[4];
array[0] = performanceBuyCountUid;
array[1] = ticketBuyCountUid;
array[2] = performanceBuyCountIdCard;
array[3] = ticketBuyCountIdCard;
return array;
}
public String judgeMemberType(int performanceLimitCount, int performanceMemberLimitCount, int ticketLimitCount, int ticketMemberLimitCount, int memberType, int performanceBuyCount, int ticketBuyCount, int isTrueName) {
public String judgeMemberType(int performanceLimitCount, int performanceMemberLimitCount, int performanceLimitIdCard,
int ticketLimitCount, int ticketMemberLimitCount, int ticketLimitIdCard, int memberType,
int performanceBuyCountUid, int ticketBuyCountUid, int performanceBuyCountIdCard, int ticketBuyCountIdCard, int isTrueName) {
if (memberType == 1 || memberType == 2) {
if (performanceBuyCount > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "本场") + "演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCount > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "该") + "票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
if(isTrueName==1){
if (performanceBuyCountIdCard > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return "实名制演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountIdCard > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return "实名制票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
}
}else{
if (performanceBuyCountUid > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return "本场演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return "该票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
}
}
} else {//非会员区间
if (performanceBuyCount > performanceLimitCount && performanceLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "本场") + "演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCount > ticketLimitCount && ticketLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "该") + "票种限购" + ticketLimitCount + "张,已超出";//超过票维度购买量
if(isTrueName==1){
if (performanceBuyCountUid > performanceLimitCount && performanceLimitCount != 0) {
return "本场演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketLimitCount && ticketLimitCount != 0) {
return "该票种限购" + ticketLimitCount + "张,已超出";//超过演出维度购买量
}
if (performanceBuyCountIdCard > performanceLimitIdCard && performanceLimitIdCard != 0) {
return "实名制演出限购" + performanceLimitIdCard + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountIdCard > ticketLimitIdCard && ticketLimitIdCard != 0) {
return "实名制票种限购" + ticketLimitIdCard + "张,已超出";//超过演出维度购买量
}
}else{
if (performanceBuyCountUid > performanceLimitCount && performanceLimitCount != 0) {
return "本场演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketLimitCount && ticketLimitCount != 0) {
return "该票种限购" + ticketLimitCount + "张,已超出";//超过演出维度购买量
}
}
}
return "";
}
/**
* @param userId 用户id
* @param type 1新增 2修改
......
......@@ -467,6 +467,9 @@ public class PerformanceVoUtils {
ticketsMapper.insert(tickets);
ticketStatus.setStatus(9);
ticketStatus.setIsTrueName(performanceStatus.getIsTrueName());
if(ticketItem.getExpressType()==null){
ticketStatus.setExpressType(0);
}
ticketStatusMapper.insert(ticketStatus);
ticketRelationsMapper.insert(ticketRelations);
......@@ -481,6 +484,7 @@ public class PerformanceVoUtils {
} else {
//不改动数据 价格 限购 购票时间
ticketStatus.setLimitCount(null);
ticketStatus.setIdCount(null);
ticketStatus.setTotalGeneral(null);
ticketStatus.setTotalExchange(null);
tickets.setTimeStart(null);
......
......@@ -117,6 +117,16 @@ public abstract class DateUtil {
return new Date(c.getTimeInMillis());
}
/**
* 计算日期,增加天数
*/
public static String addDay(String date, int days) {
Calendar c = Calendar.getInstance();
c.setTime(parse(date, "yyyy-MM-dd HH:mm:ss"));
c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) + days);
return format(new Date(c.getTimeInMillis()), Formatter.yyyyMMddHHmmss);
}
/**
* 计算日期,增加小时
*/
......@@ -315,6 +325,18 @@ public abstract class DateUtil {
return asLocalDate(date2).toEpochDay() - asLocalDate(date1).toEpochDay();
}
/**
* 间隔天数
*
* @param date1 开始日期
* @param date2 结束日期
*/
public static long intervalDays(String date1, String date2) {
Date date1D = parse(date1, "yyyy-MM-dd HH:mm:ss");
Date date2D = parse(date2, "yyyy-MM-dd HH:mm:ss");
return asLocalDate(date2D).toEpochDay() - asLocalDate(date1D).toEpochDay();
}
/**
* 间隔月
*
......@@ -509,25 +531,28 @@ public abstract class DateUtil {
/**
* 秒级时间戳转 LocalDateTime
*
* @param epochMilli 秒级时间戳
* @return LocalDateTime
*/
public static LocalDateTime ofEpochMilli(long epochMilli){
public static LocalDateTime ofEpochMilli(long epochMilli) {
// return LocalDateTime.ofInstant(Instant.ofEpochMilli(epochMilli), ZoneOffset.of("+8"));
return LocalDateTime.ofEpochSecond(epochMilli,0, ZoneOffset.ofHours(8));
return LocalDateTime.ofEpochSecond(epochMilli, 0, ZoneOffset.ofHours(8));
}
/**
* 获取10位时间戳,精确到秒
*
* @return
*/
public static Long getNowSeconds(){
public static Long getNowSeconds() {
//获取秒数
Long second = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
//获取毫秒数
// Long milliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
return second;
}
public static void main(String[] args) {
System.out.println(DateUtil.getNowTime());
//获取秒数
......@@ -535,7 +560,7 @@ public abstract class DateUtil {
//获取毫秒数
Long milliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
System.out.println("second==="+second);
System.out.println("milliSecond==="+milliSecond);
System.out.println("second===" + second);
System.out.println("milliSecond===" + milliSecond);
}
}
......@@ -83,7 +83,7 @@ public class GoblinMix implements Serializable {
private String coverPic;
/**
* 商品视频地址/数字昌平视频地址
* 展示类型为1[详情图片地址]展示类型为2[商品视频地址/数字藏品视频地址]
*/
private String video;
......
......@@ -79,6 +79,11 @@ public class KylinPerformanceStatus implements Serializable ,Cloneable{
*/
private Integer limitCount;
/**
* 实名限购张数 0无限 (开启实名 则实名限购 未开始为账号限购)
*/
private Integer idCount;
/**
* 会员限购张数 0无限 (开启实名 则实名限购 未开始为账号限购)
*/
......@@ -179,7 +184,7 @@ public class KylinPerformanceStatus implements Serializable ,Cloneable{
vo.getPerformanceStatusId(),vo.getPerformanceId(),
vo.getIsShow(),vo.getStatus(),vo.getStatusSell(),
vo.getIsDistribution(),vo.getSyncAgent(),0,
vo.getAuditStatus(),vo.getIsTrueName(),vo.getLimitCount(),
vo.getAuditStatus(),vo.getIsTrueName(),vo.getLimitCount(),vo.getIdCount(),
vo.getLimitCountMember(),vo.getFieldAuditStatus(),vo.getCreatedAt(),vo.getUpdatedAt()
};
}
......
......@@ -119,6 +119,11 @@ public class KylinTicketStatus implements Serializable ,Cloneable {
*/
private Integer limitCount;
/**
* 实名限购张数 0无限 (开启实名 则实名限购 未开始为账号限购)
*/
private Integer idCount;
/**
* 会员限购张数 0无限 (开启实名 则实名限购 未开始为账号限购)
*/
......@@ -170,7 +175,7 @@ public class KylinTicketStatus implements Serializable ,Cloneable {
vo.getCounts(),vo.getStatusExchange(),vo.getIsShowCode(),
vo.getQrCodeShowTime(),vo.getIsLackRegister(),vo.getTotalGeneral(),
vo.getTotalExchange(),vo.getSurplusGeneral(),vo.getSurplusExchange(),
vo.getExpressType(),vo.getIsTransfer(),vo.getIsTrueName(),vo.getLimitCount(),
vo.getExpressType(),vo.getIsTransfer(),vo.getIsTrueName(),vo.getLimitCount(),vo.getIdCount(),
vo.getMemberLimitCount(),vo.getIsExclusive(),vo.getIsMember(),
0,0,vo.getCreatedAt(),vo.getUpdatedAt()
......
package com.liquidnet.service.consumer.kylin.receiver;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.OrderCloseMapping;
import com.liquidnet.service.consumer.kylin.utils.KylinUtils;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.stream.StreamListener;
import java.util.HashMap;
@Slf4j
public abstract class AbstractSqlOptOrderCloseRedisReceiver implements StreamListener<String, MapRecord<String, String, String>> {
@Autowired
StringRedisTemplate stringRedisTemplate;
@Autowired
private RedisUtil redisUtil;
@Autowired
private KylinUtils kylinUtils;
@Override
public void onMessage(MapRecord<String, String, String> message) {
String redisStreamKey = this.getRedisStreamKey();
log.debug("CONSUMER MSG[streamKey:{},messageId:{},stream:{},body:{}]", redisStreamKey, message.getId(), message.getStream(), message.getValue());
boolean result = this.consumerSqlOperationOrderCloseHandler(message.getValue().get("message"));
log.info("CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}", result, redisStreamKey, message.getId());
try {
stringRedisTemplate.opsForStream().acknowledge(getRedisStreamGroup(), message);
} catch (Exception e) {
log.error("#CONSUMER MSG EX_ACK ==> [{}]RESULT:{},MESSAGE:{}", redisStreamKey, result, message.getValue(), e);
}
try {
stringRedisTemplate.opsForStream().delete(redisStreamKey, message.getId());
} catch (Exception e) {
log.error("#CONSUMER MSG EX_DEL ==> [{}]RESULT:{},MESSAGE:{}", redisStreamKey, result, message.getValue(), e);
}
}
private boolean consumerSqlOperationOrderCloseHandler(String msg) {
boolean aBoolean = false;
try {
OrderCloseMapping.orderCloseMessage mqMessage = JsonUtils.fromJson(msg, OrderCloseMapping.orderCloseMessage.class);
for (int x = 0; x < mqMessage.getOrderTicketIds().size(); x++) {
String t = mqMessage.getOrderTicketIds().get(x);
String orderTicketId = t.split(",")[0];
String uid = t.split(",")[1];
KylinOrderTicketVo vo = kylinUtils.getOrderTicketVo(orderTicketId);
vo.setStatus(2);
redisUtil.set("kylin:order:id:" + orderTicketId, vo);
kylinUtils.resetOrderListVo(uid, 2, orderTicketId, vo);
// redis 限购
for (int i = 0; i < vo.getEntitiesVoList().size(); i++) {
KylinOrderTicketEntitiesVo items = vo.getEntitiesVoList().get(i);
kylinUtils.changeBuyInfo(items.getUserId(), items.getEnterIdCode(), items.getPerformanceId(), items.getTicketId(), -1);
}
}
aBoolean = true;
} catch (Exception e) {
log.error("CONSUMER MSG EX_HANDLE ==> [{}]:{}", this.getRedisStreamKey(), msg, e);
} finally {
if (!aBoolean) {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put("message", msg);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(this.getRedisStreamKey()));
}
}
return aBoolean;
}
protected abstract String getRedisStreamKey();
protected abstract String getRedisStreamGroup();
}
//package com.liquidnet.service.consumer.kylin.receiver;
//
//import com.liquidnet.common.cache.redis.util.RedisUtil;
//import com.liquidnet.commons.lang.util.CollectionUtil;
//import com.liquidnet.commons.lang.util.JsonUtils;
//import com.liquidnet.service.base.OrderCloseMapping;
//import com.liquidnet.service.consumer.kylin.utils.KylinUtils;
//import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
//import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.connection.stream.MapRecord;
//import org.springframework.data.redis.connection.stream.StreamRecords;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.data.redis.stream.StreamListener;
//
//import java.util.HashMap;
//
//@Slf4j
//public abstract class AbstractSqlOptOrderCloseRedisReceiver implements StreamListener<String, MapRecord<String, String, String>> {
// @Autowired
// StringRedisTemplate stringRedisTemplate;
// @Autowired
// private RedisUtil redisUtil;
// @Autowired
// private KylinUtils kylinUtils;
//
// @Override
// public void onMessage(MapRecord<String, String, String> message) {
// String redisStreamKey = this.getRedisStreamKey();
// log.debug("CONSUMER MSG[streamKey:{},messageId:{},stream:{},body:{}]", redisStreamKey, message.getId(), message.getStream(), message.getValue());
// boolean result = this.consumerSqlOperationOrderCloseHandler(message.getValue().get("message"));
// log.info("CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}", result, redisStreamKey, message.getId());
//
// try {
// stringRedisTemplate.opsForStream().acknowledge(getRedisStreamGroup(), message);
// } catch (Exception e) {
// log.error("#CONSUMER MSG EX_ACK ==> [{}]RESULT:{},MESSAGE:{}", redisStreamKey, result, message.getValue(), e);
// }
// try {
// stringRedisTemplate.opsForStream().delete(redisStreamKey, message.getId());
// } catch (Exception e) {
// log.error("#CONSUMER MSG EX_DEL ==> [{}]RESULT:{},MESSAGE:{}", redisStreamKey, result, message.getValue(), e);
// }
// }
//
// private boolean consumerSqlOperationOrderCloseHandler(String msg) {
// boolean aBoolean = false;
// try {
// OrderCloseMapping.orderCloseMessage mqMessage = JsonUtils.fromJson(msg, OrderCloseMapping.orderCloseMessage.class);
//
// for (int x = 0; x < mqMessage.getOrderTicketIds().size(); x++) {
// String t = mqMessage.getOrderTicketIds().get(x);
// String orderTicketId = t.split(",")[0];
// String uid = t.split(",")[1];
// KylinOrderTicketVo vo = kylinUtils.getOrderTicketVo(orderTicketId);
// vo.setStatus(2);
// redisUtil.set("kylin:order:id:" + orderTicketId, vo);
//
// kylinUtils.resetOrderListVo(uid, 2, orderTicketId, vo);
// // redis 限购
// for (int i = 0; i < vo.getEntitiesVoList().size(); i++) {
// KylinOrderTicketEntitiesVo items = vo.getEntitiesVoList().get(i);
// kylinUtils.changeBuyInfo(items.getUserId(), items.getEnterIdCode(), items.getPerformanceId(), items.getTicketId(), -1);
// }
// }
//
// aBoolean = true;
// } catch (Exception e) {
// log.error("CONSUMER MSG EX_HANDLE ==> [{}]:{}", this.getRedisStreamKey(), msg, e);
// } finally {
// if (!aBoolean) {
// HashMap<String, String> map = CollectionUtil.mapStringString();
// map.put("message", msg);
// stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(this.getRedisStreamKey()));
// }
// }
// return aBoolean;
// }
//
// protected abstract String getRedisStreamKey();
//
// protected abstract String getRedisStreamGroup();
//}
package com.liquidnet.service.consumer.kylin.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerKylinSqlOptOrderCloseRedisReceiver extends AbstractSqlOptOrderCloseRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.KylinQueue.SQL_ORDER_CLOSE.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.KylinQueue.SQL_ORDER_CLOSE.getGroup();
}
}
//package com.liquidnet.service.consumer.kylin.receiver;
//
//import com.liquidnet.service.base.constant.MQConst;
//import org.springframework.stereotype.Component;
//
//@Component
//public class ConsumerKylinSqlOptOrderCloseRedisReceiver extends AbstractSqlOptOrderCloseRedisReceiver {
// @Override
// protected String getRedisStreamKey() {
// return MQConst.KylinQueue.SQL_ORDER_CLOSE.getKey();
// }
//
// @Override
// protected String getRedisStreamGroup() {
// return MQConst.KylinQueue.SQL_ORDER_CLOSE.getGroup();
// }
//}
......@@ -83,45 +83,26 @@ public class KylinUtils {
}
}
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKey;
int isTrueName = getPerformanceIsTrueName(performanceId);
// String useTime = "";
// HashMap<String, ArrayList<String>> allTicketId = new HashMap<>();
// for (int x = 0; x < vo.getTicketTimeList().size(); x++) {
// KylinTicketTimesVo timeItem = vo.getTicketTimeList().get(x);
// ArrayList<String> ticketList = new ArrayList<>();
// for (int y = 0; y < timeItem.getTicketList().size(); y++) {
// KylinTicketVo ticketItem = timeItem.getTicketList().get(y);
// if (ticketItem.getType() == 1) {
// ticketList.add(ticketItem.getTicketsId());
// }
// if (ticketItem.getTicketsId().equals(ticketId)) {
// useTime = ticketItem.getUseStart();
// }
// }
// allTicketId.put(timeItem.getUseStart(), ticketList);
// public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
// String redisKey;
// int isTrueName = getPerformanceIsTrueName(performanceId);
// if (0 == isTrueName) {
// redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
// } else {
// redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
// }
if (0 == isTrueName) {
redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
} else {
redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
}
String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
// String ticketUseTimeKey = ticketIdKey + ":" + KylinRedisConst.USE_TIME;
// redisUtil.set(ticketUseTimeKey, useTime);
if (buyCount > 0) {
redisUtil.incr(ticketIdKey, buyCount);
redisUtil.incr(performanceIdKey, buyCount);
} else {
redisUtil.decr(ticketIdKey, Math.abs(buyCount));
redisUtil.decr(performanceIdKey, Math.abs(buyCount));
}
}
//
// String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
// String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
//
// if (buyCount > 0) {
// redisUtil.incr(ticketIdKey, buyCount);
// redisUtil.incr(performanceIdKey, buyCount);
// } else {
// redisUtil.decr(ticketIdKey, Math.abs(buyCount));
// redisUtil.decr(performanceIdKey, Math.abs(buyCount));
// }
// }
/**
* 根据演出id 获取 演出vo 详情
......
......@@ -131,21 +131,36 @@ public class KylinOrderUtils {
* @param buyCount
*/
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKey;
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
int isTrueName = getPerformanceIsTrueName(performanceId);
if (0 == isTrueName) {
redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
} else {
redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
redisKeyUid = KylinRedisConst.USERID_BUY_INFO + userId;
redisKeyIdCard = KylinRedisConst.IDCARD_BUY_INFO + idCard;
String performanceIdKeyUid = redisKeyUid + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKeyUid = redisKeyUid + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (isTrueName != 0) {
performanceIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
ticketIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
}
String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (buyCount > 0) {
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKey, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKey, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKeyUid, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKeyUid, buyCount);
if (isTrueName != 0) {
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKeyIdCard, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKeyIdCard, buyCount);
}
} else {
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKey, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKey, Math.abs(buyCount));
if (isTrueName != 0) {
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKeyIdCard, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKeyIdCard, Math.abs(buyCount));
}
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKeyUid, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKeyUid, Math.abs(buyCount));
}
}
......
......@@ -83,46 +83,6 @@ public class KylinUtils {
}
}
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKey;
int isTrueName = getPerformanceIsTrueName(performanceId);
// String useTime = "";
// HashMap<String, ArrayList<String>> allTicketId = new HashMap<>();
// for (int x = 0; x < vo.getTicketTimeList().size(); x++) {
// KylinTicketTimesVo timeItem = vo.getTicketTimeList().get(x);
// ArrayList<String> ticketList = new ArrayList<>();
// for (int y = 0; y < timeItem.getTicketList().size(); y++) {
// KylinTicketVo ticketItem = timeItem.getTicketList().get(y);
// if (ticketItem.getType() == 1) {
// ticketList.add(ticketItem.getTicketsId());
// }
// if (ticketItem.getTicketsId().equals(ticketId)) {
// useTime = ticketItem.getUseStart();
// }
// }
// allTicketId.put(timeItem.getUseStart(), ticketList);
// }
if (0 == isTrueName) {
redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
} else {
redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
}
String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
// String ticketUseTimeKey = ticketIdKey + ":" + KylinRedisConst.USE_TIME;
// redisUtil.set(ticketUseTimeKey, useTime);
if (buyCount > 0) {
redisUtil.incr(ticketIdKey, buyCount);
redisUtil.incr(performanceIdKey, buyCount);
} else {
redisUtil.decr(ticketIdKey, Math.abs(buyCount));
redisUtil.decr(performanceIdKey, Math.abs(buyCount));
}
}
/**
* 根据演出id 获取 演出vo 详情
*
......
......@@ -17,7 +17,7 @@ CREATE TABLE `goblin_mix`
`intro` varchar(512) DEFAULT NULL COMMENT '商品简介/购买须知',
`watch_type` char(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '展示文件类型[1-图片|2-视频|3-模型]',
`cover_pic` varchar(256) DEFAULT NULL COMMENT '封面图片地址',
`video` varchar(256) DEFAULT NULL COMMENT '商品视频地址/数字昌平视频地址',
`video` varchar(256) DEFAULT NULL COMMENT '展示类型为1[详情图片地址]展示类型为2[商品视频地址/数字藏品视频地址]',
`detail_url` varchar(256) DEFAULT NULL COMMENT '数字藏品图片地址',
`details` text COMMENT '商品详情/藏品详情',
......
......@@ -652,8 +652,10 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
// 获取限购 实名
int ticketLimit = ticketData.getLimitCount();//普通票种限购
int ticketMemberLimit = ticketData.getLimitCountMember();//会员票种限购
int ticketIdCount = ticketData.getIdCount();//实名票种限购
int performanceLimit = performanceData.getLimitCount();//普通演出限购
int performanceMemberLimit = performanceData.getLimitCountMember();//会员演出限购
int performanceMemberLimit = 1;//会员演出限购
int performanceIdCount = performanceData.getIdCount();//实名演出限购
int isTrueName = ticketData.getIsTrueName();//是否演出实名
//实名判断
......@@ -688,14 +690,20 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
//限购判断 如果实名 则身份证维度限购 如果不实名则数量限购
if (entersVoList.size() > 0) {
for (int i = 0; i < entersVoList.size(); i++) {
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, entersVoList.get(i).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, 1, 1, 0, isTrueName);
dataUtils.changeBuyInfo(uid, entersVoList.get(i).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), 1);
String res1 = orderUtils.judgeOrderLimit(uid, entersVoList.get(i).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, performanceIdCount, ticketLimit, ticketMemberLimit, ticketIdCount, 0, isTrueName);
if (!res1.equals("")) {
for (int x = 0; x <= i; x++) {
dataUtils.changeBuyInfo(uid, entersVoList.get(x).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), -1);
}
return ResponseDto.failure(res1);//乱七八糟异常
}
}
} else {
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, orderTicketVo.getNumber(), orderTicketVo.getNumber(), 0, isTrueName);
dataUtils.changeBuyInfo(uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), orderTicketVo.getNumber());
String res1 = orderUtils.judgeOrderLimit(uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), performanceLimit, performanceMemberLimit, performanceIdCount, ticketLimit, ticketMemberLimit, ticketIdCount, 0, isTrueName);
if (!res1.equals("")) {
dataUtils.changeBuyInfo(uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), -orderTicketVo.getNumber());
return ResponseDto.failure(res1);//乱七八糟异常
}
}
......@@ -831,7 +839,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
orderTicketEntitiesVo.setUpdatedAt(null);
orderTicketEntitiesVo.setChangeDate(orderTicketEntities.getCreatedAt());
mongoTemplate.insert(orderTicketEntitiesVo, KylinOrderTicketEntitiesVo.class.getSimpleName());
dataUtils.changeBuyInfo(orderTicketEntitiesVo.getUserId(), orderTicketEntitiesVo.getEnterIdCode(), orderTicketEntitiesVo.getPerformanceId(), orderTicketEntitiesVo.getTicketId(), 1);
// dataUtils.changeBuyInfo(orderTicketEntitiesVo.getUserId(), orderTicketEntitiesVo.getEnterIdCode(), orderTicketEntitiesVo.getPerformanceId(), orderTicketEntitiesVo.getTicketId(), 1);
}
orderTickets.setPayType(orderTicketVo.getPayType());
......
......@@ -975,25 +975,36 @@ public class DataUtils {
}
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKey;
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
int isTrueName = getPerformanceIsTrueName(performanceId);
if (0 == isTrueName) {
redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
} else {
redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
redisKeyUid = KylinRedisConst.USERID_BUY_INFO + userId;
redisKeyIdCard = KylinRedisConst.IDCARD_BUY_INFO + idCard;
String performanceIdKeyUid = redisKeyUid + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKeyUid = redisKeyUid + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (isTrueName != 0) {
performanceIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
ticketIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
}
String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (buyCount > 0) {
redisUtil.incr(ticketIdKey, buyCount);
redisUtil.incr(performanceIdKey, buyCount);
redisUtil.incr(ticketIdKeyUid, buyCount);
redisUtil.incr(performanceIdKeyUid, buyCount);
if (isTrueName != 0) {
redisUtil.incr(ticketIdKeyIdCard, buyCount);
redisUtil.incr(performanceIdKeyIdCard, buyCount);
}
} else {
redisUtil.decr(ticketIdKey, Math.abs(buyCount));
redisUtil.decr(performanceIdKey, Math.abs(buyCount));
if (isTrueName != 0) {
redisUtil.decr(ticketIdKeyIdCard, Math.abs(buyCount));
redisUtil.decr(performanceIdKeyIdCard, Math.abs(buyCount));
}
redisUtil.decr(ticketIdKeyUid, Math.abs(buyCount));
redisUtil.decr(performanceIdKeyUid, Math.abs(buyCount));
}
}
......
......@@ -31,93 +31,104 @@ public class OrderUtils {
public String judgeOrderLimit(
int type,
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceLimitCount,
int performanceMemberLimitCount,
int performanceLimitIdCard,
int ticketLimitCount,
int ticketMemberLimitCount,
int performanceBuyCount,
int ticketBuyCount,
int ticketLimitIdCard,
int memberType,
int isTrueName
) {
Integer[] integers;
if (101 == type) {
integers = festivalOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
} else {
integers = roadShowOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
}
return judgeMemberType(performanceLimitCount, performanceMemberLimitCount, ticketLimitCount, ticketMemberLimitCount, memberType, integers[0], integers[1], isTrueName);
Integer[] integers = orderLimit(userId, idCard, performanceId, ticketId, isTrueName);
return judgeMemberType(performanceLimitCount, performanceMemberLimitCount, performanceLimitIdCard,
ticketLimitCount, ticketMemberLimitCount, ticketLimitIdCard,
memberType, integers[0], integers[1], integers[2], integers[3], isTrueName);
}
public Integer[] roadShowOrderLimit(
public Integer[] orderLimit(
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceBuyCount,
int ticketBuyCount,
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount += dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount += dataUtils.getIdCardTBuyCount(idCard, ticketId);
} else {//非实名
performanceBuyCount += dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = new Integer[2];
array[0] = performanceBuyCount;
array[1] = ticketBuyCount;
return array;
}
int performanceBuyCountUid = 0;
int ticketBuyCountUid = 0;
int performanceBuyCountIdCard = 0;
int ticketBuyCountIdCard = 0;
public Integer[] festivalOrderLimit(
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceBuyCount,
int ticketBuyCount,
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount += dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount += dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCountIdCard = dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCountIdCard = dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCountUid = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCountUid = dataUtils.getUserTBuyCount(userId, ticketId);
} else {//非实名
performanceBuyCount += dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
performanceBuyCountUid = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCountUid = dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = new Integer[2];
array[0] = performanceBuyCount;
array[1] = ticketBuyCount;
Integer[] array = new Integer[4];
array[0] = performanceBuyCountUid;
array[1] = ticketBuyCountUid;
array[2] = performanceBuyCountIdCard;
array[3] = ticketBuyCountIdCard;
return array;
}
public String judgeMemberType(int performanceLimitCount, int performanceMemberLimitCount, int ticketLimitCount, int ticketMemberLimitCount, int memberType, int performanceBuyCount, int ticketBuyCount, int isTrueName) {
public String judgeMemberType(int performanceLimitCount, int performanceMemberLimitCount, int performanceLimitIdCard,
int ticketLimitCount, int ticketMemberLimitCount, int ticketLimitIdCard, int memberType,
int performanceBuyCountUid, int ticketBuyCountUid, int performanceBuyCountIdCard, int ticketBuyCountIdCard, int isTrueName) {
log.info("转赠:\n演出数量=" + performanceBuyCountUid + "\n演出实名数量=" + performanceBuyCountIdCard + "\n票种数量=" + ticketBuyCountUid + "\n票种实名数量=" + ticketBuyCountIdCard);
if (memberType == 1 || memberType == 2) {
if (performanceBuyCount > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "本场") + "演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCount > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "该") + "票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
if (isTrueName == 1) {
if (performanceBuyCountIdCard > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return "实名制演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountIdCard > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return "实名制票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
}
} else {
if (performanceBuyCountUid > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return "本场演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return "该票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
}
}
} else {//非会员区间
if (performanceBuyCount > performanceLimitCount && performanceLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "本场") + "演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCount > ticketLimitCount && ticketLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "该") + "票种限购" + ticketLimitCount + "张,已超出";//超过票维度购买量
if (isTrueName == 1) {
if (performanceBuyCountUid > performanceLimitCount && performanceLimitCount != 0) {
return "本场演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketLimitCount && ticketLimitCount != 0) {
return "该票种限购" + ticketLimitCount + "张,已超出";//超过演出维度购买量
}
if (performanceBuyCountIdCard > performanceLimitIdCard && performanceLimitIdCard != 0) {
return "实名制演出限购" + performanceLimitIdCard + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountIdCard > ticketLimitIdCard && ticketLimitIdCard != 0) {
return "实名制票种限购" + ticketLimitIdCard + "张,已超出";//超过演出维度购买量
}
} else {
if (performanceBuyCountUid > performanceLimitCount && performanceLimitCount != 0) {
return "本场演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketLimitCount && ticketLimitCount != 0) {
return "该票种限购" + ticketLimitCount + "张,已超出";//超过演出维度购买量
}
}
}
return "";
}
/**
* @param userId 用户id
* @param type 1新增 2修改
......@@ -184,7 +195,7 @@ public class OrderUtils {
public List<AdamEntersVo> getEnters(String entersIds, String uid) {
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", "application/json;charset=UTF-8");
String returnVo = HttpUtil.get( adamUrl+ "/adam/rsc/inquire/enters?entersIds=" + entersIds + "&uid=" + uid, null, headers);
String returnVo = HttpUtil.get(adamUrl + "/adam/rsc/inquire/enters?entersIds=" + entersIds + "&uid=" + uid, null, headers);
ResponseDto<List<AdamEntersVo>> ResponseVo = JsonUtils.fromJson(returnVo, new TypeReference<ResponseDto<List<AdamEntersVo>>>() {
});
return ResponseVo.getData();
......
......@@ -98,6 +98,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
public ResponseDto<PayInnerResultVo> checkCanOrder(PayOrderParam payOrderParam) {
boolean isDownGeneral = false;
boolean isPay = true;
boolean useAdvance = false;
String performanceId = "";
List<AdamEntersVo> entersVoList = ObjectUtil.cloneArrayListObject();
String uid = CurrentUtil.getCurrentUid();
HashMap<String, Object> advanceMap = null;
......@@ -128,7 +130,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
break;
}
}
performanceId = performanceData.getPerformancesId();
if (ticketTimesData == null || ticketData == null) {
return ResponseDto.failure(ErrorMapping.get("20004"));//参数错误
}
......@@ -204,9 +206,14 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
int memberType; //会员状态 不需要判断会员 1判断会员逻辑 2会员专属
if (DateUtil.compareStrDay(DateUtil.getNowTime(), memberTimeStart) == 1 && DateUtil.compareStrDay(DateUtil.getNowTime(), timeStart) == -1){//优先时间
if(payOrderParam.getNumber()>2){
return ResponseDto.failure("非法下单");
if (DateUtil.compareStrDay(DateUtil.getNowTime(), memberTimeStart) == 1 && DateUtil.compareStrDay(DateUtil.getNowTime(), timeStart) == -1) {//优先时间
if (payOrderParam.getNumber() > ticketData.getCounts()) {
return ResponseDto.failure("优先购时段内,本场演出限购"+ticketData.getCounts()+"张");
}
int advanceCount = dataUtils.incrUseMemberCount(uid, performanceData.getPerformancesId());
if (advanceCount > 1) {//todo
dataUtils.decrUseMemberCount(uid, performanceData.getPerformancesId());
return ResponseDto.failure("本场演出限用1张优先券,已超出");
}
}
if (ticketData.getIsExclusive() == 1) {
......@@ -230,9 +237,10 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
// 获取限购 实名
int ticketLimit = ticketData.getLimitCount();//普通票种限购
int ticketMemberLimit = ticketData.getLimitCountMember();//会员票种限购
int ticketIdCount = ticketData.getIdCount();//实名票种限购
int performanceLimit = performanceData.getLimitCount();//普通演出限购
// int performanceMemberLimit = performanceData.getLimitCountMember();//会员演出限购
int performanceMemberLimit = 1;//会员演出限购
int performanceIdCount = performanceData.getIdCount();//实名演出限购
int isTrueName = ticketData.getIsTrueName();//是否演出实名
if (!canBuyStatus.contains(performanceData.getAppStatus())) {
......@@ -266,6 +274,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderUtils.backAdvanceCoupon(payOrderParam.getAdvanceCode(), uid);
return ResponseDto.failure("优先券该演出不可用");
}
int couponCount = dataUtils.incrUseCouponCount(uid, performanceData.getPerformancesId());
useAdvance = true;
if (couponCount > 1) {//todo
useAdvance = false;
dataUtils.decrUseCouponCount(uid, performanceData.getPerformancesId());
return ResponseDto.failure("本场演出限用1张优先券,已超出");
}
}
}
}
......@@ -345,7 +360,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
if (entersVoList.size() > 0) {
for (int i = 0; i < entersVoList.size(); i++) {
dataUtils.changeBuyInfo(uid, entersVoList.get(i).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), 1);
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, entersVoList.get(i).getIdCard(), payOrderParam.getPerformanceId(), payOrderParam.getTicketId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, 1, 1, memberType, isTrueName);
String res1 = orderUtils.judgeOrderLimit(uid, entersVoList.get(i).getIdCard(), payOrderParam.getPerformanceId(), payOrderParam.getTicketId(), performanceLimit, performanceMemberLimit, performanceIdCount, ticketLimit, ticketMemberLimit, ticketIdCount, memberType, isTrueName);
if (!res1.equals("")) {
for (int x = 0; x <= i; x++) {
dataUtils.changeBuyInfo(uid, entersVoList.get(x).getIdCard(), performanceData.getPerformancesId(), ticketData.getTicketsId(), -1);
......@@ -357,7 +372,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
} else {
dataUtils.changeBuyInfo(uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), payOrderParam.getNumber());
String res1 = orderUtils.judgeOrderLimit(performanceData.getType(), uid, "", payOrderParam.getPerformanceId(), payOrderParam.getTicketId(), performanceLimit, performanceMemberLimit, ticketLimit, ticketMemberLimit, payOrderParam.getNumber(), payOrderParam.getNumber(), memberType, isTrueName);
String res1 = orderUtils.judgeOrderLimit(uid, "", payOrderParam.getPerformanceId(), payOrderParam.getTicketId(), performanceLimit, performanceMemberLimit, performanceIdCount, ticketLimit, ticketMemberLimit, ticketIdCount, memberType, isTrueName);
if (!res1.equals("")) {
dataUtils.changeBuyInfo(uid, "", performanceData.getPerformancesId(), ticketData.getTicketsId(), -payOrderParam.getNumber());
orderUtils.changeSurplus(isPay, payOrderParam.getTicketId(), payOrderParam.getNumber());
......@@ -376,6 +391,9 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderUtils.changeSurplus(isPay, payOrderParam.getTicketId(), payOrderParam.getNumber());
log.error("回滚库存");
orderUtils.backAdvanceCoupon(payOrderParam.getAdvanceCode(), uid);
if (useAdvance) {
dataUtils.decrUseCouponCount(uid, performanceId);
}
for (AdamEntersVo enters : entersVoList) {
dataUtils.changeBuyInfo(uid, enters.getIdCard(), payOrderParam.getPerformanceId(), payOrderParam.getTicketId(), -1);
}
......
......@@ -123,44 +123,38 @@ public class DataUtils {
* @param buyCount 购买数量 大于 0 增加 小于 0 减少 对应 支付 退款表
*/
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKey;
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
int isTrueName = getPerformanceIsTrueName(performanceId);
// String useTime = "";
// HashMap<String, ArrayList<String>> allTicketId = new HashMap<>();
// for (int x = 0; x < vo.getTicketTimeList().size(); x++) {
// KylinTicketTimesVo timeItem = vo.getTicketTimeList().get(x);
// ArrayList<String> ticketList = ObjectUtil.cloneArrayListString();
// for (int y = 0; y < timeItem.getTicketList().size(); y++) {
// KylinTicketVo ticketItem = timeItem.getTicketList().get(y);
// if (ticketItem.getType() == 1) {
// ticketList.add(ticketItem.getTicketsId());
// }
// if (ticketItem.getTicketsId().equals(ticketId)) {
// useTime = ticketItem.getUseStart();
// }
// }
// allTicketId.put(timeItem.getUseStart(), ticketList);
// }
if (0 == isTrueName) {
redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
} else {
redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
redisKeyUid = KylinRedisConst.USERID_BUY_INFO + userId;
redisKeyIdCard = KylinRedisConst.IDCARD_BUY_INFO + idCard;
String performanceIdKeyUid = redisKeyUid + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKeyUid = redisKeyUid + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (isTrueName != 0) {
performanceIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
ticketIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
}
String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
// String ticketUseTimeKey = ticketIdKey + ":" + KylinRedisConst.USE_TIME;
// redisUtil.set(ticketUseTimeKey, useTime);
if (buyCount > 0) {
redisUtil.incr(ticketIdKey, buyCount);
redisUtil.incr(performanceIdKey, buyCount);
redisUtil.incr(ticketIdKeyUid, buyCount);
redisUtil.incr(performanceIdKeyUid, buyCount);
if (isTrueName != 0) {
redisUtil.incr(ticketIdKeyIdCard, buyCount);
redisUtil.incr(performanceIdKeyIdCard, buyCount);
}
} else {
redisUtil.decr(ticketIdKey, Math.abs(buyCount));
redisUtil.decr(performanceIdKey, Math.abs(buyCount));
if (isTrueName != 0) {
redisUtil.decr(ticketIdKeyIdCard, Math.abs(buyCount));
redisUtil.decr(performanceIdKeyIdCard, Math.abs(buyCount));
}
redisUtil.decr(ticketIdKeyUid, Math.abs(buyCount));
redisUtil.decr(performanceIdKeyUid, Math.abs(buyCount));
}
}
......@@ -293,16 +287,16 @@ public class DataUtils {
String redisKey = KylinRedisConst.ADAM_IS_MEMBER
.concat(uid);
Object obj = redisUtil.get(redisKey);
if(obj==null){
if (obj == null) {
return null;
}else{
} else {
return (Integer) obj;
}
}
// 获取快递价格
public BigDecimal getExpressPrice(String adCode, String productCode){
BigDecimal price ;
public BigDecimal getExpressPrice(String adCode, String productCode) {
BigDecimal price;
Object obj = redisUtil.get(KylinRedisConst.RETURN_ADDRESS_CODE + adCode + KylinRedisConst.EXPRESS_TYPE + productCode);
if (obj != null) {
KylinFreightChargeDao k = (KylinFreightChargeDao) obj;
......@@ -321,9 +315,9 @@ public class DataUtils {
public String getTicketPayTxt(String ticketId) {
String rdsKey = KylinRedisConst.TICKET_PAY_TXT.concat(ticketId);
Object obj = redisUtil.get(rdsKey);
if(obj==null){
if (obj == null) {
return "";
}else{
} else {
return (String) obj;
}
}
......@@ -338,4 +332,44 @@ public class DataUtils {
return (List<String>) obj;
}
}
public int incrUseCouponCount(String uid, String performanceId) {
String rdk = KylinRedisConst.COUPON_COUNT.concat(uid).concat(":").concat(performanceId);
return (int) redisUtil.incr(rdk, 1);
}
public int decrUseCouponCount(String uid, String performanceId) {
String rdk = KylinRedisConst.COUPON_COUNT.concat(uid).concat(":").concat(performanceId);
return (int) redisUtil.decr(rdk, 1);
}
public int incrUseMemberCount(String uid, String performanceId) {
String rdk = KylinRedisConst.MEMBER_COUNT.concat(uid).concat(":").concat(performanceId);
return (int) redisUtil.incr(rdk, 1);
}
public int decrUseMemberCount(String uid, String performanceId) {
String rdk = KylinRedisConst.MEMBER_COUNT.concat(uid).concat(":").concat(performanceId);
return (int) redisUtil.decr(rdk, 1);
}
// public int getUseCouponCount(String uid,String performanceId){
// String rdk = KylinRedisConst.COUPON_COUNT.concat(uid).concat(":").concat(performanceId);
// Object obj = redisUtil.get(rdk);
// if(obj==null){
// return 0;
// }else{
// return (int) obj;
// }
// }
public int getUseCouponCount(String uid, String performanceId) {
String rdk = KylinRedisConst.COUPON_COUNT.concat(uid).concat(":").concat(performanceId);
Object obj = redisUtil.get(rdk);
if (obj == null) {
return 0;
} else {
return (int) obj;
}
}
}
......@@ -44,98 +44,109 @@ public class OrderUtils {
private String candyUrl;
@Value("${liquidnet.service.smile.url}")
private String smile;
@Value("${liquidnet.service.stone.url}")
private String stoneUrl;
public String judgeOrderLimit(
int type,
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceLimitCount,
int performanceMemberLimitCount,
int performanceLimitIdCard,
int ticketLimitCount,
int ticketMemberLimitCount,
int performanceBuyCount,
int ticketBuyCount,
int ticketLimitIdCard,
int memberType,
int isTrueName
) {
Integer[] integers;
if (101 == type) {
integers = festivalOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
} else {
integers = roadShowOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
}
log.debug("演出购买数量=" + integers[0]);
log.debug("票种购买数量=" + integers[1]);
return judgeMemberType(performanceLimitCount, performanceMemberLimitCount, ticketLimitCount, ticketMemberLimitCount, memberType, integers[0], integers[1], isTrueName);
Integer[] integers = orderLimit(userId, idCard, performanceId, ticketId, isTrueName);
return judgeMemberType(performanceLimitCount, performanceMemberLimitCount, performanceLimitIdCard,
ticketLimitCount, ticketMemberLimitCount,ticketLimitIdCard,
memberType, integers[0], integers[1], integers[2], integers[3], isTrueName);
}
public Integer[] roadShowOrderLimit(
public Integer[] orderLimit(
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceBuyCount,
int ticketBuyCount,
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount = dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount = dataUtils.getIdCardTBuyCount(idCard, ticketId);
} else {//非实名
performanceBuyCount = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount = dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = ObjectUtil.cloneInteger2Array();
array[0] = performanceBuyCount;
array[1] = ticketBuyCount;
return array;
}
int performanceBuyCountUid = 0;
int ticketBuyCountUid = 0;
int performanceBuyCountIdCard = 0;
int ticketBuyCountIdCard = 0;
public Integer[] festivalOrderLimit(
String userId,
String idCard,
String performanceId,
String ticketId,
int performanceBuyCount,
int ticketBuyCount,
int isTrueName
) {
if (1 == isTrueName) {//实名
performanceBuyCount = dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCount = dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCountIdCard = dataUtils.getIdCardPBuyCount(idCard, performanceId);
ticketBuyCountIdCard = dataUtils.getIdCardTBuyCount(idCard, ticketId);
performanceBuyCountUid = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCountUid = dataUtils.getUserTBuyCount(userId, ticketId);
} else {//非实名
performanceBuyCount = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount = dataUtils.getUserTBuyCount(userId, ticketId);
performanceBuyCountUid = dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCountUid = dataUtils.getUserTBuyCount(userId, ticketId);
}
Integer[] array = ObjectUtil.cloneInteger2Array();
array[0] = performanceBuyCount;
array[1] = ticketBuyCount;
Integer[] array = new Integer[4];
array[0] = performanceBuyCountUid;
array[1] = ticketBuyCountUid;
array[2] = performanceBuyCountIdCard;
array[3] = ticketBuyCountIdCard;
return array;
}
public String judgeMemberType(int performanceLimitCount, int performanceMemberLimitCount, int ticketLimitCount, int ticketMemberLimitCount, int memberType, int performanceBuyCount, int ticketBuyCount, int isTrueName) {
log.debug("会员限购演出=" + performanceMemberLimitCount);
log.debug("限购演出=" + performanceLimitCount);
log.debug("会员限购票种=" + ticketMemberLimitCount);
log.debug("限购票种=" + ticketLimitCount);
public String judgeMemberType(int performanceLimitCount, int performanceMemberLimitCount, int performanceLimitIdCard,
int ticketLimitCount, int ticketMemberLimitCount, int ticketLimitIdCard, int memberType,
int performanceBuyCountUid, int ticketBuyCountUid, int performanceBuyCountIdCard, int ticketBuyCountIdCard, int isTrueName) {
log.info("会员限购演出=" + performanceMemberLimitCount);
log.info("限购演出=" + performanceLimitCount);
log.info("实名限购演出=" + performanceLimitIdCard);
log.info("会员限购票种=" + ticketMemberLimitCount);
log.info("限购票种=" + ticketLimitCount);
log.info("实名限购票种=" + ticketLimitIdCard);
log.info("演出数量=" + performanceBuyCountUid);
log.info("演出实名数量=" + performanceBuyCountIdCard);
log.info("票种数量=" + ticketBuyCountUid);
log.info("票种实名数量=" + ticketBuyCountIdCard);
if (memberType == 1 || memberType == 2) {
if (performanceBuyCount > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "本场") + "演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCount > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "该") + "票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
if(isTrueName==1){
if (performanceBuyCountIdCard > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return "实名制演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountIdCard > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return "实名制票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
}
}else{
if (performanceBuyCountUid > performanceMemberLimitCount && performanceMemberLimitCount != 0) {
return "本场演出限购" + performanceMemberLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketMemberLimitCount && ticketMemberLimitCount != 0) {
return "该票种限购" + ticketMemberLimitCount + "张,已超出";//超过票维度购买量
}
}
} else {//非会员区间
if (performanceBuyCount > performanceLimitCount && performanceLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "本场") + "演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCount > ticketLimitCount && ticketLimitCount != 0) {
return (1 == isTrueName ? "实名制" : "该") + "票种限购" + ticketLimitCount + "张,已超出";//超过票维度购买量
if(isTrueName==1){
if (performanceBuyCountIdCard > performanceLimitIdCard && performanceLimitIdCard != 0) {
return "实名制演出限购" + performanceLimitIdCard + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountIdCard > ticketLimitIdCard && ticketLimitIdCard != 0) {
return "实名制票种限购" + ticketLimitIdCard + "张,已超出";//超过演出维度购买量
}
if (performanceBuyCountUid > performanceLimitCount && performanceLimitCount != 0) {
return "本场演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketLimitCount && ticketLimitCount != 0) {
return "该票种限购" + ticketLimitCount + "张,已超出";//超过演出维度购买量
}
}else{
if (performanceBuyCountUid > performanceLimitCount && performanceLimitCount != 0) {
return "本场演出限购" + performanceLimitCount + "张,已超出";//超过演出维度购买量
}
if (ticketBuyCountUid > ticketLimitCount && ticketLimitCount != 0) {
return "该票种限购" + ticketLimitCount + "张,已超出";//超过演出维度购买量
}
}
}
return "";
......
......@@ -136,6 +136,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
BeanUtils.copyProperties(step1Param, performancePartnerVo);
performancePartnerVo.setIsTrueName(0);
performancePartnerVo.setLimitCount(0);
performancePartnerVo.setIdCount(0);
performancePartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performancePartnerVo.setIsSubmit(0);
performancePartnerVo.setStatus(0);
......@@ -183,6 +184,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
if (data != null) { // 有修改记录
performancePartnerVo.setIsTrueName(data.getIsTrueName());
performancePartnerVo.setLimitCount(data.getLimitCount());
performancePartnerVo.setIdCount(data.getIdCount());
performancePartnerVo.setStatusSell(data.getStatusSell());
performancePartnerVo.setRoadShowId(data.getRoadShowId());
performancePartnerVo.setProjectId(data.getProjectId());
......@@ -196,6 +198,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
KylinPerformanceRelations relationsData = performanceRelationsMapper.selectOne(Wrappers.lambdaQuery(KylinPerformanceRelations.class).eq(KylinPerformanceRelations::getPerformanceId, performanceId));
performancePartnerVo.setIsTrueName(statusData.getIsTrueName());
performancePartnerVo.setLimitCount(statusData.getLimitCount());
performancePartnerVo.setIdCount(statusData.getStatus());
performancePartnerVo.setStatusSell(statusData.getStatusSell());
performancePartnerVo.setRoadShowId(relationsData.getRoadShowId());
performancePartnerVo.setProjectId(relationsData.getProjectId());
......@@ -387,6 +390,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
performanceStatus.setAuditStatus((int) map.get("auditStatus"));
performanceStatus.setIsTrueName(step2Param.getIsTrueName());
performanceStatus.setLimitCount(step2Param.getLimitCount());
performanceStatus.setIdCount(step2Param.getIdCount());
performanceStatusMapper.update(performanceStatus, Wrappers.lambdaQuery(KylinPerformanceStatus.class).eq(KylinPerformanceStatus::getPerformanceId, performanceId));
dataUtils.setPerformanceIsTrueName(performanceId, step2Param.getIsTrueName());
......@@ -412,6 +416,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
inventory.setTotalGeneral(ticketItem.getTotalGeneral());
inventory.setIsTrueName(kylinPerformanceMisVo.getIsTrueName());
inventory.setLimitCount(ticketItem.getLimitCount());
inventory.setLimitCount(ticketItem.getIdCount());
inventory.setIsLackRegister(ticketItem.getIsLackRegister());
inventory.setIsExpress(ticketItem.getIsExpress());
inventory.setIsElectronic(ticketItem.getIsElectronic());
......
......@@ -155,13 +155,13 @@ public class DataUtils {
public List<KylinOrderListVo> getOrderList(String userId) {
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(KylinRedisConst.ORDER_LIST + userId);
if (obj!=null) {
return (List<KylinOrderListVo>)obj;
if (obj != null) {
return (List<KylinOrderListVo>) obj;
} else {
List<KylinOrderListVo> voList = mongoTemplate.find(Query.query(Criteria.where("userId").is(userId))
.with(Sort.by(Sort.Direction.DESC, "createdAt")).limit(40),
KylinOrderListVo.class, KylinOrderTicketVo.class.getSimpleName());
for (KylinOrderListVo item : voList){
for (KylinOrderListVo item : voList) {
item.setStatus(item.getStatus());
}
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.ORDER_LIST + userId, voList);
......@@ -175,8 +175,8 @@ public class DataUtils {
* @param performanceId
* @param isTrueName
*/
public void setPerformanceIsTrueName(String performanceId,int isTrueName) {
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.PERFORMANCES_TRUE_NAME + performanceId,isTrueName);
public void setPerformanceIsTrueName(String performanceId, int isTrueName) {
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.PERFORMANCES_TRUE_NAME + performanceId, isTrueName);
}
/**
......@@ -187,8 +187,8 @@ public class DataUtils {
*/
public KylinOrderTicketVo getOrderTicketVo(String orderId) {
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(KylinRedisConst.ORDER + orderId);
if (obj!=null) {
return (KylinOrderTicketVo)obj;
if (obj != null) {
return (KylinOrderTicketVo) obj;
} else {
KylinOrderTicketVo ticketData = mongoTemplate.findOne(Query.query(Criteria.where("orderTicketsId").is(orderId)), KylinOrderTicketVo.class, KylinOrderTicketVo.class.getSimpleName());
List<KylinOrderTicketEntitiesVo> kylinOrderTicketEntitiesVoList = mongoTemplate.find(Query.query(Criteria.where("orderId").is(orderId)), KylinOrderTicketEntitiesVo.class, KylinOrderTicketEntitiesVo.class.getSimpleName());
......@@ -228,7 +228,6 @@ public class DataUtils {
}
public void updatePerformanceMongo(String performanceIds, KylinPerformanceVo paramVo) {
//查询 mysql 数据
KylinPerformanceVo vo;
......@@ -273,31 +272,40 @@ public class DataUtils {
* @param buyCount 购买数量 大于 0 增加 小于 0 减少 对应 支付 退款表
*/
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKey;
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
int isTrueName = getPerformanceIsTrueName(performanceId);
if (0 == isTrueName) {
redisKey = KylinRedisConst.USERID_BUY_INFO + userId;
} else {
redisKey = KylinRedisConst.IDCARD_BUY_INFO + idCard;
redisKeyUid = KylinRedisConst.USERID_BUY_INFO + userId;
redisKeyIdCard = KylinRedisConst.IDCARD_BUY_INFO + idCard;
String performanceIdKeyUid = redisKeyUid + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKeyUid = redisKeyUid + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (isTrueName != 0) {
performanceIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
ticketIdKeyIdCard = redisKeyIdCard + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
}
String performanceIdKey = redisKey + ":" + KylinRedisConst.PERFORMANCE_ID + ":" + performanceId;
String ticketIdKey = redisKey + ":" + KylinRedisConst.TICKET_ID + ":" + ticketId;
if (buyCount > 0) {
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKey, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKey, buyCount);
}else{
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKey, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKey, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKeyUid, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKeyUid, buyCount);
if (isTrueName != 0) {
redisDataSourceUtil.getRedisKylinUtil().incr(ticketIdKeyIdCard, buyCount);
redisDataSourceUtil.getRedisKylinUtil().incr(performanceIdKeyIdCard, buyCount);
}
} else {
if (isTrueName != 0) {
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKeyIdCard, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKeyIdCard, Math.abs(buyCount));
}
redisDataSourceUtil.getRedisKylinUtil().decr(ticketIdKeyUid, Math.abs(buyCount));
redisDataSourceUtil.getRedisKylinUtil().decr(performanceIdKeyUid, Math.abs(buyCount));
}
}
// 获取 用户维度 演出购买数量
public int getUserPBuyCount(String userId, String performanceId) {
try {
......@@ -351,8 +359,8 @@ public class DataUtils {
*/
public KylinPerformanceVo getPerformanceVo(String performanceId) {
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(KylinRedisConst.PERFORMANCES + performanceId);
if (obj!=null) {
return (KylinPerformanceVo)obj;
if (obj != null) {
return (KylinPerformanceVo) obj;
} else {
KylinPerformanceVo performanceData = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performanceId)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.PERFORMANCES + performanceId, performanceData);
......@@ -367,26 +375,27 @@ public class DataUtils {
*/
public int getPerformanceIsTrueName(String performanceId) {
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(KylinRedisConst.PERFORMANCES_TRUE_NAME + performanceId);
if (obj!=null) {
return (int)obj;
}else{
if (obj != null) {
return (int) obj;
} else {
int isTrueName = getPerformanceVo(performanceId).getIsTrueName();
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.PERFORMANCES_TRUE_NAME + performanceId,isTrueName);
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.PERFORMANCES_TRUE_NAME + performanceId, isTrueName);
return isTrueName;
}
}
public void delOrderRefundVo(String orderRefundsId){
public void delOrderRefundVo(String orderRefundsId) {
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.ORDER_REFUND + orderRefundsId);
}
public void delOrderRefundVoByOrderId(String orderId){
public void delOrderRefundVoByOrderId(String orderId) {
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.ORDER_REFUND_BY_ORDER_ID + orderId);
}
/**
* 演出订单快递信息
*
* @param orderId
* @param kylinOrderExpressVo
*/
......@@ -409,7 +418,7 @@ public class DataUtils {
}
// 获取订单券的使用情况
public ArrayList<KylinOrderCoupons> getOrderCoupon(String orderId){
public ArrayList<KylinOrderCoupons> getOrderCoupon(String orderId) {
String redisKey = KylinRedisConst.ORDER_COUPON.concat(orderId);
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(redisKey);
if (obj == null) {
......
......@@ -272,3 +272,9 @@ create table kylin_ticket_express_module
updated_at datetime ,
comment text
) engine = InnoDB comment '票种快递模板关联表';
ALTER TABLE kylin_performance_status
ADD id_count int DEFAULT NULL COMMENT '实名限购数';
ALTER TABLE kylin_ticket_status
ADD id_count int DEFAULT NULL COMMENT '实名限购数';
\ No newline at end of file
......@@ -44,6 +44,14 @@ public class KylinBuyNoticeParnterController {
@Autowired
RedisSlimeUtils redisSlimeUtils;
@GetMapping(value = "test")
@ApiOperation(value = "测试", position = 1)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<Boolean> ce(@RequestParam("performanceId") String performanceId) {
performanceUtils.getNewTicketData(performanceId);
return ResponseDto.success();
}
@GetMapping(value = "buyNotice")
@ApiOperation(value = "购票须知列表", position = 1)
@ApiResponse(code = 200, message = "接口返回对象参数")
......
......@@ -107,6 +107,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
BeanUtils.copyProperties(step1Param, performancePartnerVo);
performancePartnerVo.setIsTrueName(0);
performancePartnerVo.setLimitCount(0);
performancePartnerVo.setIdCount(0);
performancePartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performancePartnerVo.setIsSubmit(0);
performancePartnerVo.setStatus(0);
......@@ -157,6 +158,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
if (data != null) { // 有修改记录
performancePartnerVo.setIsTrueName(data.getIsTrueName());
performancePartnerVo.setLimitCount(data.getLimitCount());
performancePartnerVo.setIdCount(data.getIdCount());
performancePartnerVo.setStatusSell(data.getStatusSell());
performancePartnerVo.setRoadShowId(data.getRoadShowId());
performancePartnerVo.setProjectId(data.getProjectId());
......@@ -165,6 +167,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
KylinPerformanceVo vo = redisSlimeUtils.getPerformanceVo(performanceId);
performancePartnerVo.setIsTrueName(vo.getIsTrueName());
performancePartnerVo.setLimitCount(vo.getLimitCount());
performancePartnerVo.setIdCount(vo.getIdCount());
performancePartnerVo.setStatusSell(vo.getStatusSell());
performancePartnerVo.setRoadShowId(vo.getRoadShowId());
performancePartnerVo.setProjectId(vo.getProjectId());
......@@ -246,6 +249,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
performancePartnerVo.setPerformancesId(performanceId);
performancePartnerVo.setIsTrueName(step2Param.getIsTrueName());
performancePartnerVo.setLimitCount(step2Param.getLimitCount());
performancePartnerVo.setIdCount(step2Param.getIdCount());
performancePartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performancePartnerVo.setIsSubmit(step2Param.getIsSubmit());
// performancePartnerVo.setStatusSell(1);
......@@ -341,6 +345,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
performancePartnerVo.setPerformancesId(performanceId);
performancePartnerVo.setIsTrueName(step2Param.getIsTrueName());
performancePartnerVo.setLimitCount(step2Param.getLimitCount());
performancePartnerVo.setIdCount(step2Param.getIdCount());
performancePartnerVo.setCreatedAt(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performancePartnerVo.setUpdatedAt(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performancePartnerVo.setIsSubmit(step2Param.getIsSubmit());
......@@ -385,7 +390,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
now, kylinPerformanceMisVo.getNoticeImage(), performanceId, now, now
});
sqlsDataB.add(new Object[]{
performancePartnerVo.getFieldAuditStatus(), performancePartnerVo.getAuditStatus(), step2Param.getIsTrueName(), step2Param.getLimitCount(), performanceId, now, now
performancePartnerVo.getFieldAuditStatus(), performancePartnerVo.getAuditStatus(), step2Param.getIsTrueName(), step2Param.getLimitCount(),step2Param.getIdCount(), performanceId, now, now
});
redisSlimeUtils.setPerformanceIsTrueName(performanceId, step2Param.getIsTrueName());
......@@ -425,6 +430,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
ticketData.setTotalGeneral(ticketItem.getTotalGeneral());
ticketData.setIsTrueName(kylinPerformanceMisVo.getIsTrueName());
ticketData.setLimitCount(ticketItem.getLimitCount());
ticketData.setIdCount(ticketItem.getIdCount());
ticketData.setIsLackRegister(ticketItem.getIsLackRegister());
ticketData.setIsExpress(ticketItem.getIsExpress());
ticketData.setIsElectronic(ticketItem.getIsElectronic());
......@@ -442,7 +448,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
//修改 mysql 购票限购、库存
sqlsDataD.add(new Object[]{
ticketItem.getTotalExchange(), ticketItem.getTotalGeneral(), kylinPerformanceMisVo.getIsTrueName(),
ticketItem.getLimitCount(), ticketItem.getIsLackRegister(), ticketItem.getIsExpress(),
ticketItem.getLimitCount(),ticketItem.getIdCount(), ticketItem.getIsLackRegister(), ticketItem.getIsExpress(),
ticketItem.getIsElectronic(), ticketItem.getCounts(), ticketItem.getIsShowCode(),
DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketItem.getQrCodeShowTime()), ticketItem.getTicketsId(), now, now
});
......@@ -471,6 +477,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
vo.setAuditStatus(performancePartnerVo.getAuditStatus());
vo.setIsTrueName(step2Param.getIsTrueName());
vo.setLimitCount(step2Param.getLimitCount());
vo.setIdCount(step2Param.getIdCount());
mongoSlimeUtils.updateKylinPerformanceVoById(vo);
redisSlimeUtils.delPerformanceVo(performanceId);
......
package com.liquidnet.service.slime.util;
import com.alibaba.fastjson.JSON;
import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
......@@ -401,7 +402,7 @@ public class PerformanceUtils {
//快递相关
KylinTicketExpressModuleVo moduleVo = redisSlimeUtils.getTEMMerchantVo(tickets.getTicketsId());
if (moduleVo != null && moduleVo.getProduceCodeList()!=null) {
if (moduleVo != null && moduleVo.getProduceCodeList() != null) {
redisSlimeUtils.setTEMMerchantVo(tickets.getTicketsId(), moduleVo);
del9.add(new Object[]{tickets.getTicketsId(), updatedAt});
for (ExpressModuleVo mVo : moduleVo.getProduceCodeList())
......@@ -736,4 +737,67 @@ public class PerformanceUtils {
return null;
}
}
/**
* 根据场次时间进行拆分组
*
* @param performanceId
*/
public void getNewTicketData(String performanceId) {
KylinPerformanceVo vo = redisSlimeUtils.getPerformanceVo(performanceId);
List<KylinTicketTimesVo> timeList = vo.getTicketTimeList();
List<KylinTicketTimesVo> timeListVo = new ArrayList<>();
HashMap<String, List<KylinTicketVo>> mapData = new HashMap<>();
//根据场次拆出时间组
List<String> useTimeList = CollectionUtil.linkedListString();
for (KylinTicketTimesVo timesVo : timeList) {
String st = timesVo.getUseStart();
String et = timesVo.getUseEnd();
long day = DateUtil.intervalDays(st, et);
for (int i = 0; i <= day; i++) {
String useDay = DateUtil.addDay(st, i);
if (!useTimeList.contains(useDay)) {
useTimeList.add(useDay);
}
}
}
Collections.sort(useTimeList);
//新场次
for (String name : useTimeList) {
KylinTicketTimesVo timesVo = KylinTicketTimesVo.getNew();
timesVo.setPerformanceId(performanceId);
timesVo.setTitle(name);
timesVo.setUseStart(name);
timesVo.setUseEnd(name);
timeListVo.add(timesVo);
mapData.put(name, new ArrayList<>());
}
//完善新场次数据
for (KylinTicketTimesVo timesVo : timeList) {
for (KylinTicketVo ticketVo : timesVo.getTicketList()) {
String st = ticketVo.getUseStart();
String et = ticketVo.getUseEnd();
long day = DateUtil.intervalDays(st, et);
for (int i = 0; i <= day; i++) {
String useDay = DateUtil.addDay(st, i);
List<KylinTicketVo> t1 = mapData.get(useDay);
t1.add(ticketVo);
mapData.put(useDay, t1);
}
}
}
for (String key : mapData.keySet()) {
for (KylinTicketTimesVo v1 : timeListVo) {
if (v1.getTitle().equals(key)) {
List<KylinTicketVo> v2 = mapData.get(key);
v1.setTicketList(v2);
}
}
}
log.info("新数据:" + JsonUtils.toJson(timeListVo));
}
}
......@@ -42,9 +42,9 @@ kylin_performances_reject_txt.fieldsStatus = UPDATE kylin_performances SET rejec
# ---- 演出第二步骤操作 ----
kylin_performance.updateStep2=UPDATE kylin_performances SET audit_time = ? , notice_image = ? WHERE performances_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_performance_status.updateStep2=UPDATE kylin_performance_status SET field_audit_status = ? ,audit_status = ? , is_true_name = ? , limit_count = ? WHERE performance_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_performance_status.updateStep2=UPDATE kylin_performance_status SET field_audit_status = ? ,audit_status = ? , is_true_name = ? , limit_count = ?,id_count =? WHERE performance_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_ticket.updateStep2=UPDATE kylin_tickets SET time_end = ? , time_start = ? ,time_end_express = ? ,pay_countdown_minute = ? ,price = ? WHERE tickets_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_ticket_status.updateStep2=UPDATE kylin_ticket_status SET total_exchange = ? , total_general = ? , is_true_name = ? , limit_count = ? , is_lack_register = ? , is_express = ? , is_electronic = ? ,counts = ? , is_show_code = ? ,qr_code_show_time = ? WHERE ticket_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_ticket_status.updateStep2=UPDATE kylin_ticket_status SET total_exchange = ? , total_general = ? , is_true_name = ? , limit_count = ? ,id_count =? , is_lack_register = ? , is_express = ? , is_electronic = ? ,counts = ? , is_show_code = ? ,qr_code_show_time = ? WHERE ticket_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
# ---- VoStatus ----
kylin_ticket_status.VoStatus=UPDATE kylin_ticket_status SET status = ?, surplus_general = ? WHERE ticket_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_performance_status.VoStatus=UPDATE kylin_performance_status SET status = ? WHERE performance_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
......@@ -54,7 +54,7 @@ kylin_performance_status.del=DELETE FROM kylin_performance_status WHERE performa
kylin_performance_relations.del=DELETE FROM kylin_performance_relations WHERE performance_id = ?
#province_id,province_name,district_id,district_name
kylin_performances.insert=INSERT INTO kylin_performances (performances_id,title,type,img_poster,city_id,city_name,approval_url,notice,sponsor_id,sponsor_type,sponsor,contacts,mobile,describes,details,notice_image,time_start,time_end,sort,comment,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_performance_status.insert=INSERT INTO kylin_performance_status (performance_status_id,performance_id,is_show,status,status_sell,is_distribution,sync_agent,sync_damai,audit_status,is_true_name,limit_count,limit_count_member,field_audit_status,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_performance_status.insert=INSERT INTO kylin_performance_status (performance_status_id,performance_id,is_show,status,status_sell,is_distribution,sync_agent,sync_damai,audit_status,is_true_name,limit_count,id_count,limit_count_member,field_audit_status,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_performance_relations.insert=INSERT INTO kylin_performance_relations (performance_relations_id,performance_id,copy_id,merchant_id,field_id,road_show_id,project_id,video_id,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?)
kylin_ticket_times.del=DELETE FROM kylin_ticket_times WHERE ticket_times_id = ?
......@@ -68,7 +68,7 @@ kylin_ticket_status.del=DELETE FROM kylin_ticket_status WHERE ticket_id = ?
kylin_ticket_relations.del=DELETE FROM kylin_ticket_relations WHERE ticket_id = ?
kylin_tickets.insert=INSERT INTO kylin_tickets (tickets_id,title,type,price,price_express,price_discount_member,price_discount,describes,describe_express,describe_electronic,advance_minute_member,time_start,time_end,time_end_express,use_start,use_end,pay_countdown_minute,sale_remind_minute,comment,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_ticket_status.insert=INSERT INTO kylin_ticket_status (ticket_status_id,ticket_id,is_student,is_electronic,is_express,status,counts,status_exchange,is_show_code,qr_code_show_time,is_lack_register,total_general,total_exchange,surplus_general,surplus_exchange,express_type,is_transfer,is_true_name,limit_count,member_limit_count,is_exclusive,is_member,is_agent,sync_damai,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_ticket_status.insert=INSERT INTO kylin_ticket_status (ticket_status_id,ticket_id,is_student,is_electronic,is_express,status,counts,status_exchange,is_show_code,qr_code_show_time,is_lack_register,total_general,total_exchange,surplus_general,surplus_exchange,express_type,is_transfer,is_true_name,limit_count,id_count,member_limit_count,is_exclusive,is_member,is_agent,sync_damai,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
kylin_ticket_relations.insert=INSERT INTO kylin_ticket_relations (ticket_relations_id,ticket_id,times_id,created_at,updated_at) VALUES (?,?,?,?,?)
kylin_ticket_express_module.del=DELETE FROM kylin_ticket_express_module WHERE ticket_id = ? and created_at < ?
......
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