提交代码

dev-discount
胡锐 3 years ago
parent 4b6a0f0cfd
commit 6d838a7ed9
  1. 2
      hai-bweb/src/main/resources/dev/application.yml
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  3. 8
      hai-service/src/main/java/com/hai/config/SpPrinterTemplate.java
  4. 1
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  5. 9
      hai-service/src/main/java/com/hai/model/GasOrderModel.java
  6. 45
      hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java
  7. 55
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -28,7 +28,7 @@ spring:
poolPreparedStatements: true poolPreparedStatements: true
maxOpenPreparedStatements: 20 maxOpenPreparedStatements: 20
redis: redis:
database: 5 database: 0
host: 139.159.177.244 host: 139.159.177.244
port: 36379 port: 36379
password: HF123456.Redis password: HF123456.Redis

@ -238,7 +238,7 @@ public class HighGasController {
// 查询油枪 // 查询油枪
List<Map<String, Object>> gasGunMapList = new ArrayList<>(); List<Map<String, Object>> gasGunMapList = new ArrayList<>();
Map<String, Object> gasGunMap; Map<String, Object> gasGunMap;
List<HighGasOilGunNo> oilGunNoList = gasOilGunNoService.getGunNoListByOilPrice(store.getId()); List<HighGasOilGunNo> oilGunNoList = gasOilGunNoService.getGunNoListByStoreId(store.getId());
for (HighGasOilGunNo oilGunNo : oilGunNoList) { for (HighGasOilGunNo oilGunNo : oilGunNoList) {
gasGunMap = new HashMap<>(); gasGunMap = new HashMap<>();
gasGunMap.put("gunNo", oilGunNo.getGunNo()); gasGunMap.put("gunNo", oilGunNo.getGunNo());

@ -56,8 +56,8 @@ public class SpPrinterTemplate {
"升数:" + oilLiters +"升<BR>" + "升数:" + oilLiters +"升<BR>" +
"实际加油升数以油站加油机为准!<BR>" + "实际加油升数以油站加油机为准!<BR>" +
"------------------------------<BR>" + "------------------------------<BR>" +
"<L2>加油金额</L2><BR>" + "<L1>加油金额</L1><BR>" +
"<L2>¥" + orderPrice + "元</L2><BR>" + "<L1>¥" + orderPrice + "元</L1><BR>" +
"------------------------------<BR>" + "------------------------------<BR>" +
"<C>来"嗨森逛“;开心又省钱</C>"; "<C>来"嗨森逛“;开心又省钱</C>";
return str; return str;
@ -95,8 +95,8 @@ public class SpPrinterTemplate {
"升数:" + oilLiters +"升<BR>" + "升数:" + oilLiters +"升<BR>" +
"实际加油升数以油站加油机为准!<BR>" + "实际加油升数以油站加油机为准!<BR>" +
"------------------------------<BR>" + "------------------------------<BR>" +
"<L2>加油金额</L2><BR>" + "<L1>加油金额</L1><BR>" +
"<L2>¥" + orderPrice + "元</L2><BR>" + "<L1>¥" + orderPrice + "元</L1><BR>" +
"------------------------------<BR>" + "------------------------------<BR>" +
"<C>来"嗨森逛“;开心又省钱</C>"; "<C>来"嗨森逛“;开心又省钱</C>";
return str; return str;

@ -1094,6 +1094,7 @@ public interface HighOrderMapperExt {
" a.goods_name gasName," + " a.goods_name gasName," +
" (select address from high_merchant_store where id = a.goods_id) gasAddress," + " (select address from high_merchant_store where id = a.goods_id) gasAddress," +
" (select store_logo from high_merchant_store where id = a.goods_id) gasLogo," + " (select store_logo from high_merchant_store where id = a.goods_id) gasLogo," +
" a.gas_oil_type gasOilType," +
" a.gas_oil_no gasOilNo," + " a.gas_oil_no gasOilNo," +
" a.gas_gun_no gasGunNo," + " a.gas_gun_no gasGunNo," +
" a.gas_price_gun gasPriceGun," + " a.gas_price_gun gasPriceGun," +

@ -19,6 +19,7 @@ public class GasOrderModel {
private String gasLogo; private String gasLogo;
private String gasName; private String gasName;
private String gasAddress; private String gasAddress;
private String gasOilType;
private String gasOilNo; private String gasOilNo;
private String gasGunNo; private String gasGunNo;
private String gasOilLiters; private String gasOilLiters;
@ -31,6 +32,14 @@ public class GasOrderModel {
private Date payTime; private Date payTime;
private Date refundTime; private Date refundTime;
public String getGasOilType() {
return gasOilType;
}
public void setGasOilType(String gasOilType) {
this.gasOilType = gasOilType;
}
public String getOrderNo() { public String getOrderNo() {
return orderNo; return orderNo;
} }

@ -105,6 +105,10 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
if (store == null) { if (store == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站");
} }
// 是否是加油站
if (!store.getType().equals(1)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站");
}
// 优惠比例 // 优惠比例
BigDecimal discount = new BigDecimal("100"); BigDecimal discount = new BigDecimal("100");
@ -129,26 +133,39 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
} }
} }
discount = discount.divide(new BigDecimal("100")); discount = discount.divide(new BigDecimal("100"));
// 枪价
// 查询油站油品价格 BigDecimal priceGun = null;
JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo); // 优惠价
if (oilPriceObject == null) { BigDecimal priceVip = null;
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格");
} // 来源类型 1:平台自建 2:团油
JSONArray oilPriceObjectArray = oilPriceObject.getJSONArray("result"); if (store.getSourceType().equals(2)) {
if (oilPriceObjectArray.size() == 0) { // 查询油站油品价格
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo);
if (oilPriceObject == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格");
}
JSONArray oilPriceObjectArray = oilPriceObject.getJSONArray("result");
if (oilPriceObjectArray.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格");
}
JSONObject priceDetail = (JSONObject) oilPriceObjectArray.get(0);
// 团油枪价
priceGun = priceDetail.getBigDecimal("priceGun");
// 团油优惠价
priceVip = priceDetail.getBigDecimal("priceVip");
} }
HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo)); HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo));
if (gasOilPrice == null) { if (gasOilPrice == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格");
} }
if (priceGun == null) {
priceGun = gasOilPrice.getPriceGun();
}
if (priceVip == null) {
priceVip = gasOilPrice.getPriceVip();
}
JSONObject priceDetail = (JSONObject) oilPriceObjectArray.get(0);
// 团油枪价
BigDecimal priceGun = priceDetail.getBigDecimal("priceGun");
// 团油优惠价
BigDecimal priceVip = priceDetail.getBigDecimal("priceVip");
// 团油国标价 // 团油国标价
BigDecimal priceOfficial = gasOilPrice.getPriceOfficial(); BigDecimal priceOfficial = gasOilPrice.getPriceOfficial();
// 嗨森逛平台价 国标价 * 折扣 // 嗨森逛平台价 国标价 * 折扣

@ -357,6 +357,7 @@ public class HighOrderServiceImpl implements HighOrderService {
if (highChildOrder.getGoodsType() == 3) { if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3); highChildOrder.setChildOrdeStatus(3);
highOrder.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 来源类型 1:平台自建 2:团油 // 来源类型 1:平台自建 2:团油
@ -439,43 +440,6 @@ public class HighOrderServiceImpl implements HighOrderService {
} }
} }
} }
/* if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(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", highOrder.getMemPhone());
paramMap.put("thirdSerialNo", highOrder.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(highOrder.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"));
}
}*/
if (highChildOrder.getGoodsType() == 7) { if (highChildOrder.getGoodsType() == 7) {
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId());
@ -506,13 +470,16 @@ public class HighOrderServiceImpl implements HighOrderService {
updateOrder(highOrder); updateOrder(highOrder);
if (highOrder.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
Map<String, Object> message = new HashMap<>(); new Thread(() -> {
message.put("order", highOrderService.getOrderByOrderNo(highOrder.getOrderNo())); if (highOrder.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
message.put("voice", baiduVoiceService.text2audio(highOrder.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + highOrder.getTotalPrice())); Map<String, Object> message = new HashMap<>();
webSocket.SenderMessage(highOrder.getHighChildOrderList().get(0).getGoodsId().toString() message.put("order", highOrderService.getGasOrderDetail(highOrder.getOrderNo()));
, JSONObject.toJSONString(message)); message.put("voice", baiduVoiceService.text2audio(highOrder.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + highOrder.getTotalPrice()));
} webSocket.SenderMessage(highOrder.getHighChildOrderList().get(0).getGoodsId().toString()
, JSONObject.toJSONString(message));
}
}).start();
} }
@Override @Override

Loading…
Cancel
Save