文档库编辑时更新首页文档动态
This commit is contained in:
+2
@@ -24,6 +24,8 @@ public interface IOSSFileService extends IService<OSSFile> {
|
||||
|
||||
public List<OSSFile> getFileInfos(String id);
|
||||
|
||||
public List<OSSFile> getFileInfoAll(String id);
|
||||
|
||||
public List<OSSFile> getFileInfosByConnectId(String connectId);
|
||||
|
||||
boolean delete(OSSFile ossFile);
|
||||
|
||||
+13
@@ -290,6 +290,19 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@Override
|
||||
public List<OSSFile> getFileInfoAll(String id) {
|
||||
if (com.jero.modules.system.util.StringUtils.isEmpty(id)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
LambdaQueryWrapper<OSSFile> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(OSSFile::getId, id.split(","));
|
||||
List<OSSFile> list = this.list(wrapper);
|
||||
LambdaQueryWrapper<OSSFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(OSSFile::getConnectId, id.split(","));
|
||||
list.addAll(this.list(lambdaQueryWrapper));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OSSFile> getFileInfosByConnectId(String connectId) {
|
||||
|
||||
+149
-23
@@ -2032,6 +2032,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
List<String> serialNumberList = list.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList());
|
||||
String serialNumber = (String)map.get("serial_number");
|
||||
String id = (String) map.get("id");
|
||||
String title = (String) map.get("title");
|
||||
//通过id查询数据
|
||||
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id);
|
||||
if(dataList.size() != 0){
|
||||
@@ -2040,6 +2041,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
throw new JeroBootException("编号已存在不能重复添加");
|
||||
}
|
||||
}
|
||||
//字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
||||
//普通数据字典
|
||||
List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsAll();
|
||||
//编辑时处理首页文档动态 1. 标准XXXX的状态改为 2. 标准XXXX的适用车型改为 3. 标准XXXX删除了XXXX文件 4. 标准XXXX上传了XXXX文件
|
||||
homeDocumentDynamic(cut,map, serialNumber, id, title, dataList, fieldList,dictItemList);
|
||||
|
||||
|
||||
try {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
@@ -2063,27 +2071,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
} catch (ParseException e) {
|
||||
throw new JeroBootException(e.getMessage());
|
||||
}
|
||||
//字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
||||
//标准选择字段
|
||||
// List<OnlCgformField> standardOnlCgformFieldList = fieldList.stream()
|
||||
// .filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
// if(standardOnlCgformFieldList.size() != 0){
|
||||
// List<String> collect = standardOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
// List<String> standardList = new ArrayList<>();
|
||||
// for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
// String key = entry.getKey();
|
||||
// if(collect.contains(key)){
|
||||
// standardList.add(key);
|
||||
// }
|
||||
// }
|
||||
// if(standardList.size() != 0){
|
||||
// for (String standard : standardList) {
|
||||
// map.put(standard, map.get(standard+"_id"));
|
||||
// map.remove(standard+"_id");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
map.remove("cut");
|
||||
//获取搜索中心字段
|
||||
@@ -2121,8 +2110,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
|
||||
//树形数据字典
|
||||
List<SysCategory> categoryList = sysCategoryService.list();
|
||||
//普通数据字典
|
||||
List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsAll();
|
||||
//查询所有
|
||||
List<Map<String, Object>> listMap = bussDocumentLibraryEOMapper.selectMapsAll(null);
|
||||
|
||||
@@ -2360,6 +2347,145 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
}
|
||||
}
|
||||
|
||||
private void homeDocumentDynamic(String cut,
|
||||
Map<String, Object> map,
|
||||
String serialNumber,
|
||||
String id, String title,
|
||||
List<Map<String, Object>> dataList,
|
||||
List<OnlCgformField> fieldList,
|
||||
List<SysDictItem> dictItemList) {
|
||||
//文件类型字段
|
||||
List<OnlCgformField> onlCgformFieldList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
|
||||
List<String> fileFieldList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
|
||||
//编辑时处理首页文档动态 1. 标准XXXX的状态改为 2. 标准XXXX的适用车型改为 3. 标准XXXX删除了XXXX文件 4. 标准XXXX上传了XXXX文件
|
||||
String href = "<a href='/docManage/library/detail?id=" + id +
|
||||
"&title=" + title +
|
||||
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>,";
|
||||
|
||||
StringBuilder msgContentSb = new StringBuilder("标准" + serialNumber);
|
||||
StringBuilder msgContentInfoSb = new StringBuilder("标准" + href);
|
||||
|
||||
List<String> fileIdLIstTemp = new ArrayList<>();
|
||||
for (Map.Entry<String, Object> entry : dataList.get(0).entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = String.valueOf(entry.getValue());
|
||||
//文件
|
||||
if(fileFieldList.contains(key)&& !"null".equals(value) && StringUtils.isNotBlank(value)){
|
||||
fileIdLIstTemp.addAll(Arrays.asList(value.split(",")));
|
||||
}
|
||||
}
|
||||
List<String> fileIdLIst = new ArrayList<>();
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = String.valueOf(entry.getValue());
|
||||
//文件
|
||||
if(fileFieldList.contains(key) && !"null".equals(value) && StringUtils.isNotBlank(value)){
|
||||
fileIdLIst.addAll(Arrays.asList(value.split(",")));
|
||||
}
|
||||
}
|
||||
//之前的文件
|
||||
List<OSSFile> fileListTemp = new ArrayList<>();
|
||||
if(fileIdLIstTemp.size() != 0){
|
||||
fileListTemp = iOSSFileService.getFileInfoAll(StringUtils.join(fileIdLIstTemp,","));
|
||||
}
|
||||
List<String> fileNameListTemp = fileListTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList());
|
||||
|
||||
|
||||
//编辑的文件
|
||||
List<OSSFile> fileList = new ArrayList<>();
|
||||
if(fileIdLIst.size() != 0){
|
||||
fileList = iOSSFileService.getFileInfoAll(StringUtils.join(fileIdLIst,","));
|
||||
}
|
||||
List<String> fileNameList = fileList.stream().map(OSSFile::getFileName).collect(Collectors.toList());
|
||||
//删除的文件
|
||||
|
||||
List<String> deleteFileList = new ArrayList<>();
|
||||
for (String fileName : fileNameListTemp) {
|
||||
if(fileNameList.size() != 0 && !fileNameList.contains(fileName)){
|
||||
deleteFileList.add(fileName);
|
||||
}
|
||||
}
|
||||
//上传的文件
|
||||
List<String> upFileList = new ArrayList<>();
|
||||
for (String fileName : fileNameList) {
|
||||
if(!fileNameListTemp.contains(fileName)){
|
||||
upFileList.add(fileName);
|
||||
}
|
||||
}
|
||||
int count = 0;
|
||||
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = String.valueOf(entry.getValue());
|
||||
//状态
|
||||
if("state".equals(key) && !value.equals((String)dataList.get(0).get("state"))){
|
||||
count++;
|
||||
//数据字典转换 dictItemList
|
||||
String finalValue = value;
|
||||
List<SysDictItem> stateDictItemList = dictItemList.stream()
|
||||
.filter(e -> "state".equals(e.getDictCode()) && finalValue.equals(e.getItemValue()))
|
||||
.collect(Collectors.toList());
|
||||
if(stateDictItemList.size() != 0){
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
value = stateDictItemList.get(0).getItemText();
|
||||
}else{
|
||||
value = stateDictItemList.get(0).getEnName();
|
||||
}
|
||||
}
|
||||
msgContentSb.append("状态改为" + value + ",");
|
||||
msgContentInfoSb.append("状态改为" + value + ",");
|
||||
}
|
||||
//适用车型 car_type
|
||||
if("shi4_yong4_che1_xing2".equals(key) && !value.equals((String)dataList.get(0).get("shi4_yong4_che1_xing2"))){
|
||||
count++;
|
||||
//数据字典转换 dictItemList
|
||||
List<SysDictItem> stateDictItemList = dictItemList.stream()
|
||||
.filter(e -> "car_type".equals(e.getDictCode()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : value.split(",")) {
|
||||
List<SysDictItem> collect = stateDictItemList.stream().filter(e -> s.equals(e.getItemValue())).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
sb.append(collect.get(0).getItemText()+",");
|
||||
}else{
|
||||
sb.append(collect.get(0).getEnName()+",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(sb)){
|
||||
String substring = sb.substring(0, sb.length() - 1);
|
||||
value = substring;
|
||||
}
|
||||
|
||||
msgContentSb.append("适用车型改为" + value + ",");
|
||||
msgContentInfoSb.append("适用车型改为" + value + ",");
|
||||
}
|
||||
}
|
||||
if(upFileList.size() != 0){
|
||||
count++;
|
||||
msgContentSb.append("上传了" + StringUtils.join(upFileList,",") + ",");
|
||||
msgContentInfoSb.append("上传了" + StringUtils.join(upFileList,",") + ",");
|
||||
}
|
||||
if(deleteFileList.size() != 0){
|
||||
count++;
|
||||
msgContentSb.append("删除了" + StringUtils.join(deleteFileList,",") + ",");
|
||||
msgContentInfoSb.append("删除了" + StringUtils.join(deleteFileList,",") + ",");
|
||||
}
|
||||
if(count > 0){
|
||||
String msgContent = msgContentSb.substring(0, msgContentSb.length() - 1);
|
||||
String msgContentInfo = msgContentInfoSb.substring(0, msgContentInfoSb.length() - 1);
|
||||
HomeDocumentDynamicEO homeDocumentDynamicEO = new HomeDocumentDynamicEO();
|
||||
homeDocumentDynamicEO.setMsgContent(msgContent);
|
||||
homeDocumentDynamicEO.setMsgContentInfo(msgContentInfo);
|
||||
homeDocumentDynamicEOService.save(homeDocumentDynamicEO);
|
||||
}
|
||||
}
|
||||
|
||||
private String updateEsInfo(Map<String, Object> map, List<OnlCgformField> searchFieldList, StringBuilder sbCn, StringBuilder sbEn, List<OSSFile> fileInfos, List<Map<String, Object>> mapListTempCn, List<Map<String, Object>> mapListTempEn, String cutCn, String cutEn) {
|
||||
Map<String, Object> mapBaseDateCn = new HashMap<>();
|
||||
Map<String, Object> mapBaseDateEn = new HashMap<>();
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class HomeDocumentDynamicEOController extends JeroController<HomeDocument
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<HomeDocumentDynamicEO> queryWrapper = QueryGenerator.initQueryWrapper(homeDocumentDynamicEO, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
Page<HomeDocumentDynamicEO> page = new Page<HomeDocumentDynamicEO>(pageNo, pageSize);
|
||||
IPage<HomeDocumentDynamicEO> pageList = homeDocumentDynamicEOService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
|
||||
+2
-2
@@ -76,8 +76,8 @@ public class HomeFunctionModuleEOController extends JeroController<HomeFunctionM
|
||||
@AutoLog(value = "功能模块-列表查询")
|
||||
@ApiOperation(value="功能模块-列表查询", notes="功能模块-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<HomeFunctionModuleEO>> queryList() {
|
||||
List<HomeFunctionModuleEO> list = homeFunctionModuleEOService.queryList();
|
||||
public Result<List<HomeFunctionModuleEO>> queryList(String cut) {
|
||||
List<HomeFunctionModuleEO> list = homeFunctionModuleEOService.queryList(cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -59,5 +59,5 @@ public interface IHomeFunctionModuleEOService extends IService<HomeFunctionModul
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<HomeFunctionModuleEO> queryList();
|
||||
List<HomeFunctionModuleEO> queryList(String cut);
|
||||
}
|
||||
|
||||
+13
-2
@@ -3,6 +3,7 @@ package com.jero.modules.home.service.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.home.entity.HomeFunctionModuleEO;
|
||||
import com.jero.modules.home.mapper.HomeFunctionModuleEOMapper;
|
||||
@@ -99,7 +100,7 @@ public class HomeFunctionModuleEOServiceImpl extends ServiceImpl<HomeFunctionMod
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<HomeFunctionModuleEO> queryList() {
|
||||
public List<HomeFunctionModuleEO> queryList(String cut) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//所有的图表(state=0)
|
||||
@@ -111,9 +112,19 @@ public class HomeFunctionModuleEOServiceImpl extends ServiceImpl<HomeFunctionMod
|
||||
LambdaQueryWrapper<HomeFunctionModuleEO> wrapperTemp = new LambdaQueryWrapper<>();
|
||||
wrapperTemp.in(HomeFunctionModuleEO::getCreateBy,loginUser.getUsername()).orderByAsc(HomeFunctionModuleEO::getState).orderByAsc(HomeFunctionModuleEO::getSort);
|
||||
List<HomeFunctionModuleEO> homeFunctionModuleEOS = this.list(wrapperTemp);
|
||||
if(homeFunctionModuleEOS.size() == 0){
|
||||
if(homeFunctionModuleEOList.size() == 0){
|
||||
if(CutEnum.EN.getValue().equals(cut)){
|
||||
for (HomeFunctionModuleEO homeFunctionModuleEO : homeFunctionModuleEOList) {
|
||||
homeFunctionModuleEO.setIconName(homeFunctionModuleEO.getIconNameEn());
|
||||
}
|
||||
}
|
||||
return homeFunctionModuleEOList;
|
||||
}else{
|
||||
if(CutEnum.EN.getValue().equals(cut)){
|
||||
for (HomeFunctionModuleEO homeFunctionModuleEO : homeFunctionModuleEOS) {
|
||||
homeFunctionModuleEO.setIconName(homeFunctionModuleEO.getIconNameEn());
|
||||
}
|
||||
}
|
||||
return homeFunctionModuleEOS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user