开票信息

This commit is contained in:
2024-11-25 17:54:41 +08:00
parent ee88ccc07d
commit 754d5526d1

View File

@@ -52,15 +52,15 @@ public class BindServiceImpl implements BindService {
String result = HttpUtil.post(url + "cash/subinvoicing", params, 5000); String result = HttpUtil.post(url + "cash/subinvoicing", params, 5000);
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
if (jsonObject.getInteger("code").equals(1)) { if (jsonObject.getInteger("code").equals(1)) {
if (StringUtils.isNotBlank(shopId)) { // if (StringUtils.isNotBlank(shopId)) {
if (redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + shopId)) { // if (redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + shopId)) {
Set<Object> articles = redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + shopId); // Set<Object> articles = redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + shopId);
if (!articles.contains(params.get("article"))) { // if (!articles.contains(params.get("article"))) {
articles.add(params.get("article")); // articles.add(params.get("article"));
redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + shopId, articles); // redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + shopId, articles);
} // }
} // }
} // }
return jsonObject.getJSONObject("data"); return jsonObject.getJSONObject("data");
} else { } else {
throw new BadRequestException(jsonObject.getString("msg")); throw new BadRequestException(jsonObject.getString("msg"));
@@ -69,7 +69,7 @@ public class BindServiceImpl implements BindService {
@Override @Override
public JSONObject industry(BindingDto bindingDto) { public JSONObject industry(BindingDto bindingDto) {
if (StringUtils.isNotBlank(bindingDto.getArticle())) { // if (StringUtils.isNotBlank(bindingDto.getArticle())) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("name", bindingDto.getArticle()); params.put("name", bindingDto.getArticle());
params.put("page", bindingDto.getPage() == null ? 1 : bindingDto.getPage()); params.put("page", bindingDto.getPage() == null ? 1 : bindingDto.getPage());
@@ -80,20 +80,21 @@ public class BindServiceImpl implements BindService {
} else { } else {
throw new BadRequestException(jsonObject.getString("msg")); throw new BadRequestException(jsonObject.getString("msg"));
} }
} else { // }
Set<String> set = new HashSet<>(); // else {
JSONObject jsonObject = new JSONObject(); // Set<String> set = new HashSet<>();
if (!redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())) { // JSONObject jsonObject = new JSONObject();
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null); // if (!redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())) {
TbMerchantAccount account = accountRepository.findByAccount(tbShopInfo.getAccount()); // TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null);
set.add(account.getArticle()); // TbMerchantAccount account = accountRepository.findByAccount(tbShopInfo.getAccount());
redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId(), set); // set.add(account.getArticle());
jsonObject.put("articles", set); // redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId(), set);
} else { // jsonObject.put("articles", set);
jsonObject.put("list", redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())); // } else {
} // jsonObject.put("list", redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId()));
return jsonObject; // }
} // return jsonObject;
// }
} }
@Override @Override