Commit a62e609e authored by suhuiguang's avatar suhuiguang

fix(jyjc):检验结果

1.检验结果技术参数为空时,转为null,防止字符串转数字报错
parent 495d2f5a
...@@ -46,6 +46,7 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionDetectionSaveToDbEv ...@@ -46,6 +46,7 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionDetectionSaveToDbEv
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher; import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher; import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jyjc.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jyjc.biz.util.CompareUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils; import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
...@@ -60,7 +61,6 @@ import org.apache.commons.lang3.StringUtils; ...@@ -60,7 +61,6 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -440,7 +440,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -440,7 +440,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
paramObj.forEach((k, v) -> { paramObj.forEach((k, v) -> {
DynamicColumnDto columnDto = new DynamicColumnDto(); DynamicColumnDto columnDto = new DynamicColumnDto();
columnDto.setColumnName(String.format("\"%s\"", StrUtil.toUnderlineCase(k).toUpperCase())); columnDto.setColumnName(String.format("\"%s\"", StrUtil.toUnderlineCase(k).toUpperCase()));
columnDto.setColumnValue(v == null ? null : String.valueOf(v)); columnDto.setColumnValue(v == null ? null : nullIfNullOrEmpty(String.valueOf(v)));
columns.add(columnDto); columns.add(columnDto);
}); });
String tableName = this.getTableName(param.getParamType()); String tableName = this.getTableName(param.getParamType());
...@@ -449,6 +449,16 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -449,6 +449,16 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
} }
} }
/**
* 处理将空转null 防止技术参数,数字类型在查询详情时,映射错误
*
* @param str 字符串
* @return null or 非空的字符串
*/
private String nullIfNullOrEmpty(String str) {
return CompareUtils.isNullOrEmpty(str) ? null : str;
}
private String getTableName(String paramType) { private String getTableName(String paramType) {
return String.format("\"%s\"", StrUtil.toUnderlineCase(paramType)); return String.format("\"%s\"", StrUtil.toUnderlineCase(paramType));
} }
......
package com.yeejoin.amos.boot.module.jyjc.biz.util; package com.yeejoin.amos.boot.module.jyjc.biz.util;
public class CompareUtils { public final class CompareUtils {
public static boolean isNullOrEmpty(String str) { public static boolean isNullOrEmpty(String str) {
return str == null || str.trim().isEmpty() || "null".equals(str); return str == null || str.trim().isEmpty() || "null".equalsIgnoreCase(str);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment