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

Commit 013d88a0 authored by 胡佳晨's avatar 胡佳晨

为了方便测试 订单维度 暂时以 演出 id 为 维度

parent a8347c19
...@@ -25,4 +25,12 @@ public class DataController { ...@@ -25,4 +25,12 @@ public class DataController {
Boolean result = data.performance(); Boolean result = data.performance();
return ResponseDto.success(result); return ResponseDto.success(result);
} }
@PostMapping("order")
@ApiOperation("订单数据迁移")
public ResponseDto<Boolean> order(int month) {
Boolean result = data.order(month);
return ResponseDto.success(result);
}
} }
...@@ -5,6 +5,8 @@ import com.liquidnet.commons.lang.util.DateUtil; ...@@ -5,6 +5,8 @@ import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.constant.KylinRedisConst; import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerVo; import com.liquidnet.service.kylin.dto.param.PerformancePartnerVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo; import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo; import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo;
...@@ -19,10 +21,8 @@ import org.springframework.data.mongodb.core.convert.MongoConverter; ...@@ -19,10 +21,8 @@ import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Connection; import java.sql.*;
import java.sql.DriverManager; import java.time.LocalDateTime;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -50,6 +50,16 @@ public class DataImpl { ...@@ -50,6 +50,16 @@ public class DataImpl {
private KylinTicketRelationsMapper ticketRelationsMapper; private KylinTicketRelationsMapper ticketRelationsMapper;
@Autowired @Autowired
private PerformanceVoTask performanceVoTask; private PerformanceVoTask performanceVoTask;
@Autowired
private KylinOrderTicketsMapper orderTicketsMapper;
@Autowired
private KylinOrderTicketStatusMapper orderTicketStatusMapper;
@Autowired
private KylinOrderTicketRelationsMapper orderTicketRelationsMapper;
@Autowired
private KylinOrderTicketEntitiesMapper orderTicketEntitiesMapper;
@Autowired @Autowired
private DataUtils dataUtils; private DataUtils dataUtils;
@Autowired @Autowired
...@@ -128,7 +138,7 @@ public class DataImpl { ...@@ -128,7 +138,7 @@ public class DataImpl {
performances.setNoticeImage("[{\"id\":1,\"sort\":1,\"message\":\"因演出票品非普通商品,其背后承载的文化服务具有时效性、稀缺性等特征,故不适用7天无理由退货政策。因“不可抗力”导致的演出取消或延期除外。\",\"title\":\"门票退换\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c45722882a13.png\"},{\"id\":7,\"sort\":2,\"message\":\"凭订单二维码或手机号兑票入场,二维码或手机号请勿泄露,以免影响入场。个人原因导致的信息泄露,主办方/平台方不承担任何责任。\",\"title\":\"电子票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456d9482fb9.png\"},{\"id\":3,\"sort\":3,\"message\":\"本场演出不设座位,均为站席观演。\",\"title\":\"仅设站席\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456e93db0b9.png\"},{\"id\":12,\"sort\":4,\"message\":\"每场现场票数量由场地方决定,具体请到现场询问。\",\"title\":\"现场票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/06/17/5d07647eaa55f.png\"}]"); performances.setNoticeImage("[{\"id\":1,\"sort\":1,\"message\":\"因演出票品非普通商品,其背后承载的文化服务具有时效性、稀缺性等特征,故不适用7天无理由退货政策。因“不可抗力”导致的演出取消或延期除外。\",\"title\":\"门票退换\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c45722882a13.png\"},{\"id\":7,\"sort\":2,\"message\":\"凭订单二维码或手机号兑票入场,二维码或手机号请勿泄露,以免影响入场。个人原因导致的信息泄露,主办方/平台方不承担任何责任。\",\"title\":\"电子票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456d9482fb9.png\"},{\"id\":3,\"sort\":3,\"message\":\"本场演出不设座位,均为站席观演。\",\"title\":\"仅设站席\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456e93db0b9.png\"},{\"id\":12,\"sort\":4,\"message\":\"每场现场票数量由场地方决定,具体请到现场询问。\",\"title\":\"现场票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/06/17/5d07647eaa55f.png\"}]");
performances.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_start").toString())); performances.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_start").toString()));
performances.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_end").toString())); performances.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_end").toString()));
if(null!=resultData.getString("audit_submit_time")) { if (null != resultData.getString("audit_submit_time")) {
performances.setAuditTime(DateUtil.Formatter.yyyyMMddHHmmss.parse(resultData.getString("audit_submit_time"))); performances.setAuditTime(DateUtil.Formatter.yyyyMMddHHmmss.parse(resultData.getString("audit_submit_time")));
} }
performances.setRejectTxt(resultData.getString("reject_text")); performances.setRejectTxt(resultData.getString("reject_text"));
...@@ -294,7 +304,7 @@ public class DataImpl { ...@@ -294,7 +304,7 @@ public class DataImpl {
tickets.setAdvanceMinuteMember(5); tickets.setAdvanceMinuteMember(5);
tickets.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("time_start").toString())); tickets.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("time_start").toString()));
tickets.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("time_end").toString())); tickets.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("time_end").toString()));
if(null!=ticketData.getTimestamp("time_end_express")) { if (null != ticketData.getTimestamp("time_end_express")) {
tickets.setTimeEndExpress(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("time_end_express").toString())); tickets.setTimeEndExpress(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("time_end_express").toString()));
} }
tickets.setUseStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("use_start").toString())); tickets.setUseStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("use_start").toString()));
...@@ -350,8 +360,8 @@ public class DataImpl { ...@@ -350,8 +360,8 @@ public class DataImpl {
ticketStatusMapper.insert(ticketStatus); ticketStatusMapper.insert(ticketStatus);
ticketRelationsMapper.insert(ticketRelations); ticketRelationsMapper.insert(ticketRelations);
dataUtils.setSurplusGeneral(tickets.getTicketsId(),ticketStatus.getSurplusGeneral()); dataUtils.setSurplusGeneral(tickets.getTicketsId(), ticketStatus.getSurplusGeneral());
dataUtils.setSurplusExchange(tickets.getTicketsId(),ticketStatus.getSurplusExchange()); dataUtils.setSurplusExchange(tickets.getTicketsId(), ticketStatus.getSurplusExchange());
//Vo //Vo
ticketPartnerVo.setTicketsId(tickets.getTicketsId()); ticketPartnerVo.setTicketsId(tickets.getTicketsId());
ticketPartnerVo.setTitle(tickets.getTitle()); ticketPartnerVo.setTitle(tickets.getTitle());
...@@ -398,7 +408,7 @@ public class DataImpl { ...@@ -398,7 +408,7 @@ public class DataImpl {
rowCount += resultData.getRow(); rowCount += resultData.getRow();
if (allCountResult > rowCount) { if (allCountResult > rowCount) {
isBreak = true; isBreak = true;
page+=1; page += 1;
} else { } else {
isBreak = false; isBreak = false;
} }
...@@ -421,4 +431,307 @@ public class DataImpl { ...@@ -421,4 +431,307 @@ public class DataImpl {
} }
} }
public boolean order(int month) {
String driverClassName = "com.mysql.cj.jdbc.Driver"; //启动驱动
String url = "jdbc:mysql://zhengzai.mysql.polardb.rds.aliyuncs.com:3306/mall"; //设置连接路径
String username = "readonly"; //数据库用户名
String password = "ZWDsf8Fy"; //数据库连接密码
Connection con = null; //连接
PreparedStatement pstmt = null; //使用预编译语句
ResultSet rs = null; //获取的结果集
KylinOrderTickets orderTickets = new KylinOrderTickets();
KylinOrderTicketStatus orderTicketStatus = new KylinOrderTicketStatus();
KylinOrderTicketRelations orderTicketRelations = new KylinOrderTicketRelations();
KylinOrderTicketEntities orderTicketEntities = new KylinOrderTicketEntities();
KylinOrderTicketVo orderTicketVo = new KylinOrderTicketVo();
ArrayList<KylinOrderTicketEntitiesVo> entitiesVosList = new ArrayList<>();
try {
int count = 200;
int page = 0;
Class.forName(driverClassName); //执行驱动
con = DriverManager.getConnection(url, username, password); //获取连接
// String sqlAllCount = "select count(0) as 'allCount' from order_tickets where performance_id > 5721 and status != 2 and created_at like '2021-" + month + "%'"; //设置的预编译语句格式
String sqlAllCount = "select count(0) as 'allCount' from order_tickets where performance_id = "+month + " and status != 2 and status !=-1"; //设置的预编译语句格式
pstmt = con.prepareStatement(sqlAllCount);
ResultSet allCount = pstmt.executeQuery();
int allCountResult = 0;//共多少条
int rowCount = 0;//当前多少条
boolean isBreak = false;//是否终端循环
while (allCount.next()) {
allCountResult = allCount.getInt("allCount");
}
do {
//订单
// String sql = "select * from order_tickets where performance_id > 5721 and status != 2 and created_at like '2021-" + month + "%' limit " + count * page + " ," + count; //设置的预编译语句格式
String sql = "select * from order_tickets where performance_id = "+month +" and status != 2 limit " + count * page + " ," + count;
pstmt = con.prepareStatement(sql);
ResultSet orderData = pstmt.executeQuery();
while (orderData.next()) {
String ticketSql = "select student,use_end,use_start,title,type from tickets where id = " + orderData.getInt("ticket_id"); //设置的预编译语句格式
pstmt = con.prepareStatement(ticketSql);
ResultSet ticketData = pstmt.executeQuery();
int isStudent = 0;
String useEnd = "";
String useStart = "";
String ticketTitle = "";
int ticketType = 0;
while (ticketData.next()) {
isStudent = ticketData.getString("student").equals("yes") ? 1 : 0;
ticketTitle = ticketData.getString("title");
ticketType = ticketData.getInt("type");
useEnd = DateUtil.Formatter.yyyyMMddHHmmss.format(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("use_end").toString()));
useStart = DateUtil.Formatter.yyyyMMddHHmmss.format(DateUtil.Formatter.yyyyMMddHHmmssS.parse(ticketData.getTimestamp("use_start").toString()));
}
//退款
String refundSql = "select refund_table_id,sum(refund_number) as 'refund_number',sum(refund_price) as 'refund_price' from order_refunds where refund_table = 'order_ticket_entities' and order_id = " + orderData.getInt("id")+" group by refund_table_id"; //设置的预编译语句格式
pstmt = con.prepareStatement(refundSql);
int refundNumber = 0;
BigDecimal refundPrice = new BigDecimal("0.00");
ResultSet refundData = pstmt.executeQuery();
while (refundData.next()) {
refundNumber+=refundData.getInt("refund_number");
refundPrice.add(refundData.getBigDecimal("refund_price"));
}
//演出
String performancedSql = "select time_start,img_poster,need_id_card from performances where id =" + orderData.getInt("performance_id");
pstmt = con.prepareStatement(performancedSql);
ResultSet performanceData = pstmt.executeQuery();
String performanceTimeStart = "";
String performanceImg = "";
int isTrueName = 0;
while (performanceData.next()) {
performanceTimeStart = DateUtil.Formatter.yyyyMMddHHmmss.format(DateUtil.Formatter.yyyyMMddHHmmssS.parse(performanceData.getTimestamp("time_start").toString()));
performanceImg=performanceData.getString("img_poster");
isTrueName=performanceData.getString("need_id_card").equals("yes")?1:0;
}
orderTickets.setOrderTicketsId(orderData.getInt("id") + "");
orderTickets.setUserId(orderData.getInt("user_id") + "");
orderTickets.setUserName(orderData.getString("user_name"));
orderTickets.setUserMobile(orderData.getString("user_mobile"));
orderTickets.setPerformanceTitle(orderData.getString("performance_title"));
orderTickets.setOrderCode(orderData.getString("order_code"));
orderTickets.setPayCode(orderData.getString("pay_code"));
orderTickets.setQrCode(orderData.getString("qr_code"));
orderTickets.setOrderType(orderData.getString("order_type"));
orderTickets.setOrderSource(orderData.getString("order_type"));
orderTickets.setOrderVersion(orderData.getString("order_version"));
orderTickets.setNumber(orderData.getInt("number"));
orderTickets.setPrice(orderData.getBigDecimal("price"));
orderTickets.setPriceMember(orderData.getBigDecimal("price_member"));
orderTickets.setPriceTotal(orderData.getBigDecimal("price_total"));
orderTickets.setPriceVoucher(orderData.getBigDecimal("price_voucher"));
orderTickets.setPriceActual(orderData.getBigDecimal("price_actual"));
orderTickets.setPriceExpress(orderData.getBigDecimal("price_express"));
orderTickets.setPriceRefund(refundPrice);
orderTickets.setRefundNumber(refundNumber);
orderTickets.setPayType(orderData.getString("pay_type"));
orderTickets.setPaymentType(orderData.getString("payment_type"));
orderTickets.setTimePay(orderData.getString("time_pay"));
orderTickets.setExpressContacts(orderData.getString("express_contacts"));
orderTickets.setExpressAddress(orderData.getString("express_address"));
orderTickets.setExpressPhone(orderData.getString("express_phone"));
orderTickets.setCouponType(orderData.getString("coupon_type"));
orderTickets.setGetTicketType(orderData.getString("get_ticket_type"));
orderTickets.setGetTicketDescribe(orderData.getString("get_ticket_describe"));
orderTickets.setPayCountdownMinute(orderData.getInt("pay_countdown_minute"));
orderTickets.setComment("");
orderTickets.setCreatedAt(DateUtil.Formatter.yyyyMMddHHmmssS.parse(orderData.getTimestamp("created_at").toString()));
if (null != orderData.getTimestamp("updated_at")) {
orderTickets.setUpdatedAt(DateUtil.Formatter.yyyyMMddHHmmssS.parse(orderData.getTimestamp("updated_at").toString()));
}
orderTicketStatus.setOrderTicketStatusId(IDGenerator.nextSnowId().toString());
orderTicketStatus.setOrderId(orderTickets.getOrderTicketsId());
orderTicketStatus.setExpressType(orderData.getInt("express_type"));
orderTicketStatus.setIsStudent(isStudent);
orderTicketStatus.setTransferStatus(orderData.getInt("transfer_status"));
orderTicketStatus.setStatus(orderData.getInt("status"));
orderTicketStatus.setPayStatus(orderData.getInt("pay_status"));
orderTicketStatus.setCreatedAt(orderTickets.getCreatedAt());
orderTicketStatus.setUpdatedAt(orderTickets.getUpdatedAt());
orderTicketRelations.setOrderTicketRelationsId(IDGenerator.nextSnowId().toString());
orderTicketRelations.setOrderId(orderTickets.getOrderTicketsId());
orderTicketRelations.setTransferId(orderData.getInt("transfer_id") + "");
orderTicketRelations.setLiveId(orderData.getInt("live_id") + "");
orderTicketRelations.setPerformanceId(orderData.getString("performance_id"));
orderTicketRelations.setTimeId("");
orderTicketRelations.setTicketId(orderData.getString("ticket_id"));
orderTicketRelations.setAgentId(orderData.getString("proxy_id"));
orderTicketRelations.setIsMember(orderData.getInt("is_member"));
orderTicketRelations.setCreatedAt(orderTickets.getCreatedAt());
orderTicketRelations.setUpdatedAt(orderTickets.getUpdatedAt());
orderTicketsMapper.insert(orderTickets);
orderTicketStatusMapper.insert(orderTicketStatus);
orderTicketRelationsMapper.insert(orderTicketRelations);
//vo
orderTicketVo.setMid(0);
orderTicketVo.setOrderTicketsId(orderTickets.getOrderTicketsId());
orderTicketVo.setUserId(orderTickets.getUserId());
orderTicketVo.setUserName(orderTickets.getUserName());
orderTicketVo.setUserMobile(orderTickets.getUserMobile());
orderTicketVo.setPerformanceTitle(orderTickets.getPerformanceTitle());
orderTicketVo.setTicketTitle(ticketTitle);
orderTicketVo.setTimeStart(performanceTimeStart);
orderTicketVo.setUseStart(useStart);
orderTicketVo.setPerformanceImg(performanceImg);
orderTicketVo.setOrderCode(orderTickets.getOrderCode());
orderTicketVo.setPayCode(orderTickets.getPayCode());
orderTicketVo.setQrCode(orderTickets.getQrCode());
orderTicketVo.setOrderType(orderTickets.getOrderType());
orderTicketVo.setOrderVersion(orderTickets.getOrderVersion());
orderTicketVo.setNumber(orderTickets.getNumber());
orderTicketVo.setPrice(orderTickets.getPrice());
orderTicketVo.setPriceMember(orderTickets.getPriceMember());
orderTicketVo.setPriceTotal(orderTickets.getPriceTotal());
orderTicketVo.setPriceVoucher(orderTickets.getPriceVoucher());
orderTicketVo.setPriceActual(orderTickets.getPriceActual());
orderTicketVo.setPriceExpress(orderTickets.getPriceExpress());
orderTicketVo.setPriceRefund(orderTickets.getPriceRefund());
orderTicketVo.setRefundNumber(orderTickets.getRefundNumber());
orderTicketVo.setPayType(orderTickets.getPayType());
orderTicketVo.setPaymentType(orderTickets.getPaymentType());
orderTicketVo.setTimePay(orderTickets.getTimePay());
orderTicketVo.setExpressContacts(orderTickets.getExpressContacts());
orderTicketVo.setExpressAddress(orderTickets.getExpressAddress());
orderTicketVo.setExpressPhone(orderTickets.getExpressPhone());
orderTicketVo.setCouponType(orderTickets.getCouponType());
orderTicketVo.setGetTicketType(orderTickets.getGetTicketType());
orderTicketVo.setGetTicketDescribe(orderTickets.getGetTicketDescribe());
orderTicketVo.setPayCountdownMinute(orderTickets.getPayCountdownMinute());
orderTicketVo.setExpressType(orderTicketStatus.getExpressType());
orderTicketVo.setIsStudent(orderTicketStatus.getIsStudent());
orderTicketVo.setTransferStatus(orderTicketStatus.getTransferStatus());
orderTicketVo.setStatus(orderTicketStatus.getStatus());
orderTicketVo.setPayStatus(orderTicketStatus.getPayStatus());
orderTicketVo.setTransferId(orderTicketRelations.getTransferId());
orderTicketVo.setLiveId(orderTicketRelations.getLiveId());
orderTicketVo.setPerformanceId(orderTicketRelations.getPerformanceId());
orderTicketVo.setTimeId(orderTicketRelations.getTimeId());
orderTicketVo.setTicketId(orderTicketRelations.getTicketId());
orderTicketVo.setAgentId(orderTicketRelations.getAgentId());
orderTicketVo.setIsMember(orderTicketRelations.getIsMember());
orderTicketVo.setCreatedAt(DateUtil.Formatter.yyyyMMddHHmmss.format(orderTickets.getCreatedAt()));
orderTicketVo.setUpdatedAt(DateUtil.Formatter.yyyyMMddHHmmss.format(orderTickets.getUpdatedAt()));
orderTicketVo.setChangeDate(orderTickets.getUpdatedAt() == null ? orderTickets.getUpdatedAt() : orderTickets.getCreatedAt());
orderTicketVo.setIsTrueName(isTrueName);
orderTicketVo.setOverdueAt(orderTickets.getCreatedAt().plusMinutes(orderTickets.getPayCountdownMinute()).plusSeconds(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
orderTicketVo.setNoticeImage("[{\"id\":1,\"sort\":1,\"message\":\"因演出票品非普通商品,其背后承载的文化服务具有时效性、稀缺性等特征,故不适用7天无理由退货政策。因“不可抗力”导致的演出取消或延期除外。\",\"title\":\"门票退换\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c45722882a13.png\"},{\"id\":7,\"sort\":2,\"message\":\"凭订单二维码或手机号兑票入场,二维码或手机号请勿泄露,以免影响入场。个人原因导致的信息泄露,主办方/平台方不承担任何责任。\",\"title\":\"电子票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456d9482fb9.png\"},{\"id\":3,\"sort\":3,\"message\":\"本场演出不设座位,均为站席观演。\",\"title\":\"仅设站席\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456e93db0b9.png\"},{\"id\":12,\"sort\":4,\"message\":\"每场现场票数量由场地方决定,具体请到现场询问。\",\"title\":\"现场票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/06/17/5d07647eaa55f.png\"}]");
orderTicketVo.setTicketType(ticketType);
orderTicketVo.setFieldName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + orderTicketRelations.getPerformanceId(), "name"));
mongoTemplate.insert(orderTicketVo, KylinOrderTicketVo.class.getSimpleName());
//入场人
String enterSql = "select * from order_ticket_entities where order_id = " + orderTickets.getOrderTicketsId(); //设置的预编译语句格式
pstmt = con.prepareStatement(enterSql);
ResultSet enterData = pstmt.executeQuery();
while (enterData.next()) {
KylinOrderTicketEntitiesVo entitiesVo = new KylinOrderTicketEntitiesVo();
orderTicketEntities.setOrderTicketEntitiesId(enterData.getInt("id")+"");
orderTicketEntities.setOrderId(orderTickets.getOrderTicketsId());
orderTicketEntities.setTicketId(enterData.getInt("ticket_id") + "");
orderTicketEntities.setUserId(enterData.getInt("user_id") + "");
orderTicketEntities.setPerformanceId(enterData.getInt("performance_id") + "");
orderTicketEntities.setTimeId("");
orderTicketEntities.setEnterType(Integer.parseInt(enterData.getString("enter_type")));
orderTicketEntities.setEnterName(enterData.getString("enter_name"));
orderTicketEntities.setEnterMobile(enterData.getString("enter_mobile"));
orderTicketEntities.setEnterIdCode(enterData.getString("enter_idcode"));
orderTicketEntities.setStatus(enterData.getInt("status"));
orderTicketEntities.setSysDamai(0);
orderTicketEntities.setCheckClient("");
int isPayment = 0;
switch (enterData.getString("is_payment")) {
case "yes":
isPayment = 1;
break;
case "no":
isPayment = 0;
break;
case "refunding":
isPayment = 2;
break;
case "refunded":
isPayment = 3;
break;
}
orderTicketEntities.setIsPayment(isPayment);
orderTicketEntities.setRefundPrice(isPayment == 3 ? orderTickets.getPrice() : new BigDecimal("0.00"));
orderTicketEntities.setComment("");
orderTicketEntities.setCreatedAt(DateUtil.Formatter.yyyyMMddHHmmssS.parse(orderData.getTimestamp("created_at").toString()));
if (null != orderData.getTimestamp("updated_at")) {
orderTicketEntities.setUpdatedAt(DateUtil.Formatter.yyyyMMddHHmmssS.parse(orderData.getTimestamp("updated_at").toString()));
}
orderTicketEntitiesMapper.insert(orderTicketEntities);
//vo
entitiesVo.setMid(0);
entitiesVo.setOrderTicketEntitiesId(orderTicketEntities.getOrderTicketEntitiesId());
entitiesVo.setOrderId(orderTicketEntities.getOrderId());
entitiesVo.setTicketId(orderTicketEntities.getTicketId());
entitiesVo.setUserId(orderTicketEntities.getUserId());
entitiesVo.setPerformanceId(orderTicketEntities.getPerformanceId());
entitiesVo.setTimeId(orderTicketEntities.getTimeId());
entitiesVo.setEnterType(orderTicketEntities.getEnterType());
entitiesVo.setEnterName(orderTicketEntities.getEnterName());
entitiesVo.setEnterMobile(orderTicketEntities.getEnterMobile());
entitiesVo.setEnterIdCode(orderTicketEntities.getEnterIdCode());
entitiesVo.setStatus(orderTicketEntities.getStatus());
entitiesVo.setSysDamai(orderTicketEntities.getSysDamai());
entitiesVo.setCheckClient(orderTicketEntities.getCheckClient());
entitiesVo.setIsPayment(orderTicketEntities.getIsPayment());
entitiesVo.setPerformanceTitle(orderTickets.getPerformanceTitle());
entitiesVo.setTicketTitle(ticketTitle);
entitiesVo.setUseStart(useStart);
entitiesVo.setUseEnd(useEnd);
entitiesVo.setCreatedAt(DateUtil.Formatter.yyyyMMddHHmmss.format(orderTicketEntities.getCreatedAt()));
entitiesVo.setUpdatedAt(DateUtil.Formatter.yyyyMMddHHmmss.format(orderTicketEntities.getUpdatedAt()));
entitiesVo.setTicketsmId(0);
entitiesVo.setTimemId(0);
entitiesVo.setChangeDate(orderTicketEntities.getUpdatedAt() == null ? orderTicketEntities.getUpdatedAt() : orderTicketEntities.getCreatedAt());
mongoTemplate.insert(entitiesVo, KylinOrderTicketEntitiesVo.class.getSimpleName());
entitiesVosList.add(entitiesVo);
}
orderTicketVo.setEntitiesVoList(entitiesVosList);
}
orderData.last();
rowCount += orderData.getRow();
if (allCountResult > rowCount) {
isBreak = true;
page += 1;
} else {
isBreak = false;
}
} while (isBreak);
return true;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
} finally {
//关闭资源,倒关
try {
if (rs != null) rs.close();
if (pstmt != null) pstmt.close();
if (con != null) con.close(); //必须要关
} 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