|
|
@ -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")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|