|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.cweb.controller; |
|
|
|
package com.cweb.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
@ -11,11 +13,13 @@ import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.config.TuanYouConfig; |
|
|
|
import com.hai.config.TuanYouConfig; |
|
|
|
import com.hai.dao.HighGasOrderPushMapper; |
|
|
|
import com.hai.dao.HighGasOrderPushMapper; |
|
|
|
|
|
|
|
import com.hai.entity.HighGasDiscountOilPrice; |
|
|
|
import com.hai.entity.HighGasOrderPush; |
|
|
|
import com.hai.entity.HighGasOrderPush; |
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
import com.hai.entity.SecRegion; |
|
|
|
import com.hai.entity.SecRegion; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.service.CommonService; |
|
|
|
import com.hai.service.CommonService; |
|
|
|
|
|
|
|
import com.hai.service.HighGasDiscountOilPriceService; |
|
|
|
import com.hai.service.HighGasOilPriceService; |
|
|
|
import com.hai.service.HighGasOilPriceService; |
|
|
|
import com.hai.service.HighOrderService; |
|
|
|
import com.hai.service.HighOrderService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
@ -47,6 +51,9 @@ public class HighGasController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private CommonService commonService; |
|
|
|
private CommonService commonService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private HighGasDiscountOilPriceService highGasDiscountOilPriceService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighGasOrderPushMapper highGasOrderPushMapper; |
|
|
|
private HighGasOrderPushMapper highGasOrderPushMapper; |
|
|
|
|
|
|
|
|
|
|
@ -100,6 +107,27 @@ public class HighGasController { |
|
|
|
JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(storeKey); |
|
|
|
JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(storeKey); |
|
|
|
if (jsonObject != null && jsonObject.getString("code").equals("200")) { |
|
|
|
if (jsonObject != null && jsonObject.getString("code").equals("200")) { |
|
|
|
JSONObject result = jsonObject.getJSONObject("result"); |
|
|
|
JSONObject result = jsonObject.getJSONObject("result"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 原始油品价格
|
|
|
|
|
|
|
|
JSONArray originalOilPriceList = result.getJSONArray("oilPriceList"); |
|
|
|
|
|
|
|
// 新油品价格
|
|
|
|
|
|
|
|
JSONArray newOilPriceList = new JSONArray(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理油品价格
|
|
|
|
|
|
|
|
for (Object oilPriceObject : originalOilPriceList) { |
|
|
|
|
|
|
|
JSONObject price = JSON.parseObject(JSONObject.toJSONString(oilPriceObject), JSONObject.class); |
|
|
|
|
|
|
|
// 查询是否配置了优惠比例
|
|
|
|
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNoName(price.getString("oilNoName")); |
|
|
|
|
|
|
|
if (gasDiscountOilPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
|
|
|
|
price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(1, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
newOilPriceList.add(price); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
result.put("oilPriceList", newOilPriceList); |
|
|
|
|
|
|
|
|
|
|
|
double distance = CoordCommonUtil.getDistance(Double.valueOf(result.get("gasAddressLatitude").toString()), Double.valueOf(result.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); |
|
|
|
double distance = CoordCommonUtil.getDistance(Double.valueOf(result.get("gasAddressLatitude").toString()), Double.valueOf(result.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); |
|
|
|
result.put("distance", Math.round(distance/100d)/10d); |
|
|
|
result.put("distance", Math.round(distance/100d)/10d); |
|
|
|
return ResponseMsgUtil.success(jsonObject.get("result")); |
|
|
|
return ResponseMsgUtil.success(jsonObject.get("result")); |
|
|
@ -112,7 +140,7 @@ public class HighGasController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getGasPriceDetail",method = RequestMethod.GET) |
|
|
|
/* @RequestMapping(value="/getGasPriceDetail",method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "根据门店key和油号 查询油价") |
|
|
|
@ApiOperation(value = "根据门店key和油号 查询油价") |
|
|
|
public ResponseData getGasPriceDetail(@RequestParam(name = "storeKey", required = true) String storeKey, |
|
|
|
public ResponseData getGasPriceDetail(@RequestParam(name = "storeKey", required = true) String storeKey, |
|
|
@ -124,7 +152,7 @@ public class HighGasController { |
|
|
|
if(jsonObject.getJSONArray("result").size() == 0) { |
|
|
|
if(jsonObject.getJSONArray("result").size() == 0) { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到价格信息"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到价格信息"); |
|
|
|
} |
|
|
|
} |
|
|
|
return ResponseMsgUtil.success(jsonObject.get("result")); |
|
|
|
return ResponseMsgUtil.success(jsonObject); |
|
|
|
} |
|
|
|
} |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到价格信息"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到价格信息"); |
|
|
|
|
|
|
|
|
|
|
@ -132,7 +160,7 @@ public class HighGasController { |
|
|
|
log.error("HighGasController -> getGasPriceDetail() error!",e); |
|
|
|
log.error("HighGasController -> getGasPriceDetail() error!",e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/refuelingOrderRefund",method = RequestMethod.POST) |
|
|
|
@RequestMapping(value="/refuelingOrderRefund",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
@ -174,7 +202,7 @@ public class HighGasController { |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/refuelingOrderPush",method = RequestMethod.GET) |
|
|
|
@RequestMapping(value="/refuelingOrderPush",method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "推送订单") |
|
|
|
@ApiOperation(value = "手动推送订单") |
|
|
|
public ResponseData refuelingOrderPush() { |
|
|
|
public ResponseData refuelingOrderPush() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
@ -221,39 +249,4 @@ public class HighGasController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/queryThirdOrderDretail",method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "查询订单信息") |
|
|
|
|
|
|
|
public ResponseData queryThirdOrderDretail() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(TuanYouConfig.queryThirdOrderDretail("1624611159129")); |
|
|
|
|
|
|
|
//return ResponseMsgUtil.success(map);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighGasController -> queryThirdOrderDretail() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/test",method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "测试") |
|
|
|
|
|
|
|
public ResponseData test() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String data = "{\"data\":\"ui2KbK5jpLtw7YaA52uSt1TzDpaE5OjeW5O6xg+saM4nN4aVnpoT1aTgJwQt/DuNSbs7LrX6q1B0cpW5T531ltYl1ERxyKXqZyMKBNWzDFuB5QSww22VGfypchGNm+oW\",\"timestamp\":1624611912047,\"companyCode\":\"208241666939552\"}"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data, JSONObject.class); |
|
|
|
|
|
|
|
//return ResponseMsgUtil.success(AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(jsonObject.getString("data")), SysConst.getSysConfig().getTuanYouAppSecret()));
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(CommonSysConst.getSysConfig().getTuanYouUrl()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighGasController -> queryThirdOrderDretail() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|