文档动态修改

This commit is contained in:
zhn
2023-02-03 17:49:47 +08:00
parent cdc327755c
commit 0d7ea9571a
6 changed files with 115 additions and 27 deletions
@@ -159,3 +159,10 @@ ALTER TABLE `laws_weilai`.`params_report_detail`
-- 更新拆分详情列 展示顺序不在列表头展示sql 2022-12-30 已同步生产环境
UPDATE `laws_weilai`.`onl_cgform_field` SET `is_show_list` = 0 WHERE `id` = '1529373706885799937'
-- 文档动态 添加中文消息的字段 2023-02-03 未同步生产环境
ALTER TABLE `laws_weilai`.`home_document_dynamic`
MODIFY COLUMN `msg_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '消息内容(英文)' AFTER `sys_org_code`,
MODIFY COLUMN `msg_content_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '消息详情(英文)' AFTER `msg_content`,
ADD COLUMN `msg_content_cn` text NULL COMMENT '消息内容(中文)' AFTER `msg_content_info`,
ADD COLUMN `msg_content_info_cn` text NULL COMMENT '消息内容(中文)' AFTER `msg_content_cn`;
@@ -144,8 +144,8 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
@ApiOperation(value="文档库信息表-批量删除", notes="文档库信息表-批量删除")
@GetMapping(value = "/deleteBatch")
@RequiresPermissions("document:deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")));
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids,String cut) {
this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut);
return Result.OK("批量删除成功!");
}
@@ -37,7 +37,7 @@ public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibr
* @param ids
* @return
*/
void deleteByIds(List<String> ids);
void deleteByIds(List<String> ids,String cut);
/**
* 通过id查询
@@ -216,7 +216,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
* @return
*/
@Override
public void deleteByIds(List<String> ids) {
public void deleteByIds(List<String> ids,String cut) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//字段属性
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
@@ -256,6 +256,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<String> documentIds = onlCgformSubscribeList.stream().map(OnlCgformSubscribe::getDocumentId).collect(Collectors.toList());
List<String> serialNumberList = new ArrayList<>();
List<String> serialNumberListTemp = new ArrayList<>();
List<String> serialNumberListTempCn = new ArrayList<>();
StringBuilder sb = new StringBuilder();
StringBuilder sbTemp = new StringBuilder();
for (Map<String, Object> map : mapList) {
@@ -270,7 +271,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
.filter(e -> "type".equals(e.getDictCode()) && finalCategory.equals(e.getItemValue()))
.collect(Collectors.toList());
if(stateDictItemList.size() != 0){
category = stateDictItemList.get(0).getEnName();
if(CutEnum.CN.getValue().equals(cut)){
category = stateDictItemList.get(0).getItemText();
}else{
category = stateDictItemList.get(0).getEnName();
}
}
}else {
category = "";
@@ -282,6 +288,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>" + " " + titleEn + ",";
sbTemp.append(hrefTemp);
serialNumberListTemp.add(category + " " + serialNumber + " " + titleEn);
serialNumberListTempCn.add(category + " " + serialNumber + " " + title);
//---------------------------
if (documentIds.size() != 0 && documentIds.contains((String) map.get("id"))) {
serialNumberList.add(serialNumber);
@@ -299,9 +306,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (serialNumberListTemp.size() > 1) {
msgEndStr = " have been deleted from the document library.";
}
String msgContent = "The standard " + StringUtils.join(serialNumberListTemp,",") + msgEndStr;
String msgContent = "The " + StringUtils.join(serialNumberListTemp,",") + msgEndStr;
String msgContentCn = "文档库中删除了" + StringUtils.join(serialNumberListTempCn,",");
homeDocumentDynamicEO.setMsgContent(msgContent);
homeDocumentDynamicEO.setMsgContentInfo(msgContent);
homeDocumentDynamicEO.setMsgContentCn(msgContentCn);
homeDocumentDynamicEO.setMsgContentInfoCn(msgContentCn);
homeDocumentDynamicEOService.save(homeDocumentDynamicEO);
}
@@ -2145,6 +2155,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String title = StringUtils.valueOf(map.get("title"));
String serialNumber = StringUtils.valueOf(map.get("serial_number"));
String category = StringUtils.valueOf(map.get("lei4_bie2"));
String categoryCn = "";
String titleEn = StringUtils.valueOf(map.get("title_en"));
List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsAll();
if(StringUtils.isNotBlank(category)){
@@ -2154,6 +2165,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
.collect(Collectors.toList());
if(stateDictItemList.size() != 0){
category = stateDictItemList.get(0).getEnName();
categoryCn = stateDictItemList.get(0).getItemText();
}
}else{
category = "";
@@ -2198,11 +2210,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String href = category + " " + "<a href='/docManage/library/detail?id=" + idTemp +
"&title=" + title +
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>" + " "+ titleEn + " ";
String hrefCn = categoryCn + " " + "<a href='/docManage/library/detail?id=" + idTemp +
"&title=" + title +
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>" + " "+ title;
//文档动态, 文档库中新增了标准XXXX homeDocumentDynamicEOService
//The standard GB 7258-2017 Technical specifications has been added to the document library.
String msgContentCn = "文档库中新增了"+categoryCn+" "+serialNumber+" "+title;
String msgContentInfoCn = "文档中库新增了"+hrefCn;
HomeDocumentDynamicEO homeDocumentDynamicEO = new HomeDocumentDynamicEO();
homeDocumentDynamicEO.setMsgContent("The standard " + category + " " + serialNumber + " " + titleEn + " has been added to the document library.");
homeDocumentDynamicEO.setMsgContentInfo("The standard " + href + " has been added to the document library.");
homeDocumentDynamicEO.setMsgContent("The " + category + " " + serialNumber + " " + titleEn + " has been added to the document library.");
homeDocumentDynamicEO.setMsgContentInfo("The " + href + " has been added to the document library.");
homeDocumentDynamicEO.setMsgContentCn(msgContentCn);
homeDocumentDynamicEO.setMsgContentInfoCn(msgContentInfoCn);
homeDocumentDynamicEOService.save(homeDocumentDynamicEO);
@@ -2664,6 +2683,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<SysDictItem> dictItemList,
String category,
String titleEn) {
String categoryCn = "";
if(StringUtils.isNotBlank(category)){
String finalCategory = category;
List<SysDictItem> stateDictItemList = dictItemList.stream()
@@ -2671,6 +2691,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
.collect(Collectors.toList());
if(stateDictItemList.size() != 0){
category = stateDictItemList.get(0).getEnName();
categoryCn = stateDictItemList.get(0).getItemText();
}
}else{
category = "";
@@ -2685,6 +2706,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
StringBuilder sbContentInfo = new StringBuilder();
StringBuilder sbField = new StringBuilder();
StringBuilder sbNew = new StringBuilder();
StringBuilder sbFieldCn = new StringBuilder();
StringBuilder sbNewCn = new StringBuilder();
dataList.get(0).entrySet().forEach(entry -> {
String keyTemp = entry.getKey();
if(fileFieldList.contains(keyTemp)) {
@@ -2701,11 +2724,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (!checkDiffrent && fileNameListNew.size() != 0) {
//消息
sbField.append(fields.get(0).getDbFieldEnName() + ",");
sbFieldCn.append(fields.get(0).getDbFieldTxt() + ",");
for (String s : fileNameListNew) {
if (!fileNameList.contains(s)) {
//消息详情
sbNew.append(fields.get(0).getDbFieldEnName() + " " + s + ",");
sbNewCn.append(fields.get(0).getDbFieldTxt() + " " + s + ",");
}
}
}
@@ -2715,15 +2740,22 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String href = "<a href='/docManage/library/detail?id=" + id +
"&title=" + title +
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>" + " " + titleEn;
String hrefCn = "<a href='/docManage/library/detail?id=" + id +
"&title=" + title +
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>" + " " + title;
String contentFile = "";
String contentInfoFile = "";
String contentFileCn = "";
String contentInfoFileCn = "";
if(StringUtils.isNotBlank(sbField)){
// String substring = sbField.substring(0, sbField.length() - 1);
contentFile = category + " " + serialNumber + " " + titleEn + " uploaded " + sbField;
contentFileCn = categoryCn + " " + serialNumber + " " + title + " 中上传了 " + sbFieldCn;
}
if(StringUtils.isNotBlank(sbNew)){
// String substring = sbNew.substring(0, sbNew.length() - 1);
contentInfoFile = category + " " + href + " uploaded " + sbNew;
contentInfoFileCn = categoryCn + " " + hrefCn + " 中上传了" + sbNewCn;
}
//编辑时处理首页文档动态 1. 标准XXXX的状态改为 2. 标准XXXX的适用车型改为 3. 标准XXXX删除了XXXX文件 4. 标准XXXX上传了XXXX文件
@@ -2733,12 +2765,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
StringBuilder msgContentSb = new StringBuilder();
StringBuilder msgContentInfoSb = new StringBuilder();
StringBuilder msgContentSbCn = new StringBuilder();
StringBuilder msgContentInfoSbCn = new StringBuilder();
//适用车型
StringBuilder msgContentSbCarType = new StringBuilder("Vehicle Type of the standard " + category + " " + serialNumber + " " + titleEn);
StringBuilder msgContentInfoSbCarType = new StringBuilder("Vehicle Type of the standard " + category + " " + href);
StringBuilder msgContentSbCarType = new StringBuilder("Vehicle Type of the " + category + " " + serialNumber + " " + titleEn);
StringBuilder msgContentInfoSbCarType = new StringBuilder("Vehicle Type of the " + category + " " + href);
StringBuilder msgContentSbCarTypeCn = new StringBuilder(categoryCn + " " + serialNumber + " " + title+" 的适用车型改为");
StringBuilder msgContentInfoSbCarTypeCn = new StringBuilder(categoryCn + " " + hrefCn+" 的适用车型改为");
//状态
StringBuilder msgContentSbStatus = new StringBuilder("The Status of the standard " + category + " " + serialNumber + " " + titleEn);
StringBuilder msgContentInfoSbStatus = new StringBuilder("The Status of the standard " + category + " " + href);
StringBuilder msgContentSbStatus = new StringBuilder("The Status of the " + category + " " + serialNumber + " " + titleEn);
StringBuilder msgContentInfoSbStatus = new StringBuilder("The Status of the " + category + " " + href);
StringBuilder msgContentSbStatusCn = new StringBuilder(categoryCn + " " + serialNumber + " " + title+" 的状态改为");
StringBuilder msgContentInfoSbStatusCn = new StringBuilder(categoryCn + " " + hrefCn+" 的状态改为");
List<String> fileIdLIstTemp = new ArrayList<>();
@@ -2764,11 +2802,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
count++;
//数据字典转换 dictItemList
String finalValue = value;
String valueCn = "";
List<SysDictItem> stateDictItemList = dictItemList.stream()
.filter(e -> "state".equals(e.getDictCode()) && finalValue.equals(e.getItemValue()))
.collect(Collectors.toList());
if(stateDictItemList.size() != 0){
value = stateDictItemList.get(0).getEnName();
valueCn = stateDictItemList.get(0).getItemText();
}
//
if(StringUtils.isBlank(value)){
@@ -2781,6 +2821,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
msgContentInfoSbStatus.append(" has been modified to " + value + ",");
msgContentSb.append(msgContentSbStatus);
msgContentInfoSb.append(msgContentInfoSbStatus);
msgContentSbCn.append(msgContentSbStatusCn + valueCn+ ",");
msgContentInfoSbCn.append(msgContentInfoSbStatusCn + valueCn+ ",");
}
}
@@ -2812,11 +2854,15 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
msgContentInfoSbCarType.append(" has been modified to be null,");
msgContentSb.append(msgContentSbCarType);
msgContentInfoSb.append(msgContentInfoSbCarType);
msgContentSbCn.append(msgContentSbCarTypeCn + "空,");
msgContentInfoSbCn.append(msgContentInfoSbCarTypeCn + "空,");
}else{
msgContentSbCarType.append(" has been modified to " + value + ",");
msgContentInfoSbCarType.append(" has been modified to " + value + ",");
msgContentSb.append(msgContentSbCarType);
msgContentInfoSb.append(msgContentInfoSbCarType);
msgContentSbCn.append(msgContentSbCarTypeCn + value+ ",");
msgContentInfoSbCn.append(msgContentInfoSbCarTypeCn + value+ ",");
}
}
@@ -2824,16 +2870,22 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if(StringUtils.isNotBlank(contentFile)){
count ++;
msgContentSb.append(contentFile);
msgContentSbCn.append(contentFileCn);
}
if(StringUtils.isNotBlank(contentInfoFile)){
msgContentInfoSb.append(contentInfoFile);
msgContentInfoSbCn.append(contentInfoFileCn);
}
if(count > 0){
String msgContent = msgContentSb.substring(0, msgContentSb.length() - 1) + ".";
String msgContentInfo = msgContentInfoSb.substring(0, msgContentInfoSb.length() - 1) + ".";
String msgContentCn = msgContentSbCn.substring(0, msgContentSbCn.length() - 1) + ".";
String msgContentInfoCn = msgContentInfoSbCn.substring(0, msgContentInfoSbCn.length() - 1) + ".";
HomeDocumentDynamicEO homeDocumentDynamicEO = new HomeDocumentDynamicEO();
homeDocumentDynamicEO.setMsgContent(msgContent);
homeDocumentDynamicEO.setMsgContentInfo(msgContentInfo);
homeDocumentDynamicEO.setMsgContentCn(msgContentCn);
homeDocumentDynamicEO.setMsgContentInfoCn(msgContentInfoCn);
homeDocumentDynamicEOService.save(homeDocumentDynamicEO);
}
}
@@ -1,25 +1,37 @@
package com.jero.modules.home.controller;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.home.entity.HomeDocumentDynamicEO;
import com.jero.modules.home.service.IHomeDocumentDynamicEOService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.base.controller.JeroController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.home.entity.HomeDocumentDynamicEO;
import com.jero.modules.home.service.IHomeDocumentDynamicEOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
@@ -51,11 +63,22 @@ public class HomeDocumentDynamicEOController extends JeroController<HomeDocument
public Result<?> queryPageList(HomeDocumentDynamicEO homeDocumentDynamicEO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
HttpServletRequest req,
String cut) {
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);
if(CutEnum.CN.getValue().equals(cut) && ObjectUtils.isNotEmpty(pageList.getRecords())){
for (HomeDocumentDynamicEO record : pageList.getRecords()) {
if(StringUtils.isNotBlank(record.getMsgContentCn())){
record.setMsgContent(record.getMsgContentCn());
}
if(StringUtils.isNotBlank(record.getMsgContentInfoCn())){
record.setMsgContentInfo(record.getMsgContentInfoCn());
}
}
}
return Result.OK(pageList);
}
@@ -71,4 +71,10 @@ public class HomeDocumentDynamicEO implements Serializable {
@ApiModelProperty(value = "消息内容详情")
private java.lang.String msgContentInfo;
//消息中文
private String msgContentCn;
//消息详情中文
private String msgContentInfoCn;
}