|
@@ -1,8 +1,12 @@
|
|
|
package com.benyun.core.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.benyun.core.constant.RedisContant;
|
|
|
+import com.benyun.core.dao.AttentionPoolDao;
|
|
|
+import com.benyun.core.entity.AttentionPool;
|
|
|
import com.benyun.core.entity.bo.WdCount;
|
|
|
import com.benyun.core.entity.WdInfo;
|
|
|
+import com.benyun.core.entity.bo.WdTopologicalInfoBo;
|
|
|
import com.benyun.core.entity.vo.ChannelMapAceeptVo;
|
|
|
import com.benyun.core.service.ChannelMapService;
|
|
|
import com.benyun.core.valida.ChannelAreaGroup;
|
|
@@ -18,7 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@RestController
|
|
@@ -30,6 +36,9 @@ public class ChannelMapController {
|
|
|
@Autowired
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ AttentionPoolDao attentionPoolDao;
|
|
|
+
|
|
|
@RequestMapping("/getArea")
|
|
|
public R area(@Validated(value={ChannelAreaGroup.class}) ChannelMapAceeptVo channel) {
|
|
|
String md5 = channel.getHash();
|
|
@@ -58,6 +67,9 @@ public class ChannelMapController {
|
|
|
String md5 = channel.getHash();
|
|
|
HashMap pageInfo = (HashMap) redisTemplate.boundHashOps(RedisContant.CHANNEL_MAP_LIST).get(md5);
|
|
|
if(pageInfo != null){
|
|
|
+ List<WdTopologicalInfoBo> data = (List<WdTopologicalInfoBo>) pageInfo.get("data");
|
|
|
+ attention(data);
|
|
|
+ pageInfo.put("data",data);
|
|
|
return R.ok(pageInfo);
|
|
|
}
|
|
|
|
|
@@ -66,6 +78,9 @@ public class ChannelMapController {
|
|
|
return R.fail("请求参数错误");
|
|
|
|
|
|
//4.保存到redis中
|
|
|
+ List<WdTopologicalInfoBo> data = (List<WdTopologicalInfoBo>) hashMap.get("data");
|
|
|
+ attention(data);
|
|
|
+ hashMap.put("data",data);
|
|
|
redisTemplate.boundHashOps(RedisContant.CHANNEL_MAP_LIST).put(md5,hashMap);
|
|
|
redisTemplate.expire(RedisContant.CHANNEL_MAP_LIST,RedisContant.CHANNEL_MAP_LIST_TIME, TimeUnit.MINUTES); //30分钟
|
|
|
return R.ok(hashMap);
|
|
@@ -89,4 +104,28 @@ public class ChannelMapController {
|
|
|
return R.ok(point);
|
|
|
}
|
|
|
|
|
|
+ //Todo 标记网点关注
|
|
|
+ public void attention(List<WdTopologicalInfoBo> wdTopologicalInfoBos){
|
|
|
+ List<String> collect = wdTopologicalInfoBos.stream().map(wdTopologicalInfoBo -> {
|
|
|
+ return wdTopologicalInfoBo.getCenterWdId();
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //标志是否关注
|
|
|
+ QueryWrapper<AttentionPool> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.select("wd_id");
|
|
|
+ queryWrapper1.in("wd_id",collect);
|
|
|
+ List<AttentionPool> attentionPools = attentionPoolDao.selectList(queryWrapper1);
|
|
|
+ List<String> collect1 = attentionPools.stream().map(attentionPool -> {
|
|
|
+ return attentionPool.getWdId();
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (WdTopologicalInfoBo wdTopologicalInfoBo : wdTopologicalInfoBos) {
|
|
|
+ boolean contains = collect1.contains(wdTopologicalInfoBo.getCenterWdId());
|
|
|
+ if (contains)
|
|
|
+ wdTopologicalInfoBo.setAttention(1);
|
|
|
+ else
|
|
|
+ wdTopologicalInfoBo.setAttention(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|