提交代码

dev-discount
胡锐 3 years ago
parent e15d32ed8e
commit feb32cd982
  1. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  2. 132
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  3. 190
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  4. 68
      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,39 +284,95 @@ 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());
// 推送团油订单
Map<String,Object> paramMap = new HashMap<>(); // 来源类型 1:平台自建 2:团油
paramMap.put("gasId", store.getStoreKey()); if (store.getSourceType().equals(1)) {
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo()); // 预存类型 0:非预存 1:预存门店
BigDecimal priceGun = highChildOrder.getGasPriceGun(); if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
BigDecimal priceVip = highChildOrder.getGasPriceVip(); Map<String, Object> pushParam = new HashMap<>();
paramMap.put("priceGun", priceGun); // 枪单价 pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
paramMap.put("priceVip", priceVip); // 优惠价 pushParam.put("storeId", highChildOrder.getGoodsId());
paramMap.put("driverPhone", order.getMemPhone()); pushParam.put("price", order.getTotalPrice());
paramMap.put("thirdSerialNo", order.getOrderNo()); pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气 pushParam.put("opUserId", order.getMemId());
if (highChildOrder.getGasOilType() == 1) { pushParam.put("opUserName", order.getMemName());
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); // 扣预存款
} else if (highChildOrder.getGasOilType() == 2) { this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); }
} if (StringUtils.isNotBlank(store.getDeviceSn())) {
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); new Thread(() -> {
// 推送团油订单记录 try {
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); SpPrinterConfig sp = new SpPrinterConfig();
highGasOrderPush.setType(OrderPushType.type1.getType()); sp.print(store.getDeviceSn(),
highGasOrderPush.setOrderNo(order.getOrderNo()); SpPrinterTemplate.oilCashierStubTemp(
highGasOrderPush.setCreateTime(new Date()); highChildOrder.getGoodsName(),
highGasOrderPush.setCode(orderPushObject.getString("code")); order.getOrderNo(),
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); "嗨森逛",
highGasOrderPushMapper.insert(highGasOrderPush); highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.getGasOilLiters().toString(),
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); 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<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", order.getMemPhone());
paramMap.put("thirdSerialNo", order.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
} }
} }

@ -378,36 +378,40 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
new Thread(() -> { if (StringUtils.isNotBlank(store.getDeviceSn())) {
try { new Thread(() -> {
SpPrinterConfig sp = new SpPrinterConfig(); try {
sp.print(store.getDeviceSn(), SpPrinterConfig sp = new SpPrinterConfig();
SpPrinterTemplate.oilCashierStubTemp( sp.print(store.getDeviceSn(),
highChildOrder.getGoodsName(), SpPrinterTemplate.oilCashierStubTemp(
highOrder.getOrderNo(), highChildOrder.getGoodsName(),
DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), highOrder.getOrderNo(),
"嗨森逛", DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasGunNo(), "嗨森逛",
highChildOrder.getGasOilNo(), highChildOrder.getGasGunNo(),
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilNo(),
highOrder.getTotalPrice().toString() highChildOrder.getGasOilLiters().toString(),
), 1); highOrder.getTotalPrice().toString()
Thread.sleep(3000); ), 1);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp( Thread.sleep(6000);
highChildOrder.getGoodsName(),
highOrder.getOrderNo(), sp.print(store.getDeviceSn(),
DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), SpPrinterTemplate.oilClientStubTemp(
"嗨森逛", highChildOrder.getGoodsName(),
highChildOrder.getGasGunNo(), highOrder.getOrderNo(),
highChildOrder.getGasOilNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasOilLiters().toString(), "嗨森逛",
highOrder.getTotalPrice().toString() highChildOrder.getGasGunNo(),
), 1); highChildOrder.getGasOilNo(),
} catch (Exception e) { highChildOrder.getGasOilLiters().toString(),
e.printStackTrace(); highOrder.getTotalPrice().toString()
} ), 1);
}).start(); } catch (Exception e) {
e.printStackTrace();
}
}).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,36 +677,39 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
new Thread(() -> { if (StringUtils.isNotBlank(store.getDeviceSn())) {
try { new Thread(() -> {
SpPrinterConfig sp = new SpPrinterConfig(); try {
sp.print(store.getDeviceSn(), SpPrinterConfig sp = new SpPrinterConfig();
SpPrinterTemplate.oilCashierStubTemp( sp.print(store.getDeviceSn(),
highChildOrder.getGoodsName(), SpPrinterTemplate.oilCashierStubTemp(
order.getOrderNo(), highChildOrder.getGoodsName(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"), order.getOrderNo(),
"嗨森逛", DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasGunNo(), "嗨森逛",
highChildOrder.getGasOilNo(), highChildOrder.getGasGunNo(),
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilNo(),
order.getTotalPrice().toString() highChildOrder.getGasOilLiters().toString(),
), 1); order.getTotalPrice().toString()
Thread.sleep(3000); ), 1);
sp.print(store.getDeviceSn(), Thread.sleep(6000);
SpPrinterTemplate.oilClientStubTemp( sp.print(store.getDeviceSn(),
highChildOrder.getGoodsName(), SpPrinterTemplate.oilClientStubTemp(
order.getOrderNo(), highChildOrder.getGoodsName(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"), order.getOrderNo(),
"嗨森逛", DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasGunNo(), "嗨森逛",
highChildOrder.getGasOilNo(), highChildOrder.getGasGunNo(),
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilNo(),
order.getTotalPrice().toString() highChildOrder.getGasOilLiters().toString(),
), 1); order.getTotalPrice().toString()
} catch (Exception e) { ), 1);
e.printStackTrace(); } catch (Exception e) {
} 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,36 +1012,39 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
new Thread(() -> { if (StringUtils.isNotBlank(store.getDeviceSn())) {
try { new Thread(() -> {
SpPrinterConfig sp = new SpPrinterConfig(); try {
sp.print(store.getDeviceSn(), SpPrinterConfig sp = new SpPrinterConfig();
SpPrinterTemplate.oilCashierStubTemp( sp.print(store.getDeviceSn(),
highChildOrder.getGoodsName(), SpPrinterTemplate.oilCashierStubTemp(
order.getOrderNo(), highChildOrder.getGoodsName(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"), order.getOrderNo(),
"嗨森逛", DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasGunNo(), "嗨森逛",
highChildOrder.getGasOilNo(), highChildOrder.getGasGunNo(),
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilNo(),
order.getTotalPrice().toString() highChildOrder.getGasOilLiters().toString(),
), 1); order.getTotalPrice().toString()
Thread.sleep(3000); ), 1);
sp.print(store.getDeviceSn(), Thread.sleep(6000);
SpPrinterTemplate.oilClientStubTemp( sp.print(store.getDeviceSn(),
highChildOrder.getGoodsName(), SpPrinterTemplate.oilClientStubTemp(
order.getOrderNo(), highChildOrder.getGoodsName(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"), order.getOrderNo(),
"嗨森逛", DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasGunNo(), "嗨森逛",
highChildOrder.getGasOilNo(), highChildOrder.getGasGunNo(),
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilNo(),
order.getTotalPrice().toString() highChildOrder.getGasOilLiters().toString(),
), 1); order.getTotalPrice().toString()
} catch (Exception e) { ), 1);
e.printStackTrace(); } catch (Exception e) {
} 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,38 +299,41 @@ public class GoodsOrderServiceImpl implements PayService {
// 扣预存款 // 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
} }
new Thread(() -> { if (StringUtils.isNotBlank(store.getDeviceSn())) {
try { new Thread(() -> {
SpPrinterConfig sp = new SpPrinterConfig(); try {
sp.print(store.getDeviceSn(), SpPrinterConfig sp = new SpPrinterConfig();
SpPrinterTemplate.oilCashierStubTemp( sp.print(store.getDeviceSn(),
highChildOrder.getGoodsName(), SpPrinterTemplate.oilCashierStubTemp(
order.getOrderNo(), highChildOrder.getGoodsName(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"), order.getOrderNo(),
"嗨森逛", DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasGunNo(), "嗨森逛",
highChildOrder.getGasOilNo(), highChildOrder.getGasGunNo(),
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilNo(),
order.getTotalPrice().toString() highChildOrder.getGasOilLiters().toString(),
), 1); order.getTotalPrice().toString()
), 1);
Thread.sleep(3000);
Thread.sleep(6000);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp( sp.print(store.getDeviceSn(),
highChildOrder.getGoodsName(), SpPrinterTemplate.oilClientStubTemp(
order.getOrderNo(), highChildOrder.getGoodsName(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"), order.getOrderNo(),
"嗨森逛", DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
highChildOrder.getGasGunNo(), "嗨森逛",
highChildOrder.getGasOilNo(), highChildOrder.getGasGunNo(),
highChildOrder.getGasOilLiters().toString(), highChildOrder.getGasOilNo(),
order.getTotalPrice().toString() highChildOrder.getGasOilLiters().toString(),
), 1); order.getTotalPrice().toString()
} catch (Exception e) { ), 1);
e.printStackTrace(); } catch (Exception e) {
} 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