字符串模板修改

This commit is contained in:
张松 2025-02-19 10:14:48 +08:00
parent 9c0f1f7bfc
commit 684902769b
2 changed files with 4 additions and 4 deletions

View File

@ -97,7 +97,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
// 设置 ZIP 响应头
response.setContentType("application/zip");
response.setHeader("Content-Disposition", STR."attachment; filename=shop_qrcodes_\{shopId}.zip");
response.setHeader("Content-Disposition", "attachment; filename=shop_qrcodes_" + shopId + ".zip");
ArrayList<ShopTableCode> codeList = new ArrayList<>();
// 使用 ZipOutputStream 将二维码写入 zip
@ -117,7 +117,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
byte[] qrBytes = out.toByteArray();
// 添加到 ZIP
zipOut.putNextEntry(new ZipEntry(STR."\{tableCode}.png"));
zipOut.putNextEntry(new ZipEntry(tableCode + ".png"));
zipOut.write(qrBytes);
zipOut.closeEntry();
}
@ -130,7 +130,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
if (count > 100) {
throw new ApiNotPrintException("桌码生成失败");
}
String tableCode = STR."40\{shopId % 10}\{id % 10}\{RandomUtil.randomNumbers(7)}";
String tableCode = "40" + shopId % 10 + id % 10 + RandomUtil.randomNumbers(7);
if (map.containsKey(tableCode)) {
generateCode(++count, shopId, id + 1, map);
}

View File

@ -154,7 +154,7 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
return CzgResult.failure("加入会员后使用");
}
String dynamicCode = generatePaymentCode(String.valueOf(shopId), String.valueOf(userInfoId));
redisService.set(STR."\{RedisCst.SHOP_USER_DYNAMIC_CODE}\{shopUser.getShopId()}:\{dynamicCode}", shopUser.getId(), 180);
redisService.set(RedisCst.SHOP_USER_DYNAMIC_CODE + shopUser.getShopId() + ":" + dynamicCode, shopUser.getId(), 180);
return CzgResult.success(dynamicCode);
}