diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java index 56bb99597..a4771a6bf 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java @@ -8,9 +8,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.common.api.vo.Result; import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.system.base.controller.JeroController; -import com.jero.modules.cert.template.vo.ParamsInfoVO; import com.jero.modules.cert.template.entity.ParamsInfoEO; import com.jero.modules.cert.template.service.IParamsInfoEOService; +import com.jero.modules.cert.template.vo.ParamsInfoVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -18,6 +18,7 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -57,7 +58,8 @@ public class ParamsInfoEOController extends JeroController queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.like(StringUtils.isNotEmpty(paramsInfoEO.getNioNumber()), ParamsInfoEO::getNioNumber, paramsInfoEO.getNioNumber()) + queryWrapper.eq(ParamsInfoEO::getParamsTemplateId, paramsInfoEO.getParamsTemplateId()) + .like(StringUtils.isNotEmpty(paramsInfoEO.getNioNumber()), ParamsInfoEO::getNioNumber, paramsInfoEO.getNioNumber()) .like(StringUtils.isNotEmpty(paramsInfoEO.getParamsName()), ParamsInfoEO::getParamsName, paramsInfoEO.getParamsName()) .eq(StringUtils.isNotEmpty(paramsInfoEO.getDutyTerritory()), ParamsInfoEO::getDutyTerritory, paramsInfoEO.getDutyTerritory()) .orderByDesc(ParamsInfoEO::getCreateTime); @@ -190,12 +192,14 @@ public class ParamsInfoEOController extends JeroController importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, ParamsInfoEO.class); - } + /** + * 导入 + * @param file + * @param cut + * @param paramsTemplateId + * @return + * @throws Exception + */ + @AutoLog(value = "参数项基本信息表-导入") + @ApiOperation(value = "参数项基本信息表-导入") + @PostMapping(value = "/importParamsInfo") + public Result importParamsInfo( MultipartFile file, + @RequestParam(value = "cut") String cut, + @RequestParam(value = "paramsTemplateId") String paramsTemplateId) throws Exception { + return paramsInfoEOService.importParamsInfo(file, cut, paramsTemplateId); + } } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlTypeEnum.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlTypeEnum.java index 87b9ce159..1c0f1bfb4 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlTypeEnum.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlTypeEnum.java @@ -1,27 +1,34 @@ package com.jero.modules.cert.template.enums; +import com.jero.common.constant.enums.CutEnum; + +import java.util.HashMap; +import java.util.Map; + /** * @Author: liyawei * @Description: * @Date: Created in 15:51 2022/4/22 */ public enum ControlTypeEnum { - TEXT("文本","1"), - PULL_SINGLE("下拉单选","2"), - PULL_MORE("下拉多选","3"), - FILE("附件","4"), - TEXT_PULL_SINGLE("文本+下拉单选","5"), - TEXT_PULL_MORE("文本+下拉多选","6"), - TEXT_FILE("文本+附件","7"), - PULL_SINGLE_FILE("下拉单选+附件","8"), - PULL_MORE_FILE("下拉多选+附件","9"), - TEXT_PULL_SINGLE_FILE("文本+下拉单选+附件","10"); + TEXT("文本", "text","1"), + PULL_SINGLE("下拉单选","pull single","2"), + PULL_MORE("下拉多选","pull more","3"), + FILE("附件","file","4"), + TEXT_PULL_SINGLE("文本+下拉单选","text+pull single","5"), + TEXT_PULL_MORE("文本+下拉多选","text+pull more","6"), + TEXT_FILE("文本+附件","text+file","7"), + PULL_SINGLE_FILE("下拉单选+附件","pull single+file","8"), + PULL_MORE_FILE("下拉多选+附件","pull more+file","9"), + TEXT_PULL_SINGLE_FILE("文本+下拉单选+附件","text+pull single file","10"); String name; + String enName; String value; - ControlTypeEnum(String name, String value) { + ControlTypeEnum(String name, String enName, String value) { this.name = name; + this.enName = enName; this.value = value; } @@ -40,4 +47,26 @@ public enum ControlTypeEnum { public void setValue(String value) { this.value = value; } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public static Map toMapForImport(String cut){ + Map map = new HashMap<>(); + if (CutEnum.CN.getValue().equals(cut)) { + for (ControlTypeEnum controlTypeEnum : ControlTypeEnum.values()) { + map.put(controlTypeEnum.getName(), controlTypeEnum.getValue()); + } + } else if (CutEnum.EN.getValue().equals(cut)) { + for (ControlTypeEnum controlTypeEnum : ControlTypeEnum.values()) { + map.put(controlTypeEnum.getEnName(), controlTypeEnum.getValue()); + } + } + return map; + } } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlVerifyEnum.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlVerifyEnum.java index 94697f0c9..0234d1fa8 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlVerifyEnum.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ControlVerifyEnum.java @@ -1,26 +1,33 @@ package com.jero.modules.cert.template.enums; +import com.jero.common.constant.enums.CutEnum; + +import java.util.HashMap; +import java.util.Map; + /** * @Author: liyawei * @Description: 控件类型为文本时需要该校验 * @Date: Created in 15:58 2022/4/22 */ public enum ControlVerifyEnum { - NULL("无","1"), - CHINESE("中文","2"), - POSITIVE_INTEGER("正整数","3"), - POSITIVE_FLOAT("正浮点数","4"), - INTEGER_DECIMAL("整数或小数","5"), - DECIMAL_ONE("一位小数","6"), - DECIMAL_TWO("两位小数","7"), - DECIMAL_THREE("三位小数","8"), - DECIMAL_FOUR("四位小数","9"); + NULL("无","null","1"), + CHINESE("中文","chinese","2"), + POSITIVE_INTEGER("正整数","positive integer","3"), + POSITIVE_FLOAT("正浮点数","positive float","4"), + INTEGER_DECIMAL("整数或小数","integer decimal","5"), + DECIMAL_ONE("一位小数","decimal one","6"), + DECIMAL_TWO("两位小数","decimal two","7"), + DECIMAL_THREE("三位小数","decimal three","8"), + DECIMAL_FOUR("四位小数","decimal four","9"); String name; + String enName; String value; - ControlVerifyEnum(String name, String value) { + ControlVerifyEnum(String name, String enName, String value) { this.name = name; + this.enName = enName; this.value = value; } @@ -39,4 +46,26 @@ public enum ControlVerifyEnum { public void setValue(String value) { this.value = value; } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public static Map toMapForImport(String cut){ + Map map = new HashMap<>(); + if (CutEnum.CN.getValue().equals(cut)) { + for (ControlVerifyEnum controlVerifyEnum : ControlVerifyEnum.values()) { + map.put(controlVerifyEnum.getName(), controlVerifyEnum.getValue()); + } + } else if (CutEnum.EN.getValue().equals(cut)) { + for (ControlVerifyEnum controlVerifyEnum : ControlVerifyEnum.values()) { + map.put(controlVerifyEnum.getEnName(), controlVerifyEnum.getValue()); + } + } + return map; + } } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/IsMustEnum.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/IsMustEnum.java deleted file mode 100644 index 5b464a0fa..000000000 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/IsMustEnum.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.jero.modules.cert.template.enums; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 11:20 2022/4/14 - */ -public enum IsMustEnum { - YES("是","1"), - NO("否","0"); - - String name; - String value; - - IsMustEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ParamsIsMustEnum.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ParamsIsMustEnum.java new file mode 100644 index 000000000..27e4cc10a --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/enums/ParamsIsMustEnum.java @@ -0,0 +1,65 @@ +package com.jero.modules.cert.template.enums; + +import com.jero.common.constant.enums.CutEnum; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author: liyawei + * @Description: + * @Date: Created in 11:20 2022/4/14 + */ +public enum ParamsIsMustEnum { + YES("是","yes","1"), + NO("否","no","0"); + + String name; + String enName; + String value; + + ParamsIsMustEnum(String name, String enName, String value) { + this.name = name; + this.enName = enName; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public static Map toMapForImport(String cut){ + Map map = new HashMap<>(); + if (CutEnum.CN.getValue().equals(cut)) { + for (ParamsIsMustEnum paramsIsMustEnum : ParamsIsMustEnum.values()) { + map.put(paramsIsMustEnum.getName(), paramsIsMustEnum.getValue()); + } + } else if (CutEnum.EN.getValue().equals(cut)) { + for (ParamsIsMustEnum paramsIsMustEnum : ParamsIsMustEnum.values()) { + map.put(paramsIsMustEnum.getEnName(), paramsIsMustEnum.getValue()); + } + } + return map; + } + +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java index cea2cdb3b..d6dbb107c 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java @@ -1,13 +1,18 @@ package com.jero.modules.cert.template.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.common.api.vo.Result; import com.jero.modules.cert.template.entity.ParamsInfoEO; +import com.jero.modules.cert.template.vo.CertCategoryParamsInfoCnImport; +import com.jero.modules.cert.template.vo.ParamsInfoCnImport; import com.jero.modules.cert.template.vo.ParamsInfoVO; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; +import java.util.Map; /** * @Description: 参数项基本信息表 @@ -83,4 +88,12 @@ public interface IParamsInfoEOService extends IService { void exportParamsInfo(String cut, ParamsInfoVO paramsInfoVO, String exportExcelName, HttpServletResponse response, HttpServletRequest request); void getTreeDictItemText(List paramsInfoEOList, String cut); + + Result importParamsInfo(MultipartFile file, String cut, String paramsTemplateId) throws IOException; + + Result importParamsInfoData(List paramsInfoEOList, + Map> certCategoryParamsInfoEOListMap, + String unzipfilepath, + String paramsTemplateId, + String cut); } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java index c061d4b37..6167f4cfc 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java @@ -1,39 +1,52 @@ package com.jero.modules.cert.template.service.impl; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ZipUtil; import com.aliyuncs.utils.IOUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.CutEnum; +import com.jero.common.constant.enums.IsMustEnum; import com.jero.common.exception.JeroBootException; import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO; import com.jero.modules.cert.template.entity.ParamsInfoEO; +import com.jero.modules.cert.template.enums.ControlTypeEnum; +import com.jero.modules.cert.template.enums.ControlVerifyEnum; +import com.jero.modules.cert.template.enums.ParamsIsMustEnum; import com.jero.modules.cert.template.mapper.ParamsInfoEOMapper; import com.jero.modules.cert.template.service.ICertCategoryParamsInfoEOService; import com.jero.modules.cert.template.service.IParamsInfoEOService; import com.jero.modules.cert.template.utils.CommonExcelExportStyler; -import com.jero.modules.cert.template.vo.CertCategoryParamsInfoEnExport; -import com.jero.modules.cert.template.vo.ParamsInfoEnExport; -import com.jero.modules.cert.template.vo.ParamsInfoVO; +import com.jero.modules.cert.template.vo.*; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.split.common.FileUnZip; import com.jero.modules.split.common.ReadExcel; import com.jero.modules.system.entity.SysCategory; import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.service.ISysDictItemService; import com.jero.modules.system.service.impl.SysCategoryServiceImpl; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Workbook; -import org.jeecgframework.poi.excel.ExcelExportUtil; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.entity.enmus.ExcelType; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -44,6 +57,8 @@ import java.nio.file.StandardOpenOption; import java.util.*; import java.util.stream.Collectors; +import static com.jero.modules.split.util.ExcelUtil.checkObjAllFieldsIsNull; + /** * @Description: 参数项基本信息表 * @Author: jero-boot @@ -64,7 +79,6 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl importParamsInfo(MultipartFile file, String cut, String paramsTemplateId) throws IOException { + //验证文件名是否合格 + /* 截取后缀名 */ + int pos = file.getOriginalFilename().lastIndexOf("."); + String str = file.getOriginalFilename().substring(pos+1).toLowerCase(); + String filenameorg = file.getOriginalFilename().substring(0,pos); + String resultMsg = ""; + //判断上传文件必须是zip + // TODO 允许导入rar + if (!str.equals("zip")) { + if(CutEnum.CN.getValue().equals(cut)){ + resultMsg = "请上传zip文件"; + }else{ + resultMsg = "Please upload a zip file"; + } + return Result.error(resultMsg); + } + String path = uploadpath + "/modal/"+filenameorg; + File saveDirectory = new File(path); + if(!saveDirectory.isDirectory()){ + saveDirectory.mkdir(); + } + FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path +File.separator+ file.getOriginalFilename())); + try{ + //解压缩 + String zipEntryName = FileUnZip.unZipFiles(path +File.separator+ file.getOriginalFilename(),path); + // 数据相关处理, + // 1.获取其中的Excel, + List excelfilelist = FileUnZip.readExcelFile(zipEntryName); + if(excelfilelist.size()<1){ + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(cut)){ + resultMsg = "压缩包内没有上传Excel数据"; + }else{ + resultMsg = "In the cabinet did not upload the Excel data"; + } + return Result.error(1, resultMsg); + + } else if (excelfilelist.size()>1) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(cut)){ + resultMsg = "压缩包根目录下仅能存在一个excel为导入数据"; + }else{ + resultMsg = "Only one Excel file can be imported in the compressed package root directory"; + } + return Result.error(1, resultMsg); + } + File excelfile = excelfilelist.get(0); + // 导入参数设置,默认即可 + ImportParams params = new ImportParams(); + try { + // 取数据 TODO 英文导入待处理 + XSSFWorkbook workbook=new XSSFWorkbook(new FileInputStream(excelfile)); + List paramsInfoEOList = new ArrayList<>(); + Map> certCategoryParamsInfoEOListMap = new HashMap<>(); + + // 认证类别 数据字典 map + List sysDictItemList = sysDictItemService.selectItemsByDictCode("cert_category"); + Map certCategoryMap = sysDictItemList.stream().collect(Collectors.toMap(c->c.getItemText(),c->c.getItemValue())); + + for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { + params.setStartSheetIndex(numSheet); + // 表头在第几行 +// params.setTitleRows(1); + // 距离表头中间有几行不要的数据 +// params.setStartRows(1); + //是否需要通过key-value导入方法,获取特定字段 +// params.setReadSingleCell(true); + //判断一个cell是key的规则,可以自定义,默认就是 “:” +// params.setKeyMark(":"); + String sheetName = workbook.getSheetName(numSheet); + // 第几个sheet页 + if (numSheet == 0) { // 企业参数表 + ExcelImportResult result = ExcelImportUtil.importExcelMore(excelfile,ParamsInfoCnImport.class, params); + paramsInfoEOList = result.getList(); + } else { // 认证类别参数表 + if (certCategoryMap.containsKey(sheetName)) { + ExcelImportResult result = ExcelImportUtil.importExcelMore(excelfile, CertCategoryParamsInfoCnImport.class, params); + List list = result.getList(); + if (CollectionUtil.isNotEmpty(list)) { + list.forEach(certCategoryParamsInfoEO -> { + certCategoryParamsInfoEO.setCertCategory(certCategoryMap.get(sheetName)); + certCategoryParamsInfoEO.setParamsTemplateId(paramsTemplateId); + }); + certCategoryParamsInfoEOListMap.put(sheetName, list); + } + } + } + + } + + if(paramsInfoEOList!=null &&!paramsInfoEOList.isEmpty()){ + try { + String unzipfilepath = zipEntryName; + Result message = importParamsInfoData(paramsInfoEOList,certCategoryParamsInfoEOListMap,unzipfilepath,paramsTemplateId,cut); + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + return message; + + } catch (Exception e) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + return Result.error(e.getMessage()); + } + }else{ + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(cut)){ + resultMsg = "企业参数表没有可导入的数据,请检查!"; + }else{ + resultMsg = "No data to import, please check"; + } + return Result.error(1, resultMsg); + } + } catch (NoSuchElementException e){ + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(cut)){ + resultMsg = "没有可导入的数据,请检查!"; + }else{ + resultMsg = "No data to import, please check"; + } + return Result.error(1, resultMsg); + } catch (JeroBootException e){ + FileUnZip.deleteDir(saveDirectory); + return Result.error(1, e.getMessage()); + } catch (Exception e) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(cut)){ + resultMsg = "读取失败,请严格按照模板文件导入数据"; + }else{ + resultMsg = "The data fails to be read. Import data strictly according to the template file"; + } + return Result.error(1, resultMsg); + } + } catch (Exception e) { + //删除原上传文件 + FileUnZip.deleteDir(saveDirectory); + if(CutEnum.CN.getValue().equals(cut)){ + resultMsg = "读取失败,请严格按照模板文件导入数据"; + }else{ + resultMsg = "The data fails to be read. Import data strictly according to the template file"; + } + return Result.error(1, resultMsg); + } + } + + @Override + public Result importParamsInfoData(List paramsInfoEOList, + Map> certCategoryParamsInfoEOListMap, + String unzipfilepath, + String paramsTemplateId, + String cut) { + //验证导入数据是否符合规则 + Map map = validateImportDatas(paramsInfoEOList,certCategoryParamsInfoEOListMap,unzipfilepath,cut); + boolean isOk = (boolean) map.get("result"); + if (!isOk) { + //验证没有通过 + String message = (String) map.get("message"); + return Result.error(message); + } + //将导入数据循环合并整理后 新增至相应表 + paramsInfoEOList = (List) map.get("paramsInfoEOList"); + List certCategoryParamsInfoEOList = (List) map.get("certCategoryParamsInfoEOList"); + + List paramsInfoEOS = new ArrayList<>(); + for (ParamsInfoCnImport importDto : paramsInfoEOList) { + //判断此行数据是否全部为空,是则不读取 + if (checkObjAllFieldsIsNull(importDto)) { + continue; + } + String[] fileIdList = importDto.getFileTemplateName().split(","); + String connectId = UUID.randomUUID().toString().replace("-", ""); + List updateFileList = new ArrayList<>(); + for (int i=0; i certCategoryParamsInfoEOS = new ArrayList<>(); + for (CertCategoryParamsInfoCnImport ccImportDto : certCategoryParamsInfoEOList) { + CertCategoryParamsInfoEO target = new CertCategoryParamsInfoEO(); + BeanUtils.copyProperties(ccImportDto, target); + certCategoryParamsInfoEOS.add(target); + } + // 批量新增认证参数项 + certCategoryParamsInfoEOService.saveBatch(certCategoryParamsInfoEOS); + // 批量新增参数项 + Boolean isSuccess = saveBatch(paramsInfoEOS); + + String msg = ""; + if (isSuccess) { + int countSuccess = paramsInfoEOS.size(); + if (CutEnum.CN.getValue().equals(cut)) { + msg = "成功导入" + countSuccess + "条"; + } else { + msg = "import " + countSuccess + " datas successfully"; + } + return Result.OK(msg, null); + } else { + if (CutEnum.CN.getValue().equals(cut)) { + msg = "导入失败"; + } else { + msg = "import failed"; + } + return Result.error(1, msg); + } + } + + private Map validateImportDatas(List paramsInfoEOList, + Map> certCategoryParamsInfoEOListMap, + String filepath, + String cut){ + List certCategoryParamsInfoEOList = new ArrayList<>(); + // 树形数据字典 + List categoryList = sysCategoryService.queryByTreeDicCode("technology_territory"); + // 普通数据字典 + List dictItemList = new ArrayList<>(); + List dictCodeList = new ArrayList<>(); + dictCodeList.add("params_batch"); + dictCodeList.add("duty_territory"); + dictCodeList.add("cert_category"); + for (String dictCode : dictCodeList) { + List dictItems = sysDictItemService.selectItemsByDictCode(dictCode); + dictItemList.addAll(dictItems); + } + Map controlTypeEnumMap = ControlTypeEnum.toMapForImport(cut); + Map controlVerifyEnumMap = ControlVerifyEnum.toMapForImport(cut); + Map paramsIsMustEnumMap = ParamsIsMustEnum.toMapForImport(cut); + + //树形数据字典 + List treeNameList = new ArrayList<>(); + //普通数据字典 + List itemNameList = new ArrayList<>(); + if (CutEnum.CN.getValue().equals(cut)) { + treeNameList = categoryList.stream().map(SysCategory::getName).collect(Collectors.toList()); + itemNameList = dictItemList.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); + } else if(CutEnum.EN.getValue().equals(cut)){ + treeNameList = categoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList()); + itemNameList = dictItemList.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); + } + + //存放数据验证结果信息 + List stringMessage = new ArrayList<>(); + int i = 2; //记录行号 + int num = 0; //记录是第几条数据 + //循环验证数据 + for (ParamsInfoCnImport dto : paramsInfoEOList) { + //判断此行数据是否全部为空,是则不读取 + if (checkObjAllFieldsIsNull(dto)) { + continue; + } + + i++; + int countError = 0; //记录失败数据数量 + String errorMsg = ""; + if (CutEnum.CN.getValue().equals(cut)) { + errorMsg = "企业参数表 第" + i + "行:"; + } else { + errorMsg = i + " line:"; + } + + // nio编号 + String nioNumber = dto.getNioNumber(); + validateMustAndLength(nioNumber, "nio编号", IsMustEnum.YES.getValue(),"15", errorMsg, countError, false, cut); + if (StringUtils.isNotEmpty(dto.getNioNumber())) { + // 校验nio编号 格式:字母数字横杠(-) + String nioNumberRegex = "^[A-Za-z0-9-]+$"; + if (!nioNumber.matches(nioNumberRegex)) { + errorMsg += "nio编号格式错误,仅能为字母,数字,横杠(-)"; + countError++; + } + } + + // 是否必填 + String isMust = dto.getIsMust(); + validateMustAndLength(isMust, "是否必填", IsMustEnum.YES.getValue(), "50",errorMsg, countError, false, cut); + getCodeByName(isMust,"是否必填","enum",paramsIsMustEnumMap,null,null,errorMsg,countError,cut); + dto.setIsMust(isMust); + + // 参数名称 + String paramsName = dto.getParamsName(); + validateMustAndLength(paramsName, "参数名称", IsMustEnum.YES.getValue(), "30",errorMsg, countError, false, cut); + + // 技术领域 + String technologyTerritory = dto.getTechnologyTerritory(); + validateMustAndLength(technologyTerritory, "技术领域", IsMustEnum.YES.getValue(), "1000",errorMsg, countError, false, cut); + getCodeByName(technologyTerritory,"技术领域","treeDicCode",null,treeNameList,categoryList,errorMsg,countError,cut); + dto.setTechnologyTerritory(technologyTerritory); + + // 参数批次 + String paramsBatch = dto.getParamsBatch(); + validateMustAndLength(paramsBatch, "参数批次", IsMustEnum.YES.getValue(), "50",errorMsg, countError, true, cut); + getCodeByName(paramsBatch,"参数批次","dicCode",null,itemNameList,dictItemList,errorMsg,countError,cut); + dto.setParamsBatch(paramsBatch); + + // 责任领域 + String dutyTerritory = dto.getDutyTerritory(); + validateMustAndLength(dutyTerritory, "责任领域", IsMustEnum.YES.getValue(), "50",errorMsg, countError, true, cut); + getCodeByName(dutyTerritory,"责任领域","dicCode",null,itemNameList,dictItemList,errorMsg,countError,cut); + dto.setDutyTerritory(dutyTerritory); + + // 参数说明 + String description = dto.getDescription(); + validateMustAndLength(description,"参数说明",IsMustEnum.YES.getValue(),"200",errorMsg,countError,false,cut); + + // 认证类别 + String certCategory = dto.getCertCategory(); + validateMustAndLength(certCategory, "认证类别", IsMustEnum.YES.getValue(), "1000",errorMsg, countError, false, cut); + getCodeByName(certCategory,"认证类别","dicCode",null,itemNameList,dictItemList,errorMsg,countError,cut); + dto.setCertCategory(certCategory); + + // 控件类型 + String controlType = dto.getControlType(); + validateMustAndLength(controlType, "控件类型", IsMustEnum.YES.getValue(), "50",errorMsg, countError, false, cut); + getCodeByName(controlType,"控件类型","enum",controlTypeEnumMap,null,null,errorMsg,countError,cut); + dto.setControlType(controlType); + + // 控件备选值 + String controlValues = dto.getControlValues(); + validateMustAndLength(controlValues, "控件备选值", IsMustEnum.YES.getValue(), "500",errorMsg, countError, false, cut); + + // 控件校验 + String controlVerify = dto.getControlVerify(); + validateMustAndLength(controlVerify, "控件校验", IsMustEnum.YES.getValue(), "50",errorMsg, countError, false, cut); + getCodeByName(controlVerify,"控件校验","enum",controlVerifyEnumMap,null,null,errorMsg,countError,cut); + dto.setControlVerify(controlVerify); + + // 附件模板 + String fileTemplateName = dto.getFileTemplateName(); + if (StringUtils.isNotBlank(fileTemplateName)) { + StringBuilder sb = new StringBuilder(); + fileTemplateName = fileTemplateName.replace(",",","); + for (String fileName : fileTemplateName.split(",")) { + List nowFileList = FileUnZip.readFileByFilename(filepath, fileName); + if (nowFileList.size() == 0) { + if(CutEnum.CN.getValue().equals(cut)) { + errorMsg += "附件模板压缩包中没有" + fileName + "文件; "; + } else { + errorMsg += "附件模板 " + fileName + "isn't present in the cabinet;"; + } + countError++; + } else { + try { + FileInputStream input = new FileInputStream(nowFileList.get(0)); + MultipartFile multipartFile = + new MockMultipartFile(nowFileList.get(0).getName(), nowFileList.get(0).getName(), "text/plain", input); + //文件存入文件表 + OSSFile ossFile = ossFileService.uploadLocal(multipartFile, "", null,null); + if (ObjectUtils.isNotEmpty(ossFile)) { + sb.append(ossFile.getId() + ","); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + String fileTemplateId = substring; + dto.setFileTemplateName(fileTemplateId); + } + } + if (countError > 0) { + stringMessage.add(errorMsg); + } + } + + for (Map.Entry> ccDtoMap : certCategoryParamsInfoEOListMap.entrySet()) { + String certCategory = ccDtoMap.getKey(); + List ccDtoList = ccDtoMap.getValue(); + for (CertCategoryParamsInfoCnImport ccDto : ccDtoList) { + //判断此行数据是否全部为空,是则不读取 + if (checkObjAllFieldsIsNull(ccDto)) { + continue; + } + + i++; + int countError = 0; //记录失败数据数量 + String errorMsg = ""; + if (CutEnum.CN.getValue().equals(cut)) { + errorMsg = certCategory + " 第" + i + "行:"; + } else { + errorMsg = i + " line:"; + } + + // nio编号 + String nioNumber = ccDto.getNioNumber(); + validateMustAndLength(nioNumber, "nio编号", IsMustEnum.YES.getValue(),"15", errorMsg, countError, false, cut); + if (StringUtils.isNotEmpty(ccDto.getNioNumber())) { + // 校验nio编号 格式:字母数字横杠(-) + String nioNumberRegex = "^[A-Za-z0-9-]+$"; + if (!nioNumber.matches(nioNumberRegex)) { + errorMsg += "nio编号格式错误,仅能为字母,数字,横杠(-)"; + countError++; + } + } + // 编号 + String paramsNumber = ccDto.getParamsNumber(); + validateMustAndLength(paramsNumber, "编号", IsMustEnum.YES.getValue(),"15", errorMsg, countError, false, cut); + // 参数名称 + String paramsName = ccDto.getParamsName(); + validateMustAndLength(paramsName, "参数名称", IsMustEnum.YES.getValue(),"30", errorMsg, countError, false, cut); + // 参数说明 + String description = ccDto.getDescription(); + validateMustAndLength(description, "参数说明", IsMustEnum.YES.getValue(),"200", errorMsg, countError, false, cut); + + if (countError > 0) { + stringMessage.add(errorMsg); + } + } + certCategoryParamsInfoEOList.addAll(ccDtoList); + } + // 校验同 nio下认证参数编号唯一 + List ccDtoAfterDistinct = certCategoryParamsInfoEOList.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> + new TreeSet<>(Comparator.comparing(o -> o.getNioNumber() + ";" + o.getCertCategory()))), ArrayList::new)); + if (ccDtoAfterDistinct.size() < certCategoryParamsInfoEOList.size()) { + stringMessage.add("导入数据中存在重复认证编号;"); + } + + + Map map = new HashMap(); + if (stringMessage.isEmpty()) { + map.put("result", true); + map.put("paramsInfoEOList", paramsInfoEOList); + map.put("certCategoryParamsInfoEOList", certCategoryParamsInfoEOList); + map.put("message", ""); + } else { + map.put("result", false); + String html = ""; + for (String message : stringMessage) { + html += message + "
"; + } + map.put("message", html); + } + return map; + } + + private void validateMustAndLength (String fieldData, String fieldName, String mustInput, String dbLength, String errorMsg, int countError, Boolean isSingle, String cut) { + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isEmpty(fieldData)) { + if(CutEnum.CN.getValue().equals(cut)) { + errorMsg += fieldName + "为必填项,不能为空;"; + } else { + errorMsg += fieldName + " is mandatory and cannot be empty;"; + } + countError++; + } + + if (StringUtils.isNotBlank(fieldData) && fieldData.length() > Long.parseLong(dbLength)) { + if(CutEnum.CN.getValue().equals(cut)) { + errorMsg += fieldName + "不能超过" + dbLength + "个字符;"; + } else { + errorMsg += fieldName + " can not be more than" + dbLength + "char;"; + } + countError++; + } + + if (isSingle) { + //判断是否是单选 + if (StringUtils.isNotBlank(fieldData) && fieldData.contains(",")) { + if (CutEnum.CN.getValue().equals(cut)) { + errorMsg += fieldName + "为单选项;"; + } else { + errorMsg += fieldName + " is single type;"; + } + countError++; + } + } + + } + + private void getCodeByName(String value, String fieldName, String type, Map enumMap, List judgeData, List coverData,String errorMsg, int countError,String cut) { + if ("treeDicCode".equals(type)) { + // 树形字典类型 + List treeNameList = judgeData; + List categoryList = coverData; + //判断数据是否匹配 + if (StringUtils.isNotBlank(value)) { + value = value.replace(",",","); + for (String valueTemp : value.split(",")) { + String lastValue = valueTemp; + if(valueTemp.contains("/")){ + lastValue = valueTemp.substring(valueTemp.lastIndexOf("/")+1); + } + if (!treeNameList.contains(lastValue)) { + if(CutEnum.CN.getValue().equals(cut)) { + errorMsg += fieldName + "中的" + lastValue + "与数据字典不匹配;"; + } else { + errorMsg += fieldName +" "+ lastValue + " does not match the data dictionary;"; + } + countError++; + } + } + } + List valueIdList = new ArrayList<>(); + //文字转ID + if (StringUtils.isNotBlank(value)) { + value = value.replace(",",","); + for (String valueTemp : value.split(",")) { + String lastValue = valueTemp; + if(valueTemp.contains("/")){ + lastValue = valueTemp.substring(valueTemp.lastIndexOf("/")+1); + } + if (treeNameList.contains(lastValue)) { + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(cut)) { + String finalLastValue = lastValue; + collect = categoryList.stream().filter(e -> e.getName().equals(finalLastValue)).collect(Collectors.toList()); + } else if(CutEnum.EN.getValue().equals(cut)) { + String finalLastValue1 = lastValue; + collect = categoryList.stream().filter(e -> e.getEnName().equals(finalLastValue1)).collect(Collectors.toList()); + } + if (collect.size() != 0) { + if(collect.size() == 1){ + valueIdList.add(collect.get(0).getId()); + } else { + for(SysCategory sysCategory : collect){ + List nameList = sysCategoryService.getParentPath(sysCategory); + List targetNameList = Arrays.asList(valueTemp.split("/")); + if(nameList.size() == targetNameList.size() && targetNameList.containsAll(nameList)) { + valueIdList.add(sysCategory.getId()); + continue; + } + } + } + } + } + } + value = StringUtils.join(valueIdList, ","); + } + + } else if ("dicCode".equals(type)) { + // 普通字典类型 + List itemNameList = judgeData; + List dictItemList = coverData; + + if (StringUtils.isNotBlank(value)) { + value = value.replace(",",","); + for (String valueTemp : value.split(",")) { + if (!itemNameList.contains(valueTemp)) { + if(CutEnum.CN.getValue().equals(cut)) { + errorMsg += fieldName + "中的" + valueTemp + "与数据字典不匹配;"; + } else{ + errorMsg += fieldName + " " + valueTemp + " does not match the data dictionary"; + } + countError++; + } + } + } + String valueId = ""; + //文字转数据字典id + if (StringUtils.isNotBlank(value)) { + value = value.replace(",",","); + for (String valueTemp : value.split(",")) { + if (itemNameList.contains(valueTemp)) { + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(cut)) { + collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(valueTemp)).collect(Collectors.toList()); + } else if(CutEnum.EN.getValue().equals(cut)) { + collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(valueTemp)).collect(Collectors.toList()); + } + valueId += collect.get(0).getItemValue() + ","; + } + } + if (StringUtils.isNotBlank(valueId)) { + value = valueId.substring(0, valueId.length() - 1); + } + } + + } else if ("enum".equals(type)) { + // 枚举类型 + if (StringUtils.isNotBlank(value)) { + if (enumMap.containsKey(value)) { + value = (String) enumMap.get(value); + } else { + if(CutEnum.CN.getValue().equals(cut)) { + errorMsg += fieldName + "中的" + value + "不正确;"; + } else{ + errorMsg += fieldName + " " + value + " is not correct"; + } + countError++; + } + } + + } + + } + + public void getTreeDictItemTextForEnExport(List paramsInfoEnExportList) { //树形数据字典 List categoryList = sysCategoryService.list(); diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java index 4c25e65b4..44728a7d7 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java @@ -56,6 +56,7 @@ public class ParamsTemplateEOServiceImpl extends ServiceImpl ids) { + // TODO 关联删除参数项 removeByIds(ids); } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/CertCategoryParamsInfoCnImport.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/CertCategoryParamsInfoCnImport.java new file mode 100644 index 000000000..f72d23fff --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/CertCategoryParamsInfoCnImport.java @@ -0,0 +1,71 @@ +package com.jero.modules.cert.template.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * @Author: liyawei + * @Description: + * @Date: Created in 19:18 2022/4/28 + */ +@Data +public class CertCategoryParamsInfoCnImport { + /**主键*/ + @ApiModelProperty(value = "主键") + private String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; + + /**编号*/ + @Excel(name = "*number", width = 15, orderNum = "2") + @ApiModelProperty(value = "编号") + private String paramsNumber; + + /**参数名称*/ + @Excel(name = "*params name", width = 15, orderNum = "3") + @ApiModelProperty(value = "参数名称") + private String paramsName; + + /**参数说明*/ + @Excel(name = "description", width = 36, orderNum = "4") + @ApiModelProperty(value = "参数说明") + private String description; + + /**nio编号*/ + @Excel(name = "*nio number", width = 15, orderNum = "1") + @ApiModelProperty(value = "nio编号") + private String nioNumber; + + /**所属认证类别*/ + @ApiModelProperty(value = "所属认证类别") + private String certCategory; + + /**参数模板id*/ + @ApiModelProperty(value = "参数模板id") + private String paramsTemplateId; +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/CertCategoryParamsInfoEnExport.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/CertCategoryParamsInfoEnExport.java index 2ab222110..f162ca4fc 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/CertCategoryParamsInfoEnExport.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/CertCategoryParamsInfoEnExport.java @@ -1,14 +1,11 @@ package com.jero.modules.cert.template.vo; import com.fasterxml.jackson.annotation.JsonFormat; -import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; -import java.util.List; - /** * @Author: liyawei * @Description: diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoCnImport.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoCnImport.java new file mode 100644 index 000000000..0af49044d --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoCnImport.java @@ -0,0 +1,80 @@ +package com.jero.modules.cert.template.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: liyawei + * @Description: + * @Date: Created in 14:00 2022/4/28 + */ +@Data +public class ParamsInfoCnImport { + + /**nio编号*/ + @Excel(name = "*nio编号", width = 15) + @ApiModelProperty(value = "nio编号") + private String nioNumber; + + /**是否必填*/ + @Excel(name = "*是否必填", width = 15) + @ApiModelProperty(value = "是否必填") + private String isMust; + + /**参数名称*/ + @Excel(name = "*参数名称", width = 15) + @ApiModelProperty(value = "参数名称") + private String paramsName; + + /**技术领域*/ + @Excel(name = "*技术领域", width = 15) + @ApiModelProperty(value = "技术领域") + private String technologyTerritory; + + /**参数批次*/ + @Excel(name = "*参数批次", width = 15) + @ApiModelProperty(value = "参数批次") + private String paramsBatch; + + /**责任领域*/ + @Excel(name = "*责任领域", width = 15) + @ApiModelProperty(value = "责任领域") + private String dutyTerritory; + + /**参数说明*/ + @Excel(name = "参数说明", width = 36) + @ApiModelProperty(value = "参数说明") + private String description; + + /**认证类别*/ + @Excel(name = "认证类别", width = 15) + @ApiModelProperty(value = "认证类别") + private String certCategory; + + /**控件类型*/ + @Excel(name = "*控件类型", width = 15) + @ApiModelProperty(value = "控件类型") + private String controlType; + + /**控件校验*/ + @Excel(name = "控件校验", width = 15) + @ApiModelProperty(value = "控件校验") + private String controlVerify; + + /**控件备选值*/ + @Excel(name = "控件备选值", width = 15) + @ApiModelProperty(value = "控件备选值") + private String controlValues; + + /**附件模板*/ + @ApiModelProperty(value = "附件模板") + private String fileTemplateConnectId; + + @Excel(name = "附件模板", width = 15) + private String fileTemplateName; //附件模板文件名 + + /**参数模板id*/ + @ApiModelProperty(value = "参数模板id") + private String paramsTemplateId; +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoEnExport.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoEnExport.java index 6a56cafdf..23004509f 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoEnExport.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoEnExport.java @@ -1,6 +1,5 @@ package com.jero.modules.cert.template.vo; -import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.jero.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModelProperty; @@ -109,14 +108,12 @@ public class ParamsInfoEnExport { private String fileTemplateConnectId; @Excel(name = "file template", width = 15) - @TableField(exist = false) private String fileTemplateName; //附件模板文件名 /**参数模板id*/ @ApiModelProperty(value = "参数模板id") private String paramsTemplateId; - @TableField(exist = false) private List certCategoryParamsInfoEnExportList; // 认证类别参数列表 diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoEnImport.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoEnImport.java new file mode 100644 index 000000000..2e0a1ba56 --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/vo/ParamsInfoEnImport.java @@ -0,0 +1,80 @@ +package com.jero.modules.cert.template.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: liyawei + * @Description: + * @Date: Created in 14:01 2022/4/28 + */ +@Data +public class ParamsInfoEnImport { + + /**nio编号*/ + @Excel(name = "*nio number", width = 15) + @ApiModelProperty(value = "nio编号") + private String nioNumber; + + /**是否必填*/ + @Excel(name = "*is must", width = 15) + @ApiModelProperty(value = "是否必填") + private String isMust; + + /**参数名称*/ + @Excel(name = "*param name", width = 15) + @ApiModelProperty(value = "参数名称") + private String paramsName; + + /**技术领域*/ + @Excel(name = "*technology territory", width = 15) + @ApiModelProperty(value = "技术领域") + private String technologyTerritory; + + /**参数批次*/ + @Excel(name = "*params batch", width = 15) + @ApiModelProperty(value = "参数批次") + private String paramsBatch; + + /**责任领域*/ + @Excel(name = "*duty territory", width = 15) + @ApiModelProperty(value = "责任领域") + private String dutyTerritory; + + /**参数说明*/ + @Excel(name = "description", width = 36) + @ApiModelProperty(value = "参数说明") + private String description; + + /**认证类别*/ + @Excel(name = "cert category", width = 15) + @ApiModelProperty(value = "认证类别") + private String certCategory; + + /**控件类型*/ + @Excel(name = "*control type", width = 15) + @ApiModelProperty(value = "控件类型") + private String controlType; + + /**控件校验*/ + @Excel(name = "control verify", width = 15) + @ApiModelProperty(value = "控件校验") + private String controlVerify; + + /**控件备选值*/ + @Excel(name = "control values", width = 15) + @ApiModelProperty(value = "控件备选值") + private String controlValues; + + /**附件模板*/ + @ApiModelProperty(value = "附件模板") + private String fileTemplateConnectId; + + @Excel(name = "file template", width = 15) + private String fileTemplateName; //附件模板文件名 + + /**参数模板id*/ + @ApiModelProperty(value = "参数模板id") + private String paramsTemplateId; +} diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/SysCategoryMapper.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/SysCategoryMapper.java index ff0b20a30..f84049e32 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/SysCategoryMapper.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/SysCategoryMapper.java @@ -40,4 +40,6 @@ public interface SysCategoryMapper extends BaseMapper { public void updateDictDelFlag(@Param("flag") int delFlag, @Param("id") String id); public String getFieldInfo(@Param("fieldName") String fieldName); + + List queryByTreeDicCode( @Param("dicCode") String dicCode); } diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/SysCategoryMapper.xml b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/SysCategoryMapper.xml index 67ecf593f..e14cd1bf6 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/SysCategoryMapper.xml +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/mapper/xml/SysCategoryMapper.xml @@ -43,4 +43,10 @@ and is_model = 1 and is_delete = 0 + + diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysCategoryService.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysCategoryService.java index 4f0f3057e..9e95752fe 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysCategoryService.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/ISysCategoryService.java @@ -83,4 +83,6 @@ public interface ISysCategoryService extends IService { * @param id */ public void updateDictDelFlag(int delFlag,String id); + + List queryByTreeDicCode(String dicCode); } diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysCategoryServiceImpl.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysCategoryServiceImpl.java index 043b84843..3b61ad3a9 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysCategoryServiceImpl.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/service/impl/SysCategoryServiceImpl.java @@ -291,4 +291,9 @@ public class SysCategoryServiceImpl extends ServiceImpl queryByTreeDicCode(String dicCode) { + return sysCategoryMapper.queryByTreeDicCode(dicCode); + } }