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

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

提交新结构mongo

parent 52829d04
package com.liquidnet.service.kylin.constant;
public class KylinRedisConst {
public static final String FIELDS = "kylin:fields:id:";
public static final String FIELDS = "kylin:fields:id";
public static final String PERFORMANCES = "kylin:performances:id:";
public static final String PERFORMANCES_RECOMMEND = "kylin:performances:recommend:id:";
public static final String PERFORMANCES_INVENTORY = "kylin:performances_inventory:ticket:id:";
......
......@@ -12,6 +12,7 @@ import java.util.List;
@ApiModel
public class KylinTicketTimesVo {
private Integer mid;
@ApiModelProperty(value = "主键")
private String ticketTimesId;
@ApiModelProperty(value = "名称")
......
......@@ -13,6 +13,7 @@ import java.time.format.DateTimeFormatter;
@ApiModel
public class KylinTicketVo {
private Integer mid;
@ApiModelProperty(value = "主键")
private String ticketsId;
@ApiModelProperty(value = "场次id")
......@@ -85,6 +86,8 @@ public class KylinTicketVo {
private Integer isShowCode;
@ApiModelProperty(value = "二维码显示时间")
private String qrCodeShowTime;
@ApiModelProperty(value = "会员提前分钟")
private Integer advanceMinuteMember;
public void setTicket(KylinTickets ticket) {
this.ticketsId = ticket.getTicketsId();
......@@ -99,11 +102,12 @@ public class KylinTicketVo {
this.describeElectronic = ticket.getDescribeElectronic();
this.timeStart = ticket.getTimeStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
this.timeEnd = ticket.getTimeEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
this.advanceMinuteMember = ticket.getAdvanceMinuteMember();
this.memberTimeStart = ticket.getTimeStart().plusMinutes(-ticket.getAdvanceMinuteMember()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if(ticket.getTimeEndExpress()!=null) {
if (ticket.getTimeEndExpress() != null) {
this.timeEndExpress = ticket.getTimeEndExpress().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}else{
this.timeEndExpress=null;
} else {
this.timeEndExpress = null;
}
this.useStart = ticket.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
this.useEnd = ticket.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
......@@ -126,8 +130,8 @@ public class KylinTicketVo {
this.limitCount = ticketStatus.getLimitCount();
this.counts = ticketStatus.getCounts();
this.sysDamai = ticketStatus.getSyncDamai();
this.isShowCode=ticketStatus.getIsShowCode();
this.qrCodeShowTime=ticketStatus.getQrCodeShowTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
this.isShowCode = ticketStatus.getIsShowCode();
this.qrCodeShowTime = ticketStatus.getQrCodeShowTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
......
......@@ -18,6 +18,7 @@ import java.util.List;
@Data
public class KylinPerformanceVo {
private Integer mid;
@ApiModelProperty(value = "主键")
private String performancesId;
@ApiModelProperty(value = "演出名称")
......
......@@ -13,7 +13,6 @@ public class OrderDetailsVo {
private KylinOrderTicketVo orderTicketVo;
private List<KylinOrderTicketEntitiesVo> orderTicketEntitiesVo;
private KylinPerformanceVo performanceVo;
private KylinTicketVo ticketVo;
private String express_number;
private String express_company;
private Integer kuaidi_status;
......
......@@ -162,7 +162,7 @@ public interface IKylinPerformancesAdminService extends IService<KylinPerformanc
* @param status 0 否 1 是
* @return
*/
boolean changeTicketAgent(String ticketId, Integer status);
boolean changeTicketAgent(String performancesId,String ticketId, Integer status);
/**
* 修改 演出&票种&是否同步到大麦
......
......@@ -86,12 +86,12 @@ public interface IKylinTicketsPartnerService extends IService<KylinTickets> {
* @param ticketsId 票id
* @return boolean
*/
ResponseDto<String> onLine(String ticketsId);
ResponseDto<String> onLine(String ticketsId,String performancesId);
/**
* 票下线
* @param ticketsId 票id
* @return boolean
*/
ResponseDto<String> outLine(String ticketsId);
ResponseDto<String> outLine(String ticketsId,String performancesId);
}
......@@ -149,8 +149,8 @@ public class KylinPerformancesController extends BaseController {
@RequiresPermissions("kylin:performances:agent")
@PostMapping(value = "/agent/change")
@ResponseBody
public AjaxResult changeTicketAgent(@RequestParam("ticketsId") String ticketsId, @RequestParam("status") Integer status) {
boolean result = kylinPerformancesService.changeTicketAgent(ticketsId, status);
public AjaxResult changeTicketAgent(@RequestParam("performancesId") String performancesId,@RequestParam("ticketsId") String ticketsId, @RequestParam("status") Integer status) {
boolean result = kylinPerformancesService.changeTicketAgent(performancesId,ticketsId, status);
return toAjax(result);
}
......
......@@ -63,6 +63,7 @@
function submitHandler(res) {
var param = {
"performancesId":'[[${kylinPerformanceAgentVo.performancesId}]]'.replaceAll("\"", ""),
"ticketsId":$(res).parent().parent().parent().find("input[name^='ticketsId']").val(),
"status": $(res).parent().find("input[name^='ticket_agent:"+$(res).parent().parent().parent().find("input[name^='ticketsId']").val()+"']:checked").val()
}
......@@ -74,4 +75,4 @@
</script>
</body>
</html>
\ No newline at end of file
</html>
......@@ -43,7 +43,9 @@
<option value="4">审核拒绝</option>
<option value="6">售卖</option>
<option value="7">已下架</option>
<option value="8">演出结束</option>
<option value="8">售罄</option>
<option value="9">未开始</option>
<option value="10">演出结束</option>
</select>
</li>
<li>
......@@ -174,4 +176,4 @@
}
</script>
</body>
</html>
\ No newline at end of file
</html>
......@@ -146,7 +146,6 @@ public class KylinOrderTicketsAdminServiceImpl extends ServiceImpl<KylinOrderTic
}
vo.setOrderTicketEntitiesVo(kylinOrderTicketEntitiesVoList);
vo.setPerformanceVo(performanceVo);
vo.setTicketVo(ticketVo);
vo.setOrderTicketVo(orderTicketVo);
}
return vo;
......
......@@ -157,6 +157,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
mapSql.put("status", 9);
mapSql.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performanceVoUtils.updatePerformanceMySql(performancesId, mapSql, performanceVoUtils.getPerformanceMisVo(performancesId), updatedAt, auditStatus);
dataUtils.updatePerformanceMongo(performancesId);
if (sqlStatus.getStatus() == 6) {//若 演出上 则 线判断状态
performanceVoUtils.performanceVoStatus(performancesId);
}
......@@ -245,15 +246,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
performanceRelations.setRoadShowId(roadShowId);
performanceRelationsMapper.update(performanceRelations, new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id", performancesId));
//mongodb
HashMap<String, Object> map = new HashMap<>();
map.put("roadShowId", roadShowId);
BasicDBObject object = new BasicDBObject("$set", map);
mongoTemplate.getCollection(KylinPerformanceVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object
);
dataUtils.delPerformanceRedis(performancesId);
dataUtils.updatePerformanceMongo(performancesId);
return true;
} catch (Exception e) {
return false;
......@@ -273,31 +266,9 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
isRecommend = 0;
}
KylinPerformanceStatus performanceStatus = new KylinPerformanceStatus();
// performanceStatus.setIsRecommend(0);
// performanceStatus.setStatus(null);
// performanceStatusMapper.update(performanceStatus, new UpdateWrapper<KylinPerformanceStatus>().gt("is_recommend", 0));
//
// HashMap<String, Object> map = new HashMap<>();
// map.put("isRecommend", 0);
// BasicDBObject object = new BasicDBObject("$set", map);
// mongoTemplate.getCollection(KylinPerformanceVo.class.getSimpleName()).updateMany(
// Query.query(Criteria.where("isRecommend").gt(0)).getQueryObject(),
// object
// );
// for (PerformanceRecommendAdminParam item : performancesIdList) {
performanceStatus.setIsRecommend(isRecommend);
performanceStatusMapper.update(performanceStatus, new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
HashMap<String, Object> map2 = new HashMap<>();
map2.put("isRecommend", isRecommend);
BasicDBObject object2 = new BasicDBObject("$set", map2);
mongoTemplate.getCollection(KylinPerformanceVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object2
);
// }
// dataUtils.delPerformanceRecommendRedis(item.getPerformanceId());
dataUtils.updatePerformanceMongo(performancesId);
return true;
} catch (Exception e) {
return false;
......@@ -307,24 +278,19 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
@Override
public Integer setIsShow(String performancesId, Integer isShow) {
try {
Integer resultInt = 0;
if (isShow == 0) {
resultInt = performanceStatusMapper.hideIsShow(performancesId);
performanceStatusMapper.hideIsShow(performancesId);
} else {
resultInt = performanceStatusMapper.showIsShow(performancesId);
performanceStatusMapper.showIsShow(performancesId);
}
HashMap<String, Object> map = new HashMap<>();
map.put("isShow", isShow);
BasicDBObject object = new BasicDBObject("$set", map);
mongoTemplate.getCollection(KylinPerformanceVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object
);
mongoTemplate.getCollection(PerformancePartnerVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object
);
dataUtils.updatePerformanceMongo(performancesId);
return 1;
} catch (Exception e) {
e.printStackTrace();
......@@ -493,35 +459,8 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
tickets.setPriceDiscountMember(item.getPriceDiscountMember());
tickets.setUpdatedAt(updatedAt);
ticketsMapper.update(tickets, new UpdateWrapper<KylinTickets>().eq("tickets_id", item.getTicketsId()));
KylinTickets ticketsTime = ticketsMapper.selectOne(new UpdateWrapper<KylinTickets>().eq("tickets_id", item.getTicketsId()));
//修改mongo
HashMap<String, Object> map = new HashMap<>();
map.put("isMember", memberAuditVo.getIsMember());
map.put("isExclusive", memberAuditVo.getIsExclusive());
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
map.put("memberPrice", ticketsTime.getPrice().subtract(item.getPriceDiscountMember()));
map.put("memberTimeStart", ticketsTime.getTimeStart().plusMinutes(-ticketsTime.getAdvanceMinuteMember()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
map.put("limitCountMember", item.getMemberLimitCount());
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(KylinTicketVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("ticketsId").is(item.getTicketsId())).getQueryObject(),
object);
}
//修改 演出vo
HashMap<String, Object> mapPerformanceVo = new HashMap<>();
mapPerformanceVo.put("isMember", memberAuditVo.getIsMember());
mapPerformanceVo.put("isExclusive", memberAuditVo.getIsExclusive());
mapPerformanceVo.put("isAdvance", isAdvance);
mapPerformanceVo.put("isDiscount", isDiscount);
BasicDBObject objectPerformanceVo = new BasicDBObject("$set", mongoConverter.convertToMongoType(mapPerformanceVo));
mongoTemplate.getCollection(KylinPerformanceVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performanceId)).getQueryObject(),
objectPerformanceVo);
HashMap<String, Object> map2 = new HashMap<>();
map2.put("status", 3);
map2.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
......@@ -531,8 +470,8 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
Query.query(Criteria.where("performancesId").is(performanceId).and("status").is(1)).getQueryObject(),
object);
dataUtils.updatePerformanceMongo(performanceId);
performanceVoUtils.performanceVoStatus(performanceId);
dataUtils.delPerformanceRedis(performanceId);
} else {
HashMap<String, Object> map2 = new HashMap<>();
map2.put("status", 2);
......@@ -579,7 +518,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
}
@Override
public boolean changeTicketAgent(String ticketId, Integer status) {
public boolean changeTicketAgent(String performancesId , String ticketId, Integer status) {
try {
LocalDateTime updatedAt = LocalDateTime.now();
if (status != 0 && status != 1) {
......@@ -590,17 +529,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
ticketStatus.setUpdatedAt(updatedAt);
ticketStatus.setIsAgent(status);
ticketStatusMapper.update(ticketStatus, new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketId));
//修改 mongo
HashMap<String, Object> map = new HashMap<>();
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
map.put("isAgent", status);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(KylinTicketVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("ticketsId").is(ticketId)).getQueryObject(),
object);
dataUtils.delTicketRedis(ticketId);
dataUtils.updatePerformanceMongo(performancesId);
return true;
} catch (Exception e) {
return false;
......
......@@ -5,6 +5,7 @@ import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.vo.*;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.entity.KylinBuyNotice;
import com.liquidnet.service.kylin.mapper.KylinBuyNoticeMapper;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,12 +19,12 @@ import java.util.List;
@Component
public class DataUtils {
@Autowired
private KylinBuyNoticeMapper buyNoticeMapper;
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private RedisUtil redisUtil;
@Autowired
private MongoVoUtils mongoVoUtils;
/**
* 初始化普通库存
......@@ -142,4 +143,31 @@ public class DataUtils {
public void delCheckUserRelationRedis(String checkUserId) {
redisUtil.del(KylinRedisConst.CHECK_USER_RELATION + checkUserId);
}
public void updatePerformanceMongo(String performanceIds) {
//查询 mysql 数据
KylinPerformanceVo vo = mongoVoUtils.combinePerformanceVoData(performanceIds);
if (vo != null) {
try {
//删除 mongo数据
mongoTemplate.remove(Query.query(Criteria.where("performancesId").is(performanceIds)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
} catch (Exception e) {
e.printStackTrace();
}
try {
//新增 mongo数据
mongoTemplate.insert(vo, KylinPerformanceVo.class.getSimpleName());
} catch (Exception e) {
e.printStackTrace();
}
try {
//删除redis
redisUtil.del(KylinRedisConst.PERFORMANCES + performanceIds);
} catch (Exception e) {
e.printStackTrace();
}
} else {
System.out.println("创建Vo异常");
}
}
}
package com.liquidnet.client.admin.zhengzai.kylin.utils;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Component
public class MongoVoUtils {
@Autowired
private KylinPerformancesMapper performancesMapper;
@Autowired
private KylinPerformanceStatusMapper performanceStatusMapper;
@Autowired
private KylinPerformanceRelationsMapper performanceRelationsMapper;
@Autowired
private KylinTicketTimesMapper ticketTimesMapper;
@Autowired
private KylinTicketTimeRelationMapper ticketTimeRelationMapper;
@Autowired
private KylinTicketsMapper ticketsMapper;
@Autowired
private KylinTicketStatusMapper ticketStatusMapper;
@Autowired
private KylinTicketRelationsMapper ticketRelationsMapper;
@Autowired
private RedisUtil redisUtil;
@Autowired
private DataUtils dataUtils;
public KylinPerformanceVo combinePerformanceVoData(String performancesId) {
try {
KylinPerformanceVo voData = new KylinPerformanceVo();
//演出数据
KylinPerformances p1 = performancesMapper.selectOne(new UpdateWrapper<KylinPerformances>().eq("performances_id", performancesId));
KylinPerformanceStatus p2 = performanceStatusMapper.selectOne(new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
KylinPerformanceRelations p3 = performanceRelationsMapper.selectOne(new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id", performancesId));
//场地相关数据
KylinFields fields = new KylinFields();
String cityName = (String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name");
fields.setCityId(null);
fields.setLatitude((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "latitude"));
fields.setLongitude((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "longitude"));
fields.setCityName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name"));
fields.setName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "name"));
//相关状态时间初始变量
LocalDateTime stopSellTime = null;
LocalDateTime sellTime = null;
int isLackRegister = 0;
int isMember = 0;
int isExclusive = 0;
int isAdvance = 0;
int isDiscount = 0;
int payCountdownMinute = 15;
BigDecimal price = new BigDecimal("0.00");
//场次数据
List<KylinTicketTimeRelation> tt3 = ticketTimeRelationMapper.selectList(new UpdateWrapper<KylinTicketTimeRelation>().eq("performance_id", performancesId));
List<KylinTicketTimesVo> timeList = new ArrayList<>();
for (int x = 0; x < tt3.size(); x++) {
KylinTicketTimeRelation times = tt3.get(x);
KylinTicketTimes tt1 = ticketTimesMapper.selectOne(new UpdateWrapper<KylinTicketTimes>().eq("ticket_times_id", times.getTimesId()));
//票种数据
List<KylinTicketRelations> t3 = ticketRelationsMapper.selectList(new UpdateWrapper<KylinTicketRelations>().eq("times_id", times.getTimesId()));
List<KylinTicketVo> ticketList = new ArrayList<>();
for (int y = 0; y < t3.size(); y++) {
KylinTicketRelations ticket = t3.get(y);
KylinTickets t1 = ticketsMapper.selectOne(new UpdateWrapper<KylinTickets>().eq("tickets_id", ticket.getTicketId()));
KylinTicketStatus t2 = ticketStatusMapper.selectOne(new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticket.getTicketId()));
KylinTicketVo kylinTicketVo = new KylinTicketVo();
kylinTicketVo.setTimeId(ticket.getTimesId());
kylinTicketVo.setTicket(t1);
kylinTicketVo.setTicketStatus(t2);
ticketList.add(kylinTicketVo);
//票种 库存redis
if (!redisUtil.hHasKey(KylinRedisConst.PERFORMANCES_INVENTORY + kylinTicketVo.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL)) {
dataUtils.setSurplusGeneral(kylinTicketVo.getTicketsId(), t2.getTotalGeneral());
dataUtils.setSurplusExchange(kylinTicketVo.getTicketsId(), t2.getSurplusExchange());
}
if (kylinTicketVo.getIsMember() == 1) {
if (kylinTicketVo.getMemberPrice().compareTo(kylinTicketVo.getPrice()) != 0) {
isDiscount = 1;
}
if (!kylinTicketVo.getTimeStart().equalsIgnoreCase(kylinTicketVo.getMemberTimeStart())) {
isAdvance = 1;
}
if (kylinTicketVo.getIsMember() == 1) {
isMember = 1;
}
if (kylinTicketVo.getIsExclusive() == 1) {
isExclusive = 1;
}
}
if (kylinTicketVo.getIsLackRegister() == 1) {
isLackRegister = 1;
}
payCountdownMinute = t1.getPayCountdownMinute();
if (price.subtract(kylinTicketVo.getPrice()).compareTo(new BigDecimal("0.00")) < 0) {
price = kylinTicketVo.getPrice();
}
if (stopSellTime == null || stopSellTime.isBefore(t1.getTimeEnd())) {
stopSellTime = t1.getTimeEnd();
}
if (sellTime == null || sellTime.isAfter(t1.getTimeStart().plusMinutes(-t1.getAdvanceMinuteMember()))) {
sellTime = t1.getTimeStart().plusMinutes(-t1.getAdvanceMinuteMember());
}
}
KylinTicketTimesVo kylinTicketTimesVo = new KylinTicketTimesVo();
kylinTicketTimesVo.setTicketTimes(tt1);
kylinTicketTimesVo.setPerformanceId(times.getPerformanceId());
kylinTicketTimesVo.setTimeId(times.getTimesId());
kylinTicketTimesVo.setTicketList(ticketList);
timeList.add(kylinTicketTimesVo);
}
voData.setPerformance(p1);
voData.setPerformanceStatus(p2);
voData.setPerformanceRelations(p3);
voData.setFieldsData(fields, cityName);
voData.setTimePriceVipAndLack(isLackRegister, isMember, isExclusive, price, stopSellTime, sellTime, isAdvance, isDiscount, payCountdownMinute);
voData.setTicketTimeList(timeList);
return voData;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
}
......@@ -474,6 +474,10 @@ public abstract class DateUtil {
return dayLast + " 23:59:59";
}
public static LocalDateTime stringToLocalDateTime(String str) {
return LocalDateTime.parse(str, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
public static void main(String[] args) {
//
......
......@@ -43,7 +43,13 @@ public class PerformanceAdminListDao {
this.statusName="已下架";
break;
case 8:
this.statusName="演出结束";
this.statusName="售罄";
break;
case 9:
this.statusName="未开始";
break;
case 10:
this.statusName="已结束";
break;
default:
this.statusName="其他";
......
......@@ -152,7 +152,7 @@ CREATE TABLE `kylin_performance_status`
`performance_status_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'performance_status_id',
`performance_id` varchar(255) NOT NULL DEFAULT '' COMMENT '演出关联id',
`is_show` tinyint NOT NULL DEFAULT 1 COMMENT '是否显示 0全部用户可见 1白名单可见 2任何不显示',
`status` int NOT NULL DEFAULT 0 COMMENT '状态:-1删除;0未提交;1审核中;2审核中(自动上线);3审核通过;4审核未通过;6上线;7下架;8活动结束;9活动取消退款中;10活动取消退',
`status` int NOT NULL DEFAULT 0 COMMENT '状态:-1删除;0未提交;1审核中;2审核中(自动上线);3审核通过;4审核未通过;6上线;7下架;8活动售罄;9活动未开始;10活动结束',
`status_sell` tinyint NOT NULL DEFAULT 1 COMMENT '是否售卖 0停止 1正常',
`is_distribution` tinyint NOT NULL DEFAULT 0 COMMENT '是否开启分销 0关闭 1开启',
`sync_agent` tinyint NOT NULL DEFAULT 0 COMMENT '是否关联小程序 0不关联 1关联',
......@@ -772,4 +772,4 @@ CREATE TABLE `kylin_order_refunds`
KEY `kylin_order_refunds_order_refunds_id_index` (`order_refunds_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='订单退款表'
\ No newline at end of file
COLLATE = utf8mb4_unicode_ci COMMENT ='订单退款表'
package com.liquidnet.service.kylin.controller.admin;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dao.RoadShowAdminListDao;
import com.liquidnet.service.kylin.dto.param.CreateRoadShowParam;
import com.liquidnet.service.kylin.dto.vo.admin.KylinRoadShowAdminVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 巡演 前端控制器
* </p>
*
* @author liquidnet
* @since 2021-05-11
*/
@Api(tags = "后端-巡演",position = 2002)
@RestController
@RequestMapping("/admin/roadshow")
public class KylinRoadShowsAdminController {
// @Autowired
// private KylinRoadShowsAdminServiceImpl roadShowsService;
//
// @GetMapping(value = "list")
// @ApiOperation(value = "获取列表",position = 1)
// @ApiResponse(response = RoadShowAdminListDao.class, code = 200, message = "接口返回对象参数")
// public ResponseDto<PageInfo<RoadShowAdminListDao>> listRoadShow(@RequestParam(value = "title",required = false) String title,
// @RequestParam(value = "page") int page,
// @RequestParam(value = "size") int size) {
// PageInfo<RoadShowAdminListDao> result = null;
// result = roadShowsService.listRoadShow(title, page, size);
// if (null != result) {
// return ResponseDto.success(result);
// } else {
// return ResponseDto.failure("获取演出详情失败");
// }
// }
//
// @PostMapping(value = "")
// @ApiOperation(value = "创建",position = 2)
// @ApiResponse(code = 200, message = "接口返回对象参数")
// public ResponseDto<Map<String,String>> createRoadShow(@RequestBody CreateRoadShowParam createRoadShowParam) {
// String result = roadShowsService.createRoadShow(createRoadShowParam);
// if (!result.isEmpty()) {
// Map<String,String> map = new HashMap<>();
// map.put("roadShowId",result);
// return ResponseDto.success(map);
// } else {
// return ResponseDto.failure("创建失败");
// }
// }
//
// @PutMapping(value = "")
// @ApiOperation(value = "修改",position = 3)
// @ApiResponse(code = 200, message = "接口返回对象参数")
// public ResponseDto<String> updateRoadShow(@RequestBody CreateRoadShowParam createRoadShowParam) {
// boolean result = roadShowsService.updateRoadShow(createRoadShowParam);
// if (result) {
// return ResponseDto.success("修改成功");
// } else {
// return ResponseDto.failure("修改失败");
// }
// }
//
// @DeleteMapping(value = "")
// @ApiOperation(value = "删除",position = 4)
// @ApiResponse( code = 200, message = "接口返回对象参数")
// public ResponseDto<String> deleteRoadShow(@RequestParam("roadShowId") String roadShowId, @RequestParam("status") int status) {
// boolean result = roadShowsService.deleteRoadShow(roadShowId, status);
// if (result) {
// return ResponseDto.success("操作成功");
// } else {
// return ResponseDto.failure("操作失败");
// }
// }
//
// @GetMapping(value = "details")
// @ApiOperation(value = "详情",position = 5)
// @ApiResponse(response = KylinRoadShowAdminVo.class, code = 200, message = "接口返回对象参数")
// public ResponseDto<KylinRoadShowAdminVo> detailsRoadShow(@RequestParam("roadShowId") String roadShowId) {
// KylinRoadShowAdminVo result = null;
// result = roadShowsService.detailsRoadShow(roadShowId);
// if (result != null) {
// return ResponseDto.success(result);
// } else {
// return ResponseDto.failure("操作失败");
// }
// }
}
......@@ -76,14 +76,14 @@ public class KylinTicketsPartnerController {
@PostMapping(value = "/onLine")
@ApiOperation(value = "票上线",position = 6)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> onLine(@RequestParam("ticketsId") @NotNull String ticketsId) {
return ticketsPartnerService.onLine(ticketsId);
public ResponseDto<String> onLine(@RequestParam("ticketsId") @NotNull String ticketsId,@RequestParam("performancesId") @NotNull String performancesId) {
return ticketsPartnerService.onLine(ticketsId,performancesId);
}
@PostMapping(value = "/outLine")
@ApiOperation(value = "票下线",position = 7)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> outLine(@RequestParam("ticketsId") @NotNull String ticketsId) {
return ticketsPartnerService.outLine(ticketsId);
public ResponseDto<String> outLine(@RequestParam("ticketsId") @NotNull String ticketsId,@RequestParam("performancesId") @NotNull String performancesId) {
return ticketsPartnerService.outLine(ticketsId,performancesId);
}
}
......@@ -105,8 +105,23 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
RLock lock = RedisLockUtil.lock("userId:" + uid, 2);
try {
KylinPerformanceVo performanceData = dataUtils.getPerformanceVo(payOrderParam.getPerformanceId());
KylinTicketTimesVo ticketTimesData = dataUtils.getTicketTimesVo(payOrderParam.getTimeId());
KylinTicketVo ticketData = dataUtils.getTicketVo(payOrderParam.getTicketId());
KylinTicketTimesVo ticketTimesData = null;
KylinTicketVo ticketData = null;
for (int x = 0 ; x<performanceData.getTicketTimeList().size();x++){
KylinTicketTimesVo timeItem = performanceData.getTicketTimeList().get(x);
if(timeItem.getTimeId().equals(payOrderParam.getTimeId())){
ticketTimesData = timeItem;
for (int y = 0 ; y < ticketTimesData.getTicketList().size();y++){
KylinTicketVo ticketItem = ticketTimesData.getTicketList().get(y);
if(ticketItem.getTimeId().equals(payOrderParam.getTicketId())){
ticketData = ticketItem;
break;
}
}
break;
}
}
Integer isStudent = ticketData.getIsStudent();
if (performanceData == null || ticketTimesData == null || ticketData == null) {
lock.unlock();
......@@ -781,7 +796,6 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
if (null != orderTicketVo) {
Expresses expresses = expressesMapper.selectOne(new UpdateWrapper<Expresses>().eq("order_id", orderId).eq("order_type", "order_ticket"));
KylinPerformanceVo performanceVo = dataUtils.getPerformanceVo(orderTicketVo.getPerformanceId());
KylinTicketVo ticketVo = dataUtils.getTicketVo(orderTicketVo.getTicketId());
List<KylinOrderTicketEntitiesVo> kylinOrderTicketEntitiesVoList = mongoTemplate.find(Query.query(Criteria.where("orderId").is(orderTicketVo.getOrderTicketsId())), KylinOrderTicketEntitiesVo.class, KylinOrderTicketEntitiesVo.class.getSimpleName());
// 数据脱敏
for (KylinOrderTicketEntitiesVo item : kylinOrderTicketEntitiesVoList) {
......@@ -813,7 +827,6 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
}
vo.setOrderTicketEntitiesVo(kylinOrderTicketEntitiesVoList);
vo.setPerformanceVo(performanceVo);
vo.setTicketVo(ticketVo);
vo.setOrderTicketVo(orderTicketVo);
}
return vo;
......
......@@ -377,8 +377,8 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
KylinTicketStatus ticketStatus = ticketStatusMapper.selectOne(new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketItem.getTicketsId()));
int changeGeneral = ticketStatus.getTotalGeneral() - ticketItem.getTotalGeneral();
int changeExchange = ticketStatus.getTotalGeneral() - ticketItem.getTotalExchange();
dataUtils.changeSurplusGeneral(ticketItem.getTicketsId(),changeGeneral);
dataUtils.changeSurplusExchange(ticketItem.getTicketsId(),changeExchange);
dataUtils.changeSurplusGeneral(ticketItem.getTicketsId(), changeGeneral);
dataUtils.changeSurplusExchange(ticketItem.getTicketsId(), changeExchange);
}
//修改 mysql 库存
KylinTicketStatus inventory = new KylinTicketStatus();
......@@ -476,12 +476,8 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
, new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketRelationsItem.getTicketId()).eq("status", 7));
}
}
boolean performanceExists =
mongoTemplate.exists(Query.query(Criteria.where("performancesId").is(performancesId)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
if (!performanceExists) {
dataUtils.updatePerformanceMongo(performancesId);
}
//判断状态
dataUtils.updatePerformanceMongo(performancesId);
// 判断状态
performanceVoTask.performanceVoStatus(performancesId);
return ResponseDto.success("上线成功");
} catch (Exception e) {
......@@ -496,46 +492,21 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
KylinPerformanceStatus performanceStatusData = performanceStatusMapper.selectOne(new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
if (performanceStatusData.getStatus() != 6) {
if (performanceStatusData.getStatus() >= 3 && performanceStatusData.getStatus() != 4 && performanceStatusData.getStatus() != 7) {//未提审||被拒绝
LocalDateTime updatedAt = LocalDateTime.now();
KylinPerformanceStatus performanceStatus = new KylinPerformanceStatus();
performanceStatus.setStatus(7);
performanceStatus.setUpdatedAt(updatedAt);
performanceStatusMapper.update(performanceStatus
, new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
dataUtils.updatePerformanceMongo(performancesId);
return ResponseDto.success("下线成功");
}else{
return ResponseDto.failure(ErrorMapping.get(20111));
}
LocalDateTime updatedAt = LocalDateTime.now();
KylinPerformanceStatus performanceStatus = new KylinPerformanceStatus();
performanceStatus.setStatus(7);
performanceStatus.setUpdatedAt(updatedAt);
performanceStatusMapper.update(performanceStatus
, new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
//mongoVo 迁移 演出数据迁移
KylinPerformanceVo kylinPerformanceVo = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performancesId)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
KylinPerformanceIgnoreVo kylinPerformanceIgnoreVo = new KylinPerformanceIgnoreVo();
BeanUtils.copyProperties(kylinPerformanceVo, kylinPerformanceIgnoreVo);
kylinPerformanceIgnoreVo.setAppStatus(7);
mongoTemplate.remove(Query.query(Criteria.where("performancesId").is(performancesId)), KylinPerformanceIgnoreVo.class, KylinPerformanceIgnoreVo.class.getSimpleName());
mongoTemplate.insert(kylinPerformanceIgnoreVo, KylinPerformanceIgnoreVo.class.getSimpleName());
mongoTemplate.remove(Query.query(Criteria.where("performancesId").is(performancesId)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
List<KylinTicketTimesVo> kylinTicketTimesVoList = mongoTemplate.find(Query.query(Criteria.where("performanceId").is(performancesId)), KylinTicketTimesVo.class, KylinTicketTimesVo.class.getSimpleName());
for (KylinTicketTimesVo kylinTicketTimesVoItem : kylinTicketTimesVoList) {
//场次数据迁移
KylinTicketTimesIgnoreVo kylinTicketTimesIgnoreVo = new KylinTicketTimesIgnoreVo();
BeanUtils.copyProperties(kylinTicketTimesVoItem, kylinTicketTimesIgnoreVo);
mongoTemplate.remove(Query.query(Criteria.where("ticketTimesId").is(kylinTicketTimesVoItem.getTicketTimesId())), KylinTicketTimesIgnoreVo.class, KylinTicketTimesIgnoreVo.class.getSimpleName());
mongoTemplate.insert(kylinTicketTimesIgnoreVo, KylinTicketTimesIgnoreVo.class.getSimpleName());
mongoTemplate.remove(Query.query(Criteria.where("ticketTimesId").is(kylinTicketTimesVoItem.getTicketTimesId())), KylinTicketTimesVo.class, KylinTicketTimesVo.class.getSimpleName());
List<KylinTicketVo> kylinTicketVoList = mongoTemplate.find(Query.query(Criteria.where("timeId").is(kylinTicketTimesVoItem.getTicketTimesId())), KylinTicketVo.class, KylinTicketVo.class.getSimpleName());
for (KylinTicketVo kylinTicketVoItem : kylinTicketVoList) {
// 票 迁移
KylinTicketIgnoreVo kylinTicketIgnoreVo = new KylinTicketIgnoreVo();
BeanUtils.copyProperties(kylinTicketVoItem, kylinTicketIgnoreVo);
mongoTemplate.remove(Query.query(Criteria.where("ticketsId").is(kylinTicketVoItem.getTicketsId())), KylinTicketIgnoreVo.class, KylinTicketIgnoreVo.class.getSimpleName());
mongoTemplate.insert(kylinTicketIgnoreVo, KylinTicketIgnoreVo.class.getSimpleName());
mongoTemplate.remove(Query.query(Criteria.where("ticketsId").is(kylinTicketVoItem.getTicketsId())), KylinTicketVo.class, KylinTicketVo.class.getSimpleName());
}
}
return ResponseDto.success("下线成功");
} catch (Exception e) {
return ResponseDto.failure(ErrorMapping.get(20109));
}
......
......@@ -8,13 +8,12 @@ import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerVo;
import com.liquidnet.service.kylin.dto.param.TicketCreateParam;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketVo;
import com.liquidnet.service.kylin.dto.vo.ignore.KylinTicketIgnoreVo;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo;
import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.kylin.service.partner.IKylinTicketsPartnerService;
import com.liquidnet.service.kylin.utils.DataUtils;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
......@@ -66,6 +65,8 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
@Autowired
private KylinTicketRelationsMapper ticketRelationsMapper;
@Autowired
private DataUtils dataUtils;
@Override
public ResponseDto<KylinTicketPartnerVo> createTicketSummary(TicketCreateParam ticketCreateParam) {
......@@ -331,7 +332,7 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
}
@Override
public ResponseDto<String> onLine(String ticketsId) {
public ResponseDto<String> onLine(String ticketsId,String performancesId) {
try {
LocalDateTime updatedAt = LocalDateTime.now();
KylinTicketStatus ticketStatus = ticketStatusMapper.selectOne(new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketsId));
......@@ -339,36 +340,19 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
//mysql
KylinTicketStatus changeStatus = new KylinTicketStatus();
changeStatus.setUpdatedAt(updatedAt);
changeStatus.setStatus(6);
changeStatus.setStatus(9);
ticketStatusMapper.update(changeStatus, new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketsId));
// mongo 操作
KylinTicketStatus ticketStatusMySql = ticketStatusMapper.selectOne(new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketsId).between("status", 1, 10).ne("status", 7));
KylinTicketRelations ticketRelation = ticketRelationsMapper.selectOne(new UpdateWrapper<KylinTicketRelations>().eq("ticket_id", ticketsId));
KylinTickets tickets = ticketsMapper.selectOne(
new UpdateWrapper<KylinTickets>().eq("tickets_id", ticketsId)
);
HashMap<String,Object> map = new HashMap<>();
map.put("status",6);
map.put("status",9);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(KylinTicketPartnerVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("ticketsId").is(ticketsId)).getQueryObject(),
object
);
KylinTicketVo kylinTicketVo = new KylinTicketVo();
kylinTicketVo.setTimeId(ticketRelation.getTimesId());
kylinTicketVo.setTicket(tickets);
kylinTicketVo.setTicketStatus(ticketStatusMySql);
boolean ticketExists =
mongoTemplate.exists(Query.query(Criteria.where("ticketsId").is(kylinTicketVo.getTicketsId())), KylinTicketVo.class, KylinTicketVo.class.getSimpleName());
if (!ticketExists) {
mongoTemplate.insert(
kylinTicketVo, KylinTicketVo.class.getSimpleName()
);
}
dataUtils.updatePerformanceMongo(performancesId);
return ResponseDto.success("上线成功");
} else {
return ResponseDto.failure(ErrorMapping.get(20110));
......@@ -379,7 +363,7 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
}
@Override
public ResponseDto<String> outLine(String ticketsId) {
public ResponseDto<String> outLine(String ticketsId,String performancesId) {
try {
LocalDateTime updatedAt = LocalDateTime.now();
KylinTicketStatus ticketStatus = ticketStatusMapper.selectOne(new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketsId));
......@@ -398,13 +382,7 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
object
);
KylinTicketVo kylinTicketVoItem = mongoTemplate.findOne(Query.query(Criteria.where("ticketsId").is(ticketsId)), KylinTicketVo.class, KylinTicketVo.class.getSimpleName());
KylinTicketIgnoreVo kylinTicketIgnoreVo = new KylinTicketIgnoreVo();
BeanUtils.copyProperties(kylinTicketVoItem, kylinTicketIgnoreVo);
mongoTemplate.remove(Query.query(Criteria.where("ticketsId").is(kylinTicketVoItem.getTicketsId())), KylinTicketIgnoreVo.class, KylinTicketIgnoreVo.class.getSimpleName());
mongoTemplate.insert(kylinTicketIgnoreVo, KylinTicketIgnoreVo.class.getSimpleName());
mongoTemplate.remove(Query.query(Criteria.where("ticketsId").is(kylinTicketVoItem.getTicketsId())), KylinTicketVo.class, KylinTicketVo.class.getSimpleName());
dataUtils.updatePerformanceMongo(performancesId);
return ResponseDto.success("下线成功");
} else {
return ResponseDto.failure(ErrorMapping.get(20111));
......
......@@ -69,9 +69,9 @@ public class DataUtils {
* @return 普通剩余库存
*/
public int changeSurplusGeneral(String ticketId, int surplusGeneral) {
if(surplusGeneral>0) {
if (surplusGeneral > 0) {
return (int) redisUtil.incr(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_GENERAL, surplusGeneral);
}else{
} else {
return (int) redisUtil.decr(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_GENERAL, Math.abs(surplusGeneral));
}
}
......@@ -104,9 +104,9 @@ public class DataUtils {
* @return 兑换剩余库存
*/
public int changeSurplusExchange(String ticketId, int surplusExchange) {
if(surplusExchange>0) {
if (surplusExchange > 0) {
return (int) redisUtil.incr(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_EXCHANGE, surplusExchange);
}else{
} else {
return (int) redisUtil.decr(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_EXCHANGE, Math.abs(surplusExchange));
}
}
......@@ -126,21 +126,6 @@ public class DataUtils {
return (KylinPerformanceVo) redisUtil.get(KylinRedisConst.PERFORMANCES + performanceId);
}
/**
* 根据场次id 获取 场次vo 详情
*
* @param ticketTimeId
* @return
*/
public KylinTicketTimesVo getTicketTimesVo(String ticketTimeId) {
if (redisUtil.hasKey(KylinRedisConst.TIMES + ticketTimeId)) {
} else {
KylinTicketTimesVo ticketTimesData = mongoTemplate.findOne(Query.query(Criteria.where("ticketTimesId").is(ticketTimeId)), KylinTicketTimesVo.class, KylinTicketTimesVo.class.getSimpleName());
redisUtil.set(KylinRedisConst.TIMES+ticketTimeId, ticketTimesData);
}
return (KylinTicketTimesVo) redisUtil.get(KylinRedisConst.TIMES + ticketTimeId);
}
/**
* 根据票种id 获取 票种vo 详情
*
......@@ -209,7 +194,7 @@ public class DataUtils {
* @param bannerId
* @return
*/
public KylinBannersVo getBannersVo(String bannerId){
public KylinBannersVo getBannersVo(String bannerId) {
if (redisUtil.hasKey(KylinRedisConst.BANNERS + bannerId)) {
} else {
KylinBannersVo ticketData = mongoTemplate.findOne(Query.query(Criteria.where("bannersId").is(bannerId)), KylinBannersVo.class, KylinBannersVo.class.getSimpleName());
......@@ -220,6 +205,7 @@ public class DataUtils {
/**
* 删除 banner redis
*
* @param bannerId
*/
public void delBannersRedis(String bannerId) {
......@@ -228,10 +214,11 @@ public class DataUtils {
/**
* 获取 推荐演出vo
*
* @param recommendId
* @return
*/
public KylinPerformanceVo getPerformanceRecommendVo(String recommendId){
public KylinPerformanceVo getPerformanceRecommendVo(String recommendId) {
if (redisUtil.hasKey(KylinRedisConst.PERFORMANCES_RECOMMEND + recommendId)) {
} else {
KylinPerformanceVo ticketData = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(recommendId)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
......@@ -242,6 +229,7 @@ public class DataUtils {
/**
* 删除 推荐演出 redis
*
* @param recommendId
*/
public void delPerformanceRecommendRedis(String recommendId) {
......@@ -250,10 +238,11 @@ public class DataUtils {
/**
* 获取 验票账号 vo
*
* @param checkUserId
* @return
*/
public KylinCheckUserVo getCheckUserVo(String checkUserId){
public KylinCheckUserVo getCheckUserVo(String checkUserId) {
if (redisUtil.hasKey(KylinRedisConst.CHECK_USER + checkUserId)) {
} else {
KylinCheckUserVo ticketData = mongoTemplate.findOne(Query.query(Criteria.where("checkUserId").is(checkUserId)), KylinCheckUserVo.class, KylinCheckUserVo.class.getSimpleName());
......@@ -264,6 +253,7 @@ public class DataUtils {
/**
* 删除 验票账号 redis
*
* @param checkUserId
*/
public void delCheckUserRedis(String checkUserId) {
......@@ -272,10 +262,11 @@ public class DataUtils {
/**
* 获取 验票账号关系 vo
*
* @param checkUserId
* @return
*/
public KylinCheckUserPerformanceVo getCheckUserRelationVo(String checkUserId){
public KylinCheckUserPerformanceVo getCheckUserRelationVo(String checkUserId) {
if (redisUtil.hasKey(KylinRedisConst.CHECK_USER_RELATION + checkUserId)) {
} else {
KylinCheckUserPerformanceVo ticketData = mongoTemplate.findOne(Query.query(Criteria.where("checkUserId").is(checkUserId)), KylinCheckUserPerformanceVo.class, KylinCheckUserPerformanceVo.class.getSimpleName());
......@@ -286,6 +277,7 @@ public class DataUtils {
/**
* 删除 验票账号关系 vo
*
* @param checkUserId
*/
public void delCheckUserRelationRedis(String checkUserId) {
......@@ -294,27 +286,43 @@ public class DataUtils {
/**
* 获取入场须知
*
* @param enterInfoId
* @return
*/
public String getEnterInfo(String enterInfoId){
public String getEnterInfo(String enterInfoId) {
if (redisUtil.hasKey(KylinRedisConst.ENTER_INFO + enterInfoId)) {
} else {
return "入场须知";
return "入场须知";
}
return (String) redisUtil.get(KylinRedisConst.ENTER_INFO + enterInfoId);
}
public void updatePerformanceMongo(String performanceIds){
public void updatePerformanceMongo(String performanceIds) {
//查询 mysql 数据
KylinPerformanceVo vo = mongoVoUtils.combinePerformanceVoData(performanceIds);
//删除 mongo数据
mongoTemplate.remove(Query.query(Criteria.where("performancesId").is(performanceIds)),KylinPerformanceVo.class,KylinPerformanceVo.class.getSimpleName());
//新增 mongo数据
//删除redis
if (vo != null) {
try {
//删除 mongo数据
mongoTemplate.remove(Query.query(Criteria.where("performancesId").is(performanceIds)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
} catch (Exception e) {
e.printStackTrace();
}
try {
//新增 mongo数据
mongoTemplate.insert(vo, KylinPerformanceVo.class.getSimpleName());
} catch (Exception e) {
e.printStackTrace();
}
try {
//删除redis
redisUtil.del(KylinRedisConst.PERFORMANCES + performanceIds);
} catch (Exception e) {
e.printStackTrace();
}
} else {
System.out.println("创建Vo异常");
}
}
}
......@@ -21,4 +21,4 @@
</dependencies>
</project>
\ No newline at end of file
</project>
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