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 1f5e4ec47..7bfb4d7d1 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 @@ -75,8 +75,8 @@ public interface RemoteUserService { * @param userIds ID * @return SysUser */ - @GetMapping("/user/list") - R> getUserById(@RequestParam("userIds") List userIds); + @PostMapping("/user/list") + R> getUserById(@RequestBody List userIds); @GetMapping("/user/user-dept") R> getUserDeptByIds(@RequestParam("userIds") List userIds); diff --git a/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/vo/UserExcelVO.java b/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/vo/UserExcelVO.java index e3989210b..157b7a794 100644 --- a/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/vo/UserExcelVO.java +++ b/pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/vo/UserExcelVO.java @@ -7,6 +7,7 @@ import com.bsd.pjcloud.common.excel.annotation.ExcelLine; import lombok.Data; import jakarta.validation.constraints.NotBlank; + import java.io.Serializable; import java.time.LocalDateTime; @@ -20,87 +21,87 @@ import java.time.LocalDateTime; @ColumnWidth(30) public class UserExcelVO implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 导入时候回显行号 - */ - @ExcelLine - @ExcelIgnore - private Long lineNum; + /** + * 导入时候回显行号 + */ + @ExcelLine + @ExcelIgnore + private Long lineNum; - /** - * 主键ID - */ - @ExcelProperty("用户编号") - private Long userId; + /** + * 主键ID + */ + @ExcelProperty("用户编号") + private Long userId; - /** - * 用户名 - */ - @NotBlank(message = "用户名不能为空") - @ExcelProperty("用户名") - private String username; + /** + * 用户名 + */ + @NotBlank(message = "用户名不能为空") + @ExcelProperty("用户名") + private String username; - /** - * 手机号 - */ - @NotBlank(message = "手机号不能为空") - @ExcelProperty("手机号") - private String phone; + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空") + @ExcelProperty("手机号") + private String phone; - /** - * 手机号 - */ - @NotBlank(message = "昵称不能为空") - @ExcelProperty("昵称") - private String nickname; + /** + * 手机号 + */ + @NotBlank(message = "昵称不能为空") + @ExcelProperty("昵称") + private String nickname; - /** - * 手机号 - */ - @NotBlank(message = "姓名不能为空") - @ExcelProperty("姓名") - private String name; + /** + * 手机号 + */ + @NotBlank(message = "姓名不能为空") + @ExcelProperty("姓名") + private String name; - /** - * 手机号 - */ - @NotBlank(message = "邮箱不能为空") - @ExcelProperty("邮箱") - private String email; + /** + * 手机号 + */ + @NotBlank(message = "邮箱不能为空") + @ExcelProperty("邮箱") + private String email; - /** - * 部门名称 - */ - @NotBlank(message = "部门名称不能为空") - @ExcelProperty("部门名称") - private String deptName; + /** + * 部门名称 + */ + @NotBlank(message = "部门名称不能为空") + @ExcelProperty("部门名称") + private String deptName; - /** - * 角色列表 - */ - @NotBlank(message = "角色不能为空") - @ExcelProperty("角色") - private String roleNameList; + /** + * 角色列表 + */ + @NotBlank(message = "角色不能为空") + @ExcelProperty("角色") + private String roleNameList; - /** - * 角色列表 - */ - @NotBlank(message = "岗位不能为空") - @ExcelProperty("岗位名称") - private String postNameList; + /** + * 角色列表 + */ + @NotBlank(message = "岗位不能为空") + @ExcelProperty("岗位名称") + private String postNameList; - /** - * 锁定标记 - */ - @ExcelProperty("锁定标记,0:正常,9:已锁定") - private String lockFlag; + /** + * 锁定标记 + */ + @ExcelProperty("锁定标记,0:正常,9:已锁定") + private String lockFlag; - /** - * 创建时间 - */ - @ExcelProperty(value = "创建时间") - private LocalDateTime createTime; + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private LocalDateTime createTime; } 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 059e3602a..d6c91eec1 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 @@ -20,7 +20,6 @@ package com.bsd.pjcloud.admin.controller; 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; @@ -247,10 +246,10 @@ public class SysUserController { * @return */ @ResponseExcel - @GetMapping("/export") + @PostMapping("/export") @HasPermission("sys_user_export") - public List export(UserDTO userDTO, Long[] ids) { - return userService.listUser(userDTO, ids); + public List export(@RequestBody UserDTO userDTO) { + return userService.listUser(userDTO, null); } /** @@ -347,8 +346,8 @@ public class SysUserController { * @param userIds ID列表 * @return 用户列表 */ - @GetMapping("/list") - public R> getUserListByIds(@RequestParam("userIds") List userIds) { + @PostMapping("/list") + public R> getUserListByIds(@RequestBody List userIds) { return R.ok(userService.list(Wrappers.lambdaQuery().in(SysUser::getUserId, userIds))); } @@ -380,11 +379,11 @@ public class SysUserController { @GetMapping("/getSimpleUserAll") @Schema(description = "简要用户信息") - public R> getSimpleUserAllList(@RequestParam(value = "mobile",required = false) String mobile, - @RequestParam(value = "name",required = false) String name){ + public R> getSimpleUserAllList(@RequestParam(value = "mobile", required = false) String mobile, + @RequestParam(value = "name", required = false) String name) { LambdaQueryWrapper sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); - sysUserLambdaQueryWrapper.like(StringUtils.isNotBlank(mobile),SysUser::getPhone,mobile); - sysUserLambdaQueryWrapper.like(StringUtils.isNotBlank(name),SysUser::getName,name); + sysUserLambdaQueryWrapper.like(StringUtils.isNotBlank(mobile), SysUser::getPhone, mobile); + sysUserLambdaQueryWrapper.like(StringUtils.isNotBlank(name), SysUser::getName, name); List list = userService.listScope(sysUserLambdaQueryWrapper); return R.ok(list); diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java index df9fe7bca..fd637c1a1 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java @@ -220,6 +220,7 @@ public class SysUserServiceImpl extends ServiceImpl impl */ @Override public IPage getUsersWithRolePage(Page page, UserDTO userDTO) { + // 部门 if (ObjectUtil.isNotEmpty(userDTO.getIsDeepDept()) && userDTO.getIsDeepDept() && ObjectUtil.isNotEmpty(userDTO.getDeptId())) { List deptList = sysDeptService.listDescendant(userDTO.getDeptId()); userDTO.setDeptId(null); @@ -227,6 +228,9 @@ public class SysUserServiceImpl extends ServiceImpl impl userDTO.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList())); } } + if (ObjectUtil.isNotEmpty(userDTO.getDeptIds())) { + userDTO.setDeptId(null); + } IPage list = baseMapper.getUserVosPage(page, userDTO, DataScope.of()); if (ObjectUtil.isNotEmpty(list.getRecords())) { List userIds = list.getRecords().stream().map(UserVO::getUserId).distinct().toList(); @@ -363,6 +367,17 @@ public class SysUserServiceImpl extends ServiceImpl impl */ @Override public List listUser(UserDTO userDTO, Long[] ids) { + // 部门 + if (ObjectUtil.isNotEmpty(userDTO.getIsDeepDept()) && userDTO.getIsDeepDept() && ObjectUtil.isNotEmpty(userDTO.getDeptId())) { + List deptList = sysDeptService.listDescendant(userDTO.getDeptId()); + userDTO.setDeptId(null); + if (ObjectUtil.isNotEmpty(deptList)) { + userDTO.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList())); + } + } + if (ObjectUtil.isNotEmpty(userDTO.getDeptIds())) { + userDTO.setDeptId(null); + } // 根据数据权限查询全部的用户信息 List voList = baseMapper.selectVoListByScope(userDTO, ids, DataScope.of()); // 转换成execl 对象输出 @@ -768,7 +783,7 @@ public class SysUserServiceImpl extends ServiceImpl impl @Override public List listScope(LambdaQueryWrapper sysUserLambdaQueryWrapper) { - List sysUsers = baseMapper.selectListByScope(sysUserLambdaQueryWrapper,DataScope.of()); + List sysUsers = baseMapper.selectListByScope(sysUserLambdaQueryWrapper, DataScope.of()); List collect = sysUsers.stream().map(sysUser -> { SimpleUserAllListVO vo = new SimpleUserAllListVO(); vo.setId(sysUser.getUserId()); diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/resources/mapper/SysUserMapper.xml b/pjcloud-upms/pjcloud-upms-biz/src/main/resources/mapper/SysUserMapper.xml index f49b9b596..0f850493a 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/resources/mapper/SysUserMapper.xml +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/resources/mapper/SysUserMapper.xml @@ -247,9 +247,15 @@ AND u.dept_id = #{query.deptId} - + + AND u.dept_id in + + #{id} + + + AND u.user_id in - + #{id} 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 6d582e8bf..490cfaf0a 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 @@ -28,6 +28,12 @@ public enum WalletBizEnum { ); } + public static WalletBizEnum valueOfByType(String code) { + return Arrays.stream(WalletBizEnum.values()) + .filter(v -> ObjectUtil.equal(v.getCode(), code)) + .findFirst().get(); + } + 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 index 17a2e8f36..839d4bec0 100644 --- 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 @@ -16,6 +16,12 @@ public enum WalletBizRechargeEnum { private final String desc; + public static WalletBizRechargeEnum valueOfByType(String code) { + return Arrays.stream(WalletBizRechargeEnum.values()) + .filter(v -> ObjectUtil.equal(v.getCode(), code)) + .findFirst().get(); + } + public static WalletBizRechargeEnum descOf(String description) { return Arrays.stream(WalletBizRechargeEnum.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/WalletManageDto.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletManageDto.java index d9470b02e..4f8aa8e00 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletManageDto.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/WalletManageDto.java @@ -16,4 +16,14 @@ public class WalletManageDto extends WalletManageEntity { private LocalDateTime[] createTimeList; + /** + * 是否深度搜索deptId + */ + private Boolean isDeepDept; + + /** + * 部门ids + */ + private List deptIds; + } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/recharge/WalletRechargeImportDto.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/recharge/WalletRechargeImportDto.java index e414029ba..379b1fd73 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/recharge/WalletRechargeImportDto.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/dto/recharge/WalletRechargeImportDto.java @@ -19,10 +19,20 @@ public class WalletRechargeImportDto extends WalletRechargeImportEntity { private Long userDeptId; + /** + * 是否深度搜索deptId + */ + private Boolean isDeepDept; + + /** + * 部门ids + */ private List userDeptIds; private LocalDateTime[] createTimeList; private LocalDateTime[] processTimeList; + private String bizType; + } diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/recharge/WalletRechargeImportVo.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/recharge/WalletRechargeImportVo.java index 233f47f58..48cece896 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/recharge/WalletRechargeImportVo.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/recharge/WalletRechargeImportVo.java @@ -52,4 +52,8 @@ public class WalletRechargeImportVo extends WalletRechargeImportEntity implement private String walletTypeUniqueCode; private String walletTypeIcon; + + private String priceStr; + + private String importTimeStr; } diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletManageController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletManageController.java index 57015aced..d8f568536 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletManageController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletManageController.java @@ -144,9 +144,9 @@ public class WalletManageController { } @Operation(summary = "分页查询", description = "分页查询") - @GetMapping("/page-join") + @PostMapping("/page-join") @PreAuthorize("@pms.hasPermission('wallet_walletManage_view')") - public R getWalletManagePageJoin(@ParameterObject Page page, @ParameterObject WalletManageDto dto) { + public R getWalletManagePageJoin(@ParameterObject Page page, @RequestBody WalletManageDto dto) { return R.ok(walletManageService.scopePageList(page, dto, DataScope.of())); } @@ -180,10 +180,10 @@ public class WalletManageController { public R removeById(@RequestBody Long[] ids) { return R.ok(walletManageService.removeBatchByIds(CollUtil.toList(ids))); } - - @GetMapping("/export") + + @PostMapping("/export") @PreAuthorize("@pms.hasPermission('wallet_walletManage_export')") - public void export(HttpServletResponse response, @ParameterObject Page page, @ParameterObject WalletManageDto dto) { + public void export(HttpServletResponse response, @ParameterObject Page page, @RequestBody WalletManageDto dto) { walletManageService.export(response, page, dto); } } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java index 6eee9c65b..bcf949ec3 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java @@ -96,7 +96,7 @@ public class WalletTransactionController { @PostMapping("/page-cz") public R pageCz(@ParameterObject Page page, @RequestBody WalletTransactionDto dto) { dto.setBizTypes(WalletBizEnum.getTopUpCodes()); - dto.setType(WalletTransactionDto.TYPE_INCOME); + // dto.setType(WalletTransactionDto.TYPE_INCOME); DataScope dataScope = new DataScope(); return R.ok(walletTransactionService.scopePageList(page, dto, dataScope)); } @@ -161,28 +161,29 @@ public class WalletTransactionController { @Operation(summary = "充值导出", description = "充值导出") @PostMapping("/export-cz") @PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')") - public void exportCz(HttpServletResponse response, @ParameterObject Page page, @RequestBody WalletTransactionDto dto) { - dto.setBizTypes(List.of(WalletBizEnum.RECHARGE.getCode())); - List list = walletTransactionService.scopePageList(page, dto, DataScope.of()).getRecords(); + public void exportCz(HttpServletResponse response, @RequestBody WalletTransactionDto dto) { + dto.setBizTypes(WalletBizEnum.getTopUpCodes()); + // dto.setType(WalletTransactionDto.TYPE_INCOME); + List list = walletTransactionService.scopeList(dto, DataScope.of()); walletTransactionService.exportByTemplate(response, dto, "file/个人充值明细.xlsx", list); } @Operation(summary = "消费导出", description = "消费导出") @PostMapping("/export-xf") @PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')") - public void exportXf(HttpServletResponse response, @ParameterObject Page page, @RequestBody WalletTransactionDto dto) { + public void exportXf(HttpServletResponse response, @RequestBody WalletTransactionDto dto) { dto.setBizTypes(List.of(WalletBizEnum.PAYMENT.getCode())); - List list = walletTransactionService.scopePageList(page, dto, DataScope.of()).getRecords(); + List list = walletTransactionService.scopeList(dto, DataScope.of()); walletTransactionService.exportByTemplate(response, dto, "file/个人消费明细.xlsx", list); } @Operation(summary = "退款导出", description = "退款导出") @PostMapping("/export-tk") @PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')") - public void exportTk(HttpServletResponse response, @ParameterObject Page page, @RequestBody WalletTransactionDto dto) { + public void exportTk(HttpServletResponse response, @RequestBody WalletTransactionDto dto) { dto.setBizTypes(List.of(WalletBizEnum.REFUND.getCode())); dto.setIsFindOrder(true); - List list = walletTransactionService.scopePageList(page, dto, DataScope.of()).getRecords(); + List list = walletTransactionService.scopeList(dto, DataScope.of()); walletTransactionService.exportByTemplate(response, dto, "file/个人退款明细.xlsx", list); } } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/recharge/WalletRechargeImportController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/recharge/WalletRechargeImportController.java index 6696271ff..4a9cdded8 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/recharge/WalletRechargeImportController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/recharge/WalletRechargeImportController.java @@ -1,7 +1,15 @@ package com.bsd.pjcloud.wallet.controller.recharge; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.io.resource.ResourceUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.fill.FillConfig; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -9,9 +17,15 @@ import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.data.datascope.DataScope; import com.bsd.pjcloud.common.idempotent.annotation.Idempotent; import com.bsd.pjcloud.common.log.annotation.SysLog; +import com.bsd.pjcloud.hard.api.constant.HardTypeEnum; +import com.bsd.pjcloud.wallet.api.constant.WalletBizRechargeEnum; +import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum; import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto; import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity; +import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeImportVo; +import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo; import com.bsd.pjcloud.wallet.service.WalletRechargeImportService; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import com.bsd.pjcloud.common.excel.annotation.ResponseExcel; import io.swagger.v3.oas.annotations.security.SecurityRequirement; @@ -22,7 +36,12 @@ import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; /** @@ -57,9 +76,9 @@ public class WalletRechargeImportController { } @Operation(summary = "分页复杂查询", description = "分页复杂查询") - @GetMapping("/page-join") + @PostMapping("/page-join") @PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_view')") - public R scopePageList(@ParameterObject Page page, @ParameterObject WalletRechargeImportDto dto) { + public R scopePageList(@ParameterObject Page page, @RequestBody WalletRechargeImportDto dto) { return R.ok(walletRechargeImportService.scopePageList(page, dto, DataScope.of())); } @@ -95,9 +114,40 @@ public class WalletRechargeImportController { } @ResponseExcel - @GetMapping("/export") + @PostMapping("/export") @PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_export')") - public List export(WalletRechargeImportEntity walletRechargeImport, Long[] ids) { - return walletRechargeImportService.list(Wrappers.lambdaQuery(walletRechargeImport).in(ArrayUtil.isNotEmpty(ids), WalletRechargeImportEntity::getId, ids)); + public void export(HttpServletResponse response, @RequestBody WalletRechargeImportDto dto) throws IOException { + List list = walletRechargeImportService.scopeList(dto, DataScope.of()); + try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream("file/批量充值扣款流水明细.xlsx")).build()) { + WriteSheet writeSheet = EasyExcel.writerSheet().build(); + FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); + Map map = new HashMap(); + if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) { + map.put("timeSpan", " 到 "); + map.put("startTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN)); + map.put("endTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN)); + } + if (ObjectUtil.isNotEmpty(list)) { + BigDecimal priceStrSum = BigDecimal.ZERO; + for (WalletRechargeImportVo v : list) { + if (ObjectUtil.isNotEmpty(v.getPrice())) { + priceStrSum = priceStrSum.add(BigDecimal.valueOf(v.getPrice())); + v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); + } + if (ObjectUtil.isNotEmpty(v.getImportTime())) { + v.setImportTimeStr(LocalDateTimeUtil.format(v.getImportTime(), DatePattern.NORM_MONTH_PATTERN)); + } + if (ObjectUtil.isNotEmpty(v.getBizType())) { + v.setBizType(WalletBizRechargeEnum.valueOfByType(v.getBizType()).getDesc()); + } + if (ObjectUtil.isNotEmpty(v.getWalletTypeUniqueCode())) { + v.setWalletTypeUniqueCode(WalletTypeEnum.valueOfByCode(v.getWalletTypeUniqueCode()).getDesc()); + } + } + map.put("priceStrSum", priceStrSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); + } + excelWriter.fill(map, writeSheet); + excelWriter.fill(list, fillConfig, writeSheet); + } } } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletManageMapper.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletManageMapper.java index 55a815371..afe5b1307 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletManageMapper.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletManageMapper.java @@ -105,10 +105,12 @@ public interface WalletManageMapper extends PjcloudBaseMapper scopePageList(Page page, WalletManageDto dto, DataScope dataScope) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper() .eq(ObjectUtil.isNotEmpty(dto.getUserId()), WalletManageEntity::getUserId, dto.getUserId()) + .eq(ObjectUtil.isNotEmpty(dto.getDeptId()), WalletManageEntity::getDeptId, dto.getDeptId()) .eq(ObjectUtil.isNotEmpty(dto.getWalletTypeId()), WalletManageEntity::getWalletTypeId, dto.getWalletTypeId()) .eq(ObjectUtil.isNotEmpty(dto.getIsFreeze()), WalletManageEntity::getIsFreeze, dto.getIsFreeze()) .in(ObjectUtil.isNotEmpty(dto.getWalletIds()), WalletManageEntity::getId, dto.getWalletIds()) .in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds()) + .in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds()) .between( ObjectUtil.isNotEmpty(dto.getCreateTimeList()), WalletManageEntity::getCreateTime, @@ -121,4 +123,24 @@ public interface WalletManageMapper extends PjcloudBaseMapper scopeList(WalletManageDto dto, DataScope dataScope) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(ObjectUtil.isNotEmpty(dto.getUserId()), WalletManageEntity::getUserId, dto.getUserId()) + .eq(ObjectUtil.isNotEmpty(dto.getDeptId()), WalletManageEntity::getDeptId, dto.getDeptId()) + .eq(ObjectUtil.isNotEmpty(dto.getWalletTypeId()), WalletManageEntity::getWalletTypeId, dto.getWalletTypeId()) + .eq(ObjectUtil.isNotEmpty(dto.getIsFreeze()), WalletManageEntity::getIsFreeze, dto.getIsFreeze()) + .in(ObjectUtil.isNotEmpty(dto.getWalletIds()), WalletManageEntity::getId, dto.getWalletIds()) + .in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds()) + .in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds()) + .between( + ObjectUtil.isNotEmpty(dto.getCreateTimeList()), + WalletManageEntity::getCreateTime, + ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[0] : null, + ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null + ) + .orderByDesc(WalletManageEntity::getCreateTime); + List list = selectListByScope(wrapper, dataScope); + return BeanUtils.toBean(list, WalletManageVo.class); + } + } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletTransactionMapper.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletTransactionMapper.java index bad6fd667..873e39393 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletTransactionMapper.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/WalletTransactionMapper.java @@ -24,33 +24,11 @@ import java.util.Objects; @Mapper public interface WalletTransactionMapper extends PjcloudBaseMapper { - default List pageList(WalletTransactionDto dto) { - MPJLambdaWrapper wrapper = new MPJLambdaWrapper() - .selectAll(WalletTransactionEntity.class) - .selectAs(WalletManageEntity::getUserId, WalletTransactionVo::getUserId) - .selectAs(WalletManageEntity::getDeptId, WalletTransactionVo::getDeptId) - .selectAs(WalletTypeEntity::getName, WalletTransactionVo::getWalletTypeName) - .selectAs(WalletTypeEntity::getUniqueCode, WalletTransactionVo::getWalletTypeUniqueCode) - .leftJoin(WalletManageEntity.class, WalletManageEntity::getId, WalletTransactionEntity::getWalletId) - .leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletManageEntity::getWalletTypeId) - .eqIfExists(WalletTransactionEntity::getWalletId, dto.getWalletId()) - .eqIfExists(WalletTransactionEntity::getBizType, dto.getBizType()) - .eqIfExists(WalletManageEntity::getWalletTypeId, dto.getWalletTypeId()) - .in(ObjectUtil.isNotEmpty(dto.getBizTypes()), WalletTransactionEntity::getBizType, dto.getBizTypes()) - .in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds()) - .orderByDesc(WalletTransactionEntity::getCreateTime); - if (ObjectUtil.equals(dto.getType(), WalletTransactionDto.TYPE_INCOME)) { - wrapper.gt(WalletTransactionEntity::getPrice, 0); - } else if (Objects.equals(dto.getType(), WalletTransactionDto.TYPE_EXPENSE)) { - wrapper.lt(WalletTransactionEntity::getPrice, 0); - } - return selectJoinList(WalletTransactionVo.class, wrapper); - } - default Page scopePageList(Page page, WalletTransactionDto dto, DataScope dataScope) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper() .eq(ObjectUtil.isNotEmpty(dto.getWalletId()), WalletTransactionEntity::getWalletId, dto.getWalletId()) .eq(ObjectUtil.isNotEmpty(dto.getBizType()), WalletTransactionEntity::getBizType, dto.getBizType()) + .eq(ObjectUtil.isNotEmpty(dto.getUserId()), WalletTransactionEntity::getUserId, dto.getUserId()) .eq(ObjectUtil.isNotEmpty(dto.getDeptId()), WalletTransactionEntity::getDeptId, dto.getDeptId()) .in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletTransactionEntity::getUserId, dto.getUserIds()) .in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds()) @@ -72,6 +50,32 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper scopeList(WalletTransactionDto dto, DataScope dataScope) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(ObjectUtil.isNotEmpty(dto.getWalletId()), WalletTransactionEntity::getWalletId, dto.getWalletId()) + .eq(ObjectUtil.isNotEmpty(dto.getBizType()), WalletTransactionEntity::getBizType, dto.getBizType()) + .eq(ObjectUtil.isNotEmpty(dto.getUserId()), WalletTransactionEntity::getUserId, dto.getUserId()) + .eq(ObjectUtil.isNotEmpty(dto.getDeptId()), WalletTransactionEntity::getDeptId, dto.getDeptId()) + .in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletTransactionEntity::getUserId, dto.getUserIds()) + .in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds()) + .in(ObjectUtil.isNotEmpty(dto.getBizTypes()), WalletTransactionEntity::getBizType, dto.getBizTypes()) + .between( + ObjectUtil.isNotEmpty(dto.getCreateTimeList()), + WalletTransactionEntity::getCreateTime, + ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[0] : null, + ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null + ) + .orderByDesc(WalletTransactionEntity::getCreateTime); + if (ObjectUtil.equals(dto.getType(), WalletTransactionDto.TYPE_INCOME)) { + wrapper.gt(WalletTransactionEntity::getPrice, 0); + } else if (Objects.equals(dto.getType(), WalletTransactionDto.TYPE_EXPENSE)) { + wrapper.lt(WalletTransactionEntity::getPrice, 0); + } + List list = selectListByScope(wrapper, dataScope); + return BeanUtils.toBean(list, WalletTransactionVo.class); + } + + Integer getTransactionPriceCount(@Param("month") String importTimeStr, @Param("walletId") Long walletId, @Param("bizType") String bizType); List selectCompare(@Param("bizType") String bizType, @Param("dateTime") String monthTimeStr, @Param("userIdList") List userIdList); diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/recharge/WalletRechargeImportMapper.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/recharge/WalletRechargeImportMapper.java index a1fbbcbaa..86a510182 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/recharge/WalletRechargeImportMapper.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/mapper/recharge/WalletRechargeImportMapper.java @@ -17,6 +17,8 @@ public interface WalletRechargeImportMapper extends PjcloudBaseMapper scopePageList(Page page, @Param("dto") WalletRechargeImportDto dto, DataScope dataScope); + List scopeList(@Param("dto") WalletRechargeImportDto dto, DataScope dataScope); + default Page pageJoin(Page page, WalletRechargeImportDto dto) { MPJLambdaWrapper wrapper = new MPJLambdaWrapper() .eqIfExists(WalletRechargeImportEntity::getId, dto.getId()) diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletManageService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletManageService.java index 53feeb7b6..2c7054888 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletManageService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletManageService.java @@ -2,7 +2,6 @@ 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.common.data.datascope.DataScope; import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum; import com.bsd.pjcloud.wallet.api.dto.WalletManageDto; @@ -83,7 +82,7 @@ public interface WalletManageService extends IService { Page scopePageList(Page page, WalletManageDto dto, DataScope dataScope); - List joinList(WalletManageDto dto); + List scopeList(WalletManageDto dto, DataScope dataScope); WalletManageVo join(Long user, Long walletId); diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeImportService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeImportService.java index 49fb414bd..b1e0dbfbb 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeImportService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRechargeImportService.java @@ -18,5 +18,7 @@ public interface WalletRechargeImportService extends IService scopePageList(Page page, WalletRechargeImportDto dto, DataScope dataScope); + List scopeList(WalletRechargeImportDto dto, DataScope dataScope); + Boolean recover(Long id); } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java index 696c93014..03b90d82b 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java @@ -16,7 +16,7 @@ public interface WalletTransactionService extends IService scopePageList(Page page, WalletTransactionDto dto, DataScope dataScope); - List pageList(WalletTransactionDto dto); + List scopeList(WalletTransactionDto dto, DataScope dataScope); /** * 扣减钱包余额 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 aaad3d1ea..3cd4ef8ef 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 @@ -39,7 +39,6 @@ import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity; import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil; import com.bsd.pjcloud.wallet.api.vo.WalletManageVo; import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo; -import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo; import com.bsd.pjcloud.wallet.mapper.WalletManageMapper; import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper; import com.bsd.pjcloud.wallet.service.WalletManageService; @@ -49,7 +48,6 @@ import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,6 +59,7 @@ import java.math.RoundingMode; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.*; +import java.util.stream.Collectors; /** * 钱包管理 @@ -219,51 +218,38 @@ public class WalletManageServiceImpl extends ServiceImpl joinList(WalletManageDto dto) { - List list = baseMapper.joinList(dto); - if (ObjectUtil.isNotEmpty(list)) { - // 用户 - List userIds = list.stream().map(WalletManageVo::getUserId).distinct().toList(); - R> userList = userService.getUserById(new ArrayList<>(userIds)); - if (ObjectUtil.isNotEmpty(userList.getData())) { - DataUtil.convertUserList(list, CollectionUtils.convertMap(userList.getData(), SysUser::getUserId)); - } - // 部门 - List deptIds = list.stream().map(WalletManageVo::getDeptId).distinct().toList(); - R> deptList = deptService.getDeptByDeptIds(deptIds); - if (ObjectUtil.isNotEmpty(deptList.getData())) { - DataUtil.convertDeptList(list, deptList.getData()); + public List scopeList(WalletManageDto dto, DataScope dataScope) { + // 查询部门 + if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) { + List deptList = deptService.getDescendantList(dto.getDeptId()).getData(); + dto.setDeptId(null); + if (ObjectUtil.isNotEmpty(deptList)) { + dto.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList())); } } + if (ObjectUtil.isNotEmpty(dto.getDeptIds())) { + dto.setDeptId(null); + } + List list = baseMapper.scopeList(dto, dataScope); + disposeList(list, dto); return list; } @Override public Page scopePageList(Page page, WalletManageDto dto, DataScope dataScope) { - Page list = baseMapper.scopePageList(page, dto, dataScope); - if (ObjectUtil.isNotEmpty(list.getRecords())) { - // 用户 - List userIds = list.getRecords().stream().map(WalletManageVo::getUserId).distinct().toList(); - R> userList = userService.getUserById(new ArrayList<>(userIds)); - if (ObjectUtil.isNotEmpty(userList.getData())) { - DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId)); - } - // 部门 - List deptIds = list.getRecords().stream().map(WalletManageVo::getDeptId).distinct().toList(); - R> deptList = deptService.getDeptByDeptIds(deptIds); - if (ObjectUtil.isNotEmpty(deptList.getData())) { - DataUtil.convertDeptList(list.getRecords(), deptList.getData()); - } - // 饭卡类型 - List walletTypeId = list.getRecords().stream().map(WalletManageVo::getWalletTypeId).distinct().toList(); - if (ObjectUtil.isNotEmpty(walletTypeId)) { - WalletTypeDto walletTypeDto = new WalletTypeDto(); - List walletTypeList = walletTypeMapper.list(walletTypeDto); - if (ObjectUtil.isNotEmpty(walletTypeList)) { - WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId)); - } + // 查询部门 + if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) { + List deptList = deptService.getDescendantList(dto.getDeptId()).getData(); + dto.setDeptId(null); + if (ObjectUtil.isNotEmpty(deptList)) { + dto.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList())); } } + if (ObjectUtil.isNotEmpty(dto.getDeptIds())) { + dto.setDeptId(null); + } + Page list = baseMapper.scopePageList(page, dto, dataScope); + disposeList(list.getRecords(), dto); return list; } @@ -283,7 +269,7 @@ public class WalletManageServiceImpl extends ServiceImpl list = scopePageList(page, dto, DataScope.of()).getRecords(); + List list = scopeList(dto, DataScope.of()); try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream(fileName)).build()) { WriteSheet writeSheet = EasyExcel.writerSheet().build(); FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); @@ -323,6 +309,32 @@ public class WalletManageServiceImpl extends ServiceImpl list, WalletManageDto dto) { + if (ObjectUtil.isNotEmpty(list)) { + // 用户 + List userIds = list.stream().map(WalletManageVo::getUserId).distinct().toList(); + R> userList = userService.getUserById(new ArrayList<>(userIds)); + if (ObjectUtil.isNotEmpty(userList.getData())) { + DataUtil.convertUserList(list, CollectionUtils.convertMap(userList.getData(), SysUser::getUserId)); + } + // 部门 + List deptIds = list.stream().map(WalletManageVo::getDeptId).distinct().toList(); + R> deptList = deptService.getDeptByDeptIds(deptIds); + if (ObjectUtil.isNotEmpty(deptList.getData())) { + DataUtil.convertDeptList(list, deptList.getData()); + } + // 饭卡类型 + List walletTypeId = list.stream().map(WalletManageVo::getWalletTypeId).distinct().toList(); + if (ObjectUtil.isNotEmpty(walletTypeId)) { + WalletTypeDto walletTypeDto = new WalletTypeDto(); + List walletTypeList = walletTypeMapper.list(walletTypeDto); + if (ObjectUtil.isNotEmpty(walletTypeList)) { + WalletDataUtil.convertWalletTypeList(list, CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId)); + } + } + } + } + private WalletManageServiceImpl getSelf() { return SpringUtil.getBean(getClass()); } diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java index 579149818..3b17e75e7 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java @@ -17,11 +17,11 @@ import com.bsd.pjcloud.admin.api.entity.SysUser; import com.bsd.pjcloud.admin.api.feign.RemoteDeptService; import com.bsd.pjcloud.admin.api.feign.RemoteUserService; import com.bsd.pjcloud.admin.api.utils.DataUtil; -import com.bsd.pjcloud.common.core.constant.CacheConstants; import com.bsd.pjcloud.common.core.util.CollectionUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.data.datascope.DataScope; import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum; +import com.bsd.pjcloud.wallet.api.constant.WalletBizRechargeEnum; import com.bsd.pjcloud.wallet.api.dto.WalletManageDto; import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto; import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto; @@ -38,7 +38,6 @@ import com.bsd.pjcloud.wallet.service.WalletTransactionService; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; @@ -179,54 +178,62 @@ public class WalletTransactionServiceImpl extends ServiceImpl list = baseMapper.scopePageList(page, dto, dataScope); - if (ObjectUtil.isNotEmpty(list.getRecords())) { - // 用户 - List userIds = list.getRecords().stream().map(WalletTransactionVo::getUserId).distinct().toList(); - R> userList = userService.getUserById(new ArrayList<>(userIds)); - if (ObjectUtil.isNotEmpty(userList.getData())) { - DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId)); - } - // 部门 - List deptIds = list.getRecords().stream().map(WalletTransactionVo::getDeptId).distinct().toList(); - R> deptList = deptService.getDeptByDeptIds(deptIds); - if (ObjectUtil.isNotEmpty(deptList.getData())) { - DataUtil.convertDeptList(list.getRecords(), deptList.getData()); - } - // 饭卡 - List walletIds = list.getRecords().stream().map(WalletTransactionVo::getWalletId).distinct().toList(); - if (ObjectUtil.isNotEmpty(walletIds)) { - WalletManageDto walletManageDto = new WalletManageDto(); - walletManageDto.setWalletIds(walletIds); - List walletList = walletManageMapper.list(walletManageDto); - if (ObjectUtil.isNotEmpty(walletList)) { - WalletDataUtil.convertWalletList(list.getRecords(), CollectionUtils.convertMap(walletList, WalletManageEntity::getId)); - } - } - // 饭卡类型 - List walletTypeIds = list.getRecords().stream().map(WalletTransactionVo::getWalletTypeId).distinct().toList(); - if (ObjectUtil.isNotEmpty(walletTypeIds)) { - WalletTypeDto walletTypeDto = new WalletTypeDto(); - walletTypeDto.setWalletTypeIds(walletTypeIds); - List walletTypeList = walletTypeMapper.list(walletTypeDto); - if (ObjectUtil.isNotEmpty(walletTypeList)) { - WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId)); - } - } - // 订单 - if (dto.getIsFindOrder()) { - list.getRecords().forEach(v -> { - if (ObjectUtil.isNotEmpty(v.getBizId())) { - v.setOrderId(Long.valueOf(v.getBizId())); - } - }); - } - } + disposeList(list.getRecords(), dto); return list; } @Override - public List pageList(WalletTransactionDto dto) { - List list = baseMapper.pageList(dto); + public List scopeList(WalletTransactionDto dto, DataScope dataScope) { + // 查询部门 + if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) { + List deptList = deptService.getDescendantList(dto.getDeptId()).getData(); + dto.setDeptId(null); + if (ObjectUtil.isNotEmpty(deptList)) { + dto.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList())); + } + } + if (ObjectUtil.isNotEmpty(dto.getDeptIds())) { + dto.setDeptId(null); + } + List list = baseMapper.scopeList(dto, dataScope); + disposeList(list, dto); + return list; + } + + @Override + public void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, List list) { + try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream(fileName)).build()) { + WriteSheet writeSheet = EasyExcel.writerSheet().build(); + FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); + Map map = new HashMap(); + if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) { + map.put("timeSpan", " 到 "); + map.put("startTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN)); + map.put("endTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN)); + } + if (ObjectUtil.isNotEmpty(list)) { + BigDecimal priceTotal = BigDecimal.ZERO; + for (WalletTransactionVo v : list) { + if (ObjectUtil.isNotEmpty(v.getPrice())) { + priceTotal = priceTotal.add(BigDecimal.valueOf(v.getPrice())); + v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); + } + if (ObjectUtil.isNotEmpty(v.getBizType())) { + v.setBizType(WalletBizEnum.valueOfByType(v.getBizType()).getDesc()); + } + } + map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); + } + excelWriter.fill(map, writeSheet); + excelWriter.fill(list, fillConfig, writeSheet); + } catch (IOException e) { + e.printStackTrace(); + log.error("|{}|导入错误,dto:|{}|,fileName:|{}|,error:|{}|", TAG, JSON.toJSONString(dto), fileName, e.getMessage()); + } + } + + + private void disposeList(List list, WalletTransactionDto dto) { if (ObjectUtil.isNotEmpty(list)) { // 用户 List userIds = list.stream().map(WalletTransactionVo::getUserId).distinct().toList(); @@ -260,36 +267,15 @@ public class WalletTransactionServiceImpl extends ServiceImpl { + if (ObjectUtil.isNotEmpty(v.getBizId())) { + v.setOrderId(Long.valueOf(v.getBizId())); + } + }); + } } - return list; } - @Override - public void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, List list) { - try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream(fileName)).build()) { - WriteSheet writeSheet = EasyExcel.writerSheet().build(); - FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); - Map map = new HashMap(); - if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) { - map.put("timeSpan", " 到 "); - map.put("startTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN)); - map.put("endTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN)); - } - if (ObjectUtil.isNotEmpty(list)) { - BigDecimal priceTotal = BigDecimal.ZERO; - for (WalletTransactionVo v : list) { - if (ObjectUtil.isNotEmpty(v.getPrice())) { - priceTotal = priceTotal.add(BigDecimal.valueOf(v.getPrice())); - v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); - } - } - map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString()); - } - excelWriter.fill(map, writeSheet); - excelWriter.fill(list, fillConfig, writeSheet); - } catch (IOException e) { - e.printStackTrace(); - log.error("|{}|导入错误,dto:|{}|,fileName:|{}|,error:|{}|", TAG, JSON.toJSONString(dto), fileName, e.getMessage()); - } - } } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeImportServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeImportServiceImpl.java index 522d00b54..4bc57325e 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeImportServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/recharge/WalletRechargeImportServiceImpl.java @@ -4,8 +4,7 @@ import cn.hutool.core.util.ObjectUtil; 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.dto.UserDTO; -import com.bsd.pjcloud.admin.api.entity.SysUser; +import com.bsd.pjcloud.admin.api.entity.SysDept; import com.bsd.pjcloud.admin.api.feign.RemoteDeptService; import com.bsd.pjcloud.admin.api.feign.RemoteUserService; import com.bsd.pjcloud.admin.api.utils.DataUtil; @@ -23,7 +22,6 @@ import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity; import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity; import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity; import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil; -import com.bsd.pjcloud.wallet.api.vo.WalletManageVo; import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeImportVo; import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper; import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeImportMapper; @@ -37,6 +35,7 @@ import org.springframework.validation.annotation.Validated; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * 充值导入表 @@ -94,26 +93,37 @@ public class WalletRechargeImportServiceImpl extends ServiceImpl scopePageList(Page page, WalletRechargeImportDto dto, DataScope dataScope) { - Page list = baseMapper.scopePageList(page, dto, dataScope); - if (ObjectUtil.isNotEmpty(list.getRecords())) { - // 用户 - List userIds = list.getRecords().stream().map(WalletRechargeImportVo::getUserId).distinct().toList(); - if (ObjectUtil.isNotEmpty(userIds)) { - R> userList = userService.getUserDeptByIds(new ArrayList<>(userIds)); - if (ObjectUtil.isNotEmpty(userList.getData())) { - DataUtil.convertUserDeptList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), UserVO::getUserId)); - } - } - // 饭卡类型 - List walletTypeId = list.getRecords().stream().map(WalletRechargeImportVo::getWalletTypeId).distinct().toList(); - if (ObjectUtil.isNotEmpty(walletTypeId)) { - WalletTypeDto walletTypeDto = new WalletTypeDto(); - List walletTypeList = walletTypeMapper.list(walletTypeDto); - if (ObjectUtil.isNotEmpty(walletTypeList)) { - WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId)); - } + // 查询部门 + if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getUserDeptId())) { + List deptList = deptService.getDescendantList(dto.getUserDeptId()).getData(); + dto.setUserDeptId(null); + if (ObjectUtil.isNotEmpty(deptList)) { + dto.setUserDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList())); } } + if (ObjectUtil.isNotEmpty(dto.getUserDeptIds())) { + dto.setUserDeptId(null); + } + Page list = baseMapper.scopePageList(page, dto, dataScope); + disposeList(list.getRecords(), dto); + return list; + } + + @Override + public List scopeList(WalletRechargeImportDto dto, DataScope dataScope) { + // 查询部门 + if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getUserDeptId())) { + List deptList = deptService.getDescendantList(dto.getUserDeptId()).getData(); + dto.setUserDeptId(null); + if (ObjectUtil.isNotEmpty(deptList)) { + dto.setUserDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList())); + } + } + if (ObjectUtil.isNotEmpty(dto.getUserDeptIds())) { + dto.setUserDeptId(null); + } + List list = baseMapper.scopeList(dto, dataScope); + disposeList(list, dto); return list; } @@ -138,4 +148,26 @@ public class WalletRechargeImportServiceImpl extends ServiceImpl list, WalletRechargeImportDto dto) { + if (ObjectUtil.isNotEmpty(list)) { + // 用户 + List userIds = list.stream().map(WalletRechargeImportVo::getUserId).distinct().toList(); + if (ObjectUtil.isNotEmpty(userIds)) { + R> userList = userService.getUserDeptByIds(new ArrayList<>(userIds)); + if (ObjectUtil.isNotEmpty(userList.getData())) { + DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList.getData(), UserVO::getUserId)); + } + } + // 饭卡类型 + List walletTypeId = list.stream().map(WalletRechargeImportVo::getWalletTypeId).distinct().toList(); + if (ObjectUtil.isNotEmpty(walletTypeId)) { + WalletTypeDto walletTypeDto = new WalletTypeDto(); + List walletTypeList = walletTypeMapper.list(walletTypeDto); + if (ObjectUtil.isNotEmpty(walletTypeList)) { + WalletDataUtil.convertWalletTypeList(list, CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId)); + } + } + } + } } \ No newline at end of file diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人充值明细.xlsx b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人充值明细.xlsx index 7891f08cf..e29b87028 100644 Binary files a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人充值明细.xlsx and b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人充值明细.xlsx differ diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人消费明细.xlsx b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人消费明细.xlsx index a517bcaa5..fe60ad04b 100644 Binary files a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人消费明细.xlsx and b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人消费明细.xlsx differ diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人退款明细.xlsx b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人退款明细.xlsx index 47638ce15..cf2211aaf 100644 Binary files a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人退款明细.xlsx and b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/个人退款明细.xlsx differ diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/批量充值扣款流水明细.xlsx b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/批量充值扣款流水明细.xlsx new file mode 100644 index 000000000..dfe85f6ad Binary files /dev/null and b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/file/批量充值扣款流水明细.xlsx differ diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/recharge/WalletRechargeImportMapper.xml b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/recharge/WalletRechargeImportMapper.xml index 798eb0639..3331804cd 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/recharge/WalletRechargeImportMapper.xml +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/resources/mapper/recharge/WalletRechargeImportMapper.xml @@ -34,6 +34,9 @@ a.del_flag = 0 + + and a.user_id = #{dto.userId} + and a.user_id in @@ -60,7 +63,7 @@ - + + + + \ No newline at end of file