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

设备列表导出优化

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