Commit 35344c1e authored by wujipeng's avatar wujipeng
Browse files

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/platform/service/impl/UserServiceImpl.java
parents 7bfe80fd f2662ffb
......@@ -2,8 +2,14 @@ package com.platform.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.platform.model.entity.UserEntity;
import com.platform.model.vo.ExcelDataVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface UserMapper extends BaseMapper<UserEntity> {
List<ExcelDataVO> queryUserLabel(@Param("userNameList") List<String> userNameList,
@Param("caseId") Integer id);
}
......@@ -6,6 +6,7 @@ import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.UserEntity;
import com.platform.model.entity.UserRelationEntity;
import com.platform.model.vo.EveryoneVO;
import com.platform.model.vo.ExcelDataVO;
import com.platform.model.vo.UserVO;
import java.util.List;
......@@ -37,4 +38,6 @@ public interface UserService extends IService<UserEntity> {
List<String> queryListByCaseId(Integer id);
Boolean relationSaveOrUpdate(List<UserRelationEntity> userRelationList);
List<ExcelDataVO> queryUserLabel(List<String> userNameList, Integer id);
}
......@@ -16,7 +16,6 @@ import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implements CasesService {
......@@ -437,25 +436,25 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
}
//查看每个人的账号类型
List<String> userNameList = new ArrayList<>(uniqueNodes);
List<ExcelDataVO> excelDataEntityListNew = excelDataService.queryListByPayUserList(userNameList, caseDTO.getId());
//根据用户名分组
List<ExcelDataVO> groupedObjects = excelDataEntityListNew.stream()
.collect(Collectors.groupingBy(ExcelDataVO::getPayUserName))
.values().stream()
.map(list -> list.get(0)) // 保留每组的第一个对象
.collect(Collectors.toList());
groupedObjects.forEach(excelDataVO -> {
//获取节点数量
int nodeNum = nodeDegreeMap.get(excelDataVO.getPayUserName());
excelDataVO.setNodeNum(nodeNum);
if (excelDataVO.getPayeeName().contains("公司")) {
excelDataVO.setAccountType("银联");
//查看每个人的账号标签
List<ExcelDataVO> excelDataEntityListNew = userService.queryUserLabel(userNameList, caseDTO.getId());
for (ExcelDataVO dataVO : excelDataEntityListNew) {
for (Map.Entry<String, Integer> entry : nodeDegreeMap.entrySet()) {
String key = entry.getKey();
Integer value = entry.getValue();
if (dataVO.getPayUserName().equals(key)) {
if (key.contains("公司")) {
dataVO.setAccountType("银联");
} else {
excelDataVO.setAccountType("个人");
dataVO.setAccountType("个人");
}
});
Iterator<ExcelDataVO> iterator = groupedObjects.iterator();
dataVO.setNodeNum(value);
}
}
}
Iterator<ExcelDataVO> iterator = excelDataEntityListNew.iterator();
while (iterator.hasNext()) {
ExcelDataVO excelDataVO = iterator.next();
if (caseDTO.getMinTransaction() != null && caseDTO.getMaxTransaction() != null) {
......@@ -469,22 +468,24 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
}
}
}
List<NodeVO> result = Lists.newArrayList();
groupedObjects.forEach(excelDataVO -> {
NodeVO person = new NodeVO();
person.setNode(excelDataVO.getPayUserName());
person.setNodeNum(excelDataVO.getNodeNum());
person.setLabel(excelDataVO.getLabel());
person.setNodeType("个人");
result.add(person);
excelDataEntityListNew.forEach(excelDataVO -> {
NodeVO org = new NodeVO();
if (excelDataVO.getPayeeName().contains("公司")) {
org.setNode(excelDataVO.getPayeeName());
if (excelDataVO.getAccountType().equals("银联")) {
org.setNode(excelDataVO.getPayUserName());
org.setNodeNum(excelDataVO.getNodeNum());
org.setBankCode(excelDataVO.getPayeeBankCard());
org.setNodeType("银联");
result.add(org);
}else{
NodeVO person = new NodeVO();
person.setNode(excelDataVO.getPayUserName());
person.setNodeNum(excelDataVO.getNodeNum());
person.setLabel(excelDataVO.getLabel());
person.setNodeType("个人");
result.add(person);
}
});
return result;
......
......@@ -27,8 +27,12 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
@Override
public List<GroupDetailEntity> queryList(GroupDetailDTO groupDetailDTO) {
return baseMapper.selectList(new LambdaQueryWrapper<GroupDetailEntity>()
List<GroupDetailEntity> groupDetailEntityList = baseMapper.selectList(new LambdaQueryWrapper<GroupDetailEntity>()
.eq(GroupDetailEntity::getGroupId, groupDetailDTO.getGroupId()));
// 安全移除元素
groupDetailEntityList.removeIf(groupDetailEntity -> groupDetailEntity.getUserName().contains("商户"));
return groupDetailEntityList;
}
@Override
......
......@@ -33,9 +33,11 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, GroupEntity> impl
GroupVO groupVO = groups.get(i);
GroupEntity groupEntity = new GroupEntity();
groupEntity.setGroupSize(groupVO.getGroupSize());
groupEntity.setGroupName("团体" + 1);
groupEntity.setGroupName("团体" + i);
groupEntity.setCaseId(id);
groupEntity.setTotalAmount(groupVO.getTotalAmount());
double totalAmount = groupVO.getTotalAmount();
double formattedAmount = Math.round(totalAmount * 100.0) / 100.0;
groupEntity.setTotalAmount(formattedAmount);
groupEntity.setTotalTransactions(groupVO.getTotalTransactions());
//入库
save(groupEntity);
......
......@@ -278,4 +278,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
public Boolean relationSaveOrUpdate(List<UserRelationEntity> userRelationList) {
return userRelationService.saveOrUpdateBatch(userRelationList);
}
@Override
public List<ExcelDataVO> queryUserLabel(List<String> userNameList, Integer id) {
return baseMapper.queryUserLabel(userNameList, id);
}
}
......@@ -4,9 +4,9 @@ server:
spring:
datasource:
username: root
password: xukang123
password: RZKJ_0415$
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://101.126.87.27:3306/relation?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
url: jdbc:mysql://47.110.71.183:3306/relation?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
servlet:
multipart:
......
......@@ -3,4 +3,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.platform.mapper.UserMapper">
<select id="queryUserLabel" resultType="com.platform.model.vo.ExcelDataVO">
SELECT
v.userName AS payUserName,
u.label
FROM
(
<foreach collection="userNameList" item="userName" separator="UNION ALL">
SELECT #{userName} AS userName
</foreach>
) AS v
LEFT JOIN
user u ON u.user_name = v.userName AND u.case_id = #{caseId}
</select>
</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