提交代码

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.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.TuanYouConfig;
import com.hai.config.UnionStagingPayConfig;
import com.hai.config.*;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighPayRecordMapper;
import com.hai.dao.HighUserCouponMapper;
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.model.HighMerchantStoreModel;
import com.hai.model.ResponseData;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.*;
import com.hai.service.pay.NotifyService;
import io.swagger.annotations.Api;
@ -29,6 +29,7 @@ import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -47,6 +48,9 @@ public class UnionPayController {
private static Logger log = LoggerFactory.getLogger(UnionPayController.class);
@Resource
private RedisTemplate redisTemplate;
@Resource
private HighOrderService highOrderService;
@ -280,39 +284,95 @@ public class UnionPayController {
if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 推送团油订单
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"));
// 来源类型 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<>();
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);
}
new Thread(() -> {
try {
SpPrinterConfig sp = new SpPrinterConfig();
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilCashierStubTemp(
highChildOrder.getGoodsName(),
highOrder.getOrderNo(),
DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
highOrder.getTotalPrice().toString()
), 1);
Thread.sleep(3000);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(),
highOrder.getOrderNo(),
DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
highOrder.getTotalPrice().toString()
), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
if (StringUtils.isNotBlank(store.getDeviceSn())) {
new Thread(() -> {
try {
SpPrinterConfig sp = new SpPrinterConfig();
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilCashierStubTemp(
highChildOrder.getGoodsName(),
highOrder.getOrderNo(),
DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
highOrder.getTotalPrice().toString()
), 1);
Thread.sleep(6000);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(),
highOrder.getOrderNo(),
DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
highOrder.getTotalPrice().toString()
), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String,Object> paramMap = new HashMap<>();
@ -673,36 +677,39 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
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(3000);
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();
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<>();
@ -1005,36 +1012,39 @@ public class HighOrderServiceImpl implements HighOrderService {
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
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(3000);
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();
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<>();

@ -25,6 +25,7 @@ import com.hai.service.*;
import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
@ -298,38 +299,41 @@ public class GoodsOrderServiceImpl implements PayService {
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
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(3000);
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();
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<>();

Loading…
Cancel
Save