package com.vci.ubcs.code.controller;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.vci.ubcs.code.applyjtcodeservice.vo.BaseModelVO;
|
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
|
import com.vci.ubcs.code.dto.CodeOrderDTO;
|
import com.vci.ubcs.code.entity.CodeClassify;
|
import com.vci.ubcs.code.enumpack.CodeClassifyProcessUseEnum;
|
import com.vci.ubcs.code.service.ICodeClassifyService;
|
import com.vci.ubcs.code.service.ICodeClassifyTemplateAttrService;
|
import com.vci.ubcs.code.service.ICodeClassifyValueService;
|
import com.vci.ubcs.code.service.MdmEngineService;
|
import com.vci.ubcs.code.service.impl.FormulaServiceImpl;
|
import com.vci.ubcs.code.vo.ComponentRule;
|
import com.vci.ubcs.code.vo.pagemodel.*;
|
import com.vci.ubcs.starter.annotation.VciBusinessLog;
|
import com.vci.ubcs.starter.revision.model.BaseModel;
|
import com.vci.ubcs.starter.revision.model.TreeQueryObject;
|
import com.vci.ubcs.starter.web.pagemodel.*;
|
import io.swagger.annotations.Api;
|
import lombok.AllArgsConstructor;
|
import org.springblade.core.tool.api.R;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 主题库定义表 控制器
|
*
|
* @author xiejun
|
* @since 2023-07-24
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/codeApplySwingController")
|
@Api(value = "主题库定义表", tags = "主题库定义表接口")
|
public class CodeApplySwingController {
|
/***
|
* 分类服务对象
|
*/
|
private final ICodeClassifyService codeClassifyService;
|
/***
|
* 数据操作服务对象
|
*/
|
private final MdmEngineService mdmEngineService;
|
/***
|
* 模板属性服务
|
*/
|
private final ICodeClassifyTemplateAttrService codeClstempattrService;
|
|
/***
|
* 分类码段服务
|
*/
|
private final ICodeClassifyValueService codeClassifyValueService;
|
|
/**
|
* 公式的服务
|
*/
|
@Autowired
|
private FormulaServiceImpl formulaService;
|
/**
|
* 获取库节点信息
|
* @param libName 库节点名称
|
* @return 主题库分类显示树
|
*/
|
@GetMapping("/getRMLibByName")
|
public R<List<CodeClassifyVO>> getRMLibByName(String libName) {
|
List<CodeClassifyVO> codeClassifyVOList=codeClassifyService.getRMLibByName(libName);
|
return R.data(codeClassifyVOList) ;
|
}
|
|
/***
|
* 根据分类描述备注和库节点查询分类信息
|
* @param desc
|
* @param codeLibName
|
* @return
|
*/
|
@GetMapping("/getRMTypeByDescAndLib")
|
public R<List<CodeClassifyVO>> getRMTypeByDescAndLib(String desc,String codeLibName) {
|
List<CodeClassifyVO> codeClassifyVOList=codeClassifyService.getRMTypeByDescAndLib(desc,codeLibName);
|
return R.data(codeClassifyVOList) ;
|
}
|
|
/**
|
* 使用模板的主键获取表单的定义
|
* @param codeClassifyOid 使用模板的分类主键
|
* @return UI相关的信息(仅包含表单)
|
*/
|
@GetMapping("/getFormDefineByTemplateOid")
|
public MdmUIInfoVO getFormDefineByTemplateOid(String codeClassifyOid){
|
CodeClassifyTemplateVO usedTemplateByClassifyOid = mdmEngineService.getUsedTemplateByClassifyOid(codeClassifyOid);
|
return mdmEngineService.getFormDefineByTemplateOid(usedTemplateByClassifyOid.getOid(),codeClassifyOid);
|
}
|
|
/**
|
* 主题库分类树
|
* @param parentId 树形查询对象
|
* @return 主题库分类显示树
|
*/
|
@GetMapping("/selectCodeClassifyVOByParentId")
|
public R<List<CodeClassifyVO>> selectCodeClassifyVOByParentId(String parentId) {
|
List<CodeClassifyVO> codeClassifyVOList =codeClassifyService.selectCodeClassifyVOByParentId(parentId);
|
return R.data(codeClassifyVOList);
|
}
|
|
/**
|
* 使用分类的主键获取可以使用的模板对象
|
* @param codeClassifyOid 分类的主键
|
* @return 模板的显示对象
|
*/
|
@GetMapping("/getUsedTemplateByClassifyOid")
|
public R<CodeClassifyTemplateVO> getUsedTemplateByClassifyOid(String codeClassifyOid){
|
CodeClassifyTemplateVO codeClassifyTemplateVO=mdmEngineService.getUsedTemplateByClassifyOid(codeClassifyOid);
|
return R.data(codeClassifyTemplateVO);
|
}
|
|
/***
|
* 根據分类oid获取规则信息
|
* @param codeClassId
|
* @return
|
*/
|
@GetMapping("/getCodeRuleByClassifyFullInfo")
|
public R<CodeRuleVO> getCodeRuleByClassifyFullInfo(String codeClassId){
|
CodeRuleVO codeRuleVO=new CodeRuleVO();
|
CodeClassifyFullInfoBO classifyFullInfo = codeClassifyService.getClassifyFullInfo(codeClassId);
|
if(classifyFullInfo!=null) {
|
codeRuleVO = mdmEngineService.getCodeRuleByClassifyFullInfo(classifyFullInfo);
|
}
|
return R.data(codeRuleVO);
|
}
|
|
/***
|
* 根据属性获取枚举值
|
* @param oid
|
* @return
|
*/
|
@GetMapping("/listComboboxItems")
|
public R<List<KeyValue>> listComboboxItems(String oid){
|
List<KeyValue> keyValueList=mdmEngineService.listComboboxItems(codeClstempattrService.getObjectByOid(oid));
|
return R.data(keyValueList);
|
}
|
|
/**
|
* 分类码段码值获取
|
* @param secOid
|
* @param parentClassifyValueOid
|
* @return
|
*/
|
@GetMapping("/listCodeClassifyValueBySecOid")
|
public R<List<CodeClassifyValueVO>> listCodeClassifyValueBySecOid(String secOid,String parentClassifyValueOid){
|
List<CodeClassifyValueVO> codeClassifyValueVOS= codeClassifyValueService.listCodeClassifyValueBySecOid(secOid,parentClassifyValueOid);
|
return R.data(codeClassifyValueVOS);
|
}
|
|
/**
|
* 主题库分类树
|
* @param treeQueryObject 树形查询对象
|
* @return 主题库分类显示树
|
*/
|
@GetMapping("/treeCodeClassify")
|
public R<List<Tree>> treeCodeClassify(TreeQueryObject treeQueryObject) {
|
List<Tree> treeList = codeClassifyService.treeCodeClassify(treeQueryObject);
|
return R.data(treeList);
|
}
|
|
/**
|
* 默认的树形参照列表
|
* @param referConfigVO 参照的配置信息
|
* @return 执行的结果
|
*/
|
@GetMapping("/defaultReferTree")
|
public R<List<Tree>> defaultReferTree(UIFormReferVO referConfigVO, TreeQueryObject queryObject){
|
List<Tree> defaultReferTree= mdmEngineService.referTree(referConfigVO,queryObject);
|
return R.data(defaultReferTree);
|
}
|
|
|
/**
|
* 默认的参照列表
|
* @param referConfigVO 参照的配置信息
|
* @return 执行的结果
|
*/
|
@GetMapping("/defaultReferDataGrid")
|
public R<IPage<BaseModelVO>> defaultReferDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject){
|
IPage<BaseModelVO> iPage= mdmEngineService.referDataGrid(referConfigVO,baseQueryObject);
|
return R.data(iPage);
|
|
}
|
|
/**
|
* 获取属性组合规则的值
|
* @param componentRule 参照的配置信息
|
* @param componentRule 组合规则
|
* @return 执行的结果
|
*/
|
@GetMapping("/getValueByFormula")
|
public R<String> getValueByFormula(ComponentRule componentRule){
|
String value = formulaService.getValueByFormula(componentRule.getDataMap(),componentRule.getComponentRuleValue());
|
return R.data(value);
|
}
|
|
/**
|
* 使用分类获取对应的数据
|
* @param codeClassifyOid 分类的主键
|
* @param templateOid 模板的主键
|
* @param queryObject 基础查询对象
|
* @return 数据的信息(包含下级分类)
|
*/
|
@GetMapping("/gridTableDataByClassifyOid")
|
@VciBusinessLog(operateName = "查询主题库分类的数据")
|
public R<DataGrid<Map<String,String>>> gridTableDataByClassifyOid(String codeClassifyOid, String templateOid, BaseQueryObject queryObject){
|
//TODO后续可以定义查询模板来查询
|
return R.data(mdmEngineService.gridTableDataByClassifyOid(codeClassifyOid,templateOid,queryObject.getConditionMap(),queryObject.getPageHelper()));
|
}
|
|
/***
|
*统计子节点的个数
|
* @param parentId 父节点oid
|
* @return
|
*/
|
@GetMapping("/countChildrenByClassifyOid")
|
@VciBusinessLog(operateName = "统计子节点的个数")
|
public R<Integer> countChildrenByClassifyOid(String parentId){
|
int count= this.codeClassifyService.countChildrenByClassifyOid(parentId);
|
return R.data(count);
|
}
|
|
/**
|
* 申请编码保存
|
* @param orderDTO 编码申请相关的信息,需要有属性和码段相关的信息
|
* @return 执行结果
|
*/
|
@PostMapping("/addSaveCode")
|
@VciBusinessLog(operateName = "申请单个编码")
|
public R addSaveCode(@RequestBody CodeOrderDTO orderDTO) throws Exception {
|
return R.data(mdmEngineService.addSaveCode(orderDTO));
|
}
|
/**
|
* 申请编码保存
|
* @param orderDTO 编码申请相关的信息,需要有属性和码段相关的信息
|
* @return 执行结果
|
*/
|
@PostMapping("/checkKeyAttrOnOrderFordatas")
|
@VciBusinessLog(operateName = "申请单个编码")
|
public R checkKeyAttrOnOrderFordatas(@RequestBody CodeOrderDTO orderDTO) throws Exception {
|
return R.data(mdmEngineService.checkKeyAttrOnOrderFordatas(orderDTO));
|
}
|
|
/**
|
* 集团/企业码段判断
|
* @param classifyGroupCode 传入数据 ,classifyGroupCode:配置的中的分类顶节点
|
* @param oid 传入数据 ,选择节点的oid--,nowApplyCode:当前申请编码的分类
|
* @return 执行结果
|
*/
|
@GetMapping("/checkGroupCode")
|
@VciBusinessLog(operateName = "集团/企业码段判断")
|
public R checkGroupCode(String oid,String classifyGroupCode) throws Exception {
|
Map<String,String> codtionMap=new HashMap<>();
|
codtionMap.put("oid",oid);
|
codtionMap.put("classifyGroupCode",classifyGroupCode);
|
return mdmEngineService.checkGroupCode(codtionMap);
|
}
|
}
|