开票信息

This commit is contained in:
wangw 2024-11-25 17:54:41 +08:00
parent ee88ccc07d
commit 754d5526d1
1 changed files with 25 additions and 24 deletions

View File

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