Commit bc7e75ba authored by zhuxiang's avatar zhuxiang
Browse files

增加查看商户关联的用户接口

parent f2662ffb
......@@ -28,7 +28,7 @@ public class AnalysisController {
@ApiOperation("解析画布边文件上传excel内容")
@PostMapping("/canvas")
public Result<?> canvas(@RequestParam(value = "files") List<MultipartFile> files,
@RequestParam(value = "caseId") String caseId,
@RequestParam(value = "caseId") int caseId,
@RequestParam(value = "folderName", required = false) String folderName) {
return analysisService.canvas(files,caseId,folderName);
}
......
package com.platform.controller;
import com.platform.model.dto.NodeDTO;
import com.platform.page.TableDataInfo;
import com.platform.service.NodeService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/node")
public class NodeController extends BaseController {
@Resource
private NodeService nodeService;
@PostMapping("/mchRelationUser")
public TableDataInfo mchRelationUser(@RequestBody NodeDTO nodeDTO) {
startPage(nodeDTO.getPageNum(), nodeDTO.getPageSize());
return getDataTable(nodeService.mchRelationUser(nodeDTO));
}
}
package com.platform.model.dto;
import lombok.Data;
@Data
public class NodeDTO {
private String payeeName;
private int caseId;
private int pageNum;
private int pageSize;
}
......@@ -27,7 +27,7 @@ public class ExcelDataEntity {
@TableField("case_id")
@ApiModelProperty("案件id")
private String caseId;
private int caseId;
@TableField("directory_id")
@ApiModelProperty("目录id")
......
......@@ -22,7 +22,7 @@ public class UserAccountEntity {
@TableField("case_id")
@ApiModelProperty("案件id")
private String caseId;
private int caseId;
private String userName;
......
......@@ -24,7 +24,7 @@ public class UserEntity {
@TableField("case_id")
@ApiModelProperty("案件id")
private String caseId;
private int caseId;
private String userName;
......
......@@ -19,7 +19,7 @@ public interface AnalysisService {
* @param files
* @return
*/
Result<?> canvas(List<MultipartFile> files,String caseId,String folderName);
Result<?> canvas(List<MultipartFile> files,int caseId,String folderName);
/**
* 读取模板文件
......
......@@ -23,7 +23,7 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
* @param fileId
* @return
*/
List<ExcelDataEntity> queryListByFileId(String fileId, String caseId);
List<ExcelDataEntity> queryListByFileId(String fileId, int caseId);
/**
* @param fileId
......@@ -35,7 +35,7 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
* @param
* @return
*/
List<ExcelDataEntity> queryListByCaseIdAndPayUserName(String caseId, String payUserName);
List<ExcelDataEntity> queryListByCaseIdAndPayUserName(int caseId, String payUserName);
/**
* 查看案件所有的人员
......@@ -59,5 +59,5 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List<ExcelDataEntity> queryListByPayUserName(ExcelDataDTO excelDataDTO);
List<ExcelDataEntity> queryListByPayeeName(String oldName, String caseId);
List<ExcelDataEntity> queryListByPayeeName(String oldName, int caseId);
}
package com.platform.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.platform.model.dto.NodeDTO;
import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.NodeEntity;
import com.platform.model.vo.ExcelDataVO;
import com.platform.model.vo.NodeVO;
import java.util.List;
......@@ -10,4 +13,6 @@ public interface NodeService extends IService<NodeEntity> {
void saveData(Integer id, List<NodeVO> nodes);
List<NodeVO> queryByCaseId(Integer id);
List<NodeVO> mchRelationUser(NodeDTO nodeDTO);
}
......@@ -58,7 +58,7 @@ public class AnalysisServiceImpl implements AnalysisService {
@Override
@Transactional
public Result<?> canvas(List<MultipartFile> files, String caseId, String folderName) {
public Result<?> canvas(List<MultipartFile> files, int caseId, String folderName) {
//查询模板
// CasesEntity caseEntity = caseService.getById(caseId);
// String templateId = caseEntity.getTemplateId();
......@@ -166,7 +166,7 @@ public class AnalysisServiceImpl implements AnalysisService {
}
}
private ExcelDataEntity handleExcelData(List<TableHeaderVO> tableHeaderList, Row row, String folderName, String fileId, String caseId) {
private ExcelDataEntity handleExcelData(List<TableHeaderVO> tableHeaderList, Row row, String folderName, String fileId, int caseId) {
ExcelDataEntity excelDataEntity = new ExcelDataEntity();
trySetValue(() -> excelDataEntity.setType(getCellValueAsString(row.getCell(tableHeaderList.get(0).getIndex()))));
......@@ -268,7 +268,7 @@ public class AnalysisServiceImpl implements AnalysisService {
return false;
}
private void processSingleExcelFile(File excelFile, List<TableHeaderVO> tableHeaderList, String folderName, String fileId, String caseId, List<UserAccountEntity> userAccountList, Map<String, String> groupedMap) throws IOException {
private void processSingleExcelFile(File excelFile, List<TableHeaderVO> tableHeaderList, String folderName, String fileId, int caseId, List<UserAccountEntity> userAccountList, Map<String, String> groupedMap) throws IOException {
//读取第一个sheet
Sheet sheet = getWorkbook(excelFile).getSheetAt(0);
//获取sheet长度
......
......@@ -30,7 +30,7 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
}
@Override
public List<ExcelDataEntity> queryListByFileId(String fileId, String caseId) {
public List<ExcelDataEntity> queryListByFileId(String fileId, int caseId) {
return baseMapper.selectList(new LambdaQueryWrapper<ExcelDataEntity>()
.eq(ExcelDataEntity::getFileId, fileId)
.eq(ExcelDataEntity::getCaseId, caseId));
......@@ -47,7 +47,7 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
}
@Override
public List<ExcelDataEntity> queryListByCaseIdAndPayUserName(String caseId, String payUserName) {
public List<ExcelDataEntity> queryListByCaseIdAndPayUserName(int caseId, String payUserName) {
return baseMapper.selectList(new LambdaQueryWrapper<ExcelDataEntity>()
.eq(ExcelDataEntity::getCaseId, caseId)
.eq(ExcelDataEntity::getPayUserName, payUserName));
......@@ -101,7 +101,7 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
}
@Override
public List<ExcelDataEntity> queryListByPayeeName(String oldName, String caseId) {
public List<ExcelDataEntity> queryListByPayeeName(String oldName, int caseId) {
return baseMapper.selectList(new LambdaQueryWrapper<ExcelDataEntity>()
.eq(ExcelDataEntity::getCaseId, caseId)
.eq(ExcelDataEntity::getPayeeName, oldName));
......
......@@ -2,17 +2,31 @@ package com.platform.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Maps;
import com.platform.mapper.NodeMapper;
import com.platform.model.dto.NodeDTO;
import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.NodeEntity;
import com.platform.model.vo.ExcelDataVO;
import com.platform.model.vo.NodeVO;
import com.platform.service.ExcelDataService;
import com.platform.service.NodeService;
import com.platform.service.UserService;
import com.platform.utils.DozerUtils;
import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;
import java.util.*;
@Service
public class NodeServiceImpl extends ServiceImpl<NodeMapper, NodeEntity> implements NodeService {
@Resource
private UserService userService;
@Resource
private ExcelDataService excelDataService;
@Override
public void saveData(Integer id, List<NodeVO> nodes) {
List<NodeEntity> nodeEntityList = DozerUtils.convertList(nodes, NodeEntity.class);
......@@ -25,4 +39,55 @@ public class NodeServiceImpl extends ServiceImpl<NodeMapper, NodeEntity> impleme
return DozerUtils.convertList(baseMapper.selectList(new LambdaQueryWrapper<NodeEntity>()
.eq(NodeEntity::getCaseId, id)), NodeVO.class);
}
@Override
public List<NodeVO> mchRelationUser(NodeDTO nodeDTO) {
// 使用Set去重
Set<String> uniqueNodes = new HashSet<>();
List<ExcelDataEntity> excelDataEntityList = excelDataService.queryListByPayeeName(nodeDTO.getPayeeName(), nodeDTO.getCaseId());
Map<String, Integer> nodeDegreeMap = Maps.newHashMap();
excelDataEntityList.forEach(excelDataEntity -> {
String payer = excelDataEntity.getPayUserName();
// 添加节点
uniqueNodes.add(payer);
nodeDegreeMap.put(payer, nodeDegreeMap.getOrDefault(payer, 0) + 1);
});
//查看每个人的账号类型
List<String> userNameList = new ArrayList<>(uniqueNodes);
//查看每个人的账号标签
List<ExcelDataVO> excelDataEntityListNew = userService.queryUserLabel(userNameList, nodeDTO.getCaseId());
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)) {
dataVO.setNodeNum(value);
}
}
}
List<NodeVO> result = Lists.newArrayList();
excelDataEntityListNew.forEach(excelDataVO -> {
NodeVO org = new NodeVO();
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;
}
}
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