文档库--数据字典纸中英文切换处理
This commit is contained in:
+32
-14
@@ -419,7 +419,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
dataList.get(0).entrySet().forEach(entry -> {
|
dataList.get(0).entrySet().forEach(entry -> {
|
||||||
if (fieldPullList.contains(entry.getKey())) {
|
if (fieldPullList.contains(entry.getKey())) {
|
||||||
//下拉选处理数据字典
|
//下拉选处理数据字典
|
||||||
dictItem(sysDictItems, entry, onlCgformFieldList);
|
dictItem(sysDictItems, entry, onlCgformFieldList,cut);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -614,6 +614,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
* @param map
|
* @param map
|
||||||
*/
|
*/
|
||||||
public void updateInfo(Map<String, Object> map) {
|
public void updateInfo(Map<String, Object> map) {
|
||||||
|
String cut = (String) map.get("cut");
|
||||||
if (ObjectUtils.isNotEmpty(map.get("replace_standard_id"))) {
|
if (ObjectUtils.isNotEmpty(map.get("replace_standard_id"))) {
|
||||||
map.put("replace_standard", map.get("replace_standard_id"));
|
map.put("replace_standard", map.get("replace_standard_id"));
|
||||||
}
|
}
|
||||||
@@ -642,7 +643,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
|
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
|
||||||
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
|
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
|
||||||
//更新log
|
//更新log
|
||||||
updateLog(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList);
|
updateLog(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList,cut);
|
||||||
//判断该条数据是否订阅
|
//判断该条数据是否订阅
|
||||||
|
|
||||||
|
|
||||||
@@ -742,7 +743,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
List<OnlCgformField> fieldList,
|
List<OnlCgformField> fieldList,
|
||||||
List<OnlCgformField> fieldDateList,
|
List<OnlCgformField> fieldDateList,
|
||||||
List<OnlCgformField> fieldFileList,
|
List<OnlCgformField> fieldFileList,
|
||||||
List<OnlCgformField> fieldPullList) {
|
List<OnlCgformField> fieldPullList,
|
||||||
|
String cut) {
|
||||||
Map<String, Object> mapTemp = new HashMap<>();
|
Map<String, Object> mapTemp = new HashMap<>();
|
||||||
mapCopy(map, mapTemp);
|
mapCopy(map, mapTemp);
|
||||||
//时间类型的字段
|
//时间类型的字段
|
||||||
@@ -760,14 +762,14 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
.filter(e -> entry.getKey().equals(e.getDictField()))
|
.filter(e -> entry.getKey().equals(e.getDictField()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//下拉选处理数据字典
|
//下拉选处理数据字典
|
||||||
dictItem(sysDictItems, entry, collect);
|
dictItem(sysDictItems, entry, collect,cut);
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, Object> entry : mapTemp.entrySet()) {
|
for (Map.Entry<String, Object> entry : mapTemp.entrySet()) {
|
||||||
List<OnlCgformField> collect = fieldPullList.stream()
|
List<OnlCgformField> collect = fieldPullList.stream()
|
||||||
.filter(e -> entry.getKey().equals(e.getDictField()))
|
.filter(e -> entry.getKey().equals(e.getDictField()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//下拉选处理数据字典
|
//下拉选处理数据字典
|
||||||
dictItem(sysDictItems, entry, collect);
|
dictItem(sysDictItems, entry, collect,cut);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -1058,6 +1060,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IPage getInfoPage(Map<String, Object> parameter) {
|
public IPage getInfoPage(Map<String, Object> parameter) {
|
||||||
|
String cut = (String) parameter.get("cut");//中英文切换标识
|
||||||
//需要查询的字段
|
//需要查询的字段
|
||||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList("1");
|
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList("1");
|
||||||
if (fieldList.size() != 0) {
|
if (fieldList.size() != 0) {
|
||||||
@@ -1100,7 +1103,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
.filter(e -> entry.getKey().equals(e.getDictField()))
|
.filter(e -> entry.getKey().equals(e.getDictField()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//下拉选处理数据字典
|
//下拉选处理数据字典
|
||||||
dictItem(sysDictItems, entry, collect);
|
dictItem(sysDictItems, entry, collect,cut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//收藏和订阅
|
//收藏和订阅
|
||||||
@@ -1218,13 +1221,14 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
* @param entry
|
* @param entry
|
||||||
* @param collect
|
* @param collect
|
||||||
*/
|
*/
|
||||||
private void dictItem(List<SysDictItem> sysDictItems, Map.Entry<String, Object> entry, List<OnlCgformField> collect) {
|
private void dictItem(List<SysDictItem> sysDictItems, Map.Entry<String, Object> entry, List<OnlCgformField> collect,String cut) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//通过dictField判断字段是否为下拉选(不为空则为下拉选)
|
//通过dictField判断字段是否为下拉选(不为空则为下拉选)
|
||||||
if (collect.size() != 0 && StringUtils.isNotBlank(collect.get(0).getDictField())) {
|
if (collect.size() != 0 && StringUtils.isNotBlank(collect.get(0).getDictField())) {
|
||||||
String value = (String) entry.getValue();
|
String value = (String) entry.getValue();
|
||||||
//数据字典中文
|
//数据字典中文
|
||||||
List<String> dictItemsCh = new ArrayList<>();
|
List<String> dictItemsCh = new ArrayList<>();
|
||||||
|
List<String> dictItemsEn = new ArrayList<>();
|
||||||
if (StringUtils.isNotBlank(value)) {
|
if (StringUtils.isNotBlank(value)) {
|
||||||
for (String itemValue : value.split(",")) {
|
for (String itemValue : value.split(",")) {
|
||||||
//字段的数据字典
|
//字段的数据字典
|
||||||
@@ -1236,13 +1240,23 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
.filter(e -> itemValue.equals(e.getItemValue()))
|
.filter(e -> itemValue.equals(e.getItemValue()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (dictItems.size() != 0) {
|
if (dictItems.size() != 0) {
|
||||||
List<String> itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList());
|
List<String> itemText = new ArrayList<>();
|
||||||
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
|
itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList());
|
||||||
|
}else {
|
||||||
|
itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList());
|
||||||
|
}
|
||||||
dictItemsCh.addAll(itemText);
|
dictItemsCh.addAll(itemText);
|
||||||
|
dictItemsEn.addAll(itemText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entry.setValue(StringUtils.join(dictItemsCh, ","));
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
|
entry.setValue(StringUtils.join(dictItemsCh, ","));
|
||||||
|
}else{
|
||||||
|
entry.setValue(StringUtils.join(dictItemsEn, ","));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1330,6 +1344,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exportExcel(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request) {
|
public void exportExcel(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request) {
|
||||||
|
String cut = (String) map.get("cut");
|
||||||
//String flag = "file"为带文件导出标识
|
//String flag = "file"为带文件导出标识
|
||||||
String flag = (String) map.get("flag");
|
String flag = (String) map.get("flag");
|
||||||
// String flag = "file";
|
// String flag = "file";
|
||||||
@@ -1359,8 +1374,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
if (!"file".equals(flag)) {
|
if (!"file".equals(flag)) {
|
||||||
fieldListTemp = fieldListTemp.stream().filter(e -> !FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
fieldListTemp = fieldListTemp.stream().filter(e -> !FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
headerFieldList = fieldListTemp.stream().map(OnlCgformField::getDbFieldTxt).collect(Collectors.toList());
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
|
headerFieldList = fieldListTemp.stream().map(OnlCgformField::getDbFieldTxt).collect(Collectors.toList());
|
||||||
|
}else{
|
||||||
|
headerFieldList = fieldListTemp.stream().map(OnlCgformField::getDbFieldEnName).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//查询字段
|
//查询字段
|
||||||
List<String> conditionFieldList = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
List<String> conditionFieldList = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||||
@@ -1380,7 +1398,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
String header = StringUtils.join(headerFieldList, ",");
|
String header = StringUtils.join(headerFieldList, ",");
|
||||||
createHeader(workbook, sheet, header);
|
createHeader(workbook, sheet, header);
|
||||||
// 创建数据
|
// 创建数据
|
||||||
createDatas(workbook, sheet, datas, header, fieldListTemp);
|
createDatas(workbook, sheet, datas, header, fieldListTemp,cut);
|
||||||
|
|
||||||
if (!"file".equals(flag)) {
|
if (!"file".equals(flag)) {
|
||||||
//不带文件导出
|
//不带文件导出
|
||||||
@@ -1453,7 +1471,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createDatas(Workbook workbook, Sheet sheet, List<Map<String, Object>> datas, String header, List<OnlCgformField> fieldList) {
|
public void createDatas(Workbook workbook, Sheet sheet, List<Map<String, Object>> datas, String header, List<OnlCgformField> fieldList,String cut) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象
|
CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象
|
||||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||||
@@ -1485,7 +1503,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
.filter(e -> entry.getKey().equals(e.getDictField()))
|
.filter(e -> entry.getKey().equals(e.getDictField()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//下拉选处理数据字典
|
//下拉选处理数据字典
|
||||||
dictItem(sysDictItems, entry, collect);
|
dictItem(sysDictItems, entry, collect,cut);
|
||||||
}
|
}
|
||||||
Row row = sheet.createRow(i + 1);
|
Row row = sheet.createRow(i + 1);
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
Reference in New Issue
Block a user