Commit b1c70315 authored by 曹盼盼's avatar 曹盼盼

设备认领或设备管理列表接口

parent bd135c67
package com.yeejoin.amos.boot.module.tzs.flc.api.feign;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.Claim;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.IdxTable;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
......@@ -25,4 +25,9 @@ public interface IdxFeignService {
*/
@RequestMapping(value = "/table/{tableId}", method = RequestMethod.GET)
ResponseModel<JSONObject> queryByTableId(@PathVariable String tableId);
/**
* */
@RequestMapping(value = "/table/getPage", method = RequestMethod.GET)
ResponseModel<Page<Map<String,Object>>> getPage(@RequestParam Map map);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.feign;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@FeignClient(value = "AMOS-API-PRIVILEGE", path = "privilege")
public interface PrivilegeFeginService {
@RequestMapping(value = "/v1/agencyuser/me", method = RequestMethod.GET)
ResponseModel<AgencyUserModel> getMe();
}
......@@ -201,4 +201,13 @@ public class EquipmentCategoryController extends BaseController {
public ResponseModel<Object> creatTree() {
return ResponseHelper.buildResponse(equipmentCategoryService.creatTree());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getTable")
@ApiOperation(httpMethod = "GET", value = "设备认领和设备管理通用接口", notes = "设备认领和设备管理通用接口")
public ResponseModel<Page<Map<String,Object>>> getTable(@RequestBody Map<String,Object> map) {
return equipmentCategoryServiceImpl.getTable(map);
}
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto;
......@@ -12,7 +13,11 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.tzs.biz.fegin.PrivilegeFeign;
import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
......@@ -20,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
......@@ -47,6 +53,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper;
@Autowired
PrivilegeFeginService privilegeFeginService;
@Autowired
IdxFeignService idxFeignService;
/**
* 分页查询
*/
......@@ -242,4 +254,50 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return resultMap;
}
/**
* 获取当前登录人单位类型
*
*
* @return
*/
public JSONObject getCompanyType() {
ResponseModel<AgencyUserModel> me = privilegeFeginService.getMe();
CompanyModel companyModel = (me.getResult().getCompanys()).get(0);
JSONObject object = new JSONObject();
object.put("leve", companyModel.getLevel());
object.put("companyCode", companyModel.getCompanyCode());
return object;
}
/**
* levlel=company,是企业,如果不是都是监管单位,
* * 在接口中查询当前登录人所属单位是监管单位还是企业。
* * 如果为监管单位添加监管机构查询参数(ORG_BRANCH_CODE);
* * 如果为企业添加使用单位查询参数(USE_UNIT_CREDIT_CODE)
*/
private static final String LEVEL = "company";
public ResponseModel<Page<Map<String,Object>>> getTable(Map<String,Object> map) {
ResponseModel<Page<Map<String,Object>>> model = new ResponseModel<>();
JSONObject object = getCompanyType();
String leve = object.getString("leve");
String code = object.getString("companyCode");
if (!ValidationUtil.isEmpty(leve)) {
if (LEVEL.equals(leve)) {
//企业
map.put("USE_UNIT_CREDIT_CODE", code);
model = idxFeignService.getPage(map);
} else {
//监管单位
map.put("ORG_BRANCH_CODE", code);
model = idxFeignService.getPage(map);
}
}
return model;
}
}
\ No newline at end of file
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