|
|
@ -46,8 +46,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i |
|
|
|
private RedisCache redisCache; |
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
public void init() |
|
|
|
{ |
|
|
|
public void init() { |
|
|
|
/* |
|
|
|
添加数据到 redis 缓存 |
|
|
|
*/ |
|
|
@ -57,12 +56,10 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i |
|
|
|
/** |
|
|
|
* 添加数据到 redis 缓存 |
|
|
|
*/ |
|
|
|
public void updateRedisCache() |
|
|
|
{ |
|
|
|
public void updateRedisCache() { |
|
|
|
// 获取全部设备列表数据
|
|
|
|
List<DcDevice> dcDevices = list(); |
|
|
|
if (dcDevices == null || dcDevices.isEmpty()) |
|
|
|
{ |
|
|
|
if (dcDevices == null || dcDevices.isEmpty()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -396,39 +393,50 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i |
|
|
|
List<String> startStakeMarks = castList(parameter.get("startStakeMark"), String.class); |
|
|
|
List<String> endStakeMarks = castList(parameter.get("endStakeMark"), String.class); |
|
|
|
String deviceType = String.valueOf(parameter.get("deviceType")); |
|
|
|
Integer startStakeMark = Integer.parseInt(startStakeMarks.get(0) + startStakeMarks.get(1)); |
|
|
|
Integer endStakeMark = Integer.parseInt(endStakeMarks.get(0) + endStakeMarks.get(1)); |
|
|
|
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
ArrayList<Integer> integers = new ArrayList<>(); |
|
|
|
integers.add(6); |
|
|
|
lambdaQueryWrapper.notIn(DcDevice::getDeviceType, integers); |
|
|
|
lambdaQueryWrapper.eq(DcDevice::getDeviceType, deviceType); |
|
|
|
List<DcDevice> list = list(lambdaQueryWrapper); |
|
|
|
for (DcDevice dcDevice : list) { |
|
|
|
String stakeMark = dcDevice.getStakeMark(); |
|
|
|
Pattern pat = Pattern.compile(REGEX_CHINESE); |
|
|
|
Matcher mat = pat.matcher(stakeMark); |
|
|
|
stakeMark = mat.replaceAll(""); |
|
|
|
if (stakeMark == null || stakeMark.equals("")) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
String childType = String.valueOf(parameter.get("childType")); |
|
|
|
String deviceState = String.valueOf(parameter.get("deviceState")); |
|
|
|
DcDevice device = new DcDevice(); |
|
|
|
if (!Objects.equals(childType, "null")) { |
|
|
|
device.setChildType(childType); |
|
|
|
} |
|
|
|
if (!Objects.equals(deviceType, "null")) { |
|
|
|
device.setDeviceType(Integer.valueOf(deviceType)); |
|
|
|
} |
|
|
|
if (!Objects.equals(deviceState, "null")) { |
|
|
|
device.setDeviceState(deviceState); |
|
|
|
} |
|
|
|
List<DcDevice> list = listDevice(device); |
|
|
|
if (startStakeMarks != null && endStakeMarks != null) { |
|
|
|
Integer startStakeMark = Integer.parseInt(startStakeMarks.get(0) + startStakeMarks.get(1)); |
|
|
|
Integer endStakeMark = Integer.parseInt(endStakeMarks.get(0) + endStakeMarks.get(1)); |
|
|
|
for (DcDevice dcDevice : list) { |
|
|
|
String stakeMark = dcDevice.getStakeMark(); |
|
|
|
Pattern pat = Pattern.compile(REGEX_CHINESE); |
|
|
|
Matcher mat = pat.matcher(stakeMark); |
|
|
|
stakeMark = mat.replaceAll(""); |
|
|
|
if (stakeMark == null || stakeMark.equals("")) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if (stakeMark.startsWith("-")) { |
|
|
|
String[] split = stakeMark.replace("K", "").replace("k", "").split("-"); |
|
|
|
for (String s : split) { |
|
|
|
String[] ks = s.split("\\+"); |
|
|
|
if (stakeMark.startsWith("-")) { |
|
|
|
String[] split = stakeMark.replace("K", "").replace("k", "").split("-"); |
|
|
|
for (String s : split) { |
|
|
|
String[] ks = s.split("\\+"); |
|
|
|
double integer = Double.parseDouble(ks[0] + ks[1]); |
|
|
|
if (startStakeMark <= integer && endStakeMark >= integer) { |
|
|
|
dcDevices.add(dcDevice); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
String[] ks = stakeMark.replace("K", "").replace("k", "").split("\\+"); |
|
|
|
double integer = Double.parseDouble(ks[0] + ks[1]); |
|
|
|
if (startStakeMark <= integer && endStakeMark >= integer) { |
|
|
|
dcDevices.add(dcDevice); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
String[] ks = stakeMark.replace("K", "").replace("k", "").split("\\+"); |
|
|
|
double integer = Double.parseDouble(ks[0] + ks[1]); |
|
|
|
if (startStakeMark <= integer && endStakeMark >= integer) { |
|
|
|
dcDevices.add(dcDevice); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
dcDevices = (ArrayList<DcDevice>) list; |
|
|
|
} |
|
|
|
|
|
|
|
return dcDevices; |
|
|
|