|
|
|
@@ -5,7 +5,9 @@ import com.github.binarywang.wxpay.exception.WxPayException; |
|
|
|
import com.github.binarywang.wxpay.service.WxPayService; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxBankProvinceCity; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.mapper.WxBankProvinceCityMapper; |
|
|
|
import com.iformall.service.WxPayAccountService; |
|
|
|
import com.iformall.service.bank.WxBankUtilService; |
|
|
|
import com.iformall.utils.RedisCacheUtils; |
|
|
|
@@ -28,6 +30,9 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { |
|
|
|
@Autowired |
|
|
|
WxPayAccountService wxPayAccountService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxBankProvinceCityMapper wxBankProvinceCityMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("objectCommonRedisTemplate") |
|
|
|
RedisTemplate<String, Object> bankRedisTemplate; |
|
|
|
@@ -238,4 +243,34 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { |
|
|
|
} |
|
|
|
return new ResultData(bankInfoList); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData initProvincesCities(TenantEntity tenantInfo) { |
|
|
|
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); |
|
|
|
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); |
|
|
|
|
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
} catch (WxPayException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |