Commit 36dc3a29 by levphon

用户数据检测

1 parent ee91b065
......@@ -74,7 +74,7 @@ import org.springframework.util.StopWatch;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -2412,14 +2412,25 @@ public class VehicleService extends AbstractCommonService {
* @return
*/
public boolean dataSniff(DataSniffBO sniffBO) {
//类型必须都检查到
Map<Integer, Integer> checkedMap = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(sniffBO.getTypes())) {
AtomicInteger vehicleCnt = new AtomicInteger();
sniffBO.getTypes().forEach(type -> {
checkedMap.put(type, null);
if (type == 1) {//车辆
vehicleCnt.set(vehicleMapper.countByUserId(sniffBO.getUserId()));
Integer cnt = vehicleMapper.countByUserId(sniffBO.getUserId());
checkedMap.put(type, cnt);
}
});
return vehicleCnt.get() <= 0;
//1、有传类型,但是没有检测到数据,则按检测不通过处理
//2、检测数据最后所有结果相加必须小于0,则为用户下面没数据
if (checkedMap.containsValue(null)) {
return false;
} else {
AtomicReference<Integer> totalCnt = new AtomicReference<>(0);
checkedMap.forEach((k, v) -> totalCnt.updateAndGet(v1 -> v1 + v));
return totalCnt.get() <= 0;
}
}
return false;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!