|
|
|
@ -473,6 +473,113 @@ public class HighGasServiceImpl implements HighGasService { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void getDianAllStation() throws Exception { |
|
|
|
|
HighMerchantModel merchant = highMerchantService.getMerchantById(39L); |
|
|
|
|
JSONObject jsonObject = DianConfig.getGasInfoAll(); |
|
|
|
|
|
|
|
|
|
JSONArray resultObject = jsonObject.getObject("result", JSONArray.class); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < resultObject.size();i++) { |
|
|
|
|
Object objectData = resultObject.get(i); |
|
|
|
|
JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectData)); |
|
|
|
|
HighMerchantStore highMerchantStore; |
|
|
|
|
HighGasOilPrice highGasOilPrice; |
|
|
|
|
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("jyzid")); |
|
|
|
|
SecRegion region = commonService.getRegionsByName(object.getString("province")); |
|
|
|
|
if (store != null) { |
|
|
|
|
store.setType(1); |
|
|
|
|
store.setSourceType(6); |
|
|
|
|
store.setMerchantId(merchant.getId()); |
|
|
|
|
store.setCompanyId(merchant.getCompanyId()); |
|
|
|
|
store.setStoreKey(object.getString("jyzid")); |
|
|
|
|
store.setStoreName(object.getString("mingcheng")); |
|
|
|
|
store.setStoreLogo(object.getString("tupian")); |
|
|
|
|
store.setRegionId(region.getRegionId()); |
|
|
|
|
store.setRegionName(object.getString("province")); |
|
|
|
|
store.setAddress(object.getString("dizhi")); |
|
|
|
|
store.setLongitude(object.getString("lng")); |
|
|
|
|
store.setLatitude(object.getString("lat")); |
|
|
|
|
store.setStatus(object.getInteger("zhuangtai")); |
|
|
|
|
store.setPrestoreType(0); |
|
|
|
|
store.setOperatorId(0L); |
|
|
|
|
store.setOperatorName("系统创建"); |
|
|
|
|
store.setUpdateTime(new Date()); |
|
|
|
|
store.setExt1(object.getString("gasSourceId")); |
|
|
|
|
highMerchantStoreService.updateMerchantStoreDetail(store); |
|
|
|
|
|
|
|
|
|
JSONArray oilPriceList = object.getJSONArray("oilPriceList"); |
|
|
|
|
for (Object oilPrice : oilPriceList) { |
|
|
|
|
JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); |
|
|
|
|
// 查询门店油号
|
|
|
|
|
highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getString("youhao")); |
|
|
|
|
if (highGasOilPrice == null) { |
|
|
|
|
highGasOilPrice = new HighGasOilPrice(); |
|
|
|
|
highGasOilPrice.setMerchantStoreId(store.getId()); |
|
|
|
|
highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); |
|
|
|
|
highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); |
|
|
|
|
highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); |
|
|
|
|
highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); |
|
|
|
|
highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); |
|
|
|
|
highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); |
|
|
|
|
highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); |
|
|
|
|
highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); |
|
|
|
|
} else { |
|
|
|
|
highGasOilPrice.setMerchantStoreId(store.getId()); |
|
|
|
|
highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); |
|
|
|
|
highGasOilPrice.setOilNoName( oilPriceObject.getString("youhao") + "#"); |
|
|
|
|
highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); |
|
|
|
|
highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); |
|
|
|
|
highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); |
|
|
|
|
highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); |
|
|
|
|
highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); |
|
|
|
|
} |
|
|
|
|
highGasOilPriceService.editGasOilPrice(highGasOilPrice); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
highMerchantStore = new HighMerchantStore(); |
|
|
|
|
highMerchantStore.setType(1); |
|
|
|
|
highMerchantStore.setSourceType(6); |
|
|
|
|
highMerchantStore.setMerchantId(merchant.getId()); |
|
|
|
|
highMerchantStore.setCompanyId(merchant.getCompanyId()); |
|
|
|
|
highMerchantStore.setStoreKey(object.getString("jyzid")); |
|
|
|
|
highMerchantStore.setStoreName(object.getString("mingcheng")); |
|
|
|
|
highMerchantStore.setStoreLogo(object.getString("tupian")); |
|
|
|
|
highMerchantStore.setRegionId(region.getRegionId()); |
|
|
|
|
highMerchantStore.setRegionName(object.getString("province")); |
|
|
|
|
highMerchantStore.setAddress(object.getString("dizhi")); |
|
|
|
|
highMerchantStore.setLongitude(object.getString("lng")); |
|
|
|
|
highMerchantStore.setLatitude(object.getString("lat")); |
|
|
|
|
highMerchantStore.setStatus(1); |
|
|
|
|
highMerchantStore.setPrestoreType(0); |
|
|
|
|
highMerchantStore.setOperatorId(0L); |
|
|
|
|
highMerchantStore.setOperatorName("系统创建"); |
|
|
|
|
highMerchantStore.setCreateTime(new Date()); |
|
|
|
|
highMerchantStore.setUpdateTime(new Date()); |
|
|
|
|
highMerchantStore.setExt1(object.getString("gasSourceId")); |
|
|
|
|
HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); |
|
|
|
|
BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); |
|
|
|
|
highMerchantStoreService.insertMerchantStore(merchantStoreModel); |
|
|
|
|
|
|
|
|
|
JSONArray oilPriceList = object.getJSONArray("oilPriceList"); |
|
|
|
|
for (Object oilPrice : oilPriceList) { |
|
|
|
|
JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); |
|
|
|
|
highGasOilPrice = new HighGasOilPrice(); |
|
|
|
|
highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); |
|
|
|
|
highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); |
|
|
|
|
highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); |
|
|
|
|
highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); |
|
|
|
|
highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); |
|
|
|
|
highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); |
|
|
|
|
highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); |
|
|
|
|
highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); |
|
|
|
|
highGasOilPriceService.editGasOilPrice(highGasOilPrice); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void getGasInfoList() throws Exception { |
|
|
|
|
HighMerchantModel merchant = highMerchantService.getMerchantById(39L); |
|
|
|
|
if (merchant == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); |
|
|
|
|