提交代码

dev-discount
胡锐 3 years ago
parent e15d32ed8e
commit feb32cd982
  1. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  2. 68
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  3. 16
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  4. 6
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

File diff suppressed because one or more lines are too long

@ -9,18 +9,18 @@ import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator; import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst; import com.hai.config.*;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.TuanYouConfig;
import com.hai.config.UnionStagingPayConfig;
import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighGasOrderPushMapper; import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighPayRecordMapper; import com.hai.dao.HighPayRecordMapper;
import com.hai.dao.HighUserCouponMapper; import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.MerStoreAmountSourceTypeEnum;
import com.hai.enum_type.MerStoreAmountTypeEnum;
import com.hai.enum_type.OrderPushType; import com.hai.enum_type.OrderPushType;
import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.*; import com.hai.service.*;
import com.hai.service.pay.NotifyService; import com.hai.service.pay.NotifyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -29,6 +29,7 @@ import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -47,6 +48,9 @@ public class UnionPayController {
private static Logger log = LoggerFactory.getLogger(UnionPayController.class); private static Logger log = LoggerFactory.getLogger(UnionPayController.class);
@Resource
private RedisTemplate redisTemplate;
@Resource @Resource
private HighOrderService highOrderService; private HighOrderService highOrderService;
@ -280,7 +284,62 @@ public class UnionPayController {
if (highChildOrder.getGoodsType() == 3) { if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3); highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("storeId", highChildOrder.getGoodsId());
pushParam.put("price", order.getTotalPrice());
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
pushParam.put("opUserId", order.getMemId());
pushParam.put("opUserName", order.getMemName());
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
if (StringUtils.isNotBlank(store.getDeviceSn())) {
new Thread(() -> {
try {
SpPrinterConfig sp = new SpPrinterConfig();
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilCashierStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
Thread.sleep(6000);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
} else if (store.getSourceType().equals(2)) {
// 推送团油订单 // 推送团油订单
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey()); paramMap.put("gasId", store.getStoreKey());
@ -315,6 +374,7 @@ public class UnionPayController {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
} }
} }
}
if (highChildOrder.getGoodsType() == 7) { if (highChildOrder.getGoodsType() == 7) {
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId());

@ -378,6 +378,7 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
if (StringUtils.isNotBlank(store.getDeviceSn())) {
new Thread(() -> { new Thread(() -> {
try { try {
SpPrinterConfig sp = new SpPrinterConfig(); SpPrinterConfig sp = new SpPrinterConfig();
@ -392,7 +393,9 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilLiters().toString(),
highOrder.getTotalPrice().toString() highOrder.getTotalPrice().toString()
), 1); ), 1);
Thread.sleep(3000);
Thread.sleep(6000);
sp.print(store.getDeviceSn(), sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp( SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(), highChildOrder.getGoodsName(),
@ -408,6 +411,7 @@ public class HighOrderServiceImpl implements HighOrderService {
e.printStackTrace(); e.printStackTrace();
} }
}).start(); }).start();
}
} else if (store.getSourceType().equals(2)) { } else if (store.getSourceType().equals(2)) {
// 推送团油订单 // 推送团油订单
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
@ -673,6 +677,7 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
if (StringUtils.isNotBlank(store.getDeviceSn())) {
new Thread(() -> { new Thread(() -> {
try { try {
SpPrinterConfig sp = new SpPrinterConfig(); SpPrinterConfig sp = new SpPrinterConfig();
@ -687,7 +692,7 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString() order.getTotalPrice().toString()
), 1); ), 1);
Thread.sleep(3000); Thread.sleep(6000);
sp.print(store.getDeviceSn(), sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp( SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(), highChildOrder.getGoodsName(),
@ -703,6 +708,8 @@ public class HighOrderServiceImpl implements HighOrderService {
e.printStackTrace(); e.printStackTrace();
} }
}).start(); }).start();
}
} else if (store.getSourceType().equals(2)) { } else if (store.getSourceType().equals(2)) {
// 推送团油订单 // 推送团油订单
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
@ -1005,6 +1012,7 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
if (StringUtils.isNotBlank(store.getDeviceSn())) {
new Thread(() -> { new Thread(() -> {
try { try {
SpPrinterConfig sp = new SpPrinterConfig(); SpPrinterConfig sp = new SpPrinterConfig();
@ -1019,7 +1027,7 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString() order.getTotalPrice().toString()
), 1); ), 1);
Thread.sleep(3000); Thread.sleep(6000);
sp.print(store.getDeviceSn(), sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp( SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(), highChildOrder.getGoodsName(),
@ -1035,6 +1043,8 @@ public class HighOrderServiceImpl implements HighOrderService {
e.printStackTrace(); e.printStackTrace();
} }
}).start(); }).start();
}
} else if (store.getSourceType().equals(2)) { } else if (store.getSourceType().equals(2)) {
// 推送团油订单 // 推送团油订单
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();

@ -25,6 +25,7 @@ import com.hai.service.*;
import com.hai.service.pay.NotifyService; import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayService; import com.hai.service.pay.PayService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
@ -298,6 +299,7 @@ public class GoodsOrderServiceImpl implements PayService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
if (StringUtils.isNotBlank(store.getDeviceSn())) {
new Thread(() -> { new Thread(() -> {
try { try {
SpPrinterConfig sp = new SpPrinterConfig(); SpPrinterConfig sp = new SpPrinterConfig();
@ -313,7 +315,7 @@ public class GoodsOrderServiceImpl implements PayService {
order.getTotalPrice().toString() order.getTotalPrice().toString()
), 1); ), 1);
Thread.sleep(3000); Thread.sleep(6000);
sp.print(store.getDeviceSn(), sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp( SpPrinterTemplate.oilClientStubTemp(
@ -330,6 +332,8 @@ public class GoodsOrderServiceImpl implements PayService {
e.printStackTrace(); e.printStackTrace();
} }
}).start(); }).start();
}
} else if (store.getSourceType().equals(2)) { } else if (store.getSourceType().equals(2)) {
// 推送团油订单 // 推送团油订单
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();

Loading…
Cancel
Save