Pārlūkot izejas kodu

电气设备导入

guarantee-lsq 2 gadi atpakaļ
vecāks
revīzija
309364c163

+ 24 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbInfoVO.java

@@ -179,4 +179,28 @@ public class ExportSbInfoVO implements Serializable {
      */
     @Excel(name = "介质")
     private String characterType;
+
+    @Excel(name="额定电压V",styleType=1)
+    private String eddy;
+    @Excel(name="单机功率KW",styleType=1)
+    private String djgl;
+    @Excel(name="额定电流",styleType=1)
+    private String eddl;
+    @Excel(name="转速",styleType=1)
+    private String zs;
+    @Excel(name="功率因数",styleType=1)
+    private String glys;
+    @Excel(name="接线方式",styleType=1)
+    private String lxfs;
+    @Excel(name="绝缘等级",styleType=1)
+    private String jydj;
+    @Excel(name="电机效率",styleType=1)
+    private String djxl;
+    @Excel(name="防护等级",styleType=1)
+    private String fhdj;
+    @Excel(name="防爆标志",styleType=1)
+    private String fbbz;
+    @Excel(name="防爆合格证号",styleType=1)
+    private String fbhgzh;
+
 }

+ 30 - 1
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -55,6 +55,7 @@ import com.platform.dao.util.ExcelUtil;
 import com.platform.dao.util.MessageTemplateUtil;
 import com.platform.dao.util.UserUtil;
 import com.platform.dao.util.compare.FieldComparedUtils;
+import com.platform.dao.util.compare.annotation.FieldCompared;
 import com.platform.dao.vo.SysUserDeptVO;
 import com.platform.dao.vo.SysUserVO;
 import com.platform.dao.vo.export.sb.ExportSbInfoVO;
@@ -63,6 +64,7 @@ import com.platform.dao.vo.query.upms.SysDeptVO;
 import com.platform.dao.vo.report.MeasureLogReportVO;
 import com.platform.dao.vo.report.SbInfoTypeReportVO;
 import com.platform.dao.vo.sb.*;
+import com.platform.office.annotation.Excel;
 import com.platform.service.base.impl.BaseServiceImpl;
 import com.platform.service.business.ActivitiBusinessService;
 import com.platform.service.check.CheckStandardService;
@@ -88,6 +90,8 @@ import org.springframework.web.multipart.MultipartFile;
 import tk.mybatis.mapper.weekend.Weekend;
 import tk.mybatis.mapper.weekend.WeekendCriteria;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -2125,7 +2129,6 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                     if (vo.getSeatNumber() == null) {
                         tempInfo.setSeatNumber(30);// 如果为空默认30天提醒
                     }
-
                     // 对必填字段进行判断
                     if (StringUtils.isBlank(vo.getPositionNo())) {
                         throw new BusinessException("第" + i + "行,位号为空,位号为必填项目,请填写;");// 编号为空,复制位号
@@ -2259,6 +2262,27 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                     tempInfo.setCreatedUserName(SecurityUtils.getUserInfo().getUsername());
                     tempInfo.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
                     tempInfo.setCreatedTime(LocalDateTime.now());
+                    // 检索自定义字段值
+                    Class clazz = vo.getClass();
+                    Field[] fields = clazz.getDeclaredFields();
+                    StringBuilder paramList = new StringBuilder();
+                    paramList.append("[");
+                    for (Field field : fields) {
+                        Method requestMethod = clazz.getMethod(getGetMethod(field.getName()));
+                        Object requestVal = requestMethod.invoke(vo);
+                        Excel excel = field.getAnnotation(Excel.class);
+                        if (excel != null && excel.styleType() == 1) {
+                            // 拼接自定义字符串
+                            paramList.append("{\"name\":\"").append(excel.name()).append("\",");
+                            paramList.append("\"content\":\"").append(requestVal).append("\"},");
+                        }
+                    }
+                    String param = paramList.toString();
+                    if(param.length() > 1){
+                        param = param.substring(0,param.length()-1);
+                    }
+                    param += "]";
+                    tempInfo.setParamList(param);
                     addList.add(tempInfo);
                 }
             }
@@ -2274,6 +2298,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         }
     }
 
+    public String getGetMethod(String fieldName){
+        char cha = fieldName.charAt(0);
+        return "get" + Character.toUpperCase(cha) + fieldName.substring(1);
+    }
+
     /**
      * 全部参数修改
      *