Jelajahi Sumber

excel 删除空行 编码、关联编码循环嵌套

lenovodn 2 tahun lalu
induk
melakukan
b88ee52b72

+ 3 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/MedicalInsRuleInfoController.java

@@ -412,10 +412,10 @@ public class MedicalInsRuleInfoController extends JeecgController<MedicalInsRule
     @ApiOperation(value = "medical_ins_rule_info-通过id删除", notes = "medical_ins_rule_info-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
-        List<MedicalInsRuleProject> list = projectService.lambdaQuery().eq(MedicalInsRuleProject::getMedicalInsRuleInfoId, id).list();
-        if(list.size()>0){
+        Long count = projectService.lambdaQuery().eq(MedicalInsRuleProject::getMedicalInsRuleInfoId, id).count();
+        Long factorCount = enchanceService.lambdaQuery().eq(FactorEnchance::getFactorCatalog, id).count();
+        if(count>0 || factorCount>0){
             return Result.error("有医保规则数据,不能删除!");
-
         }
         medicalInsRuleInfoService.removeById(id);
         return Result.OK("删除成功!");

+ 16 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/MedicalInsRuleInfo.java

@@ -133,4 +133,20 @@ public class MedicalInsRuleInfo implements Serializable {
 
     @TableField(exist = false)
     private String medicalDiagnoseCode;
+
+
+//    @Excel(name = "医疗总发生费用", width = 15)
+//    @ApiModelProperty(value = "医疗总发生费用")
+//    private java.lang.Double medfeeSumamt;
+//    @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 inHospDate;
+//    @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 outHospDate;
+//    @ApiModelProperty(value = "入院床位")
+//    private java.lang.String admBed;
+
 }

+ 87 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/MedicalInsRuleProjectServiceImpl.java

@@ -5,8 +5,10 @@ import com.alibaba.fastjson.util.BiFunction;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import net.sf.saxon.expr.instruct.Copy;
 import net.sf.saxon.s9api.TeeDestination;
 import net.sf.saxon.value.IntegerValue;
+import org.apache.poi.ss.formula.functions.T;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.exception.JeecgBootException;
@@ -20,6 +22,7 @@ import org.jeecg.modules.medical.common.bo.ExportRuleFieldDTO;
 import org.jeecg.modules.medical.common.bo.ExportRuleTitleDTO;
 import org.jeecg.modules.medical.entity.MaterialItems;
 import org.jeecg.modules.medical.entity.MedicalInsRuleProject;
+import org.jeecg.modules.medical.entity.MedicalInsRuleProjectDiagnose;
 import org.jeecg.modules.medical.mapper.MedicalInsRuleProjectMapper;
 import org.jeecg.modules.medical.service.IMedicalInsRuleProjectDiagnoseService;
 import org.jeecg.modules.medical.service.IMedicalInsRuleProjectService;
@@ -34,6 +37,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.jeecgframework.poi.util.PoiPublicUtil;
 import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -290,15 +294,16 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
                     log.error("模板不正确,缺少字段={}", jsonString);
                     throw new JeecgBootException("导入模板不正确,缺少字段" + jsonString);
                 }
-
-
 //                List<MedicalInsRuleProject> list = ExcelImportUtil.importExcel(file.getInputStream(), MedicalInsRuleProject.class, params);
                 List<MedicalInsRuleProject> list = DefaultExcelImportUtil
                         .importExcel(file.getInputStream(), MedicalInsRuleProject.class, params);
+
                 if (CollectionUtils.isEmpty(list)) {
                     log.error("导入文件没有数据,请检查");
                     return Result.ok("上传的文件没有数据,请检查");
                 }
+                list.removeIf(Objects::isNull);
+
                 //去空格 medicalDiagnoseCode   correlationMedicalDiagnoseCode
                 list.forEach(it -> {
                     DefaultExcelImportUtil.objectToTrim(it);
@@ -317,7 +322,9 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
                     this.saveBatch(list, 500);
                     return Result.ok("文件导入成功!数据行数:" + list.size());
                 }
-
+                boolean hasCode = false;
+                boolean hasCorrelationCode = false;
+                List<MedicalInsRuleProject> resultList = new ArrayList<>();
                 for (MedicalInsRuleProject item : list) {
                     String projectCode = item.getProjectCode();
                     String correlationProjectCode = item.getCorrelationProjectCode();
@@ -335,8 +342,42 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
                             throw new JeecgBootException("数据关联项目编号为空,关联项目编号必填,请检查!");
                         }
                     }
+
+                    hasCode = projectCode.contains("\n");
+                    hasCorrelationCode = correlationProjectCode.contains("\n");
+                    if(hasCode||hasCorrelationCode){
+                        List<String> codeArr = Arrays.asList(projectCode.split("\n"));
+                        List<String> nameArr = Arrays.asList(item.getProjectName().split("\n"));
+                        List<MedicalInsRuleProject> codeList = new ArrayList<>();
+                        int size = Math.min(codeArr.size(), nameArr.size());
+                        for (int i = 0; i < size; i++) {
+                            String code = codeArr.get(i);
+                            String name = nameArr.get(i);
+                            MedicalInsRuleProject project = new MedicalInsRuleProject();
+                            BeanUtils.copyProperties(item,project);
+                            project.setProjectCode(code);
+                            project.setProjectName(name);
+                            codeList.add(project);
+                        }
+
+                        List<String> relatedCodeArr = Arrays.asList(correlationProjectCode.split("\n"));
+                        List<String> relatedNameArr = Arrays.asList(item.getCorrelationProjectName().split("\n"));
+                        List<MedicalInsRuleProject> relatedCodeList = new ArrayList<>();
+                        int relatedSize = Math.min(relatedCodeArr.size(), relatedNameArr.size());
+                        for (int i = 0; i < relatedSize; i++) {
+                            String code = relatedCodeArr.get(i);
+                            String name = relatedNameArr.get(i);
+                            MedicalInsRuleProject project = new MedicalInsRuleProject();
+
+                            project.setCorrelationProjectCode(code);
+                            project.setCorrelationProjectName(name);
+                            relatedCodeList.add(project);
+                        }
+                        list = generateDataRecords(codeList, relatedCodeList);
+                    }
                 }
 
+
                 // 去重
                 // 倒序去重
                 List<MedicalInsRuleProject> collect = list.stream().map(item -> item).collect(Collectors.toList());
@@ -459,6 +500,49 @@ public class MedicalInsRuleProjectServiceImpl extends ServiceImpl<MedicalInsRule
     }
 
 
+
+    private static List<MedicalInsRuleProject> generateDataRecords(List<MedicalInsRuleProject> projectCodesAndNames, List<MedicalInsRuleProject> correlationProjectCodesAndNames) {
+        List<MedicalInsRuleProject> resultList = new ArrayList<>();
+        for (MedicalInsRuleProject project : projectCodesAndNames) {
+            for (MedicalInsRuleProject relatedProject : correlationProjectCodesAndNames) {
+                MedicalInsRuleProject result = new MedicalInsRuleProject();
+                BeanUtils.copyProperties(project,result);
+                result.setCorrelationProjectCode(relatedProject.getCorrelationProjectCode());
+                result.setCorrelationProjectName(relatedProject.getCorrelationProjectName());
+                resultList.add(result);
+            }
+        }
+
+        return resultList;
+    }
+
+    public static <T> List<T> removeEmptyRows(List<T> list) {
+        List<T> filteredList = new ArrayList<>();
+        Iterator<T> iterator = list.iterator();
+        while (iterator.hasNext()) {
+            T item = iterator.next();
+            if (!isRowEmpty(item)) {
+                filteredList.add(item);
+            }
+        }
+        return filteredList;
+    }
+
+    private static <T> boolean isRowEmpty(T row) {
+        for (java.lang.reflect.Field field : row.getClass().getDeclaredFields()) {
+            field.setAccessible(true);
+            try {
+                Object value = field.get(row);
+                if (value != null) {
+                    return false;
+                }
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        return true;
+    }
+
     private String getDuplicateRm(MedicalInsRuleProject medicalInsRuleProject) {
 //        log.info("调试信息,输入id={}, projectCode={}, corren={}", medicalInsRuleProject.getId(), medicalInsRuleProject.getCode(),
 //                medicalInsRuleProject.getCorrelationProjectCode());

+ 94 - 53
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/utils/DefaultExcelImportServer.java

@@ -76,38 +76,70 @@ public class DefaultExcelImportServer extends ImportBaseService {
      * @param params
      */
     private void addListContinue(Object object, ExcelCollectionParams param, Row row, Map<Integer, String> titlemap, String targetId, Map<String, PictureData> pictures, ImportParams params) throws Exception {
-        Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[] {});
+        Collection collection = (Collection) PoiPublicUtil.getMethod(param.getName(), object.getClass()).invoke(object, new Object[]{});
         Object entity = PoiPublicUtil.createObject(param.getType(), targetId);
         String picId;
         boolean isUsed = false;// 是否需要加上这个对象
         for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) {
-            Cell cell = row.getCell(i);
-            String titleString = (String) titlemap.get(i);
-            if (param.getExcelParams().containsKey(titleString)) {
-                if (param.getExcelParams().get(titleString).getType() == 2) {
-                    picId = row.getRowNum() + "_" + i;
-                    saveImage(object, picId, param.getExcelParams(), titleString, pictures, params);
-                } else {
-                    saveFieldValue(params, entity, cell, param.getExcelParams(), titleString, row);
+
+                Cell cell = row.getCell(i);
+                String titleString = (String) titlemap.get(i);
+                if (param.getExcelParams().containsKey(titleString)) {
+                    if (param.getExcelParams().get(titleString).getType() == 2) {
+                        picId = row.getRowNum() + "_" + i;
+                        saveImage(object, picId, param.getExcelParams(), titleString, pictures, params);
+                    } else {
+                        saveFieldValue(params, entity, cell, param.getExcelParams(), titleString, row);
+                    }
+                    isUsed = true;
                 }
-                isUsed = true;
             }
-        }
+
         if (isUsed) {
             collection.add(entity);
         }
     }
 
+    public static boolean isEmptyRow(Row row) {
+        //行不存在
+        if (row == null) {
+            return true;
+        }
+        //第一个列位置
+        int firstCellNum = row.getFirstCellNum();
+        //最后一列位置
+        int lastCellNum = row.getLastCellNum();
+        //空列数量
+        int nullCellNum = 0;
+        for (int c = firstCellNum; c < lastCellNum; c++) {
+            Cell cell = row.getCell(c);
+            if (null == cell || CellType.BLANK == cell.getCellType()) {
+                nullCellNum++;
+                continue;
+            }
+            cell.setCellType(CellType.STRING);
+            String cellValue = cell.getStringCellValue().trim();
+            if (StringUtils.isEmpty(cellValue)) {
+                nullCellNum++;
+            }
+        }
+        //所有列都为空
+        if (nullCellNum == (lastCellNum - firstCellNum)) {
+            return true;
+        }
+        return false;
+    }
+
     /**
      * 获取key的值,针对不同类型获取不同的值
      *
-     * @Author JEECG
-     * @date 2013-11-21
      * @param cell
      * @return
+     * @Author JEECG
+     * @date 2013-11-21
      */
     private String getKeyValue(Cell cell) {
-        if(cell==null){
+        if (cell == null) {
             return null;
         }
         Object obj = null;
@@ -147,6 +179,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
         }
         return excelImportEntity.getSaveUrl();
     }
+
     //update-begin--Author:xuelin  Date:20171205 for:TASK #2098 【excel问题】 Online 一对多导入失败--------------------
     private <T> List<T> importExcel(Collection<T> result, Sheet sheet, Class<?> pojoClass, ImportParams params, Map<String, PictureData> pictures) throws Exception {
         List collection = new ArrayList();
@@ -189,7 +222,11 @@ public class DefaultExcelImportServer extends ImportBaseService {
             // 判断是集合元素还是不是集合元素,如果是就继续加入这个集合,不是就创建新的对象
             //update-begin--Author:xuelin  Date:20171206 for:TASK #2451 【excel导出bug】online 一对多导入成功, 但是现在代码生成后的一对多online导入有问题了
             Cell keyIndexCell = row.getCell(params.getKeyIndex());
-            if (excelCollection.size()>0 && StringUtils.isEmpty(getKeyValue(keyIndexCell)) && object != null && !Map.class.equals(pojoClass)) {
+            boolean emptyRow = isEmptyRow(row);
+            if(emptyRow){
+                continue;
+            }
+            if (excelCollection.size() > 0 && StringUtils.isEmpty(getKeyValue(keyIndexCell)) && object != null && !Map.class.equals(pojoClass)) {
                 //update-end--Author:xuelin  Date:20171206 for:TASK #2451 【excel导出bug】online 一对多导入成功, 但是现在代码生成后的一对多online导入有问题了
                 for (ExcelCollectionParams param : excelCollection) {
                     addListContinue(object, param, row, titlemap, targetId, pictures, params);
@@ -200,12 +237,12 @@ public class DefaultExcelImportServer extends ImportBaseService {
                 try {
                     //update-begin-author:taoyan date:20200303 for:导入图片
                     int firstCellNum = row.getFirstCellNum();
-                    if(firstCellNum>minColumnIndex){
+                    if (firstCellNum > minColumnIndex) {
                         firstCellNum = minColumnIndex;
                     }
                     int lastCellNum = row.getLastCellNum();
-                    if(lastCellNum<maxColumnIndex+1){
-                        lastCellNum = maxColumnIndex+1;
+                    if (lastCellNum < maxColumnIndex + 1) {
+                        lastCellNum = maxColumnIndex + 1;
                     }
                     for (int i = firstCellNum, le = lastCellNum; i < le; i++) {
                         Cell cell = row.getCell(i);
@@ -224,16 +261,16 @@ public class DefaultExcelImportServer extends ImportBaseService {
                                 picId = row.getRowNum() + "_" + i;
                                 saveImage(object, picId, excelParams, titleString, pictures, params);
                             } else {
-                                if(params.getImageList()!=null && params.getImageList().contains(titleString)){
+                                if (params.getImageList() != null && params.getImageList().contains(titleString)) {
                                     if (pictures != null) {
                                         picId = row.getRowNum() + "_" + i;
                                         PictureData image = pictures.get(picId);
-                                        if(image!=null){
+                                        if (image != null) {
                                             byte[] data = image.getData();
                                             params.getDataHanlder().setMapValue((Map) object, titleString, data);
                                         }
                                     }
-                                }else{
+                                } else {
                                     saveFieldValue(params, object, cell, excelParams, titleString, row);
                                 }
                                 //update-end-author:taoyan date:20200303 for:导入图片
@@ -245,7 +282,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
                         addListContinue(object, param, row, titlemap, targetId, pictures, params);
                     }
                     //update-begin-author:taoyan date:20210526 for:autopoi导入excel 如果单元格被设置边框,即使没有内容也会被当做是一条数据导入 #2484
-                    if(isNotNullObject(pojoClass, object)){
+                    if (isNotNullObject(pojoClass, object)) {
                         collection.add(object);
                     }
                     //update-end-author:taoyan date:20210526 for:autopoi导入excel 如果单元格被设置边框,即使没有内容也会被当做是一条数据导入 #2484
@@ -260,18 +297,20 @@ public class DefaultExcelImportServer extends ImportBaseService {
         return collection;
     }
 
+
     /**
      * 判断当前对象不是空
+     *
      * @param pojoClass
      * @param object
      * @return
      */
-    private boolean isNotNullObject(Class pojoClass, Object object){
+    private boolean isNotNullObject(Class pojoClass, Object object) {
         try {
             Method method = pojoClass.getMethod("isNullObject");
-            if(method!=null){
+            if (method != null) {
                 Object flag = method.invoke(object);
-                if(flag!=null && true == Boolean.parseBoolean(flag.toString())){
+                if (flag != null && true == Boolean.parseBoolean(flag.toString())) {
                     return false;
                 }
             }
@@ -287,14 +326,15 @@ public class DefaultExcelImportServer extends ImportBaseService {
 
     /**
      * 获取忽略的表头信息
+     *
      * @param excelParams
      * @param params
      */
-    private void ignoreHeaderHandler(Map<String, ExcelImportEntity> excelParams,ImportParams params){
+    private void ignoreHeaderHandler(Map<String, ExcelImportEntity> excelParams, ImportParams params) {
         List<String> ignoreList = new ArrayList<>();
-        for(String key:excelParams.keySet()){
+        for (String key : excelParams.keySet()) {
             String temp = excelParams.get(key).getGroupName();
-            if(temp!=null && temp.length()>0){
+            if (temp != null && temp.length() > 0) {
                 ignoreList.add(temp);
             }
         }
@@ -320,10 +360,10 @@ public class DefaultExcelImportServer extends ImportBaseService {
         //update_begin-author:taoyan date:2020622 for:当文件行数小于代码里设置的TitleRows时headRow一直为空就会出现死循环
         int allRowNum = sheet.getPhysicalNumberOfRows();
         //找到首行表头,每个sheet都必须至少有一行表头
-        while(headRow == null && headBegin < allRowNum){
+        while (headRow == null && headBegin < allRowNum) {
             headRow = sheet.getRow(headBegin++);
         }
-        if(headRow==null){
+        if (headRow == null) {
             throw new Exception("不识别该文件");
         }
         //update-end-author:taoyan date:2020622 for:当文件行数小于代码里设置的TitleRows时headRow一直为空就会出现死循环
@@ -331,7 +371,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
         //设置表头行数
         if (ExcelUtil.isMergedRegion(sheet, headRow.getRowNum(), 0)) {
             params.setHeadRows(2);
-        }else{
+        } else {
             params.setHeadRows(1);
         }
         cellTitle = headRow.cellIterator();
@@ -353,7 +393,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
         }
 
         //多行表头
-        for (int j = headBegin; j < headBegin + params.getHeadRows()-1; j++) {
+        for (int j = headBegin; j < headBegin + params.getHeadRows() - 1; j++) {
             headRow = sheet.getRow(j);
             cellTitle = headRow.cellIterator();
             while (cellTitle.hasNext()) {
@@ -362,20 +402,20 @@ public class DefaultExcelImportServer extends ImportBaseService {
                 if (StringUtils.isNotEmpty(value)) {
                     int columnIndex = cell.getColumnIndex();
                     //当前cell的上一行是否为合并单元格
-                    if(ExcelUtil.isMergedRegion(sheet, cell.getRowIndex()-1, columnIndex)){
-                        collectionName = ExcelUtil.getMergedRegionValue(sheet, cell.getRowIndex()-1, columnIndex);
-                        if(params.isIgnoreHeader(collectionName)){
+                    if (ExcelUtil.isMergedRegion(sheet, cell.getRowIndex() - 1, columnIndex)) {
+                        collectionName = ExcelUtil.getMergedRegionValue(sheet, cell.getRowIndex() - 1, columnIndex);
+                        if (params.isIgnoreHeader(collectionName)) {
                             titlemap.put(cell.getColumnIndex(), value);
-                        }else{
+                        } else {
                             titlemap.put(cell.getColumnIndex(), collectionName + "_" + value);
                         }
-                    }else{
+                    } else {
                         //update-begin-author:taoyan date:20220112 for: JT640 【online】导入 无论一对一还是一对多 如果子表只有一个字段 则子表无数据
                         // 上一行不是合并的情况下另有一种特殊的场景: 如果当前单元格和上面的单元格同一列 即子表字段只有一个 所以标题没有出现跨列
                         String prefixTitle = titlemap.get(cell.getColumnIndex());
-                        if(prefixTitle!=null && !"".equals(prefixTitle)){
-                            titlemap.put(cell.getColumnIndex(), prefixTitle + "_" +value);
-                        }else{
+                        if (prefixTitle != null && !"".equals(prefixTitle)) {
+                            titlemap.put(cell.getColumnIndex(), prefixTitle + "_" + value);
+                        } else {
                             titlemap.put(cell.getColumnIndex(), value);
                         }
                         //update-end-author:taoyan date:20220112 for: JT640 【online】导入 无论一对一还是一对多 如果子表只有一个字段 则子表无数据
@@ -401,6 +441,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
         return titlemap;
     }
     //update-end--Author:xuelin  Date:20171205 for:TASK #2098 【excel问题】 Online 一对多导入失败--------------------
+
     /**
      * 获取这个名称对应的集合信息
      *
@@ -443,18 +484,18 @@ public class DefaultExcelImportServer extends ImportBaseService {
 //			isXSSFWorkbook=false;
 //		}
         book = WorkbookFactory.create(inputstream);
-        if(book instanceof XSSFWorkbook){
-            isXSSFWorkbook=true;
+        if (book instanceof XSSFWorkbook) {
+            isXSSFWorkbook = true;
         }
-        LOGGER.info("  >>>  poi3升级到4.0兼容改造工作, isXSSFWorkbook = " +isXSSFWorkbook);
+        LOGGER.info("  >>>  poi3升级到4.0兼容改造工作, isXSSFWorkbook = " + isXSSFWorkbook);
         //end-------author:liusq------date:20210129-----for:-------poi3升级到4兼容改造工作【重要敏感修改点】--------
 
         //begin-------author:liusq------date:20210313-----for:-------多sheet导入改造点--------
         //获取导入文本的sheet数
         //update-begin-author:taoyan date:20211210 for:https://gitee.com/jeecg/jeecg-boot/issues/I45C32 导入空白sheet报错
-        if(params.getSheetNum()==0){
+        if (params.getSheetNum() == 0) {
             int sheetNum = book.getNumberOfSheets();
-            if(sheetNum>0){
+            if (sheetNum > 0) {
                 params.setSheetNum(sheetNum);
             }
         }
@@ -488,8 +529,8 @@ public class DefaultExcelImportServer extends ImportBaseService {
         }
         return new ExcelImportResult(result, verfiyFail, book);
     }
+
     /**
-     *
      * @param is
      * @return
      * @throws IOException
@@ -541,7 +582,6 @@ public class DefaultExcelImportServer extends ImportBaseService {
     }
 
     /**
-     *
      * @param object
      * @param picId
      * @param excelParams
@@ -551,7 +591,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
      * @throws Exception
      */
     private void saveImage(Object object, String picId, Map<String, ExcelImportEntity> excelParams, String titleString, Map<String, PictureData> pictures, ImportParams params) throws Exception {
-        if (pictures == null || pictures.get(picId)==null) {
+        if (pictures == null || pictures.get(picId) == null) {
             return;
         }
         PictureData image = pictures.get(picId);
@@ -560,7 +600,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
         fileName += "." + PoiPublicUtil.getFileExtendName(data);
         //update-beign-author:taoyan date:20200302 for:【多任务】online 专项集中问题 LOWCOD-159
         int saveType = excelParams.get(titleString).getSaveType();
-        if ( saveType == 1) {
+        if (saveType == 1) {
             String path = PoiPublicUtil.getWebRootPath(getSaveUrl(excelParams.get(titleString), object));
             File savefile = new File(path);
             if (!savefile.exists()) {
@@ -571,7 +611,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
             fos.write(data);
             fos.close();
             setValues(excelParams.get(titleString), object, getSaveUrl(excelParams.get(titleString), object) + "/" + fileName);
-        } else if(saveType==2) {
+        } else if (saveType == 2) {
             setValues(excelParams.get(titleString), object, data);
         } else {
             ImportFileServiceI importFileService = null;
@@ -580,7 +620,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
             } catch (Exception e) {
                 System.err.println(e.getMessage());
             }
-            if(importFileService!=null){
+            if (importFileService != null) {
                 String dbPath = importFileService.doUpload(data);
                 setValues(excelParams.get(titleString), object, dbPath);
             }
@@ -597,6 +637,7 @@ public class DefaultExcelImportServer extends ImportBaseService {
 
     /**
      * 根据文件流,获取上传的Excel的表头
+     *
      * @param inputstream
      * @param sheetIdx
      * @return
@@ -618,10 +659,10 @@ public class DefaultExcelImportServer extends ImportBaseService {
             //update_begin-author:taoyan date:2020622 for:当文件行数小于代码里设置的TitleRows时headRow一直为空就会出现死循环
             int allRowNum = sheet.getPhysicalNumberOfRows();
             //找到首行表头,每个sheet都必须至少有一行表头
-            while(headRow == null && headBegin < allRowNum){
+            while (headRow == null && headBegin < allRowNum) {
                 headRow = sheet.getRow(headBegin++);
             }
-            if(headRow==null){
+            if (headRow == null) {
                 throw new Exception("不识别该文件");
             }
             cellTitle = headRow.cellIterator();