123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- package com.persagy.proxy.adm.controller;
- import cn.hutool.core.collection.CollUtil;
- import com.persagy.dmp.define.entity.ObjectInfoCollect;
- import com.persagy.proxy.adm.constant.AdmDictConstant;
- import com.persagy.proxy.adm.constant.enums.AdmDictCategoryEnum;
- import com.persagy.proxy.adm.model.*;
- import com.persagy.proxy.adm.request.AdmCreateRequest;
- import com.persagy.proxy.adm.request.AdmQueryCriteria;
- import com.persagy.proxy.adm.request.AdmResponse;
- import com.persagy.proxy.adm.service.IAdmDictService;
- import com.persagy.proxy.adm.utils.AdmContextUtil;
- import com.persagy.proxy.common.entity.InstanceUrlParam;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.commons.lang.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * @ClassName AdmDictController
- * @Description: 字典查询
- * @Author linhuili
- * @Date 2021/8/31 18:21
- * @Version V1.0
- **/
- @RestController
- @RequestMapping("/dict")
- @Slf4j
- public class AdmDictController {
- @Autowired
- private IAdmDictService service;
- /**
- * 字典类型查询:所有设备类型、部件类型、系统类型、专业类型
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/category")
- public AdmResponse queryCategory(@RequestBody AdmDict request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- if(StringUtils.isEmpty(request.getType())){
- throw new Exception("type不能为空");
- }
- return service.queryCategory(context,request,AdmObjectType.class);
- }
- /**
- * 批量处理字典信息操作:方案设定(BDTP暂不支持)
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/dict-batch")
- public AdmResponse dictBatch( @RequestBody AdmCreateRequest<AdmDictBatch> request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- //方案设定:方案id :全新设定(schemeZero)、方案1(schemeOne)、方案2(schemeTwo),
- //"注意SchemeId为必填字段 ,优先级在列表中[R,S,M] ,一级标签[技术参数,基本参数] 列表为String类型
- return AdmResponse.success(new ArrayList<>());
- }
- /**
- * 查询项目下类型的信息点
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/query")
- public AdmResponse query(@RequestBody AdmDictQueryCriteria request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- request.setName(request.getType());
- return service.query(context, request, AdmDictConstant.CLASS_CODE, AdmObjectInfo.class);
- }
- /**
- * 查询设备对应的设备族(废弃)
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/family/query")
- @Deprecated
- public AdmResponse familyQuery(@RequestBody AdmQueryCriteria request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- return AdmResponse.success(new ArrayList<>());
- }
- /**
- * 重置项目下所有得定制信息点
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/reset-dic")
- public AdmResponse resetDic(@RequestBody AdmDictQueryCriteria request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- return service.resetDic(context,request,null,AdmObjectInfo.class);
- }
- /**
- * 根据类型,项目id重置信息点
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/reset-type")
- public AdmResponse resetType(@RequestBody AdmDictQueryCriteria request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- if(StringUtils.isEmpty(request.getType())){
- throw new Exception("type不能为空");
- }
- request.setName(request.getType());
- return service.resetDic(context,request,AdmDictConstant.CLASS_CODE,AdmObjectInfo.class);
- }
- /**
- * 设置-项目定制化字典
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/setting-dic-project")
- public AdmResponse settingDicProject(@RequestBody AdmCreateRequest<AdmDefFuncIdGather> request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- return service.settingDicProject(context,request, ObjectInfoCollect.class);
- }
- /**
- * 查询项目下已有的设备类型带系统
- * @param projectId
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/system/equip/category")
- @Deprecated
- public AdmResponse querySystemEquipCategory(@RequestBody AdmDict request) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- request.setType(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue());
- return service.queryCategory(context,request,AdmObjectType.class);
- }
- /**
- * 查询类型下所有字典信息 M 和 L 类型,包括自定义信息点
- * @param projectId
- * @param dictTypeList
- * @return
- * @throws Exception
- */
- @PostMapping("/morl/query")
- @Deprecated
- public AdmResponse queryMorlDict(@RequestBody List<String> dictTypeList) throws Exception {
- // 组装上下文条件
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
- if(CollUtil.isEmpty(dictTypeList)){
- return AdmResponse.success(new ArrayList<>());
- }
- //查询指定类型下的信息点
- return service.queryMorlDict(context,dictTypeList);
- }
- /**
- * 获取不能同步到物理世界对象的数量
- * @param request
- * @return
- * @throws Exception
- */
- @PostMapping("/data-count")
- @Deprecated
- public AdmResponse queryNotSyncDmpObjects(@RequestBody AdmDictQueryCriteria request) throws Exception {
- return AdmResponse.success(new ArrayList<>());
- }
- /**
- * 需采集信息同步到所有项目
- * @return
- * @throws Exception
- */
- @GetMapping("/syn-dic-project")
- @Deprecated
- public AdmResponse syncProjectObjectInfo() throws Exception {
- return AdmResponse.success(new ArrayList<>());
- }
- }
|