feat:删除部门用户、字部门判断
This commit is contained in:
1 parent
96fe841151
commit
efdd3ca31d
6 files changed
+32
-51
No files matched your search
+10
@@ -87,6 +87,16 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
public Boolean removeDeptById(Long id) {
|
||||
// 级联删除部门
|
||||
List<Long> idList = this.listDescendant(id).stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
if (idList.size() > 1) throw new RuntimeException("该部门下有子部门,无法删除");
|
||||
|
||||
for (Long v : idList) {
|
||||
// 查询该部门下的用户
|
||||
List<SysUser> userList = userMapper.selectList(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getDeptId, v));
|
||||
if (CollUtil.isNotEmpty(userList)) {
|
||||
SysDept sysDept = baseMapper.selectById(v);
|
||||
throw new RuntimeException("该部门<" + sysDept.getName() + ">下有" + userList.size() + "名用户,无法删除,请先删除该部门下的用户");
|
||||
}
|
||||
}
|
||||
|
||||
Optional.ofNullable(idList).filter(CollUtil::isNotEmpty).ifPresent(this::removeByIds);
|
||||
|
||||
|
||||
+6
-20
@@ -23,15 +23,10 @@ public class WalletRechargeApplyCompareVo extends HashMap<String, Object> {
|
||||
*/
|
||||
private String userMobile;
|
||||
|
||||
/**
|
||||
* 操作前的余额
|
||||
*/
|
||||
private Integer prenBalance;
|
||||
|
||||
/**
|
||||
* 扣减之后的余额
|
||||
*/
|
||||
private Integer discountBalance;
|
||||
private Integer afterBalance;
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
@@ -69,21 +64,12 @@ public class WalletRechargeApplyCompareVo extends HashMap<String, Object> {
|
||||
this.put("userMobile", userMobile);
|
||||
}
|
||||
|
||||
public Integer getPrenBalance() {
|
||||
return (Integer) this.get("prenBalance");
|
||||
public Integer getAfterBalance() {
|
||||
return (Integer) this.get("afterBalance");
|
||||
}
|
||||
|
||||
public void setPrenBalance(Integer prenBalance) {
|
||||
this.prenBalance = prenBalance;
|
||||
this.put("prenBalance", prenBalance);
|
||||
}
|
||||
|
||||
public Integer getDiscountBalance() {
|
||||
return (Integer) this.get("discountBalance");
|
||||
}
|
||||
|
||||
public void setDiscountBalance(Integer discountBalance) {
|
||||
this.discountBalance = discountBalance;
|
||||
this.put("discountBalance", discountBalance);
|
||||
public void setAfterBalance(Integer discountBalance) {
|
||||
this.afterBalance = discountBalance;
|
||||
this.put("afterBalance", discountBalance);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class WalletRechargeApplySelectCompareVo {
|
||||
@Schema(description = "当前月的金额")
|
||||
private Integer price;
|
||||
|
||||
@Schema(description = "总金额(加上倒入)")
|
||||
@Schema(description = "总金额(加上导入)")
|
||||
private Integer totalPrice;
|
||||
|
||||
@Schema(description = "充值月", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
-19
@@ -151,25 +151,6 @@ public class WalletRechargeApplyComposeServiceImpl implements WalletRechargeAppl
|
||||
}
|
||||
}
|
||||
|
||||
// 查询当前钱包余额
|
||||
WalletManageDto userWalletDto = new WalletManageDto();
|
||||
userWalletDto.setUserIds(userIdList);
|
||||
userWalletDto.setWalletTypeId(topUpApplyDetail.getWalletTypeId());
|
||||
List<WalletManageEntity> userWalletList = walletManageMapper.list(userWalletDto);
|
||||
if (ObjectUtil.isNotEmpty(userWalletList) && ObjectUtil.isNotEmpty(resultList)) {
|
||||
for (WalletRechargeApplyCompareVo i : resultList) {
|
||||
userWalletList.stream().filter(j -> ObjectUtil.equals(i.getUserId(), j.getUserId())).findFirst().ifPresent(j -> {
|
||||
i.setPrenBalance(j.getBalance());
|
||||
if (ObjectUtil.equals(topUpApplyDetail.getBizType(), WalletBizRechargeEnum.REDUCTION.getCode())) {
|
||||
Integer currentImportPrice = (Integer) i.get("currentImport_price");
|
||||
if (ObjectUtil.isNotEmpty(currentImportPrice)) {
|
||||
i.setDiscountBalance(j.getBalance() - currentImportPrice);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
resultVo.setRecords(resultList);
|
||||
List<String> tableListStr = new ArrayList<>();
|
||||
tableListStr.add(merge.get(0) + "(上个月总充值金额)");
|
||||
|
||||
+12
-10
@@ -198,17 +198,19 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
for (WalletRechargeImportEntity i : importList) {
|
||||
userWalletList.stream().filter(j -> ObjectUtil.equals(i.getUserId(), j.getUserId())).findFirst().ifPresent(wallet -> {
|
||||
int discountPrice = wallet.getBalance() - i.getPrice();
|
||||
// 查询用户名字
|
||||
UserVO userTarget = userList.stream().filter(j -> ObjectUtil.equals(i.getUserId(), j.getUserId())).findFirst().get();
|
||||
if (ObjectUtil.isEmpty(userTarget)) {
|
||||
errorMsg.append("用户id<").append(wallet.getUserId()).append(">");
|
||||
} else {
|
||||
errorMsg.append("用户名<").append(userTarget.getName()).append(">");
|
||||
if (discountPrice < 0) {
|
||||
// 查询用户名字
|
||||
UserVO userTarget = userList.stream().filter(j -> ObjectUtil.equals(i.getUserId(), j.getUserId())).findFirst().get();
|
||||
if (ObjectUtil.isEmpty(userTarget)) {
|
||||
errorMsg.append("用户id<").append(wallet.getUserId()).append(">");
|
||||
} else {
|
||||
errorMsg.append("用户名<").append(userTarget.getName()).append(">");
|
||||
}
|
||||
errorMsg.append("记账扣款失败,");
|
||||
errorMsg.append("操作前的金额<").append(wallet.getBalance() / 100).append(">,");
|
||||
errorMsg.append("记账扣款的金额<").append(i.getPrice() / 100).append(">,");
|
||||
errorMsg.append("记账扣款后的金额<").append(discountPrice / 100).append(">\n");
|
||||
}
|
||||
errorMsg.append("记账扣款失败,");
|
||||
errorMsg.append("操作前的金额<").append(wallet.getBalance() / 100).append(">,");
|
||||
errorMsg.append("记账扣款的金额<").append(i.getPrice() / 100).append(">,");
|
||||
errorMsg.append("记账扣款后的金额<").append(discountPrice / 100).append(">\n");
|
||||
});
|
||||
}
|
||||
String errorMsgString = errorMsg.toString();
|
||||
|
||||
+3
-1
@@ -40,7 +40,9 @@
|
||||
FROM wallet_transaction a
|
||||
INNER JOIN
|
||||
wallet_manage w ON w.id = a.wallet_id
|
||||
WHERE biz_type = #{bizType}
|
||||
WHERE
|
||||
a.del_flag = '0'
|
||||
and a.biz_type = #{bizType}
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m') = #{dateTime}
|
||||
and w.user_id in
|
||||
<foreach collection="userIdList" item="v" open="(" close=")" separator=",">
|
||||
|
||||
Reference in new issue
Block a user