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

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

修改 order 相关new

parent a3551838
......@@ -55,7 +55,6 @@ public class KylinOrderTicketEntitiesVo implements Serializable, Cloneable {
}
private static final KylinOrderTicketEntitiesVo obj = new KylinOrderTicketEntitiesVo();
public static KylinOrderTicketEntitiesVo getNew() {
try {
return (KylinOrderTicketEntitiesVo) obj.clone();
......
......@@ -16,7 +16,7 @@ import java.util.List;
@ApiModel(value = "KylinOrderTicketVo", description = "订单数据")
@Data
public class KylinOrderTicketVo implements Serializable {
public class KylinOrderTicketVo implements Serializable,Cloneable {
private Integer mid;
private static final long serialVersionUID = 5325511589667456213L;
@ApiModelProperty(position = 10, value = "ID")
......@@ -124,4 +124,13 @@ public class KylinOrderTicketVo implements Serializable {
public void setOrderTicketRelation(KylinOrderTicketRelations orderTicketRelation) {
BeanUtils.copyProperties(orderTicketRelation,this);
}
private static final KylinOrderTicketVo obj = new KylinOrderTicketVo();
public static KylinOrderTicketVo getNew() {
try {
return (KylinOrderTicketVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new KylinOrderTicketVo();
}
}
}
package com.liquidnet.commons.lang.config;
import org.apache.http.Header;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Configuration
public class RestTemplateConfig {
private static final Logger logger = LoggerFactory.getLogger(RestTemplateConfig.class);
@Bean
public RestTemplate restTemplate() {
// 添加内容转换器,使用默认的内容转换器
RestTemplate restTemplate = new RestTemplate(httpRequestFactory());
// 设置编码格式为UTF-8
List<HttpMessageConverter<?>> converterList = restTemplate.getMessageConverters();
HttpMessageConverter<?> converterTarget = null;
for (HttpMessageConverter<?> item : converterList) {
if (item.getClass() == StringHttpMessageConverter.class) {
converterTarget = item;
break;
}
}
if (converterTarget != null) {
converterList.remove(converterTarget);
}
HttpMessageConverter<?> converter = new StringHttpMessageConverter(StandardCharsets.UTF_8);
converterList.add(1, converter);
return restTemplate;
}
@Bean
public ClientHttpRequestFactory httpRequestFactory() {
return new HttpComponentsClientHttpRequestFactory(httpClient());
}
@Bean
public HttpClient httpClient() {
// 长连接保持30秒
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(30, TimeUnit.SECONDS);
//设置整个连接池最大连接数 根据自己的场景决定
connectionManager.setMaxTotal(500);
//同路由的并发数,路由是对maxTotal的细分
connectionManager.setDefaultMaxPerRoute(500);
//requestConfig
RequestConfig requestConfig = RequestConfig.custom()
//服务器返回数据(response)的时间,超过该时间抛出read timeout
.setSocketTimeout(10000)
//连接上服务器(握手成功)的时间,超出该时间抛出connect timeout
.setConnectTimeout(5000)
//从连接池中获取连接的超时时间,超过该时间未拿到可用连接,会抛出org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
.setConnectionRequestTimeout(500)
.build();
//headers
List<Header> headers = new ArrayList<>();
headers.add(new BasicHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36"));
headers.add(new BasicHeader("Accept-Encoding", "gzip,deflate"));
headers.add(new BasicHeader("Accept-Language", "zh-CN"));
headers.add(new BasicHeader("Connection", "Keep-Alive"));
headers.add(new BasicHeader("Content-type", "application/json;charset=UTF-8"));
return HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.setConnectionManager(connectionManager)
.setDefaultHeaders(headers)
// 保持长连接配置,需要在头添加Keep-Alive
.setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy())
//重试次数,默认是3次,没有开启
.setRetryHandler(new DefaultHttpRequestRetryHandler(2, true))
.build();
}
}
package com.liquidnet.commons.lang.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
import java.util.Map;
@Component
public class HttpOrderUtil {
@Autowired
private RestTemplate restTemplate;
/**
* get请求
*
* @param url
* @param params 请求参数
* @return
*/
public String get(String url, MultiValueMap<String, String> params) {
return get(url, params, null);
}
/**
* get请求
*
* @param url
* @param params 请求参数
* @param headers 请求头
* @return
*/
public String get(String url, MultiValueMap<String, String> params, MultiValueMap<String, String> headers) {
return request(url, params, headers, HttpMethod.GET);
}
/**
* post请求
*
* @param url
* @param params 请求参数
* @return
*/
public String post(String url, MultiValueMap<String, String> params) {
return post(url, params, null);
}
/**
* post请求
*
* @param url
* @param params 请求参数
* @param headers 请求头
* @return
*/
public String post(String url, MultiValueMap<String, String> params, MultiValueMap<String, String> headers) {
return request(url, params, headers, HttpMethod.POST);
}
/**
* put请求
*
* @param url
* @param params 请求参数
* @return
*/
public String put(String url, MultiValueMap<String, String> params) {
return put(url, params, null);
}
/**
* put请求
*
* @param url
* @param params 请求参数
* @param headers 请求头
* @return
*/
public String put(String url, MultiValueMap<String, String> params, MultiValueMap<String, String> headers) {
return request(url, params, headers, HttpMethod.PUT);
}
/**
* delete请求
*
* @param url
* @param params 请求参数
* @return
*/
public String delete(String url, MultiValueMap<String, String> params) {
return delete(url, params, null);
}
/**
* delete请求
*
* @param url
* @param params 请求参数
* @param headers 请求头
* @return
*/
public String delete(String url, MultiValueMap<String, String> params, MultiValueMap<String, String> headers) {
return request(url, params, headers, HttpMethod.DELETE);
}
/**
* 表单请求
*
* @param url
* @param params 请求参数
* @param headers 请求头
* @param method 请求方式
* @return
*/
public String request(String url, MultiValueMap<String, String> params, MultiValueMap<String, String> headers, HttpMethod method) {
if (params == null) {
params = new LinkedMultiValueMap<>();
}
return request(url, params, headers, method, MediaType.APPLICATION_FORM_URLENCODED);
}
/**
* http请求
*
* @param url
* @param params 请求参数
* @param headers 请求头
* @param method 请求方式
* @param mediaType 参数类型
* @return
*/
public String request(String url, Object params, MultiValueMap<String, String> headers, HttpMethod method, MediaType mediaType) {
if (url == null || url.trim().isEmpty()) {
return null;
}
// header
HttpHeaders httpHeaders = new HttpHeaders();
if (headers != null) {
httpHeaders.addAll(headers);
}
HttpEntity<Object> httpEntity;
if (headers != null) {
// header
httpHeaders = new HttpHeaders();
httpHeaders.addAll(headers);
httpHeaders.setContentType(mediaType);
httpEntity = new HttpEntity(params, httpHeaders);
} else {
httpEntity = new HttpEntity(params, null);
}
// 提交方式:表单、json
ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
return response.getBody();
}
private final String PHP_API_KEY = "R7tXY9smPQPG9Ku5yI0u6sfnlckmk04V";
public String postToPhpApi(String url, MultiValueMap<String, String> params) {
params.add("sign", processForPhpApi(params).concat("&key=").concat(PHP_API_KEY).toUpperCase());
return post(url, params, null);
}
private String processForPhpApi(MultiValueMap<String, String> map) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue().get(0)).append("&");
}
String targetStr = sb.substring(0, sb.length() - 1);
try {
targetStr = URLDecoder.decode(targetStr, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
targetStr = targetStr.replace("%3D", "=").replace("%26", "&");
return targetStr;
}
}
......@@ -140,4 +140,13 @@ public class KylinOrderTicketEntities implements Serializable {
isPayment, updatedAt, orderId,updateTime,createTime
};
}
private static final KylinOrderTicketEntities obj = new KylinOrderTicketEntities();
public static KylinOrderTicketEntities getNew() {
try {
return (KylinOrderTicketEntities) obj.clone();
} catch (CloneNotSupportedException e) {
return new KylinOrderTicketEntities();
}
}
}
......@@ -92,4 +92,12 @@ public class KylinOrderTicketRelations implements Serializable {
};
}
private static final KylinOrderTicketRelations obj = new KylinOrderTicketRelations();
public static KylinOrderTicketRelations getNew() {
try {
return (KylinOrderTicketRelations) obj.clone();
} catch (CloneNotSupportedException e) {
return new KylinOrderTicketRelations();
}
}
}
......@@ -19,7 +19,7 @@ import lombok.EqualsAndHashCode;
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class KylinOrderTicketStatus implements Serializable {
public class KylinOrderTicketStatus implements Serializable,Cloneable {
private static final long serialVersionUID = 1L;
......@@ -103,4 +103,13 @@ public class KylinOrderTicketStatus implements Serializable {
status, updatedAt, orderId
};
}
private static final KylinOrderTicketStatus obj = new KylinOrderTicketStatus();
public static KylinOrderTicketStatus getNew() {
try {
return (KylinOrderTicketStatus) obj.clone();
} catch (CloneNotSupportedException e) {
return new KylinOrderTicketStatus();
}
}
}
......@@ -21,7 +21,7 @@ import lombok.EqualsAndHashCode;
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class KylinOrderTickets implements Serializable {
public class KylinOrderTickets implements Serializable ,Cloneable {
private static final long serialVersionUID = 1L;
......@@ -259,4 +259,13 @@ public class KylinOrderTickets implements Serializable {
updatedAt, orderTicketsId
};
}
private static final KylinOrderTickets obj = new KylinOrderTickets();
public static KylinOrderTickets getNew() {
try {
return (KylinOrderTickets) obj.clone();
} catch (CloneNotSupportedException e) {
return new KylinOrderTickets();
}
}
}
package com.liquidnet.service.order.controller;
import com.liquidnet.commons.lang.util.HttpOrderUtil;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.codec.annotation.DecryptAndVerify;
import com.liquidnet.service.base.codec.vo.EncryptedReq;
import com.liquidnet.service.kylin.dto.param.PayAgainParam;
import com.liquidnet.service.kylin.dto.param.PayOrderParam;
import com.liquidnet.service.kylin.dto.param.SyncOrderDtoParam;
import com.liquidnet.service.kylin.dto.param.SyncOrderParam;
import com.liquidnet.service.kylin.dto.vo.returns.*;
import com.liquidnet.service.kylin.service.IKylinOrderTicketsOrderService;
......@@ -19,7 +16,6 @@ import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import sun.net.www.http.HttpClient;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
......
......@@ -28,6 +28,7 @@ import com.liquidnet.service.kylin.entity.KylinOrderTicketStatus;
import com.liquidnet.service.kylin.entity.KylinOrderTickets;
import com.liquidnet.service.kylin.service.IKylinOrderTicketsOrderService;
import com.liquidnet.service.order.utils.DataUtils;
import com.liquidnet.service.order.utils.ObjectUtil;
import com.liquidnet.service.order.utils.OrderUtils;
import com.liquidnet.service.order.utils.TaobaoTicketUtils;
import com.mongodb.BasicDBObject;
......@@ -78,8 +79,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
@Autowired
private RedisUtil redisUtil;
@Autowired
private HttpOrderUtil httpOrderUtil;
@Autowired
private OrderUtils orderUtils;
@Autowired
private RedisLockUtil redisLockUtil;
......@@ -105,7 +104,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
public ResponseDto<PayInnerResultVo> checkCanOrder(PayOrderParam payOrderParam) {
Long currentTime;
boolean isDownGeneral = false;
List<AdamEntersVo> entersVoList = new ArrayList<>();
List<AdamEntersVo> entersVoList = ObjectUtil.cloneArrayListObject();
String uid = CurrentUtil.getCurrentUid();
String lock = "userId:" + uid;
// if (!redisLockUtil.tryLock(lock, 1, 5)) {
......@@ -257,7 +256,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
isDownGeneral = true;
//学生票 判断
entersVoList = new ArrayList<>();
entersVoList = ObjectUtil.cloneArrayListObject();
if (isTrueName == 1) {
currentTime = System.currentTimeMillis();
for (String enterId : payOrderParam.getEnterIdList()) {
......@@ -313,7 +312,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
return resultData;
}
} catch (Exception e) {
log.error("Kylin Order Pay Error = ",e);
log.error("Kylin Order Pay Error = ", e);
if (isDownGeneral) {
currentTime = System.currentTimeMillis();
dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber());
......@@ -335,12 +334,12 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
private ResponseDto<PayInnerResultVo> order(PayOrderParam payOrderParam, String uid, boolean isMember, int isTrueName, KylinPerformanceVo performanceData, KylinTicketVo ticketData, List<AdamEntersVo> entersVoList, Integer isStudent, KylinTicketTimesVo ticketTimesData, Long currentTime) {
LinkedList<String> sqls = new LinkedList<>();
LinkedList<String> sqls = ObjectUtil.cloneLinkedListStr();
String source = CurrentUtil.getCliSource() == null ? "" : CurrentUtil.getCliSource();
String version = CurrentUtil.getCliVersion() == null ? "" : CurrentUtil.getCliVersion();
LocalDateTime now = LocalDateTime.now();
//生成订单 order_ticket
KylinOrderTickets orderTickets = new KylinOrderTickets();
KylinOrderTickets orderTickets = KylinOrderTickets.getNew();
String orderTicketId = IDGenerator.nextSnowId();
orderTickets.setOrderTicketsId(orderTicketId);
orderTickets.setUserId(uid);
......@@ -357,15 +356,14 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTickets.setPrice(ticketData.getPrice());
orderTickets.setPriceMember(ticketData.getMemberPrice());
if (isMember) {
orderTickets.setPriceTotal(ticketData.getMemberPrice().multiply(new BigDecimal(payOrderParam.getNumber())).add(payOrderParam.getIsExpress() == 1 ? ticketData.getPriceExpress() : new BigDecimal("0")));
orderTickets.setPriceTotal(ticketData.getMemberPrice().multiply(BigDecimal.valueOf(payOrderParam.getNumber())).add(payOrderParam.getIsExpress() == 1 ? ticketData.getPriceExpress() : BigDecimal.valueOf(0)));
} else {
orderTickets.setPriceTotal(ticketData.getPrice().multiply(new BigDecimal(payOrderParam.getNumber())).add(payOrderParam.getIsExpress() == 1 ? ticketData.getPriceExpress() : new BigDecimal("0")));
orderTickets.setPriceTotal(ticketData.getPrice().multiply(BigDecimal.valueOf(payOrderParam.getNumber())).add(payOrderParam.getIsExpress() == 1 ? ticketData.getPriceExpress() : BigDecimal.valueOf(0)));
}
orderTickets.setPriceActual(orderTickets.getPriceTotal());
orderTickets.setPriceVoucher(new BigDecimal("0.0"));
orderTickets.setPriceVoucher(BigDecimal.valueOf(0.0));
orderTickets.setPriceExpress(ticketData.getPriceExpress());
orderTickets.setPriceRefund(new BigDecimal(0.0));
orderTickets.setPriceRefund(BigDecimal.valueOf(0.0));
orderTickets.setRefundNumber(0);
orderTickets.setPayType(payOrderParam.getPayType());
orderTickets.setPaymentType(null);
......@@ -399,8 +397,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
//生成订单 order_ticket_status
KylinOrderTicketStatus orderTicketStatus = new KylinOrderTicketStatus();
String orderTicketStatusId = IDGenerator.nextSnowId().toString();
KylinOrderTicketStatus orderTicketStatus = KylinOrderTicketStatus.getNew();
String orderTicketStatusId = IDGenerator.nextSnowId();
orderTicketStatus.setOrderTicketStatusId(orderTicketStatusId);
orderTicketStatus.setOrderId(orderTicketId);
orderTicketStatus.setExpressType(payOrderParam.getExpressType());
......@@ -411,11 +409,11 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTicketStatus.setCreatedAt(now);
orderTicketStatus.setUpdatedAt(null);
sqls.add(SqlMapping.get("kylin_order_ticket_status.add"));
LinkedList<Object[]> sqlsDataB = new LinkedList<Object[]>();
LinkedList<Object[]> sqlsDataB = ObjectUtil.cloneLinkedListObj();
sqlsDataB.add(orderTicketStatus.getAddObject());
//生成订单 order_ticket_relation
KylinOrderTicketRelations orderTicketRelations = new KylinOrderTicketRelations();
KylinOrderTicketRelations orderTicketRelations = KylinOrderTicketRelations.getNew();
String orderTicketRelationId = IDGenerator.nextSnowId();
orderTicketRelations.setOrderTicketRelationsId(orderTicketRelationId);
orderTicketRelations.setOrderId(orderTicketId);
......@@ -429,18 +427,17 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTicketRelations.setCreatedAt(now);
orderTicketRelations.setUpdatedAt(null);
sqls.add(SqlMapping.get("kylin_order_ticket_relation.add"));
LinkedList<Object[]> sqlsDataC = new LinkedList<Object[]>();
LinkedList<Object[]> sqlsDataC = ObjectUtil.cloneLinkedListObj();
sqlsDataC.add(orderTicketRelations.getAddObject());
//生成票
KylinOrderTicketEntities orderTicketEntities = new KylinOrderTicketEntities();
LinkedList<Object[]> sqlsDataD = null;
sqlsDataD = new LinkedList<Object[]>();
KylinOrderTicketEntities orderTicketEntities = KylinOrderTicketEntities.getNew();
LinkedList<Object[]> sqlsDataD = ObjectUtil.cloneLinkedListObj();
sqls.add(SqlMapping.get("kylin_order_ticket_entities.add"));
if (isTrueName == 1) {
for (AdamEntersVo enters : entersVoList) {
String orderTicketEntitiesId = IDGenerator.nextSnowId().toString();
String orderTicketEntitiesId = IDGenerator.nextSnowId();
orderTicketEntities.setOrderTicketEntitiesId(orderTicketEntitiesId);
orderTicketEntities.setOrderId(orderTicketId);
orderTicketEntities.setTicketId(payOrderParam.getTicketId());
......@@ -461,7 +458,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTicketEntities.setUpdatedAt(null);
sqlsDataD.add(orderTicketEntities.getAddObject());
// 生成vo
KylinOrderTicketEntitiesVo orderTicketEntitiesVo = new KylinOrderTicketEntitiesVo();
KylinOrderTicketEntitiesVo orderTicketEntitiesVo = KylinOrderTicketEntitiesVo.getNew();
BeanUtils.copyProperties(orderTicketEntities, orderTicketEntitiesVo);
orderTicketEntitiesVo.setPerformanceTitle(performanceData.getTitle());
orderTicketEntitiesVo.setTicketTitle(ticketData.getTitle());
......@@ -503,7 +500,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTicketEntities.setUpdatedAt(null);
sqlsDataD.add(orderTicketEntities.getAddObject());
// 生成vo
KylinOrderTicketEntitiesVo orderTicketEntitiesVo = new KylinOrderTicketEntitiesVo();
KylinOrderTicketEntitiesVo orderTicketEntitiesVo = KylinOrderTicketEntitiesVo.getNew();
BeanUtils.copyProperties(orderTicketEntities, orderTicketEntitiesVo);
orderTicketEntitiesVo.setPerformanceTitle(performanceData.getTitle());
orderTicketEntitiesVo.setTicketTitle(ticketData.getTitle());
......@@ -530,7 +527,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
String useTime = ticketData.getType() == 2 ? time1 + "~" + time2 : time2;
LinkedMultiValueMap<String, String> httpData = new LinkedMultiValueMap<String, String>();
LinkedMultiValueMap<String, String> httpData = ObjectUtil.cloneLinkedMultiValueMapStringAndString();
httpData.add("type", "TICKET");
httpData.add("price", orderTickets.getPriceActual().toString());
httpData.add("name", useTime + ticketData.getTitle() + "-" + performanceData.getTitle());
......@@ -553,7 +550,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
currentTime = System.currentTimeMillis();
String returnData = httpOrderUtil.post(payUrl, httpData);
String returnData = HttpUtil.post(payUrl, httpData);
currentTime = System.currentTimeMillis() - currentTime;
log.debug("调用 DRAGON 支付 -> time:" + (currentTime) + "毫秒");
log.debug("调用 DRAGON 结果 = " + returnData);
......@@ -562,7 +559,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
payResultVo.getData().setPrice(orderTickets.getPriceActual());
orderTickets.setPayCode(payResultVo.getData().getCode());
sqls.add(SqlMapping.get("kylin_order_ticket.add"));
LinkedList<Object[]> sqlsDataA = new LinkedList<>();
LinkedList<Object[]> sqlsDataA = ObjectUtil.cloneLinkedListObj();
sqlsDataA.add(orderTickets.getAddObject());
if (payOrderParam.getPayType().equals("alipay") && payOrderParam.getDeviceFrom().equals("wap")) {
......@@ -570,7 +567,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
payResultVo.getData().setReturnUrl(payOrderParam.getReturnUrl() + orderTicketId);
}
// 生成vo
KylinOrderTicketVo orderTicketVo = new KylinOrderTicketVo();
KylinOrderTicketVo orderTicketVo = KylinOrderTicketVo.getNew();
orderTicketVo.setOrderTicket(orderTickets);
orderTicketVo.setOrderTicketStatus(orderTicketStatus);
orderTicketVo.setOrderTicketRelation(orderTicketRelations);
......@@ -635,7 +632,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
KylinOrderTicketEntitiesVo entitiesData = orderTicketData.getEntitiesVoList().get(0);
LinkedMultiValueMap<String, String> httpData = new LinkedMultiValueMap<String, String>();
LinkedMultiValueMap<String, String> httpData = ObjectUtil.cloneLinkedMultiValueMapStringAndString();
httpData.add("type", "TICKET");
httpData.add("price", orderTicketData.getPriceActual().toString());
httpData.add("name", entitiesData.getUseStart() + "" + entitiesData.getPerformanceTitle());
......@@ -667,14 +664,14 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
payResultVo.getData().setReturnUrl(payAgainParam.getReturnUrl());
}
KylinOrderTickets orderTickets = new KylinOrderTickets();
KylinOrderTickets orderTickets = KylinOrderTickets.getNew();
orderTickets.setOrderTicketsId(payAgainParam.getOrderId());
orderTickets.setUpdatedAt(LocalDateTime.now());
orderTickets.setPayCode(payResultVo.getCode());
orderTickets.setPayType(payAgainParam.getPayType());
//改vo
HashMap<String, Object> map = new HashMap<>();
HashMap<String, Object> map = ObjectUtil.cloneHashMapStringAndObject();
map.put("payType", payAgainParam.getPayType());
map.put("payCode", payResultVo.getCode());
map.put("updatedAt", DateUtil.Formatter.yyyyMMddHHmmss.format(orderTickets.getUpdatedAt()));
......@@ -687,18 +684,18 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
LocalDateTime strTime = orderTicketData.getChangeDate();
dataUtils.delOrderTicketRedis(orderTickets.getOrderTicketsId());
LinkedList<String> sqls = new LinkedList<>();
LinkedList<String> sqls = ObjectUtil.cloneLinkedListStr();
sqls.add(SqlMapping.get("kylin_order_ticket.payAgain"));
LinkedList<Object[]> sqlsDataA = new LinkedList<>();
LinkedList<Object[]> sqlsDataA = ObjectUtil.cloneLinkedListObj();
sqlsDataA.add(orderTickets.getPayAgainObject(strTime, strTime));
sqls.add(SqlMapping.get("kylin_order_ticket_status.payAgain"));
LinkedList<Object[]> sqlsDataB = new LinkedList<>();
LinkedList<Object[]> sqlsDataB = ObjectUtil.cloneLinkedListObj();
sqlsDataB.add(new Object[]{orderTickets.getUpdatedAt(), orderTickets.getOrderTicketsId(), strTime, strTime});
sqls.add(SqlMapping.get("kylin_order_ticket_relation.payAgain"));
LinkedList<Object[]> sqlsDataC = new LinkedList<>();
LinkedList<Object[]> sqlsDataC = ObjectUtil.cloneLinkedListObj();
sqlsDataC.add(new Object[]{orderTickets.getUpdatedAt(), orderTickets.getOrderTicketsId(), strTime, strTime});
sqls.add(SqlMapping.get("kylin_order_ticket_entities.payAgain"));
LinkedList<Object[]> sqlsDataD = new LinkedList<>();
LinkedList<Object[]> sqlsDataD = ObjectUtil.cloneLinkedListObj();
sqlsDataD.add(new Object[]{orderTickets.getUpdatedAt(), orderTickets.getOrderTicketsId(), strTime, strTime});
String sqlData = SqlMapping.gets(sqls, sqlsDataA, sqlsDataB, sqlsDataC, sqlsDataD);
......@@ -749,17 +746,17 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
return "fail";//价格不符
}
LinkedList<String> sqls = new LinkedList<>();
LinkedList<Object[]> sqlsDataA = new LinkedList<>();
LinkedList<Object[]> sqlsDataB = new LinkedList<>();
LinkedList<Object[]> sqlsDataC = new LinkedList<>();
LinkedList<Object[]> sqlsDataD = new LinkedList<>();
LinkedList<String> sqls = ObjectUtil.cloneLinkedListStr();
LinkedList<Object[]> sqlsDataA = ObjectUtil.cloneLinkedListObj();
LinkedList<Object[]> sqlsDataB = ObjectUtil.cloneLinkedListObj();
LinkedList<Object[]> sqlsDataC = ObjectUtil.cloneLinkedListObj();
LinkedList<Object[]> sqlsDataD = ObjectUtil.cloneLinkedListObj();
LocalDateTime strTime = orderTicketData.getChangeDate();
KylinOrderTickets orderTickets = new KylinOrderTickets();
KylinOrderTicketStatus orderTicketStatus = new KylinOrderTicketStatus();
KylinOrderTicketEntities orderTicketEntities = new KylinOrderTicketEntities();
KylinOrderTickets orderTickets = KylinOrderTickets.getNew();
KylinOrderTicketStatus orderTicketStatus = KylinOrderTicketStatus.getNew();
KylinOrderTicketEntities orderTicketEntities = KylinOrderTicketEntities.getNew();
if (orderTicketData.getStatus() == 2) {
orderUtils.resetOrderListVo(orderTicketData.getUserId(), 2, orderTicketData.getOrderTicketsId(), null);
......@@ -795,7 +792,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
sqlsDataD.add(orderTicketEntities.getSynOrderObject(strTime, strTime));
//vo
HashMap<String, Object> orderTicketVo = new HashMap<>();
HashMap<String, Object> orderTicketVo = ObjectUtil.cloneHashMapStringAndObject();
orderTicketVo.put("paymentType", orderTickets.getPaymentType());
orderTicketVo.put("payCode", orderTickets.getPayCode());
orderTicketVo.put("timePay", orderTickets.getTimePay());
......@@ -810,7 +807,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
);
HashMap<String, Object> orderTicketEntitiesVo = new HashMap<>();
HashMap<String, Object> orderTicketEntitiesVo = ObjectUtil.cloneHashMapStringAndObject();
orderTicketEntitiesVo.put("isPayment", KylinTableStatusConst.ENTITIES_IS_PAYMENT1);
orderTicketEntitiesVo.put("updatedAt", timePay);
orderTicketEntitiesVo.put("changeDate", now);
......@@ -845,25 +842,17 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
}
// MessageDataVo dataVo = new MessageDataVo();
// dataVo.setName(orderTicketData.getPerformanceTitle());
String time1 = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketData.getUseStart()), DateUtil.Formatter.yyyy_MM_dd);
String time2 = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(performanceData.getTimeStart()), DateUtil.Formatter.HHmm);
// dataVo.setTime(time1 + " " + time2);
// MessageConfigVo configVo = new MessageConfigVo();
// configVo.setStatus(true);
SmsEnum.ADTemplate adTemplate = null;
if (orderTicketData.getGetTicketType().equals("express")) {
// configVo.setId("SMS_181490473");
adTemplate = SmsEnum.ADTemplate.SMS_181490473;
} else if (orderTicketData.getGetTicketType().equals("electronic")) {
// configVo.setId(ticketData.getIsShowCode() == 1 ? "SMS_171358560" : "SMS_181500419");
adTemplate = ticketData.getIsShowCode() == 1 ? SmsEnum.ADTemplate.SMS_171358560 : SmsEnum.ADTemplate.SMS_181500419;
}
// otherUtils.sendMessage(orderTicketData.getUserMobile(), dataVo, configVo, 1);
if (null != adTemplate) {
rabbitTemplate.convertAndSend(MQConst.EX_LNS_SMS_SENDER, MQConst.RK_SMS_NOTICE,
......
package com.liquidnet.service.order.utils;
import com.liquidnet.service.adam.dto.vo.AdamEntersVo;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: ObjectUtil
* @Package com.liquidnet.service.dragon.utils
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/21 16:00
*/
@Component
public class ObjectUtil {
public static final LinkedList<Object[]> linkedListObj = new LinkedList<Object[]>();
public static final LinkedList<String> linkedListStr = new LinkedList<String>();
public static final HashMap<String, String> hashMapStringAndString = new HashMap<String, String>();
public static final HashMap<String, Object> hashMapStringAndObject = new HashMap<String, Object>();
public static final List<AdamEntersVo> arrayListObject = new ArrayList<>();
public static final LinkedMultiValueMap<String,String> linkedMultiValueMapStringAndString = new LinkedMultiValueMap<String, String>();
public static LinkedList<Object[]> cloneLinkedListObj() {
linkedListObj.clear();
return linkedListObj;
}
public static LinkedList<String> cloneLinkedListStr() {
linkedListStr.clear();
return linkedListStr;
}
public static HashMap<String, String> cloneHashMapStringAndString() {
hashMapStringAndString.clear();
return hashMapStringAndString;
}
public static HashMap<String, Object> cloneHashMapStringAndObject() {
hashMapStringAndObject.clear();
return hashMapStringAndObject;
}
public static List<AdamEntersVo> cloneArrayListObject() {
arrayListObject.clear();
return arrayListObject;
}
public static LinkedMultiValueMap<String,String> cloneLinkedMultiValueMapStringAndString() {
linkedMultiValueMapStringAndString.clear();
return linkedMultiValueMapStringAndString;
}
}
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