Commit ec2d306a authored by 高建强's avatar 高建强

新增接口获取所属场站

parent f2c9e943
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.CompanyTreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.ListCompanyModel; import com.yeejoin.amos.boot.module.jxiop.api.dto.ListCompanyModel;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
...@@ -27,6 +29,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -27,6 +29,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @description: * @description:
...@@ -84,7 +87,31 @@ public class PrivilegeController extends BaseController{ ...@@ -84,7 +87,31 @@ public class PrivilegeController extends BaseController{
return ResponseHelper.buildResponse(date); return ResponseHelper.buildResponse(date);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/stationTree")
@ApiOperation(httpMethod = "GET",value = "查询所属场站", notes = "查询所属场站")
public ResponseModel< List<ListCompanyModel>> stationTree() {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long companyId = reginParams.getCompany().getSequenceNbr();
List<ListCompanyModel> data = new ArrayList();
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId);
Collection<CompanyModel> datas = de.getResult();
for (CompanyModel companyModel : datas) {
if ("area".equals(companyModel.getLevel())) {
ListCompanyModel companyModeld = new ListCompanyModel();
companyModeld.setSequenceNbr(companyModel.getSequenceNbr());
companyModeld.setCompanyName(companyModel.getCompanyName());
companyModeld.setDisabled(true);
data.add(companyModeld);
}else {
ListCompanyModel companyModeld = new ListCompanyModel();
companyModeld.setSequenceNbr(companyModel.getSequenceNbr());
companyModeld.setCompanyName(companyModel.getCompanyName());
companyModeld.setChildren(companyModel.getChildren());
data.add(companyModeld);
}
}
return ResponseHelper.buildResponse(data);
}
} }
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