Commit cfa59fc8 authored by 赵啸非's avatar 赵啸非

设备列表导出优化

parent ac7ec8d2
......@@ -85,7 +85,6 @@ public class TbRabbitMqProducerTemplate<T extends TbQueueMsg> implements TbQueue
if (!topicIfNotExist) {
//topic不存在创建通道队列
Map<String, Object> args = new HashMap<>();
log.info("x-message-ttl:{}", rabbitMqSettings.getMessageTtl());
args.put("x-message-ttl", Integer.parseInt(rabbitMqSettings.getMessageTtl()));
channel.queueDeclare(tpi.getTopic(), true, false, false, args);
}
......@@ -136,7 +135,6 @@ public class TbRabbitMqProducerTemplate<T extends TbQueueMsg> implements TbQueue
if (!topicIfNotExist) {
//topic不存在创建通道队列
Map<String, Object> args = new HashMap<>();
log.info("x-message-ttl:{}", rabbitMqSettings.getMessageTtl());
args.put("x-message-ttl", Integer.parseInt(rabbitMqSettings.getMessageTtl()));
channel.queueDeclare(tpi.getTopic(), true, false, false, args);
}
......
......@@ -28,7 +28,7 @@ import java.util.Map;
* @author zxfei
*/
//@Service
@Service
@Order(1)
@Slf4j
public class AuthTokenServiceImpl implements IAuthTokenService {
......
......@@ -7,6 +7,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.site.SitePdu;
......@@ -47,6 +48,8 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
private DeviceService deviceService;
@Autowired
private IUserFeign userFeign;
@Autowired
private IAuthTokenService authTokenService;
/**
* 重写带分页的方法
......@@ -117,18 +120,18 @@ public class SitestatServiceImpl extends AbstractCRUDServiceImpl<SitestatDao, Si
@Override
public String getSiteTree(Context context) {
UserPdu userPdu = new UserPdu();
userPdu.setLoginName("admin");
userPdu.setPassword("admin");
userPdu.setSecurityCode("8888");
String loginResp = userFeign.portalLogin(userPdu);
JSONObject loginRespJson = JSON.parseObject(loginResp);
String token = loginRespJson.getJSONObject("data").getString("token");
// String token = authTokenService.getToken(request);
//
// UserPdu userPdu = new UserPdu();
// userPdu.setLoginName("admin");
// userPdu.setPassword("admin");
// userPdu.setSecurityCode("8888");
// String loginResp = userFeign.portalLogin(userPdu);
// JSONObject loginRespJson = JSON.parseObject(loginResp);
// String token = loginRespJson.getJSONObject("data").getString("token");
//
String token = context.getUser().getToken();
String resp = siteFeign.siteTree(token);
log.info("treeResp:"+resp);
//log.info("treeResp:"+resp);
return resp;
}
......
package com.mortals.xhx.module.sitestat.web;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -77,8 +78,6 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
// }
}
......@@ -88,11 +87,9 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
@GetMapping(value = "siteTree")
public String siteTree() {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = this.getModuleDesc() + "构建站点树";
try {
String siteTree = this.service.getSiteTree(getContext());
return siteTree;
} catch (Exception e) {
log.error("构建站点树异常", e);
......@@ -111,11 +108,13 @@ public class SitestatController extends BaseCRUDJsonBodyMappingController<Sitest
JSONObject jsonObject = new JSONObject();
String busiDesc = this.getModuleDesc() + "构建站点列表";
try {
// TODO: 2022/7/6 管理员角色 获取所有站点列表
SitePdu sitePdu = new SitePdu();
sitePdu.setPage(1);
sitePdu.setSize(-1);
if (!getContext().getUser().isAdmin()) {
List<Long> siteIdList = StrUtil.split(getContext().getUser().getSiteIds(), ",".charAt(0), -1, true, e -> Long.parseLong(e));
sitePdu.setIdList(siteIdList);
}
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
return JSON.toJSONString(resp);
} catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment