Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a6be4c3606
27 files changed
+364
-106
No files matched your search
+20
@@ -100,6 +100,26 @@ public class HardOrderController {
|
||||
return R.ok(hardwareOrderService.pagejoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询超市订单列表", description = "app查询订单列表")
|
||||
@GetMapping("/app/sup-page-join")
|
||||
public R appSupPageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setIsFindCarList(true);
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.SUPERMARKET.getType(), MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
return R.ok(hardwareOrderService.pagejoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询食堂订单列表", description = "app查询订单列表")
|
||||
@GetMapping("/app/caneen-page-join")
|
||||
public R appCaneenPageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setIsFindCarList(true);
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
return R.ok(hardwareOrderService.pagejoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app商户查询订单列表", description = "app商户查询订单列表")
|
||||
@GetMapping("/app/mch-page-join")
|
||||
public R appMchPageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
.eqIfExists(HardOrderEntity::getPayType, dto.getPayType())
|
||||
.eqIfExists(HardOrderEntity::getOrderStatus, dto.getOrderStatus())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), HardOrderEntity::getUserId, dto.getUserIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getMchTypeCodes()), HardOrderEntity::getMerchantType, dto.getMchTypeCodes())
|
||||
.orderByDesc(HardOrderEntity::getCreateTime)
|
||||
.orderByDesc(HardOrderEntity::getUserId);
|
||||
return selectJoinPage(page, HardOrderVo.class, wrapper);
|
||||
|
||||
+25
-3
@@ -65,6 +65,7 @@ import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.flow.task.dto.TaskDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
|
||||
|
||||
@@ -541,6 +542,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
String walletAutoCreate = ParamResolver.getStr("WALLET_AUTO_CREATE");
|
||||
String userDefaultRole = ParamResolver.getStr("USER_DEFAULT_ROLE");
|
||||
List<Long> roleIds = roleList.stream().filter(v -> ObjectUtil.equals(v.getRoleCode(), walletAutoCreate) || ObjectUtil.equals(v.getRoleCode(), userDefaultRole)).map(SysRole::getRoleId).toList();
|
||||
// 用户手机号重复判断
|
||||
List<String> userPoneList = excelList.stream().map(UserExcelFaceVo::getMobile).filter(ObjectUtil::isNotEmpty).toList();
|
||||
// 用户名重复判断
|
||||
List<String> usernameList = excelList.stream().map(UserExcelFaceVo::getUsername).filter(ObjectUtil::isNotEmpty).toList();
|
||||
// 读取图片
|
||||
Map<String, PictureData> images = ExcelTool.getPictureFromExcel(file, 1);
|
||||
for (UserExcelFaceVo v : excelList) {
|
||||
@@ -576,9 +581,23 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
String key = String.valueOf(v.getLineNum() - 1);
|
||||
face = images.getOrDefault(key, null);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(face)) {
|
||||
errorMsg.add("人脸照片为空");
|
||||
// if (ObjectUtil.isEmpty(face)) {
|
||||
// errorMsg.add("人脸照片为空");
|
||||
// }
|
||||
if (ObjectUtil.isNotEmpty(v.getMobile())) {
|
||||
long userPhone = userPoneList.stream().filter(i -> ObjectUtil.equals(i, v.getMobile())).count();
|
||||
if (userPhone > 1) {
|
||||
errorMsg.add("用手机号 <" + v.getMobile() + "> 重复");
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getUsername())) {
|
||||
long repetitionUsername = usernameList.stream().filter(i -> ObjectUtil.equals(i, v.getUsername())).count();
|
||||
if (repetitionUsername > 1) {
|
||||
errorMsg.add("用户名 <" + v.getUsername() + "> 重复");
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(errorMsg)) {
|
||||
insertExcelUser(v, deptId, roleIds, face);
|
||||
} else {
|
||||
@@ -638,7 +657,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
// 插入用户
|
||||
Long usrId = this.saveUser(userDTO);
|
||||
userDTO.setUserId(usrId);
|
||||
insertExcelFace(userDTO, face);
|
||||
// 更新人脸
|
||||
if (ObjectUtil.isNotEmpty(face)) {
|
||||
insertExcelFace(userDTO, face);
|
||||
}
|
||||
}
|
||||
|
||||
public void insertExcelFace(UserDTO user, PictureData face) {
|
||||
|
||||
+2
@@ -18,6 +18,8 @@ public class MchManageDto extends MchManageEntity {
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
private List<Long> notIds;
|
||||
|
||||
private String type;
|
||||
|
||||
private Boolean parentIsNull = true;
|
||||
|
||||
+2
@@ -29,4 +29,6 @@ public class WalletTransactionSumAndCountDto {
|
||||
|
||||
private Long walletTypeId;
|
||||
|
||||
private Long walletId;
|
||||
|
||||
}
|
||||
+2
@@ -10,4 +10,6 @@ public class WalletTypeDto extends WalletTypeEntity {
|
||||
|
||||
private List<Long> walletTypeIds;
|
||||
|
||||
private List<Long> notWalletTypeIds;
|
||||
|
||||
}
|
||||
+1
@@ -37,6 +37,7 @@ public class WalletDataUtil {
|
||||
v.setWalletTypeName(vo.getName());
|
||||
v.setWalletTypeUniqueCode(vo.getUniqueCode());
|
||||
v.setWalletTypeIcon(vo.getIcon());
|
||||
v.setIsRule(vo.getIsRule());
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -10,8 +10,9 @@ import java.util.List;
|
||||
@Data
|
||||
public class MchManageVo extends MchManageEntity implements BaseDeptInterface, BaseWalletTypeInterface {
|
||||
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 钱包类型相关
|
||||
*/
|
||||
private Long walletTypeId;
|
||||
|
||||
private String walletTypeName;
|
||||
@@ -20,6 +21,10 @@ public class MchManageVo extends MchManageEntity implements BaseDeptInterface, B
|
||||
|
||||
private String walletTypeIcon;
|
||||
|
||||
private String isRule;
|
||||
|
||||
private String deptName;
|
||||
|
||||
private List<MchManageVo> children;
|
||||
|
||||
}
|
||||
+2
@@ -41,4 +41,6 @@ public class WalletActiveVo extends WalletActiveEntity implements BaseUserInterf
|
||||
private String walletTypeUniqueCode;
|
||||
|
||||
private String walletTypeIcon;
|
||||
|
||||
private String isRule;
|
||||
}
|
||||
+2
@@ -24,6 +24,8 @@ public class WalletManageVo extends WalletManageEntity implements BaseUserInterf
|
||||
|
||||
private String walletTypeIcon;
|
||||
|
||||
private String isRule;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletTypeVo extends WalletTypeEntity {
|
||||
|
||||
}
|
||||
+4
@@ -17,4 +17,8 @@ public interface BaseWalletTypeInterface {
|
||||
String getWalletTypeIcon();
|
||||
|
||||
void setWalletTypeIcon(String walletTypeIcon);
|
||||
|
||||
String getIsRule();
|
||||
|
||||
void setIsRule(String isRule);
|
||||
}
|
||||
+2
@@ -19,6 +19,8 @@ public class WalletRechargeApplyVo extends WalletRechargeApplyEntity implements
|
||||
|
||||
private String walletTypeIcon;
|
||||
|
||||
private String isRule;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
|
||||
+2
@@ -57,6 +57,8 @@ public class WalletRechargeImportVo extends WalletRechargeImportEntity implement
|
||||
|
||||
private String importTimeStr;
|
||||
|
||||
private String isRule;
|
||||
|
||||
/**
|
||||
* 导出相关
|
||||
*/
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.rule;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletRuleJoinUserConfigVo {
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
private Long userDpetId;
|
||||
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
/**
|
||||
* 源钱包相关
|
||||
*/
|
||||
private Long sourceWalletId;
|
||||
|
||||
private Integer sourceWalletBalance = 0;
|
||||
|
||||
private Long sourceWalletTypeId;
|
||||
|
||||
private String sourceWalletTypeName;
|
||||
|
||||
/**
|
||||
* 目标钱包相关
|
||||
*/
|
||||
private Long targetWalletId;
|
||||
|
||||
private Integer targetWalletBalance = 0;
|
||||
|
||||
private Long targetWalletTypeId;
|
||||
|
||||
private String targetWalletTypeName;
|
||||
|
||||
/**
|
||||
* 可以转账的余额
|
||||
*/
|
||||
private Integer changeTransferBalance = 0;
|
||||
|
||||
/**
|
||||
* 总充值余额
|
||||
*/
|
||||
private Long totalTopUpBalance = 0L;
|
||||
|
||||
/**
|
||||
* 总的转账余额
|
||||
*/
|
||||
private Long totalTransferBalance = 0L;
|
||||
|
||||
}
|
||||
+9
-1
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.rule;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -11,7 +12,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class WalletRuleJoinVo extends WalletRuleJoinEntity {
|
||||
public class WalletRuleJoinVo extends WalletRuleJoinEntity implements BaseDeptInterface {
|
||||
|
||||
/**
|
||||
* 源钱包类型
|
||||
@@ -30,4 +31,11 @@ public class WalletRuleJoinVo extends WalletRuleJoinEntity {
|
||||
private String targetUniqueCode;
|
||||
|
||||
private String targetIcon;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
private String deptName;
|
||||
}
|
||||
+2
@@ -71,6 +71,8 @@ public class WalletTransactionVo extends WalletTransactionEntity implements Base
|
||||
|
||||
private String walletTypeIcon;
|
||||
|
||||
private String isRule;
|
||||
|
||||
/**
|
||||
* 订单相关
|
||||
*/
|
||||
|
||||
+8
-1
@@ -150,7 +150,7 @@ public class WalletManageController {
|
||||
@GetMapping("/app/detail")
|
||||
public R appGetAll(@RequestParam Long walletId) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
return R.ok(walletManageService.join(user.getId(), walletId));
|
||||
return R.ok(walletManageService.join(walletId));
|
||||
}
|
||||
|
||||
@GetMapping("/app/get-qr-code")
|
||||
@@ -190,6 +190,13 @@ public class WalletManageController {
|
||||
return R.ok(walletManageService.getWallet(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/join/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_view')")
|
||||
public R<WalletManageVo> joinDetail(@PathVariable("id") Long id) {
|
||||
return R.ok(walletManageService.join(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增钱包管理", description = "新增钱包管理")
|
||||
@SysLog("新增钱包管理")
|
||||
@PostMapping
|
||||
|
||||
+5
-45
@@ -2,11 +2,13 @@ package com.bsd.pjcloud.wallet.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -37,40 +39,24 @@ public class WalletTypeController {
|
||||
|
||||
private final WalletTypeService walletTypeService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param walletType 钱包类型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_view')")
|
||||
public R getWalletTypePage(@ParameterObject Page page, @ParameterObject WalletTypeEntity walletType) {
|
||||
public R getWalletTypePage(@ParameterObject Page page, @ParameterObject WalletTypeDto dto) {
|
||||
LambdaQueryWrapper<WalletTypeEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.orderByDesc(WalletTypeEntity::getCreateTime);
|
||||
return R.ok(walletTypeService.page(page, wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询下拉
|
||||
*/
|
||||
@Operation(summary = "查询下拉", description = "查询下拉")
|
||||
@GetMapping("/select")
|
||||
public R<Page<WalletTypeEntity>> walletList(@ParameterObject Page page) {
|
||||
public R<Page<WalletTypeEntity>> walletList(@ParameterObject Page page, @ParameterObject WalletTypeDto dto) {
|
||||
LambdaQueryWrapper<WalletTypeEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.orderByDesc(WalletTypeEntity::getCreateTime);
|
||||
wrapper.notIn(ObjectUtil.isNotEmpty(dto.getNotWalletTypeIds()), WalletTypeEntity::getId, dto.getNotWalletTypeIds());
|
||||
return R.ok(walletTypeService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询钱包类型
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_view')")
|
||||
@@ -78,12 +64,6 @@ public class WalletTypeController {
|
||||
return R.ok(walletTypeService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钱包类型
|
||||
*
|
||||
* @param dto 钱包类型
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增钱包类型", description = "新增钱包类型")
|
||||
@SysLog("新增钱包类型")
|
||||
@PostMapping
|
||||
@@ -93,12 +73,6 @@ public class WalletTypeController {
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改钱包类型
|
||||
*
|
||||
* @param dto 钱包类型
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改钱包类型", description = "修改钱包类型")
|
||||
@SysLog("修改钱包类型")
|
||||
@PutMapping
|
||||
@@ -108,12 +82,6 @@ public class WalletTypeController {
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除钱包类型
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除钱包类型", description = "通过id删除钱包类型")
|
||||
@SysLog("通过id删除钱包类型")
|
||||
@DeleteMapping
|
||||
@@ -122,14 +90,6 @@ public class WalletTypeController {
|
||||
return R.ok(walletTypeService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
*
|
||||
* @param walletType 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_export')")
|
||||
|
||||
+11
-3
@@ -59,18 +59,26 @@ public class WalletRuleJoinController {
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("join-detail/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
|
||||
@GetMapping("/join-detail/{id}")
|
||||
// @PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
|
||||
public R joinDetail(@PathVariable("id") Long id) {
|
||||
return R.ok(walletRuleJoinService.joinDetail(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询用户转账配置", description = "查询用户转账配置")
|
||||
@GetMapping("/user-config")
|
||||
// @PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
|
||||
public R userConfig(@RequestParam Long userId, @RequestParam Long sourceWalletTypeId, @RequestParam Long targetWalletTypeId) {
|
||||
return R.ok(walletRuleJoinService.userConfig(userId, sourceWalletTypeId, targetWalletTypeId));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增钱包规则配置", description = "新增钱包规则配置")
|
||||
@SysLog("新增钱包规则配置")
|
||||
@PostMapping
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_add')")
|
||||
public R save(@RequestBody WalletRuleJoinDto dto) {
|
||||
return R.ok(walletRuleJoinService.create(dto));
|
||||
walletRuleJoinService.create(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "修改钱包规则配置", description = "修改钱包规则配置")
|
||||
|
||||
+1
@@ -71,6 +71,7 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
|
||||
.like(ObjectUtil.isNotEmpty(dto.getName()), MchManageEntity::getName, dto.getName())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getNotIds()), MchManageEntity::getId, dto.getNotIds())
|
||||
.orderByDesc(MchManageEntity::getSort)
|
||||
.orderByDesc(MchManageEntity::getDeptId)
|
||||
.orderByDesc(MchManageEntity::getCreateTime);
|
||||
|
||||
+2
@@ -106,5 +106,7 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
|
||||
@Param("dateTime") String monthTimeStr,
|
||||
@Param("userIdList") List<Long> userIdList);
|
||||
|
||||
WalletTransactionSumAndCountVo sumAndCountUser(@Param("dto") WalletTransactionSumAndCountDto dto);
|
||||
|
||||
List<WalletTransactionSumAndCountVo> sumAndCount(@Param("dto") WalletTransactionSumAndCountDto dto);
|
||||
}
|
||||
+3
-35
@@ -17,67 +17,42 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
|
||||
/**
|
||||
* 创建钱包
|
||||
*
|
||||
* @param userId
|
||||
* @param checkPermission
|
||||
*/
|
||||
void createWallet(@NotNull Long userId, @NotNull Boolean checkPermission);
|
||||
|
||||
/**
|
||||
* 创建钱包
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void createWallet(@NotNull Long userId);
|
||||
|
||||
/**
|
||||
* 获取钱包没有就创建用户钱包(没有缓存)
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
WalletManageEntity getOrCreateWallet(@NotNull Long userId, @NotNull WalletTypeEnum walletTypeCode);
|
||||
|
||||
/**
|
||||
* 获取钱包(没有缓存)
|
||||
*
|
||||
* @param userId
|
||||
* @param walletTypeCode
|
||||
* @return
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull Long userId, @NotNull WalletTypeEnum walletTypeCode);
|
||||
|
||||
|
||||
/**
|
||||
* 获取钱包(没有缓存)
|
||||
*
|
||||
* @param cardNumber
|
||||
* @return
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull String cardNumber);
|
||||
|
||||
|
||||
/**
|
||||
* 获取钱包(没有缓存)
|
||||
*
|
||||
* @param userId
|
||||
* @param walletTypeId
|
||||
* @return
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull Long userId, @NotNull Long walletTypeId);
|
||||
|
||||
/**
|
||||
* 获取钱包(有缓存)
|
||||
*
|
||||
* @param walletId
|
||||
* @return
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull Long walletId);
|
||||
|
||||
/**
|
||||
* 根据用户id删除用户钱包
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
Boolean delWalletByUserIds(List<@NotNull Long> userIds);
|
||||
|
||||
@@ -89,29 +64,22 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
|
||||
List<WalletManageVo> scopeQbList(WalletManageBalanceDto dto, DataScope dataScope);
|
||||
|
||||
WalletManageVo join(Long user, Long walletId);
|
||||
WalletManageVo join(Long walletId);
|
||||
|
||||
WalletManageVo join(Long user, Long walletTypeId);
|
||||
|
||||
/**
|
||||
* 生成钱包二维码参数
|
||||
*
|
||||
* @param walletId 钱包id
|
||||
*/
|
||||
String getQrCode(Long walletId);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
* @param response
|
||||
* @param dto
|
||||
*/
|
||||
void export(HttpServletResponse response, Page page, WalletManageDto dto);
|
||||
|
||||
/**
|
||||
* 钱包记录导出
|
||||
*
|
||||
* @param response
|
||||
* @param page
|
||||
* @param dto
|
||||
*/
|
||||
void exportQb(HttpServletResponse response, Page page, WalletManageBalanceDto dto);
|
||||
|
||||
|
||||
+7
-3
@@ -4,9 +4,8 @@ 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.rule.WalletRuleJoinDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinUserConfigVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -21,7 +20,7 @@ public interface WalletRuleJoinService extends IService<WalletRuleJoinEntity> {
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(WalletRuleJoinEntity dto);
|
||||
void create(WalletRuleJoinDto dto);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
@@ -37,4 +36,9 @@ public interface WalletRuleJoinService extends IService<WalletRuleJoinEntity> {
|
||||
* 复杂详情
|
||||
*/
|
||||
WalletRuleJoinVo joinDetail(Long id);
|
||||
|
||||
/**
|
||||
* 用户配置
|
||||
*/
|
||||
WalletRuleJoinUserConfigVo userConfig(Long userId, Long sourceWalletTypeId, Long targetWalletTypeId);
|
||||
}
|
||||
+23
-2
@@ -250,11 +250,11 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletManageVo join(Long userId, Long walletId) {
|
||||
public WalletManageVo join(Long walletId) {
|
||||
WalletManageVo detail = baseMapper.join(walletId);
|
||||
if (ObjectUtil.isNotEmpty(detail)) {
|
||||
// 用户
|
||||
UserInfo userInfo = userService.getByUserId(userId).getData();
|
||||
UserInfo userInfo = userService.getByUserId(detail.getUserId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(userInfo)) {
|
||||
DataUtil.convertUser(detail, userInfo.getSysUser());
|
||||
}
|
||||
@@ -262,6 +262,27 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletManageVo join(Long userId, Long walletTypeId) {
|
||||
WalletManageEntity detail = getWallet(userId, walletTypeId);
|
||||
if (ObjectUtil.isEmpty(detail)) return null;
|
||||
WalletManageVo result = BeanUtils.toBean(detail, WalletManageVo.class);
|
||||
if (ObjectUtil.isNotEmpty(detail)) {
|
||||
// 用户
|
||||
UserInfo userInfo = userService.getByUserId(detail.getUserId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(userInfo)) {
|
||||
DataUtil.convertUser(result, userInfo.getSysUser());
|
||||
}
|
||||
// 钱包类型
|
||||
WalletTypeEntity walletType = walletTypeService.getById(detail.getWalletTypeId());
|
||||
if (ObjectUtil.isNotEmpty(walletType)) {
|
||||
WalletDataUtil.convertWalletType(result, walletType);
|
||||
}
|
||||
detail.getWalletTypeId();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletManageVo> scopeQbPage(Page page, WalletManageBalanceDto dto, DataScope dataScope) {
|
||||
WalletManageDto walletDto = BeanUtils.toBean(dto, WalletManageDto.class);
|
||||
|
||||
+112
-10
@@ -4,12 +4,27 @@ 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.UserInfo;
|
||||
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;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
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.dto.WalletTransactionSumAndCountDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletTransactionSumAndCountVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinUserConfigVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleJoinMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRuleJoinService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,6 +33,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 钱包规则配置
|
||||
@@ -28,33 +45,45 @@ import java.util.ArrayList;
|
||||
@Service
|
||||
public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper, WalletRuleJoinEntity> implements WalletRuleJoinService {
|
||||
|
||||
private final WalletTransactionMapper walletTransactionMapper;
|
||||
|
||||
private final WalletTypeService walletTypeService;
|
||||
private final WalletManageService walletManageService;
|
||||
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 权限分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<WalletRuleJoinVo> scopeJoinPage(Page page, WalletRuleJoinDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopeJoinPage(page, dto, dataScope);
|
||||
Page<WalletRuleJoinVo> pageList = baseMapper.scopeJoinPage(page, dto, dataScope);
|
||||
disposeList(pageList.getRecords(), dto);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Long create(WalletRuleJoinEntity dto) {
|
||||
if (existWalletRuleJoin(dto)) {
|
||||
throw new RuntimeException("绑定类型不能重复");
|
||||
}
|
||||
public void create(WalletRuleJoinDto dto) {
|
||||
if (areWalletIdsDistinct(dto)) {
|
||||
throw new RuntimeException("源钱包类型与目标钱包类型不能重复");
|
||||
}
|
||||
WalletTypeEntity targetMch = walletTypeService.getById(dto.getTargetWalletTypeId());
|
||||
if (ObjectUtil.isEmpty(targetMch)) {
|
||||
throw new RuntimeException("目标钱包类型不存在");
|
||||
List<WalletRuleJoinEntity> saveList = new ArrayList<>();
|
||||
for (Long v : dto.getTargetDeptIdList()) {
|
||||
if (ObjectUtil.isEmpty(v)) continue;
|
||||
WalletRuleJoinEntity item = BeanUtils.toBean(dto, WalletRuleJoinEntity.class);
|
||||
item.setTargetDeptId(v);
|
||||
if (existWalletRuleJoin(dto)) {
|
||||
// 查询部门
|
||||
SysDept sysDept = remoteDeptService.getDeptByDeptId(v).getData();
|
||||
throw new RuntimeException(sysDept.getName() + "部门绑定类型不能重复");
|
||||
}
|
||||
saveList.add(item);
|
||||
}
|
||||
baseMapper.insert(dto);
|
||||
return dto.getId();
|
||||
baseMapper.insert(saveList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +122,68 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper,
|
||||
return baseMapper.joinDetail(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletRuleJoinUserConfigVo userConfig(Long userId, Long sourceWalletTypeId, Long targetWalletTypeId) {
|
||||
WalletRuleJoinUserConfigVo configVo = new WalletRuleJoinUserConfigVo();
|
||||
// 源钱包信息
|
||||
WalletManageVo sourceWallet = walletManageService.join(userId, sourceWalletTypeId);
|
||||
if (ObjectUtil.isEmpty(sourceWallet)) {
|
||||
throw new RuntimeException("源钱包不存在");
|
||||
}
|
||||
configVo.setSourceWalletId(sourceWallet.getId());
|
||||
configVo.setTargetWalletBalance(sourceWallet.getBalance());
|
||||
configVo.setSourceWalletTypeId(sourceWallet.getWalletTypeId());
|
||||
configVo.setSourceWalletTypeName(sourceWallet.getWalletTypeName());
|
||||
// 目标钱包信息
|
||||
WalletManageVo targetWallet = walletManageService.join(userId, targetWalletTypeId);
|
||||
if (ObjectUtil.isEmpty(targetWallet)) {
|
||||
throw new RuntimeException("目标钱包不存在");
|
||||
}
|
||||
configVo.setTargetWalletId(targetWallet.getId());
|
||||
configVo.setTargetWalletBalance(targetWallet.getBalance());
|
||||
configVo.setTargetWalletTypeId(targetWallet.getWalletTypeId());
|
||||
configVo.setTargetWalletTypeName(targetWallet.getWalletTypeName());
|
||||
// 查询用户充值的总充值余额
|
||||
WalletTransactionSumAndCountDto totalTopupDto = new WalletTransactionSumAndCountDto();
|
||||
totalTopupDto.setBizTypes(WalletBizEnum.getTopUpCodes());
|
||||
totalTopupDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
|
||||
totalTopupDto.setWalletTypeId(sourceWalletTypeId);
|
||||
WalletTransactionSumAndCountVo totalTopupVo = walletTransactionMapper.sumAndCountUser(totalTopupDto);
|
||||
if (ObjectUtil.isNotEmpty(totalTopupVo) && ObjectUtil.isNotEmpty(totalTopupVo.getSum())) {
|
||||
configVo.setTotalTopUpBalance(totalTopupVo.getSum());
|
||||
}
|
||||
// 查询总的转账余额
|
||||
WalletTransactionSumAndCountDto transferBalanceDto = new WalletTransactionSumAndCountDto();
|
||||
totalTopupDto.setBizTypes(List.of(WalletBizEnum.TRANSFER_ACCOUNTS.getCode()));
|
||||
totalTopupDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
|
||||
totalTopupDto.setWalletTypeId(targetWalletTypeId);
|
||||
WalletTransactionSumAndCountVo transferBalanceVo = walletTransactionMapper.sumAndCountUser(transferBalanceDto);
|
||||
if (ObjectUtil.isNotEmpty(transferBalanceVo)) {
|
||||
configVo.setTotalTransferBalance(transferBalanceVo.getSum());
|
||||
}
|
||||
// 转账百分比配置
|
||||
// 查询用户
|
||||
UserInfo userInfo = remoteUserService.getByUserId(sourceWallet.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) {
|
||||
throw new RuntimeException("用户不存在");
|
||||
}
|
||||
configVo.setUserId(userInfo.getSysUser().getUserId());
|
||||
configVo.setUserDpetId(userInfo.getSysUser().getDeptId());
|
||||
configVo.setUsername(userInfo.getSysUser().getName());
|
||||
configVo.setUserMobile(userInfo.getSysUser().getPhone());
|
||||
WalletRuleJoinEntity walletRuleJoin = baseMapper.selectOne(new LambdaQueryWrapper<WalletRuleJoinEntity>()
|
||||
.eq(WalletRuleJoinEntity::getSourceWalletTypeId, sourceWallet.getWalletTypeId())
|
||||
.eq(WalletRuleJoinEntity::getTargetWalletTypeId, targetWallet.getWalletTypeId())
|
||||
.eq(WalletRuleJoinEntity::getTargetDeptId, userInfo.getSysUser().getDeptId())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(walletRuleJoin)) {
|
||||
// 查询部门
|
||||
SysDept sysDept = remoteDeptService.getDeptByDeptId(userInfo.getSysUser().getDeptId()).getData();
|
||||
throw new RuntimeException("该用户所属的部门<" + sysDept.getName() + ">未配置钱包规则");
|
||||
}
|
||||
return configVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否重复
|
||||
*/
|
||||
@@ -118,4 +209,15 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper,
|
||||
}
|
||||
return ObjectUtil.equals(dto.getSourceWalletTypeId(), dto.getTargetWalletTypeId());
|
||||
}
|
||||
|
||||
private void disposeList(List<WalletRuleJoinVo> list, WalletRuleJoinDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 部门
|
||||
list.forEach(v -> v.setDeptId(v.getTargetDeptId()));
|
||||
List<Long> deptIds = list.stream().map(WalletRuleJoinVo::getTargetDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list, deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
-1
@@ -16,7 +16,6 @@
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="getTransactionPriceCount" resultType="java.lang.Integer">
|
||||
@@ -58,6 +57,9 @@
|
||||
from wallet_transaction a
|
||||
<where>
|
||||
a.del_flag = 0 and a.dept_id is not null
|
||||
<if test="dto.walletId != null">
|
||||
a.wallet_id = ${dto.walletId}
|
||||
</if>
|
||||
<if test="dto.walletTypeId != null">
|
||||
</if>
|
||||
<if test="dto.type != null">
|
||||
@@ -86,4 +88,45 @@
|
||||
</where>
|
||||
group by a.dept_id
|
||||
</select>
|
||||
|
||||
<select id="sumAndCountUser" resultType="com.bsd.pjcloud.wallet.api.vo.WalletTransactionSumAndCountVo">
|
||||
select a.dept_id,
|
||||
sum(a.price) as sum,
|
||||
count(0) as count
|
||||
from wallet_transaction a
|
||||
left join wallet_manage m on a.wallet_id = m.id
|
||||
left join wallet_type t on t.id = m.wallet_type_id
|
||||
<where>
|
||||
a.del_flag = 0 and a.dept_id is not null
|
||||
<if test="dto.walletId != null">
|
||||
and a.wallet_id = ${dto.walletId}
|
||||
</if>
|
||||
<if test="dto.walletTypeId != null">
|
||||
and m.wallet_type_id = ${dto.walletTypeId}
|
||||
</if>
|
||||
<if test="dto.type != null">
|
||||
<if test="dto.type == 1">
|
||||
and a.price > 0
|
||||
</if>
|
||||
<if test="dto.type == 2">
|
||||
and a.price < 0
|
||||
</if>
|
||||
</if>
|
||||
<if test="dto.bizTypes != null and dto.bizTypes.size() != 0">
|
||||
and a.biz_type in
|
||||
<foreach collection="dto.bizTypes" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
|
||||
and a.dept_id in
|
||||
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user