Commit a6575947 authored by wujipeng's avatar wujipeng
Browse files

人与人关系弹框分页-优化

parent e8a7d940
...@@ -30,4 +30,7 @@ public class EveryoneVO { ...@@ -30,4 +30,7 @@ public class EveryoneVO {
@ApiModelProperty(value = "明细") @ApiModelProperty(value = "明细")
private List<ExcelDataEntity> details; private List<ExcelDataEntity> details;
@ApiModelProperty(value = "汇总文字")
private List<String> totalDescription;
} }
...@@ -2,7 +2,6 @@ package com.platform.service.impl; ...@@ -2,7 +2,6 @@ package com.platform.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.annotation.TableField;
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.github.pagehelper.PageHelper;
...@@ -27,7 +26,6 @@ import com.platform.service.UserRelationService; ...@@ -27,7 +26,6 @@ import com.platform.service.UserRelationService;
import com.platform.service.UserService; import com.platform.service.UserService;
import com.platform.utils.DozerUtils; import com.platform.utils.DozerUtils;
import com.platform.utils.IdCardUtils; import com.platform.utils.IdCardUtils;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -242,13 +240,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme ...@@ -242,13 +240,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
@Override @Override
public EveryoneVO relationPage(UserDTO userDTO) { public EveryoneVO relationPage(UserDTO userDTO) {
EveryoneVO everyoneVO = new EveryoneVO(); EveryoneVO everyoneVO = new EveryoneVO();
UserEntity oneself = getOne(new LambdaQueryWrapper<UserEntity>()
.eq(UserEntity::getUserName, userDTO.getUserName()).eq(UserEntity::getCaseId, userDTO.getCaseId()), false);
// UserEntity other = getOne(new LambdaQueryWrapper<UserEntity>()
// .eq(UserEntity::getUserName, userDTO.getOtherName()).eq(UserEntity::getCaseId, userDTO.getCaseId()), false);
// if (ObjectUtils.isEmpty(oneself) || ObjectUtils.isEmpty(other)) {
// throw new BusinessException("用户不存在");
// }
//标题 //标题
everyoneVO.setTitle(userDTO.getUserName() + "," + userDTO.getOtherName()); everyoneVO.setTitle(userDTO.getUserName() + "," + userDTO.getOtherName());
//查询关系 //查询关系
...@@ -263,11 +254,39 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme ...@@ -263,11 +254,39 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
PageHelper.startPage(userDTO.getPageNum(), userDTO.getPageSize()); PageHelper.startPage(userDTO.getPageNum(), userDTO.getPageSize());
List<ExcelDataEntity> details = Lists.newArrayList();
if (!ObjectUtils.isEmpty(oneselfAccountList) && !ObjectUtils.isEmpty(otherAccountList)) { if (!ObjectUtils.isEmpty(oneselfAccountList) && !ObjectUtils.isEmpty(otherAccountList)) {
List<ExcelDataEntity> details = excelDataService.relationPage(oneselfAccountList, otherAccountList); details = excelDataService.relationPage(oneselfAccountList, otherAccountList);
everyoneVO.setDetails(details); everyoneVO.setDetails(details);
} }
PageHelper.clearPage(); PageHelper.clearPage();
//汇总文字
List<String> totalDescription = Lists.newArrayList();
//入账次数
int inCount = 0;
//入账合计
double inTotal = 0;
//出账次数
int outCount = 0;
//出账合计
double outTotal = 0;
if (!details.isEmpty()) {
for (ExcelDataEntity detail : details) {
if ("入账".equals(detail.getDirection())) {
inCount++;
inTotal += detail.getAmount();
} else if ("出账".equals(detail.getDirection())) {
outCount++;
outTotal += detail.getAmount();
}
}
totalDescription.add(userDTO.getUserName() + "向" + userDTO.getOtherName() + "转账" + outCount + "次,合计" + outTotal + "元;");
totalDescription.add(userDTO.getOtherName() + "向" + userDTO.getUserName() + "转账" + inCount + "次,合计" + inTotal + "元;");
} else {
totalDescription.add(userDTO.getUserName() + "向" + userDTO.getOtherName() + "转账0次,合计0元;");
totalDescription.add(userDTO.getOtherName() + "向" + userDTO.getUserName() + "转账0次,合计0元;");
}
everyoneVO.setTotalDescription(totalDescription);
return everyoneVO; return everyoneVO;
} }
......
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