|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.zc.business.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
@ -12,9 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -25,7 +30,7 @@ import java.util.Map; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Transactional |
|
|
|
public class DcEventServiceImpl implements IDcEventService { |
|
|
|
public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> implements IDcEventService { |
|
|
|
@Autowired |
|
|
|
private DcEventMapper dcEventMapper; |
|
|
|
//异常天气
|
|
|
@ -576,4 +581,62 @@ public class DcEventServiceImpl implements IDcEventService { |
|
|
|
map.put("warningCount", i); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
private static String REGEX_CHINESE = "[\u4e00-\u9fa5]";// 中文正则
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DcEvent> eventPileNumberQueryEvent(Map<String, Object> parameter) { |
|
|
|
|
|
|
|
ArrayList<DcEvent> dcEvents = new ArrayList<>(); |
|
|
|
List<String> startStakeMarks = castList(parameter.get("startStakeMark"), String.class); |
|
|
|
List<String> endStakeMarks = castList(parameter.get("endStakeMark"), String.class); |
|
|
|
String eventType = String.valueOf(parameter.get("eventType")); |
|
|
|
LambdaQueryWrapper<DcEvent> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
lambdaQueryWrapper.eq(DcEvent::getEventType, eventType); |
|
|
|
List<DcEvent> list = list(lambdaQueryWrapper); |
|
|
|
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 (DcEvent dcEvent : list) { |
|
|
|
String stakeMark = dcEvent.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("\\+"); |
|
|
|
double integer = Double.parseDouble(ks[0] + ks[1]); |
|
|
|
if (startStakeMark <= integer && endStakeMark >= integer) { |
|
|
|
dcEvents.add(dcEvent); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
String[] ks = stakeMark.replace("K", "").replace("k", "").split("\\+"); |
|
|
|
double integer = Double.parseDouble(ks[0] + ks[1]); |
|
|
|
if (startStakeMark <= integer && endStakeMark >= integer) { |
|
|
|
dcEvents.add(dcEvent); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
dcEvents = (ArrayList<DcEvent>) list; |
|
|
|
} |
|
|
|
return dcEvents; |
|
|
|
} |
|
|
|
|
|
|
|
public static <T> List<T> castList(Object obj, Class<T> clazz) { |
|
|
|
List<T> result = new ArrayList<T>(); |
|
|
|
if (obj instanceof List<?>) { |
|
|
|
for (Object o : (List<?>) obj) { |
|
|
|
result.add(clazz.cast(o)); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|