认证虚拟清单导入导出
This commit is contained in:
+5
-10
@@ -13,10 +13,8 @@ import com.jero.modules.authDummy.service.IAuthDummyInventoryInfoEOService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -58,6 +56,7 @@ public class AuthDummyInventoryInfoEOController extends JeroController<AuthDummy
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<AuthDummyInventoryInfoEO> queryWrapper = QueryGenerator.initQueryWrapper(authDummyInventoryInfoEO, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
Page<AuthDummyInventoryInfoEO> page = new Page<AuthDummyInventoryInfoEO>(pageNo, pageSize);
|
||||
IPage<AuthDummyInventoryInfoEO> pageList = this.authDummyInventoryInfoEOService.page(page, queryWrapper);
|
||||
this.authDummyInventoryInfoEOService.disposeData(pageList.getRecords(),authDummyInventoryInfoEO.getCut());
|
||||
@@ -169,8 +168,8 @@ public class AuthDummyInventoryInfoEOController extends JeroController<AuthDummy
|
||||
* @param authDummyInventoryInfoEO
|
||||
*/
|
||||
@ApiOperation(value="认证虚拟清单详情表-导出数据",notes="认证虚拟清单详情表-导出数据",produces = "application/octet-stream")
|
||||
@PostMapping(value = "/exportData")
|
||||
// @RequiresPermissions("authDummyInventoryInfoEO:exportData")
|
||||
@RequestMapping(value = "/exportData",method = RequestMethod.GET)
|
||||
// @Require@RequestMapping(value = "/exportData",method = RequestMethod.GET)sPermissions("authDummyInventoryInfoEO:exportData")
|
||||
public void exportData(HttpServletResponse response,
|
||||
HttpServletRequest request,
|
||||
AuthDummyInventoryInfoEO authDummyInventoryInfoEO) {
|
||||
@@ -182,15 +181,11 @@ public class AuthDummyInventoryInfoEOController extends JeroController<AuthDummy
|
||||
* @param authDummyInventoryInfoEO
|
||||
*/
|
||||
@ApiOperation(value="认证虚拟清单详情表-导入数据",notes="认证虚拟清单详情表-导入数据",produces = "application/octet-stream")
|
||||
@PostMapping(value = "/importData")
|
||||
// @RequiresPermissions("authDummyInventoryInfoEO:exportData")
|
||||
@RequestMapping(value = "/importData",method = RequestMethod.POST)
|
||||
// @RequiresPermiss/certificationListMaintenanceions("authDummyInventoryInfoEO:exportData")
|
||||
public Result<?> importData(@RequestParam(value = "file", required = false) MultipartFile file,
|
||||
AuthDummyInventoryInfoEO authDummyInventoryInfoEO) {
|
||||
try {
|
||||
authDummyInventoryInfoEOService.importData(file, authDummyInventoryInfoEO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Result.OK("导入成功");
|
||||
}
|
||||
|
||||
|
||||
+15
-5
@@ -73,7 +73,7 @@ public class AuthDummyInventoryInfoEO implements Serializable {
|
||||
private java.lang.String inspectionItem;
|
||||
|
||||
/**配置项*/
|
||||
// @Excel(name = "配置项", width = 15)
|
||||
@Excel(name = "配置项", width = 15)
|
||||
@ApiModelProperty(value = "配置项")
|
||||
private java.lang.String configItem;
|
||||
|
||||
@@ -83,30 +83,36 @@ public class AuthDummyInventoryInfoEO implements Serializable {
|
||||
private java.lang.String wvtaId;
|
||||
|
||||
/**标准编号*/
|
||||
@Excel(name = "编号", width = 15)
|
||||
@Excel(name = "*编号", width = 15)
|
||||
@ApiModelProperty(value = "编号")
|
||||
private java.lang.String serialNumber;
|
||||
|
||||
/**责任领域*/
|
||||
@Excel(name = "责任领域", width = 15)
|
||||
@ApiModelProperty(value = "责任领域")
|
||||
private java.lang.String dutyTerritory;
|
||||
@Excel(name = "*责任领域", width = 15)
|
||||
@TableField(exist = false)
|
||||
// 责任领域名称
|
||||
private String dutyTerritoryName;
|
||||
/**责任领域名称-英文**/
|
||||
@TableField(exist = false)
|
||||
private String dutyTerritoryNameEn;
|
||||
|
||||
/**交付物*/
|
||||
@Excel(name = "交付物", width = 15)
|
||||
// @Excel(name = "交付物", width = 15)
|
||||
@ApiModelProperty(value = "交付物")
|
||||
private java.lang.String deliverable;
|
||||
|
||||
/**交付物类型*/
|
||||
@Excel(name = "交付物类型", width = 15)
|
||||
@ApiModelProperty(value = "交付物类型")
|
||||
private String deliverableType;
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "交付物类型", width = 15)
|
||||
// 交付物类型名称
|
||||
private String deliverableTypeName;
|
||||
// 交付物类型名称-英文
|
||||
@TableField(exist = false)
|
||||
private String deliverableTypeNameEn;
|
||||
|
||||
/**文档库id*/
|
||||
// @Excel(name = "文档库id", width = 15)
|
||||
@@ -124,4 +130,8 @@ public class AuthDummyInventoryInfoEO implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String ids;
|
||||
|
||||
/**值类型,对应SysCategoryValueTypeEnum中value**/
|
||||
@TableField(exist = false)
|
||||
private String valueType;
|
||||
}
|
||||
|
||||
+25
-4
@@ -70,7 +70,7 @@ public class AuthDummyInventoryInfoEOEn implements Serializable {
|
||||
private String inspectionItem;
|
||||
|
||||
/**配置项*/
|
||||
// @Excel(name = "配置项", width = 15)
|
||||
@Excel(name = "Configuration Item", width = 15)
|
||||
@ApiModelProperty(value = "配置项")
|
||||
private String configItem;
|
||||
|
||||
@@ -80,20 +80,37 @@ public class AuthDummyInventoryInfoEOEn implements Serializable {
|
||||
private String wvtaId;
|
||||
|
||||
/**标准编号*/
|
||||
@Excel(name = "Number", width = 15)
|
||||
@Excel(name = "*Number", width = 15)
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String serialNumber;
|
||||
|
||||
/**责任领域*/
|
||||
@Excel(name = "Responsible Field", width = 15)
|
||||
@ApiModelProperty(value = "责任领域")
|
||||
private String dutyTerritory;
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "*Responsible Field", width = 15)
|
||||
// 责任领域名称
|
||||
private String dutyTerritoryName;
|
||||
/**责任领域名称-英文**/
|
||||
@TableField(exist = false)
|
||||
private String dutyTerritoryNameEn;
|
||||
|
||||
/**交付物*/
|
||||
@Excel(name = "Deliverables", width = 15)
|
||||
// @Excel(name = "Deliverables", width = 15)
|
||||
@ApiModelProperty(value = "交付物")
|
||||
private String deliverable;
|
||||
|
||||
/**交付物类型*/
|
||||
@ApiModelProperty(value = "交付物类型")
|
||||
private String deliverableType;
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "Deliverable Type", width = 15)
|
||||
// 交付物类型名称
|
||||
private String deliverableTypeName;
|
||||
// 交付物类型名称-英文
|
||||
@TableField(exist = false)
|
||||
private String deliverableTypeNameEn;
|
||||
|
||||
/**文档库id*/
|
||||
// @Excel(name = "文档库id", width = 15)
|
||||
@ApiModelProperty(value = "文档库id")
|
||||
@@ -110,4 +127,8 @@ public class AuthDummyInventoryInfoEOEn implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String ids;
|
||||
|
||||
/**值类型,对应SysCategoryValueTypeEnum中value**/
|
||||
@TableField(exist = false)
|
||||
private String valueType;
|
||||
}
|
||||
|
||||
+9
-1
@@ -94,7 +94,7 @@ public interface IAuthDummyInventoryInfoEOService extends IService<AuthDummyInve
|
||||
* @param file
|
||||
* @param authDummyInventoryInfoEO
|
||||
*/
|
||||
void importData(MultipartFile file, AuthDummyInventoryInfoEO authDummyInventoryInfoEO) throws Exception;
|
||||
void importData(MultipartFile file, AuthDummyInventoryInfoEO authDummyInventoryInfoEO);
|
||||
Result<?> batchAdd(JSONObject json);
|
||||
|
||||
/**
|
||||
@@ -120,4 +120,12 @@ public interface IAuthDummyInventoryInfoEOService extends IService<AuthDummyInve
|
||||
* @return
|
||||
*/
|
||||
String getTreeName(String cut, List<SysCategory> categoryList, List<String> technologyTerritoryList);
|
||||
|
||||
/**
|
||||
* 数据导入时的数据处理
|
||||
* @param datas
|
||||
* @param cut
|
||||
*/
|
||||
void importDisposeData(List<AuthDummyInventoryInfoEO> datas, String cut);
|
||||
String getTreeNameImport(String cut, List<SysCategory> categoryList, List<String> technologyTerritoryList);
|
||||
}
|
||||
|
||||
+158
-372
@@ -11,22 +11,16 @@ import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.oss.CosBootUtil;
|
||||
import com.jero.modules.authDummy.entity.AuthDummyInventoryBaseEO;
|
||||
import com.jero.modules.authDummy.entity.AuthDummyInventoryInfoEO;
|
||||
import com.jero.modules.authDummy.entity.AuthDummyInventoryInfoEOEn;
|
||||
import com.jero.modules.authDummy.mapper.AuthDummyInventoryInfoEOMapper;
|
||||
import com.jero.modules.authDummy.service.IAuthDummyInventoryBaseEOService;
|
||||
import com.jero.modules.authDummy.service.IAuthDummyInventoryInfoEOService;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEOEn;
|
||||
import com.jero.modules.dummy.service.impl.DummyLogEOServiceImpl;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.project.enums.ProjectInventoryFieldEnum;
|
||||
import com.jero.modules.split.common.FileUnZip;
|
||||
@@ -36,6 +30,7 @@ import com.jero.modules.system.mapper.SysCategoryMapper;
|
||||
import com.jero.modules.system.service.ISysDictItemService;
|
||||
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -44,15 +39,12 @@ import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
@@ -79,11 +71,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl.copyFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @Description: 认证虚拟清单详情表
|
||||
* @Author: jero-boot
|
||||
@@ -119,6 +106,12 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
@Autowired
|
||||
private ISysDictItemService sysDictItemService;
|
||||
|
||||
@Autowired
|
||||
private BussDocumentLibraryEOMapper bussDocumentLibraryEOMapper;
|
||||
|
||||
@Autowired
|
||||
private IAuthDummyInventoryInfoEOService authDummyInventoryInfoEOService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -302,8 +295,8 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
//导出的数据
|
||||
dataList = this.list(queryWrapper);
|
||||
|
||||
//数据转换(文件名称,技术领域,对应标准,发起人,责任人)
|
||||
// dataTransition(dataList, fileInfos,dummyInventoryInfoEO);
|
||||
String cut = authDummyInventoryInfoEO.getCut();
|
||||
disposeData(dataList,cut);
|
||||
|
||||
OutputStream os = null;
|
||||
try {
|
||||
@@ -337,7 +330,7 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
dataListEn.add(authDummyInventoryInfoEOEn);
|
||||
}
|
||||
//下拉选中英文转换
|
||||
transition(dataListEn);
|
||||
// transition(dataListEn);
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, AuthDummyInventoryInfoEOEn.class, dataListEn);
|
||||
}
|
||||
workbook.write(excelOS);
|
||||
@@ -379,17 +372,18 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
* @param file
|
||||
* @param authDummyInventoryInfoEO
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void importData(MultipartFile file, AuthDummyInventoryInfoEO authDummyInventoryInfoEO) throws Exception{
|
||||
public void importData(MultipartFile file, AuthDummyInventoryInfoEO authDummyInventoryInfoEO) {
|
||||
//检查虚拟清单是否存在
|
||||
QueryWrapper<AuthDummyInventoryBaseEO> infoEOQueryWrapper = new QueryWrapper<>();
|
||||
List<AuthDummyInventoryBaseEO> baseList = authDummyInventoryBaseEOService.list(infoEOQueryWrapper.eq("id", authDummyInventoryInfoEO.getAuthDummyInventoryBaseId()));
|
||||
if(CollectionUtils.isNotEmpty(baseList)){
|
||||
String title = "";
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
title = "类别,检验项目,WVTA ID,编号,责任领域,交付物";
|
||||
title = "类别,检验项目,配置项,WVTA ID,*编号,*责任领域,交付物类型";
|
||||
}else{
|
||||
title = "Category,Inspection Items,WVTA ID,Number,Responsible Field,Deliverables";
|
||||
title = "Category,Inspection Items,Configuration Item,WVTA ID,*Number,*Responsible Field,Deliverable Type";
|
||||
}
|
||||
|
||||
int pos = file.getOriginalFilename().lastIndexOf(".");
|
||||
@@ -507,26 +501,10 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
if (i == 0) {
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
||||
headerSb.append(cell.getStringCellValue() + ",");
|
||||
if(j == 8){
|
||||
if(j == 6){
|
||||
break;
|
||||
}
|
||||
} else if(i >=1){
|
||||
// 校验头部是否符合模板
|
||||
String substring = headerSb.toString();
|
||||
if (substring.endsWith(",") || substring.endsWith(",")){
|
||||
substring = headerSb.substring(0, headerSb.length() - 1);
|
||||
}
|
||||
String excelHeader = substring.toString();
|
||||
if (!title.equals(excelHeader)) {
|
||||
workbook.close();
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
|
||||
}else{
|
||||
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
|
||||
}
|
||||
}
|
||||
} else if(i > 1){
|
||||
List<String> headList = Arrays.asList(headerSb.toString().split(","));
|
||||
String field ="";
|
||||
if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
@@ -547,7 +525,7 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i >= 1) {
|
||||
if (i > 1) {
|
||||
dataList.add(rowList);
|
||||
}
|
||||
}
|
||||
@@ -572,32 +550,33 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
}
|
||||
}
|
||||
// 校验头部是否符合模板
|
||||
// String substring = headerSb.toString();
|
||||
// if (substring.endsWith(",") || substring.endsWith(",")){
|
||||
// substring = headerSb.substring(0, headerSb.length() - 1);
|
||||
// }
|
||||
// String excelHeader = substring.toString();
|
||||
// if (!title.equals(excelHeader)) {
|
||||
// workbook.close();
|
||||
// //删除原上传文件
|
||||
// FileUnZip.deleteDir(saveDirectory);
|
||||
// if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
// throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
|
||||
// }else{
|
||||
// throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
String substring = headerSb.toString();
|
||||
if (substring.endsWith(",") || substring.endsWith(",")){
|
||||
substring = headerSb.substring(0, headerSb.length() - 1);
|
||||
}
|
||||
String excelHeader = substring.toString();
|
||||
if (!title.equals(excelHeader)) {
|
||||
workbook.close();
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
throw new JeroBootException("读取失败,请严格按照模板文件导入数据");
|
||||
}else{
|
||||
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
workbook.close();
|
||||
|
||||
|
||||
// //树形数据字典
|
||||
List<SysCategory> categoryList = sysCategoryService.list();
|
||||
//普通数据字典
|
||||
List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsAll();
|
||||
importDatas(datas, categoryList, dictItemList, zipEntryName,saveDirectory,authDummyInventoryInfoEO);
|
||||
// List<SysCategory> categoryList = sysCategoryService.list();
|
||||
// //普通数据字典
|
||||
// List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsAll();
|
||||
// importDatas(datas, categoryList, dictItemList, zipEntryName,saveDirectory,authDummyInventoryInfoEO);
|
||||
String cut = authDummyInventoryInfoEO.getCut();
|
||||
importDisposeData(datas,cut);
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}else{
|
||||
@@ -639,224 +618,25 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
private void importDatas(List<AuthDummyInventoryInfoEO> dataList,
|
||||
List<SysCategory> categoryList,
|
||||
List<SysDictItem> dictItemList,
|
||||
String zipEntryName,
|
||||
File saveDirectory,
|
||||
AuthDummyInventoryInfoEO authDummyInventoryInfoEOTemp) {
|
||||
|
||||
String dictId = sysCategoryMapper.getDictId("deliverable_template");
|
||||
List<SysCategory> collect = categoryList.stream().filter(e -> e.getSysDictId().equals(dictId)).collect(Collectors.toList());
|
||||
List<String> treeNameList = new ArrayList<>();
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){
|
||||
treeNameList = collect.stream().map(SysCategory::getName).collect(Collectors.toList());
|
||||
}else{
|
||||
treeNameList = collect.stream().map(SysCategory::getEnName).collect(Collectors.toList());
|
||||
}
|
||||
int i = 3;
|
||||
List<String> msgList = new ArrayList<>();
|
||||
String value = "";
|
||||
boolean flag = true;
|
||||
//编号验证
|
||||
verifySerialNumber(dataList,authDummyInventoryInfoEOTemp);
|
||||
for (AuthDummyInventoryInfoEO authDummyInventoryInfoEO : dataList) {
|
||||
i++;
|
||||
String errorMsg = "";
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){
|
||||
errorMsg = "第" + i + "行:";
|
||||
}else{
|
||||
errorMsg = i + " line:";
|
||||
}
|
||||
//编号
|
||||
String serialNumber = authDummyInventoryInfoEO.getSerialNumber();
|
||||
//wvtaId
|
||||
String wvtaId = authDummyInventoryInfoEO.getWvtaId();
|
||||
//类别
|
||||
String category = authDummyInventoryInfoEO.getCategory();
|
||||
//检验项目
|
||||
String inspectionItem = authDummyInventoryInfoEO.getInspectionItem();
|
||||
//配置项
|
||||
String configItem = authDummyInventoryInfoEO.getConfigItem();
|
||||
//责任领域
|
||||
String dutyTerritory = authDummyInventoryInfoEO.getDutyTerritory();
|
||||
//交付物
|
||||
String deliverable = authDummyInventoryInfoEO.getDeliverable();
|
||||
//文档库id
|
||||
String bussDocumentLibraryId = authDummyInventoryInfoEO.getBussDocumentLibraryId();
|
||||
// 虚拟表基础表id
|
||||
String authDummyInventoryBaseId = authDummyInventoryInfoEO.getAuthDummyInventoryBaseId();
|
||||
|
||||
//编号(输入框必填)
|
||||
flag = must(authDummyInventoryInfoEO, errorMsg, msgList, serialNumber, "编号", "Number");
|
||||
|
||||
//WVTA ID
|
||||
if(StringUtils.isNotBlank(wvtaId)){
|
||||
if(wvtaId.length() > 100){
|
||||
String message = "";
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEOTemp.getCut())){
|
||||
message = errorMsg + "WVTA ID不能超过100个字符, ";
|
||||
}else{
|
||||
message = errorMsg + " The WVTA ID cannot contain more than 100 characters, ";
|
||||
}
|
||||
msgList.add(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//责任领域(多选必填)
|
||||
flag = must(authDummyInventoryInfoEO, errorMsg, msgList, dutyTerritory,"责任领域","Responsible Field");
|
||||
if(flag){
|
||||
value = pullMore(dictItemList, authDummyInventoryInfoEO, errorMsg, dutyTerritory,msgList,"责任领域","Responsible Field","duty_territory");
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
authDummyInventoryInfoEO.setDutyTerritory(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (msgList.size() > 0) {
|
||||
//返回报错信息
|
||||
String html = "";
|
||||
for (String s : msgList) {
|
||||
html += s + "</br>";
|
||||
}
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
throw new JeroBootException(html);
|
||||
} else {
|
||||
StringBuilder serialNumberBuilder = new StringBuilder();
|
||||
if (dataList.size() != 0) {
|
||||
this.saveBatch(dataList);
|
||||
|
||||
//更新log
|
||||
for (AuthDummyInventoryInfoEO authDummyInventoryInfoEO : dataList){
|
||||
serialNumberBuilder.append(authDummyInventoryInfoEO.getSerialNumber()).append(",");
|
||||
}
|
||||
String serialNumber = serialNumberBuilder.substring(0, serialNumberBuilder.length() - 1);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String username = sysUser.getUsername();
|
||||
String contentLog = username+"向清单中导入了“"+serialNumber+"”";
|
||||
String enContentLog = username+" imported “"+serialNumber+"” into the list.";
|
||||
dummyLogEOService.updateLog(contentLog, dataList.get(0).getAuthDummyInventoryBaseId(),CutEnum.CN.getValue());
|
||||
dummyLogEOService.updateLog(enContentLog, dataList.get(0).getAuthDummyInventoryBaseId(),CutEnum.EN.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
private String pullMore(List<SysDictItem> dictItemList, AuthDummyInventoryInfoEO authDummyInventoryInfoEO,
|
||||
String errorMsg, String value,List<String> msgList,
|
||||
String nameCn,String nameEn,String dictCode) {
|
||||
List<String> valueList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
List<String> list = Arrays.asList(value.split(","));
|
||||
List<SysDictItem> collect = dictItemList.stream().filter(e -> dictCode.equals(e.getDictCode()) && list.contains(e.getItemText())).collect(Collectors.toList());
|
||||
if(list.size() == collect.size()){
|
||||
valueList = collect.stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
||||
}else{
|
||||
//数据中有与数据字典不匹配的值
|
||||
List<String> finalValueList = valueList;
|
||||
List<String> diffList = list.stream().filter(e -> !finalValueList.contains(e)).collect(Collectors.toList());
|
||||
if (CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())) {
|
||||
errorMsg += nameCn + "中的" + StringUtils.join(diffList,",") + "与数据字典不匹配, ";
|
||||
} else {
|
||||
errorMsg += nameEn + " " + StringUtils.join(diffList,",") + " does not match the data dictionary, ";
|
||||
}
|
||||
msgList.add(errorMsg);
|
||||
}
|
||||
}
|
||||
return StringUtils.join(valueList,",");
|
||||
}
|
||||
private boolean must(AuthDummyInventoryInfoEO authDummyInventoryInfoEO, String errorMsg,
|
||||
List<String> msgList, String serialNumber,String nameCn,String nameEn) {
|
||||
int errorCount = 0;
|
||||
if(StringUtils.isBlank(serialNumber)){
|
||||
errorCount ++;
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
errorMsg += nameCn + "为必填项,不能为空, ";
|
||||
}else{
|
||||
errorMsg += nameEn + " this parameter is mandatory and cannot be empty, ";
|
||||
}
|
||||
msgList.add(errorMsg);
|
||||
}
|
||||
if(errorCount == 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private void verifySerialNumber(List<AuthDummyInventoryInfoEO> dataList,AuthDummyInventoryInfoEO authDummyInventoryInfoEOTemp) {
|
||||
//文档库数据
|
||||
List<String> serialNumberList = dataList.stream().map(AuthDummyInventoryInfoEO::getSerialNumber).collect(Collectors.toList());
|
||||
List<String> serialNumberS = new ArrayList<>();
|
||||
if(serialNumberList.size() != 0){
|
||||
for (String s : serialNumberList) {
|
||||
if(StringUtils.isNotBlank(s)){
|
||||
serialNumberS.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(serialNumberS.size() != 0){
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(BussDocumentLibraryEO::getSerialNumber,serialNumberS);
|
||||
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper);
|
||||
//文档库中可能存在重复的标准号
|
||||
List<String> serialNumberListTemp = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).distinct().collect(Collectors.toList());
|
||||
|
||||
//虚拟清单数据
|
||||
LambdaQueryWrapper<AuthDummyInventoryInfoEO> wrapperTemp = new LambdaQueryWrapper<>();
|
||||
wrapperTemp.in(AuthDummyInventoryInfoEO::getSerialNumber,serialNumberS).in(AuthDummyInventoryInfoEO::getAuthDummyInventoryBaseId,authDummyInventoryInfoEOTemp.getAuthDummyInventoryBaseId());
|
||||
List<AuthDummyInventoryInfoEO> dummyInventoryInfoEOList = this.list(wrapperTemp);
|
||||
List<String> serialNumberTempList = dummyInventoryInfoEOList.stream().map(AuthDummyInventoryInfoEO::getSerialNumber).collect(Collectors.toList());
|
||||
if(serialNumberS.size() != serialNumberListTemp.size()){
|
||||
//存在文档库没有的数据
|
||||
List<String> collect = bussDocumentLibraryEOList.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList());
|
||||
List<String> serialNumbers = serialNumberS.stream().filter(e -> !collect.contains(e)).collect(Collectors.toList());
|
||||
if(serialNumbers.size() != 0){
|
||||
if(CutEnum.CN.getValue().equals(dataList.get(0).getCut())){
|
||||
throw new JeroBootException(StringUtils.join(serialNumbers,",")+"文档库中不存在,不能添加");
|
||||
}else{
|
||||
throw new JeroBootException(StringUtils.join(serialNumbers,",")+" does not exist in the document library and cannot be added");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dummyInventoryInfoEOList.size() > 0){
|
||||
if(CutEnum.CN.getValue().equals(dataList.get(0).getCut())){
|
||||
throw new JeroBootException(StringUtils.join(serialNumberTempList,",")+"已存在,不能重复添加");
|
||||
}else{
|
||||
throw new JeroBootException(StringUtils.join(serialNumberTempList,",")+" already exists and cannot be added again");
|
||||
}
|
||||
}
|
||||
//通过编号将导入的数据与文档库进行关联
|
||||
for (AuthDummyInventoryInfoEO authDummyInventoryInfoEO : dataList) {
|
||||
List<BussDocumentLibraryEO> collect = bussDocumentLibraryEOList.stream()
|
||||
.filter(e -> e.getSerialNumber().equals(authDummyInventoryInfoEO.getSerialNumber())).collect(Collectors.toList());
|
||||
authDummyInventoryInfoEO.setBussDocumentLibraryId(collect.get(0).getId());
|
||||
authDummyInventoryInfoEO.setAuthDummyInventoryBaseId(collect.get(0).getId());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
private String fieldConvert(String field){
|
||||
if (field == null) return null;
|
||||
|
||||
switch (field) {
|
||||
case "类别": return "category";
|
||||
case "检验项目": return "inspectionItem";
|
||||
case "配置项": return "configItem";
|
||||
case "WVTA ID": return "wvtaId";
|
||||
case "编号" : return "serialNumber";
|
||||
case "责任领域": return "dutyTerritory";
|
||||
case "交付物" : return "deliverable";
|
||||
case "*编号" : return "serialNumber";
|
||||
case "*责任领域": return "dutyTerritoryName";
|
||||
case "交付物类型" : return "deliverableTypeName";
|
||||
|
||||
case "Category" : return "Category";
|
||||
case "Inspection Items" : return"inspectionItem";
|
||||
case "Configuration Item" : return"configItem";
|
||||
// case "WVTA ID" : return "wvtaId";
|
||||
case "Number" : return "serialNumber";
|
||||
case "Responsible Field" : return "dutyTerritory";
|
||||
case "Deliverables" : return "deliverable";
|
||||
case "*Number" : return "serialNumber";
|
||||
case "*Responsible Field" : return "dutyTerritoryName";
|
||||
case "Deliverable Type" : return "deliverableTypeNameEn";
|
||||
|
||||
|
||||
default: return null;
|
||||
@@ -905,19 +685,6 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
return false;
|
||||
}
|
||||
|
||||
private void transition(List<AuthDummyInventoryInfoEOEn> dataListEn) {
|
||||
//技术领域数据字典
|
||||
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
for (AuthDummyInventoryInfoEOEn authDummyInventoryInfoEOEn : dataListEn) {
|
||||
|
||||
//责任领域dutyTerritory
|
||||
String dutyTerritory = authDummyInventoryInfoEOEn.getDutyTerritory();
|
||||
String pullDutyTerritory = pull(sysDictItems, dutyTerritory,"duty_territory");
|
||||
if(StringUtils.isNotBlank(pullDutyTerritory)){
|
||||
authDummyInventoryInfoEOEn.setDutyTerritory(pullDutyTerritory);
|
||||
}
|
||||
}
|
||||
}
|
||||
private String pull(List<SysDictItem> sysDictItems, String field,String dictCode) {
|
||||
if(StringUtils.isBlank(field)){
|
||||
return null;
|
||||
@@ -949,41 +716,20 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
String fileOriName = "认证虚拟清单导入模板.xls";
|
||||
String filePath = uploadpath + File.separator + fileOriName;
|
||||
try {
|
||||
String titleOne = "";
|
||||
// String titleTwo = "";
|
||||
String title = "";
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
// titleOne = "编号,子标题,实施类别," +
|
||||
// "WVTA ID,认证类型," +
|
||||
// "*认证级别," +"适用增补件,"+
|
||||
// "*责任领域,备注," +
|
||||
// "设计符合性确认,Pre-homo确认,验证符合性确认";
|
||||
titleOne="类别,检验项目," +
|
||||
"WVTA ID,编号," +
|
||||
"*责任领域,交付物";
|
||||
// titleTwo = "交付物类型,交付物模板,发起人,责任人,交付物说明," +
|
||||
// "交付物类型,交付物模板,发起人,责任人,交付物说明," +
|
||||
// "交付物类型,交付物模板,发起人,责任人,交付物说明";
|
||||
title = "类别,检验项目,配置项,WVTA ID," +
|
||||
"*编号,*责任领域,交付物类型,";
|
||||
}else{
|
||||
// titleOne = "*Number,Sub-Title,Usage," +
|
||||
// "WVTA ID,Certification Type," +
|
||||
// "*Certification Level," +"Applicable Supplement,"+
|
||||
// "*Responsible Field,Comments," +
|
||||
// "Design compliance check,Pre-homo check,Validation compliance chech";
|
||||
titleOne = "Type,检验项目," +
|
||||
"WVTA ID,*Number," +
|
||||
"*Responsible Field,交付物";
|
||||
// titleTwo = "Type of deliverables,Deliverable template,Initiator,Person liable,Deliverables description," +
|
||||
// "Type of deliverables,Deliverable template,Initiator,Person liable,Deliverables description," +
|
||||
// "Type of deliverables,Deliverable template,Initiator,Person liable,Deliverables description";
|
||||
title = "Category,Inspection Items,Configuration Item,WVTA ID," +
|
||||
"*Number,*Responsible Field,Deliverable Type,";
|
||||
}
|
||||
|
||||
|
||||
List<String> list = Arrays.asList(titleOne.split(","));
|
||||
List<String> list = Arrays.asList(title.split(","));
|
||||
int index = 0;
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
index = list.indexOf("备注") + 1;
|
||||
index = list.indexOf("交付物类型") + 1;
|
||||
}else{
|
||||
index = list.indexOf("Comments") + 1;
|
||||
index = list.indexOf("Deliverable Type") + 1;
|
||||
}
|
||||
|
||||
//创建临时文件夹
|
||||
@@ -994,91 +740,56 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
nowFile.mkdirs();
|
||||
HSSFSheet sheet = workbook.createSheet("认证虚拟清单导入模板");
|
||||
sheet.setDefaultColumnWidth(16);//列宽
|
||||
HSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setWrapText(true);//自动换行
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中
|
||||
// HSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
// cellStyle.setWrapText(true);//自动换行
|
||||
// cellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中
|
||||
// cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中
|
||||
|
||||
HSSFCellStyle cellStyleTemp = workbook.createCellStyle();
|
||||
cellStyleTemp.setWrapText(true);//自动换行
|
||||
|
||||
|
||||
int count = 1;
|
||||
int startLine = 0;
|
||||
int endLine = 0;
|
||||
int line = 4;
|
||||
for (int i = 0; i < index; i++) {
|
||||
//合并单元格
|
||||
CellRangeAddress region1 =
|
||||
new CellRangeAddress(0, 1, i, i);
|
||||
sheet.addMergedRegion(region1);
|
||||
}
|
||||
for (int i = index; i < 12; i++) {
|
||||
if(count > 1){
|
||||
startLine = startLine + line + 1;
|
||||
endLine = startLine + line;
|
||||
}else{
|
||||
startLine = i;
|
||||
endLine = i + line;
|
||||
}
|
||||
//合并单元格
|
||||
CellRangeAddress region1 =
|
||||
new CellRangeAddress(0, 0, startLine, endLine); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
|
||||
sheet.addMergedRegion(region1);
|
||||
count ++;
|
||||
}
|
||||
CellRangeAddress region =
|
||||
new CellRangeAddress(2, 2, 0, 23); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
|
||||
new CellRangeAddress(1, 1, 0, 6); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
|
||||
sheet.addMergedRegion(region);
|
||||
// String explain= "";
|
||||
// if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
// explain = "填写说明\n" +
|
||||
// "1.导入数据从第四行开始\n" +
|
||||
// "2.所有带*号的字段必须填写\n"+
|
||||
// "3.实施类别,交付物类型,发起人,责任人,字段是单选属性,必须和系统中的对应字段选项相匹配\n" +
|
||||
// "4.认证类型,认证级别,责任领域,字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n" +
|
||||
// "5.编号,子标题,WVTA ID,备注,填写文本内容\n" +
|
||||
// "6.交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx";
|
||||
// }else{
|
||||
// explain = "Filling explanation\n" +
|
||||
// "1.Import data starts at the fourth line\n" +
|
||||
// "2.All fields marked with * must be filled in\n"+
|
||||
// "3.Implementation category,Type of deliverables,Initiator,Person liable,Fields are radio attributes that must match the corresponding field option in the system\n" +
|
||||
// "4.Certification Type,Certification Level,Responsible Field, field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n" +
|
||||
// "5.Number,Sub-Title,WVTA ID,Comments,Fill in the text\n" +
|
||||
// "6.Deliverable template,When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder. If b. diocx is stored under the AAA standard number, enter AAA/B. diocx";
|
||||
// }
|
||||
String explain= "";
|
||||
if(CutEnum.CN.getValue().equals(authDummyInventoryInfoEO.getCut())){
|
||||
explain = "填写说明\n" +
|
||||
"1.导入数据从第三行开始\n" +
|
||||
"2.所有带*号的字段必须填写\n"+
|
||||
"3.交付物类型,字段是单选属性,必须和系统中的对应字段选项相匹配\n" +
|
||||
"4.编号,责任领域,字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n" +
|
||||
"5.类别,WVTA ID,检验项目,配置项填写文本内容\n" +
|
||||
"6.交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx";
|
||||
}else{
|
||||
explain = "Filling explanation\n" +
|
||||
"1.Import data starts at the fourth line\n" +
|
||||
"2.All fields marked with * must be filled in\n"+
|
||||
"3.Deliverable Type,Fields are radio attributes that must match the corresponding field option in the system\n" +
|
||||
"4.Number,Responsible Field, field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n" +
|
||||
"5.Category,WVTA ID,Inspection Items,Configuration Item,Fill in the text\n" +
|
||||
"6.Deliverable template,When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder. If b. diocx is stored under the AAA standard number, enter AAA/B. diocx";
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
//表头
|
||||
Row row = sheet.createRow(i);//开始创建标题行
|
||||
String[] headerArr = titleOne.split(",");
|
||||
String[] headerArr = title.split(",");
|
||||
int lineTemp = index;
|
||||
if (i == 0) {
|
||||
for (int m = 0; m < headerArr.length; m++) {
|
||||
if(m < index){
|
||||
row.createCell(m).setCellValue(headerArr[m]);
|
||||
}else{
|
||||
row.createCell(lineTemp).setCellValue(headerArr[m]);
|
||||
Cell cell = row.getCell(lineTemp);
|
||||
cell.setCellStyle(cellStyle);
|
||||
lineTemp = lineTemp + 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}else if(i == 1){
|
||||
//titleTwo
|
||||
// String[] headerArrTwo = titleTwo.split(",");
|
||||
// for (int j = 0; j < headerArrTwo.length; j++) {
|
||||
// row.createCell(9+j).setCellValue(headerArrTwo[j]);
|
||||
// }
|
||||
}else{
|
||||
short height = (short) (7 * 252);
|
||||
row.setHeight((short) height);
|
||||
Cell cell = row.createCell(0);
|
||||
cell.setCellStyle(cellStyleTemp);
|
||||
// cell.setCellValue(new HSSFRichTextString(explain));
|
||||
cell.setCellValue(new HSSFRichTextString(explain));
|
||||
}
|
||||
}
|
||||
response.setHeader("Content-Disposition",
|
||||
@@ -1135,4 +846,79 @@ public class AuthDummyInventoryInfoEOServiceImpl extends ServiceImpl<AuthDummyIn
|
||||
}
|
||||
return technologyTerritoryName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据导入时的数据处理
|
||||
* @param datas
|
||||
* @param cut
|
||||
*/
|
||||
@Override
|
||||
public void importDisposeData(List<AuthDummyInventoryInfoEO> datas, String cut) {
|
||||
if(CollectionUtils.isNotEmpty(datas)){
|
||||
List<SysCategory> categoryList = this.sysCategoryService.list();
|
||||
List<SysDictItem> sysDictItems = this.sysDictItemServiceImpl.getBaseMapper().selectItemsAll();
|
||||
|
||||
|
||||
for(AuthDummyInventoryInfoEO data : datas){
|
||||
//交付物类型
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
if(StringUtils.isNotEmpty(data.getDeliverableTypeName())){
|
||||
String deliverableType = this.getTreeNameImport(cut, categoryList, Arrays.asList(data.getDeliverableTypeName().split(",")));
|
||||
data.setDeliverableType(deliverableType);
|
||||
|
||||
}
|
||||
}else {
|
||||
if(StringUtils.isNotEmpty(data.getDeliverableTypeNameEn())){
|
||||
|
||||
String deliverableType = this.getTreeNameImport(CutEnum.EN.getValue(), categoryList, Arrays.asList(data.getDeliverableTypeNameEn().split(",")));
|
||||
data.setDeliverableType(deliverableType);
|
||||
|
||||
String valueType = categoryList.stream().filter(category -> {
|
||||
boolean flag = false;
|
||||
if (StringUtils.equals(data.getDeliverableTypeNameEn(), category.getEnName())) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).map(SysCategory::getValueType).distinct().collect(Collectors.joining(","));
|
||||
data.setValueType(valueType);
|
||||
}
|
||||
}
|
||||
//责任领域
|
||||
if(StringUtils.isNotEmpty(data.getDutyTerritoryName())){
|
||||
String dutyTerritory = this.sysDictItemService.disposeShowDictItemText(sysDictItems,data.getDutyTerritoryName(),cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue());
|
||||
data.setDutyTerritory(dutyTerritory);
|
||||
}
|
||||
//通过编号查找文档库的id
|
||||
if(StringUtils.isNotEmpty(data.getSerialNumber())){
|
||||
BussDocumentLibraryEO bySerialNumber = bussDocumentLibraryEOMapper.getBySerialNumber(data.getSerialNumber());
|
||||
data.setBussDocumentLibraryId(bySerialNumber.getId());
|
||||
}
|
||||
List<AuthDummyInventoryInfoEO> list = new ArrayList<>();
|
||||
list.add(data);
|
||||
if (list.size()>0) {
|
||||
authDummyInventoryInfoEOService.saveBatch(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getTreeNameImport(String cut, List<SysCategory> categoryList, List<String> technologyTerritoryList) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String technologyTerritory : technologyTerritoryList) {
|
||||
List<SysCategory> collect = new ArrayList<>();
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getName())).collect(Collectors.toList());
|
||||
}else {
|
||||
collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getEnName())).collect(Collectors.toList());
|
||||
}
|
||||
if(collect!=null&&collect.size()>0){
|
||||
sb.append(collect.get(0).getId());
|
||||
}
|
||||
}
|
||||
String technologyTerritoryId = "";
|
||||
if (StringUtils.isNotBlank(sb)) {
|
||||
technologyTerritoryId = sb.substring(0, sb.length()-0);
|
||||
}
|
||||
return technologyTerritoryId;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-31
@@ -369,16 +369,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
}
|
||||
}
|
||||
//责任领域
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
if(StringUtils.isNotEmpty(data.getDutyTerritoryName())){
|
||||
String dutyTerritory = this.sysDictItemService.disposeShowDictItemText(sysDictItems,data.getDutyTerritoryName(),cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue());
|
||||
data.setDutyTerritory(dutyTerritory);
|
||||
}
|
||||
}else {
|
||||
if (StringUtils.isNotEmpty(data.getDutyTerritoryNameEn())){
|
||||
String dutyTerritory = this.sysDictItemService.disposeShowDictItemText(sysDictItems,data.getDutyTerritoryNameEn(),cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue());
|
||||
data.setDutyTerritory(dutyTerritory);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(data.getDutyTerritoryName())){
|
||||
String dutyTerritory = this.sysDictItemService.disposeShowDictItemText(sysDictItems,data.getDutyTerritoryName(),cut, ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue());
|
||||
data.setDutyTerritory(dutyTerritory);
|
||||
}
|
||||
//通过编号查找文档库的id
|
||||
if(StringUtils.isNotEmpty(data.getSerialNumber())){
|
||||
@@ -387,7 +380,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
}
|
||||
List<ProjectCertificationInventoryEO> list = new ArrayList<>();
|
||||
list.add(data);
|
||||
if (list.size()>0) {
|
||||
if (list!=null&&list.size()>0) {
|
||||
projectCertificationInventoryEOService.saveBatch(list);
|
||||
}
|
||||
}
|
||||
@@ -404,7 +397,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
}else {
|
||||
collect = categoryList.stream().filter(e -> technologyTerritory.equals(e.getEnName())).collect(Collectors.toList());
|
||||
}
|
||||
sb.append(collect.get(0).getId());
|
||||
if(collect!=null&&collect.size()>0){
|
||||
sb.append(collect.get(0).getId());
|
||||
}
|
||||
}
|
||||
String technologyTerritoryId = "";
|
||||
if (StringUtils.isNotBlank(sb)) {
|
||||
@@ -2356,7 +2351,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
}else{
|
||||
throw new JeroBootException("The data fails to be read. Import data strictly according to the template file");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2462,23 +2456,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
}
|
||||
|
||||
}
|
||||
// private void transition(List<ProjectCertificationInventoryEOEn> dataListEn,ProjectCertificationInventoryEO projectCertificationInventoryEO){
|
||||
// //下拉选数据字典
|
||||
// List<SysCategory> sysCategoryList = sysCategoryService.list();
|
||||
//
|
||||
// //技术领域数据字典
|
||||
// List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
// for (ProjectCertificationInventoryEOEn projectCertificationInventoryEOEn : dataListEn) {
|
||||
//
|
||||
// //责任领域dutyTerritory
|
||||
// String dutyTerritory = projectCertificationInventoryEOEn.getDutyTerritory();
|
||||
// String pullDutyTerritory = pull(sysDictItems, dutyTerritory,"duty_territory");
|
||||
// if(StringUtils.isNotBlank(pullDutyTerritory)){
|
||||
// projectCertificationInventoryEOEn.setDutyTerritory(pullDutyTerritory);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
private String pull(List<SysDictItem> sysDictItems, String field,String dictCode) {
|
||||
if(StringUtils.isBlank(field)){
|
||||
return null;
|
||||
@@ -2565,7 +2542,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
case "Inspection Items": return "inspectionItem";
|
||||
case "Configuration Item": return "configItem";
|
||||
case "*Standard No": return "serialNumber";
|
||||
case "*Responsible Field": return "dutyTerritoryNameEn";
|
||||
case "*Responsible Field": return "dutyTerritoryName";
|
||||
case "Eng. Interface": return "sdtName";
|
||||
case "Assignee": return "dutyPersonName";
|
||||
case "Deliverable Type": return "deliverableTypeNameEn";
|
||||
|
||||
Reference in New Issue
Block a user