feat:充值流水统计
This commit is contained in:
1 parent
f8ecf06bd6
commit
811f1e79aa
28 files changed
+531
-40
No files matched your search
@@ -46,7 +46,7 @@ CREATE TABLE wallet_manage
|
||||
total_expense int DEFAULT 0 NOT NULL COMMENT '累计支出,单位分',
|
||||
total_recharge int DEFAULT 0 NOT NULL COMMENT '累计充值,单位分',
|
||||
freeze_price int DEFAULT 0 NOT NULL COMMENT '冻结金额,单位分',
|
||||
is_freeze char(1) DEFAULT '0' NOT NULL COMMENT '是否冻结饭卡',
|
||||
is_freeze char(1) DEFAULT '0' NOT NULL COMMENT '是否冻结饭卡',
|
||||
active_bind_time timestamp COMMENT '绑定饭卡时间',
|
||||
active_bind_status char(10) COMMENT '饭卡绑定状态',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
@@ -117,6 +117,7 @@ CREATE TABLE wallet_freeze
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
process_id varchar(256) COMMENT '流程id',
|
||||
process_status varchar(10) NOT NULL COMMENT '审核状体',
|
||||
process_time datetime COMMENT '审核时间',
|
||||
wallet_id bigint NOT NULL COMMENT '钱包id',
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
@@ -191,6 +192,7 @@ CREATE TABLE wallet_recharge_apply
|
||||
user_id bigint NOT NULL COMMENT '申请人ID',
|
||||
process_id varchar(256) COMMENT '流程id',
|
||||
process_status varchar(10) COMMENT '审核状体',
|
||||
process_time datetime COMMENT '审核时间',
|
||||
biz_type tinytext DEFAULT NULL COMMENT '充值类型',
|
||||
wallet_type_id bigint DEFAULT NULL COMMENT '饭卡类型id',
|
||||
dept_id bigint NOT NULL COMMENT '部门ID',
|
||||
@@ -238,6 +240,7 @@ CREATE TABLE wallet_stride
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
process_id varchar(256) COMMENT '流程id',
|
||||
process_status varchar(10) NOT NULL COMMENT '审核状体',
|
||||
process_time datetime COMMENT '审核时间',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
count int NOT NULL COMMENT '申请数量',
|
||||
use_count int DEFAULT 0 COMMENT '使用数量',
|
||||
@@ -263,6 +266,7 @@ CREATE TABLE wallet_foreign
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
process_id varchar(256) COMMENT '流程id',
|
||||
process_status varchar(10) NOT NULL COMMENT '审核状体',
|
||||
process_time datetime COMMENT '审核时间',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
apply_start_time date NULL COMMENT '申请使用开始时间',
|
||||
apply_end_time date NULL COMMENT '申请使用结束时间',
|
||||
|
||||
@@ -71,6 +71,7 @@ public class UserDTO extends SysUser {
|
||||
* true 当前部门及子部门
|
||||
*/
|
||||
private Boolean isDeepDept = false;
|
||||
|
||||
private List<Long> deptIds;
|
||||
|
||||
}
|
||||
+4
@@ -22,6 +22,7 @@ package com.bsd.pjcloud.admin.api.feign;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserDTO;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
@@ -77,6 +78,9 @@ public interface RemoteUserService {
|
||||
@GetMapping("/user/list")
|
||||
R<List<SysUser>> getUserById(@RequestParam("userIds") List<Long> userIds);
|
||||
|
||||
@GetMapping("/user/user-dept")
|
||||
R<List<UserVO>> getUserDeptByIds(@RequestParam("userIds") List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 通过社交账号或手机号查询用户、角色信息
|
||||
*
|
||||
|
||||
+16
@@ -6,8 +6,10 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysMenu;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.vo.SysUserFaceVo;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseFacesInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import lombok.experimental.UtilityClass;
|
||||
@@ -106,6 +108,20 @@ public class DataUtil {
|
||||
return v;
|
||||
}
|
||||
|
||||
public <T extends BaseUserDeptInterface> List<T> convertUserDeptList(List<T> list, Map<Long, UserVO> map) {
|
||||
return CollectionUtils.convertList(list, user -> convertUserDept(user, map.get(user.getUserId())));
|
||||
}
|
||||
|
||||
public <T extends BaseUserDeptInterface> T convertUserDept(T v, UserVO user) {
|
||||
if (ObjectUtil.isEmpty(user)) return v;
|
||||
v.setUsername(user.getName());
|
||||
v.setUserMobile(user.getPhone());
|
||||
v.setUserAvatar(user.getAvatar());
|
||||
v.setUserDeptId(user.getDeptId());
|
||||
v.setUserDeptName(user.getDeptName());
|
||||
return v;
|
||||
}
|
||||
|
||||
public <T extends BaseDeptInterface> List<T> convertDeptList(List<T> list, Map<Long, SysDept> map) {
|
||||
return CollectionUtils.convertList(list, user -> convertDept(user, map.get(user.getDeptId())));
|
||||
}
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.bsd.pjcloud.admin.api.vo.base;
|
||||
|
||||
public interface BaseUserDeptInterface {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
Long getUserId();
|
||||
|
||||
void setUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
String getUsername();
|
||||
|
||||
void setUsername(String username);
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
String getUserMobile();
|
||||
|
||||
void setUserMobile(String userMobile);
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
String getUserAvatar();
|
||||
|
||||
void setUserAvatar(String userAvatar);
|
||||
|
||||
/**
|
||||
* 用户部门id
|
||||
*/
|
||||
Long getUserDeptId();
|
||||
|
||||
void setUserDeptId(Long userDeptId);
|
||||
|
||||
/**
|
||||
* 用户部门
|
||||
*/
|
||||
String getUserDeptName();
|
||||
|
||||
void setUserDeptName(String deptName);
|
||||
}
|
||||
+5
@@ -27,6 +27,7 @@ import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserExcelFaceVo;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserExcelVO;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.admin.service.SysUserService;
|
||||
import com.bsd.pjcloud.common.core.constant.CommonConstants;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
@@ -344,6 +345,10 @@ public class SysUserController {
|
||||
return R.ok(userService.list(Wrappers.<SysUser>lambdaQuery().in(SysUser::getUserId, userIds)));
|
||||
}
|
||||
|
||||
@GetMapping("/user-dept")
|
||||
public R<List<UserVO>> getUserDeptByIds(@RequestParam("userIds") List<Long> userIds) {
|
||||
return R.ok(userService.getUserDeptByIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据浙政钉号和手机号查询
|
||||
|
||||
+2
@@ -189,4 +189,6 @@ public interface SysUserService extends IService<SysUser> {
|
||||
* @return
|
||||
*/
|
||||
R<Boolean> resetUserPassword(UserDTO userDto);
|
||||
|
||||
List<UserVO> getUserDeptByIds(List<Long> userIds);
|
||||
}
|
||||
+5
@@ -56,6 +56,7 @@ import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
|
||||
import com.bsd.pjcloud.common.file.core.FileProperties;
|
||||
@@ -762,4 +763,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
return baseMapper.selectList(Wrappers.<SysUser>lambdaQuery().in(SysUser::getDeptId, deptIdList));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserVO> getUserDeptByIds(List<Long> userIds) {
|
||||
return baseMapper.selectVoListByScope(new UserDTO(), userIds.toArray(new Long[0]), null);
|
||||
}
|
||||
}
|
||||
+18
-1
@@ -3,7 +3,24 @@ package com.bsd.pjcloud.wallet.api.dto.recharge;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WalletRechargeImportDto extends WalletRechargeImportEntity {
|
||||
|
||||
|
||||
private String processStatus;
|
||||
|
||||
private Long walletTypeId;
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
private Long userDeptId;
|
||||
|
||||
private List<Long> userDeptIds;
|
||||
|
||||
private LocalDateTime[] createTimeList;
|
||||
|
||||
private LocalDateTime[] processTimeList;
|
||||
|
||||
}
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
package com.bsd.pjcloud.wallet.api.dto.excel;
|
||||
package com.bsd.pjcloud.wallet.api.dto.recharge.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
@@ -47,4 +47,7 @@ public class WalletRechargeExcelDto {
|
||||
|
||||
// 用户id
|
||||
private Long userId;
|
||||
|
||||
// 用户部门id
|
||||
private Long userDeptId;
|
||||
}
|
||||
+6
@@ -46,6 +46,12 @@ public class WalletRechargeApplyEntity extends Model<WalletRechargeApplyEntity>
|
||||
@Schema(description = "流程状态")
|
||||
private String processStatus;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
@Schema(description = "审核时间")
|
||||
private LocalDateTime processTime;
|
||||
|
||||
/**
|
||||
* 申请人ID
|
||||
*/
|
||||
|
||||
+6
@@ -37,6 +37,12 @@ public class WalletRechargeImportEntity extends Model<WalletRechargeImportEntity
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户部门id
|
||||
*/
|
||||
@Schema(description = "用户部门id")
|
||||
private Long userDeptId;
|
||||
|
||||
/**
|
||||
* 申请id
|
||||
*/
|
||||
|
||||
+39
-1
@@ -1,11 +1,16 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.recharge;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.base.BaseWalletTypeInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class WalletRechargeImportVo extends WalletRechargeImportEntity implements BaseUserInterface {
|
||||
public class WalletRechargeImportVo extends WalletRechargeImportEntity implements BaseUserDeptInterface, BaseWalletTypeInterface {
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
@@ -14,4 +19,37 @@ public class WalletRechargeImportVo extends WalletRechargeImportEntity implement
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
private Long userDeptId;
|
||||
|
||||
private String userDeptName;
|
||||
|
||||
/**
|
||||
* 申请相关
|
||||
*/
|
||||
private Long applyId;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private String bizType;
|
||||
|
||||
private Long walletTypeId;
|
||||
|
||||
private LocalDate importTime;
|
||||
|
||||
private String processId;
|
||||
|
||||
private String processStatus;
|
||||
|
||||
private LocalDateTime processTime;
|
||||
|
||||
/**
|
||||
* 钱包类型相关
|
||||
*/
|
||||
|
||||
private String walletTypeName;
|
||||
|
||||
private String walletTypeUniqueCode;
|
||||
|
||||
private String walletTypeIcon;
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.recharge.excel;
|
||||
|
||||
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 lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false)
|
||||
@HeadRowHeight(40)
|
||||
@ColumnWidth(50)
|
||||
@ContentRowHeight(20)
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WalletRechargeByApplyExcelVo {
|
||||
|
||||
@ExcelProperty("用户名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty("用户手机号")
|
||||
private String userMobile;
|
||||
|
||||
@ExcelProperty("用户部门")
|
||||
private String userDeptName;
|
||||
|
||||
@ExcelProperty("操作金额")
|
||||
private String price;
|
||||
|
||||
}
|
||||
+12
-2
@@ -11,8 +11,10 @@ import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletRechargeByApplyExcelVo;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeApplyService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeApplyComposeService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -55,7 +57,7 @@ public class WalletRechargeApplyController {
|
||||
@Operation(summary = "提交申请", description = "提交申请")
|
||||
@SysLog("提交申请")
|
||||
@GetMapping("/apply")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_apply')")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_apply')")
|
||||
public R apply(@RequestParam Long id) {
|
||||
walletRechargeApplyService.apply(id);
|
||||
return R.ok(true);
|
||||
@@ -120,6 +122,14 @@ public class WalletRechargeApplyController {
|
||||
|
||||
/* ************************************* start excel start ************************************* */
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export-excel")
|
||||
public List<WalletRechargeByApplyExcelVo> exportExcel(WalletRechargeImportDto dto) {
|
||||
dto.setApplyId(dto.getId());
|
||||
dto.setId(null);
|
||||
return walletRechargeApplyService.exportExcel(dto);
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_export')")
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package com.bsd.pjcloud.wallet.controller.recharge;
|
||||
|
||||
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.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeImportService;
|
||||
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;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 充值导入表
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2025-01-20 17:56:46
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wallet-recharge-import")
|
||||
@Tag(description = "wallet-recharge-import", name = "充值导入表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletRechargeImportController {
|
||||
|
||||
private final WalletRechargeImportService walletRechargeImportService;
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_view')")
|
||||
public R getWalletRechargeImportPage(@ParameterObject Page page, @ParameterObject WalletRechargeImportEntity walletRechargeImport) {
|
||||
LambdaQueryWrapper<WalletRechargeImportEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletRechargeImportService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_view')")
|
||||
public R scopePageList(@ParameterObject Page page, @ParameterObject WalletRechargeImportDto dto) {
|
||||
return R.ok(walletRechargeImportService.scopePageList(page, dto, DataScope.of()));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(walletRechargeImportService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增充值导入表", description = "新增充值导入表")
|
||||
@SysLog("新增充值导入表")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_add')")
|
||||
public R save(@RequestBody WalletRechargeImportEntity walletRechargeImport) {
|
||||
return R.ok(walletRechargeImportService.save(walletRechargeImport));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改充值导入表", description = "修改充值导入表")
|
||||
@SysLog("修改充值导入表")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_edit')")
|
||||
public R updateById(@RequestBody WalletRechargeImportEntity walletRechargeImport) {
|
||||
return R.ok(walletRechargeImportService.updateById(walletRechargeImport));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除充值导入表", description = "通过id删除充值导入表")
|
||||
@SysLog("通过id删除充值导入表")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletRechargeImportService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeImport_export')")
|
||||
public List<WalletRechargeImportEntity> export(WalletRechargeImportEntity walletRechargeImport, Long[] ids) {
|
||||
return walletRechargeImportService.list(Wrappers.lambdaQuery(walletRechargeImport).in(ArrayUtil.isNotEmpty(ids), WalletRechargeImportEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+15
@@ -14,6 +14,8 @@ import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface WalletRechargeApplyMapper extends PjcloudBaseMapper<WalletRechargeApplyEntity> {
|
||||
|
||||
@@ -29,6 +31,19 @@ public interface WalletRechargeApplyMapper extends PjcloudBaseMapper<WalletRecha
|
||||
return selectJoinPage(page, WalletRechargeApplyVo.class, wrapper);
|
||||
}
|
||||
|
||||
default List<WalletRechargeApplyVo> listJoin(WalletRechargeApplyDto dto) {
|
||||
MPJLambdaWrapper<WalletRechargeApplyEntity> wrapper = new MPJLambdaWrapper<WalletRechargeApplyEntity>()
|
||||
.selectAll(WalletRechargeApplyEntity.class)
|
||||
.selectAs(WalletTypeEntity::getName, WalletRechargeApplyVo::getWalletTypeName)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletRechargeApplyVo::getWalletTypeUniqueCode)
|
||||
.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 selectJoinList(WalletRechargeApplyVo.class, wrapper);
|
||||
}
|
||||
|
||||
|
||||
default Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto) {
|
||||
LambdaQueryWrapper<WalletRechargeApplyEntity> wrapper = new LambdaQueryWrapper<WalletRechargeApplyEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getWalletTypeId()), WalletRechargeApplyEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
|
||||
+13
@@ -1,20 +1,33 @@
|
||||
package com.bsd.pjcloud.wallet.mapper.recharge;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
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.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface WalletRechargeImportMapper extends PjcloudBaseMapper<WalletRechargeImportEntity> {
|
||||
|
||||
Page<WalletRechargeImportVo> scopePageList(Page page, @Param("dto") WalletRechargeImportDto dto, DataScope dataScope);
|
||||
|
||||
default Page<WalletRechargeImportVo> pageJoin(Page page, WalletRechargeImportDto dto) {
|
||||
MPJLambdaWrapper<WalletRechargeImportEntity> wrapper = new MPJLambdaWrapper<WalletRechargeImportEntity>()
|
||||
.eqIfExists(WalletRechargeImportEntity::getId, dto.getId())
|
||||
.eqIfExists(WalletRechargeImportEntity::getApplyId, dto.getApplyId());
|
||||
return selectJoinPage(page, WalletRechargeImportVo.class, wrapper);
|
||||
}
|
||||
|
||||
default List<WalletRechargeImportVo> listJoin(WalletRechargeImportDto dto) {
|
||||
MPJLambdaWrapper<WalletRechargeImportEntity> wrapper = new MPJLambdaWrapper<WalletRechargeImportEntity>()
|
||||
.eqIfExists(WalletRechargeImportEntity::getId, dto.getId())
|
||||
.eqIfExists(WalletRechargeImportEntity::getApplyId, dto.getApplyId());
|
||||
return selectJoinList(WalletRechargeImportVo.class, wrapper);
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletRechargeByApplyExcelVo;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,6 +22,8 @@ public interface WalletRechargeApplyService extends IService<WalletRechargeApply
|
||||
|
||||
Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto);
|
||||
|
||||
List<WalletRechargeApplyVo> listJoin(WalletRechargeApplyDto dto);
|
||||
|
||||
Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto);
|
||||
|
||||
/**
|
||||
@@ -50,4 +54,6 @@ public interface WalletRechargeApplyService extends IService<WalletRechargeApply
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
|
||||
void updateBeforePrice(WalletRechargeApplyEntity detail);
|
||||
|
||||
List<WalletRechargeByApplyExcelVo> exportExcel(WalletRechargeImportDto dto);
|
||||
}
|
||||
+6
@@ -3,12 +3,18 @@ package com.bsd.pjcloud.wallet.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
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 java.util.List;
|
||||
|
||||
public interface WalletRechargeImportService extends IService<WalletRechargeImportEntity> {
|
||||
|
||||
Page<WalletRechargeImportVo> pageJoin(Page page, WalletRechargeImportDto dto);
|
||||
|
||||
List<WalletRechargeImportVo> listJoin(WalletRechargeImportDto dto);
|
||||
|
||||
Page<WalletRechargeImportVo> scopePageList(Page page, WalletRechargeImportDto dto, DataScope dataScope);
|
||||
}
|
||||
+5
-6
@@ -11,7 +11,6 @@ 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;
|
||||
@@ -66,10 +65,10 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long create(MchManageEntity dto) {
|
||||
if (existName(dto.getName(), null)) {
|
||||
throw new CheckedException("商户名不能重复");
|
||||
throw new RuntimeException("商户名不能重复");
|
||||
}
|
||||
if (existDeptId(dto.getDeptId(), null)) {
|
||||
throw new CheckedException("该部门已经绑定过商户");
|
||||
throw new RuntimeException("该部门已经绑定过商户");
|
||||
}
|
||||
// 查询父部门
|
||||
|
||||
@@ -98,14 +97,14 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
// @CacheEvict(value = CacheConstants.WALLET_MCH, key = "#dto.getId()", condition = "#dto.getId() != null")
|
||||
public void edit(MchManageEntity dto) {
|
||||
if (existName(dto.getName(), dto.getId())) {
|
||||
throw new CheckedException("商户名不能重复");
|
||||
throw new RuntimeException("商户名不能重复");
|
||||
}
|
||||
if (existDeptId(dto.getDeptId(), dto.getId())) {
|
||||
throw new CheckedException("改部门已经绑定过商户");
|
||||
throw new RuntimeException("该部门已经绑定过商户");
|
||||
}
|
||||
MchManageEntity mchManage = getSelf().getById(dto.getId());
|
||||
if (ObjectUtil.isEmpty(mchManage)) {
|
||||
throw new CheckedException("商户不存在");
|
||||
throw new RuntimeException("商户不存在");
|
||||
}
|
||||
baseMapper.updateById(dto);
|
||||
}
|
||||
|
||||
+2
-3
@@ -11,7 +11,6 @@ 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.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
@@ -70,10 +69,10 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
Long count = dto.getCount();
|
||||
// 查询饭卡钱包类型
|
||||
WalletTypeEntity walletType = walletTypeService.getByUniqueCode(WalletTypeEnum.EAT);
|
||||
if (ObjectUtil.isEmpty(walletType)) throw new CheckedException("钱包类型不存在");
|
||||
if (ObjectUtil.isEmpty(walletType)) throw new RuntimeException("钱包类型不存在");
|
||||
// 查询商户
|
||||
MchManageEntity mchManage = mchManageService.getById(dto.getMerchantId());
|
||||
if (ObjectUtil.isEmpty(mchManage)) throw new CheckedException("商户不存在");
|
||||
if (ObjectUtil.isEmpty(mchManage)) throw new RuntimeException("商户不存在");
|
||||
int startNum = 1;
|
||||
WalletActiveEntity last = baseMapper.getLast();
|
||||
if (ObjectUtil.isNotEmpty(last)) startNum = last.getCardSort();
|
||||
|
||||
-1
@@ -13,7 +13,6 @@ 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.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.flow.task.api.feign.RemoteFlowApiFlowService;
|
||||
|
||||
+4
-5
@@ -11,7 +11,6 @@ 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.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
@@ -74,12 +73,12 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
WalletManageEntity wallet = walletManageService.getById(walletId);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
log.error("|{}|,用户钱包id({})不存在.", TAG, walletId);
|
||||
throw new CheckedException("扣款失败,用户钱包不存在");
|
||||
throw new RuntimeException("扣款失败,用户钱包不存在");
|
||||
}
|
||||
int updateCounts = walletManageMapper.updateWhenConsumption(wallet.getId(), price);
|
||||
if (updateCounts == 0) {
|
||||
log.error("|{}|,用户钱包id({})余额不足.", TAG, walletId);
|
||||
throw new CheckedException("钱包余额不足");
|
||||
throw new RuntimeException("钱包余额不足");
|
||||
}
|
||||
Integer afterBalance = wallet.getBalance() - price;
|
||||
WalletTransactionEntity insetObj = new WalletTransactionEntity();
|
||||
@@ -102,7 +101,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
WalletManageEntity wallet = walletManageService.getById(walletId);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
log.error("|{}|,用户钱包id({})不存在.", TAG, walletId);
|
||||
throw new CheckedException("扣款失败,用户钱包不存在");
|
||||
throw new RuntimeException("扣款失败,用户钱包不存在");
|
||||
}
|
||||
switch (bizType) {
|
||||
case UPDATE:
|
||||
@@ -141,7 +140,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
if (wallet == null) {
|
||||
log.error("|{}|,updateReqVO({}) 用户钱包不存在.", TAG, JSON.toJSONString(dto));
|
||||
throw new CheckedException("用户钱包不存在");
|
||||
throw new RuntimeException("用户钱包不存在");
|
||||
}
|
||||
// 更新钱包余额
|
||||
WalletTransactionEntity result = getSelf().addWalletBalance(wallet.getId(), dto.getBalance(), String.valueOf(dto.getUserId()), WalletBizEnum.UPDATE);
|
||||
|
||||
+5
-6
@@ -3,7 +3,6 @@ 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.exception.CheckedException;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
@@ -37,10 +36,10 @@ public class WalletTypeServiceImpl extends ServiceImpl<WalletTypeMapper, WalletT
|
||||
@Override
|
||||
public void create(WalletTypeEntity dto) {
|
||||
if (existName(dto.getId(), dto.getName())) {
|
||||
throw new CheckedException("钱包名存在");
|
||||
throw new RuntimeException("钱包名存在");
|
||||
}
|
||||
if (existCode(dto.getId(), dto.getUniqueCode())) {
|
||||
throw new CheckedException("钱包类型存在");
|
||||
throw new RuntimeException("钱包类型存在");
|
||||
}
|
||||
baseMapper.insert(dto);
|
||||
}
|
||||
@@ -48,14 +47,14 @@ public class WalletTypeServiceImpl extends ServiceImpl<WalletTypeMapper, WalletT
|
||||
@Override
|
||||
public void edit(WalletTypeEntity dto) {
|
||||
if (existName(dto.getId(), dto.getName())) {
|
||||
throw new CheckedException("钱包名存在");
|
||||
throw new RuntimeException("钱包名存在");
|
||||
}
|
||||
if (existCode(dto.getId(), dto.getUniqueCode())) {
|
||||
throw new CheckedException("钱包类型存在");
|
||||
throw new RuntimeException("钱包类型存在");
|
||||
}
|
||||
WalletTypeEntity walletType = baseMapper.selectById(dto.getId());
|
||||
if (ObjectUtil.isEmpty(walletType)) {
|
||||
throw new CheckedException("钱包类型不存在");
|
||||
throw new RuntimeException("钱包类型不存在");
|
||||
}
|
||||
baseMapper.updateById(dto);
|
||||
}
|
||||
|
||||
+57
-9
@@ -15,7 +15,6 @@ 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.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
@@ -31,13 +30,16 @@ import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizRechargeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
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.recharge.WalletRechargeApplyVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeImportVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletRechargeByApplyExcelVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeApplyMapper;
|
||||
@@ -55,6 +57,8 @@ import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -127,6 +131,30 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WalletRechargeApplyVo> listJoin(WalletRechargeApplyDto dto) {
|
||||
List<WalletRechargeApplyVo> list = baseMapper.listJoin(dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 用户
|
||||
List<Long> userIds = list.stream().map(WalletRechargeApplyVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list, CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.stream().map(WalletRechargeApplyVo::getDeptId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list, deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto) {
|
||||
Page<WalletRechargeApplyVo> list = baseMapper.scopePageList(page, dto);
|
||||
@@ -166,15 +194,15 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
public void apply(Long id) {
|
||||
// 查询详情
|
||||
WalletRechargeApplyEntity detail = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(detail)) throw new CheckedException("充值申请不存在");
|
||||
if (ObjectUtil.isEmpty(detail)) throw new RuntimeException("充值申请不存在");
|
||||
if (!ObjectUtil.isAllNotEmpty(detail.getImportTime(), detail.getWalletTypeId())) {
|
||||
throw new CheckedException("请先编辑导入时间等信息");
|
||||
throw new RuntimeException("请先编辑导入时间等信息");
|
||||
}
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(detail.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
// 查询用户
|
||||
UserInfo user = userService.getByUserId(detail.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(user)) throw new CheckedException("发起人不存在");
|
||||
if (ObjectUtil.isEmpty(user)) throw new RuntimeException("发起人不存在");
|
||||
// 查询部门
|
||||
SysDept dept = deptService.getDeptByDeptId(detail.getDeptId()).getData();
|
||||
if (ObjectUtil.isEmpty(dept)) throw new RuntimeException("发起人部门不存在");
|
||||
@@ -205,7 +233,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
public void cancelApply(WalletRechargeApplyDto dto) {
|
||||
WalletRechargeApplyEntity rechargeApply = baseMapper.selectById(dto.getId());
|
||||
if (ObjectUtil.isEmpty(rechargeApply)) {
|
||||
throw new CheckedException("充值申请不存在");
|
||||
throw new RuntimeException("充值申请不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +274,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
errors.add("用户不存在");
|
||||
} else {
|
||||
v.setUserId(sysUser.get().getUserId());
|
||||
v.setUserDeptId(sysUser.get().getDeptId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,9 +291,9 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
insertObj.setUserId(loginUser.getId());
|
||||
int i = baseMapper.insert(insertObj);
|
||||
if (i <= 0) {
|
||||
throw new CheckedException("导入失败");
|
||||
throw new RuntimeException("导入失败");
|
||||
}
|
||||
List<WalletRechargeImportEntity> batchSaveList = list.stream().map(v -> WalletRechargeImportEntity.builder().price(v.getPriceNumber()).userId(v.getUserId()).build()).toList();
|
||||
List<WalletRechargeImportEntity> batchSaveList = list.stream().map(v -> WalletRechargeImportEntity.builder().price(v.getPriceNumber()).userId(v.getUserId()).userDeptId(v.getUserDeptId()).build()).toList();
|
||||
batchSaveList.forEach(v -> v.setApplyId(insertObj.getId()));
|
||||
rechargeImportService.saveBatch(batchSaveList);
|
||||
return R.ok(null, MsgUtils.getMessage(ErrorCodes.SYS_USER_IMPORT_SUCCEED));
|
||||
@@ -288,7 +317,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
try {
|
||||
Boolean isConsent = flowUtil.isConsent(dto);
|
||||
String processStatus = isConsent ? TaskCheckStatusEnum.RESULT.getCode() : TaskCheckStatusEnum.REJECT.getCode();
|
||||
baseMapper.updateById(WalletRechargeApplyEntity.builder().id(detail.getId()).processStatus(processStatus).build());
|
||||
baseMapper.updateById(WalletRechargeApplyEntity.builder().id(detail.getId()).processTime(LocalDateTime.now()).processStatus(processStatus).build());
|
||||
if (isConsent) {
|
||||
List<WalletRechargeImportEntity> importList = rechargeImportService.list(new LambdaQueryWrapper<WalletRechargeImportEntity>()
|
||||
.eq(WalletRechargeImportEntity::getApplyId, detail.getId())
|
||||
@@ -338,6 +367,25 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
rechargeImportService.updateBatchById(saveList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WalletRechargeByApplyExcelVo> exportExcel(WalletRechargeImportDto dto) {
|
||||
List<WalletRechargeByApplyExcelVo> result = new ArrayList<>();
|
||||
List<WalletRechargeImportVo> list = rechargeImportService.listJoin(dto);
|
||||
if (ObjectUtil.isEmpty(list)) return result;
|
||||
for (WalletRechargeImportVo v : list) {
|
||||
WalletRechargeByApplyExcelVo item = new WalletRechargeByApplyExcelVo();
|
||||
item.setUsername(v.getUsername());
|
||||
item.setUserMobile(v.getUserMobile());
|
||||
item.setUserDeptName(v.getUserDeptName());
|
||||
if (ObjectUtil.isNotEmpty(v.getPrice())) {
|
||||
String price = new BigDecimal(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString();
|
||||
item.setPrice(price);
|
||||
}
|
||||
result.add(item);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletRechargeApplyEntity>()
|
||||
.eq(WalletRechargeApplyEntity::getUserId, walletId)
|
||||
|
||||
+52
-2
@@ -3,18 +3,26 @@ package com.bsd.pjcloud.wallet.service.impl.recharge;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
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.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
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;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeImportService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -35,6 +43,8 @@ import java.util.List;
|
||||
@Service
|
||||
public class WalletRechargeImportServiceImpl extends ServiceImpl<WalletRechargeImportMapper, WalletRechargeImportEntity> implements WalletRechargeImportService {
|
||||
|
||||
private final WalletTypeMapper walletTypeMapper;
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
|
||||
@@ -45,13 +55,53 @@ public class WalletRechargeImportServiceImpl extends ServiceImpl<WalletRechargeI
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletRechargeImportVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
R<List<UserVO>> userList = userService.getUserDeptByIds(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
DataUtil.convertUserDeptList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), UserVO::getUserId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WalletRechargeImportVo> listJoin(WalletRechargeImportDto dto) {
|
||||
List<WalletRechargeImportVo> list = baseMapper.listJoin(dto);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 用户
|
||||
List<Long> userIds = list.stream().map(WalletRechargeImportVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<UserVO>> userList = userService.getUserDeptByIds(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList.getData(), UserVO::getUserId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletRechargeImportVo> scopePageList(Page page, WalletRechargeImportDto dto, DataScope dataScope) {
|
||||
Page<WalletRechargeImportVo> list = baseMapper.scopePageList(page, dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletRechargeImportVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<UserVO>> userList = userService.getUserDeptByIds(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserDeptList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), UserVO::getUserId));
|
||||
}
|
||||
}
|
||||
// 饭卡类型
|
||||
List<Long> walletTypeId = list.getRecords().stream().map(WalletRechargeImportVo::getWalletTypeId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletTypeId)) {
|
||||
WalletTypeDto walletTypeDto = new WalletTypeDto();
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+66
-1
@@ -2,7 +2,8 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeImportMapper">
|
||||
<resultMap id="walletRechargeImportMap" type="com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity">
|
||||
<resultMap id="walletRechargeImportMap"
|
||||
type="com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="applyId" column="apply_id"/>
|
||||
@@ -15,4 +16,68 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.user_id,
|
||||
a.user_dept_id,
|
||||
a.apply_id,
|
||||
a.before_price,
|
||||
a.price,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = 0
|
||||
<if test="dto.userIds != null and dto.userIds.size() != 0">
|
||||
and a.user_id in
|
||||
<foreach collection="dto.userIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.userDeptIds != null and dto.userDeptIds.size() != 0">
|
||||
and a.user_dept_id in
|
||||
<foreach collection="dto.userDeptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.userDeptId != null">
|
||||
and a.user_dept_id = #{dto.userDeptId}
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopePageList" resultType="com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeImportVo">
|
||||
<include refid="selectA"/>
|
||||
p.id as applyId,
|
||||
p.dept_id,
|
||||
p.biz_type,
|
||||
p.wallet_type_id,
|
||||
p.import_time,
|
||||
p.process_id,
|
||||
p.process_status,
|
||||
p.process_time
|
||||
from wallet_recharge_import a
|
||||
inner join wallet_recharge_apply p on p.id = a.apply_id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
and p.process_id is not null
|
||||
<if test="dto.processStatus != null and dto.processStatus != ''">
|
||||
and p.process_status = #{dto.processStatus}
|
||||
</if>
|
||||
<if test="dto.walletTypeId != null">
|
||||
and p.wallet_type_id = #{dto.walletTypeId}
|
||||
</if>
|
||||
<if test="dto.processTimeList != null and dto.processTimeList.length == 2">
|
||||
and p.process_time between #{dto.processTimeList[0]} and #{dto.processTimeList[1]}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user