Commit e6d9c144 authored by wujipeng's avatar wujipeng
Browse files

人与人关系弹框分页

parent 28ab0abf
...@@ -43,4 +43,10 @@ public class UserController extends BaseController { ...@@ -43,4 +43,10 @@ public class UserController extends BaseController {
startPage(userDTO.getPageNum(), userDTO.getPageSize()); startPage(userDTO.getPageNum(), userDTO.getPageSize());
return getDataTable((userService.cashFlow(userDTO))); return getDataTable((userService.cashFlow(userDTO)));
} }
@ApiModelProperty(value = "人与人关系弹框分页")
@PostMapping("/relation/page")
public Result relationPage(@RequestBody UserDTO userDTO) {
return Result.data(userService.relationPage(userDTO));
}
} }
...@@ -30,4 +30,6 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> { ...@@ -30,4 +30,6 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
List<ExcelDataEntity> cashFlow(UserDTO userDTO); List<ExcelDataEntity> cashFlow(UserDTO userDTO);
List<ExcelDataEntity> relationPage(@Param("oneselfAccountList") List<String> oneselfAccountList, @Param("otherAccountList") List<String> otherAccountList);
} }
...@@ -11,4 +11,6 @@ import java.util.List; ...@@ -11,4 +11,6 @@ import java.util.List;
public interface UserAccountMapper extends BaseMapper<UserAccountEntity> { public interface UserAccountMapper extends BaseMapper<UserAccountEntity> {
void saveUserBatch(@Param("userAccountList") List<UserAccountEntity> userAccountList); void saveUserBatch(@Param("userAccountList") List<UserAccountEntity> userAccountList);
List<String> queryUserAccountList(@Param("userName") String userName);
} }
...@@ -23,4 +23,10 @@ public class UserDTO extends UserEntity { ...@@ -23,4 +23,10 @@ public class UserDTO extends UserEntity {
@ApiModelProperty(value = "每页显示的数量", example = "10") @ApiModelProperty(value = "每页显示的数量", example = "10")
private Integer pageSize; private Integer pageSize;
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "对方id")
private String otherId;
} }
package com.platform.model.vo;
import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.UserRelationEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author : wujipeng
* @date : 2025/8/1 17:51
* @Version: 1.0
* @Desc : 描述信息
*/
@Data
public class EveryoneVO {
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "指认关系")
private List<UserRelationEntity> relation;
@ApiModelProperty(value = "交易次数")
private Integer tradeCount;
@ApiModelProperty(value = "交易总额")
private String tradeTotal;
@ApiModelProperty(value = "明细")
private List<ExcelDataEntity> details;
}
...@@ -54,4 +54,6 @@ public interface ExcelDataService extends IService<ExcelDataEntity> { ...@@ -54,4 +54,6 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List<AssociationVO> selectFinancialTransactions(String userName, String caseId); List<AssociationVO> selectFinancialTransactions(String userName, String caseId);
List<ExcelDataEntity> cashFlow(UserDTO userDTO); List<ExcelDataEntity> cashFlow(UserDTO userDTO);
List<ExcelDataEntity> relationPage(List<String> oneselfAccountList, List<String> otherAccountList);
} }
...@@ -11,4 +11,6 @@ public interface UserAccountService extends IService<UserAccountEntity> { ...@@ -11,4 +11,6 @@ public interface UserAccountService extends IService<UserAccountEntity> {
void deleteByUserName(String userName); void deleteByUserName(String userName);
void saveUserBatch(List<UserAccountEntity> userAccountList); void saveUserBatch(List<UserAccountEntity> userAccountList);
List<String> queryUserAccountList(String userName);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.platform.model.dto.UserDTO; import com.platform.model.dto.UserDTO;
import com.platform.model.entity.ExcelDataEntity; import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.UserEntity; import com.platform.model.entity.UserEntity;
import com.platform.model.vo.EveryoneVO;
import com.platform.model.vo.UserVO; import com.platform.model.vo.UserVO;
import java.util.List; import java.util.List;
...@@ -25,4 +26,6 @@ public interface UserService extends IService<UserEntity> { ...@@ -25,4 +26,6 @@ public interface UserService extends IService<UserEntity> {
* @return List<ExcelDataEntity> * @return List<ExcelDataEntity>
*/ */
List<ExcelDataEntity> cashFlow(UserDTO userDTO); List<ExcelDataEntity> cashFlow(UserDTO userDTO);
EveryoneVO relationPage(UserDTO userDTO);
} }
...@@ -76,4 +76,9 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData ...@@ -76,4 +76,9 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
public List<ExcelDataEntity> cashFlow(UserDTO userDTO) { public List<ExcelDataEntity> cashFlow(UserDTO userDTO) {
return baseMapper.cashFlow(userDTO); return baseMapper.cashFlow(userDTO);
} }
@Override
public List<ExcelDataEntity> relationPage(List<String> oneselfAccountList, List<String> otherAccountList) {
return baseMapper.relationPage(oneselfAccountList,otherAccountList);
}
} }
...@@ -27,4 +27,9 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountMapper, UserA ...@@ -27,4 +27,9 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountMapper, UserA
public void saveUserBatch(List<UserAccountEntity> userAccountList) { public void saveUserBatch(List<UserAccountEntity> userAccountList) {
baseMapper.saveUserBatch(userAccountList); baseMapper.saveUserBatch(userAccountList);
} }
@Override
public List<String> queryUserAccountList(String userName) {
return baseMapper.queryUserAccountList(userName);
}
} }
...@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil; ...@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.platform.exception.BusinessException;
import com.platform.mapper.UserMapper; import com.platform.mapper.UserMapper;
import com.platform.model.dto.UserDTO; import com.platform.model.dto.UserDTO;
import com.platform.model.entity.ExcelDataEntity; import com.platform.model.entity.ExcelDataEntity;
...@@ -13,6 +15,7 @@ import com.platform.model.entity.UserAccountEntity; ...@@ -13,6 +15,7 @@ import com.platform.model.entity.UserAccountEntity;
import com.platform.model.entity.UserEntity; import com.platform.model.entity.UserEntity;
import com.platform.model.entity.UserRelationEntity; import com.platform.model.entity.UserRelationEntity;
import com.platform.model.vo.AssociationVO; import com.platform.model.vo.AssociationVO;
import com.platform.model.vo.EveryoneVO;
import com.platform.model.vo.UserVO; import com.platform.model.vo.UserVO;
import com.platform.service.ExcelDataService; import com.platform.service.ExcelDataService;
import com.platform.service.UserAccountService; import com.platform.service.UserAccountService;
...@@ -164,4 +167,34 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme ...@@ -164,4 +167,34 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
} }
return excelDataList; return excelDataList;
} }
@Override
public EveryoneVO relationPage(UserDTO userDTO) {
EveryoneVO everyoneVO = new EveryoneVO();
UserEntity oneself = getById(userDTO.getUserId());
UserEntity other = getById(userDTO.getOtherId());
if(ObjectUtils.isEmpty(oneself) || ObjectUtils.isEmpty(other)){
throw new BusinessException("用户不存在");
}
//标题
everyoneVO.setTitle(oneself.getUserName() + "," + other.getUserName());
//查询关系
List<UserRelationEntity> userRelation = userRelationService.list(new LambdaQueryWrapper<UserRelationEntity>()
.eq(UserRelationEntity::getUserId, userDTO.getUserId())
.eq(UserRelationEntity::getOtherId, userDTO.getOtherId()));
//指认关系
if(ObjectUtils.isEmpty(userRelation)){
everyoneVO.setRelation(userRelation);
}
//查询账户
List<String> oneselfAccountList = userAccountService.queryUserAccountList(oneself.getUserName());
List<String> otherAccountList = userAccountService.queryUserAccountList(oneself.getUserName());
PageHelper.startPage(userDTO.getPageNum(),userDTO.getPageSize());
List<ExcelDataEntity> details = excelDataService.relationPage(oneselfAccountList,otherAccountList);
everyoneVO.setDetails(details);
PageHelper.clearPage();
return everyoneVO;
}
} }
...@@ -106,4 +106,9 @@ ...@@ -106,4 +106,9 @@
payment_account = #{otherUserName} payment_account = #{otherUserName}
) )
</select> </select>
<select id="relationPage" resultType="com.platform.model.entity.ExcelDataEntity">
select amount,time,payee_account,payment_account
from excel_data
where (payment_account in (#{oneselfAccountList}) and payment_account in (#{otherAccountList})) or (payment_account in (#{otherAccountList}) and payment_account in (#{oneselfAccountList}))
</select>
</mapper> </mapper>
...@@ -9,4 +9,15 @@ ...@@ -9,4 +9,15 @@
(#{item.userName}, #{item.account}, #{item.caseId}) (#{item.userName}, #{item.account}, #{item.caseId})
</foreach> </foreach>
</insert> </insert>
<select id="queryUserAccountList" resultType="java.lang.String">
SELECT DISTINCT
CASE
WHEN direction = '出账' THEN payment_account
WHEN direction = '入账' THEN payee_account
ELSE NULL
END AS account
FROM excel_data
WHERE direction IN ('出账', '入账')
and pay_user_name = #{userName}
</select>
</mapper> </mapper>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment