|
@@ -26,7 +26,6 @@ import org.jeecg.modules.app.service.IOrderService;
|
|
|
import org.jeecg.modules.app.vo.AppGameScheduleVO;
|
|
|
import org.jeecg.modules.app.vo.OrderVO;
|
|
|
import org.jeecg.modules.app.vo.QueryOrderVerifyRecordsVO;
|
|
|
-import org.jeecg.modules.pay.V3LabsApi;
|
|
|
import org.jeecg.modules.pay.vo.NotifyRequest;
|
|
|
import org.jeecg.modules.pay.vo.NotifyResponse;
|
|
|
import org.jeecg.modules.redission.RedissonDelayQueue;
|
|
@@ -44,6 +43,8 @@ import java.time.LocalTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -455,6 +456,8 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
AppSitePlace appSitePlace = appSitePlaceMapper.selectById(priceRule.getSitePlaceId());
|
|
|
AppSite appSite = appSiteMapper.selectById(appSitePlace.getSiteId());
|
|
|
|
|
|
+ appOrder.setOrgCode(appSite.getOrgCode());
|
|
|
+
|
|
|
String date = list.get(i).split("\\|")[1];
|
|
|
String startTime = DateUtil.format(priceRule.getStartTime(), "HH:mm:ss");
|
|
|
String endTime = DateUtil.format(priceRule.getEndTime(), "HH:mm:ss");
|
|
@@ -667,6 +670,9 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
appCoursesVerificationRecord.setCoursesEndTime(appCoursesPriceRules.getEndTime());
|
|
|
appCoursesVerificationRecord.setUseUserId(familyUserId);
|
|
|
appCoursesVerificationRecord.setUseUserName(familyMembers.getFullName());
|
|
|
+ appCoursesVerificationRecord.setUseUserPhone(familyMembers.getPhone());
|
|
|
+ appCoursesVerificationRecord.setUseUserImage(familyMembers.getRealNameImg());
|
|
|
+ appCoursesVerificationRecord.setUseUserName(familyMembers.getFullName());
|
|
|
appCoursesVerificationRecord.setVerifyStatus(0);
|
|
|
appCoursesVerificationRecord.setOrPostpone(0);
|
|
|
appCoursesVerificationRecord.setCoursesType(appCoursesPriceRules.getCoursesType());
|
|
@@ -770,6 +776,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
AppIsin appIsin = new AppIsin();
|
|
|
appIsin
|
|
|
.setOrderId(appOrder.getId())
|
|
|
+ .setOrgCode(appOrder.getOrgCode())
|
|
|
.setOrderCode(appOrder.getOrderCode())
|
|
|
.setOrderProInfoId(appOrderProInfo.getId())
|
|
|
.setFamilyId(appOrderProInfo.getFamilyUserId())
|
|
@@ -816,16 +823,96 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
Integer quantity = appOrder.getAmount();
|
|
|
|
|
|
//拉卡拉预支付订单,返回构建小程序支付拉起参数
|
|
|
- String res = V3LabsApi.transPreorder_wxpay_applet(out_trade_no, total_amount, request_ip, subject, notify_url, sub_appid, user_id, goods_id, goods_name, quantity);
|
|
|
- payForm.setParams(res);
|
|
|
+// String res = V3LabsApi.transPreorder_wxpay_applet(out_trade_no, total_amount, request_ip, subject, notify_url, sub_appid, user_id, goods_id, goods_name, quantity);
|
|
|
+// payForm.setParams(res);
|
|
|
|
|
|
//发布任务到redission延迟队列
|
|
|
String task = CommonConstant.ORDER_TIME_OUT_TASK_PREFIX + appOrder.getId();
|
|
|
- redissonDelayQueue.offerTask(task, 60 * 15);
|
|
|
+ redissonDelayQueue.offerTask(task, 60 * 3);
|
|
|
|
|
|
return payForm;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 异步走保存下单信息
|
|
|
+ * @param appOrder
|
|
|
+ * @param proInfoList
|
|
|
+ * @param insureOrderInfoList
|
|
|
+ * @param appCoursesVerificationRecordList
|
|
|
+ */
|
|
|
+ public void remoteSaveOrderInfo(final AppOrder appOrder,
|
|
|
+ final List<AppOrderProInfo> proInfoList,
|
|
|
+ final List<InsureOrderInfo> insureOrderInfoList,
|
|
|
+ final List<AppCoursesVerificationRecord> appCoursesVerificationRecordList) {
|
|
|
+
|
|
|
+ //开启线程池保存订单信息
|
|
|
+ remoteSaveOrderInfo(appOrder,proInfoList,insureOrderInfoList,appCoursesVerificationRecordList);
|
|
|
+
|
|
|
+ //创建一个可重用固定线程数的线程池
|
|
|
+ ExecutorService cachedThreadPool = Executors.newFixedThreadPool(20); //固定大小的线程池
|
|
|
+
|
|
|
+ cachedThreadPool.execute(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run(){
|
|
|
+ log.info("======>[保存订单商品信息] 线程<======");
|
|
|
+ log.info("======>当前线程 NAME ="+Thread.currentThread().getName());
|
|
|
+ log.info("======>当前线程 ID ="+Thread.currentThread().getId());
|
|
|
+ log.info("======>当前线程 Count ="+Thread.activeCount());
|
|
|
+
|
|
|
+ try {
|
|
|
+ Thread.sleep(500);//线程延迟0.5秒
|
|
|
+ saveSignFlowRecord(appOrder);
|
|
|
+ // 优化异步执行 -> 保存订单商品信息
|
|
|
+ for (AppOrderProInfo appOrderProInfo : proInfoList) {
|
|
|
+ appOrderProInfo
|
|
|
+ .setOrderId(appOrder.getId())
|
|
|
+ .setOrderCode(appOrder.getOrderCode())
|
|
|
+ //生成10位随机券号
|
|
|
+ .setTicketNo(RandomUtil.randomNumbers(10))
|
|
|
+ ;
|
|
|
+ appOrderProInfoMapper.insert(appOrderProInfo);
|
|
|
+ //订单券号记录
|
|
|
+ AppIsin appIsin = new AppIsin();
|
|
|
+ appIsin
|
|
|
+ .setOrderId(appOrder.getId())
|
|
|
+ .setOrderCode(appOrder.getOrderCode())
|
|
|
+ .setOrderProInfoId(appOrderProInfo.getId())
|
|
|
+ .setFamilyId(appOrderProInfo.getFamilyUserId())
|
|
|
+ .setFamilyUserName(appOrderProInfo.getUserName())
|
|
|
+ .setUserPhone(appOrderProInfo.getUserPhone())
|
|
|
+ .setUseAddress(StrUtil.isBlank(appOrderProInfo.getAddress()) ? null : appOrderProInfo.getAddress())
|
|
|
+ //过期时间
|
|
|
+ .setExpireTime(appOrderProInfo.getExpireTime())
|
|
|
+ //生成10位随机券号
|
|
|
+ .setTicketNo(appOrderProInfo.getTicketNo())
|
|
|
+ .setIsinStatus(CommonConstant.ISIN_STATUS_1);
|
|
|
+ appIsinMapper.insert(appIsin);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存保险
|
|
|
+ for (InsureOrderInfo insureOrderInfo : insureOrderInfoList) {
|
|
|
+ insureOrderInfo.setOrderId(appOrder.getId());
|
|
|
+ insureOrderInfoMapper.insert(insureOrderInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存核销记录
|
|
|
+ for (AppCoursesVerificationRecord appCoursesVerificationRecord : appCoursesVerificationRecordList) {
|
|
|
+ appCoursesVerificationRecord.setOrderId(appOrder.getId());
|
|
|
+ appCoursesVerificationRecord.setOrderCode(appOrder.getOrderCode());
|
|
|
+ appCoursesVerificationRecordMapper.insert(appCoursesVerificationRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //关闭线程池
|
|
|
+ cachedThreadPool.shutdown();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存签署流程记录
|
|
|
*/
|