|
|
@ -7,13 +7,12 @@ import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
|
|
|
|
import com.hai.openApi.model.ApiGasOliPriceModel; |
|
|
|
import com.hai.openApi.model.ApiMchStoreModel; |
|
|
|
import com.hai.openApi.model.ApiMchStoreModel; |
|
|
|
import com.hai.openApi.service.ApiMchProductService; |
|
|
|
import com.hai.openApi.service.ApiMchProductService; |
|
|
|
import com.hai.order.type.OrderProductType; |
|
|
|
import com.hai.order.type.OrderProductType; |
|
|
|
import com.hai.service.ApiIpAddressService; |
|
|
|
import com.hai.service.*; |
|
|
|
import com.hai.service.ApiMerchantsService; |
|
|
|
import com.v1.config.ApiCommonConfig; |
|
|
|
import com.hai.service.HighMerchantStoreService; |
|
|
|
|
|
|
|
import com.hai.service.SecConfigService; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -55,6 +54,12 @@ public class RefuelOnlineController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighMerchantStoreService highMerchantStoreService; |
|
|
|
private HighMerchantStoreService highMerchantStoreService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private HighGasOilPriceService gasOilPriceService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private ApiCommonConfig apiCommonConfig; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getStationStores", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/getStationStores", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "获取油站门店") |
|
|
|
@ApiOperation(value = "获取油站门店") |
|
|
@ -69,11 +74,6 @@ public class RefuelOnlineController { |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(object.getString("apiKey")) || |
|
|
|
if (StringUtils.isBlank(object.getString("apiKey")) || |
|
|
|
StringUtils.isBlank(object.getString("merchId")) || |
|
|
|
StringUtils.isBlank(object.getString("merchId")) || |
|
|
|
StringUtils.isBlank(object.getString("sign")) |
|
|
|
StringUtils.isBlank(object.getString("sign")) |
|
|
@ -82,6 +82,11 @@ public class RefuelOnlineController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); |
|
|
|
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地址,请联系管理人员!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); |
|
|
|
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); |
|
|
|
|
|
|
|
|
|
|
|
if (apiMerchants == null) { |
|
|
|
if (apiMerchants == null) { |
|
|
@ -91,7 +96,7 @@ public class RefuelOnlineController { |
|
|
|
|
|
|
|
|
|
|
|
if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE6.getApiCode(), object.getString("merchId"))) { |
|
|
|
if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE6.getApiCode(), object.getString("merchId"))) { |
|
|
|
log.error("getAllCities error!", "当前帐户无权限查询!"); |
|
|
|
log.error("getAllCities error!", "当前帐户无权限查询!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限查询!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
@ -123,10 +128,31 @@ public class RefuelOnlineController { |
|
|
|
for (HighMerchantStore merchantStore : merchantStores) { |
|
|
|
for (HighMerchantStore merchantStore : merchantStores) { |
|
|
|
ApiMchStoreModel apiMchStoreModel = new ApiMchStoreModel(); |
|
|
|
ApiMchStoreModel apiMchStoreModel = new ApiMchStoreModel(); |
|
|
|
apiMchStoreModel.setAddress(merchantStore.getAddress()); |
|
|
|
apiMchStoreModel.setAddress(merchantStore.getAddress()); |
|
|
|
// apiMchStoreModel.setStore_logo();
|
|
|
|
apiMchStoreModel.setStoreCode(merchantStore.getStoreKey()); |
|
|
|
|
|
|
|
apiMchStoreModel.setLatitude(merchantStore.getLatitude()); |
|
|
|
|
|
|
|
apiMchStoreModel.setLongitude(merchantStore.getLongitude()); |
|
|
|
|
|
|
|
apiMchStoreModel.setStoreName(merchantStore.getStoreName()); |
|
|
|
|
|
|
|
apiMchStoreModel.setRegionName(merchantStore.getRegionName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<HighGasOilPrice> gasOilPrices = gasOilPriceService.getGasOilPriceByStore(merchantStore.getId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (HighGasOilPrice gasOilPrice : gasOilPrices) { |
|
|
|
|
|
|
|
ApiGasOliPriceModel gasOliPriceModel = new ApiGasOliPriceModel(); |
|
|
|
|
|
|
|
gasOliPriceModel.setPriceCost(apiCommonConfig.computationPriceCost(object.getString("merchId") , OrderProductType.PRODUCT_TYPE6.getNumber() , gasOilPrice.getPriceGun())); |
|
|
|
|
|
|
|
gasOliPriceModel.setPriceGun(gasOilPrice.getPriceGun()); |
|
|
|
|
|
|
|
gasOliPriceModel.setPriceOfficial(gasOilPrice.getPriceOfficial()); |
|
|
|
|
|
|
|
gasOliPriceModel.setOilNo(gasOilPrice.getOilNo()); |
|
|
|
|
|
|
|
gasOliPriceModel.setOilNoName(gasOilPrice.getOilNoName()); |
|
|
|
|
|
|
|
gasOliPriceModel.setOilType(gasOilPrice.getOilType()); |
|
|
|
|
|
|
|
gasOliPriceModel.setOilTypeName(gasOilPrice.getOilTypeName()); |
|
|
|
|
|
|
|
gasOliPriceModel.setGasOliNo(apiCommonConfig.assemblyGasOilGunNo(gasOilPrice.getId())); |
|
|
|
|
|
|
|
apiMchStoreModel.getApiGasOliPriceModels().add(gasOliPriceModel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apiMchStoreModels.add(apiMchStoreModel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(merchantStores); |
|
|
|
return ResponseMsgUtil.success(apiMchStoreModels); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighOpenApiController --> getRechargeProduct() error!", e); |
|
|
|
log.error("HighOpenApiController --> getRechargeProduct() error!", e); |
|
|
|