feat:财务报表优化树形搜索

This commit is contained in:
dzc committed 2025-02-27 20:16:54 +08:00
1 parent 3f41fbf1fa
commit dd1991fead
25 files changed
+236 -178

No files matched your search

@@ -1,5 +1,6 @@
package com.bsd.pjcloud.hard.api.dto.order;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -7,7 +8,7 @@ import java.time.LocalDateTime;
import java.util.List;
@Data
public class HardDeptTotalDto {
public class HardDeptTotalDto implements BaseIsIncludeTreeInterface {
@Schema(description = "饭卡类型id")
private Long walletTypeId;
@@ -18,10 +19,13 @@ public class HardDeptTotalDto {
@Schema(description = "部门id")
private Long deptId;
@Schema(description = "是否深度搜索deptId")
@Schema(description = "是否深度搜索deptIds")
private Boolean isDeepDept;
@Schema(description = "部门ids")
private List<Long> deptIds;
@Schema(description = "是否包含deptIds")
private Boolean isInclude = false;
}
@@ -1,5 +1,6 @@
package com.bsd.pjcloud.hard.api.dto.order;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
import lombok.Data;
@@ -8,7 +9,7 @@ import java.time.LocalDateTime;
import java.util.List;
@Data
public class HardOrderDto extends HardOrderEntity {
public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeInterface {
/**
* 订单部门id极其子部门id
@@ -17,7 +18,7 @@ public class HardOrderDto extends HardOrderEntity {
private List<Long> deptIds;
private Boolean isDeepDept = false;
private Boolean isInclude = false;
private List<Long> userIds;
@@ -52,16 +52,6 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
@Override
public Page<HardOrderSbVo> pageListSb(Page page, HardOrderDto dto) {
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> deptList = remoteDeptService.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<HardOrderSbVo> list = hardOrderMapper.pageListSb(page, dto);
if (ObjectUtil.isNotEmpty(list)) {
// 商户
@@ -88,16 +78,6 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
@Override
public List<HardOrderSbVo> listSb(HardOrderDto dto) {
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> deptList = remoteDeptService.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<HardOrderSbVo> list = hardOrderMapper.listSb(dto);
if (ObjectUtil.isNotEmpty(list)) {
// 商户
@@ -124,16 +104,6 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
@Override
public Page<HardOrderCsVo> pageListCs(Page page, HardOrderDto dto) {
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> deptList = remoteDeptService.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<HardOrderCsVo> list = hardOrderMapper.pageListCs(page, dto);
if (ObjectUtil.isNotEmpty(list)) {
// 商户
@@ -150,16 +120,6 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
@Override
public List<HardOrderCsVo> listCs(HardOrderDto dto) {
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> deptList = remoteDeptService.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<HardOrderCsVo> list = hardOrderMapper.listCs(dto);
if (ObjectUtil.isNotEmpty(list)) {
// 商户
@@ -177,15 +137,9 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
@Override
public List<HardDeptTotalVo> pageListDept(HardDeptTotalDto dto) {
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> deptList = remoteDeptService.getDescendantList(dto.getDeptId()).getData();
dto.setDeptId(null);
if (ObjectUtil.isNotEmpty(deptList)) {
dto.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
}
}
CompletableFuture<List<SysDept>> deptFuture = CompletableFuture.supplyAsync(() -> {
DeptAllListDto deptDto = new DeptAllListDto();
deptDto.setIsInclude(dto.getIsInclude());
if (ObjectUtil.isNotEmpty(dto.getDeptId())) {
deptDto.setDeptId(dto.getDeptId());
}
@@ -81,7 +81,17 @@
and a.dept_id = #{dto.deptId}
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
and a.dept_id in
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and a.dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and a.dept_id NOT IN
</when>
<otherwise>
and a.dept_id IN
</otherwise>
</choose>
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
@@ -5,10 +5,12 @@ import lombok.Data;
import java.util.List;
@Data
public class DeptAllListDto {
public class DeptAllListDto {
private Long deptId;
private List<Long> deptIds;
private Boolean isInclude;
}
@@ -20,6 +20,7 @@
package com.bsd.pjcloud.admin.api.dto;
import com.bsd.pjcloud.admin.api.entity.SysUser;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -34,7 +35,7 @@ import java.util.List;
@Data
@Schema(description = "系统用户传输对象")
@EqualsAndHashCode(callSuper = true)
public class UserDTO extends SysUser {
public class UserDTO extends SysUser implements BaseIsIncludeTreeInterface {
/**
* 角色ID
@@ -72,11 +73,13 @@ public class UserDTO extends SysUser {
private List<Long> userIds;
/**
* false 当前部门
* true 当前部门及子部门
* 部门ids
*/
private Boolean isDeepDept = false;
private List<Long> deptIds;
/**
* 是否包含部门ids
*/
private Boolean isInclude;
}
@@ -7,10 +7,7 @@ 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.admin.api.vo.base.*;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import lombok.experimental.UtilityClass;
@@ -0,0 +1,27 @@
package com.bsd.pjcloud.admin.api.vo.base;
import java.util.List;
public interface BaseIsDeepDeptTreeInterface {
/**
* 部门ids
*/
List<Long> getDeptIds();
void setDeptIds(List<Long> deptIds);
/**
* 部门id
*/
Long getDeptId();
void setDeptId(Long deptId);
/**
* 是否深度搜索deptIds
* @return
*/
Boolean getIsDeepDept();
void setIsDeepDept(Boolean isDeepDept);
}
@@ -0,0 +1,20 @@
package com.bsd.pjcloud.admin.api.vo.base;
import java.util.List;
public interface BaseIsIncludeTreeInterface {
/**
* 是否包含部门ids
*/
Boolean getIsInclude();
void setIsInclude(Boolean isInclude);
/**
* 部门ids
*/
List<Long> getDeptIds();
void setDeptIds(List<Long> deptIds);
}
@@ -220,17 +220,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
*/
@Override
public IPage getUsersWithRolePage(Page page, UserDTO userDTO) {
// 部门
if (ObjectUtil.isNotEmpty(userDTO.getIsDeepDept()) && userDTO.getIsDeepDept() && ObjectUtil.isNotEmpty(userDTO.getDeptId())) {
List<SysDept> 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);
}
IPage<UserVO> list = baseMapper.getUserVosPage(page, userDTO, DataScope.of());
if (ObjectUtil.isNotEmpty(list.getRecords())) {
List<Long> userIds = list.getRecords().stream().map(UserVO::getUserId).distinct().toList();
@@ -367,17 +356,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
*/
@Override
public List<UserExcelVO> listUser(UserDTO userDTO, Long[] ids) {
// 部门
if (ObjectUtil.isNotEmpty(userDTO.getIsDeepDept()) && userDTO.getIsDeepDept() && ObjectUtil.isNotEmpty(userDTO.getDeptId())) {
List<SysDept> 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<UserVO> voList = baseMapper.selectVoListByScope(userDTO, ids, DataScope.of());
// 转换成execl 对象输出
@@ -51,7 +51,17 @@
AND a.dept_id = #{dto.deptId}
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
and a.dept_id IN
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and a.dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and a.dept_id NOT IN
</when>
<otherwise>
and a.dept_id IN
</otherwise>
</choose>
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
@@ -182,7 +182,17 @@
AND u.dept_id = #{query.deptId}
</if>
<if test="query.deptIds != null and query.deptIds.size() != 0">
and u.dept_id IN
<choose>
<when test="query.isInclude != null and query.isInclude == true">
and u.dept_id IN
</when>
<when test="query.isInclude != null and query.isInclude == false">
and u.dept_id NOT IN
</when>
<otherwise>
and u.dept_id IN
</otherwise>
</choose>
<foreach collection="query.deptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
@@ -248,7 +258,17 @@
AND u.dept_id = #{query.deptId}
</if>
<if test="query.deptIds != null and query.deptIds.size() != 0">
AND u.dept_id in
<choose>
<when test="query.isInclude != null and query.isInclude == true">
and u.dept_id IN
</when>
<when test="query.isInclude != null and query.isInclude == false">
and u.dept_id NOT IN
</when>
<otherwise>
and u.dept_id IN
</otherwise>
</choose>
<foreach collection="query.deptIds" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
@@ -1,5 +1,6 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import lombok.Data;
@@ -8,7 +9,7 @@ import java.time.LocalDateTime;
import java.util.List;
@Data
public class WalletManageDto extends WalletManageEntity {
public class WalletManageDto extends WalletManageEntity implements BaseIsIncludeTreeInterface {
private List<Long> userIds;
@@ -16,14 +17,14 @@ public class WalletManageDto extends WalletManageEntity {
private LocalDateTime[] createTimeList;
/**
* 是否深度搜索deptId
*/
private Boolean isDeepDept;
/**
* 部门ids
*/
private List<Long> deptIds;
/**
* 是否深度搜索deptId
*/
private Boolean isInclude;
}
@@ -1,5 +1,6 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -8,7 +9,7 @@ import java.time.LocalDate;
import java.util.List;
@Data
public class WalletTransactionDto extends WalletTransactionEntity {
public class WalletTransactionDto extends WalletTransactionEntity implements BaseIsIncludeTreeInterface {
/**
* 类型 - 收入
@@ -40,14 +41,14 @@ public class WalletTransactionDto extends WalletTransactionEntity {
*/
private Boolean isFindOrder = false;
/**
* 是否深度搜索deptId
*/
private Boolean isDeepDept;
/**
* 部门ids
*/
private List<Long> deptIds;
/**
* 是否包含部门ids
*/
private Boolean isInclude;
}
@@ -1,5 +1,6 @@
package com.bsd.pjcloud.wallet.api.dto.recharge;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity;
import lombok.Data;
@@ -7,7 +8,7 @@ import java.time.LocalDateTime;
import java.util.List;
@Data
public class WalletRechargeImportDto extends WalletRechargeImportEntity {
public class WalletRechargeImportDto extends WalletRechargeImportEntity implements BaseIsIncludeTreeInterface {
private String processStatus;
@@ -19,16 +20,22 @@ public class WalletRechargeImportDto extends WalletRechargeImportEntity {
private Long userDeptId;
/**
* 是否深度搜索deptId
*/
private Boolean isDeepDept;
/**
* 部门ids
*/
private List<Long> userDeptIds;
/**
* 没有使用
*/
private List<Long> deptIds;
/**
* 是否包含部门ids
*/
private Boolean isInclude;
private LocalDateTime[] createTimeList;
private LocalDateTime[] processTimeList;
@@ -1,6 +1,5 @@
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;
@@ -22,7 +21,6 @@ import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
import com.bsd.pjcloud.wallet.service.WalletManageService;
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;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
@@ -181,6 +179,13 @@ public class WalletManageController {
return R.ok(walletManageService.removeBatchByIds(CollUtil.toList(ids)));
}
@Operation(summary = "钱包记录分页", description = "钱包记录分页")
@PostMapping("/page-qb")
public R pageQb(@ParameterObject Page page, @RequestBody WalletManageDto dto) {
DataScope dataScope = new DataScope();
return R.ok(walletManageService.scopeQbPageList(page, dto, dataScope));
}
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_walletManage_export')")
public void export(HttpServletResponse response, @ParameterObject Page page, @RequestBody WalletManageDto dto) {
@@ -96,7 +96,6 @@ public class WalletTransactionController {
@PostMapping("/page-cz")
public R pageCz(@ParameterObject Page page, @RequestBody WalletTransactionDto dto) {
dto.setBizTypes(WalletBizEnum.getTopUpCodes());
// dto.setType(WalletTransactionDto.TYPE_INCOME);
DataScope dataScope = new DataScope();
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
}
@@ -110,7 +110,6 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
.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,
@@ -118,6 +117,15 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
)
.orderByDesc(WalletManageEntity::getCreateTime);
if (ObjectUtil.isNotEmpty(dto.getIsInclude())) {
if (dto.getIsInclude()) {
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds());
} else {
wrapper.notIn(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds());
}
} else {
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds());
}
Page list = selectPageByScope(page, wrapper, dataScope);
list.setRecords(BeanUtils.toBean(list.getRecords(), WalletManageVo.class));
return list;
@@ -131,7 +139,6 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
.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,
@@ -139,6 +146,15 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
)
.orderByDesc(WalletManageEntity::getCreateTime);
if (ObjectUtil.isNotEmpty(dto.getIsInclude())) {
if (dto.getIsInclude()) {
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds());
} else {
wrapper.notIn(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds());
}
} else {
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletManageEntity::getDeptId, dto.getDeptIds());
}
List<WalletManageEntity> list = selectListByScope(wrapper, dataScope);
return BeanUtils.toBean(list, WalletManageVo.class);
}
@@ -31,7 +31,6 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
.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()),
@@ -40,6 +39,15 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
)
.orderByDesc(WalletTransactionEntity::getCreateTime);
if (ObjectUtil.isNotEmpty(dto.getIsInclude())) {
if(dto.getIsInclude()){
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds());
}else{
wrapper.notIn(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds());
}
} else {
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds());
}
if (ObjectUtil.equals(dto.getType(), WalletTransactionDto.TYPE_INCOME)) {
wrapper.gt(WalletTransactionEntity::getPrice, 0);
} else if (Objects.equals(dto.getType(), WalletTransactionDto.TYPE_EXPENSE)) {
@@ -57,7 +65,6 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
.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()),
@@ -66,6 +73,15 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
)
.orderByDesc(WalletTransactionEntity::getCreateTime);
if (ObjectUtil.isNotEmpty(dto.getIsInclude())) {
if(dto.getIsInclude()){
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds());
}else{
wrapper.notIn(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds());
}
} else {
wrapper.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletTransactionEntity::getDeptId, dto.getDeptIds());
}
if (ObjectUtil.equals(dto.getType(), WalletTransactionDto.TYPE_INCOME)) {
wrapper.gt(WalletTransactionEntity::getPrice, 0);
} else if (Objects.equals(dto.getType(), WalletTransactionDto.TYPE_EXPENSE)) {
@@ -82,6 +82,8 @@ public interface WalletManageService extends IService<WalletManageEntity> {
Page<WalletManageVo> scopePageList(Page page, WalletManageDto dto, DataScope dataScope);
Page<WalletManageVo> scopeQbPageList(Page page, WalletManageDto dto, DataScope dataScope);
List<WalletManageVo> scopeList(WalletManageDto dto, DataScope dataScope);
WalletManageVo join(Long user, Long walletId);
@@ -219,17 +219,6 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
@Override
public List<WalletManageVo> scopeList(WalletManageDto dto, DataScope dataScope) {
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> 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<WalletManageVo> list = baseMapper.scopeList(dto, dataScope);
disposeList(list, dto);
return list;
@@ -237,17 +226,6 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
@Override
public Page<WalletManageVo> scopePageList(Page page, WalletManageDto dto, DataScope dataScope) {
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> 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<WalletManageVo> list = baseMapper.scopePageList(page, dto, dataScope);
disposeList(list.getRecords(), dto);
return list;
@@ -266,6 +244,11 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
return detail;
}
@Override
public Page<WalletManageVo> scopeQbPageList(Page page, WalletManageDto dto, DataScope dataScope) {
return null;
}
@Override
public void export(HttpServletResponse response, Page page, WalletManageDto dto) {
String fileName = "file/账户余额.xlsx";
@@ -165,17 +165,6 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
@Override
public Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto, DataScope dataScope) {
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> 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<WalletTransactionVo> list = baseMapper.scopePageList(page, dto, dataScope);
disposeList(list.getRecords(), dto);
return list;
@@ -183,17 +172,6 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
@Override
public List<WalletTransactionVo> scopeList(WalletTransactionDto dto, DataScope dataScope) {
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> 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<WalletTransactionVo> list = baseMapper.scopeList(dto, dataScope);
disposeList(list, dto);
return list;
@@ -94,17 +94,6 @@ public class WalletRechargeImportServiceImpl extends ServiceImpl<WalletRechargeI
@Override
public Page<WalletRechargeImportVo> scopePageList(Page page, WalletRechargeImportDto dto, DataScope dataScope) {
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getUserDeptId())) {
List<SysDept> 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<WalletRechargeImportVo> list = baseMapper.scopePageList(page, dto, dataScope);
disposeList(list.getRecords(), dto);
return list;
@@ -112,17 +101,6 @@ public class WalletRechargeImportServiceImpl extends ServiceImpl<WalletRechargeI
@Override
public List<WalletRechargeImportVo> scopeList(WalletRechargeImportDto dto, DataScope dataScope) {
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getUserDeptId())) {
List<SysDept> 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<WalletRechargeImportVo> list = baseMapper.scopeList(dto, dataScope);
disposeList(list, dto);
return list;
@@ -0,0 +1,36 @@
package com.bsd.pjcloud.wallet.utils.dept;
import cn.hutool.core.util.ObjectUtil;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsDeepDeptTreeInterface;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
@Component
@RequiredArgsConstructor
public class DeptUtil {
private final RemoteDeptService deptService;
public <T extends BaseIsIncludeTreeInterface> void disposeIsIncludeTreeDto(T dto) {
if (ObjectUtil.isEmpty(dto)) return;
}
public <T extends BaseIsDeepDeptTreeInterface> void disposeIsDeepDeptTreeDto(T dto) {
if (ObjectUtil.isEmpty(dto)) return;
// 查询部门
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> deptList = deptService.getDescendantList(dto.getDeptId()).getData();
dto.setDeptId(null);
if (ObjectUtil.isNotEmpty(deptList)) {
dto.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
}
}
}
}
@@ -50,7 +50,17 @@
</foreach>
</if>
<if test="dto.userDeptIds != null and dto.userDeptIds.size() != 0">
and a.user_dept_id in
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and a.user_dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and a.user_dept_id NOT IN
</when>
<otherwise>
and a.user_dept_id IN
</otherwise>
</choose>
<foreach collection="dto.userDeptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>