feat(文档拆分): 发布
This commit is contained in:
+6
-1
@@ -73,8 +73,13 @@ public class DocumentSplitCommon {
|
||||
*/
|
||||
public static final String TABLE = "TABLE";
|
||||
/**
|
||||
* 条目类型 TEXT:文本, IMG:图片, TABLE:表格, INTERPRETATION:解读
|
||||
* 拆分状态 1:编辑中 2:已发布
|
||||
*/
|
||||
public static final String SPLIT_STATUS1 = "1";
|
||||
/**
|
||||
* 拆分状态 1:编辑中 2:已发布
|
||||
*/
|
||||
public static final String SPLIT_STATUS2 = "2";
|
||||
public static final String INTERPRETATION = "interpretation";
|
||||
|
||||
public static final String MEG_DEL = "删除成功!";
|
||||
|
||||
+14
@@ -99,6 +99,20 @@ public class DocumentSplitController {
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布
|
||||
*
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分-发布")
|
||||
@ApiOperation(value="文档拆分-发布", notes="文档拆分-发布")
|
||||
@PostMapping(value = "/publish")
|
||||
public Result<T> publish(@RequestBody Map<String, Object> parameter) {
|
||||
documentSplitService.publish(parameter);
|
||||
return Result.OK("发布成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.jero.modules.laws.documenttool.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 条目信息
|
||||
*
|
||||
* @author yjz
|
||||
* @since 2023-10-19 00:07:32
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsVal implements Serializable {
|
||||
private static final long serialVersionUID = -57474928779384395L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String sysOrgCode;
|
||||
/**
|
||||
* 条款id
|
||||
*/
|
||||
private String itemId;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 条目内容
|
||||
*/
|
||||
private String itemContent;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer displaySeq;
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private Integer validFlag;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgName;
|
||||
/**
|
||||
* 用于前端数组排序
|
||||
*/
|
||||
private Integer indexItem;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private Date creationTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String modifyUser;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
private Date modifyTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String creationUser;
|
||||
}
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.jero.modules.laws.documenttool.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 目录
|
||||
*
|
||||
* @author yjz
|
||||
* @since 2023-10-18 22:21:48
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitMenu implements Serializable {
|
||||
private static final long serialVersionUID = 214967115522705210L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String sysOrgCode;
|
||||
/**
|
||||
* 信息记录表id
|
||||
*/
|
||||
private String infoId;
|
||||
/**
|
||||
* 目录名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
private String parentId;
|
||||
/**
|
||||
* 排序序号
|
||||
*/
|
||||
private Integer displaySeq;
|
||||
/**
|
||||
* 是否有效
|
||||
*/
|
||||
private Integer validFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
/**
|
||||
* 条款名称
|
||||
*/
|
||||
private String itemName;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String creationUser;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private Date creationTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String modifyUser;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
private Date modifyTime;
|
||||
}
|
||||
|
||||
+48
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.modules.laws.documenttool.entity.DocumentSplitInfo;
|
||||
import com.jero.modules.laws.documenttool.entity.SarFileSplitItemsVal;
|
||||
import com.jero.modules.laws.documenttool.entity.SarFileSplitMenu;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -123,4 +125,50 @@ public interface DocumentSplitMapper {
|
||||
* @param itemIds
|
||||
*/
|
||||
int deleteItemsValByItemIds(@Param("itemIds") String itemIds, @Param("type") String type);
|
||||
|
||||
/**
|
||||
* 文档拆分根据id查询
|
||||
* @param id
|
||||
*/
|
||||
DocumentSplitInfo queryDocumentSplitInfoById(String id);
|
||||
|
||||
/**
|
||||
* 文档拆分新增
|
||||
* @param newInfo
|
||||
*/
|
||||
int insertDocumentSplitInfo(DocumentSplitInfo newInfo);
|
||||
|
||||
/**
|
||||
* 目录根据id查询
|
||||
* @param infoId
|
||||
* @return
|
||||
*/
|
||||
List<SarFileSplitMenu> querySarFileSplitMenuByInfoId(String infoId);
|
||||
|
||||
/**
|
||||
* 目录批量新增
|
||||
* @param oldMenuList
|
||||
* @return
|
||||
*/
|
||||
int insertBatchSarFileSplitMenuByInfoId(@Param("entities") List<SarFileSplitMenu> oldMenuList);
|
||||
|
||||
/**
|
||||
* 文档拆分详情根据infoid查询
|
||||
* @param infoId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> queryLawsDocumentSplitByInfoId(String infoId);
|
||||
|
||||
/**
|
||||
* 条目信息根据itemId查询
|
||||
* @param itemId
|
||||
* @return
|
||||
*/
|
||||
List<SarFileSplitItemsVal> querySarFileSplitItemsValByItemId(String itemId);
|
||||
|
||||
/**
|
||||
* 条目信息批量新增
|
||||
* @param sarFileSplitItemsVal
|
||||
*/
|
||||
int insertSarFileSplitItemsVal(@Param("entities") List<SarFileSplitItemsVal> sarFileSplitItemsVal);
|
||||
}
|
||||
|
||||
+50
@@ -23,6 +23,27 @@
|
||||
values (${insertValue})
|
||||
</insert>
|
||||
|
||||
<insert id="insertDocumentSplitInfo">
|
||||
insert into sar_file_split_info(create_by, create_time, update_by, update_time, sys_org_code, serial_number, title, file_type, file_name, split_result, file_id, connect_id, title_en, author, split_status, standard_id, del_flag)
|
||||
values (#{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{sysOrgCode}, #{serialNumber}, #{title}, #{fileType}, #{fileName}, #{splitResult}, #{fileId}, #{connectId}, #{titleEn}, #{author}, #{splitStatus}, #{standardId}, #{delFlag})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatchSarFileSplitMenuByInfoId">
|
||||
insert into sar_file_split_menu(sys_org_code, info_id, name, parent_id, display_seq, valid_flag, remarks, item_name, creation_user, creation_time, modify_user, modify_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.sysOrgCode}, #{entity.infoId}, #{entity.name}, #{entity.parentId}, #{entity.displaySeq}, #{entity.validFlag}, #{entity.remarks}, #{entity.itemName}, #{entity.creationUser}, #{entity.creationTime}, #{entity.modifyUser}, #{entity.modifyTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertSarFileSplitItemsVal">
|
||||
insert into sar_file_split_items_val(sys_org_code, item_id, type, item_content, display_seq, valid_flag, img_name, index_item, creation_time, modify_user, modify_time, creation_user)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.sysOrgCode}, #{entity.itemId}, #{entity.type}, #{entity.itemContent}, #{entity.displaySeq}, #{entity.validFlag}, #{entity.imgName}, #{entity.indexItem}, #{entity.creationTime}, #{entity.modifyUser}, #{entity.modifyTime}, #{entity.creationUser})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="sarFileSplitMenuDeleteByIdList">
|
||||
delete from SAR_FILE_SPLIT_MENU
|
||||
where id in
|
||||
@@ -138,6 +159,35 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryDocumentSplitInfoById"
|
||||
resultType="com.jero.modules.laws.documenttool.entity.DocumentSplitInfo">
|
||||
select id, create_by, create_time, update_by, update_time, sys_org_code,
|
||||
serial_number, title, file_type, file_name, split_result, file_id,
|
||||
connect_id, title_en, author, split_status, standard_id, del_flag
|
||||
from sar_file_split_info
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="querySarFileSplitMenuByInfoId"
|
||||
resultType="com.jero.modules.laws.documenttool.entity.SarFileSplitMenu">
|
||||
select id, sys_org_code, info_id, name, parent_id, display_seq, valid_flag,
|
||||
remarks, item_name, creation_user, creation_time, modify_user, modify_time
|
||||
from sar_file_split_menu
|
||||
where valid_flag = 0 and info_id = #{infoId}
|
||||
</select>
|
||||
|
||||
<select id="queryLawsDocumentSplitByInfoId" resultType="java.util.Map">
|
||||
select * from laws_document_split where del_flag = 0 and info_if = #{infoId}
|
||||
</select>
|
||||
|
||||
<select id="querySarFileSplitItemsValByItemId"
|
||||
resultType="com.jero.modules.laws.documenttool.entity.SarFileSplitItemsVal">
|
||||
select id, sys_org_code, item_id, type, item_content, display_seq, valid_flag,
|
||||
img_name, index_item, creation_time, modify_user, modify_time, creation_user
|
||||
from sar_file_split_items_val
|
||||
where valid_flag = 0 and item_id = #{infoId}
|
||||
</select>
|
||||
|
||||
<update id="editDocumentSplitDetail">
|
||||
UPDATE laws_document_split
|
||||
SET ${updateSet}
|
||||
|
||||
+7
@@ -136,4 +136,11 @@ public interface IDocumentSplitService {
|
||||
* @return
|
||||
*/
|
||||
LawsDocumentSplitView queryView(Map<String, Object> parameter);
|
||||
|
||||
/**
|
||||
* 文档拆分-发布
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
void publish(Map<String, Object> parameter);
|
||||
}
|
||||
|
||||
+88
-2
@@ -17,6 +17,8 @@ import com.jero.modules.laws.common.mapper.LawsCommonMapper;
|
||||
import com.jero.modules.laws.documenttool.common.DocumentSplitCommon;
|
||||
import com.jero.modules.laws.documenttool.entity.DocumentSplitInfo;
|
||||
import com.jero.modules.laws.documenttool.entity.LawsDocumentSplitView;
|
||||
import com.jero.modules.laws.documenttool.entity.SarFileSplitItemsVal;
|
||||
import com.jero.modules.laws.documenttool.entity.SarFileSplitMenu;
|
||||
import com.jero.modules.laws.documenttool.factory.ConditionMapFactory;
|
||||
import com.jero.modules.laws.documenttool.handler.impl.DateManyConditionImpl;
|
||||
import com.jero.modules.laws.documenttool.handler.impl.UniversalImpl;
|
||||
@@ -40,6 +42,7 @@ import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.tag.entity.LawsTag;
|
||||
import com.jero.modules.tag.enums.LawsFieldTypeEnum;
|
||||
import com.jero.modules.tag.enums.TableNameEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
@@ -49,6 +52,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -69,6 +73,7 @@ import static java.net.URLEncoder.encode;
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
@Slf4j
|
||||
public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
||||
private final DocumentSplitMapper documentSplitMapper;
|
||||
private final ISarFileSplitInfoService sarFileSplitInfoService;
|
||||
@@ -643,6 +648,87 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
||||
return lawsDocumentSplitView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish(Map<String, Object> parameter) {
|
||||
String id = (String) parameter.get(ID);
|
||||
// 文档拆分信息(旧)
|
||||
DocumentSplitInfo oldInfo = documentSplitMapper.queryDocumentSplitInfoById(id);
|
||||
// 修改发布状态
|
||||
LambdaUpdateWrapper<SarFileSplitInfoEO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(SarFileSplitInfoEO::getId, oldInfo.getId());
|
||||
updateWrapper.set(SarFileSplitInfoEO::getSplitStatus, DocumentSplitCommon.SPLIT_STATUS2);
|
||||
sarFileSplitInfoService.update(updateWrapper);
|
||||
// 文档拆分信息(新)
|
||||
DocumentSplitInfo newInfo = new DocumentSplitInfo();
|
||||
BeanUtils.copyProperties(oldInfo, newInfo);
|
||||
String uuId = UUID.randomUUID().toString().replace("-", "");
|
||||
newInfo.setId(uuId);
|
||||
newInfo.setSplitStatus(DocumentSplitCommon.SPLIT_STATUS2);
|
||||
// 新增数据
|
||||
documentSplitMapper.insertDocumentSplitInfo(newInfo);
|
||||
|
||||
// 目录(旧)
|
||||
List<SarFileSplitMenu> oldMenuList = documentSplitMapper.querySarFileSplitMenuByInfoId(id);
|
||||
List<String> oldMenuIdList = new ArrayList<>();
|
||||
List<String> newMenuIdList = new ArrayList<>();
|
||||
for (SarFileSplitMenu sarFileSplitMenu : oldMenuList) {
|
||||
oldMenuIdList.add(sarFileSplitMenu.getId());
|
||||
String newId = UUID.randomUUID().toString().replace("-", "");
|
||||
newMenuIdList.add(newId);
|
||||
sarFileSplitMenu.setId(newId);
|
||||
sarFileSplitMenu.setInfoId(newInfo.getId());
|
||||
|
||||
// 父子级关系处理
|
||||
oldMenuList.stream()
|
||||
.filter(v -> Objects.equals(sarFileSplitMenu.getId(), v.getParentId()))
|
||||
.peek(v -> v.setParentId(newId)).forEach(v -> log.info(v.getParentId()));
|
||||
}
|
||||
// 新增数据
|
||||
documentSplitMapper.insertBatchSarFileSplitMenuByInfoId(oldMenuList);
|
||||
|
||||
// 文档拆分详情(旧)
|
||||
List<Map<String, Object>> oldLawsDocumentSplitList = documentSplitMapper.queryLawsDocumentSplitByInfoId(id);
|
||||
/**
|
||||
* List<String> oldLawsDocumentSplitIdList = new ArrayList<>();
|
||||
* List<String> newLawsDocumentSplitIdList = new ArrayList<>();
|
||||
*/
|
||||
for (Map<String, Object> map : oldLawsDocumentSplitList) {
|
||||
String oldId = (String) map.get(ID);
|
||||
/**
|
||||
* oldLawsDocumentSplitIdList.add(oldId);
|
||||
*/
|
||||
String newId = UUID.randomUUID().toString().replace("-", "");
|
||||
map.put(ID, newId);
|
||||
/**
|
||||
* newLawsDocumentSplitIdList.add(newId);
|
||||
*/
|
||||
map.put(INFO_ID, newInfo.getId());
|
||||
|
||||
// 旧目录id替换
|
||||
Optional<String> optionalS = oldMenuIdList.stream().filter(v -> v.equals(map.get(MENU_ID))).findFirst();
|
||||
optionalS.ifPresent(v -> {
|
||||
int index = oldMenuIdList.indexOf(v);
|
||||
map.put(MENU_ID, newMenuIdList.get(index));
|
||||
});
|
||||
|
||||
List<String> keyList = new ArrayList<>(map.keySet());
|
||||
List<String> valueList = map.values().stream().map(o -> (String) o).collect(Collectors.toList());
|
||||
// 新增数据
|
||||
String insertField = "'" + String.join("','", keyList) + "'";
|
||||
String insertValue = "'" + String.join("','", valueList) + "'";
|
||||
documentSplitMapper.insertLawsDocumentSplit(insertField, insertValue);
|
||||
|
||||
// 条目信息(旧)
|
||||
List<SarFileSplitItemsVal> sarFileSplitItemsVal = documentSplitMapper.querySarFileSplitItemsValByItemId(oldId);
|
||||
for (SarFileSplitItemsVal fileSplitItemsVal : sarFileSplitItemsVal) {
|
||||
fileSplitItemsVal.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
fileSplitItemsVal.setItemId(newId);
|
||||
}
|
||||
// 新增数据
|
||||
documentSplitMapper.insertSarFileSplitItemsVal(sarFileSplitItemsVal);
|
||||
}
|
||||
}
|
||||
|
||||
private void manageData(Map<String, Object> resultMap, StringBuilder fieldsBuilder, StringBuilder valuesBuilder) {
|
||||
// 所有key(字段名)
|
||||
resultMap.forEach((k, v) -> {
|
||||
@@ -684,9 +770,9 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
||||
List<DocumentSplitInfo> list = queryByList(documentSplitInfo);
|
||||
if(!list.isEmpty()){
|
||||
if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
|
||||
throw new JeroBootException("不可重复拆分文件状态加标准号相同的数据!");
|
||||
throw new JeroBootException("每个文件类型只能拆分一次!");
|
||||
}else{
|
||||
throw new JeroBootException("Non-repeatable split file status plus standard number the same data!");
|
||||
throw new JeroBootException("Each file type can only be split once!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user