文件挂靠 接口
This commit is contained in:
+8
@@ -67,6 +67,14 @@ public class SarBussStandAttrInfo extends BaseEntity {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String glwj;
|
||||
|
||||
@ApiModelProperty(value = "译文件")
|
||||
@TableField("TRANSLATION")
|
||||
private String translation;
|
||||
|
||||
@ApiModelProperty(value = "原文件")
|
||||
@TableField("FBGBUSS")
|
||||
private String fbgbuss;
|
||||
//
|
||||
// @TableField("SVPPS")
|
||||
// private String svpps;
|
||||
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.slrs.sarBussionessStand.dao;
|
||||
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.OldSystem;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
|
||||
@@ -119,5 +120,7 @@ public interface SarBussionessStandDao extends BaseMapper<SarBussionessStand> {
|
||||
|
||||
|
||||
void importSarBussionessStand(SarBussionessStand sarBussionessStands);
|
||||
|
||||
List<OldSystem> selectListInfo();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.adc.da.slrs.sarBussionessStand.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OldSystem {
|
||||
|
||||
//kmpro_addon34 与 buss_id 对应
|
||||
private String loreDocId;
|
||||
//lore_depot_sort
|
||||
private String sortId;
|
||||
//lore_attache
|
||||
private String fileSign;
|
||||
//lore_attache
|
||||
private String fileSrc;
|
||||
//lore_depot_sort
|
||||
private String sortSign;
|
||||
|
||||
//新系统返回数据所需要的
|
||||
private String attfid;
|
||||
|
||||
private String standId;
|
||||
|
||||
private String buildId;
|
||||
|
||||
|
||||
// 需要组合的数据
|
||||
private String attFileId;
|
||||
|
||||
private String original;
|
||||
|
||||
private String Translation;
|
||||
}
|
||||
+3
-2
@@ -55,8 +55,9 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
|
||||
void convertDocAllQB(List<SarBussStandFile> list);
|
||||
|
||||
void checkFileByEncrypt();
|
||||
|
||||
ResponseMessage emptyFileAnewStorage();
|
||||
|
||||
ResponseMessage<SarBussionessStand> importSarBussionessStand(List<Map<String, String>> dataList, String filepath)throws Exception;
|
||||
|
||||
ResponseMessage<SarBussionessStand> importSarBussionessStandFile(MultipartFile file);
|
||||
}
|
||||
|
||||
|
||||
+182
-26
@@ -41,6 +41,7 @@ import com.adc.da.slrs.sarBussStandSn.entity.SarBussStandSn;
|
||||
import com.adc.da.slrs.sarBussStandSn.service.ISarBussStandSnService;
|
||||
import com.adc.da.slrs.sarBussStandVal.dao.SarBussStandValDao;
|
||||
import com.adc.da.slrs.sarBussStandVal.entity.SarBussStandVal;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.OldSystem;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport;
|
||||
@@ -55,6 +56,7 @@ import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
||||
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
|
||||
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
|
||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||
@@ -229,6 +231,9 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
@Autowired
|
||||
private ISarBussStandAttrInfoService sarBussStandAttrInfoService;
|
||||
|
||||
@Autowired
|
||||
private SarStandardsInfoDao sarStandardsInfoDao;
|
||||
|
||||
|
||||
@Override
|
||||
public SarBussionessStand getStandInfoByReviseStatus(String reviseStatus,String standSort,String taskId){
|
||||
@@ -2003,7 +2008,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStandFile(MultipartFile file) throws Exception {
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStandFile(MultipartFile file) {
|
||||
//给出头部信息
|
||||
String[] headerExcel = {"企标编号,中文名称,英文名称,文本状态,发布日期,企标实施日期,企标制修订状态,起草部门,废止日期,代替企标编号,复审日期,起草人,被代替企标编号,采用标准,文件上传人员,采标程度,引用标准,适用车型,能源类型,适用产品线,上传时间,体系类别,备案日期,关联模块-乘用车VPPS编码,关联模块--乘用车vpps中文名称,关联模块--卡车VPPS编码,关联模块--卡车vpps中文名称,附件,企标类型,标准年份,"};
|
||||
|
||||
@@ -2028,7 +2033,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
saveDirectory.mkdir();
|
||||
}
|
||||
//将文件写入到指定路径中
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(),new File(path + "/" + fileNameStr));
|
||||
//FileUtils.copyInputStreamToFile(file.getInputStream(),new File(path + "/" + fileNameStr));
|
||||
try {
|
||||
//解压缩
|
||||
String zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
|
||||
@@ -2710,7 +2715,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
//
|
||||
//老系统中
|
||||
//kmpro_addon34表,记录所有标准信息
|
||||
//lore_depot_sort表中Sign字段可以看出是原文或译文
|
||||
//lore_depot_sort 表中Sign字段可以看出是原文或译文
|
||||
//lore_attache表中记录附件名称和路径
|
||||
//
|
||||
//新系统中
|
||||
@@ -2723,30 +2728,181 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage emptyFileAnewStorage() {
|
||||
//一: 进行数据备份 包含新系统数据备份,老系统数据备份 以及 本地备份 线上备份。
|
||||
//二: 对老系统中的三张表 进行迁移
|
||||
/*
|
||||
一:在老系统的数据库中的表进行迁移 然后根据迁移的数据
|
||||
二:查询出老系统的数据
|
||||
1:查询 出来所有的数据
|
||||
2: 查询出来以后 进行联查 三表进行联查 关联其中的数据 获得全部数据
|
||||
3: 查询出 海标标准和国内标准的全部数据 特点是 BUILD_ID 字段不能为空 因为 这个字段代表了和新老数据库的关系
|
||||
4: 查询出 企业标准的全部数据 特点依旧是 DUILD_Id 字段不能为空
|
||||
//1 查询 新系统的所有数据 其中包含为 国内 海外 获取到 DUILD_Id 字段用来对比
|
||||
List<OldSystem> SarBussionessStandList = sarBussionessStandEODao.selectListInfo();
|
||||
List<OldSystem> SarStandardsInfoList = sarStandardsInfoDao.selectListInfo();
|
||||
// 获取 kmpro_addon34 表的 lore_doc_id
|
||||
List<OldSystem> oldSystemInfoList = sarStandardsInfoDao.selectOldSystemInfo();
|
||||
//组合数据
|
||||
List<OldSystem> oldArr = new ArrayList();
|
||||
List<OldSystem> oldInfoArr = new ArrayList();
|
||||
//文件id
|
||||
List<String> fileIdList = new ArrayList<>();
|
||||
//文件路径
|
||||
List<String> fileSrcList = new ArrayList<>();
|
||||
//国内海外
|
||||
for (OldSystem oldSystem: oldSystemInfoList){
|
||||
for (OldSystem SarStandardsInfo: SarStandardsInfoList){
|
||||
//lore_doc_id 与 DUILD_Id
|
||||
if(StringUtils.isNotBlank(SarStandardsInfo.getBuildId())){
|
||||
if(oldSystem.getLoreDocId().equals(SarStandardsInfo.getBuildId())){
|
||||
//查询文件是否是多个 是否存在
|
||||
List<OldSystem> fileList = sarStandardsInfoDao.OldSystemFile(oldSystem.getLoreDocId());
|
||||
if(!fileList.isEmpty()){
|
||||
if(fileList.size()==1){
|
||||
//判断文件是否存在 重新存入文件 获取id 存入att 表
|
||||
OldSystem old = new OldSystem();
|
||||
File file = new File(fileList.get(0).getFileSrc());
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(file);
|
||||
//文件id 和数据id
|
||||
if(attFileVo != null) {
|
||||
fileIdList.add(attFileVo.getId());
|
||||
fileSrcList.add(fileList.get(0).getFileSrc());
|
||||
old.setStandId(SarStandardsInfo.getStandId());
|
||||
old.setSortSign(SarStandardsInfo.getSortSign());
|
||||
//判断存入原本版本 还是译文版本
|
||||
if (SarStandardsInfo.getSortSign().contains("译")) {
|
||||
old.setTranslation(attFileVo.getId());
|
||||
} else {
|
||||
old.setOriginal(attFileVo.getId());
|
||||
}
|
||||
oldArr.add(old);
|
||||
}
|
||||
}else {
|
||||
String yuan = "";
|
||||
String yi = "";
|
||||
OldSystem old = new OldSystem();
|
||||
//每一个文件 都是一个英文版 或者译文版
|
||||
// 如果每一个文件是 那我必然不能 这样子拼接
|
||||
// 应该是先判断他是 英文版 还是译文版 然后再 去拼接
|
||||
for (OldSystem src:fileList){
|
||||
File file = new File(src.getFileSrc());
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(file);
|
||||
if(attFileVo != null) {
|
||||
if (SarStandardsInfo.getSortSign().contains("译")) {
|
||||
if (StringUtils.isNotBlank(yi)) {
|
||||
yi = "," + attFileVo.getId();
|
||||
} else {
|
||||
yi = attFileVo.getId();
|
||||
}
|
||||
if (StringUtils.isNotBlank(yi)) {
|
||||
old.setTranslation(yi);
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(yuan)) {
|
||||
yuan = "," + attFileVo.getId();
|
||||
} else {
|
||||
yuan = attFileVo.getId();
|
||||
}
|
||||
if (StringUtils.isNotBlank(yuan)) {
|
||||
old.setOriginal(yuan);
|
||||
}
|
||||
}
|
||||
fileSrcList.add(src.getFileSrc());
|
||||
fileIdList.add(attFileVo.getId());
|
||||
}
|
||||
}
|
||||
old.setStandId(SarStandardsInfo.getStandId());
|
||||
oldArr.add(old);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 企业
|
||||
for (OldSystem oldSystem: oldSystemInfoList){
|
||||
for (OldSystem sarBussionessStand: SarBussionessStandList){
|
||||
//lore_doc_id 与 DUILD_Id
|
||||
if(StringUtils.isNotBlank(sarBussionessStand.getBuildId())){
|
||||
if(oldSystem.getLoreDocId().equals(sarBussionessStand.getBuildId())){
|
||||
//查询文件是否是多个 是否存在
|
||||
List<OldSystem> fileList = sarStandardsInfoDao.OldSystemFile(oldSystem.getLoreDocId());
|
||||
if(!fileList.isEmpty()){
|
||||
if(fileList.size()==1){
|
||||
//判断文件是否存在 重新存入文件 获取id 存入att 表
|
||||
OldSystem old = new OldSystem();
|
||||
File file = new File(fileList.get(0).getFileSrc());
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(file);
|
||||
//文件id 和数据id
|
||||
if(attFileVo != null) {
|
||||
fileIdList.add(attFileVo.getId());
|
||||
fileSrcList.add(fileList.get(0).getFileSrc());
|
||||
old.setStandId(sarBussionessStand.getStandId());
|
||||
old.setSortSign(sarBussionessStand.getSortSign());
|
||||
//判断存入原本版本 还是译文版本
|
||||
if (sarBussionessStand.getSortSign().contains("译")) {
|
||||
old.setTranslation(attFileVo.getId());
|
||||
} else {
|
||||
old.setOriginal(attFileVo.getId());
|
||||
}
|
||||
oldInfoArr.add(old);
|
||||
}
|
||||
}else {
|
||||
String yuan = "";
|
||||
String yi = "";
|
||||
OldSystem old = new OldSystem();
|
||||
for (OldSystem src:fileList) {
|
||||
File file = new File(src.getFileSrc());
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(file);
|
||||
if (attFileVo != null) {
|
||||
if (sarBussionessStand.getSortSign().contains("译")) {
|
||||
if (StringUtils.isNotBlank(yi)) {
|
||||
yi = "," + attFileVo.getId();
|
||||
} else {
|
||||
yi = attFileVo.getId();
|
||||
}
|
||||
old.setTranslation(yi);
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(yuan)) {
|
||||
yuan = "," + attFileVo.getId();
|
||||
} else {
|
||||
yuan = attFileVo.getId();
|
||||
}
|
||||
old.setOriginal(yuan);
|
||||
}
|
||||
fileSrcList.add(src.getFileSrc());
|
||||
fileIdList.add(attFileVo.getId());
|
||||
}
|
||||
}
|
||||
old.setStandId(sarBussionessStand.getStandId());
|
||||
oldInfoArr.add(old);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
三: 进行数据关联
|
||||
1:先跟 海外和国内的数据 进行对比 找到 kmpro_addon34表的lore_doc_id字段 与 新系统中数据表sar_standards_info表的BUILD_ID字段,
|
||||
2:对应老系统中数据表kmpro_addon34表的lore_doc_id字段 相同则进入
|
||||
四:关联数据的文件存储
|
||||
1: 判断能不能找到
|
||||
2: 如果能找到 则重新存入,
|
||||
3: 鉴定是否是原文 还是 译文 进行分类存储 或者进行标识存储
|
||||
4: 数据库增加字段,与老系统进行对应
|
||||
|
||||
数据存储的时候,建立一种表 这张表存储的数据是 需要转码的文件
|
||||
五: 数据对应上 以后 要进行换换 线上进行预览 (待)
|
||||
六: es数据进行同步
|
||||
*/
|
||||
return null;
|
||||
// 获取完整数据以后 数据库 增加字段, 然后区分是否是译文 原文 然后 进行保存 通过 id 可以找到对应的数据
|
||||
// 企业
|
||||
for(OldSystem data : oldInfoArr) {
|
||||
SarBussStandAttrInfo sarBussStandAttrInfo = new SarBussStandAttrInfo();
|
||||
String id = sarBussStandAttrInfoEODao.selectFieldValByStandId("id", data.getStandId());
|
||||
if(StringUtils.isNotBlank(id)) {
|
||||
sarBussStandAttrInfo.setId(id);
|
||||
sarBussStandAttrInfo.setFbgbuss(data.getOriginal());
|
||||
sarBussStandAttrInfo.setTranslation(data.getTranslation());
|
||||
}
|
||||
sarBussStandAttrInfoEODao.updateById(sarBussStandAttrInfo);
|
||||
}
|
||||
//海外 国内
|
||||
for(OldSystem data : oldInfoArr) {
|
||||
SarStandAttrInfo sarStandAttrInfo = new SarStandAttrInfo();
|
||||
String id = sarStandAttrInfoEODao.selectFieldValByStandId("id", data.getStandId());
|
||||
if(StringUtils.isNotBlank(id)) {
|
||||
sarStandAttrInfo.setId(id);
|
||||
sarStandAttrInfo.setFbgbjbd(data.getOriginal());
|
||||
sarStandAttrInfo.setTranslation(data.getTranslation());
|
||||
}
|
||||
sarStandAttrInfoEODao.updateById(sarStandAttrInfo);
|
||||
}
|
||||
//文件删除
|
||||
// for (String s : fileSrcList){
|
||||
// File file = new File(s);
|
||||
// file.delete();
|
||||
// }
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
@@ -238,5 +238,9 @@ public class SarStandAttrInfo extends BaseEntity {
|
||||
@TableField("BDTBZH")
|
||||
private String bdtbzh;
|
||||
|
||||
@ApiModelProperty(value = "译文件")
|
||||
@TableField("TRANSLATION")
|
||||
private String translation;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.slrs.sarStandardsInfo.dao;
|
||||
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.OldSystem;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.DSarStandardDTO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
@@ -99,4 +100,9 @@ public interface SarStandardsInfoDao extends BaseMapper<SarStandardsInfo> {
|
||||
|
||||
List<DSarStandardDTO> dealWithDS(@Param("type") String standType, @Param("status")List<String> strings);
|
||||
|
||||
List<OldSystem> selectOldSystemInfo();
|
||||
|
||||
List<OldSystem> selectListInfo();
|
||||
|
||||
List<OldSystem> OldSystemFile(@Param("loreDocId") String loreDocId);
|
||||
}
|
||||
|
||||
+8
@@ -1225,4 +1225,12 @@
|
||||
<if test="standSn != null" >#{standSn, jdbcType=VARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="selectListInfo" resultType="com.adc.da.slrs.sarBussionessStand.entity.OldSystem">
|
||||
SELECT
|
||||
std.id as 'standId',
|
||||
std.BUILD_ID as 'buildId',
|
||||
att.id as 'attfid'
|
||||
from sar_bussioness_stand std
|
||||
left JOIN sar_buss_stand_attr_info att on std.id = att.STAND_ID
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+33
@@ -1888,4 +1888,37 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectOldSystemInfo" resultType="com.adc.da.slrs.sarBussionessStand.entity.OldSystem">
|
||||
SELECT
|
||||
km.lore_doc_id as 'loreDocId',
|
||||
lo.Sign as 'fileSign',
|
||||
lo.Src as 'fileSrc',
|
||||
so.id as 'sortId',
|
||||
so.Sign as 'sortSign'
|
||||
from kmpro_addon34 km
|
||||
left JOIN lore_attache lo on km.lore_doc_id = lo.LoreDocID
|
||||
left JOIN lore_depot_sort so on km.sort_id = so.id
|
||||
</select>
|
||||
|
||||
<select id="selectListInfo" resultType="com.adc.da.slrs.sarBussionessStand.entity.OldSystem">
|
||||
SELECT
|
||||
std.id as 'standId',
|
||||
std.BUILD_ID as 'buildId',
|
||||
att.id as 'attfid'
|
||||
from sar_standards_info std
|
||||
left JOIN sar_stand_attr_info att on std.id = att.STAND_ID
|
||||
</select>
|
||||
|
||||
<select id="OldSystemFile" resultType="com.adc.da.slrs.sarBussionessStand.entity.OldSystem">
|
||||
SELECT
|
||||
lo.LoreDocID as 'loreDocId',
|
||||
lo.Sign as 'fileSign',
|
||||
lo.Src as 'fileSrc'
|
||||
from lore_attache lo
|
||||
where 1=1
|
||||
<if test="loreDocId != null">
|
||||
and lo.LoreDocID = #{loreDocId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user