|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
|
import com.hai.common.utils.RedisUtil; |
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hai.entity.*; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
@ -60,12 +61,17 @@ public class RefuelOnlineController { |
|
|
|
|
@Resource |
|
|
|
|
private ApiCommonConfig apiCommonConfig; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private RedisUtil redisUtil; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getStationStore", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "获取油站门店") |
|
|
|
|
public ResponseData getStationStore(@RequestBody JSONObject object , HttpServletRequest request ) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String ip = ""; |
|
|
|
|
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
|
|
|
|
|
if (request.getHeader("x-forwarded-for") == null) { |
|
|
|
@ -82,10 +88,10 @@ public class RefuelOnlineController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { |
|
|
|
|
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
|
} |
|
|
|
|
// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
|
|
|
|
|
// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
|
|
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); |
|
|
|
|
|
|
|
|
@ -108,6 +114,12 @@ public class RefuelOnlineController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<ApiMchStoreModel> apiMchStoreModels; |
|
|
|
|
|
|
|
|
|
apiMchStoreModels = (List<ApiMchStoreModel>) redisUtil.get("stationStoreApi"); |
|
|
|
|
|
|
|
|
|
if (apiMchStoreModels == null) { |
|
|
|
|
apiMchStoreModels = new ArrayList<>(); |
|
|
|
|
Map<String, Object> mapProduct = new HashMap<>(); |
|
|
|
|
mapProduct.put("mchId" , object.getString("merchId")); |
|
|
|
|
mapProduct.put("productType" , OrderProductType.PRODUCT_TYPE6.getNumber()); |
|
|
|
@ -124,7 +136,7 @@ public class RefuelOnlineController { |
|
|
|
|
merchantStores.addAll(highMerchantStoreService.getMerchantStoreList(mapMerchant)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<ApiMchStoreModel> apiMchStoreModels = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (HighMerchantStore merchantStore : merchantStores) { |
|
|
|
|
ApiMchStoreModel apiMchStoreModel = new ApiMchStoreModel(); |
|
|
|
@ -156,6 +168,9 @@ public class RefuelOnlineController { |
|
|
|
|
apiMchStoreModel.setApiGasOliPriceModels(list); |
|
|
|
|
apiMchStoreModels.add(apiMchStoreModel); |
|
|
|
|
} |
|
|
|
|
redisUtil.set("stationStoreApi", apiMchStoreModels); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(apiMchStoreModels); |
|
|
|
|
|
|
|
|
|