Commit 69b5f68e authored by wujipeng's avatar wujipeng
Browse files

解析数据增加用户数据录入

parent 470890de
......@@ -3,10 +3,16 @@ package com.platform.model.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@TableName("user_account")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserAccountEntity {
@TableId(value = "id", type = IdType.AUTO)
......
......@@ -3,10 +3,16 @@ package com.platform.model.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@TableName("user")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserEntity {
@TableId(value = "id",type = IdType.AUTO)
......
......@@ -3,13 +3,12 @@ package com.platform.service.impl;
import com.alibaba.fastjson.JSON;
import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.ExcelTemplateEntity;
import com.platform.model.entity.UserAccountEntity;
import com.platform.model.entity.UserEntity;
import com.platform.model.resp.Result;
import com.platform.model.vo.FileUploadVO;
import com.platform.model.vo.TableHeaderVO;
import com.platform.service.AnalysisService;
import com.platform.service.ExcelDataService;
import com.platform.service.ExcelTemplateService;
import com.platform.service.FileUploadService;
import com.platform.service.*;
import com.platform.utils.DateUtils;
import com.platform.utils.StringUtils;
import org.apache.commons.compress.utils.Lists;
......@@ -48,9 +47,12 @@ public class AnalysisServiceImpl implements AnalysisService {
private ExcelTemplateService excelTemplateService;
@Resource
private ExcelDataService excelDataService;
@Resource
private FileUploadService fileUploadService;
@Resource
private UserService userService;
@Resource
private UserAccountService userAccountService;
private static final String[] EXCEL_EXTENSIONS = {".xlsx", ".xls"};
......@@ -199,6 +201,16 @@ public class AnalysisServiceImpl implements AnalysisService {
ExcelDataEntity excelDataEntity = handleExcelData(tableHeaderList, row, folderName,fileId,caseId);
excelData.add(excelDataEntity);
}
if(StringUtils.isNotEmpty(folderName)){
String userName = trimChineseNameFromFilename(folderName);
userService.save(UserEntity.builder().userName(userName).build());
if(!excelData.isEmpty()){
List<String> paymentBankNames = excelData.stream().map(ExcelDataEntity::getPaymentBankName).distinct().collect(Collectors.toList());
userAccountService.saveBatch(paymentBankNames.stream().map(paymentBankName -> UserAccountEntity.builder().userName(userName).account(paymentBankName).build()).collect(Collectors.toList()));
}
}
//保存excel数据
excelDataService.saveBatch(excelData);
}
......
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