Преглед изворни кода

Merge remote-tracking branch 'origin/dev' into dev

liujh пре 3 година
родитељ
комит
8d20375431

+ 8 - 2
zd-common/common-core/src/main/java/com/zd/common/core/utils/ExcelUtil.java

@@ -1,12 +1,12 @@
 package com.zd.common.core.utils;
 
+import com.zd.common.core.utils.file.FileTypeUtils;
+import com.zd.common.core.utils.file.ImageUtils;
 import com.zd.common.core.utils.reflect.ReflectUtils;
 import com.zd.model.annotation.Excel;
 import com.zd.model.annotation.Excel.ColumnType;
 import com.zd.model.annotation.Excel.Type;
 import com.zd.model.annotation.Excels;
-import com.zd.common.core.utils.file.FileTypeUtils;
-import com.zd.common.core.utils.file.ImageUtils;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddressList;
@@ -16,6 +16,7 @@ import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
 import org.apache.poi.xssf.usermodel.XSSFDataValidation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.InputStream;
@@ -560,6 +561,7 @@ public class ExcelUtil<T> {
      */
     public void setCellVo(Object value, Excel attr, Cell cell) {
         if (ColumnType.STRING == attr.cellType()) {
+
             cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
         } else if (ColumnType.NUMERIC == attr.cellType()) {
             if (StringUtils.isNotNull(value)) {
@@ -945,6 +947,10 @@ public class ExcelUtil<T> {
         } else {
             wb.setSheetName(index, sheetName + index);
         }
+        CellStyle style = wb.createCellStyle();
+        DataFormat format = wb.createDataFormat();
+        style.setDataFormat(format.getFormat("@"));
+        sheet.setDefaultColumnStyle(index, style);
     }
 
     /**

+ 1 - 1
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpChemicalServiceImpl.java

@@ -161,7 +161,7 @@ public class HxpChemicalServiceImpl implements IHxpChemicalService {
         }else{
             List<SysDictData> proDictDatas = DictUtils.getDictCache("chemical_shape");
             for(SysDictData dictData : proDictDatas){
-                if(dictData.getDictLabel().equals(chemical.getChemicalShapeInfo())){
+                if(dictData.getDictLabel().equals(chemical.getChemicalShapeInfo().trim())){
                     hxpChemical.setChemicalShape(Integer.parseInt(dictData.getDictValue()));
                 }
             }

+ 1 - 1
zd-modules/zd-chemical/src/main/resources/mapper/chemical/HxpChemicalMapper.xml

@@ -90,7 +90,7 @@
         (select ccf.classify_name from hxp_chemical_classify ccf where ccf.id = hc.chemical_classify) classifyName,
         (SELECT GROUP_CONCAT(dda.dict_label) FROM sys_dict_data dda WHERE dda.dict_type = 'hxp_classifyattribute' AND
         FIND_IN_SET(dda.dict_value, hc.classify_attribute)) classifyAttribute,
-        (SELECT GROUP_CONCAT(CONCAT(dda.dict_label,'(',hc.chemical_unit,')')) FROM sys_dict_data dda WHERE dda.dict_type
+        (SELECT GROUP_CONCAT(CONCAT(dda.dict_label,'(',case when hc.chemical_unit is null then '' else hc.chemical_unit end,')')) FROM sys_dict_data dda WHERE dda.dict_type
         = 'chemical_shape' AND dda.dict_value = hc.chemical_shape) chemicalShapeInfo,
         (SELECT GROUP_CONCAT(dda.dict_label) FROM sys_dict_data dda WHERE dda.dict_type = 'chemical_shape' AND
         dda.dict_value = hc.chemical_shape) chemicalShapeInfo2,