From 251a6b609d00ad9cb9bbb6ebfd019a9f3cbccf7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Tue, 9 Sep 2025 00:53:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(bszx):=20=E4=B8=BA=E7=99=BE=E8=89=B2?= =?UTF-8?q?=E4=B8=80=E5=B0=8F=E9=A1=B9=E7=9B=AE=E6=B7=BB=E5=8A=A0=E5=AE=9A?= =?UTF-8?q?=E5=88=B6=E5=8C=96=E8=AF=81=E4=B9=A6=E7=94=9F=E6=88=90=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 BszxBmServiceImpl 和 BszxPayServiceImpl 中添加了针对百色一小项目的证书生成逻辑 - 更新了 ShopDealerBankController 中的用户登录检查逻辑- 修改了 application.yml 中的文件服务器 URL --- .../bszx/service/impl/BszxBmServiceImpl.java | 7 + .../bszx/service/impl/BszxPayServiceImpl.java | 50 +++++- .../controller/ShopDealerBankController.java | 144 +++++++++--------- src/main/resources/application.yml | 2 +- 4 files changed, 130 insertions(+), 73 deletions(-) diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBmServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBmServiceImpl.java index 65fef9d..3ca601b 100644 --- a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBmServiceImpl.java +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBmServiceImpl.java @@ -107,6 +107,13 @@ public class BszxBmServiceImpl extends ServiceImpl impleme return null; } if (ObjectUtil.isNotEmpty(item)) { + + // 百色一小项目 + if(item.getTenantId().equals(10547)){ + return "https://oss.wsdns.cn/20250908/f8b88d734aac4006a89b9aeb5c3f4f75.png"; + } + + // Font font = new Font("阿里巴巴普惠体", Font.PLAIN, 40); //合成器(指定背景图和输出格式,整个图片的宽高和相关计算依赖于背景图,所以背景图的大小是个基准) ImageCombiner combiner = new ImageCombiner(article.getAddress(), OutputFormat.JPG); diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayServiceImpl.java index eb2c3d0..273068c 100644 --- a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayServiceImpl.java +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayServiceImpl.java @@ -93,6 +93,54 @@ public class BszxPayServiceImpl extends ServiceImpl impl if (StrUtil.isBlank(item.getAddress())) { return null; } + // 百色一小项目 + if(payCert.getTenantId().equals(10547) && ObjectUtil.isNotEmpty(payCert)){ + //合成器(指定背景图和输出格式,整个图片的宽高和相关计算依赖于背景图,所以背景图的大小是个基准) + ImageCombiner combiner = new ImageCombiner("https://oss.wsdns.cn/20250908/97f0891f3e4048f5b20ffb07ff370a3a.png?x-oss-process=image/resize,w_750/quality,Q_90", OutputFormat.JPG); + //加图片元素:盖章 +// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 550, 926); + //加文本元素:姓名 + String str; + if (bm.getType().equals(0)) { + str = bm.getName(); + combiner.addTextElement(str, 26, 200, 468); + } else { + str = bm.getName(); + combiner.addTextElement(str, 22, 200, 468); + } +// combiner.addTextElement(bm.getName(), 32,900, 450); + //加文本元素:捐款证书内容 +// combiner.addTextElement(" 承您慷慨解囊,襄助百色市百色中学", 32,200, 650); +// combiner.addTextElement("百廿校庆“" + item.getTitle() + "”项目,捐赠人民币", 32,200, 700); + combiner.addTextElement(totalMoney + "", 26, 420, 584); +// combiner.addTextElement(" 您对学校的支持,为我们共同教育理", 32,200, 800); +// combiner.addTextElement("想的实现增添了一份动力。", 32,200, 850); +// combiner.addTextElement(" 承蒙惠赠,隆情铭感,特颁此证,以资谢旌!", 32, 200, 900); +// combiner.addTextElement("百色市百色中学", 32,560, 1015); +// final Date createTime = payCert.getCreateTime(); +// combiner.addTextElement(DateUtil.format(createTime, "yyyy年MM月"), 28,586, 1060); +// combiner.addTextElement("2025年4月15日", 28,580, 1060); + + //执行图片合并 + combiner.combine(); + + if (!FileUtil.exist(uploadPath + "/file/poster/" + payCert.getTenantId() + "/pay")) { + FileUtil.mkdir(uploadPath + "/file/poster/" + payCert.getTenantId() + "/pay"); + } + String basePath = "/poster/" + payCert.getTenantId() + "/pay/big-" + id + ".jpg"; + String smallPath = "/poster/" + payCert.getTenantId() + "/pay/" + id + ".jpg"; + String filename = uploadPath + "/file" + basePath; + String smallFileName = uploadPath + "/file" + smallPath; + combiner.save(filename); + + File input = new File(filename); + File output = new File(smallFileName); + ImageUtil.adjustQuality(input, output, 0.8f); + if (input.exists()) { + input.delete(); + } + return fileServer + smallPath + "?r=" + RandomUtil.randomNumbers(4); + } if (ObjectUtil.isNotEmpty(payCert)) { //合成器(指定背景图和输出格式,整个图片的宽高和相关计算依赖于背景图,所以背景图的大小是个基准) ImageCombiner combiner = new ImageCombiner("https://oss.wsdns.cn/20250420/811a380e8e124097aa0940a7c68a1f72.jpeg", OutputFormat.JPG); @@ -138,7 +186,7 @@ public class BszxPayServiceImpl extends ServiceImpl impl if (input.exists()) { input.delete(); } - return fileServer + smallPath + "?r=" + RandomUtil.randomNumbers(4); + return fileServer + smallPath + "?v=" + RandomUtil.randomNumbers(4); } return null; } diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java index e87177b..a05c0c4 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java @@ -1,103 +1,105 @@ -package com.gxwebsoft.shop.controller; + package com.gxwebsoft.shop.controller; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.entity.ShopDealerBank; -import com.gxwebsoft.shop.param.ShopDealerBankParam; -import com.gxwebsoft.shop.service.ShopDealerBankService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; + import com.gxwebsoft.common.core.annotation.OperationLog; + import com.gxwebsoft.common.core.web.ApiResult; + import com.gxwebsoft.common.core.web.BaseController; + import com.gxwebsoft.common.core.web.BatchParam; + import com.gxwebsoft.common.core.web.PageResult; + import com.gxwebsoft.common.system.entity.User; + import com.gxwebsoft.shop.entity.ShopDealerBank; + import com.gxwebsoft.shop.param.ShopDealerBankParam; + import com.gxwebsoft.shop.service.ShopDealerBankService; + import io.swagger.v3.oas.annotations.Operation; + import io.swagger.v3.oas.annotations.tags.Tag; + import org.springframework.security.access.prepost.PreAuthorize; + import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import java.util.List; + import javax.annotation.Resource; + import java.util.List; -/** - * 分销商提现银行卡控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Tag(name = "分销商提现银行卡管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-bank") -public class ShopDealerBankController extends BaseController { + /** + * 分销商提现银行卡控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ + @Tag(name = "分销商提现银行卡管理") + @RestController + @RequestMapping("/api/shop/shop-dealer-bank") + public class ShopDealerBankController extends BaseController { @Resource private ShopDealerBankService shopDealerBankService; - @PreAuthorize("hasAuthority('shop:shopDealerBank:list')") @Operation(summary = "分页查询分销商提现银行卡") @GetMapping("/page") public ApiResult> page(ShopDealerBankParam param) { final User loginUser = getLoginUser(); - if(loginUser == null){ - return fail("请先登录",null); + if (loginUser == null) { + return fail("请先登录", null); } param.setUserId(loginUser.getUserId()); return success(shopDealerBankService.pageRel(param)); } - @PreAuthorize("hasAuthority('shop:shopDealerBank:list')") @Operation(summary = "查询全部分销商提现银行卡") @GetMapping() public ApiResult> list(ShopDealerBankParam param) { - final User loginUser = getLoginUser(); - if(loginUser == null){ - return fail("请先登录",null); - } - param.setUserId(loginUser.getUserId()); - return success(shopDealerBankService.listRel(param)); + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + param.setUserId(loginUser.getUserId()); + return success(shopDealerBankService.listRel(param)); } - @PreAuthorize("hasAuthority('shop:shopDealerBank:list')") @Operation(summary = "根据id查询分销商提现银行卡") @GetMapping("/{id}") public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerBankService.getByIdRel(id)); + // 使用关联查询 + return success(shopDealerBankService.getByIdRel(id)); } - @PreAuthorize("hasAuthority('shop:shopDealerBank:save')") @OperationLog @Operation(summary = "添加分销商提现银行卡") @PostMapping() public ApiResult save(@RequestBody ShopDealerBank shopDealerBank) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerBank.setUserId(loginUser.getUserId()); - } - if (shopDealerBankService.save(shopDealerBank)) { - return success("添加成功"); - } - return fail("添加失败"); + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerBank.setUserId(loginUser.getUserId()); + } + if (shopDealerBankService.save(shopDealerBank)) { + return success("添加成功"); + } + return fail("添加失败"); } - @PreAuthorize("hasAuthority('shop:shopDealerBank:update')") @OperationLog @Operation(summary = "修改分销商提现银行卡") @PutMapping() public ApiResult update(@RequestBody ShopDealerBank shopDealerBank) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerBank.setUserId(loginUser.getUserId()); if (shopDealerBankService.updateById(shopDealerBank)) { - return success("修改成功"); + return success("修改成功"); } - return fail("修改失败"); + } + return fail("修改失败"); } - @PreAuthorize("hasAuthority('shop:shopDealerBank:remove')") - @OperationLog @Operation(summary = "删除分销商提现银行卡") @DeleteMapping("/{id}") public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerBankService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + if (shopDealerBankService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); } @PreAuthorize("hasAuthority('shop:shopDealerBank:save')") @@ -105,10 +107,10 @@ public class ShopDealerBankController extends BaseController { @Operation(summary = "批量添加分销商提现银行卡") @PostMapping("/batch") public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerBankService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); + if (shopDealerBankService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); } @PreAuthorize("hasAuthority('shop:shopDealerBank:update')") @@ -116,10 +118,10 @@ public class ShopDealerBankController extends BaseController { @Operation(summary = "批量修改分销商提现银行卡") @PutMapping("/batch") public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerBankService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); + if (batchParam.update(shopDealerBankService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); } @PreAuthorize("hasAuthority('shop:shopDealerBank:remove')") @@ -127,10 +129,10 @@ public class ShopDealerBankController extends BaseController { @Operation(summary = "批量删除分销商提现银行卡") @DeleteMapping("/batch") public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerBankService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); + if (shopDealerBankService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); } -} + } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 369923b..c1bb2ce 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -100,7 +100,7 @@ config: # 主服务器 server-url: https://server.websoft.top/api # 文件服务器 - file-server: https://file.wsdns.cn + file-server: https://file.websoft.top # 其他 api-url: https://server.websoft.top/api upload-path: /Users/gxwebsoft/Documents/uploads/