Browse Source

# HZA100C参数下发功能取实时数据时爆空指针问题

zhongwei
haungxing 11 months ago
parent
commit
a2682234ba
  1. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java

8
hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java

@ -34,10 +34,7 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.*;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -100,7 +97,8 @@ public class ParamServiceImpl implements IParamService {
String realData = JSON.toJSONString(realDataR.getData().getDataMap().get(p.getSignage()));
if("0".equals(JSONObject.parseObject(realData).getString("q"))) {
String value = JSONObject.parseObject(realData).getString("v");
if(StringUtil.isNotBlank(p.getDbType()) && "double".equals(p.getDbType())) {
if(StringUtil.isNotBlank(p.getDbType()) && "double".equals(p.getDbType())
&& StringUtil.isNotBlank(value) && ObjectUtil.isNotEmpty(p.getKeepFigures())) {
value = String.valueOf(new BigDecimal(value).setScale(p.getKeepFigures(), RoundingMode.HALF_UP).doubleValue());
}
p.setValue(value);

Loading…
Cancel
Save