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

Commit 5efe06db authored by 胡佳晨's avatar 胡佳晨

提交 创建流程

parent 683ce408
......@@ -4,7 +4,9 @@ public class KylinRedisConst {
public static final String FIELDS = "kylin:fields:id";
public static final String PERFORMANCES = "kylin:performances:id";
public static final String PERFORMANCES_INVENTORY = "kylin:performances_inventory:id";
public static final String PERFORMANCES_INVENTORY = "kylin:performances_inventory:ticket:";
public static final String SURPLUS_GENERAL = "surplusGeneral";
public static final String SURPLUS_EXCHANGE = "surplusExchange";
public static final String TICKET = "kylin:ticket:id";
......
package com.liquidnet.service.kylin.dto.param;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.io.Serializable;
@Data
public class PerformanceParam implements Serializable {
@ApiModelProperty(value = "演出id", example = "")
@JsonIgnore
private String performancesId;
@ApiModelProperty(value = "封面图", example = "https://img.zhengzai.tv/partner/2019/05/14/5cda2d0520177.png")
private String imgPoster;
@ApiModelProperty(value = "演出名称", example = "测试演出")
private String title;
@ApiModelProperty(value = "演出类型 1音乐节 2演唱会 3小型演出 4展览 6舞台剧", example = "3")
private int type;
@ApiModelProperty(value = "演出开始时间", example = "2021-05-01 12:00:00")
private String timeStart;
@ApiModelProperty(value = "演出结束时间", example = "2021-05-04 12:00:00")
private String timeEnd;
@ApiModelProperty(value = "场地id", example = "1")
private String fieldId;
@ApiModelProperty(value = "场地id", example = "1")
private String fieldName;
@ApiModelProperty(value = "演出公告", example = "这是演出公告")
private String notice;
@ApiModelProperty(value = "主办方id", example = "1")
private String sponsorId;
@ApiModelProperty(value = "主办方类型", example = "1")
private String sponsorType;
@ApiModelProperty(value = "主办方名称", example = "主办方名称")
private String sponsor;
@ApiModelProperty(value = "联系人", example = "联系人")
private String contacts;
@ApiModelProperty(value = "联系方式", example = "手机号")
private String mobile;
@ApiModelProperty(value = "演出详情", example = "<p>演出详情</p>")
private String details;
@ApiModelProperty(value = "演出批文地址", example = "这是一个演出批文地址")
private String approvalUrl;
@ApiModelProperty(value = "待支付时间", example = "5")
private int payCountdownMinute;
@ApiModelProperty(value = "购票须知", example = "[{\"id\":1,\"title\":\"\\u95e8\\u7968\\u4e0d\\u9000\\u4e0d\\u6362\",\"type\":\"image\",\"url\":\"http:\\/\\/img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com\\/partner\\/2019\\/01\\/21\\/5c45722882a13.png\",\"text\":\"\\u95e8\\u7968\\u4e3a\\u6709\\u4ef7\\u8bc1\\u5238\\uff0c\\u5e76\\u975e\\u5546\\u54c1\\uff0c\\u4e00\\u7ecf\\u552e\\u51fa\\u4e0d\\u4e88\\u9000\\u6362\\u3002\\u56e0\\u201c\\u4e0d\\u53ef\\u6297\\u529b\\u201d\\u5bfc\\u81f4\\u7684\\u6f14\\u51fa\\u53d6\\u6d88\\u6216\\u5ef6\\u671f\\u9664\\u5916\\u3002\",\"sort\":1},{\"id\":3,\"title\":\"\\u4ec5\\u8bbe\\u7ad9\\u5e2d\",\"type\":\"image\",\"url\":\"http:\\/\\/img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com\\/partner\\/2019\\/01\\/21\\/5c456e93db0b9.png\",\"text\":\"\\u672c\\u573a\\u6f14\\u51fa\\u4e0d\\u8bbe\\u5ea7\\u4f4d\\uff0c\\u5747\\u4e3a\\u7ad9\\u5e2d\\u89c2\\u6f14\\u3002\",\"sort\":2},{\"id\":4,\"title\":\"\\u7981\\u6b62\\u4e2a\\u4eba\\u7968\\u52a1\\u4e70\\u5356\",\"type\":\"image\",\"url\":\"http:\\/\\/img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com\\/partner\\/2019\\/01\\/21\\/5c456e5c27644.png\",\"text\":\"\\u4e3a\\u9632\\u6b62\\u4e0d\\u6cd5\\u5206\\u5b50\\u5229\\u7528\\u7968\\u52a1\\u8f6c\\u8ba9\\u8bc8\\u9a97\\u94b1\\u6b3e\\uff0c\\u5efa\\u8bae\\u5e7f\\u5927\\u4e50\\u8ff7\\u4e0d\\u8981\\u8fdb\\u884c\\u4e2a\\u4eba\\u95f4\\u7968\\u52a1\\u4e70\\u5356\\uff0c\\u4e0d\\u8981\\u8f7b\\u6613\\u76f8\\u4fe1\\u6765\\u6e90\\u4e0d\\u660e\\u7684\\u8f6c\\u7968\\uff0c\\u4ee5\\u514d\\u81ea\\u8eab\\u5229\\u76ca\\u53d7\\u5230\\u4fb5\\u5bb3\\u3002\",\"sort\":3}]")
private String noticeImage;
@ApiModelProperty(value = "是否实名", example = "0")
private int isTrueName;
@ApiModelProperty(value = "限购数量 0为不限购", example = "0")
private int limitCount;
@ApiModelProperty(value = "是否提交 1提交 0不提交(不验证参数)", example = "0")
private int isSubmit;
@ApiModelProperty(value = "状态:-1删除;0未提交;1审核中;2审核中(自动上线);3审核通过;4审核未通过;6上线;7下架;8活动结束;9活动取消退款中;10活动取消退", example = "0")
private int status;
@ApiModelProperty(value = "第三方id", example = "0")
private String merchantId;
@ApiModelProperty(value = "演出简介", example = "0")
private String describes;
@ApiModelProperty(value = "是否售卖", example = "0")
private int statusSell;
@ApiModelProperty(value = "巡演id", example = "0",hidden = true)
private String roadShowId;
@ApiModelProperty(value = "搭售id", example = "0",hidden = true)
private String projectId;
@ApiModelProperty(value = "", example = "")
private String createdAt;
@ApiModelProperty(value = "", example = "")
private String updatedAt;
@ApiModelProperty(value = "是否保存", example = "")
private int isCreateSave;
}
......@@ -10,7 +10,6 @@ import java.io.Serializable;
public class PerformanceStep1Param implements Serializable {
@ApiModelProperty(value = "演出id", example = "")
@JsonIgnore
private String performancesId;
@ApiModelProperty(value = "封面图", example = "https://img.zhengzai.tv/partner/2019/05/14/5cda2d0520177.png")
......
package com.liquidnet.service.kylin.dto.vo.partner;
import com.liquidnet.service.kylin.dto.param.PerformanceCreateParam;
import com.liquidnet.service.kylin.dto.param.PerformanceParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class PerformancePartnerListVo {
......@@ -36,7 +34,7 @@ public class PerformancePartnerListVo {
private String createdAt;
@ApiModelProperty(value = "返回数据赋值",hidden = true)
public void setStatus0Data(PerformanceCreateParam item){
public void setStatus0Data(PerformanceParam item){
this.performancesId=item.getPerformancesId();
this.title=item.getTitle();
this.timeStart=item.getTimeStart();
......
package com.liquidnet.service.kylin.dto.param;
package com.liquidnet.service.kylin.dto.vo.partner;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.io.Serializable;
@Data
public class PerformanceCreateParam implements Serializable {
public class PerformancePartnerVo implements Serializable {
@ApiModelProperty(value = "演出id", example = "")
@JsonIgnore
......@@ -94,4 +93,7 @@ public class PerformanceCreateParam implements Serializable {
@ApiModelProperty(value = "", example = "")
private String createdAt;
@ApiModelProperty(value = "是否保存", example = "")
private int isCreateSave;
}
......@@ -12,7 +12,7 @@ import java.math.BigDecimal;
* 修改场地全部显示数据参数
*/
@Data
public class TicketCreatePartnerVo implements Serializable {
public class TicketPartnerVo implements Serializable {
@ApiModelProperty(value = "主键")
private String ticketsId;
......@@ -62,7 +62,7 @@ public class TicketCreatePartnerVo implements Serializable {
private String describes;
@ApiModelProperty(value = "票状态 -1删除;0未提交;1审核中;2审核中(自动在售);3审核通过;4审核未通过;6在售;7停售;8售罄;9未开始;10已结束", example = "0")
private int status;
private Integer status;
@ApiModelProperty(value = "是否展示二维码 0否 1是", example = "0")
private int isShowCode;
......
......@@ -8,7 +8,7 @@ import java.io.Serializable;
//返回
@Data
public class TicketTimesCreatePartnerVo implements Serializable {
public class TicketTimesPartnerVo implements Serializable {
@ApiModelProperty(value = "主键id")
private String ticketTimesId;
......@@ -24,8 +24,8 @@ public class TicketTimesCreatePartnerVo implements Serializable {
@ApiModelProperty(value = "场次适用结束时间")
private String useEnd;
@ApiModelProperty(value = "状态 0不可见 1可见")
private int status;
@ApiModelProperty(value = "状态 -1新增 0不可见 1可见")
private Integer status;
@ApiModelProperty(value = "状态 1单日票 2通票")
private int type;
......
......@@ -39,5 +39,5 @@ public class TicketTimesTicketCreatePartnerVo implements Serializable {
//票
@ApiModelProperty(value = "票数据")
private List<TicketCreatePartnerVo> ticket;
private List<TicketPartnerVo> ticket;
}
......@@ -3,11 +3,9 @@ package com.liquidnet.service.kylin.service.admin;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.kylin.dao.PerformanceAdminListDao;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dao.PerformanceTitleDao;
import com.liquidnet.service.kylin.dto.param.PerformanceAdminListParam;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam;
import com.liquidnet.service.kylin.dto.vo.partner.PerformanceCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.PerformanceMisVo;
import com.liquidnet.service.kylin.entity.KylinPerformances;
import java.util.List;
......@@ -22,7 +20,11 @@ import java.util.List;
*/
public interface IKylinPerformancesAdminService extends IService<KylinPerformances> {
PerformanceCreatePartnerVo performanceDetails(String performancesId);
PerformanceMisVo performanceDetails(String performancesId);
PerformanceMisVo performanceCreateDetails(String performancesId);
PerformanceMisVo performanceUpdateDetails(String performancesId);
boolean performanceAudit(String performancesId,int status ,String rejectTxt);
......
......@@ -3,10 +3,8 @@ package com.liquidnet.service.kylin.service.partner;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dto.param.PerformanceCreateParam;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam;
import com.liquidnet.service.kylin.dto.param.PerformanceStep1Param;
import com.liquidnet.service.kylin.dto.param.PerformanceStep2Param;
import com.liquidnet.service.kylin.dto.param.*;
import com.liquidnet.service.kylin.dto.vo.partner.PerformancePartnerVo;
import com.liquidnet.service.kylin.entity.KylinPerformances;
/**
......@@ -19,14 +17,76 @@ import com.liquidnet.service.kylin.entity.KylinPerformances;
*/
public interface IKylinPerformancesPartnerService extends IService<KylinPerformances> {
/**
* 演出第一步
* @param step1Param
* @return
*/
String step1(PerformanceStep1Param step1Param);
/**
* 创建演出第一步
* @param step1Param
* @return
*/
String createStep1(PerformanceStep1Param step1Param);
boolean createStep2(PerformanceStep2Param step1Param);
/**
* 修改演出第一步
* @param step1Param
* @return
*/
String updateStep1(PerformanceStep1Param step1Param);
/**
* 获取演出第一步数据
* @param performancesId
* @return
*/
PerformancePartnerVo getStep1(String performancesId);
/**
* 获取创建演出第一步数据
* @param performancesId
* @return
*/
PerformanceParam getCreateStep1(String performancesId);
/**
* 获取修改演出第一步数据
* @param performancesId
* @return
*/
PerformanceParam getUpdateStep1(String performancesId);
PerformanceCreateParam getStep1(String performancesId);
/**
* 演出第二步
* @param step2Param
* @return
*/
boolean step2(PerformanceStep2Param step2Param);
/**
* 演出第二步创建
* @param step2Param
* @return
*/
boolean createStep2(PerformanceStep2Param step2Param);
/**
* 演出第二步修改
* @param step2Param
* @return
*/
boolean updateStep2(PerformanceStep2Param step2Param);
PerformanceStep2Param getStep2(String performancesId);
PerformanceStep2Param getCreateStep2(String performancesId);
PerformanceStep2Param getUpdateStep2(String performancesId);
boolean onLinePerformance(String performancesId);
boolean outLinePerformance(String performancesId);
......
......@@ -2,7 +2,7 @@ package com.liquidnet.service.kylin.service.partner;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liquidnet.service.kylin.dto.param.CreateTicketTimesParam;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesPartnerVo;
import com.liquidnet.service.kylin.entity.KylinTicketTimes;
import java.util.List;
......@@ -17,13 +17,38 @@ import java.util.List;
*/
public interface IKylinTicketTimesPartnerService extends IService<KylinTicketTimes> {
TicketTimesCreatePartnerVo createTimes(CreateTicketTimesParam createTicketTimesParam);
/**
* 创建场次汇总
* @param createTicketTimesParam
* @return
*/
TicketTimesPartnerVo createTimesSummary(CreateTicketTimesParam createTicketTimesParam);
/**
* 未通过审核创建场次
* @param createTicketTimesParam
* @return
*/
TicketTimesPartnerVo createTimes(CreateTicketTimesParam createTicketTimesParam);
/**
* 通过审核后创建场次
* @param createTicketTimesParam
* @return
*/
TicketTimesPartnerVo addNewTimes(CreateTicketTimesParam createTicketTimesParam);
/**
* 删除 场次(只有未审核通过可删除)
* @param ticketTimesId
* @return
*/
Boolean deleteTimes(String ticketTimesId);
TicketTimesCreatePartnerVo changeTimes(CreateTicketTimesParam createTicketTimesParam);
TicketTimesPartnerVo changeTimes(CreateTicketTimesParam createTicketTimesParam);
List<TicketTimesCreatePartnerVo> getTimesMongoList(String performancesId);
List<TicketTimesPartnerVo> getTimesMongoList(String performancesId);
TicketTimesCreatePartnerVo getTimesMongo(String timesId);
TicketTimesPartnerVo getTimesMongo(String timesId);
}
......@@ -2,7 +2,7 @@ package com.liquidnet.service.kylin.service.partner;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liquidnet.service.kylin.dto.param.TicketCreateParam;
import com.liquidnet.service.kylin.dto.vo.partner.TicketCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketPartnerVo;
import com.liquidnet.service.kylin.entity.KylinTickets;
import java.util.List;
......@@ -17,17 +17,41 @@ import java.util.List;
*/
public interface IKylinTicketsPartnerService extends IService<KylinTickets> {
TicketCreatePartnerVo createTicket(TicketCreateParam ticketCreateParam);
/**
* 创建票汇总
* @param ticketCreateParam
* @return
*/
TicketPartnerVo createTicketSummary(TicketCreateParam ticketCreateParam);
/**
* 未通过审核创建票
* @param ticketCreateParam
* @return
*/
TicketPartnerVo createTicket(TicketCreateParam ticketCreateParam);
TicketCreatePartnerVo updateTicket(TicketCreateParam ticketCreateParam);
/**
* 通过审核后创建场次
* @param ticketCreateParam
* @return
*/
TicketPartnerVo addNewTicket(TicketCreateParam ticketCreateParam);
TicketPartnerVo updateTicket(TicketCreateParam ticketCreateParam);
/**
* 删除 票(只有未审核通过可删除)
* @param ticketsId
* @return
*/
boolean deleteTicket(String ticketsId);
TicketCreatePartnerVo copyTicket(String ticketsId);
TicketPartnerVo copyTicket(String ticketsId);
boolean submitTicketByTimes(String timesId);
List<TicketCreatePartnerVo> getTicketMongoList(String timesId);
List<TicketPartnerVo> getTicketMongoList(String timesId);
TicketCreatePartnerVo getTicketsMongo(String ticketsId);
TicketPartnerVo getTicketsMongo(String ticketsId);
}
......@@ -279,7 +279,7 @@ CREATE TABLE `kylin_ticket_status`
`is_student` tinyint NOT NULL DEFAULT 0 COMMENT '是否学生票 0否 1是',
`is_electronic` tinyint NOT NULL DEFAULT 0 COMMENT '是否电子票 0否 1是',
`is_express` tinyint NOT NULL DEFAULT 0 COMMENT '是否快递票 0否 1是',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '票状态 -1删除;0未提交;1审核中;2审核中(自动在售);3审核通过;4审核未通过;6在售;7停售;8售罄;9未开始;10已结束',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '票状态 -2新建 -1删除;0未提交;1审核中;2审核中(自动在售);3审核通过;4审核未通过;6在售;7停售;8售罄;9未开始;10已结束',
`counts` int(11) NOT NULL DEFAULT 1 COMMENT '可验证次数',
`status_exchange` tinyint NOT NULL DEFAULT 0 COMMENT '兑换状态 6可兑换 7不可兑换',
`is_show_code` tinyint NOT NULL DEFAULT 0 COMMENT '是否显示二维码 0否 1是',
......
......@@ -4,11 +4,9 @@ package com.liquidnet.service.kylin.controller.admin;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.ResponseDto;
import com.liquidnet.service.kylin.dao.PerformanceAdminListDao;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dao.PerformanceTitleDao;
import com.liquidnet.service.kylin.dto.param.PerformanceAdminListParam;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam;
import com.liquidnet.service.kylin.dto.vo.partner.PerformanceCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.PerformanceMisVo;
import com.liquidnet.service.kylin.service.impl.admin.KylinPerformancesAdminServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -49,9 +47,9 @@ public class KylinPerformancesAdminController {
@GetMapping(value = "details")
@ApiOperation(value = "获取演出详情")
@ApiResponse(response = PerformanceCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<PerformanceCreatePartnerVo> performanceDetails(@RequestParam("performancesId") String performancesId) {
PerformanceCreatePartnerVo result = null;
@ApiResponse(response = PerformanceMisVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<PerformanceMisVo> performanceDetails(@RequestParam("performancesId") String performancesId) {
PerformanceMisVo result = null;
result = performancesAdminService.performanceDetails(performancesId);
if (null != result) {
return ResponseDto.success(result);
......
......@@ -3,7 +3,7 @@ package com.liquidnet.service.kylin.controller.partner;
import com.liquidnet.service.ResponseDto;
import com.liquidnet.service.kylin.dto.param.CreateTicketTimesParam;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesPartnerVo;
import com.liquidnet.service.kylin.service.impl.partner.KylinTicketTimesPartnerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -29,10 +29,10 @@ public class KylinTicketTimesPartnerController {
@PostMapping(value = "")
@ApiOperation(value = "创建场次")
@ApiResponse(response = TicketTimesCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketTimesCreatePartnerVo> createTimes(@RequestBody CreateTicketTimesParam createTicketTimesParam) {
TicketTimesCreatePartnerVo result = null;
result = ticketTimesPartnerService.createTimes(createTicketTimesParam);
@ApiResponse(response = TicketTimesPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketTimesPartnerVo> createTimes(@RequestBody CreateTicketTimesParam createTicketTimesParam) {
TicketTimesPartnerVo result = null;
result = ticketTimesPartnerService.createTimesSummary(createTicketTimesParam);
if (null == result) {
return ResponseDto.failure("创建失败");
} else {
......@@ -42,7 +42,7 @@ public class KylinTicketTimesPartnerController {
@DeleteMapping(value = "")
@ApiOperation(value = "删除场次")
@ApiResponse(response = TicketTimesCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
@ApiResponse(response = TicketTimesPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<String> deleteTimes(@RequestParam("ticketTimesId") String ticketTimesId) {
boolean result = ticketTimesPartnerService.deleteTimes(ticketTimesId);
if (result) {
......@@ -54,9 +54,9 @@ public class KylinTicketTimesPartnerController {
@PutMapping(value = "")
@ApiOperation(value = "修改场次")
@ApiResponse(response = TicketTimesCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketTimesCreatePartnerVo> deleteTimes(@RequestBody CreateTicketTimesParam createTicketTimesParam) {
TicketTimesCreatePartnerVo result = null;
@ApiResponse(response = TicketTimesPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketTimesPartnerVo> deleteTimes(@RequestBody CreateTicketTimesParam createTicketTimesParam) {
TicketTimesPartnerVo result = null;
result = ticketTimesPartnerService.changeTimes(createTicketTimesParam);
if (null == result) {
return ResponseDto.failure("修改失败");
......@@ -67,9 +67,9 @@ public class KylinTicketTimesPartnerController {
@GetMapping(value = "/details")
@ApiOperation(value = "获取场次详情")
@ApiResponse(response = TicketTimesCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketTimesCreatePartnerVo> getTimesMongo(@RequestParam("ticketTimesId") String ticketTimesId) {
TicketTimesCreatePartnerVo result = null;
@ApiResponse(response = TicketTimesPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketTimesPartnerVo> getTimesMongo(@RequestParam("ticketTimesId") String ticketTimesId) {
TicketTimesPartnerVo result = null;
result = ticketTimesPartnerService.getTimesMongo(ticketTimesId);
if (null == result) {
return ResponseDto.failure("查询场次信息失败");
......
......@@ -3,7 +3,7 @@ package com.liquidnet.service.kylin.controller.partner;
import com.liquidnet.service.ResponseDto;
import com.liquidnet.service.kylin.dto.param.TicketCreateParam;
import com.liquidnet.service.kylin.dto.vo.partner.TicketCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketPartnerVo;
import com.liquidnet.service.kylin.service.impl.partner.KylinTicketsPartnerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -29,10 +29,10 @@ public class KylinTicketsPartnerController {
@PostMapping(value = "")
@ApiOperation(value = "创建票务")
@ApiResponse(response = TicketCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketCreatePartnerVo> createTicket(@RequestBody TicketCreateParam ticketCreateParam) {
TicketCreatePartnerVo result = null;
result = ticketsPartnerService.createTicket(ticketCreateParam);
@ApiResponse(response = TicketPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketPartnerVo> createTicket(@RequestBody TicketCreateParam ticketCreateParam) {
TicketPartnerVo result = null;
result = ticketsPartnerService.createTicketSummary(ticketCreateParam);
if (null == result) {
return ResponseDto.failure("创建票务失败");
} else {
......@@ -42,9 +42,9 @@ public class KylinTicketsPartnerController {
@PutMapping(value = "")
@ApiOperation(value = "修改票务")
@ApiResponse(response = TicketCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketCreatePartnerVo> updateTicket(@RequestBody TicketCreateParam ticketCreateParam) {
TicketCreatePartnerVo result = null;
@ApiResponse(response = TicketPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketPartnerVo> updateTicket(@RequestBody TicketCreateParam ticketCreateParam) {
TicketPartnerVo result = null;
result = ticketsPartnerService.updateTicket(ticketCreateParam);
if (null == result) {
return ResponseDto.failure("修改票务失败");
......@@ -67,9 +67,9 @@ public class KylinTicketsPartnerController {
@PostMapping(value = "/copy")
@ApiOperation(value = "复制票务")
@ApiResponse(response = TicketCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketCreatePartnerVo> copyTicket(@RequestParam("ticketsId") String ticketsId) {
TicketCreatePartnerVo result = null;
@ApiResponse(response = TicketPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketPartnerVo> copyTicket(@RequestParam("ticketsId") String ticketsId) {
TicketPartnerVo result = null;
result = ticketsPartnerService.copyTicket(ticketsId);
if (null == result) {
return ResponseDto.failure("复制票务失败");
......@@ -80,9 +80,9 @@ public class KylinTicketsPartnerController {
@GetMapping(value = "/details")
@ApiOperation(value = "获取票务详情")
@ApiResponse(response = TicketCreatePartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketCreatePartnerVo> getTicketsMongo(@RequestParam("ticketsId") String ticketsId) {
TicketCreatePartnerVo result = null;
@ApiResponse(response = TicketPartnerVo.class, code = 200, message = "接口返回对象参数")
public ResponseDto<TicketPartnerVo> getTicketsMongo(@RequestParam("ticketsId") String ticketsId) {
TicketPartnerVo result = null;
result = ticketsPartnerService.getTicketsMongo(ticketsId);
if (null == result) {
return ResponseDto.failure("查询票务信息失败");
......
......@@ -3,10 +3,8 @@ package com.liquidnet.service.kylin.controller.partner;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.ResponseDto;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dto.param.PerformanceCreateParam;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam;
import com.liquidnet.service.kylin.dto.param.PerformanceStep1Param;
import com.liquidnet.service.kylin.dto.param.PerformanceStep2Param;
import com.liquidnet.service.kylin.dto.param.*;
import com.liquidnet.service.kylin.dto.vo.partner.PerformancePartnerVo;
import com.liquidnet.service.kylin.service.impl.partner.KylinPerformancesPartnerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -35,23 +33,36 @@ public class PerformancePartnerController {
}
}
@GetMapping(value = "step1")
@ApiOperation(value = "获取演出第一步数据")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PerformancePartnerVo> getStep1(@RequestParam("performancesId") String performancesId) {
PerformancePartnerVo result = performancesPartnerService.getStep1(performancesId);
if (result == null) {
return ResponseDto.failure("获取数据失败");
} else {
return ResponseDto.success(result);
}
}
@PostMapping(value = "step1")
@ApiOperation(value = "创建演出第一步")
@ApiOperation(value = "操作演出第一步")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> createStep1(@RequestBody PerformanceStep1Param performanceStep1Param) {
String result = performancesPartnerService.createStep1(performanceStep1Param);
public ResponseDto<String> Step1(@RequestBody PerformanceStep1Param performanceStep1Param) {
String result = performancesPartnerService.step1(performanceStep1Param);
if (result.isEmpty()) {
return ResponseDto.failure("创建失败");
return ResponseDto.failure("操作失败");
} else {
return ResponseDto.success(result);
}
}
@PostMapping(value = "step2")
@ApiOperation(value = "创建演出第二步")
@ApiOperation(value = "操作演出第二步")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> createStep2(@RequestBody PerformanceStep2Param performanceStep2Param) {
boolean result = performancesPartnerService.createStep2(performanceStep2Param);
public ResponseDto<String> step2(@RequestBody PerformanceStep2Param performanceStep2Param) {
boolean result = performancesPartnerService.step2(performanceStep2Param);
if (!result) {
return ResponseDto.failure("提交失败");
} else {
......@@ -59,22 +70,10 @@ public class PerformancePartnerController {
}
}
@GetMapping(value = "step1")
@ApiOperation(value = "获取演出第一步数据")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PerformanceCreateParam> createStep1(@RequestParam("performancesId") String performancesId) {
PerformanceCreateParam result = performancesPartnerService.getStep1(performancesId);
if (result==null) {
return ResponseDto.failure("获取数据失败");
} else {
return ResponseDto.success(result);
}
}
@GetMapping(value = "step2")
@ApiOperation(value = "获取演出第二步数据")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PerformanceStep2Param> createStep2(@RequestParam("performancesId") String performancesId) {
public ResponseDto<PerformanceStep2Param> getStep2(@RequestParam("performancesId") String performancesId) {
PerformanceStep2Param result = performancesPartnerService.getStep2(performancesId);
if (result == null) {
return ResponseDto.failure("获取数据失败");
......
......@@ -6,20 +6,15 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dao.PerformanceAdminListDao;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dao.PerformanceTitleDao;
import com.liquidnet.service.kylin.dto.param.PerformanceAdminListParam;
import com.liquidnet.service.kylin.dto.param.PerformanceCreateParam;
import com.liquidnet.service.kylin.dto.vo.PerformanceVo;
import com.liquidnet.service.kylin.dto.vo.partner.PerformanceCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesTicketCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.PerformanceMisVo;
import com.liquidnet.service.kylin.dto.vo.partner.PerformancePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesPartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketPartnerVo;
import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.kylin.service.admin.IKylinPerformancesAdminService;
......@@ -29,8 +24,8 @@ import com.liquidnet.service.kylin.timerTask.PerformanceVoTask;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter;
......@@ -38,8 +33,6 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
......@@ -53,6 +46,7 @@ import java.util.*;
* @since 2021-05-05
*/
@Service
@Slf4j
public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerformancesMapper, KylinPerformances> implements IKylinPerformancesAdminService {
@Autowired
......@@ -98,15 +92,32 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
private KylinTicketsPartnerServiceImpl ticketsPartnerService;
@Override
public PerformanceCreatePartnerVo performanceDetails(String performancesId) {
public PerformanceMisVo performanceDetails(String performancesId) {
PerformanceMisVo createMisVo = performanceUpdateDetails(performancesId);
if (createMisVo == null) {
createMisVo = performanceCreateDetails(performancesId);
}
log.info(" PERFORMANCE mis演出详情");
return createMisVo;
}
@Override
public PerformanceMisVo performanceCreateDetails(String performancesId) {
return mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)),
PerformanceCreatePartnerVo.class,
PerformanceCreatePartnerVo.class.getSimpleName()
PerformanceMisVo.class,
PerformanceMisVo.class.getSimpleName()
);
}
@Override
public PerformanceMisVo performanceUpdateDetails(String performancesId) {
return mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)),
PerformanceMisVo.class,
PerformanceMisVo.class.getSimpleName());
}
@Override
public boolean performanceAudit(String performancesId, int status, String rejectTxt) {
try {
......@@ -114,6 +125,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
HashMap<String, Object> map = new HashMap<>();
int auditStatus = 0;
if (status == 3) {
log.info(" PERFORMANCE 演出审核 通过");
rejectTxt = "";
auditStatus = 1;
//修改演出
......@@ -122,25 +134,15 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
map.put("auditStatus", auditStatus);
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
BasicDBObject objectPerformanceVo = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformanceCreatePartnerVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
objectPerformanceVo
);
} else if (status == 4) {
auditStatus = 2;
map.put("rejectTxt", rejectTxt);
map.put("auditStatus", auditStatus);
map.put("status", status);
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformanceCreatePartnerVo.class.getSimpleName()).updateOne(
Document doc = mongoTemplate.getCollection(PerformanceMisVo.class.getSimpleName()).findOneAndUpdate(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object
objectPerformanceVo,
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
} else {
return false;
}
KylinPerformanceStatus sqlStatus = performanceStatusMapper.selectOne(new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
if (sqlStatus.getStatus() == 1) {
log.info(" PERFORMANCE 演出审核 第一次");
//修改
KylinPerformanceStatus performanceStatus = new KylinPerformanceStatus();
performanceStatus.setStatus(status);
......@@ -152,11 +154,11 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
performances.setRejectTxt(rejectTxt);
performancesMapper.update(performances, new UpdateWrapper<KylinPerformances>().eq("performances_id", performancesId));
List<TicketTimesCreatePartnerVo> ticketTimesCreatePartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
for (TicketTimesCreatePartnerVo ticketTimeItem : ticketTimesCreatePartnerVos) {
for (TicketCreatePartnerVo ticketItem : ticketsPartnerService.getTicketMongoList(ticketTimeItem.getTicketTimesId())) {
List<TicketTimesPartnerVo> ticketTimesPartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
for (TicketTimesPartnerVo ticketTimeItem : ticketTimesPartnerVos) {
for (TicketPartnerVo ticketItem : ticketsPartnerService.getTicketMongoList(ticketTimeItem.getTicketTimesId())) {
BasicDBObject objectTicketVo = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(TicketCreatePartnerVo.class.getSimpleName()).updateOne(
mongoTemplate.getCollection(TicketPartnerVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("ticketsId").is(ticketItem.getTicketsId())).getQueryObject(),
objectTicketVo
);
......@@ -169,6 +171,36 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
ticketStatusMapper.update(ticketStatus, new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketItem.getTicketsId()));
}
}
} else { //只修改演出相关 场次 票 (不包括 库存 售卖时间 限购)
log.info(" PERFORMANCE 演出审核 修改");
HashMap<String, Object> mapSql = new HashMap<>();
mapSql.put("status", 9);
mapSql.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performanceVoTask.updatePerformanceMySql(performancesId, mapSql, JsonUtils.fromJson(doc.toJson(), PerformanceMisVo.class), updatedAt);
if (sqlStatus.getStatus() == 6) {//若 演出上 则 线判断状态
performanceVoTask.performanceVoStatus(performancesId);
}
}
} else if (status == 4) {
log.info(" PERFORMANCE 演出审核 拒绝");
auditStatus = 2;
map.put("rejectTxt", rejectTxt);
map.put("auditStatus", auditStatus);
map.put("status", status);
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformancePartnerVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object
);
mongoTemplate.getCollection(PerformanceMisVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object
);
} else {
return false;
}
return true;
} catch (Exception e) {
System.out.println("ERROR DATA = " + e.getMessage());
......
......@@ -10,10 +10,7 @@ import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dto.TicketInventoryDto;
import com.liquidnet.service.kylin.dto.param.PerformanceCreateParam;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam;
import com.liquidnet.service.kylin.dto.param.PerformanceStep1Param;
import com.liquidnet.service.kylin.dto.param.PerformanceStep2Param;
import com.liquidnet.service.kylin.dto.param.*;
import com.liquidnet.service.kylin.dto.vo.PerformanceVo;
import com.liquidnet.service.kylin.dto.vo.TicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.TicketVo;
......@@ -26,6 +23,7 @@ import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.kylin.service.partner.IKylinPerformancesPartnerService;
import com.liquidnet.service.kylin.timerTask.PerformanceVoTask;
import com.mongodb.BasicDBObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
......@@ -54,6 +52,7 @@ import java.util.Map;
* @since 2021-05-05
*/
@Service
@Slf4j
public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerformancesMapper, KylinPerformances> implements IKylinPerformancesPartnerService {
@Autowired
......@@ -98,6 +97,26 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
@Autowired
private KylinTicketTimesPartnerServiceImpl ticketTimesPartnerService;
@Override
public String step1(PerformanceStep1Param step1Param) {
String result = null;
// 无 performancesId 则 创建
if (null == step1Param.getPerformancesId()) {
result = createStep1(step1Param);
log.info(" PERFORMANCE 演出第一步 创建");
} else { // 获取 create 数据 status = 0 或 无数据 创建
PerformanceParam createParam = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(step1Param.getPerformancesId())), PerformanceParam.class, PerformanceParam.class.getSimpleName());
if (createParam == null) {
result = createStep1(step1Param);
log.info(" PERFORMANCE 演出第一步 创建");
} else {// 修改
result = updateStep1(step1Param);
log.info(" PERFORMANCE 演出第一步 修改");
}
}
return result;
}
@Override
public String createStep1(PerformanceStep1Param step1Param) {
// 获取 主键id
......@@ -106,20 +125,19 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
LocalDateTime createdAt = LocalDateTime.now();
try {
step1Param.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
step1Param.setPerformancesId(performanceId);
PerformanceCreateParam performanceCreateParam = new PerformanceCreateParam();
BeanUtils.copyProperties(step1Param, performanceCreateParam);
performanceCreateParam.setIsTrueName(0);
performanceCreateParam.setLimitCount(0);
performanceCreateParam.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performanceCreateParam.setIsSubmit(0);
performanceCreateParam.setStatus(0);
performanceCreateParam.setStatusSell(1);
performanceCreateParam.setRoadShowId("0");
performanceCreateParam.setProjectId("0");
PerformanceParam performanceParam = new PerformanceParam();
BeanUtils.copyProperties(step1Param, performanceParam);
performanceParam.setIsTrueName(0);
performanceParam.setLimitCount(0);
performanceParam.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performanceParam.setIsSubmit(0);
performanceParam.setStatus(0);
performanceParam.setStatusSell(1);
performanceParam.setRoadShowId("0");
performanceParam.setProjectId("0");
mongoTemplate.insert(
performanceCreateParam, PerformanceCreateParam.class.getSimpleName()
performanceParam, PerformanceParam.class.getSimpleName()
);
return performanceId;
......@@ -128,6 +146,100 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
}
}
@Override
public String updateStep1(PerformanceStep1Param step1Param) {
// 获取 当前时间 -> 创建时间
LocalDateTime timeNow = LocalDateTime.now();
String performanceId = step1Param.getPerformancesId();
try {
step1Param.setPerformancesId(performanceId);
PerformanceParam performanceParam = new PerformanceParam();
BeanUtils.copyProperties(step1Param, performanceParam);
performanceParam.setCreatedAt(timeNow.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performanceParam.setUpdatedAt(timeNow.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performanceParam.setIsSubmit(0);
performanceParam.setStatus(0);
PerformanceParam data = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performanceId)),
PerformanceParam.class, PerformanceParam.class.getSimpleName());
if (data != null) { // 有修改记录
performanceParam.setIsTrueName(data.getIsTrueName());
performanceParam.setLimitCount(data.getLimitCount());
performanceParam.setStatusSell(data.getStatusSell());
performanceParam.setRoadShowId(data.getRoadShowId());
performanceParam.setProjectId(data.getProjectId());
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(performanceParam));
mongoTemplate.getCollection(PerformanceParam.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performanceId)).getQueryObject(),
object
);
} else { // 无修改记录
KylinPerformanceStatus statusData = performanceStatusMapper.selectOne(new UpdateWrapper<KylinPerformanceStatus>().eq("performanceId", performanceId));
KylinPerformanceRelations relationsData = performanceRelationsMapper.selectOne(new UpdateWrapper<KylinPerformanceRelations>().eq("performancesId", performanceId));
performanceParam.setIsTrueName(statusData.getIsTrueName());
performanceParam.setLimitCount(statusData.getLimitCount());
performanceParam.setStatusSell(statusData.getStatusSell());
performanceParam.setRoadShowId(relationsData.getRoadShowId());
performanceParam.setProjectId(relationsData.getProjectId());
mongoTemplate.insert(
performanceParam, PerformanceParam.class.getSimpleName()
);
}
return performanceId;
} catch (Exception e) {
return "";
}
}
@Override
public PerformancePartnerVo getStep1(String performancesId) {
PerformancePartnerVo performancePartnerVo = new PerformancePartnerVo();
PerformanceParam updateData = getUpdateStep1(performancesId);
BeanUtils.copyProperties(updateData, performancePartnerVo);
log.info(" PERFORMANCE 演出第一步 获取");
return performancePartnerVo;
}
@Override
public PerformanceParam getCreateStep1(String performancesId) {
PerformanceParam data = mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceParam.class, PerformanceParam.class.getSimpleName()
);
if (data == null) {
return new PerformanceParam();
}
return data;
}
@Override
public PerformanceParam getUpdateStep1(String performancesId) {
PerformanceParam data = mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceParam.class, PerformanceParam.class.getSimpleName()
);
if (data == null) {
return new PerformanceParam();
}
return data;
}
@Override
public boolean step2(PerformanceStep2Param step2Param) {
boolean result = false;
// 无 performancesId 则 创建
if (step2Param.getPerformancesId().isEmpty()) {
} else { // 获取 create 数据 status = 0 或 无数据 创建
KylinPerformanceStatus performanceStatus = performanceStatusMapper.selectOne(new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", step2Param.getPerformancesId()));
if (performanceStatus == null || performanceStatus.getStatus() == 0) {
result = createStep2(step2Param);
log.info(" PERFORMANCE 演出第二步 创建");
} else if (performanceStatus.getStatus() == 1 || performanceStatus.getStatus() == 3 || performanceStatus.getStatus() == 6 || performanceStatus.getStatus() == 7) {// 修改
result = updateStep2(step2Param);
log.info(" PERFORMANCE 演出第二步 修改");
}
}
return result;
}
@Override
public boolean createStep2(PerformanceStep2Param step2Param) {
......@@ -137,8 +249,8 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
LocalDateTime createdAt = LocalDateTime.now();
boolean isExistsSubmit = mongoTemplate.exists(Query.query(Criteria.where("performancesId").is(performanceId).and("status").is(1)),
PerformanceCreateParam.class,
PerformanceCreateParam.class.getSimpleName());
PerformanceParam.class,
PerformanceParam.class.getSimpleName());
if (isExistsSubmit) {
return false;
......@@ -156,37 +268,38 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
if (step2Param.getIsSubmit() == 1) { // 提交
map.put("status", 1);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformanceCreateParam.class.getSimpleName()).updateOne(
mongoTemplate.getCollection(PerformanceParam.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performanceId)).getQueryObject(),
object
);
//提交 票
List<TicketTimesCreatePartnerVo> ticketTimesCreatePartnerVoList = ticketTimesPartnerService.getTimesMongoList(performanceId);
for (TicketTimesCreatePartnerVo ticketTimes : ticketTimesCreatePartnerVoList) {
List<TicketTimesPartnerVo> ticketTimesPartnerVoList = ticketTimesPartnerService.getTimesMongoList(performanceId);
for (TicketTimesPartnerVo ticketTimes : ticketTimesPartnerVoList) {
boolean boolResult = ticketsPartnerService.submitTicketByTimes(ticketTimes.getTicketTimesId());
if (boolResult) {
return false;
}
}
if (ticketTimesCreatePartnerVoList.size() <= 0) {
if (ticketTimesPartnerVoList.size() <= 0) {
return false;
} else {
PerformanceCreatePartnerVo performanceCreatePartnerVo = performanceVoTask.createPerformanceCreateParam(performanceId);
PerformanceMisVo performanceMisVo = performanceVoTask.createPerformanceCreateParam(performanceId);
HashMap<String, Object> mapSql = new HashMap<>();
mapSql.put("isCreateSave", 0);
mapSql.put("rejectTxt", "");
mapSql.put("status", 1);
mapSql.put("updatedAt", createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
// auditTime
performanceVoTask.createPerformanceMySql(performanceId, mapSql, performanceCreatePartnerVo, createdAt);
performanceVoTask.createPerformanceMySql(performanceId, mapSql, performanceMisVo, createdAt);
KylinPerformances performances = new KylinPerformances();
performances.setAuditTime(LocalDateTime.now());
performancesMapper.update(performances,new UpdateWrapper<KylinPerformances>().eq("performances_id",performanceId));
performancesMapper.update(performances, new UpdateWrapper<KylinPerformances>().eq("performances_id", performanceId));
}
} else { //保存
map.put("status", 0);
map.put("isCreateSave", 1);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformanceCreateParam.class.getSimpleName()).updateMany(
mongoTemplate.getCollection(PerformanceParam.class.getSimpleName()).updateMany(
Query.query(Criteria.where("performancesId").is(performanceId)).getQueryObject(),
object
);
......@@ -196,34 +309,152 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
}
@Override
public PerformanceCreateParam getStep1(String performancesId) {
PerformanceCreateParam data = mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceCreateParam.class, PerformanceCreateParam.class.getSimpleName()
public boolean updateStep2(PerformanceStep2Param step2Param) {
// 获取 主键id
String performanceId = step2Param.getPerformancesId();
// 获取 当前时间 -> 创建时间
LocalDateTime createdAt = LocalDateTime.now();
boolean isExistsSubmit = mongoTemplate.exists(Query.query(Criteria.where("performancesId").is(performanceId).and("status").is(1)),
PerformanceParam.class,
PerformanceParam.class.getSimpleName());
if (isExistsSubmit) {
return false;
}
//演出修改数据
HashMap<String, Object> map = new HashMap<>();
map.put("isTrueName", step2Param.getIsTrueName());
map.put("limitCount", step2Param.getLimitCount());
map.put("createdAt", createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
map.put("updatedAt", createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
map.put("isSubmit", step2Param.getIsSubmit());
// 获取第一步数据
if (step2Param.getIsSubmit() == 1) { // 提交
map.put("status", 1);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformanceParam.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performanceId)).getQueryObject(),
object
);
if (data == null) {
return new PerformanceCreateParam();
//提交 票
List<TicketTimesPartnerVo> ticketTimesPartnerVoList = ticketTimesPartnerService.getTimesMongoList(performanceId);
for (TicketTimesPartnerVo ticketTimes : ticketTimesPartnerVoList) {
boolean boolResult = ticketsPartnerService.submitTicketByTimes(ticketTimes.getTicketTimesId());
if (boolResult) {
return false;
}
return data;
}
if (ticketTimesPartnerVoList.size() <= 0) {
return false;
} else {
PerformanceMisVo performanceMisVo = performanceVoTask.setPerformanceUpdateParam(performanceId);
HashMap<String, Object> mapSql = new HashMap<>();
mapSql.put("rejectTxt", "");
mapSql.put("status", 1);
mapSql.put("updatedAt", createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
KylinPerformances performances = new KylinPerformances();
performances.setAuditTime(LocalDateTime.now());
performancesMapper.update(performances, new UpdateWrapper<KylinPerformances>().eq("performances_id", performanceId));
//提示:票种价格、售票时间、购票限制 直接生效
List<TicketTimesTicketCreatePartnerVo> timeList = performanceMisVo.getTicketTimes();
for (TicketTimesTicketCreatePartnerVo timesItem : timeList) {
List<TicketPartnerVo> ticketList = timesItem.getTicket();
for (TicketPartnerVo ticketItem : ticketList) {
//修改 redis库存
if (redisUtil.hHasKey(KylinRedisConst.PERFORMANCES_INVENTORY + ticketItem.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL)) {
KylinTicketStatus ticketStatus = ticketStatusMapper.selectOne(new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketItem.getTicketsId()));
int changeGeneral = ticketStatus.getTotalGeneral() - ticketItem.getTotalGeneral();
int changeExchange = ticketStatus.getTotalGeneral() - ticketItem.getTotalExchange();
redisUtil.hincr(KylinRedisConst.PERFORMANCES_INVENTORY + ticketItem.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL, changeGeneral);
redisUtil.hincr(KylinRedisConst.PERFORMANCES_INVENTORY + ticketItem.getTicketsId(), KylinRedisConst.SURPLUS_EXCHANGE, changeExchange);
}
//修改 mysql 库存
KylinTicketStatus inventory = new KylinTicketStatus();
inventory.setTotalExchange(ticketItem.getTotalExchange());
inventory.setTotalGeneral(ticketItem.getTotalGeneral());
inventory.setIsTrueName(performanceMisVo.getIsTrueName());
inventory.setLimitCount(ticketItem.getLimitCount());
//修改 mysql 售卖时间
KylinTickets ticketSellTime = new KylinTickets();
ticketSellTime.setTimeEnd(LocalDateTime.parse(ticketItem.getTimeEnd(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketSellTime.setTimeEnd(LocalDateTime.parse(ticketItem.getTimeStart(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketsMapper.update(ticketSellTime, new UpdateWrapper<KylinTickets>().eq("tickets_id", ticketItem.getTicketsId()));
//修改 mysql 购票限购
ticketStatusMapper.update(inventory, new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketItem.getTicketsId()));
}
}
}
} else { //保存
map.put("status", 0);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformanceParam.class.getSimpleName()).updateMany(
Query.query(Criteria.where("performancesId").is(performanceId)).getQueryObject(),
object
);
}
return true;
}
@Override
public PerformanceStep2Param getStep2(String performancesId) {
PerformanceCreateParam data = mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceCreateParam.class, PerformanceCreateParam.class.getSimpleName()
PerformanceStep2Param performanceCreatePartnerVo = null;
performanceCreatePartnerVo = getUpdateStep2(performancesId);
log.info(" PERFORMANCE 演出第二步 获取");
return performanceCreatePartnerVo;
}
@Override
public PerformanceStep2Param getCreateStep2(String performancesId) {
PerformanceParam data = mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceParam.class, PerformanceParam.class.getSimpleName()
);
if (data == null) {
return new PerformanceStep2Param();
}
List<TicketTimesPartnerVo> ticketTimesPartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
List<TicketTimesTicketCreatePartnerVo> ticketTimesTicketCreatePartnerVoList = new ArrayList();
for (TicketTimesPartnerVo ticketTimes : ticketTimesPartnerVos) {
TicketTimesTicketCreatePartnerVo ticketTimesTicketCreatePartnerVo = new TicketTimesTicketCreatePartnerVo();
BeanUtils.copyProperties(ticketTimes, ticketTimesTicketCreatePartnerVo);
List<TicketPartnerVo> ticketPartnerVos = ticketsPartnerService.getTicketMongoList(ticketTimes.getTicketTimesId());
ticketTimesTicketCreatePartnerVo.setTicket(ticketPartnerVos);
ticketTimesTicketCreatePartnerVoList.add(ticketTimesTicketCreatePartnerVo);
}
PerformanceStep2Param performanceStep2Param = new PerformanceStep2Param();
BeanUtils.copyProperties(data, performanceStep2Param);
performanceStep2Param.setTicketTimes(ticketTimesTicketCreatePartnerVoList);
return performanceStep2Param;
}
@Override
public PerformanceStep2Param getUpdateStep2(String performancesId) {
PerformanceParam data = mongoTemplate.findOne(
Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceParam.class, PerformanceParam.class.getSimpleName()
);
if (data == null) {
return new PerformanceStep2Param();
}
List<TicketTimesCreatePartnerVo> ticketTimesCreatePartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
List<TicketTimesPartnerVo> ticketTimesPartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
List<TicketTimesTicketCreatePartnerVo> ticketTimesTicketCreatePartnerVoList = new ArrayList<TicketTimesTicketCreatePartnerVo>();
for (TicketTimesCreatePartnerVo ticketTimes : ticketTimesCreatePartnerVos) {
for (TicketTimesPartnerVo ticketTimes : ticketTimesPartnerVos) {
TicketTimesTicketCreatePartnerVo ticketTimesTicketCreatePartnerVo = new TicketTimesTicketCreatePartnerVo();
BeanUtils.copyProperties(ticketTimes, ticketTimesTicketCreatePartnerVo);
List<TicketCreatePartnerVo> ticketCreatePartnerVos = ticketsPartnerService.getTicketMongoList(ticketTimes.getTicketTimesId());
ticketTimesTicketCreatePartnerVo.setTicket(ticketCreatePartnerVos);
List<TicketPartnerVo> ticketPartnerVos = ticketsPartnerService.getTicketMongoList(ticketTimes.getTicketTimesId());
ticketTimesTicketCreatePartnerVo.setTicket(ticketPartnerVos);
ticketTimesTicketCreatePartnerVoList.add(ticketTimesTicketCreatePartnerVo);
}
......@@ -297,18 +528,24 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
ticketVo, TicketVo.class.getSimpleName()
);
//票种 库存redis TODO 库存可能会丢
TicketInventoryDto ticketInventoryRedis = (TicketInventoryDto) redisUtil.hget(KylinRedisConst.PERFORMANCES_INVENTORY, ticketVo.getTicketsId());
TicketInventoryDto ticketInventoryDto = new TicketInventoryDto();
if (ticketInventoryRedis == null) {
if (!redisUtil.hHasKey(KylinRedisConst.PERFORMANCES_INVENTORY + ticketVo.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL)) {
ticketInventoryDto.setSurplusExchange(ticketStatus.getSurplusExchange());
ticketInventoryDto.setSurplusGeneral(ticketStatus.getTotalGeneral());
ticketInventoryDto.setTicketsId(ticketVo.getTicketsId());
redisUtil.hset(KylinRedisConst.PERFORMANCES_INVENTORY + ticketVo.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL, ticketInventoryDto.getSurplusGeneral());
redisUtil.hset(KylinRedisConst.PERFORMANCES_INVENTORY + ticketVo.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL, ticketInventoryDto.getSurplusGeneral());
} else {
ticketInventoryDto.setSurplusExchange(ticketStatus.getSurplusExchange() - ticketInventoryRedis.getSurplusExchange());
ticketInventoryDto.setSurplusGeneral(ticketStatus.getTotalGeneral() - ticketInventoryRedis.getSurplusGeneral());
int surplusGeneral = (int) redisUtil.hget(KylinRedisConst.PERFORMANCES_INVENTORY + ticketVo.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL);
int surplusExchange = (int) redisUtil.hget(KylinRedisConst.PERFORMANCES_INVENTORY + ticketVo.getTicketsId(), KylinRedisConst.SURPLUS_EXCHANGE);
ticketInventoryDto.setSurplusExchange(ticketStatus.getSurplusExchange() - surplusGeneral);
ticketInventoryDto.setSurplusGeneral(ticketStatus.getTotalGeneral() - surplusExchange);
ticketInventoryDto.setTicketsId(ticketVo.getTicketsId());
}
redisUtil.hset(KylinRedisConst.PERFORMANCES_INVENTORY+":performance:"+performancesId, ticketVo.getTicketsId(), ticketInventoryDto);
redisUtil.hset(KylinRedisConst.PERFORMANCES_INVENTORY + ticketVo.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL, ticketInventoryDto.getSurplusGeneral());
redisUtil.hset(KylinRedisConst.PERFORMANCES_INVENTORY + ticketVo.getTicketsId(), KylinRedisConst.SURPLUS_EXCHANGE, ticketInventoryDto.getSurplusExchange());
if (ticketVo.getIsMember() == 1) {
isMember = 1;
......@@ -342,7 +579,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
Map<String, Object> map = new HashMap<>();
map.put("status", 3);
BasicDBObject objectPerformance = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
mongoTemplate.getCollection(PerformanceCreatePartnerVo.class.getSimpleName()).updateOne(
mongoTemplate.getCollection(PerformanceMisVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
objectPerformance
);
......@@ -413,21 +650,22 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
int size = performancePartnerListParam.getSize();
PageInfo<PerformancePartnerListDao> pageInfoTmp = null;
if (status == 0) {//未发布演出
log.info(" PERFORMANCE 演出列表 未提交");
// 排序 分页
Pageable pageable = PageRequest.of(page, size, Sort.by(Sort.Direction.DESC, "createdAt"));
//条件
Criteria criteria = Criteria.where("status").is(status);
Criteria criteria = Criteria.where("status").is(status).and("isCreateSave").is(1);
if (!performancePartnerListParam.getTitle().isEmpty()) {
criteria.and("title").regex(".*?\\" + performancePartnerListParam.getTitle());
}
Query query = Query.query(criteria);
// 查询总数
long count = mongoTemplate.count(query, PerformanceCreateParam.class, PerformanceCreateParam.class.getSimpleName());
List<PerformanceCreateParam> performanceCreateParam = mongoTemplate.find(query, PerformanceCreateParam.class, PerformanceCreateParam.class.getSimpleName());
long count = mongoTemplate.count(query, PerformanceParam.class, PerformanceParam.class.getSimpleName());
List<PerformanceParam> performanceParam = mongoTemplate.find(query, PerformanceParam.class, PerformanceParam.class.getSimpleName());
query.with(pageable);
//处理Vo
List<PerformancePartnerListVo> voList = new ArrayList<>();
for (PerformanceCreateParam item : performanceCreateParam) {
for (PerformanceParam item : performanceParam) {
PerformancePartnerListVo voData = new PerformancePartnerListVo();
voData.setStatus0Data(item);
voList.add(voData);
......@@ -435,6 +673,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
pageInfoTmp = new PageInfo(voList);
pageInfoTmp.setTotal(count);
} else {//演出列表
log.info(" PERFORMANCE 演出列表 已提交");
try {
PageHelper.startPage(performancePartnerListParam.getPage(), performancePartnerListParam.getSize());
List<PerformancePartnerListDao> voList = performancesMapper.partnerPerformanceList(BeanUtil.convertBeanToMap(performancePartnerListParam));
......
package com.liquidnet.service.kylin.service.impl.partner;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.param.CreateTicketTimesParam;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesPartnerVo;
import com.liquidnet.service.kylin.entity.KylinPerformanceStatus;
import com.liquidnet.service.kylin.entity.KylinTicketTimeRelation;
import com.liquidnet.service.kylin.entity.KylinTicketTimes;
import com.liquidnet.service.kylin.mapper.KylinPerformanceStatusMapper;
import com.liquidnet.service.kylin.mapper.KylinTicketTimeRelationMapper;
import com.liquidnet.service.kylin.mapper.KylinTicketTimesMapper;
import com.liquidnet.service.kylin.service.partner.IKylinTicketTimesPartnerService;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -38,13 +41,14 @@ import java.util.List;
* @since 2021-05-06
*/
@Service
@Slf4j
public class KylinTicketTimesPartnerServiceImpl extends ServiceImpl<KylinTicketTimesMapper, KylinTicketTimes> implements IKylinTicketTimesPartnerService {
@Autowired
private MongoTemplate mongoTemplate;
// @Autowired
// private RedisUtil redisUtil;
@Autowired
private MongoConverter mongoConverter;
@Autowired
private KylinTicketTimesMapper ticketTimesMapper;
......@@ -53,10 +57,29 @@ public class KylinTicketTimesPartnerServiceImpl extends ServiceImpl<KylinTicketT
private KylinTicketTimeRelationMapper ticketTimeRelationMapper;
@Autowired
private MongoConverter mongoConverter;
private KylinPerformanceStatusMapper performanceStatusMapper;
@Override
public TicketTimesCreatePartnerVo createTimes(CreateTicketTimesParam createTicketTimesParam) {
public TicketTimesPartnerVo createTimesSummary(CreateTicketTimesParam createTicketTimesParam) {
TicketTimesPartnerVo ticketTimesPartnerVo = null;
//获取演出状态
KylinPerformanceStatus performanceStatus = performanceStatusMapper.selectOne(
new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id",createTicketTimesParam.getPerformancesId()));
if(null == performanceStatus){
ticketTimesPartnerVo = createTimes(createTicketTimesParam);
log.info(" PERFORMANCE 场次 创建");
}else if(performanceStatus.getStatus()>=3 && performanceStatus.getStatus()!=4){//未被拒绝 且 通过审核的演出
ticketTimesPartnerVo = addNewTimes(createTicketTimesParam);
log.info(" PERFORMANCE 场次 新增");
}else {
ticketTimesPartnerVo = createTimes(createTicketTimesParam);
log.info(" PERFORMANCE 场次 创建");
}
return ticketTimesPartnerVo;
}
@Override
public TicketTimesPartnerVo createTimes(CreateTicketTimesParam createTicketTimesParam) {
// 获取 主键id
String ticketTimesId = IDGenerator.nextSnowId().toString();
......@@ -70,76 +93,84 @@ public class KylinTicketTimesPartnerServiceImpl extends ServiceImpl<KylinTicketT
title = createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")) + "-" + createTicketTimesParam.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
}
// mysql 操作
// KylinTicketTimes ticketTimes = new KylinTicketTimes();
// BeanUtils.copyProperties(createTicketTimesParam, ticketTimes);
// ticketTimes.setTicketTimesId(ticketTimesId);
// ticketTimes.setCreatedAt(createdAt);
// ticketTimes.setStatus(1);
// ticketTimes.setTitle(title);
// ticketTimesMapper.insert(ticketTimes);
//
// KylinTicketTimeRelation ticketTimeRelation = new KylinTicketTimeRelation();
// ticketTimeRelation.setTicketTimeRelationId(IDGenerator.nextSnowId().toString());
// ticketTimeRelation.setTimesId(ticketTimesId);
// ticketTimeRelation.setPerformanceId(createTicketTimesParam.getPerformancesId());
// ticketTimeRelation.setCreatedAt(createdAt);
// ticketTimeRelationMapper.insert(ticketTimeRelation);
// mongo 操作
TicketTimesCreatePartnerVo ticketTimesCreatePartnerVo = new TicketTimesCreatePartnerVo();
ticketTimesCreatePartnerVo.setTicketTimesId(ticketTimesId);
ticketTimesCreatePartnerVo.setUseStart(createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesCreatePartnerVo.setUseEnd(createTicketTimesParam.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesCreatePartnerVo.setStatus(1);
ticketTimesCreatePartnerVo.setTitle(title);
ticketTimesCreatePartnerVo.setPerformancesId(createTicketTimesParam.getPerformancesId());
ticketTimesCreatePartnerVo.setType(createTicketTimesParam.getType());
ticketTimesCreatePartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketTimesCreatePartnerVo data = mongoTemplate.insert(
ticketTimesCreatePartnerVo, TicketTimesCreatePartnerVo.class.getSimpleName()
TicketTimesPartnerVo ticketTimesPartnerVo = new TicketTimesPartnerVo();
ticketTimesPartnerVo.setTicketTimesId(ticketTimesId);
ticketTimesPartnerVo.setUseStart(createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesPartnerVo.setUseEnd(createTicketTimesParam.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesPartnerVo.setStatus(1);
ticketTimesPartnerVo.setTitle(title);
ticketTimesPartnerVo.setPerformancesId(createTicketTimesParam.getPerformancesId());
ticketTimesPartnerVo.setType(createTicketTimesParam.getType());
ticketTimesPartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketTimesPartnerVo data = mongoTemplate.insert(
ticketTimesPartnerVo, TicketTimesPartnerVo.class.getSimpleName()
);
// redis 操作
// redisUtil.hset(KylinRedisConst.TIMES, ticketTimesId, ticketTimesCreatePartnerVo);
return ticketTimesPartnerVo;
}
@Override
public TicketTimesPartnerVo addNewTimes(CreateTicketTimesParam createTicketTimesParam) {
// 获取 主键id
String ticketTimesId = IDGenerator.nextSnowId().toString();
// 获取 当前时间 -> 创建时间
LocalDateTime createdAt = LocalDateTime.now();
// 标题
String title = "";
if (createTicketTimesParam.getType() == 1) {
title = createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
} else {
title = createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")) + "-" + createTicketTimesParam.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
}
return ticketTimesCreatePartnerVo;
// mongo 操作
TicketTimesPartnerVo ticketTimesPartnerVo = new TicketTimesPartnerVo();
ticketTimesPartnerVo.setTicketTimesId(ticketTimesId);
ticketTimesPartnerVo.setUseStart(createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesPartnerVo.setUseEnd(createTicketTimesParam.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesPartnerVo.setStatus(-1);
ticketTimesPartnerVo.setTitle(title);
ticketTimesPartnerVo.setPerformancesId(createTicketTimesParam.getPerformancesId());
ticketTimesPartnerVo.setType(createTicketTimesParam.getType());
ticketTimesPartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketTimesPartnerVo data = mongoTemplate.insert(
ticketTimesPartnerVo, TicketTimesPartnerVo.class.getSimpleName()
);
return null;
}
@Override
public Boolean deleteTimes(String ticketTimesId) {
try {
LocalDateTime updatedAt = LocalDateTime.now();
KylinTicketTimeRelation ticketTimeRelation = ticketTimeRelationMapper.selectOne(
new UpdateWrapper<KylinTicketTimeRelation>().eq("times_id",ticketTimesId));
// KylinTicketTimes ticketTimes = new KylinTicketTimes();
// ticketTimes.setUpdatedAt(updatedAt);
// ticketTimes.setStatus(0);
// ticketTimesMapper.update(ticketTimes
// , new UpdateWrapper<KylinTicketTimes>().eq("ticket_times_id", ticketTimesId));
// mongo 操作
KylinPerformanceStatus performanceStatus = performanceStatusMapper.selectOne(
new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id",ticketTimeRelation.getPerformanceId()));
if(performanceStatus.getStatus() == 0 || performanceStatus.getStatus() == 4) {//未提审||被拒绝
HashMap<String, Object> map = new HashMap<>();
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
map.put("status", 0);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
Document doc = mongoTemplate.getCollection(TicketTimesCreatePartnerVo.class.getSimpleName()).findOneAndUpdate(
Document doc = mongoTemplate.getCollection(TicketTimesPartnerVo.class.getSimpleName()).findOneAndUpdate(
Query.query(Criteria.where("ticketTimesId").is(ticketTimesId)).getQueryObject(),
object,
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
// redis 操作
// redisUtil.hset(KylinRedisConst.TIMES, ticketTimesId, JsonUtils.fromJson(doc.toJson(), TicketTimesCreatePartnerVo.class));
return true;
}else{
return false;
}
} catch (Exception e) {
return false;
}
}
@Override
public TicketTimesCreatePartnerVo changeTimes(CreateTicketTimesParam createTicketTimesParam) {
public TicketTimesPartnerVo changeTimes(CreateTicketTimesParam createTicketTimesParam) {
try {
LocalDateTime updatedAt = LocalDateTime.now();
String title = "";
......@@ -150,46 +181,36 @@ public class KylinTicketTimesPartnerServiceImpl extends ServiceImpl<KylinTicketT
}
createTicketTimesParam.setTitle(title);
// mysql 操作
// KylinTicketTimes ticketTimes = new KylinTicketTimes();
// BeanUtils.copyProperties(createTicketTimesParam, ticketTimes);
// ticketTimes.setUpdatedAt(updatedAt);
// ticketTimes.setStatus(1);
// ticketTimesMapper.update(ticketTimes, new UpdateWrapper<KylinTicketTimes>().eq("ticket_times_id", createTicketTimesParam.getTicketTimesId()));
// mongo 操作
TicketTimesCreatePartnerVo ticketTimesCreatePartnerVo = new TicketTimesCreatePartnerVo();
BeanUtils.copyProperties(createTicketTimesParam, ticketTimesCreatePartnerVo);
ticketTimesCreatePartnerVo.setTicketTimesId(createTicketTimesParam.getTicketTimesId());
ticketTimesCreatePartnerVo.setUpdatedAt(updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesCreatePartnerVo.setUseStart(createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesCreatePartnerVo.setUseEnd(createTicketTimesParam.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesCreatePartnerVo.setStatus(1);
BasicDBObject object = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(ticketTimesCreatePartnerVo)));
Document doc = mongoTemplate.getCollection(TicketTimesCreatePartnerVo.class.getSimpleName()).findOneAndUpdate(
TicketTimesPartnerVo ticketTimesPartnerVo = new TicketTimesPartnerVo();
BeanUtils.copyProperties(createTicketTimesParam, ticketTimesPartnerVo);
ticketTimesPartnerVo.setTicketTimesId(createTicketTimesParam.getTicketTimesId());
ticketTimesPartnerVo.setUpdatedAt(updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesPartnerVo.setUseStart(createTicketTimesParam.getUseStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesPartnerVo.setUseEnd(createTicketTimesParam.getUseEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketTimesPartnerVo.setStatus(null);
BasicDBObject object = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(ticketTimesPartnerVo)));
Document doc = mongoTemplate.getCollection(TicketTimesPartnerVo.class.getSimpleName()).findOneAndUpdate(
Query.query(Criteria.where("ticketTimesId").is(createTicketTimesParam.getTicketTimesId())).getQueryObject(),
object,
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
// redis 操作
// redisUtil.hset(KylinRedisConst.TIMES, createTicketTimesParam.getTicketTimesId(), JsonUtils.fromJson(doc.toJson(), TicketTimesCreatePartnerVo.class));
return JsonUtils.fromJson(doc.toJson(), TicketTimesCreatePartnerVo.class);
return JsonUtils.fromJson(doc.toJson(), TicketTimesPartnerVo.class);
}catch (Exception e){
} catch (Exception e) {
return null;
}
}
@Override
public List<TicketTimesCreatePartnerVo> getTimesMongoList(String performancesId) {
return mongoTemplate.find(Query.query(Criteria.where("performancesId").is(performancesId)), TicketTimesCreatePartnerVo.class, TicketTimesCreatePartnerVo.class.getSimpleName());
public List<TicketTimesPartnerVo> getTimesMongoList(String performancesId) {
return mongoTemplate.find(Query.query(Criteria.where("performancesId").is(performancesId)), TicketTimesPartnerVo.class, TicketTimesPartnerVo.class.getSimpleName());
}
@Override
public TicketTimesCreatePartnerVo getTimesMongo(String timesId) {
return mongoTemplate.findOne(Query.query(Criteria.where("ticketTimesId").is(timesId)), TicketTimesCreatePartnerVo.class, TicketTimesCreatePartnerVo.class.getSimpleName());
public TicketTimesPartnerVo getTimesMongo(String timesId) {
return mongoTemplate.findOne(Query.query(Criteria.where("ticketTimesId").is(timesId)), TicketTimesPartnerVo.class, TicketTimesPartnerVo.class.getSimpleName());
}
}
package com.liquidnet.service.kylin.service.impl.partner;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.param.TicketCreateParam;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesPartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketPartnerVo;
import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.KylinTicketRelationsMapper;
import com.liquidnet.service.kylin.mapper.KylinTicketStatusMapper;
import com.liquidnet.service.kylin.mapper.KylinTicketsMapper;
import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.kylin.service.partner.IKylinTicketsPartnerService;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
import com.mongodb.client.result.UpdateResult;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -40,6 +40,7 @@ import java.util.List;
* @since 2021-05-06
*/
@Service
@Slf4j
public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapper, KylinTickets> implements IKylinTicketsPartnerService {
@Autowired
......@@ -51,6 +52,12 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
@Autowired
private RedisUtil redisUtil;
@Autowired
private KylinPerformanceStatusMapper performanceStatusMapper;
@Autowired
private KylinTicketTimeRelationMapper ticketTimeRelationMapper;
@Autowired
private KylinTicketsMapper ticketsMapper;
......@@ -61,78 +68,123 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
private KylinTicketRelationsMapper ticketRelationsMapper;
@Override
public TicketCreatePartnerVo createTicket(TicketCreateParam ticketCreateParam) {
public TicketPartnerVo createTicketSummary(TicketCreateParam ticketCreateParam) {
TicketPartnerVo ticketPartnerVo = null;
//获取演出状态
KylinTicketTimeRelation timesRelations = ticketTimeRelationMapper.selectOne(
new UpdateWrapper<KylinTicketTimeRelation>().eq("times_id", ticketCreateParam.getTimesId()));
if(null != timesRelations) {
KylinPerformanceStatus performanceStatus = performanceStatusMapper.selectOne(
new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", timesRelations.getPerformanceId()));
if(null == performanceStatus ){
ticketPartnerVo = createTicket(ticketCreateParam);
log.info(" PERFORMANCE 票 创建");
}else if (performanceStatus.getStatus() >= 3 && performanceStatus.getStatus() != 4) {//未被拒绝 且 通过审核的演出
ticketPartnerVo = addNewTicket(ticketCreateParam);
log.info(" PERFORMANCE 票 添加");
} else {
ticketPartnerVo = createTicket(ticketCreateParam);
log.info(" PERFORMANCE 票 创建");
}
}else{
ticketPartnerVo = createTicket(ticketCreateParam);
log.info(" PERFORMANCE 票 创建");
}
return ticketPartnerVo;
}
@Override
public TicketPartnerVo createTicket(TicketCreateParam ticketCreateParam) {
// 获取 主键id
String ticketsId = IDGenerator.nextSnowId().toString();
// 获取 当前时间 -> 创建时间
LocalDateTime createdAt = LocalDateTime.now();
ticketCreateParam.setTicketsId(ticketsId);
// mysql 操作
// ticketsMapper.insert(ticketCreateParam.kylinTickets(ticketsId, createdAt, null));
// ticketStatusMapper.insert(ticketCreateParam.kylinTicketStatus(ticketsId, createdAt, null));
// ticketRelationsMapper.insert(ticketCreateParam.kylinTicketRelations(ticketsId, createdAt, null));
// mongo 操作
TicketPartnerVo ticketPartnerVo = new TicketPartnerVo();
BeanUtils.copyProperties(ticketCreateParam, ticketPartnerVo);
ticketPartnerVo.setTicketsId(ticketsId);
ticketPartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeEndExpress(ticketCreateParam.getTimeEndExpress().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeStart(ticketCreateParam.getTimeStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeEnd(ticketCreateParam.getTimeEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketTimesPartnerVo ticketTimesPartnerVo = mongoTemplate.findOne(Query.query(Criteria.where("ticketTimesId").is(ticketCreateParam.getTimesId())), TicketTimesPartnerVo.class, TicketTimesPartnerVo.class.getSimpleName());
ticketPartnerVo.setUseStart(ticketTimesPartnerVo.getUseStart());
ticketPartnerVo.setUseEnd(ticketTimesPartnerVo.getUseEnd());
ticketPartnerVo.setType(ticketTimesPartnerVo.getType());
ticketPartnerVo.setStatus(0);
ticketPartnerVo.setDefault();
ticketPartnerVo.setQrCodeShowTime(ticketCreateParam.getQrCodeShowTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketPartnerVo data = mongoTemplate.insert(
ticketPartnerVo, TicketPartnerVo.class.getSimpleName()
);
return ticketPartnerVo;
}
@Override
public TicketPartnerVo addNewTicket(TicketCreateParam ticketCreateParam) {
// 获取 主键id
String ticketsId = IDGenerator.nextSnowId().toString();
// 获取 当前时间 -> 创建时间
LocalDateTime createdAt = LocalDateTime.now();
ticketCreateParam.setTicketsId(ticketsId);
// mongo 操作
TicketCreatePartnerVo ticketCreatePartnerVo = new TicketCreatePartnerVo();
BeanUtils.copyProperties(ticketCreateParam, ticketCreatePartnerVo);
ticketCreatePartnerVo.setTicketsId(ticketsId);
ticketCreatePartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTimeEndExpress(ticketCreateParam.getTimeEndExpress().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTimeStart(ticketCreateParam.getTimeStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTimeEnd(ticketCreateParam.getTimeEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketTimesCreatePartnerVo ticketTimesCreatePartnerVo = mongoTemplate.findOne(Query.query(Criteria.where("ticketTimesId").is(ticketCreateParam.getTimesId())), TicketTimesCreatePartnerVo.class, TicketTimesCreatePartnerVo.class.getSimpleName());
ticketCreatePartnerVo.setUseStart(ticketTimesCreatePartnerVo.getUseStart());
ticketCreatePartnerVo.setUseEnd(ticketTimesCreatePartnerVo.getUseEnd());
ticketCreatePartnerVo.setType(ticketTimesCreatePartnerVo.getType());
ticketCreatePartnerVo.setDefault();
ticketCreatePartnerVo.setQrCodeShowTime(ticketCreateParam.getQrCodeShowTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketCreatePartnerVo data = mongoTemplate.insert(
ticketCreatePartnerVo, TicketCreatePartnerVo.class.getSimpleName()
TicketPartnerVo ticketPartnerVo = new TicketPartnerVo();
BeanUtils.copyProperties(ticketCreateParam, ticketPartnerVo);
ticketPartnerVo.setTicketsId(ticketsId);
ticketPartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeEndExpress(ticketCreateParam.getTimeEndExpress().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeStart(ticketCreateParam.getTimeStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeEnd(ticketCreateParam.getTimeEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketTimesPartnerVo ticketTimesPartnerVo = mongoTemplate.findOne(Query.query(Criteria.where("ticketTimesId").is(ticketCreateParam.getTimesId())), TicketTimesPartnerVo.class, TicketTimesPartnerVo.class.getSimpleName());
ticketPartnerVo.setUseStart(ticketTimesPartnerVo.getUseStart());
ticketPartnerVo.setUseEnd(ticketTimesPartnerVo.getUseEnd());
ticketPartnerVo.setType(ticketTimesPartnerVo.getType());
ticketPartnerVo.setStatus(-2);
ticketPartnerVo.setDefault();
ticketPartnerVo.setQrCodeShowTime(ticketCreateParam.getQrCodeShowTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
TicketPartnerVo data = mongoTemplate.insert(
ticketPartnerVo, TicketPartnerVo.class.getSimpleName()
);
// redis 操作
redisUtil.hset(KylinRedisConst.TICKET, ticketsId, ticketCreatePartnerVo);
return ticketCreatePartnerVo;
return ticketPartnerVo;
}
@Override
public TicketCreatePartnerVo updateTicket(TicketCreateParam ticketCreateParam) {
public TicketPartnerVo updateTicket(TicketCreateParam ticketCreateParam) {
try {
String ticketId = ticketCreateParam.getTicketsId();
LocalDateTime updatedAt = LocalDateTime.now();
// mysql 操作
// KylinTickets tickets = ticketCreateParam.kylinTickets(ticketId, null, updatedAt);
// tickets.setUpdatedAt(updatedAt);
// ticketsMapper.update(tickets
// , new UpdateWrapper<KylinTickets>().eq("tickets_id", ticketId));
// mongo 操作
TicketCreatePartnerVo ticketCreatePartnerVo = new TicketCreatePartnerVo();
BeanUtils.copyProperties(ticketCreateParam, ticketCreatePartnerVo);
ticketCreatePartnerVo.setUpdatedAt(updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTimeEndExpress(ticketCreateParam.getTimeEndExpress().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTimeStart(ticketCreateParam.getTimeStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTimeEnd(ticketCreateParam.getTimeEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setQrCodeShowTime(ticketCreateParam.getQrCodeShowTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTimesId(null);
ticketCreatePartnerVo.setDefault();
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(ticketCreatePartnerVo));
Document doc = mongoTemplate.getCollection(TicketCreatePartnerVo.class.getSimpleName()).findOneAndUpdate(
TicketPartnerVo ticketPartnerVo = new TicketPartnerVo();
BeanUtils.copyProperties(ticketCreateParam, ticketPartnerVo);
ticketPartnerVo.setUpdatedAt(updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeEndExpress(ticketCreateParam.getTimeEndExpress().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeStart(ticketCreateParam.getTimeStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimeEnd(ticketCreateParam.getTimeEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setQrCodeShowTime(ticketCreateParam.getQrCodeShowTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTimesId(null);
ticketPartnerVo.setStatus(null);
ticketPartnerVo.setDefault();
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(ticketPartnerVo));
Document doc = mongoTemplate.getCollection(TicketPartnerVo.class.getSimpleName()).findOneAndUpdate(
Query.query(Criteria.where("ticketsId").is(ticketId)).getQueryObject(),
object,
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
// redis 操作
TicketCreatePartnerVo ticketCreatePartnerVoData = JsonUtils.fromJson(doc.toJson(), TicketCreatePartnerVo.class);
redisUtil.hset(KylinRedisConst.TICKET, ticketId, ticketCreatePartnerVoData);
return ticketCreatePartnerVoData;
TicketPartnerVo ticketPartnerVoData = JsonUtils.fromJson(doc.toJson(), TicketPartnerVo.class);
return ticketPartnerVoData;
} catch (Exception e) {
return null;
}
......@@ -143,95 +195,77 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
try {
LocalDateTime updatedAt = LocalDateTime.now();
// KylinTicketStatus ticketStatus = new KylinTicketStatus();
// ticketStatus.setUpdatedAt(updatedAt);
// ticketStatus.setStatus(-1);
// ticketStatusMapper.update(ticketStatus
// , new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketsId));
KylinTicketRelations ticketRelations = ticketRelationsMapper.selectOne(
new UpdateWrapper<KylinTicketRelations>().eq("ticket_id", ticketsId));
KylinTicketTimeRelation ticketTimeRelation = ticketTimeRelationMapper.selectOne(
new UpdateWrapper<KylinTicketTimeRelation>().eq("times_id", ticketRelations.getTimesId()));
KylinPerformanceStatus performanceStatus = performanceStatusMapper.selectOne(
new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", ticketTimeRelation.getPerformanceId()));
if (performanceStatus.getStatus() == 0 || performanceStatus.getStatus() == 4) {//未提审||被拒绝
// mongo 操作
HashMap<String, Object> map = new HashMap<>();
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
map.put("status", -1);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
Document doc = mongoTemplate.getCollection(TicketCreatePartnerVo.class.getSimpleName()).findOneAndUpdate(
Document doc = mongoTemplate.getCollection(TicketPartnerVo.class.getSimpleName()).findOneAndUpdate(
Query.query(Criteria.where("ticketsId").is(ticketsId)).getQueryObject(),
object,
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
// redis 操作
redisUtil.hset(KylinRedisConst.TICKET, ticketsId, JsonUtils.fromJson(doc.toJson(), TicketCreatePartnerVo.class));
return true;
} else {
return false;
}
} catch (Exception e) {
return false;
}
}
@Override
public TicketCreatePartnerVo copyTicket(String ticketsId) {
public TicketPartnerVo copyTicket(String ticketsId) {
// 获取 当前时间 -> 创建时间
LocalDateTime createdAt = LocalDateTime.now();
// KylinTickets tickets = ticketsMapper.selectOne(new UpdateWrapper<KylinTickets>().eq("tickets_id", ticketsId));
// tickets.setCreatedAt(createdAt);
// KylinTicketStatus ticketStatus = ticketStatusMapper.selectOne(new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketsId));
// ticketStatus.setCreatedAt(createdAt);
// KylinTicketRelations ticketRelations = ticketRelationsMapper.selectOne(new UpdateWrapper<KylinTicketRelations>().eq("ticket_id", ticketsId));
// ticketRelations.setCreatedAt(createdAt);
// String ticketsCopyId = IDGenerator.nextSnowId().toString();
// tickets.setTicketsId(ticketsCopyId);
// ticketStatus.setTicketId(ticketsCopyId);
// ticketStatus.setTicketStatusId(IDGenerator.nextSnowId().toString());
// ticketRelations.setTicketId(ticketsCopyId);
// ticketRelations.setTicketRelationsId(IDGenerator.nextSnowId().toString());
// ticketsMapper.insert(tickets);
// ticketStatusMapper.insert(ticketStatus);
// ticketRelationsMapper.insert(ticketRelations);
TicketCreatePartnerVo ticketCreatePartnerVo = mongoTemplate.findOne(Query.query(Criteria.where("ticketsId").is(ticketsId)), TicketCreatePartnerVo.class, TicketCreatePartnerVo.class.getSimpleName());
ticketCreatePartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketCreatePartnerVo.setTicketsId(IDGenerator.nextSnowId().toString());
TicketCreatePartnerVo data = mongoTemplate.insert(
ticketCreatePartnerVo, TicketCreatePartnerVo.class.getSimpleName()
TicketPartnerVo ticketPartnerVo = mongoTemplate.findOne(Query.query(Criteria.where("ticketsId").is(ticketsId)), TicketPartnerVo.class, TicketPartnerVo.class.getSimpleName());
ticketPartnerVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketPartnerVo.setTicketsId(IDGenerator.nextSnowId().toString());
TicketPartnerVo data = mongoTemplate.insert(
ticketPartnerVo, TicketPartnerVo.class.getSimpleName()
);
redisUtil.hset(KylinRedisConst.TICKET, ticketsId, ticketCreatePartnerVo);
return ticketCreatePartnerVo;
redisUtil.hset(KylinRedisConst.TICKET, ticketsId, ticketPartnerVo);
return ticketPartnerVo;
}
@Override
public boolean submitTicketByTimes(String timesId) {
LocalDateTime updatedAt = LocalDateTime.now();
// KylinTicketStatus ticketStatus = new KylinTicketStatus();
// ticketStatus.setUpdatedAt(updatedAt);
// ticketStatus.setStatus(1);
// ticketStatusMapper.update(ticketStatus
// , new UpdateWrapper<KylinTicketStatus>().eq("time_id", timesId));
HashMap<String, Object> map = new HashMap<>();
map.put("status", 1);
map.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
UpdateResult updateResult = mongoTemplate.getCollection(TicketCreatePartnerVo.class.getSimpleName()).updateMany(
UpdateResult updateResult = mongoTemplate.getCollection(TicketPartnerVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("timesId").is(timesId)).getQueryObject(),
object
);
return updateResult.getModifiedCount()<=0;
return updateResult.getModifiedCount() <= 0;
}
@Override
public List<TicketCreatePartnerVo> getTicketMongoList(String timesId) {
return mongoTemplate.find(Query.query(Criteria.where("timesId").is(timesId)), TicketCreatePartnerVo.class, TicketCreatePartnerVo.class.getSimpleName());
public List<TicketPartnerVo> getTicketMongoList(String timesId) {
return mongoTemplate.find(Query.query(Criteria.where("timesId").is(timesId)), TicketPartnerVo.class, TicketPartnerVo.class.getSimpleName());
}
@Override
public TicketCreatePartnerVo getTicketsMongo(String ticketsId) {
return mongoTemplate.findOne(Query.query(Criteria.where("ticketsId").is(ticketsId)), TicketCreatePartnerVo.class, TicketCreatePartnerVo.class.getSimpleName());
public TicketPartnerVo getTicketsMongo(String ticketsId) {
return mongoTemplate.findOne(Query.query(Criteria.where("ticketsId").is(ticketsId)), TicketPartnerVo.class, TicketPartnerVo.class.getSimpleName());
}
}
package com.liquidnet.service.kylin.timerTask;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.TicketInventoryDto;
import com.liquidnet.service.kylin.dto.param.PerformanceCreateParam;
import com.liquidnet.service.kylin.dto.param.PerformanceParam;
import com.liquidnet.service.kylin.dto.vo.PerformanceVo;
import com.liquidnet.service.kylin.dto.vo.TicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.TicketVo;
import com.liquidnet.service.kylin.dto.vo.partner.PerformanceCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.TicketTimesTicketCreatePartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.*;
import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.kylin.service.impl.partner.KylinTicketTimesPartnerServiceImpl;
......@@ -82,6 +79,11 @@ public class PerformanceVoTask {
private KylinTicketsPartnerServiceImpl ticketsPartnerService;
/**
* 根据票状态判断 演出状态 票状态
*
* @param performanceSingleId
*/
public void performanceVoStatus(String performanceSingleId) {
LocalDateTime timeNow = LocalDateTime.now();
......@@ -115,7 +117,6 @@ public class PerformanceVoTask {
int appStatus = 6;
for (TicketTimesVo ticketTimesVoItem : timesData) {
//票
// List<TicketVo> ticketVoList = ticketTimesVoItem.getTicketVoList();
List<TicketVo> ticketVoList = mongoTemplate.find(
Query.query(Criteria.where("timeId").is(ticketTimesVoItem.getTimeId())),
TicketVo.class, TicketVo.class.getSimpleName()
......@@ -136,8 +137,9 @@ public class PerformanceVoTask {
status10Count += 1;
} else {
//库存判断
TicketInventoryDto ticketInventoryRedis = (TicketInventoryDto) redisUtil.hget(KylinRedisConst.PERFORMANCES_INVENTORY, ticketVoItem.getTicketsId());
if (ticketInventoryRedis.getSurplusGeneral() > 0) {
int surplusGeneral = (int) redisUtil.hget(KylinRedisConst.PERFORMANCES_INVENTORY+ticketVoItem.getTicketsId(), KylinRedisConst.SURPLUS_GENERAL);
if (surplusGeneral > 0) {
status = 6;
} else {
status = 8;
......@@ -152,11 +154,6 @@ public class PerformanceVoTask {
Query.query(Criteria.where("ticketsId").is(ticketVoItem.getTicketsId())).getQueryObject(),
objectTicket
);
// //修改场次 内 票数据
// mongoTemplate.getCollection(TicketTimesVo.class.getSimpleName()).updateOne(
// Query.query(Criteria.where("ticketVoList.ticketsId").is(ticketVoItem.getTicketsId())).getQueryObject(),
// objectTicket
// );
//演出状态
if (status == 6) {//单一票 可购买 则为可购买
appStatus = 6;
......@@ -181,70 +178,141 @@ public class PerformanceVoTask {
/**
* 生成 PerformanceCreatePartnerVo(用于审核第一次提交数据)
*
* @param performancesId
* @return
*/
public PerformanceCreatePartnerVo createPerformanceCreateParam(String performancesId){
PerformanceCreateParam performanceData = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceCreateParam.class, PerformanceCreateParam.class.getSimpleName());
List<TicketTimesCreatePartnerVo> ticketTimesCreatePartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
public PerformanceMisVo createPerformanceCreateParam(String performancesId) {
PerformanceParam performanceData = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceParam.class, PerformanceParam.class.getSimpleName());
List<TicketTimesPartnerVo> ticketTimesPartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
List<TicketTimesTicketCreatePartnerVo> ticketTimesTicketCreatePartnerVoList = new ArrayList<TicketTimesTicketCreatePartnerVo>();
ArrayList<BigDecimal> floatList = new ArrayList<>();
ArrayList<String> StringList = new ArrayList<>();
for (TicketTimesCreatePartnerVo ticketTimes : ticketTimesCreatePartnerVos) {
for (TicketTimesPartnerVo ticketTimes : ticketTimesPartnerVos) {
TicketTimesTicketCreatePartnerVo ticketTimesTicketCreatePartnerVo = new TicketTimesTicketCreatePartnerVo();
BeanUtils.copyProperties(ticketTimes, ticketTimesTicketCreatePartnerVo);
List<TicketCreatePartnerVo> ticketCreatePartnerVos = ticketsPartnerService.getTicketMongoList(ticketTimes.getTicketTimesId());
ticketTimesTicketCreatePartnerVo.setTicket(ticketCreatePartnerVos);
List<TicketPartnerVo> ticketPartnerVos = ticketsPartnerService.getTicketMongoList(ticketTimes.getTicketTimesId());
ticketTimesTicketCreatePartnerVo.setTicket(ticketPartnerVos);
ticketTimesTicketCreatePartnerVoList.add(ticketTimesTicketCreatePartnerVo);
for (TicketCreatePartnerVo ticketCreatePartnerVoItem : ticketCreatePartnerVos) {
floatList.add(ticketCreatePartnerVoItem.getPrice());
StringList.add(ticketCreatePartnerVoItem.getTimeEnd());
for (TicketPartnerVo ticketPartnerVoItem : ticketPartnerVos) {
floatList.add(ticketPartnerVoItem.getPrice());
StringList.add(ticketPartnerVoItem.getTimeEnd());
}
}
PerformanceCreatePartnerVo performanceCreatePartnerVo = new PerformanceCreatePartnerVo();
BeanUtils.copyProperties(performanceData, performanceCreatePartnerVo);
PerformanceMisVo performanceMisVo = new PerformanceMisVo();
BeanUtils.copyProperties(performanceData, performanceMisVo);
floatList.sort(Comparator.reverseOrder());
StringList.sort(Comparator.naturalOrder());
performanceCreatePartnerVo.setPrice(floatList.get(0) + "起");
performanceCreatePartnerVo.setStopSellTime(StringList.get(0));
performanceCreatePartnerVo.setTicketTimes(ticketTimesTicketCreatePartnerVoList);
performanceCreatePartnerVo.setStatus(1);
performanceCreatePartnerVo.setStatusSell(1);
performanceCreatePartnerVo.setRejectTxt("");
performanceMisVo.setPrice(floatList.get(0) + "起");
performanceMisVo.setStopSellTime(StringList.get(0));
performanceMisVo.setTicketTimes(ticketTimesTicketCreatePartnerVoList);
performanceMisVo.setStatus(1);
performanceMisVo.setStatusSell(1);
performanceMisVo.setRejectTxt("");
performanceCreatePartnerVo.setIsShow(1);
performanceCreatePartnerVo.setIsDistribution(0);
performanceCreatePartnerVo.setSyncAgent(0);
performanceCreatePartnerVo.setAuditStatus(0);
performanceMisVo.setIsShow(1);
performanceMisVo.setIsDistribution(0);
performanceMisVo.setSyncAgent(0);
performanceMisVo.setAuditStatus(0);
boolean exists = mongoTemplate.exists(Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceCreatePartnerVo.class, PerformanceCreatePartnerVo.class.getSimpleName());
boolean exists = mongoTemplate.exists(Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceMisVo.class, PerformanceMisVo.class.getSimpleName());
if (!exists) {
PerformanceCreatePartnerVo data = mongoTemplate.insert(
performanceCreatePartnerVo, PerformanceCreatePartnerVo.class.getSimpleName()
PerformanceMisVo data = mongoTemplate.insert(
performanceMisVo, PerformanceMisVo.class.getSimpleName()
);
}
return performanceCreatePartnerVo;
return performanceMisVo;
}
/**
* 生成 PerformanceUpdatePartnerVo(用于修改审核提交数据)
*
* @param performancesId
* @return
*/
public PerformanceMisVo setPerformanceUpdateParam(String performancesId) {
PerformanceParam performanceData = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceParam.class, PerformanceParam.class.getSimpleName());
List<TicketTimesPartnerVo> ticketTimesPartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
List<TicketTimesTicketCreatePartnerVo> ticketTimesTicketCreatePartnerVoList = new ArrayList<TicketTimesTicketCreatePartnerVo>();
ArrayList<BigDecimal> floatList = new ArrayList<>();
ArrayList<String> StringList = new ArrayList<>();
for (TicketTimesPartnerVo ticketTimes : ticketTimesPartnerVos) {
TicketTimesTicketCreatePartnerVo ticketTimesTicketCreatePartnerVo = new TicketTimesTicketCreatePartnerVo();
BeanUtils.copyProperties(ticketTimes, ticketTimesTicketCreatePartnerVo);
List<TicketPartnerVo> ticketPartnerVos = ticketsPartnerService.getTicketMongoList(ticketTimes.getTicketTimesId());
ticketTimesTicketCreatePartnerVo.setTicket(ticketPartnerVos);
ticketTimesTicketCreatePartnerVoList.add(ticketTimesTicketCreatePartnerVo);
for (TicketPartnerVo ticketPartnerVoItem : ticketPartnerVos) {
floatList.add(ticketPartnerVoItem.getPrice());
StringList.add(ticketPartnerVoItem.getTimeEnd());
}
}
PerformanceMisVo performanceMisVo = new PerformanceMisVo();
BeanUtils.copyProperties(performanceData, performanceMisVo);
floatList.sort(Comparator.reverseOrder());
StringList.sort(Comparator.naturalOrder());
performanceMisVo.setPrice(floatList.get(0) + "起");
performanceMisVo.setStopSellTime(StringList.get(0));
performanceMisVo.setTicketTimes(ticketTimesTicketCreatePartnerVoList);
performanceMisVo.setStatus(1);
performanceMisVo.setRejectTxt("");
performanceMisVo.setAuditStatus(0);
KylinPerformanceStatus performanceStatus = performanceStatusMapper.selectOne(new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id", performancesId));
performanceMisVo.setStatusSell(performanceStatus.getStatusSell());
performanceMisVo.setIsShow(performanceStatus.getIsShow());
performanceMisVo.setIsDistribution(performanceStatus.getIsDistribution());
performanceMisVo.setSyncAgent(performanceStatus.getSyncAgent());
public void createPerformanceMySql(String performancesId,HashMap<String, Object> map,PerformanceCreatePartnerVo performanceCreatePartnerVo,LocalDateTime updatedAt){
boolean exists = mongoTemplate.exists(Query.query(Criteria.where("performancesId").is(performancesId)), PerformanceMisVo.class, PerformanceMisVo.class.getSimpleName());
if (!exists) {
mongoTemplate.insert(
performanceMisVo, PerformanceMisVo.class.getSimpleName()
);
}else{
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(performanceMisVo));
mongoTemplate.getCollection(PerformanceMisVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("performancesId").is(performancesId)).getQueryObject(),
object
);
}
return performanceMisVo;
}
/**
* 插入数据库
*
* @param performancesId
* @param map
* @param performanceMisVo
* @param updatedAt
*/
public void createPerformanceMySql(String performancesId, HashMap<String, Object> map, PerformanceMisVo performanceMisVo, LocalDateTime updatedAt) {
try {
//创建演出
KylinPerformances performances = new KylinPerformances();
BeanUtils.copyProperties(performanceCreatePartnerVo, performances);
BeanUtils.copyProperties(performanceMisVo, performances);
KylinPerformanceStatus performanceStatus = new KylinPerformanceStatus();
BeanUtils.copyProperties(performanceCreatePartnerVo, performanceStatus);
BeanUtils.copyProperties(performanceMisVo, performanceStatus);
KylinPerformanceRelations performanceRelations = new KylinPerformanceRelations();
BeanUtils.copyProperties(performanceCreatePartnerVo, performanceRelations);
BeanUtils.copyProperties(performanceMisVo, performanceRelations);
performances.setCreatedAt(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceCreatePartnerVo.getCreatedAt())));
performances.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceCreatePartnerVo.getTimeStart())));
performances.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceCreatePartnerVo.getTimeEnd())));
performances.setCreatedAt(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceMisVo.getCreatedAt())));
performances.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceMisVo.getTimeStart())));
performances.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceMisVo.getTimeEnd())));
performances.setUpdatedAt(updatedAt);
performanceStatus.setPerformanceId(performances.getPerformancesId());
......@@ -264,8 +332,8 @@ public class PerformanceVoTask {
//场次数据
List<TicketTimesCreatePartnerVo> ticketTimesCreatePartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
for (TicketTimesCreatePartnerVo ticketTimeItem : ticketTimesCreatePartnerVos) {
List<TicketTimesPartnerVo> ticketTimesPartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
for (TicketTimesPartnerVo ticketTimeItem : ticketTimesPartnerVos) {
//创建场次
KylinTicketTimes ticketTimes = new KylinTicketTimes();
BeanUtils.copyProperties(ticketTimeItem, ticketTimes);
......@@ -287,22 +355,22 @@ public class PerformanceVoTask {
ticketTimeRelationMapper.insert(ticketTimeRelation);
//修改票
for (TicketCreatePartnerVo ticketItem : ticketsPartnerService.getTicketMongoList(ticketTimeItem.getTicketTimesId())) {
for (TicketPartnerVo ticketItem : ticketsPartnerService.getTicketMongoList(ticketTimeItem.getTicketTimesId())) {
BasicDBObject objectTicketVo = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
Document docTicket = mongoTemplate.getCollection(TicketCreatePartnerVo.class.getSimpleName()).findOneAndUpdate(
Document docTicket = mongoTemplate.getCollection(TicketPartnerVo.class.getSimpleName()).findOneAndUpdate(
Query.query(Criteria.where("ticketsId").is(ticketItem.getTicketsId())).getQueryObject(),
objectTicketVo,
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
TicketCreatePartnerVo ticketCreatePartnerVo = JsonUtils.fromJson(docTicket.toJson(), TicketCreatePartnerVo.class);
TicketPartnerVo ticketPartnerVo = JsonUtils.fromJson(docTicket.toJson(), TicketPartnerVo.class);
//创建演出
KylinTickets tickets = new KylinTickets();
BeanUtils.copyProperties(ticketCreatePartnerVo, tickets);
BeanUtils.copyProperties(ticketPartnerVo, tickets);
KylinTicketStatus ticketStatus = new KylinTicketStatus();
BeanUtils.copyProperties(ticketCreatePartnerVo, ticketStatus);
BeanUtils.copyProperties(ticketPartnerVo, ticketStatus);
KylinTicketRelations ticketRelations = new KylinTicketRelations();
BeanUtils.copyProperties(ticketCreatePartnerVo, ticketRelations);
BeanUtils.copyProperties(ticketPartnerVo, ticketRelations);
tickets.setPriceExpress(new BigDecimal("0.00"));
tickets.setPriceDiscountMember(new BigDecimal("0.00"));
......@@ -336,8 +404,141 @@ public class PerformanceVoTask {
ticketRelationsMapper.insert(ticketRelations);
}
}
}catch (Exception e){
} catch (Exception e) {
}
}
/**
* 修改数据库
*
* @param performancesId
* @param map
* @param performanceUpdateMisVo
* @param updatedAt
*/
public void updatePerformanceMySql(String performancesId, HashMap<String, Object> map, PerformanceMisVo performanceUpdateMisVo, LocalDateTime updatedAt) {
try {
//创建演出
KylinPerformances performances = new KylinPerformances();
BeanUtils.copyProperties(performanceUpdateMisVo, performances);
KylinPerformanceStatus performanceStatus = new KylinPerformanceStatus();
BeanUtils.copyProperties(performanceUpdateMisVo, performanceStatus);
KylinPerformanceRelations performanceRelations = new KylinPerformanceRelations();
BeanUtils.copyProperties(performanceUpdateMisVo, performanceRelations);
performances.setCreatedAt(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getCreatedAt())));
performances.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getTimeStart())));
performances.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getTimeEnd())));
performances.setUpdatedAt(updatedAt);
performanceStatus.setPerformanceId(performances.getPerformancesId());
performanceStatus.setPerformanceStatusId(IDGenerator.nextSnowId().toString());
performanceStatus.setCreatedAt(null);
performanceStatus.setAuditStatus(0);
performanceStatus.setUpdatedAt(updatedAt);
performanceRelations.setPerformanceId(performances.getPerformancesId());
performanceRelations.setPerformanceRelationsId(IDGenerator.nextSnowId().toString());
performanceRelations.setCreatedAt(null);
performanceRelations.setUpdatedAt(updatedAt);
performancesMapper.update(performances,new UpdateWrapper<KylinPerformances>().eq("performances_id",performances.getPerformancesId()));
performanceStatusMapper.update(performanceStatus,new UpdateWrapper<KylinPerformanceStatus>().eq("performance_id",performances.getPerformancesId()));
performanceRelationsMapper.update(performanceRelations,new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id",performances.getPerformancesId()));
//场次数据
List<TicketTimesPartnerVo> ticketTimesPartnerVos = ticketTimesPartnerService.getTimesMongoList(performancesId);
for (TicketTimesPartnerVo ticketTimeItem : ticketTimesPartnerVos) {
//创建场次
KylinTicketTimes ticketTimes = new KylinTicketTimes();
BeanUtils.copyProperties(ticketTimeItem, ticketTimes);
KylinTicketTimeRelation ticketTimeRelation = new KylinTicketTimeRelation();
BeanUtils.copyProperties(ticketTimeItem, ticketTimeRelation);
ticketTimes.setUseStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketTimeItem.getUseStart())));
ticketTimes.setUseEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketTimeItem.getUseEnd())));
ticketTimes.setCreatedAt(null);
ticketTimes.setUpdatedAt(updatedAt);
ticketTimeRelation.setPerformanceId(performancesId);
ticketTimeRelation.setTicketTimeRelationId(IDGenerator.nextSnowId().toString());
ticketTimeRelation.setTimesId(ticketTimes.getTicketTimesId());
ticketTimeRelation.setCreatedAt(null);
ticketTimeRelation.setUpdatedAt(updatedAt);
ticketTimesMapper.update(ticketTimes,new UpdateWrapper<KylinTicketTimes>().eq("ticket_times_id",ticketTimes.getTicketTimesId()));
ticketTimeRelationMapper.update(ticketTimeRelation,new UpdateWrapper<KylinTicketTimeRelation>().eq("ticket_time_id",ticketTimes.getTicketTimesId()));
//修改票
for (TicketPartnerVo ticketItem : ticketsPartnerService.getTicketMongoList(ticketTimeItem.getTicketTimesId())) {
TicketPartnerVo ticketPartnerVo;
if(ticketItem.getStatus()!=7){
BasicDBObject objectTicketVo = new BasicDBObject("$set", mongoConverter.convertToMongoType(map));
Document docTicket = mongoTemplate.getCollection(TicketPartnerVo.class.getSimpleName()).findOneAndUpdate(
Query.query(Criteria.where("ticketsId").is(ticketItem.getTicketsId())).getQueryObject(),
objectTicketVo,
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
ticketPartnerVo = JsonUtils.fromJson(docTicket.toJson(), TicketPartnerVo.class);
}else{
ticketPartnerVo = mongoTemplate.findOne(
Query.query(Criteria.where("ticketsId").is(ticketItem.getTicketsId())),
TicketPartnerVo.class,
TicketPartnerVo.class.getSimpleName()
);
}
//创建演出
KylinTickets tickets = new KylinTickets();
BeanUtils.copyProperties(ticketPartnerVo, tickets);
KylinTicketStatus ticketStatus = new KylinTicketStatus();
BeanUtils.copyProperties(ticketPartnerVo, ticketStatus);
KylinTicketRelations ticketRelations = new KylinTicketRelations();
BeanUtils.copyProperties(ticketPartnerVo, ticketRelations);
tickets.setPriceExpress(new BigDecimal("0.00"));
tickets.setPriceDiscountMember(new BigDecimal("0.00"));
tickets.setPriceDiscount(new BigDecimal("0.00"));
tickets.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketItem.getTimeStart())));
tickets.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketItem.getTimeEnd())));
tickets.setTimeEndExpress(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketItem.getTimeEndExpress())));
tickets.setUseStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketTimeItem.getUseStart())));
tickets.setUseEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketTimeItem.getUseEnd())));
tickets.setSaleRemindMinute(60);
tickets.setCreatedAt(null);
tickets.setUpdatedAt(updatedAt);
ticketStatus.setTicketStatusId(IDGenerator.nextSnowId().toString());
ticketStatus.setTicketId(tickets.getTicketsId());
ticketStatus.setCounts(1);
ticketStatus.setIsMember(null);
ticketStatus.setStatusExchange(7);
ticketStatus.setQrCodeShowTime(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(ticketItem.getQrCodeShowTime())));
//不改动数据 价格 限购 购票时间
ticketStatus.setLimitCount(null);
ticketStatus.setTotalGeneral(null);
ticketStatus.setTotalExchange(null);
tickets.setTimeStart(null);
tickets.setTimeEnd(null);
ticketRelations.setCreatedAt(null);
ticketRelations.setUpdatedAt(updatedAt);
ticketRelations.setTicketRelationsId(IDGenerator.nextSnowId().toString());
ticketRelations.setTicketId(tickets.getTicketsId());
ticketRelations.setCreatedAt(null);
ticketRelations.setUpdatedAt(updatedAt);
ticketsMapper.update(tickets,new UpdateWrapper<KylinTickets>().eq("tickets_id",tickets.getTicketsId()));
ticketStatusMapper.update(ticketStatus,new UpdateWrapper<KylinTicketStatus>().eq("tickets_id",tickets.getTicketsId()));
ticketRelationsMapper.update(ticketRelations,new UpdateWrapper<KylinTicketRelations>().eq("tickets_id",tickets.getTicketsId()));
}
}
} catch (Exception e) {
}
}
}
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