|
@@ -12,6 +12,7 @@ import com.jjt.check.service.ICheckRecordDetailService;
|
|
|
import com.jjt.check.service.ICheckRecordService;
|
|
|
import com.jjt.check.vo.CheckExportVO;
|
|
|
import com.jjt.common.utils.IntervalUtil;
|
|
|
+import com.jjt.common.utils.StringUtils;
|
|
|
import com.jjt.common.utils.bean.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -51,7 +52,7 @@ public class CheckRecordServiceImpl implements ICheckRecordService {
|
|
|
*/
|
|
|
@Override
|
|
|
public CheckRecord selectCheckRecordByCrId(Long crId) {
|
|
|
- CheckRecord cr=new CheckRecord();
|
|
|
+ CheckRecord cr = new CheckRecord();
|
|
|
if (crId == 0L) {
|
|
|
cr = checkRecordMapper.selectCheckRecordByLast();
|
|
|
} else {
|
|
@@ -153,10 +154,15 @@ public class CheckRecordServiceImpl implements ICheckRecordService {
|
|
|
//平均值
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
|
for (BizObjMetrics om : oms) {
|
|
|
- total = total.add(om.getDValue());
|
|
|
+ if (om.getDValue() != null) {
|
|
|
+ total = total.add(om.getDValue());
|
|
|
+ }
|
|
|
}
|
|
|
BigDecimal avg = total.divide(BigDecimal.valueOf(oms.size()), 2, RoundingMode.HALF_UP);
|
|
|
- boolean flag = IntervalUtil.inNumRange(avg.floatValue(), checkConfig.getCheckRule());
|
|
|
+ boolean flag = false;
|
|
|
+ if (StringUtils.isNotEmpty(checkConfig.getCheckRule())) {
|
|
|
+ flag = IntervalUtil.inNumRange(avg.floatValue(), checkConfig.getCheckRule());
|
|
|
+ }
|
|
|
Map<String, String> pair = CheckExportVO.checkV(flag, avg.floatValue(), pos);
|
|
|
crd.setResultL(pair.get("left"));
|
|
|
crd.setResultR(pair.get("right"));
|
|
@@ -166,7 +172,10 @@ public class CheckRecordServiceImpl implements ICheckRecordService {
|
|
|
} else {
|
|
|
//发现一个就算异常
|
|
|
for (BizObjMetrics om : oms) {
|
|
|
- boolean flag = IntervalUtil.inNumRange(om.getDValue().floatValue(), checkConfig.getCheckRule());
|
|
|
+ boolean flag = false;
|
|
|
+ if (StringUtils.isNotEmpty(checkConfig.getCheckRule()) && om.getDValue() != null) {
|
|
|
+ flag = IntervalUtil.inNumRange(om.getDValue().floatValue(), checkConfig.getCheckRule());
|
|
|
+ }
|
|
|
Map<String, String> pair = CheckExportVO.checkV(true, 0f, pos);
|
|
|
crd.setResultL(pair.get("left"));
|
|
|
crd.setResultR(pair.get("right"));
|