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

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

第三方 演出提交创建逻辑完成

parent 7d4691f8
package com.liquidnet.service.kylin.dto.param;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class PerformanceCreateParam 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 String 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 = "演出公告", 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 = "", example = "")
private String createdAt;
}
......@@ -10,7 +10,6 @@ import java.io.Serializable;
public class PerformanceStep2Param implements Serializable {
@ApiModelProperty(value = "演出id", example = "")
@JsonIgnore
private String performancesId;
@ApiModelProperty(value = "是否实名", example = "0")
......
......@@ -17,6 +17,6 @@ public interface IKylinPerformancesPartnerService extends IService<KylinPerforma
String createStep1(PerformanceStep1Param step1Param);
String createStep2(PerformanceStep2Param step1Param);
boolean createStep2(PerformanceStep2Param step1Param);
}
......@@ -3,8 +3,11 @@ 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.TicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.TicketVo;
import com.liquidnet.service.kylin.entity.KylinTicketTimes;
import java.util.List;
/**
* <p>
* 场次 服务类
......@@ -20,4 +23,6 @@ public interface IKylinTicketTimesPartnerService extends IService<KylinTicketTim
Boolean deleteTimes(String ticketTimesId);
TicketTimesVo changeTimes(CreateTicketTimesParam createTicketTimesParam);
List<TicketTimesVo> getTimesMongo(String performancesId);
}
......@@ -6,6 +6,8 @@ import com.liquidnet.service.kylin.dto.vo.TicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.TicketVo;
import com.liquidnet.service.kylin.entity.KylinTickets;
import java.util.List;
/**
* <p>
* 票 服务类
......@@ -24,4 +26,8 @@ public interface IKylinTicketsPartnerService extends IService<KylinTickets> {
TicketVo copyTicket(String ticketsId);
List<TicketVo> getTicketMongo(String timesId);
boolean submitTicketByTimes(String timesId);
}
......@@ -11,7 +11,7 @@ import java.util.HashMap;
@Api
@RestController
@RequestMapping("/user/fields")
@RequestMapping("kylin/user/fields")
public class FieldsController {
@Autowired
......
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2021-05-05
*/
@RestController
@RequestMapping("/user/performance")
@RequestMapping("kylin/user/performance")
public class KylinPerformancesController {
}
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2021-05-06
*/
@RestController
@RequestMapping("/kylin-ticket-times")
@RequestMapping("kylin/kylin-ticket-times")
public class KylinTicketTimesController {
}
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2021-05-06
*/
@RestController
@RequestMapping("/kylin-tickets")
@RequestMapping("kylin/kylin-tickets")
public class KylinTicketsController {
}
......@@ -17,7 +17,7 @@ import java.util.HashMap;
@Api
@RestController
@RequestMapping("/partner/fields")
@RequestMapping("kylin/partner/fields")
public class FieldsPartnerController {
@Autowired
......
......@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
* @since 2021-05-06
*/
@RestController
@RequestMapping("/partner/times")
@RequestMapping("kylin/partner/times")
public class KylinTicketTimesPartnerController {
@Autowired
......
......@@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
*/
@Api
@RestController
@RequestMapping("/partner/ticket")
@RequestMapping("kylin/partner/ticket")
public class KylinTicketsPartnerController {
@Autowired
......
......@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.controller.partner;
import com.liquidnet.service.ResponseDto;
import com.liquidnet.service.kylin.dto.param.PerformanceStep1Param;
import com.liquidnet.service.kylin.dto.param.PerformanceStep2Param;
import com.liquidnet.service.kylin.service.impl.partner.KylinPerformancesPartnerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -11,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
@Api
@RestController
@RequestMapping("/partner/performance")
@RequestMapping("kylin/partner/performance")
public class PerformancePartnerController {
@Autowired
......@@ -25,7 +26,19 @@ public class PerformancePartnerController {
if (result.isEmpty()) {
return ResponseDto.failure("创建失败");
} else {
return ResponseDto.success();
return ResponseDto.success(result);
}
}
@PostMapping(value = "step2")
@ApiOperation(value = "创建演出第二步")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> createStep2(@RequestBody PerformanceStep2Param performanceStep2Param) {
boolean result = performancesPartnerService.createStep2(performanceStep2Param);
if (!result) {
return ResponseDto.failure("提交失败");
} else {
return ResponseDto.success("提交完成");
}
}
......
......@@ -2,19 +2,23 @@ package com.liquidnet.service.kylin.service.impl.partner;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.dto.PerformancePartnerDto;
import com.liquidnet.service.kylin.dto.param.PerformanceCreateParam;
import com.liquidnet.service.kylin.dto.param.PerformanceStep1Param;
import com.liquidnet.service.kylin.dto.param.PerformanceStep2Param;
import com.liquidnet.service.kylin.dto.vo.TicketTimesVo;
import com.liquidnet.service.kylin.entity.KylinPerformances;
import com.liquidnet.service.kylin.mapper.KylinPerformancesMapper;
import com.liquidnet.service.kylin.service.partner.IKylinPerformancesPartnerService;
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.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* <p>
......@@ -30,6 +34,12 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private KylinTicketsPartnerServiceImpl ticketsPartnerService;
@Autowired
private KylinTicketTimesPartnerServiceImpl ticketTimesPartnerService;
@Override
public String createStep1(PerformanceStep1Param step1Param) {
// 获取 主键id
......@@ -50,8 +60,46 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
}
@Override
public String createStep2(PerformanceStep2Param step1Param) {
public boolean createStep2(PerformanceStep2Param step2Param) {
// 获取 主键id
String performanceId = step2Param.getPerformancesId();
// 获取 当前时间 -> 创建时间
LocalDateTime createdAt = LocalDateTime.now();
// 获取第一步数据
if (step2Param.getIsSubmit() == 1) { // 提交
PerformanceStep1Param info = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performanceId)),
PerformanceStep1Param.class,
PerformanceStep1Param.class.getSimpleName());
PerformanceCreateParam isExists = mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performanceId)),
PerformanceCreateParam.class,
PerformanceCreateParam.class.getSimpleName());
if(isExists!=null){
return false;
}
// 提交 演出
PerformanceCreateParam performanceCreateParam = new PerformanceCreateParam();
BeanUtils.copyProperties(info, performanceCreateParam);
performanceCreateParam.setIsTrueName(step2Param.getIsTrueName());
performanceCreateParam.setLimitCount(step2Param.getLimitCount());
performanceCreateParam.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
performanceCreateParam.setStatus(1);
PerformanceCreateParam data = mongoTemplate.insert(
performanceCreateParam, PerformanceCreateParam.class.getSimpleName()
);
//提交 票
List<TicketTimesVo> ticketTimesVoList = ticketTimesPartnerService.getTimesMongo(performanceId);
for (TicketTimesVo ticketTimes : ticketTimesVoList) {
ticketsPartnerService.submitTicketByTimes(ticketTimes.getTicketTimesId());
}
} else { //保存
return false;
}
return "";
return true;
}
}
......@@ -9,6 +9,7 @@ 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.TicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.TicketVo;
import com.liquidnet.service.kylin.entity.KylinTicketTimeRelation;
import com.liquidnet.service.kylin.entity.KylinTicketTimes;
import com.liquidnet.service.kylin.mapper.KylinTicketTimeRelationMapper;
......@@ -29,6 +30,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
/**
* <p>
......@@ -183,4 +185,9 @@ public class KylinTicketTimesPartnerServiceImpl extends ServiceImpl<KylinTicketT
return null;
}
}
@Override
public List<TicketTimesVo> getTimesMongo(String performancesId) {
return mongoTemplate.find(Query.query(Criteria.where("performancesId").is(performancesId)), TicketTimesVo.class, TicketTimesVo.class.getSimpleName());
}
}
......@@ -70,9 +70,9 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
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));
// ticketsMapper.insert(ticketCreateParam.kylinTickets(ticketsId, createdAt, null));
// ticketStatusMapper.insert(ticketCreateParam.kylinTicketStatus(ticketsId, createdAt, null));
// ticketRelationsMapper.insert(ticketCreateParam.kylinTicketRelations(ticketsId, createdAt, null));
// mongo 操作
TicketVo ticketVo = new TicketVo();
......@@ -98,10 +98,10 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
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));
// KylinTickets tickets = ticketCreateParam.kylinTickets(ticketId, null, updatedAt);
// tickets.setUpdatedAt(updatedAt);
// ticketsMapper.update(tickets
// , new UpdateWrapper<KylinTickets>().eq("tickets_id", ticketId));
// mongo 操作
TicketVo ticketVo = new TicketVo();
......@@ -133,11 +133,11 @@ 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));
// KylinTicketStatus ticketStatus = new KylinTicketStatus();
// ticketStatus.setUpdatedAt(updatedAt);
// ticketStatus.setStatus(-1);
// ticketStatusMapper.update(ticketStatus
// , new UpdateWrapper<KylinTicketStatus>().eq("ticket_id", ticketsId));
// mongo 操作
HashMap<String, Object> map = new HashMap<>();
......@@ -166,28 +166,25 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
// 获取 当前时间 -> 创建时间
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);
// 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);
TicketVo ticketVo = mongoTemplate.findOne(Query.query(Criteria.where("ticketsId").is(ticketsId)), TicketVo.class, TicketVo.class.getSimpleName());
ticketVo.setTicketsId(ticketsCopyId);
ticketVo.setCreatedAt(createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
ticketVo.setTicketsId(IDGenerator.nextSnowId().toString());
TicketVo data = mongoTemplate.insert(
ticketVo, TicketVo.class.getSimpleName()
......@@ -196,4 +193,30 @@ public class KylinTicketsPartnerServiceImpl extends ServiceImpl<KylinTicketsMapp
redisUtil.hset(KylinRedisConst.TICKET, ticketsId, ticketVo);
return ticketVo;
}
@Override
public List<TicketVo> getTicketMongo(String timesId) {
return mongoTemplate.find(Query.query(Criteria.where("timesId").is(timesId)), TicketVo.class, TicketVo.class.getSimpleName());
}
@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));
mongoTemplate.getCollection(TicketVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("timesId").is(timesId)).getQueryObject(),
object
);
return true;
}
}
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