|
|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.iformall.service.bank.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.github.binarywang.wxpay.bean.bank.*; |
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException; |
|
|
|
import com.github.binarywang.wxpay.service.WxPayService; |
|
|
|
@@ -250,21 +251,34 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { |
|
|
|
try { |
|
|
|
ProvincesResult provincesResult = wxPayService.getBankService().areasProvinces(); |
|
|
|
for (ProvincesResult.ProvinceInfo provinceInfo:provincesResult.getData()) { |
|
|
|
WxBankProvinceCity province = new WxBankProvinceCity(); |
|
|
|
province.setParentId(0l); |
|
|
|
province.setProvinceCode(provinceInfo.getProvinceCode()); |
|
|
|
province.setProvinceName(provinceInfo.getProvinceName()); |
|
|
|
wxBankProvinceCityMapper.insert(province); |
|
|
|
WxBankProvinceCity provinceQuery = new WxBankProvinceCity(); |
|
|
|
provinceQuery.setProvinceCode(provinceInfo.getProvinceCode()); |
|
|
|
provinceQuery.setProvinceName(provinceInfo.getProvinceName()); |
|
|
|
WxBankProvinceCity province = wxBankProvinceCityMapper.selectOne(new QueryWrapper<>(provinceQuery)); |
|
|
|
if(province == null){ |
|
|
|
province = new WxBankProvinceCity(); |
|
|
|
province.setParentId(0l); |
|
|
|
province.setProvinceCode(provinceInfo.getProvinceCode()); |
|
|
|
province.setProvinceName(provinceInfo.getProvinceName()); |
|
|
|
wxBankProvinceCityMapper.insert(province); |
|
|
|
} |
|
|
|
|
|
|
|
CitiesResult citiesResult = wxPayService.getBankService().areasCities(provinceInfo.getProvinceCode()); |
|
|
|
for (CitiesResult.CityInfo cityInfo:citiesResult.getData()) { |
|
|
|
WxBankProvinceCity city = new WxBankProvinceCity(); |
|
|
|
city.setParentId(province.getId()); |
|
|
|
city.setProvinceCode(provinceInfo.getProvinceCode()); |
|
|
|
city.setProvinceName(provinceInfo.getProvinceName()); |
|
|
|
city.setCityCode(cityInfo.getCityCode()); |
|
|
|
city.setCityName(cityInfo.getCityName()); |
|
|
|
wxBankProvinceCityMapper.insert(city); |
|
|
|
WxBankProvinceCity cityQuery = new WxBankProvinceCity(); |
|
|
|
cityQuery.setProvinceCode(provinceInfo.getProvinceCode()); |
|
|
|
cityQuery.setProvinceName(provinceInfo.getProvinceName()); |
|
|
|
cityQuery.setCityCode(cityInfo.getCityCode()); |
|
|
|
cityQuery.setCityName(cityInfo.getCityName()); |
|
|
|
WxBankProvinceCity city = wxBankProvinceCityMapper.selectOne(new QueryWrapper<>(cityQuery)); |
|
|
|
if(city == null){ |
|
|
|
city = new WxBankProvinceCity(); |
|
|
|
city.setParentId(province.getId()); |
|
|
|
city.setProvinceCode(provinceInfo.getProvinceCode()); |
|
|
|
city.setProvinceName(provinceInfo.getProvinceName()); |
|
|
|
city.setCityCode(cityInfo.getCityCode()); |
|
|
|
city.setCityName(cityInfo.getCityName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
@@ -273,4 +287,20 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData wxProvinces() { |
|
|
|
WxBankProvinceCity province = new WxBankProvinceCity(); |
|
|
|
province.setParentId(0l); |
|
|
|
List<WxBankProvinceCity> list = wxBankProvinceCityMapper.findList(province); |
|
|
|
return new ResultData(list); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData wxCities(Long provinceId) { |
|
|
|
WxBankProvinceCity province = new WxBankProvinceCity(); |
|
|
|
province.setParentId(provinceId); |
|
|
|
List<WxBankProvinceCity> list = wxBankProvinceCityMapper.findList(province); |
|
|
|
return new ResultData(list); |
|
|
|
} |
|
|
|
} |