中英文切换通用接口
This commit is contained in:
+1
@@ -8,6 +8,7 @@ package com.jero.common.constant.enums;
|
||||
public enum ModuleEnum {
|
||||
DOCUMENT_LIBRARY("文档管理","1"),
|
||||
OCR_RECORD("OCR识别转换记录表","2"),
|
||||
FILE_SPLIT("文档拆分","3"),
|
||||
ONL_CGFORM_COLLECTION("我的收藏","5"),
|
||||
ONL_CGFORM_SUBSCRIBE("我的订阅","6");
|
||||
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ package com.jero.common.constant.enums;
|
||||
public enum TableEnum {
|
||||
BUSS_DOCUMENT_LIBRARY("buss_document_library"),
|
||||
OCR_RECORD("ocr_record"),
|
||||
FILE_SPLIT("sar_file_split_info"),
|
||||
TAG("onl_cgform_tag"),
|
||||
TAG_AREA("onl_cgform_area"),
|
||||
ONL_CGFORM_COLLECTION("onl_cgform_collection"),
|
||||
|
||||
+7
-8
@@ -812,21 +812,20 @@ public class OnlCgformFieldServiceImpl extends ServiceImpl<OnlCgformFieldMapper,
|
||||
* 根据table_name查询字段
|
||||
* @return
|
||||
*/
|
||||
public List<OnlCgformField> getFieldList(String flag){
|
||||
public List<OnlCgformField> getFieldList(String flag) {
|
||||
List<OnlCgformField> fieldList = new ArrayList<>();
|
||||
if(ModuleEnum.DOCUMENT_LIBRARY.getValue().equals(flag)){
|
||||
if (ModuleEnum.DOCUMENT_LIBRARY.getValue().equals(flag)) {
|
||||
fieldList = onlCgformFieldMapper.getFieldList(TableEnum.BUSS_DOCUMENT_LIBRARY.getTable()+" ");
|
||||
}else if(ModuleEnum.OCR_RECORD.getValue().equals(flag)){
|
||||
} else if (ModuleEnum.OCR_RECORD.getValue().equals(flag)) {
|
||||
fieldList = onlCgformFieldMapper.getFieldList(TableEnum.OCR_RECORD.getTable());
|
||||
}else if(ModuleEnum.ONL_CGFORM_COLLECTION.getValue().equals(flag)){
|
||||
} else if (ModuleEnum.FILE_SPLIT.getValue().equals(flag)) {
|
||||
fieldList = onlCgformFieldMapper.getFieldList(TableEnum.FILE_SPLIT.getTable());
|
||||
} else if (ModuleEnum.ONL_CGFORM_COLLECTION.getValue().equals(flag)) {
|
||||
fieldList = onlCgformFieldMapper.getFieldList(TableEnum.ONL_CGFORM_COLLECTION.getTable());
|
||||
}else if(ModuleEnum.ONL_CGFORM_SUBSCRIBE.getValue().equals(flag)){
|
||||
} else if (ModuleEnum.ONL_CGFORM_SUBSCRIBE.getValue().equals(flag)) {
|
||||
fieldList = onlCgformFieldMapper.getFieldList(TableEnum.ONL_CGFORM_SUBSCRIBE.getTable());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return fieldList;
|
||||
}
|
||||
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.jero.modules.lanswitch.controller;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.modules.lanswitch.service.ILanguageSwitchService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description:
|
||||
* @Date: Created in 12:07 2022/3/22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/language/switch")
|
||||
@Api(tags="中英文切换通用接口")
|
||||
@Slf4j
|
||||
public class LanguageSwitchController {
|
||||
@Autowired
|
||||
private ILanguageSwitchService languageSwitchService;
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表头中英文切换")
|
||||
@ApiOperation(value="表头中英文切换", notes="表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = languageSwitchService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "查询条件中英文切换")
|
||||
@ApiOperation(value="查询条件中英文切换", notes="查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = languageSwitchService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.jero.modules.lanswitch.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description:
|
||||
* @Date: Created in 12:08 2022/3/22
|
||||
*/
|
||||
public interface ILanguageSwitchService {
|
||||
|
||||
/**
|
||||
* 列表表头中英文切换
|
||||
* @param flag
|
||||
* @param cut
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getHeader(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
* @param flag
|
||||
* @param cut
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> queryCondition(String flag, String cut);
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.jero.modules.lanswitch.service.impl;
|
||||
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.lanswitch.service.ILanguageSwitchService;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description:
|
||||
* @Date: Created in 12:08 2022/3/22
|
||||
*/
|
||||
@Service
|
||||
public class LanguageSwitchServiceImpl implements ILanguageSwitchService {
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
|
||||
/**
|
||||
* 列表表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getHeader(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是)
|
||||
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if("file_name".equals(onlCgformField.getDbFieldName())){
|
||||
//跳转详情的标识
|
||||
map.put("click","true");
|
||||
}
|
||||
//日期添加排序标识
|
||||
if ("create_time".equals(onlCgformField.getDbFieldName())) {
|
||||
map.put("sort", "true");//列表排序标识
|
||||
}
|
||||
if ("update_time".equals(onlCgformField.getDbFieldName())) {
|
||||
map.put("sort", "true");//列表排序标识
|
||||
}
|
||||
|
||||
String dbFieldName = onlCgformField.getDbFieldName();
|
||||
if (StringUtils.isNotBlank(onlCgformField.getDictField())) {
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(dbFieldName)+ "_dictText");//配置了数据字典的字段,需要特殊处理
|
||||
}else{
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(dbFieldName));//字段
|
||||
}
|
||||
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名
|
||||
}else{
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤出搜索条件()
|
||||
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等)
|
||||
map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名
|
||||
} else {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -24,7 +24,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: 文档拆分表
|
||||
* @Author: wcj
|
||||
* @Date: 2022-03-03
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
package com.jero.modules.split.service;
|
||||
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user