处理运控应用列表
parent
152856d8f9
commit
c1c3137524
|
@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,8 +73,9 @@ public class IndexDataController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/userAppList")
|
@GetMapping("/userAppList")
|
||||||
@Operation(summary = "当前用户首页数据展示模块的数据查询")
|
@Operation(summary = "当前用户首页数据展示模块的数据查询")
|
||||||
public GeneralResult userAppList(@Value(Common.REQ_CONTEXT) RequestContext requestContext) {
|
public GeneralResult userAppList(@Value(Common.REQ_CONTEXT) RequestContext requestContext,
|
||||||
return indexService.userAppList(requestContext);
|
@RequestParam(value = "trxToken", required = false) String trxToken) {
|
||||||
|
return indexService.userAppList(requestContext, trxToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@ public interface IndexService {
|
||||||
|
|
||||||
GeneralResult userDataStatic(RequestContext requestContext);
|
GeneralResult userDataStatic(RequestContext requestContext);
|
||||||
|
|
||||||
GeneralResult userAppList(RequestContext requestContext);
|
GeneralResult userAppList(RequestContext requestContext, String trxToken);
|
||||||
|
|
||||||
GeneralResult sevenDayWarnTrend(RequestContext requestContext);
|
GeneralResult sevenDayWarnTrend(RequestContext requestContext);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,9 @@ import com.bocloud.sms.entity.User;
|
||||||
import com.bocloud.sms.enums.WarnInfo;
|
import com.bocloud.sms.enums.WarnInfo;
|
||||||
import com.bocloud.sms.enums.YkInfo;
|
import com.bocloud.sms.enums.YkInfo;
|
||||||
import com.bocloud.sms.interfaces.IndexService;
|
import com.bocloud.sms.interfaces.IndexService;
|
||||||
|
import com.bocloud.sms.model.AppPerm;
|
||||||
import com.bocloud.sms.repository.UserRepository;
|
import com.bocloud.sms.repository.UserRepository;
|
||||||
|
import com.bocloud.sms.service.utils.QxUtils;
|
||||||
import com.bocloud.sms.utils.WarnUtil;
|
import com.bocloud.sms.utils.WarnUtil;
|
||||||
import com.bocloud.sms.utils.YkUtil;
|
import com.bocloud.sms.utils.YkUtil;
|
||||||
import com.megatron.common.model.GeneralResult;
|
import com.megatron.common.model.GeneralResult;
|
||||||
|
@ -32,6 +34,8 @@ public class IndexServiceImpl implements IndexService {
|
||||||
private UserRepository userRepository;
|
private UserRepository userRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnUtil warnUtil;
|
private WarnUtil warnUtil;
|
||||||
|
@Autowired
|
||||||
|
private QxUtils qxUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext) {
|
public GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext) {
|
||||||
|
@ -114,7 +118,7 @@ public class IndexServiceImpl implements IndexService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneralResult userAppList(RequestContext requestContext) {
|
public GeneralResult userAppList(RequestContext requestContext, String trxToken) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//获取所有的appList
|
//获取所有的appList
|
||||||
|
@ -127,9 +131,18 @@ public class IndexServiceImpl implements IndexService {
|
||||||
JSONObject allAppJson = JSONObject.parseObject(result, JSONObject.class);
|
JSONObject allAppJson = JSONObject.parseObject(result, JSONObject.class);
|
||||||
List<JSONObject> allAppList = JSONObject.parseObject(allAppJson.getString("list"), List.class);
|
List<JSONObject> allAppList = JSONObject.parseObject(allAppJson.getString("list"), List.class);
|
||||||
log.info("allAppList:{}", JSON.toJSONString(allAppList));
|
log.info("allAppList:{}", JSON.toJSONString(allAppList));
|
||||||
List<JSONObject> userAppList = getUserAppList(requestContext);
|
|
||||||
log.info("userAppList:{}", JSON.toJSONString(userAppList));
|
// List<JSONObject> userAppList = getUserAppList(requestContext);
|
||||||
List<String> appIdList = userAppList.stream().map(jsonObject -> jsonObject.getString("appId")).collect(Collectors.toList());
|
// log.info("userAppList:{}", JSON.toJSONString(userAppList));
|
||||||
|
// List<String> appIdList = userAppList.stream().map(jsonObject -> jsonObject.getString("appId")).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 调用权限系统接口
|
||||||
|
User user = userRepository.query(requestContext.getTarget());
|
||||||
|
log.info("user:{}", JSON.toJSONString(user));
|
||||||
|
List<AppPerm> permList = JSONArray.parseArray(qxUtils.queryApp(trxToken, user.getUserId()), AppPerm.class);
|
||||||
|
List<String> appIdList = permList.stream()
|
||||||
|
.map(AppPerm::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
log.info("appIdList:{}", JSON.toJSONString(appIdList));
|
log.info("appIdList:{}", JSON.toJSONString(appIdList));
|
||||||
for (JSONObject data : allAppList) {
|
for (JSONObject data : allAppList) {
|
||||||
if (appIdList.contains(data.getString("appId"))) {
|
if (appIdList.contains(data.getString("appId"))) {
|
||||||
|
|
Loading…
Reference in New Issue