diff --git a/db/800pjcloudx_wallet.sql b/db/800pjcloudx_wallet.sql index 43b9d809c..bad0e5c45 100644 --- a/db/800pjcloudx_wallet.sql +++ b/db/800pjcloudx_wallet.sql @@ -1,5 +1,35 @@ create database `pjcloudx_wallet` default character set utf8mb4 collate utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for mch_manage +-- ---------------------------- +DROP TABLE IF EXISTS `mch_manage`; +CREATE TABLE mch_manage +( + id bigint NOT NULL COMMENT '主键', + dept_id bigint NOT NULL COMMENT '绑定的部门id', + name varchar(64) NOT NULL COMMENT '商户名', + types varchar(64) NOT NULL COMMENT '店铺类型,逗号分隔', + logo_pic varchar(256) NOT NULL COMMENT '商户logo图片', + collection_code varchar(256) DEFAULT '' COMMENT '商户收款码,自动生成', + swiper_pic text DEFAULT NULL COMMENT '商户轮播图,逗号分隔', + phone varchar(128) DEFAULT '' COMMENT '商户手机号', + job_start_time timestamp DEFAULT NULL COMMENT '商户开始营业时间', + job_end_time timestamp DEFAULT NULL COMMENT '商户结束营业时间', + address_des varchar(256) DEFAULT NULL COMMENT '商户地址', + create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', + create_time datetime DEFAULT NULL COMMENT '创建时间', + update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人', + update_time datetime DEFAULT NULL COMMENT '修改时间', + del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记', + tenant_id bigint DEFAULT NULL COMMENT '租户ID', + PRIMARY KEY (id) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_general_ci COMMENT ='商户管理'; +CREATE INDEX idx_dept_id ON mch_manage (dept_id); + -- ---------------------------- -- Table structure for wallet_manage -- ---------------------------- @@ -9,7 +39,7 @@ CREATE TABLE wallet_manage id bigint NOT NULL COMMENT '主键', user_id bigint NOT NULL COMMENT '饭卡绑定的用户id', wallet_type_id bigint NOT NULL COMMENT '饭卡类型id', - dept_id BIGINT NOT NULL COMMENT '部门id', + dept_id bigint NOT NULL COMMENT '部门id', card_number varchar(64) COMMENT '饭卡卡号', balance int DEFAULT 0 NOT NULL COMMENT '余额,单位分', total_expense int DEFAULT 0 NOT NULL COMMENT '累计支出,单位分', @@ -61,10 +91,11 @@ CREATE TABLE wallet_active user_id bigint NOT NULL COMMENT '用户id', wallet_id bigint NOT NULL COMMENT '钱包id', wallet_type_id bigint NOT NULL COMMENT '饭卡类型id', - dept_id BIGINT NOT NULL COMMENT '部门id', - merchant_id BIGINT NOT NULL COMMENT '商户id', + dept_id bigint NOT NULL COMMENT '部门id', + merchant_id bigint NOT NULL COMMENT '商户id', card_number varchar(128) NOT NULL COMMENT '用户卡号', - is_active_hardware BIT DEFAULT 0 COMMENT '饭卡是否在硬件上激活', + card_sort int NOT NULL COMMENT '饭卡顺序', + is_active_hardware char(1) DEFAULT '0' COMMENT '饭卡是否在硬件上激活', create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', create_time datetime DEFAULT NULL COMMENT '创建时间', update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人', @@ -75,8 +106,7 @@ CREATE TABLE wallet_active ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='钱包开卡'; CREATE INDEX idx_dept_id ON wallet_active (user_id); -CREATE INDEX idx_dept_id ON wallet_active (wallet_id); -CREATE INDEX idx_dept_id ON wallet_active (wallet_type_id); +CREATE INDEX idx_dept_id ON wallet_active (dept_id); -- ---------------------------- -- Table structure for wallet_freeze @@ -84,10 +114,10 @@ CREATE INDEX idx_dept_id ON wallet_active (wallet_type_id); DROP TABLE IF EXISTS wallet_freeze; CREATE TABLE wallet_freeze ( - id bigint NOT NULL COMMENT '编号', - wallet_id bigint NOT NULL COMMENT '钱包id', - user_id bigint NOT NULL COMMENT '用户id', - free_status TINYINT NOT NULL COMMENT '冻结状态', + id bigint NOT NULL COMMENT '编号', + wallet_id bigint NOT NULL COMMENT '钱包id', + user_id bigint NOT NULL COMMENT '用户id', + free_status tinytext NOT NULL COMMENT '冻结状态', remark varchar(1024) COMMENT '备注', create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', create_time datetime DEFAULT NULL COMMENT '创建时间', @@ -98,8 +128,6 @@ CREATE TABLE wallet_freeze PRIMARY KEY (id) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='饭卡冻结记录表'; -CREATE INDEX idx_dept_id ON wallet_freeze (wallet_id); -CREATE INDEX idx_dept_id ON wallet_freeze (user_id); -- ---------------------------- -- Table structure for wallet_transaction @@ -170,7 +198,7 @@ CREATE TABLE wallet_recharge_import id bigint NOT NULL COMMENT '编号', user_id bigint NOT NULL COMMENT '用户id', apply_id bigint NOT NULL COMMENT '申请id', - before_price int NOT NULL COMMENT '导入前的金额', + before_price int DEFAULT NULL COMMENT '导入前的金额', price int NOT NULL COMMENT '交易金额, 单位分', create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', create_time datetime DEFAULT NULL COMMENT '创建时间', diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/MerchantInfoController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/MerchantInfoController.java index a10a339be..06ea978eb 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/MerchantInfoController.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/MerchantInfoController.java @@ -49,58 +49,64 @@ import java.util.stream.Collectors; */ @RestController @RequiredArgsConstructor -@RequestMapping("/merchantInfo" ) -@Tag(description = "merchantInfo" , name = "商户管理管理" ) +@RequestMapping("/merchantInfo") +@Tag(description = "merchantInfo", name = "商户管理管理") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class MerchantInfoController { - private final MerchantInfoService merchantInfoService; + private final MerchantInfoService merchantInfoService; private final RemoteDeptService remoteDeptService; private final RemoteFileService remoteFileService; + /** * 分页查询 - * @param page 分页对象 + * + * @param page 分页对象 * @param merchantInfo 商户管理 * @return */ - @Operation(summary = "分页查询" , description = "分页查询" ) - @GetMapping("/page" ) - @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_view')" ) + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_view')") public R getMerchantInfoPage(@ParameterObject Page page, @ParameterObject MerchantInfoEntity merchantInfo) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); Page pageData = merchantInfoService.page(page, wrapper); List records = pageData.getRecords(); List deptIds = records.stream().map(MerchantInfoEntity::getDeptId).distinct().collect(Collectors.toList()); - Map sysDeptMap=remoteDeptService.getDeptByDeptIds(deptIds).getData(); - records.forEach(record->{record.setDeptName(sysDeptMap.get(record.getDeptId())==null?"":sysDeptMap.get(record.getDeptId()).getName());}); + Map sysDeptMap = remoteDeptService.getDeptByDeptIds(deptIds).getData(); + records.forEach(record -> { + record.setDeptName(sysDeptMap.get(record.getDeptId()) == null ? "" : sysDeptMap.get(record.getDeptId()).getName()); + }); return R.ok(pageData); } /** * 通过id查询商户管理 + * * @param id id * @return R */ - @Operation(summary = "通过id查询" , description = "通过id查询" ) - @GetMapping("/{id}" ) - @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_view')" ) - public R getById(@PathVariable("id" ) Long id) { + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_view')") + public R getById(@PathVariable("id") Long id) { return R.ok(merchantInfoService.getById(id)); } /** * 新增商户管理 + * * @param merchantInfo 商户管理 * @return R */ - @Operation(summary = "新增商户管理" , description = "新增商户管理" ) - @SysLog("新增商户管理" ) + @Operation(summary = "新增商户管理", description = "新增商户管理") + @SysLog("新增商户管理") @PostMapping - @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_add')" ) + @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_add')") public R save(@RequestBody MerchantInfoEntity merchantInfo) throws Exception { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); @@ -112,10 +118,10 @@ public class MerchantInfoController { boolean isDepartmentAlreadyBound = merchantInfoService.exists(wrapper); if (isMerchantNameExists) { - return R.failed("商户名称已存在"); + return R.failed("商户名称已存在"); } if (isDepartmentAlreadyBound) { - return R.failed("部门已被绑定"); + return R.failed("部门已被绑定"); } merchantInfoService.save(merchantInfo); // 生成二维码 @@ -124,9 +130,9 @@ public class MerchantInfoController { String fileName = "merchant_collect_money_code" + merchantCollectMoneyCodeDto.getId(); byte[] bytes = QRCodeImageGenerator.generateQrCodeImage(JSON.toJSONString(merchantCollectMoneyCodeDto), 1024); // 使用字节流创建 MockMultipartFile - MultipartFile multipartFile = new MockMultipartFile("file", fileName+".png", "image/png", new ByteArrayInputStream(bytes)); + MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".png", "image/png", new ByteArrayInputStream(bytes)); - R upload = remoteFileService.upload(multipartFile,null,null,null); + R upload = remoteFileService.upload(multipartFile, null, null, null); Map data = (Map) upload.getData(); String url = (String) data.get("url"); MerchantInfoEntity merchantInfoEntity = new MerchantInfoEntity(); @@ -139,13 +145,14 @@ public class MerchantInfoController { /** * 修改商户管理 + * * @param merchantInfo 商户管理 * @return R */ - @Operation(summary = "修改商户管理" , description = "修改商户管理" ) - @SysLog("修改商户管理" ) + @Operation(summary = "修改商户管理", description = "修改商户管理") + @SysLog("修改商户管理") @PutMapping - @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_edit')" ) + @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_edit')") public R updateById(@RequestBody MerchantInfoEntity merchantInfo) throws Exception { // String bucketName = properties.getBucketName(); // // 生成二维码 @@ -165,13 +172,14 @@ public class MerchantInfoController { /** * 通过id删除商户管理 + * * @param ids id列表 * @return R */ - @Operation(summary = "通过id删除商户管理" , description = "通过id删除商户管理" ) - @SysLog("通过id删除商户管理" ) + @Operation(summary = "通过id删除商户管理", description = "通过id删除商户管理") + @SysLog("通过id删除商户管理") @DeleteMapping - @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_del')" ) + @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_del')") public R removeById(@RequestBody Long[] ids) { return R.ok(merchantInfoService.removeBatchByIds(CollUtil.toList(ids))); } @@ -179,26 +187,28 @@ public class MerchantInfoController { /** * 导出excel 表格 + * * @param merchantInfo 查询条件 - * @param ids 导出指定ID + * @param ids 导出指定ID * @return excel 文件流 */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_export')" ) - public List export(MerchantInfoEntity merchantInfo,Long[] ids) { + @PreAuthorize("@pms.hasPermission('canteen_merchantInfo_export')") + public List export(MerchantInfoEntity merchantInfo, Long[] ids) { return merchantInfoService.list(Wrappers.lambdaQuery(merchantInfo).in(ArrayUtil.isNotEmpty(ids), MerchantInfoEntity::getId, ids)); } /** * 获得商户下拉框 + * * @return */ @GetMapping("/selectMerchantList") @Operation(summary = "获得商户下拉框") - public R> selectMerchantList(@RequestParam(value = "type",required = false)String type) { - List list=merchantInfoService.selectMerchantList(type); + public R> selectMerchantList(@RequestParam(value = "type", required = false) String type) { + List list = merchantInfoService.selectMerchantList(type); return R.ok(list); } diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/application.yml b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/application.yml index d4495b43a..df4c03b1c 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/application.yml +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: username: @nacos.username@ password: @nacos.password@ discovery: - server-addr: pjcloud-register:8848 + server-addr: ${NACOS_HOST:pjcloud-register}:${NACOS_PORT:8848} config: server-addr: ${spring.cloud.nacos.discovery.server-addr} config: diff --git a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CacheConstants.java b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CacheConstants.java index f349c7f61..5229d1554 100644 --- a/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CacheConstants.java +++ b/pjcloud-common/pjcloud-common-core/src/main/java/com/bsd/pjcloud/common/core/constant/CacheConstants.java @@ -122,6 +122,8 @@ public interface CacheConstants { /* ************************************* start 钱包相关 start ************************************* */ + String WALLET_MCH = "wallet:detail:mch"; + String WALLET_DETAIL = "wallet:detail:manage"; String WALLET_TYPE_DETAIL = "wallet:detail:type"; diff --git a/pjcloud-merchant/.editorconfig b/pjcloud-merchant/.editorconfig deleted file mode 100644 index 2f2262bb1..000000000 --- a/pjcloud-merchant/.editorconfig +++ /dev/null @@ -1,18 +0,0 @@ -# 开发组IDE 编辑器标准 V2.1.0 -root = true - -[*.{adoc, bat, groovy, html, java, js, jsp, kt, kts, md, properties, py, rb, sh, sql, svg, txt, xml, xsd}] -charset = utf-8 - -[*.{groovy, java, kt, kts, xml, xsd}] -indent_style = tab -indent_size = 4 -continuation_indent_size = 8 -end_of_line = lf - -[*.{js, html}] -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/pjcloud-merchant/README.md b/pjcloud-merchant/README.md deleted file mode 100644 index 77b54353a..000000000 --- a/pjcloud-merchant/README.md +++ /dev/null @@ -1,22 +0,0 @@ - -项目描述 .... - - - - -| 姓名 | 角色 | 时间 | -| ---- | ---- |---------| -| xxx | 开发 | 2023-01 | -| | | | -| | | | - - - - -``` -项目根目录 -├── xxx-api -- 业务接口(实体,DTO,utils,feign接口) -├── xxx-biz -- 业务实现[默认服务端口 : 6060] -``` - - diff --git a/pjcloud-merchant/pjcloud-merchant-api/pom.xml b/pjcloud-merchant/pjcloud-merchant-api/pom.xml deleted file mode 100644 index 6a63133f0..000000000 --- a/pjcloud-merchant/pjcloud-merchant-api/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - com.bsd - pjcloud-merchant - 5.7.0 - - - pjcloud-merchant-api - - - - - com.github.yulichang - mybatis-plus-join-annotation - - - - com.bsd - pjcloud-common-core - - - - com.baomidou - mybatis-plus-spring - - - - com.bsd - pjcloud-common-feign - - - - com.bsd - pjcloud-common-excel - - - diff --git a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/api/feign/packge-info.java b/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/api/feign/packge-info.java deleted file mode 100644 index cad138c33..000000000 --- a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/api/feign/packge-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/* - @author pigx archetype - *

- * feign client 存放目录,注意 @EnablePigxFeignClients 的扫描范围 - */ -package merchant.api.feign; \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/constant/packge-info.java b/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/constant/packge-info.java deleted file mode 100644 index 8ffa52ee9..000000000 --- a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/constant/packge-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/* - * @author pigx archetype - *

- * 常量和枚举定义 - */ -package merchant.constant; \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/dto/packge-info.java b/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/dto/packge-info.java deleted file mode 100644 index 7ef402142..000000000 --- a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/dto/packge-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/* - * @author pigx archetype - *

- * DTO 存放目录 - */ -package merchant.dto; \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/entity/packge-info.java b/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/entity/packge-info.java deleted file mode 100644 index 61923d055..000000000 --- a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/entity/packge-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/* - * @author pigx archetype - *

- * 实体 存放目录 - */ -package merchant.entity; \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/pom.xml b/pjcloud-merchant/pjcloud-merchant-biz/pom.xml deleted file mode 100644 index a50062133..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - 4.0.0 - - com.bsd - pjcloud-merchant - 5.7.0 - - - pjcloud-merchant-biz - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - - com.bsd - pjcloud-common-data - - - - com.bsd - pjcloud-common-security - - - - com.bsd - pjcloud-common-xss - - - - com.bsd - pjcloud-common-sentinel - - - - com.bsd - pjcloud-common-feign - - - - com.bsd - pjcloud-merchant-api - 5.7.0 - - - - com.bsd - pjcloud-common-log - - - - com.baomidou - mybatis-plus-spring-boot3-starter - - - - com.alibaba - druid-spring-boot-3-starter - - - - com.mysql - mysql-connector-j - - - - com.bsd - pjcloud-common-swagger - - - - org.springframework.boot - spring-boot-starter-undertow - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - - - - - cloud - - true - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - CLASSIC - - - - - - io.fabric8 - docker-maven-plugin - - false - - - - - - - boot - - - diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/MerchantApp.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/MerchantApp.java deleted file mode 100644 index c24afdca0..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/MerchantApp.java +++ /dev/null @@ -1,24 +0,0 @@ -package merchant; - -import com.bsd.pjcloud.common.feign.annotation.EnablePjcloudFeignClients; -import com.bsd.pjcloud.common.security.annotation.EnablePjcloudResourceServer; -import com.bsd.pjcloud.common.swagger.annotation.EnableOpenApi; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; - -/** - * @author archetype auto - *

- * 项目启动类 - */ -@EnableOpenApi("merchant") -@EnablePjcloudFeignClients -@EnableDiscoveryClient -@EnablePjcloudResourceServer -@SpringBootApplication -public class MerchantApp { - public static void main(String[] args) { - SpringApplication.run(MerchantApp.class, args); - } -} diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/controller/MchManageController.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/controller/MchManageController.java deleted file mode 100644 index aff9a7492..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/controller/MchManageController.java +++ /dev/null @@ -1,124 +0,0 @@ -package merchant.controller; - -import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.bsd.pjcloud.common.core.util.R; -import com.bsd.pjcloud.common.log.annotation.SysLog; -import merchant.entity.MchManageEntity; -import merchant.service.MchManageService; -import org.springframework.security.access.prepost.PreAuthorize; -import com.bsd.pjcloud.common.excel.annotation.ResponseExcel; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import org.springdoc.core.annotations.ParameterObject; -import org.springframework.http.HttpHeaders; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 商户管理 - * - * @author pjcloud - * @date 2024-12-27 17:25:08 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/mchManage") -@Tag(description = "mchManage", name = "商户管理管理") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class MchManageController { - - private final MchManageService mchManageService; - - /** - * 分页查询 - * - * @param page 分页对象 - * @param mchManage 商户管理 - * @return - */ - @Operation(summary = "分页查询", description = "分页查询") - @GetMapping("/page") - @PreAuthorize("@pms.hasPermission('mch_mchManage_view')") - public R getMchManagePage(@ParameterObject Page page, @ParameterObject MchManageEntity mchManage) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); - return R.ok(mchManageService.page(page, wrapper)); - } - - - /** - * 通过id查询商户管理 - * - * @param id id - * @return R - */ - @Operation(summary = "通过id查询", description = "通过id查询") - @GetMapping("/{id}") - @PreAuthorize("@pms.hasPermission('mch_mchManage_view')") - public R getById(@PathVariable("id") Long id) { - return R.ok(mchManageService.getById(id)); - } - - /** - * 新增商户管理 - * - * @param mchManage 商户管理 - * @return R - */ - @Operation(summary = "新增商户管理", description = "新增商户管理") - @SysLog("新增商户管理") - @PostMapping - @PreAuthorize("@pms.hasPermission('mch_mchManage_add')") - public R save(@RequestBody MchManageEntity mchManage) { - return R.ok(mchManageService.save(mchManage)); - } - - /** - * 修改商户管理 - * - * @param mchManage 商户管理 - * @return R - */ - @Operation(summary = "修改商户管理", description = "修改商户管理") - @SysLog("修改商户管理") - @PutMapping - @PreAuthorize("@pms.hasPermission('mch_mchManage_edit')") - public R updateById(@RequestBody MchManageEntity mchManage) { - return R.ok(mchManageService.updateById(mchManage)); - } - - /** - * 通过id删除商户管理 - * - * @param ids id列表 - * @return R - */ - @Operation(summary = "通过id删除商户管理", description = "通过id删除商户管理") - @SysLog("通过id删除商户管理") - @DeleteMapping - @PreAuthorize("@pms.hasPermission('mch_mchManage_del')") - public R removeById(@RequestBody Long[] ids) { - return R.ok(mchManageService.removeBatchByIds(CollUtil.toList(ids))); - } - - - /** - * 导出excel 表格 - * - * @param mchManage 查询条件 - * @param ids 导出指定ID - * @return excel 文件流 - */ - @ResponseExcel - @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('mch_mchManage_export')") - public List export(MchManageEntity mchManage, Long[] ids) { - return mchManageService.list(Wrappers.lambdaQuery(mchManage).in(ArrayUtil.isNotEmpty(ids), MchManageEntity::getId, ids)); - } -} \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/controller/packge-info.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/controller/packge-info.java deleted file mode 100644 index 030660b23..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/controller/packge-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/* - * @author pigx archetype - */ -package merchant.controller; \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/mapper/MchManageMapper.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/mapper/MchManageMapper.java deleted file mode 100644 index e163e607c..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/mapper/MchManageMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package merchant.mapper; - -import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper; -import merchant.entity.MchManageEntity; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface MchManageMapper extends PjcloudBaseMapper { - -} \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/mapper/packge-info.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/mapper/packge-info.java deleted file mode 100644 index 7f3d48085..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/mapper/packge-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/* - * @author pigx archetype - *

- * Mybatis Mapper 存放目录 - */ -package merchant.mapper; \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/MchManageService.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/MchManageService.java deleted file mode 100644 index 12c2357c9..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/MchManageService.java +++ /dev/null @@ -1,8 +0,0 @@ -package merchant.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import merchant.entity.MchManageEntity; - -public interface MchManageService extends IService { - -} \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/impl/MchManageServiceImpl.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/impl/MchManageServiceImpl.java deleted file mode 100644 index 174e6f146..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/impl/MchManageServiceImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -package merchant.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import merchant.entity.MchManageEntity; -import merchant.mapper.MchManageMapper; -import merchant.service.MchManageService; -import org.springframework.stereotype.Service; -/** - * 商户管理 - * - * @author pjcloud - * @date 2024-12-27 17:25:08 - */ -@Service -public class MchManageServiceImpl extends ServiceImpl implements MchManageService { -} \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/packge-info.java b/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/packge-info.java deleted file mode 100644 index d388ec919..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/java/merchant/service/packge-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/* - * @author pigx archetype - */ -package merchant.service; \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/application.yml b/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/application.yml deleted file mode 100644 index d4e63e272..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/application.yml +++ /dev/null @@ -1,18 +0,0 @@ -server: - port: 6060 - -spring: - application: - name: @artifactId@ - cloud: - nacos: - username: @nacos.username@ - password: @nacos.password@ - discovery: - server-addr: ${NACOS_HOST:pjcloud-register}:${NACOS_PORT:8848} - config: - server-addr: ${spring.cloud.nacos.discovery.server-addr} - config: - import: - - optional:nacos:application-@profiles.active@.yml - - optional:nacos:${spring.application.name}-@profiles.active@.yml diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/logback-spring.xml b/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/logback-spring.xml deleted file mode 100644 index 964ca8735..000000000 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - ${CONSOLE_LOG_PATTERN} - - - - - - ${log.path}/debug.log - - ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz - 50MB - 30 - - - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n - - - - - - ${log.path}/error.log - - ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz - 50MB - 30 - - - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n - - - ERROR - - - - - - - - - - - - - - - - - diff --git a/pjcloud-merchant/pom.xml b/pjcloud-merchant/pom.xml deleted file mode 100644 index 79da54d89..000000000 --- a/pjcloud-merchant/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - 4.0.0 - - - com.bsd - pjcloud - 5.7.0 - - - pjcloud-merchant - pom - - - - pjcloud-merchant-api - pjcloud-merchant-biz - - diff --git a/pjcloud-register/src/main/resources/application.yml b/pjcloud-register/src/main/resources/application.yml index fc374a227..d74b5848a 100644 --- a/pjcloud-register/src/main/resources/application.yml +++ b/pjcloud-register/src/main/resources/application.yml @@ -4,12 +4,23 @@ server: basedir: logs error: include-message: always +#db: +# num: 1 +# user: ${MYSQL_USER:root} +# password: ${MYSQL_PWD:root} +# url: +# 0: jdbc:mysql://${MYSQL_HOST:pjcloud-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pjcloudx_config}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true +# pool: +# config: +# connectionTimeout: 30000 +# validationTimeout: 10000 + db: num: 1 - user: ${MYSQL_USER:root} - password: ${MYSQL_PWD:root} + user: root + password: root url: - 0: jdbc:mysql://${MYSQL_HOST:pjcloud-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pjcloudx_config}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true + 0: jdbc:mysql://127.0.0.1:3306/pjcloudx_config?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true pool: config: connectionTimeout: 30000 diff --git a/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/feign/RemoteUserService.java b/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/feign/RemoteUserService.java index cd3a6b448..4ef0bee0f 100644 --- a/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/feign/RemoteUserService.java +++ b/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/feign/RemoteUserService.java @@ -57,6 +57,17 @@ public interface RemoteUserService { @GetMapping("/user/get-by-user-id") R getByUserId(@RequestParam("userId") Long userId); + /** + * 通过姓名和手机号查询用户、角色信息 + * + * @param name + * @param mobile + * @return + */ + @NoToken + @GetMapping("/user/get-name-and-mobile") + R getUserByNameAndMobile(@RequestParam("name") String name, @RequestParam("mobile") String mobile); + /** * 根据用户ID获取用户 * diff --git a/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/utils/DataUtil.java b/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/utils/DataUtil.java index 2819f4028..db9e04939 100644 --- a/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/utils/DataUtil.java +++ b/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/utils/DataUtil.java @@ -98,7 +98,7 @@ public class DataUtil { public T convertUser(T v, SysUser user) { if (ObjectUtil.isEmpty(user)) return v; - v.setUsername(user.getUsername()); + v.setUsername(user.getName()); v.setUserMobile(user.getPhone()); v.setUserAvatar(user.getAvatar()); return v; diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserController.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserController.java index 2b7b270e3..fbb18f88e 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserController.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserController.java @@ -78,6 +78,16 @@ public class SysUserController { return R.ok(userService.findUserInfo(user)); } + @Inner + @GetMapping("/get-name-and-mobile") + public R getUserByNameAndMobile(@RequestParam("name") String name, @RequestParam("mobile") String mobile) { + SysUser user = userService.getOne(Wrappers.query().lambda().eq(SysUser::getName, name).eq(SysUser::getPhone, mobile)); + if (user == null) { + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERINFO_EMPTY, name, mobile)); + } + return R.ok(userService.findUserInfo(user)); + } + /** * 获取指定用户全部信息 * diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserFaceController.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserFaceController.java index da64b360f..59373ccf5 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserFaceController.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/SysUserFaceController.java @@ -47,7 +47,7 @@ public class SysUserFaceController { */ @Operation(summary = "分页查询", description = "分页查询") @GetMapping("/page") - @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_view')") +// @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_view')") public R getSysUserFacePage(@ParameterObject Page page, @ParameterObject SysUserFaceEntity sysUserFace) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); return R.ok(sysUserFaceService.page(page, wrapper)); @@ -55,7 +55,7 @@ public class SysUserFaceController { @Operation(summary = "分页复杂查询", description = "分页复杂查询") @GetMapping("/page-join") - @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_view')") +// @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_view')") public R getSysUserFacePageJoin(@ParameterObject Page page, @ParameterObject SysUserFaceDto dto) { return R.ok(sysUserFaceService.pageJoin(page, dto)); } @@ -69,7 +69,7 @@ public class SysUserFaceController { */ @Operation(summary = "通过id查询", description = "通过id查询") @GetMapping("/{id}") - @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_view')") +// @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_view')") public R getById(@PathVariable("id") Long id) { return R.ok(sysUserFaceService.getById(id)); } @@ -83,7 +83,7 @@ public class SysUserFaceController { @Operation(summary = "新增人脸样本表", description = "新增人脸样本表") @SysLog("新增人脸样本表") @PostMapping - @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_add')") +// @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_add')") public R save(@RequestBody SysUserFaceEntity sysUserFace) { return R.ok(sysUserFaceService.create(sysUserFace)); } @@ -97,7 +97,7 @@ public class SysUserFaceController { @Operation(summary = "修改人脸样本表", description = "修改人脸样本表") @SysLog("修改人脸样本表") @PutMapping - @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_edit')") +// @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_edit')") public R updateById(@RequestBody SysUserFaceEntity sysUserFace) { sysUserFaceService.edit(sysUserFace); return R.ok(true); @@ -112,7 +112,7 @@ public class SysUserFaceController { @Operation(summary = "通过id删除人脸样本表", description = "通过id删除人脸样本表") @SysLog("通过id删除人脸样本表") @DeleteMapping - @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_del')") +// @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_del')") public R removeById(@RequestBody Long[] ids) { sysUserFaceService.delByIds(CollUtil.toList(ids)); return R.ok(true); @@ -128,7 +128,7 @@ public class SysUserFaceController { */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_export')") +// @PreAuthorize("@pms.hasPermission('userFace_sysUserFace_export')") public List export(SysUserFaceEntity sysUserFace, Long[] ids) { return sysUserFaceService.list(Wrappers.lambdaQuery(sysUserFace).in(ArrayUtil.isNotEmpty(ids), SysUserFaceEntity::getId, ids)); } diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/resources/file/wallet/wallet_recharge.xlsx b/pjcloud-upms/pjcloud-upms-biz/src/main/resources/file/wallet/wallet_recharge.xlsx new file mode 100644 index 000000000..aaec9141a Binary files /dev/null and b/pjcloud-upms/pjcloud-upms-biz/src/main/resources/file/wallet/wallet_recharge.xlsx differ diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/resources/file/wallet_recharge.xlsx b/pjcloud-upms/pjcloud-upms-biz/src/main/resources/file/wallet_recharge.xlsx new file mode 100644 index 000000000..aaec9141a Binary files /dev/null and b/pjcloud-upms/pjcloud-upms-biz/src/main/resources/file/wallet_recharge.xlsx differ diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletBizEnum.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletBizEnum.java index 7b290a540..4634dde84 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletBizEnum.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletBizEnum.java @@ -1,11 +1,13 @@ package com.bsd.pjcloud.wallet.api.constant; import cn.hutool.core.util.ObjectUtil; +import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Arrays; @Getter +@AllArgsConstructor public enum WalletBizEnum { UPDATE("1", "更新余额"), BATCH("2", "批量更新余额"), @@ -15,11 +17,6 @@ public enum WalletBizEnum { private final String desc; - WalletBizEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - public static WalletBizEnum descOf(String description) { return Arrays.stream(WalletBizEnum.values()) .filter(v -> ObjectUtil.equal(v.getDesc(), description)) diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletBizRechargeEnum.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletBizRechargeEnum.java new file mode 100644 index 000000000..17a2e8f36 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletBizRechargeEnum.java @@ -0,0 +1,24 @@ +package com.bsd.pjcloud.wallet.api.constant; + +import cn.hutool.core.util.ObjectUtil; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +@Getter +@AllArgsConstructor +public enum WalletBizRechargeEnum { + ADD("1", "添加"), + REDUCTION("2", "减少"), + ; + private final String code; + + private final String desc; + + public static WalletBizRechargeEnum descOf(String description) { + return Arrays.stream(WalletBizRechargeEnum.values()) + .filter(v -> ObjectUtil.equal(v.getDesc(), description)) + .findFirst().get(); + } +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeCodeEnum.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeCodeEnum.java index 6df4eb0c4..a5dbb0939 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeCodeEnum.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeCodeEnum.java @@ -1,11 +1,13 @@ package com.bsd.pjcloud.wallet.api.constant; import cn.hutool.core.util.ObjectUtil; +import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Arrays; @Getter +@AllArgsConstructor public enum WalletTypeCodeEnum { SUPERMARKET("1", "超市"), CANTEEN("2", "食堂"), @@ -14,11 +16,6 @@ public enum WalletTypeCodeEnum { private final String desc; - WalletTypeCodeEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - public static WalletTypeCodeEnum descOf(String description) { return Arrays.stream(WalletTypeCodeEnum.values()) .filter(v -> ObjectUtil.equal(v.getDesc(), description)) diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeEnum.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeEnum.java index 3d3a6b54b..7520afc93 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeEnum.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/constant/WalletTypeEnum.java @@ -1,11 +1,13 @@ package com.bsd.pjcloud.wallet.api.constant; import cn.hutool.core.util.ObjectUtil; +import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Arrays; @Getter +@AllArgsConstructor public enum WalletTypeEnum { EAT("1", "饭卡钱包"), @@ -16,11 +18,6 @@ public enum WalletTypeEnum { private final String desc; - WalletTypeEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - public static WalletTypeEnum descOf(String description) { return Arrays.stream(WalletTypeEnum.values()) .filter(v -> ObjectUtil.equal(v.getDesc(), description)) diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/MchManageDto.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/MchManageDto.java new file mode 100644 index 000000000..e8f477052 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/MchManageDto.java @@ -0,0 +1,19 @@ +package com.bsd.pjcloud.wallet.api.dto; + +import com.bsd.pjcloud.wallet.api.entity.MchManageEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class MchManageDto extends MchManageEntity { + + private List deptIds; + +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletActiveDto.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletActiveDto.java new file mode 100644 index 000000000..3da2f5f95 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletActiveDto.java @@ -0,0 +1,25 @@ +package com.bsd.pjcloud.wallet.api.dto; + +import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class WalletActiveDto extends WalletActiveEntity { + + @Schema(description = "数量") + @Max(200) + @Min(1) + @NotNull(message = "数量不能为空") + private Long count; + + @NotNull(message = "商户id不能为空") + private Long merchantId; + + @NotNull(message = "钱包类型id不能为空") + private Long walletTypeId; + +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletFreezeEntityDto.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletFreezeEntityDto.java new file mode 100644 index 000000000..cfe78fb9e --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletFreezeEntityDto.java @@ -0,0 +1,8 @@ +package com.bsd.pjcloud.wallet.api.dto; + +import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity; +import lombok.Data; + +@Data +public class WalletFreezeEntityDto extends WalletFreezeEntity { +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletRechargeApplyDto.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletRechargeApplyDto.java index 8638ffc54..3a2c2d5c1 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletRechargeApplyDto.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletRechargeApplyDto.java @@ -1,9 +1,16 @@ package com.bsd.pjcloud.wallet.api.dto; +import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface; import com.bsd.pjcloud.wallet.api.entity.WalletRechargeApplyEntity; import lombok.Data; +import java.util.List; + @Data public class WalletRechargeApplyDto extends WalletRechargeApplyEntity { + private List userIds; + + private List walletTypeIds; + } diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/excel/WalletRechargeExcelDto.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/excel/WalletRechargeExcelDto.java new file mode 100644 index 000000000..a6425c0a2 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/excel/WalletRechargeExcelDto.java @@ -0,0 +1,50 @@ +package com.bsd.pjcloud.wallet.api.dto.excel; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import com.bsd.pjcloud.common.excel.annotation.ExcelLine; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) +@HeadRowHeight(20) +@ContentRowHeight(10) +@ExcelIgnoreUnannotated +public class WalletRechargeExcelDto { + + /** + * 导入时候回显行号 + */ + @ExcelLine + @ExcelIgnore + private Long lineNum; + + @ColumnWidth(100) + @ExcelProperty("用户名") + private String username; + + @ColumnWidth(100) + @ExcelProperty("用户手机号") + private String userMobile; + + @ColumnWidth(100) + @ExcelProperty("操作金额") + private String price; + + // 操作余额 + private Integer priceNumber; + + // 用户id + private Long userId; +} diff --git a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/entity/MchManageEntity.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/MchManageEntity.java similarity index 96% rename from pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/entity/MchManageEntity.java rename to pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/MchManageEntity.java index 75cca3ad4..cb8cd549c 100644 --- a/pjcloud-merchant/pjcloud-merchant-api/src/main/java/merchant/entity/MchManageEntity.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/MchManageEntity.java @@ -1,4 +1,4 @@ -package merchant.entity; +package com.bsd.pjcloud.wallet.api.entity; import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.extension.activerecord.Model; @@ -11,8 +11,8 @@ import java.time.LocalDateTime; /** * 商户管理 * - * @author pjcloud - * @date 2024-12-27 17:25:08 + * @author dzc + * @date 2025-01-02 11:09:26 */ @Data @TenantTable diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletActiveEntity.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletActiveEntity.java new file mode 100644 index 000000000..2ecce9e77 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletActiveEntity.java @@ -0,0 +1,121 @@ +package com.bsd.pjcloud.wallet.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.bsd.pjcloud.common.core.util.TenantTable; +import java.time.LocalDateTime; + +/** + * 钱包开卡 + * + * @author dzc + * @date 2024-12-31 18:53:31 + */ +@Data +@TenantTable +@TableName("wallet_active") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "钱包开卡") +public class WalletActiveEntity extends Model { + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description="主键") + private Long id; + + /** + * 用户id + */ + @Schema(description="用户id") + private Long userId; + + /** + * 钱包id + */ + @Schema(description="钱包id") + private Long walletId; + + /** + * 饭卡类型id + */ + @Schema(description="饭卡类型id") + private Long walletTypeId; + + /** + * 部门id + */ + @Schema(description="部门id") + private Long deptId; + + /** + * 商户id + */ + @Schema(description="商户id") + private Long merchantId; + + /** + * 用户卡号 + */ + @Schema(description="用户卡号") + private String cardNumber; + + /** + * 饭卡顺序 + */ + @Schema(description="饭卡顺序") + private Integer cardSort; + + /** + * 饭卡是否在硬件上激活 + */ + @Schema(description="饭卡是否在硬件上激活") + private String isActiveHardware; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description="创建人") + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description="创建时间") + private LocalDateTime createTime; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description="修改人") + private String updateBy; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description="修改时间") + private LocalDateTime updateTime; + + /** + * 删除标记 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description="删除标记") + private String delFlag; + + /** + * 租户ID + */ + @Schema(description="租户ID") + private Long tenantId; +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletFreezeEntity.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletFreezeEntity.java new file mode 100644 index 000000000..6071d5684 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletFreezeEntity.java @@ -0,0 +1,97 @@ +package com.bsd.pjcloud.wallet.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.bsd.pjcloud.common.core.util.TenantTable; +import java.time.LocalDateTime; + +/** + * 饭卡冻结记录表 + * + * @author dzc + * @date 2024-12-31 18:54:43 + */ +@Data +@TenantTable +@TableName("wallet_freeze") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "饭卡冻结记录表") +public class WalletFreezeEntity extends Model { + + + /** + * 编号 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description="编号") + private Long id; + + /** + * 钱包id + */ + @Schema(description="钱包id") + private Long walletId; + + /** + * 用户id + */ + @Schema(description="用户id") + private Long userId; + + /** + * 冻结状态 + */ + @Schema(description="冻结状态") + private String freeStatus; + + /** + * 备注 + */ + @Schema(description="备注") + private String remark; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description="创建人") + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description="创建时间") + private LocalDateTime createTime; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description="修改人") + private String updateBy; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description="修改时间") + private LocalDateTime updateTime; + + /** + * 删除标记 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description="删除标记") + private String delFlag; + + /** + * 租户ID + */ + @Schema(description="租户ID") + private Long tenantId; +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeApplyEntity.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeApplyEntity.java index 36470a1bc..8b1a06095 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeApplyEntity.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeApplyEntity.java @@ -1,12 +1,16 @@ package com.bsd.pjcloud.wallet.api.entity; +import cn.hutool.core.date.DatePattern; import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import com.bsd.pjcloud.common.core.util.TenantTable; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDate; import java.time.LocalDateTime; /** @@ -21,7 +25,7 @@ import java.time.LocalDateTime; @EqualsAndHashCode(callSuper = true) @Schema(description = "充值/扣款申请") public class WalletRechargeApplyEntity extends Model { - + /** * 主键ID */ @@ -57,7 +61,8 @@ public class WalletRechargeApplyEntity extends Model * 导入时间(手动选择) */ @Schema(description = "导入时间(手动选择)") - private LocalDateTime importTime; + @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN) + private LocalDate importTime; /** * 备注 diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeImportEntity.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeImportEntity.java index 0a71b5c01..3504b8449 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeImportEntity.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/entity/WalletRechargeImportEntity.java @@ -3,8 +3,7 @@ package com.bsd.pjcloud.wallet.api.entity; import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; +import lombok.*; import com.bsd.pjcloud.common.core.util.TenantTable; import java.time.LocalDateTime; @@ -15,6 +14,9 @@ import java.time.LocalDateTime; * @author dzc * @date 2024-12-31 14:24:39 */ +@Builder +@AllArgsConstructor +@NoArgsConstructor @Data @TenantTable @TableName("wallet_recharge_import") diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteMchService.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteMchService.java new file mode 100644 index 000000000..0d3e8fdf0 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteMchService.java @@ -0,0 +1,33 @@ +package com.bsd.pjcloud.wallet.api.feign; + +import com.bsd.pjcloud.common.core.constant.ServiceNameConstants; +import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.common.feign.annotation.NoToken; +import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum; +import com.bsd.pjcloud.wallet.api.dto.MchManageDto; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +@FeignClient(contextId = "remoteMchService", value = ServiceNameConstants.WALLET_SERVICE) +public interface RemoteMchService { + + @NoToken + @GetMapping("/get-by-id") + R getById(@RequestParam Long id); + + @NoToken + @GetMapping("/get-by-ids") + R> getByIds(@RequestParam List ids); + + @NoToken + @GetMapping("/get-by-dept-id") + R getByDeptId(@RequestParam Long deptId); + + @NoToken + @GetMapping("/get-first-mch") + R getFirstMch(@RequestParam List deptIds); + +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteWalletService.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteWalletService.java index f1956c7e5..5523ff404 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteWalletService.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteWalletService.java @@ -7,7 +7,6 @@ import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum; import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; import java.util.List; diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/MchManageVo.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/MchManageVo.java new file mode 100644 index 000000000..2dfb00085 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/MchManageVo.java @@ -0,0 +1,12 @@ +package com.bsd.pjcloud.wallet.api.vo; + +import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface; +import com.bsd.pjcloud.wallet.api.entity.MchManageEntity; +import lombok.Data; + +@Data +public class MchManageVo extends MchManageEntity implements BaseDeptInterface { + + private String deptName; + +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletActiveVo.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletActiveVo.java new file mode 100644 index 000000000..27f250d4e --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletActiveVo.java @@ -0,0 +1,8 @@ +package com.bsd.pjcloud.wallet.api.vo; + +import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity; +import lombok.Data; + +@Data +public class WalletActiveVo extends WalletActiveEntity { +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletFreezeVo.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletFreezeVo.java new file mode 100644 index 000000000..eda567a06 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletFreezeVo.java @@ -0,0 +1,8 @@ +package com.bsd.pjcloud.wallet.api.vo; + +import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity; +import lombok.Data; + +@Data +public class WalletFreezeVo extends WalletFreezeEntity { +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletRechargeApplyVo.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletRechargeApplyVo.java index 008823f5a..f6f25f20e 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletRechargeApplyVo.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/WalletRechargeApplyVo.java @@ -1,9 +1,29 @@ package com.bsd.pjcloud.wallet.api.vo; +import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface; +import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface; import com.bsd.pjcloud.wallet.api.entity.WalletRechargeApplyEntity; import lombok.Data; @Data -public class WalletRechargeApplyVo extends WalletRechargeApplyEntity { +public class WalletRechargeApplyVo extends WalletRechargeApplyEntity implements BaseUserInterface, BaseDeptInterface { + + private String walletTypeName; + + private String uniqueCode; + + /** + * 用户相关 + */ + private String username; + + private String userMobile; + + private String userAvatar; + + /** + * 部门相关 + */ + private String deptName; } diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/code/MchCollectionCodeVo.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/code/MchCollectionCodeVo.java new file mode 100644 index 000000000..ea4af2c79 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/code/MchCollectionCodeVo.java @@ -0,0 +1,23 @@ +package com.bsd.pjcloud.wallet.api.vo.code; + +import lombok.Data; + +@Data +public class MchCollectionCodeVo { + /** + * 商户Id + */ + private Long id; + /** + * 商户名 + */ + private String name; + /** + * 商户类型 + */ + private String type; + + public String getFileName() { + return "merchant_collect_money_code_" + id; + } +} diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports b/pjcloud-wallet/pjcloud-wallet-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports index 66232e3fa..958a7276d 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports @@ -1 +1,2 @@ -com.bsd.pjcloud.wallet.api.feign.RemoteWalletService \ No newline at end of file +com.bsd.pjcloud.wallet.api.feign.RemoteWalletService +com.bsd.pjcloud.wallet.api.feign.RemoteMchService \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/pom.xml b/pjcloud-wallet/pjcloud-wallet-biz/pom.xml index 1aabf8d9d..0b52cbc90 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/pom.xml +++ b/pjcloud-wallet/pjcloud-wallet-biz/pom.xml @@ -94,6 +94,10 @@ org.springframework.boot spring-boot-starter-test + + com.bsd + pjcloud-common-idempotent + diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/MchManageController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/MchManageController.java new file mode 100644 index 000000000..b5dec56c7 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/MchManageController.java @@ -0,0 +1,183 @@ +package com.bsd.pjcloud.wallet.controller; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.bsd.pjcloud.common.core.util.BeanUtils; +import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.common.log.annotation.SysLog; +import com.bsd.pjcloud.common.security.annotation.Inner; +import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum; +import com.bsd.pjcloud.wallet.api.dto.MchManageDto; +import com.bsd.pjcloud.wallet.api.entity.MchManageEntity; +import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity; +import com.bsd.pjcloud.wallet.api.vo.MchManageVo; +import com.bsd.pjcloud.wallet.service.MchManageService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.bsd.pjcloud.common.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import org.springdoc.core.annotations.ParameterObject; +import org.springframework.http.HttpHeaders; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 商户管理 + * + * @author dzc + * @date 2025-01-02 11:09:26 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/mch-manage") +@Tag(description = "mch-manage", name = "商户管理管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class MchManageController { + + private final MchManageService mchManageService; + + /* ************************************* start 远程调用 start ************************************* */ + + @Inner + @GetMapping("/get-by-id") + public R getById(@RequestParam Long id) { + MchManageEntity mchManage = mchManageService.getById(id); + if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + return R.ok(BeanUtils.toBean(mchManage, MchManageDto.class)); + } + + @Inner + @GetMapping("/get-by-ids") + public R> getByIds(@RequestParam List ids) { + Page page = mchManageService.pageJoin(new Page<>(), MchManageDto.builder().deptIds(ids).build()); + if (ObjectUtil.isAllNotEmpty(page, page.getRecords())) return R.failed("商户不存在"); + return R.ok(BeanUtils.toBean(page.getRecords(), MchManageDto.class)); + } + + @Inner + @GetMapping("/get-by-dept-id") + public R getByDeptId(@RequestParam Long deptId) { + MchManageDto mchManage = mchManageService.getByDeptId(deptId); + if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + return R.ok(mchManage); + } + + @Inner + @GetMapping("/get-first-mch") + public R getFirstMch(@RequestParam List deptIds) { + MchManageDto mchManage = mchManageService.getFirstMch(deptIds); + if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + return R.ok(mchManage); + } + + /* ************************************* end 远程调用 end ************************************* */ + + /** + * 分页查询 + * + * @param page 分页对象 + * @param mchManage 商户管理 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('wallet_mchManage_view')") + public R getMchManagePage(@ParameterObject Page page, @ParameterObject MchManageEntity mchManage) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + return R.ok(mchManageService.page(page, wrapper)); + } + + /** + * 分页复杂查询 + * + * @param page 分页对象 + * @param dto 商户管理 + * @return + */ + @Operation(summary = "分页复杂查询", description = "分页查询") + @GetMapping("/page-join") + @PreAuthorize("@pms.hasPermission('wallet_mchManage_view')") + public R getMchManagePageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) { + return R.ok(mchManageService.pageJoin(page, dto)); + } + + + /** + * 通过id查询商户管理 + * + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('wallet_mchManage_view')") + public R getDetail(@PathVariable("id") Long id) { + return R.ok(mchManageService.getById(id)); + } + + /** + * 新增商户管理 + * + * @param mchManage 商户管理 + * @return R + */ + @Operation(summary = "新增商户管理", description = "新增商户管理") + @SysLog("新增商户管理") + @PostMapping + @PreAuthorize("@pms.hasPermission('wallet_mchManage_add')") + public R save(@RequestBody MchManageEntity mchManage) { + return R.ok(mchManageService.create(mchManage)); + } + + /** + * 修改商户管理 + * + * @param mchManage 商户管理 + * @return R + */ + @Operation(summary = "修改商户管理", description = "修改商户管理") + @SysLog("修改商户管理") + @PutMapping + @PreAuthorize("@pms.hasPermission('wallet_mchManage_edit')") + public R updateById(@RequestBody MchManageEntity mchManage) { + mchManageService.edit(mchManage); + return R.ok(true); + } + + /** + * 通过id删除商户管理 + * + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除商户管理", description = "通过id删除商户管理") + @SysLog("通过id删除商户管理") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('wallet_mchManage_del')") + public R removeById(@RequestBody Long[] ids) { + mchManageService.delByIds(CollUtil.toList(ids)); + return R.ok(true); + } + + + /** + * 导出excel 表格 + * + * @param mchManage 查询条件 + * @param ids 导出指定ID + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('wallet_mchManage_export')") + public List export(MchManageEntity mchManage, Long[] ids) { + return mchManageService.list(Wrappers.lambdaQuery(mchManage).in(ArrayUtil.isNotEmpty(ids), MchManageEntity::getId, ids)); + } +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletActiveController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletActiveController.java new file mode 100644 index 000000000..1a7fdc47f --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletActiveController.java @@ -0,0 +1,138 @@ +package com.bsd.pjcloud.wallet.controller; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.common.idempotent.annotation.Idempotent; +import com.bsd.pjcloud.common.log.annotation.SysLog; +import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto; +import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity; +import com.bsd.pjcloud.wallet.service.WalletActiveService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.bsd.pjcloud.common.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import org.springdoc.core.annotations.ParameterObject; +import org.springframework.http.HttpHeaders; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +/** + * 钱包开卡 + * + * @author dzc + * @date 2024-12-31 18:53:31 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/wallet-active") +@Tag(description = "wallet-active", name = "钱包开卡管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +@Validated +public class WalletActiveController { + + private final WalletActiveService walletActiveService; + + @PostMapping("/fast-create-card") + @Operation(summary = "一键开卡") + @Idempotent(info = "正在开卡中,请勿重复提交") + public R fastCreateCard(WalletActiveDto dto) { + walletActiveService.fastCreateCard(dto); + return R.ok(true); + } + + /** + * 分页查询 + * + * @param page 分页对象 + * @param walletActive 钱包开卡 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('wallet_walletActive_view')") + public R getWalletActivePage(@ParameterObject Page page, @ParameterObject WalletActiveEntity walletActive) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + return R.ok(walletActiveService.page(page, wrapper)); + } + + + /** + * 通过id查询钱包开卡 + * + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('wallet_walletActive_view')") + public R getById(@PathVariable("id") Long id) { + return R.ok(walletActiveService.getById(id)); + } + + /** + * 新增钱包开卡 + * + * @param walletActive 钱包开卡 + * @return R + */ + @Operation(summary = "新增钱包开卡", description = "新增钱包开卡") + @SysLog("新增钱包开卡") + @PostMapping + @PreAuthorize("@pms.hasPermission('wallet_walletActive_add')") + public R save(@RequestBody WalletActiveEntity walletActive) { + return R.ok(walletActiveService.save(walletActive)); + } + + /** + * 修改钱包开卡 + * + * @param walletActive 钱包开卡 + * @return R + */ + @Operation(summary = "修改钱包开卡", description = "修改钱包开卡") + @SysLog("修改钱包开卡") + @PutMapping + @PreAuthorize("@pms.hasPermission('wallet_walletActive_edit')") + public R updateById(@RequestBody WalletActiveEntity walletActive) { + return R.ok(walletActiveService.updateById(walletActive)); + } + + /** + * 通过id删除钱包开卡 + * + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除钱包开卡", description = "通过id删除钱包开卡") + @SysLog("通过id删除钱包开卡") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('wallet_walletActive_del')") + public R removeById(@RequestBody Long[] ids) { + return R.ok(walletActiveService.removeBatchByIds(CollUtil.toList(ids))); + } + + + /** + * 导出excel 表格 + * + * @param walletActive 查询条件 + * @param ids 导出指定ID + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('wallet_walletActive_export')") + public List export(WalletActiveEntity walletActive, Long[] ids) { + return walletActiveService.list(Wrappers.lambdaQuery(walletActive).in(ArrayUtil.isNotEmpty(ids), WalletActiveEntity::getId, ids)); + } +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletFreezeController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletFreezeController.java new file mode 100644 index 000000000..523615236 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletFreezeController.java @@ -0,0 +1,118 @@ +package com.bsd.pjcloud.wallet.controller; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.common.log.annotation.SysLog; +import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity; +import com.bsd.pjcloud.wallet.service.WalletFreezeService; +import org.springframework.security.access.prepost.PreAuthorize; +import com.bsd.pjcloud.common.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import org.springdoc.core.annotations.ParameterObject; +import org.springframework.http.HttpHeaders; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 饭卡冻结记录表 + * + * @author dzc + * @date 2024-12-31 18:54:43 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/wallet-freeze" ) +@Tag(description = "wallet-freeze" , name = "饭卡冻结记录表管理" ) +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class WalletFreezeController { + + private final WalletFreezeService walletFreezeService; + + /** + * 分页查询 + * @param page 分页对象 + * @param walletFreeze 饭卡冻结记录表 + * @return + */ + @Operation(summary = "分页查询" , description = "分页查询" ) + @GetMapping("/page" ) + @PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')" ) + public R getWalletFreezePage(@ParameterObject Page page, @ParameterObject WalletFreezeEntity walletFreeze) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + return R.ok(walletFreezeService.page(page, wrapper)); + } + + + /** + * 通过id查询饭卡冻结记录表 + * @param id id + * @return R + */ + @Operation(summary = "通过id查询" , description = "通过id查询" ) + @GetMapping("/{id}" ) + @PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')" ) + public R getById(@PathVariable("id" ) Long id) { + return R.ok(walletFreezeService.getById(id)); + } + + /** + * 新增饭卡冻结记录表 + * @param walletFreeze 饭卡冻结记录表 + * @return R + */ + @Operation(summary = "新增饭卡冻结记录表" , description = "新增饭卡冻结记录表" ) + @SysLog("新增饭卡冻结记录表" ) + @PostMapping + @PreAuthorize("@pms.hasPermission('wallet_walletFreeze_add')" ) + public R save(@RequestBody WalletFreezeEntity walletFreeze) { + return R.ok(walletFreezeService.save(walletFreeze)); + } + + /** + * 修改饭卡冻结记录表 + * @param walletFreeze 饭卡冻结记录表 + * @return R + */ + @Operation(summary = "修改饭卡冻结记录表" , description = "修改饭卡冻结记录表" ) + @SysLog("修改饭卡冻结记录表" ) + @PutMapping + @PreAuthorize("@pms.hasPermission('wallet_walletFreeze_edit')" ) + public R updateById(@RequestBody WalletFreezeEntity walletFreeze) { + return R.ok(walletFreezeService.updateById(walletFreeze)); + } + + /** + * 通过id删除饭卡冻结记录表 + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除饭卡冻结记录表" , description = "通过id删除饭卡冻结记录表" ) + @SysLog("通过id删除饭卡冻结记录表" ) + @DeleteMapping + @PreAuthorize("@pms.hasPermission('wallet_walletFreeze_del')" ) + public R removeById(@RequestBody Long[] ids) { + return R.ok(walletFreezeService.removeBatchByIds(CollUtil.toList(ids))); + } + + + /** + * 导出excel 表格 + * @param walletFreeze 查询条件 + * @param ids 导出指定ID + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('wallet_walletFreeze_export')" ) + public List export(WalletFreezeEntity walletFreeze,Long[] ids) { + return walletFreezeService.list(Wrappers.lambdaQuery(walletFreeze).in(ArrayUtil.isNotEmpty(ids), WalletFreezeEntity::getId, ids)); + } +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletRechargeApplyController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletRechargeApplyController.java index ef9d99fc3..5bf339f26 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletRechargeApplyController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletRechargeApplyController.java @@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.common.excel.annotation.RequestExcel; import com.bsd.pjcloud.common.log.annotation.SysLog; +import com.bsd.pjcloud.wallet.api.dto.WalletRechargeApplyDto; +import com.bsd.pjcloud.wallet.api.dto.excel.WalletRechargeExcelDto; import com.bsd.pjcloud.wallet.api.entity.WalletRechargeApplyEntity; import com.bsd.pjcloud.wallet.service.WalletRechargeApplyService; import org.springframework.security.access.prepost.PreAuthorize; @@ -17,8 +20,8 @@ import org.springframework.http.HttpHeaders; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; +import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; - import java.util.List; /** @@ -36,6 +39,35 @@ public class WalletRechargeApplyController { private final WalletRechargeApplyService walletRechargeApplyService; + + /** + * 提交申请 + * + * @return + */ + @Operation(summary = "提交申请", description = "提交申请") + @SysLog("提交申请") + @PostMapping("/apply") + @PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_apply')") + public R apply(@RequestBody WalletRechargeApplyDto dto) { + walletRechargeApplyService.apply(dto); + return R.ok(true); + } + + /** + * 取消申请 + * + * @return + */ + @Operation(summary = "取消申请", description = "取消申请") + @SysLog("取消申请") + @PostMapping("/cancel-apply") + @PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_cancel_apply')") + public R cancelApply(@RequestBody WalletRechargeApplyDto dto) { + walletRechargeApplyService.cancelApply(dto); + return R.ok(true); + } + /** * 分页查询 * @@ -51,6 +83,20 @@ public class WalletRechargeApplyController { return R.ok(walletRechargeApplyService.page(page, wrapper)); } + /** + * 分页查询 + * + * @param page 分页对象 + * @param dto 充值/扣款申请 + * @return + */ + @Operation(summary = "分页复杂查询", description = "分页复杂查询") + @GetMapping("/page-join") + @PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_view')") + public R getWalletRechargeApplyPage(@ParameterObject Page page, @ParameterObject WalletRechargeApplyDto dto) { + return R.ok(walletRechargeApplyService.pageJoin(page, dto)); + } + /** * 通过id查询充值/扣款申请 @@ -68,15 +114,16 @@ public class WalletRechargeApplyController { /** * 新增充值/扣款申请 * - * @param walletRechargeApply 充值/扣款申请 + * @param dto 充值/扣款申请 * @return R */ @Operation(summary = "新增充值/扣款申请", description = "新增充值/扣款申请") @SysLog("新增充值/扣款申请") @PostMapping @PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_add')") - public R save(@RequestBody WalletRechargeApplyEntity walletRechargeApply) { - return R.ok(walletRechargeApplyService.save(walletRechargeApply)); + public R save(@RequestBody WalletRechargeApplyDto dto) { + walletRechargeApplyService.create(dto); + return R.ok(); } /** @@ -108,6 +155,8 @@ public class WalletRechargeApplyController { } + /* ************************************* start excel start ************************************* */ + /** * 导出excel 表格 * @@ -121,4 +170,17 @@ public class WalletRechargeApplyController { public List export(WalletRechargeApplyEntity walletRechargeApply, Long[] ids) { return walletRechargeApplyService.list(Wrappers.lambdaQuery(walletRechargeApply).in(ArrayUtil.isNotEmpty(ids), WalletRechargeApplyEntity::getId, ids)); } + + /** + * 读取excel内容 + * @param excelVOList + * @param bindingResult + * @return + */ + @PostMapping("/read-excel") + public R readExcel(@RequestExcel List excelVOList, BindingResult bindingResult) { + return walletRechargeApplyService.readExcel(excelVOList, bindingResult); + } + /* ************************************* start excel start ************************************* */ + } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTypeController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTypeController.java index ccb8a86dc..5c5cae8f6 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTypeController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTypeController.java @@ -66,28 +66,30 @@ public class WalletTypeController { /** * 新增钱包类型 - * @param walletType 钱包类型 + * @param dto 钱包类型 * @return R */ @Operation(summary = "新增钱包类型" , description = "新增钱包类型" ) @SysLog("新增钱包类型" ) @PostMapping @PreAuthorize("@pms.hasPermission('wallet_walletType_add')" ) - public R save(@RequestBody WalletTypeEntity walletType) { - return R.ok(walletTypeService.save(walletType)); + public R save(@RequestBody WalletTypeEntity dto) { + walletTypeService.create(dto); + return R.ok(true); } /** * 修改钱包类型 - * @param walletType 钱包类型 + * @param dto 钱包类型 * @return R */ @Operation(summary = "修改钱包类型" , description = "修改钱包类型" ) @SysLog("修改钱包类型" ) @PutMapping @PreAuthorize("@pms.hasPermission('wallet_walletType_edit')" ) - public R updateById(@RequestBody WalletTypeEntity walletType) { - return R.ok(walletTypeService.updateById(walletType)); + public R updateById(@RequestBody WalletTypeEntity dto) { + walletTypeService.edit(dto); + return R.ok(true); } /** diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/MchManageMapper.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/MchManageMapper.java new file mode 100644 index 000000000..04b3bde97 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/MchManageMapper.java @@ -0,0 +1,21 @@ +package com.bsd.pjcloud.wallet.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper; +import com.bsd.pjcloud.wallet.api.dto.MchManageDto; +import com.bsd.pjcloud.wallet.api.entity.MchManageEntity; +import com.bsd.pjcloud.wallet.api.vo.MchManageVo; +import com.github.yulichang.query.MPJLambdaQueryWrapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface MchManageMapper extends PjcloudBaseMapper { + + + default Page pageJoin(Page page, MchManageDto dto) { + MPJLambdaQueryWrapper wrapper = new MPJLambdaQueryWrapper() + .selectAll(MchManageEntity.class) + .likeIfExists(MchManageEntity::getName, dto.getName()); + return selectJoinPage(page, MchManageVo.class, wrapper); + } +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletActiveMapper.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletActiveMapper.java new file mode 100644 index 000000000..667e1c529 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletActiveMapper.java @@ -0,0 +1,11 @@ +package com.bsd.pjcloud.wallet.mapper; + +import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper; +import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface WalletActiveMapper extends PjcloudBaseMapper { + + +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletFreezeMapper.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletFreezeMapper.java new file mode 100644 index 000000000..f7e2d8bc4 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletFreezeMapper.java @@ -0,0 +1,11 @@ +package com.bsd.pjcloud.wallet.mapper; + +import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper; +import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface WalletFreezeMapper extends PjcloudBaseMapper { + + +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletRechargeApplyMapper.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletRechargeApplyMapper.java index 3fc0ed42b..444059a74 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletRechargeApplyMapper.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletRechargeApplyMapper.java @@ -1,11 +1,29 @@ package com.bsd.pjcloud.wallet.mapper; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper; +import com.bsd.pjcloud.wallet.api.dto.WalletRechargeApplyDto; +import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity; import com.bsd.pjcloud.wallet.api.entity.WalletRechargeApplyEntity; +import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity; +import com.bsd.pjcloud.wallet.api.vo.WalletRechargeApplyVo; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.apache.ibatis.annotations.Mapper; @Mapper public interface WalletRechargeApplyMapper extends PjcloudBaseMapper { + default Page pageJoin(Page page, WalletRechargeApplyDto dto) { + MPJLambdaWrapper wrapper = new MPJLambdaWrapper() + .selectAll(WalletRechargeApplyEntity.class) + .selectAs(WalletTypeEntity::getName, WalletRechargeApplyVo::getWalletTypeName) + .selectAs(WalletTypeEntity::getUniqueCode, WalletRechargeApplyVo::getUniqueCode) + .leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletRechargeApplyEntity::getWalletTypeId) + .eqIfExists(WalletRechargeApplyEntity::getWalletTypeId, dto.getWalletTypeId()) + .in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds()) + .in(ObjectUtil.isNotEmpty(dto.getWalletTypeIds()), WalletManageEntity::getWalletTypeId, dto.getWalletTypeIds()); + return selectJoinPage(page, WalletRechargeApplyVo.class, wrapper); + } } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/MchManageService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/MchManageService.java new file mode 100644 index 000000000..83e52d323 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/MchManageService.java @@ -0,0 +1,25 @@ +package com.bsd.pjcloud.wallet.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.bsd.pjcloud.wallet.api.dto.MchManageDto; +import com.bsd.pjcloud.wallet.api.entity.MchManageEntity; +import com.bsd.pjcloud.wallet.api.vo.MchManageVo; + +import java.util.ArrayList; +import java.util.List; + +public interface MchManageService extends IService { + + Long create(MchManageEntity dto); + + void edit(MchManageEntity dto); + + void delByIds(ArrayList list); + + Page pageJoin(Page page, MchManageDto dto); + + MchManageDto getByDeptId(Long deptId); + + MchManageDto getFirstMch(List deptIds); +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletActiveService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletActiveService.java new file mode 100644 index 000000000..85dcb627c --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletActiveService.java @@ -0,0 +1,14 @@ +package com.bsd.pjcloud.wallet.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto; +import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity; + +public interface WalletActiveService extends IService { + /** + * 一键开卡 + * + * @param dto + */ + void fastCreateCard(WalletActiveDto dto); +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletFreezeService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletFreezeService.java new file mode 100644 index 000000000..9177fdcdb --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletFreezeService.java @@ -0,0 +1,8 @@ +package com.bsd.pjcloud.wallet.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity; + +public interface WalletFreezeService extends IService { + +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeApplyService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeApplyService.java index 21320770e..fe7424330 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeApplyService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeApplyService.java @@ -1,8 +1,40 @@ package com.bsd.pjcloud.wallet.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.wallet.api.dto.WalletRechargeApplyDto; +import com.bsd.pjcloud.wallet.api.dto.excel.WalletRechargeExcelDto; import com.bsd.pjcloud.wallet.api.entity.WalletRechargeApplyEntity; +import com.bsd.pjcloud.wallet.api.vo.WalletRechargeApplyVo; +import org.springframework.validation.BindingResult; + +import java.util.List; public interface WalletRechargeApplyService extends IService { + void create(WalletRechargeApplyEntity dto); + + Page pageJoin(Page page, WalletRechargeApplyDto dto); + + /** + * 提交申请 + * + * @param dto + */ + void apply(WalletRechargeApplyDto dto); + + /** + * 取消申请 + * + * @param dto + */ + void cancelApply(WalletRechargeApplyDto dto); + + /** + * 读取excel内容 + * @param excelVOList + * @param bindingResult + */ + R readExcel(List excelVOList, BindingResult bindingResult); } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTypeService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTypeService.java index ad9d02199..d3bdb40e4 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTypeService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTypeService.java @@ -10,4 +10,7 @@ public interface WalletTypeService extends IService { WalletTypeEntity getByUniqueCode(WalletTypeCodeEnum walletTypeCodeEnum); + void create(WalletTypeEntity dto); + + void edit(WalletTypeEntity dto); } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/MchManageServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/MchManageServiceImpl.java new file mode 100644 index 000000000..366ceaab0 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/MchManageServiceImpl.java @@ -0,0 +1,175 @@ +package com.bsd.pjcloud.wallet.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bsd.pjcloud.admin.api.entity.SysDept; +import com.bsd.pjcloud.admin.api.feign.RemoteDeptService; +import com.bsd.pjcloud.admin.api.feign.RemoteFileService; +import com.bsd.pjcloud.admin.api.utils.DataUtil; +import com.bsd.pjcloud.common.core.constant.CacheConstants; +import com.bsd.pjcloud.common.core.exception.CheckedException; +import com.bsd.pjcloud.common.core.util.BeanUtils; +import com.bsd.pjcloud.common.core.util.QRCodeImageGenerator; +import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.wallet.api.dto.MchManageDto; +import com.bsd.pjcloud.wallet.api.entity.MchManageEntity; +import com.bsd.pjcloud.wallet.api.vo.MchManageVo; +import com.bsd.pjcloud.wallet.api.vo.code.MchCollectionCodeVo; +import com.bsd.pjcloud.wallet.mapper.MchManageMapper; +import com.bsd.pjcloud.wallet.service.MchManageService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.multipart.MultipartFile; + +import java.io.ByteArrayInputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 商户管理 + * + * @author dzc + * @date 2025-01-02 11:09:26 + */ +@Validated +@Slf4j +@RequiredArgsConstructor +@Service +public class MchManageServiceImpl extends ServiceImpl implements MchManageService { + + private final String TAG = "商户管理"; + + private final RemoteDeptService remoteDeptService; + private final RemoteFileService remoteFileService; + + private final StringRedisTemplate redisTemplate; + + @Override + @Cacheable(value = CacheConstants.WALLET_DETAIL, key = "#id", condition = "#id != null", unless = "#result == null") + public MchManageEntity getById(Serializable id) { + return super.getById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Long create(MchManageEntity dto) { + if (existName(dto.getName(), null)) { + throw new CheckedException("商户名不能重复"); + } + if (existDeptId(dto.getDeptId(), null)) { + throw new CheckedException("改部门已经绑定过商户"); + } + baseMapper.insert(dto); + try { + MchCollectionCodeVo mchCollectionCode = new MchCollectionCodeVo(); + BeanUtils.toBean(dto, MchCollectionCodeVo.class); + byte[] bytes = QRCodeImageGenerator.generateQrCodeImage(JSON.toJSONString(mchCollectionCode), 1024); + MultipartFile multipartFile = new MockMultipartFile("file", mchCollectionCode.getFileName() + ".png", "image/png", new ByteArrayInputStream(bytes)); + R upload = remoteFileService.upload(multipartFile, null, null, null); + Map data = (Map) upload.getData(); + String url = (String) data.get("url"); + MchManageEntity merchantInfoEntity = new MchManageEntity(); + merchantInfoEntity.setCollectionCode(url); + merchantInfoEntity.setId(dto.getId()); + updateById(merchantInfoEntity); + } catch (Exception e) { + e.printStackTrace(); + log.error("|{}|新增商户,生成收款码错误dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage()); + } + return dto.getId(); + } + + @Override + @CachePut(value = CacheConstants.WALLET_MCH, key = "dto.getId()", condition = "dto.getId() != null", unless = "#result == null ") + public void edit(MchManageEntity dto) { + if (existName(dto.getName(), null)) { + throw new CheckedException("商户名不能重复"); + } + if (existDeptId(dto.getDeptId(), null)) { + throw new CheckedException("改部门已经绑定过商户"); + } + MchManageEntity mchManage = getById(dto.getId()); + if (ObjectUtil.isEmpty(mchManage)) { + throw new CheckedException("商户不存在"); + } + baseMapper.updateById(dto); + } + + @Override + public void delByIds(ArrayList list) { + if (ObjectUtil.isEmpty(list)) return; + delByIds(list); + // 删除缓存 + list.forEach(v -> redisTemplate.opsForValue().getAndDelete(CacheConstants.WALLET_MCH + v)); + } + + @Override + public Page pageJoin(Page page, MchManageDto dto) { + Page list = baseMapper.pageJoin(page, dto); + if (ObjectUtil.isNotEmpty(list.getRecords())) { + // 部门 + List deptIds = list.getRecords().stream().map(MchManageVo::getDeptId).distinct().toList(); + R> deptList = remoteDeptService.getDeptByDeptIds(deptIds); + if (ObjectUtil.isNotEmpty(deptList.getData())) { + DataUtil.convertDeptList(page.getRecords(), deptList.getData()); + } + } + return list; + } + + @Override + public MchManageDto getByDeptId(Long deptId) { + MchManageEntity mchManage = baseMapper.selectOne(new LambdaQueryWrapper() + .eq(MchManageEntity::getDeptId, deptId) + ); + return BeanUtils.toBean(mchManage, MchManageDto.class); + } + + @Override + public MchManageDto getFirstMch(List deptIds) { + List merchantList = baseMapper.selectList(new LambdaQueryWrapper()); + if (ObjectUtil.isEmpty(merchantList)) return null; + for (Long id : deptIds) { + for (MchManageEntity merchant : merchantList) { + if (ObjectUtil.equals(merchant.getDeptId(), id)) { + return BeanUtils.toBean(merchant, MchManageDto.class); + } + } + } + return null; + } + + private boolean existName(String name, Long id) { + Long count = baseMapper.selectCount(new LambdaQueryWrapper() + .eq(ObjectUtil.isNotEmpty(name), MchManageEntity::getName, name) + .ne(ObjectUtil.isNotEmpty(id), MchManageEntity::getId, id) + ); + if (ObjectUtil.isNotEmpty(id)) { + return count >= 1; + } + return count > 0; + } + + private boolean existDeptId(Long deptId, Long id) { + Long count = baseMapper.selectCount(new LambdaQueryWrapper() + .eq(ObjectUtil.isNotEmpty(deptId), MchManageEntity::getDeptId, deptId) + .ne(ObjectUtil.isNotEmpty(id), MchManageEntity::getId, id) + ); + if (ObjectUtil.isNotEmpty(id)) { + return count >= 1; + } + return count > 0; + } +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletActiveServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletActiveServiceImpl.java new file mode 100644 index 000000000..33c997c26 --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletActiveServiceImpl.java @@ -0,0 +1,71 @@ +package com.bsd.pjcloud.wallet.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum; +import com.bsd.pjcloud.common.core.exception.CheckedException; +import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum; +import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto; +import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity; +import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity; +import com.bsd.pjcloud.wallet.mapper.WalletActiveMapper; +import com.bsd.pjcloud.wallet.service.WalletActiveService; +import com.bsd.pjcloud.wallet.service.WalletTypeService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import java.util.ArrayList; +import java.util.List; + +/** + * 钱包开卡 + * + * @author dzc + * @date 2024-12-31 18:53:31 + */ +@Validated +@Slf4j +@RequiredArgsConstructor +@Service +public class WalletActiveServiceImpl extends ServiceImpl implements WalletActiveService { + + private final WalletTypeService walletTypeService; + + @Override + @Transactional(rollbackFor = Exception.class) + public void fastCreateCard(WalletActiveDto dto) { + Long count = dto.getCount(); + // 查询饭卡钱包类型 + WalletTypeEntity walletType = walletTypeService.getById(dto.getWalletTypeId()); + if (ObjectUtil.isEmpty(walletType)) throw new CheckedException("钱包类型不存在"); + // 查询商户 + + int startNum = 1; + WalletActiveEntity last = getLast(); + if (ObjectUtil.isNotEmpty(last)) startNum = last.getCardSort(); + List batchSaveList = new ArrayList<>(); + for (int i = 0; i < count; i++) { + startNum += 1; + WalletActiveEntity item = new WalletActiveEntity(); + String cardNumber = "hq" + String.format("%06d", startNum) + RandomUtil.randomString(RandomUtil.BASE_CHAR, 4); + item.setCardNumber(cardNumber); + item.setWalletTypeId(walletType.getId()); + item.setDeptId(null); + item.setMerchantId(null); + item.setIsActiveHardware(YesNoEnum.NO.getCode()); + batchSaveList.add(item); + } + baseMapper.insert(batchSaveList); + } + + private WalletActiveEntity getLast() { + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.orderByDesc(WalletActiveEntity::getId).last("LIMIT 1"); + return baseMapper.selectOne(query); + } +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletFreezeServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletFreezeServiceImpl.java new file mode 100644 index 000000000..2ea4dc98d --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletFreezeServiceImpl.java @@ -0,0 +1,23 @@ +package com.bsd.pjcloud.wallet.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity; +import com.bsd.pjcloud.wallet.mapper.WalletFreezeMapper; +import com.bsd.pjcloud.wallet.service.WalletFreezeService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +/** + * 饭卡冻结记录表 + * + * @author dzc + * @date 2024-12-31 18:54:43 + */ +@Validated +@Slf4j +@RequiredArgsConstructor +@Service +public class WalletFreezeServiceImpl extends ServiceImpl implements WalletFreezeService { +} \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletManageServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletManageServiceImpl.java index f030ce754..2953349e6 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletManageServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletManageServiceImpl.java @@ -24,11 +24,9 @@ import com.bsd.pjcloud.wallet.mapper.WalletManageMapper; import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper; import com.bsd.pjcloud.wallet.service.WalletManageService; import com.bsd.pjcloud.wallet.service.WalletTypeService; -import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.ehcache.xml.model.CacheTemplate; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.redis.core.StringRedisTemplate; @@ -100,7 +98,6 @@ public class WalletManageServiceImpl extends ServiceImpl implements WalletRechargeApplyService { + + private final WalletRechargeImportServiceImpl rechargeImportService; + private final WalletManageService walletManageService; + + private final RemoteUserService userService; + private final RemoteDeptService deptService; + + @Override + public void create(WalletRechargeApplyEntity dto) { + PjcloudUser loginUser = SecurityUtils.getUser(); + dto.setDeptId(loginUser.getDeptId()); + dto.setUserId(loginUser.getId()); + baseMapper.insert(dto); + } + + @Override + public Page pageJoin(Page page, WalletRechargeApplyDto dto) { + Page list = baseMapper.pageJoin(page, dto); + if (ObjectUtil.isNotEmpty(list.getRecords())) { + // 用户 + List userIds = list.getRecords().stream().map(WalletRechargeApplyVo::getUserId).distinct().toList(); + R> userList = userService.getUserById(new ArrayList<>(userIds)); + if (ObjectUtil.isNotEmpty(userList.getData())) { + DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId)); + } + // 部门 + List deptIds = list.getRecords().stream().map(WalletRechargeApplyVo::getDeptId).distinct().toList(); + R> deptList = deptService.getDeptByDeptIds(deptIds); + if (ObjectUtil.isNotEmpty(deptList.getData())) { + DataUtil.convertDeptList(page.getRecords(), deptList.getData()); + } + } + return list; + } + + @Override + public void apply(WalletRechargeApplyDto dto) { + WalletRechargeApplyEntity rechargeApply = baseMapper.selectById(dto.getId()); + if (ObjectUtil.isEmpty(rechargeApply)) { + throw new CheckedException("充值申请不存在"); + } + baseMapper.updateById(dto); + } + + @Override + public void cancelApply(WalletRechargeApplyDto dto) { + WalletRechargeApplyEntity rechargeApply = baseMapper.selectById(dto.getId()); + if (ObjectUtil.isEmpty(rechargeApply)) { + throw new CheckedException("充值申请不存在"); + } + } + + /* ************************************* start excel start ************************************* */ + + @Override + @Transactional(rollbackFor = Exception.class) + public R readExcel(List list, BindingResult bindingResult) { + if (ObjectUtil.isEmpty(list)) return R.failed(); + list = list.stream().filter(v -> !ObjectUtil.isAllEmpty(v.getUsername(), v.getUserMobile(), v.getPrice())).toList(); + if (ObjectUtil.isEmpty(list)) return R.failed(); + List errorMessageList = (List) bindingResult.getTarget(); + for (WalletRechargeExcelDto v : list) { + Set errors = new LinkedHashSet<>(); + if (ObjectUtil.isEmpty(v.getPrice())) { + errors.add("请输入操作金额"); + } else { + try { + int i = new BigDecimal(v.getPrice()).multiply(new BigDecimal(100)).intValue(); + v.setPriceNumber(i); + } catch (Exception e) { + errors.add("请输入正确的操作金额"); + } + } + if (ObjectUtil.isEmpty(v.getUsername())) { + errors.add("请输入用户名"); + } else if (ObjectUtil.isEmpty(v.getUserMobile())) { + errors.add("请输入用户手机号"); + } else if (!Validator.isMobile(v.getUserMobile())) { + errors.add("用户手机号格式不正确"); + } else { + R user = userService.getUserByNameAndMobile(v.getUsername(), v.getUserMobile()); + Optional userId = Optional.of(user).map(R::getData).map(UserInfo::getSysUser).map(SysUser::getUserId); + if (userId.isEmpty()) { + errors.add("用户不存在"); + } else { + v.setUserId(userId.get()); + } + } + if (ObjectUtil.isNotEmpty(errors)) { + errorMessageList.add(new ErrorMessage(v.getLineNum(), errors)); + } + } + if (ObjectUtil.isNotEmpty(errorMessageList)) { + return R.failed(errorMessageList); + } + PjcloudUser loginUser = SecurityUtils.getUser(); + WalletRechargeApplyEntity insertObj = new WalletRechargeApplyEntity(); + insertObj.setDeptId(loginUser.getDeptId()); + insertObj.setUserId(loginUser.getId()); + int i = baseMapper.insert(insertObj); + if (i <= 0) { + throw new CheckedException("导入失败"); + } + List batchSaveList = list.stream().map(v -> WalletRechargeImportEntity.builder().price(v.getPriceNumber()).userId(v.getUserId()).build()).toList(); + batchSaveList.forEach(v -> v.setApplyId(insertObj.getId())); + rechargeImportService.saveBatch(batchSaveList); + return R.ok(null, MsgUtils.getMessage(ErrorCodes.SYS_USER_IMPORT_SUCCEED)); + } + + /* ************************************* end excel end ************************************* */ } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletRechargeImportServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletRechargeImportServiceImpl.java index a7443d88a..176aca4f5 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletRechargeImportServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletRechargeImportServiceImpl.java @@ -3,6 +3,7 @@ package com.bsd.pjcloud.wallet.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.bsd.pjcloud.wallet.api.entity.WalletRechargeImportEntity; import com.bsd.pjcloud.wallet.mapper.WalletRechargeImportMapper; +import com.bsd.pjcloud.wallet.service.WalletRechargeImportService; import org.springframework.stereotype.Service; /** * 充值导入表 diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTypeServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTypeServiceImpl.java index fe1ab411e..deaf74138 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTypeServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTypeServiceImpl.java @@ -1,12 +1,15 @@ package com.bsd.pjcloud.wallet.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.bsd.pjcloud.common.core.constant.CacheConstants; +import com.bsd.pjcloud.common.core.exception.CheckedException; import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum; import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity; import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper; import com.bsd.pjcloud.wallet.service.WalletTypeService; +import com.github.yulichang.query.MPJLambdaQueryWrapper; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @@ -34,4 +37,51 @@ public class WalletTypeServiceImpl extends ServiceImpl() + .ne(ObjectUtil.isNotEmpty(id), WalletTypeEntity::getId, id) + .eq(ObjectUtil.isNotEmpty(name), WalletTypeEntity::getName, name) + ); + if (ObjectUtil.isNotEmpty(id)) { + return count >= 1; + } + return count > 0; + } + + public boolean existCode(Long id, String code) { + Long count = baseMapper.selectCount(new LambdaQueryWrapper() + .ne(ObjectUtil.isNotEmpty(id), WalletTypeEntity::getId, id) + .eq(ObjectUtil.isNotEmpty(code), WalletTypeEntity::getUniqueCode, code) + ); + if (ObjectUtil.isNotEmpty(id)) { + return count >= 1; + } + return count > 0; + } } \ No newline at end of file diff --git a/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/mapper/MchManageMapper.xml b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/MchManageMapper.xml similarity index 87% rename from pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/mapper/MchManageMapper.xml rename to pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/MchManageMapper.xml index 2671c5bd3..e4e66a181 100644 --- a/pjcloud-merchant/pjcloud-merchant-biz/src/main/resources/mapper/MchManageMapper.xml +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/MchManageMapper.xml @@ -1,9 +1,9 @@ - + - + diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/WalletActiveMapper.xml b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/WalletActiveMapper.xml new file mode 100644 index 000000000..daf14beab --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/WalletActiveMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/WalletFreezeMapper.xml b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/WalletFreezeMapper.xml new file mode 100644 index 000000000..e0b0e735e --- /dev/null +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/WalletFreezeMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 25845d9f2..bcb840dd3 100644 --- a/pom.xml +++ b/pom.xml @@ -125,7 +125,6 @@ pjcloud-wallet pjcloud-supermarket pjcloud-hardware - pjcloud-merchant