feat: There is no way the Buss and Convert

This commit is contained in:
super_liu
2021-08-20 14:07:37 +08:00
parent 97b1b92acc
commit d176d93d6b
24 changed files with 1046 additions and 673 deletions
@@ -22,6 +22,6 @@ public class CreateConvertMQService {
public void sendConvertMQ(AttFileEO attFileEO){
// 中间转换业务逻辑
//发送消息队列
this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR", "convert-key_SQ_GSAR", attFileEO);
// this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR", "convert-key_SQ_GSAR", attFileEO);
}
}
@@ -1,217 +1,412 @@
//package com.adc.da.convert.mq;
//
//import com.adc.da.att.entity.AttFileEO;
//import com.adc.da.att.service.IAttFileEOService;
//import com.adc.da.convert.common.DocConverterPdf;
//import com.adc.da.util.http.ResponseMessage;
//import com.adc.da.util.http.Result;
//import com.adc.da.util.utils.StringUtils;
//import com.rabbitmq.client.Channel;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.amqp.rabbit.annotation.Exchange;
//import org.springframework.amqp.rabbit.annotation.Queue;
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.amqp.support.AmqpHeaders;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.messaging.Message;
//import org.springframework.stereotype.Component;
//
//import java.io.File;
//import java.util.Date;
//import java.util.Map;
//
//@Component
//public class SendConvertMQService {
//
// // 文档转换远程服务IP地址
// @Value("${convert.host}")
// private String convertHost;
//
// @Autowired
// private IAttFileEOService iAttFileEOService;
//
// private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
//
// @RabbitListener(bindings = @QueueBinding(
// value = @Queue(value = "createConvertStandMQ_SQ_GSAR", durable = "true"),
// exchange = @Exchange(value = "convert-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
// key = "convert-key_SQ_GSAR"))
// public void createMQ(AttFileEO attFileEO, Message message, Channel channel) throws Exception{
// try{
// try{
// Thread.sleep(5000);
// insertOrUpdateStandInfo(attFileEO);
// }catch(InterruptedException e){
// logger.error(e.toString());
// Thread.currentThread().interrupt();
// }
// } catch (Exception e) {
// logger.error("文档转换消息队列进入添加数据方法前失败!");
// logger.error(e.getMessage(),e);
// }finally {
// Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
// channel.basicAck(tag,false);
// logger.debug("文档转换消息确认成功!!!!!!!!!");
// }
//
// }
//
// public void insertConvertMsg(Map<String,Object> convertInfo) throws Exception{
// String attId = "";
// String filePath = "";
// String otId = "";
// String addUpFlag = "";
// String convertType = "";
// String standFileClassify = "";
// String lawsFileClassify = "";
// //资源与文件关联表转换成功的ID
// String standFilePdfId = "";
// if(convertInfo.get("attId") != null){
// attId = convertInfo.get("attId").toString();
// }
// if(convertInfo.get("path") != null){
// filePath = convertInfo.get("path").toString();
// }
// if(convertInfo.get("otId") != null){
// otId = convertInfo.get("otId").toString();
// }
// if(convertInfo.get("addUpFlag") != null){
// addUpFlag = convertInfo.get("addUpFlag").toString();
// }
// if(convertInfo.get("convertType") != null){
// convertType = convertInfo.get("convertType").toString();
// }
// if(convertInfo.get("standFilePdfId") != null){
// standFilePdfId = convertInfo.get("standFilePdfId").toString();
// }
// if(convertInfo.get("standFileClassify") != null){
// standFileClassify = convertInfo.get("standFileClassify").toString();
// }
// if(convertInfo.get("lawsFileClassify") != null){
// lawsFileClassify = convertInfo.get("lawsFileClassify").toString();
// }
//
// //更改完转换表信息后开始转换
// OtConvertMqEO convertMqEO = new OtConvertMqEO();
// if("0".equals(addUpFlag)){
// convertMqEO.setLawsId(convertInfo.get("lawsId").toString());
//// convertMqEO.setResId(convertInfo.get("resId").toString());
// }
// convertMqEO.setConvertType(convertType);
// convertMqEO.setAttId(attId);
// convertMqEO.setOriAttId(attId);
// convertMqEO.setId(otId);
// convertMqEO.setFilePath(filePath);
// convertMqEO.setAddOrUp(addUpFlag);
// convertMqEO.setPdfId(standFilePdfId);
// convertMqEO.setStandFileClassify(standFileClassify);
// convertMqEO.setLawsFileClassify(lawsFileClassify);
// int i = Integer.valueOf(convertInfo.get("againNum").toString());
// convertMqEO.setAgainNum(i);
// docUploadConvert(convertMqEO);
// }
//
// /**
// * @Author yangxuenan
// * @Description 文件转换
// * Date 2018/8/21 15:51
// * @Param [path]
// * @return com.adc.da.util.http.ResponseMessage
// **/
// public ResponseMessage docUploadConvert(OtConvertMqEO convertMqEO) throws Exception{
// //保存在数据库中的ID
// String path = localFilePath + convertMqEO.getFilePath();
// String convertId = convertMqEO.getId();
// try {
// //进入转换方法中,修改OT_CONVERT表中状态为转换中
// convertMqEO.setId(convertId);
// convertMqEO.setModifyTime(new Date());
// convertMqEO.setMqState(3);
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
// //开始转换。。。。。。
// if(!"".equals(path)){
// String converfilename = path.replaceAll("\\\\", "/");
// logger.info("*****上传路径:*******"+localFilePath);
// logger.info("************文件路径:**********" + convertMqEO.getFilePath());
// logger.info("************接口:**********" + port);
// logger.info("*****上传路径替换,加入文件名*******"+converfilename);
// //截取文件类型
// int index = converfilename.lastIndexOf(".");
// String fileType = converfilename.substring(index,converfilename.length());
// String fileOriName = converfilename.substring(0,index);
// //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
// DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
// d.setConvertHost(convertHost);
// //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
// File getPdf = d.conver(fileType);
// //调用getswfPath()方法,打印转换后的swf文件路径
// String dPath = d.getpdfPath();
// logger.info("*****转换后的pdf文件路径*******"+dPath);
// //判断是否转换成功,修改数据状态
// if(!dPath.isEmpty() && getPdf.length()>0){
// // 上传转换后文件
// String pdfId = attFileEOService.saveFileAttId(getPdf);
// logger.info("////////转换后文件id"+pdfId);
// int count = 0;
// if("0".equals(convertMqEO.getAddOrUp())){
// count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
// } else {
// //查询之前在资源与文件关联表中是否有转换成功的数据,如果有执行修改,没有执行新增
// if(StringUtils.isNotEmpty(convertMqEO.getPdfId())){
// count = updateConvertDocToFIles(convertMqEO,pdfId);
// } else {
// count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
// }
// }
// convertMqEO.setId(convertId);
// if (count>0) {
// // 转换成功
// convertMqEO.setModifyTime(new Date());
// convertMqEO.setMqState(1);
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
// } else {
// // 转换失败
// convertMqEO.setModifyTime(new Date());
// convertMqEO.setMqState(2);
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
// }
// } else {
// // 转换失败
// convertMqEO.setId(convertId);
// convertMqEO.setModifyTime(new Date());
// convertMqEO.setMqState(2);
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
// if(convertMqEO.getAgainNum()<=5){
// throw new Exception("转换失败");
// }
// }
// return Result.success(dPath);
// } else {
// logger.error("转换时未获取到文件路径!");
// return Result.error("文件存储失败,请重试");
// }
// } catch (Exception e) {
// // 转换失败
// logger.error("转换过程中失败!");
// logger.error(e.getMessage(),e);
// convertMqEO.setId(convertId);
// convertMqEO.setMqState(2);
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
// this.restartUploadConvert(convertMqEO);
// return Result.error("r0072", "文件转换失败,请重试");
// }
// }
//
// /**
// * 文档转换逻辑
// * @param attFileEO
// */
// public void insertOrUpdateStandInfo(AttFileEO attFileEO){
//
// }
//
//
//}
package com.adc.da.convert.mq;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.common.ConvertMqEO;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.common.UseModuleEnum;
import com.adc.da.convert.common.DocConverterPdf;
import com.adc.da.convert.otConvertMq.entity.OtConvertMq;
import com.adc.da.convert.otConvertMq.service.IOtConvertMqService;
import com.adc.da.mq.service.CreateMQService;
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.adc.da.sys.util.LoginUserUtil;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import com.adc.da.util.utils.StringUtils;
import com.adc.da.util.utils.UUID;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.Date;
import java.util.Map;
@Component
public class SendConvertMQService {
// 文档转换远程服务IP地址
@Value("${convert.host}")
private String convertHost;
@Value("${server.port}")
private String port;
@Value("${file.path}")
private String localFilePath;
@Autowired
private IAttFileEOService attFileEOService;
@Autowired
private CreateMQService convertMq;
@Autowired
private IOtConvertMqService convertMqEOService;
@Autowired
private SarStandFileDao sarStandFileEODao;
@Autowired
private SarBussStandFileDao sarBussStandFileEODao;
private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = "createConvertStandMQ_SQ_GSAR", durable = "true"),
exchange = @Exchange(value = "convert-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
key = "convert-key_SQ_GSAR"))
public void createMQ(Map<String,Object> convertInfo, Message message, Channel channel) throws Exception{
try{
try{
Thread.sleep(5000);
insertConvertMsg(convertInfo);
}catch(InterruptedException e){
logger.error(e.toString());
Thread.currentThread().interrupt();
}
} catch (Exception e) {
logger.error("文档转换消息队列进入添加数据方法前失败!");
logger.error(e.getMessage(),e);
}finally {
Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
channel.basicAck(tag,false);
logger.debug("文档转换消息确认成功!!!!!!!!!");
}
}
public void insertConvertMsg(Map<String,Object> convertInfo) throws Exception{
String attId = "";
String filePath = "";
String otId = "";
String addUpFlag = "";
String convertType = "";
String standFileClassify = "";
String lawsFileClassify = "";
//资源与文件关联表转换成功的ID
String standFilePdfId = "";
if(convertInfo.get("attId") != null){
attId = convertInfo.get("attId").toString();
}
if(convertInfo.get("path") != null){
filePath = convertInfo.get("path").toString();
}
if(convertInfo.get("otId") != null){
otId = convertInfo.get("otId").toString();
}
if(convertInfo.get("addUpFlag") != null){
addUpFlag = convertInfo.get("addUpFlag").toString();
}
if(convertInfo.get("convertType") != null){
convertType = convertInfo.get("convertType").toString();
}
if(convertInfo.get("standFilePdfId") != null){
standFilePdfId = convertInfo.get("standFilePdfId").toString();
}
if(convertInfo.get("standFileClassify") != null){
standFileClassify = convertInfo.get("standFileClassify").toString();
}
if(convertInfo.get("lawsFileClassify") != null){
lawsFileClassify = convertInfo.get("lawsFileClassify").toString();
}
//更改完转换表信息后开始转换
OtConvertMq convertMqEO = new OtConvertMq();
if("0".equals(addUpFlag)){
convertMqEO.setLawsId(convertInfo.get("lawsId").toString());
// convertMqEO.setResId(convertInfo.get("resId").toString());
}
convertMqEO.setConvertType(convertType);
convertMqEO.setAttId(attId);
convertMqEO.setOriAttId(attId);
convertMqEO.setId(otId);
convertMqEO.setFilePath(filePath);
convertMqEO.setAddOrUp(addUpFlag);
convertMqEO.setPdfId(standFilePdfId);
convertMqEO.setStandFileClassify(standFileClassify);
convertMqEO.setLawsFileClassify(lawsFileClassify);
int i = Integer.valueOf(convertInfo.get("againNum").toString());
convertMqEO.setAgainNum(i);
docUploadConvert(convertMqEO);
}
/**
* @Author yangxuenan
* @Description 文件转换
* Date 2018/8/21 15:51
* @Param [path]
* @return com.adc.da.util.http.ResponseMessage
**/
public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{
//保存在数据库中的ID
String path = localFilePath + convertMqEO.getFilePath();
String convertId = convertMqEO.getId();
try {
//进入转换方法中,修改OT_CONVERT表中状态为转换中
convertMqEO.setId(convertId);
convertMqEO.setModifyTime(new Date());
convertMqEO.setMqState(3);
convertMqEOService.updateById(convertMqEO);
//开始转换。。。。。。
if(!"".equals(path)){
String converfilename = path.replaceAll("\\\\", "/");
logger.info("*****上传路径:*******"+localFilePath);
logger.info("************文件路径:**********" + convertMqEO.getFilePath());
logger.info("************接口:**********" + port);
logger.info("*****上传路径替换,加入文件名*******"+converfilename);
//截取文件类型
int index = converfilename.lastIndexOf(".");
String fileType = converfilename.substring(index,converfilename.length());
String fileOriName = converfilename.substring(0,index);
//调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
d.setConvertHost(convertHost);
//调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
File getPdf = d.conver(fileType);
//调用getswfPath()方法,打印转换后的swf文件路径
String dPath = d.getpdfPath();
logger.info("*****转换后的pdf文件路径*******"+dPath);
//判断是否转换成功,修改数据状态
if(!dPath.isEmpty() && getPdf.length()>0){
// 上传转换后文件
String pdfId = attFileEOService.saveFileAttId(getPdf);
logger.info("////////转换后文件id"+pdfId);
int count = 0;
if("0".equals(convertMqEO.getAddOrUp())){
count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
} else {
//查询之前在资源与文件关联表中是否有转换成功的数据,如果有执行修改,没有执行新增
if(StringUtils.isNotEmpty(convertMqEO.getPdfId())){
count = updateConvertDocToFIles(convertMqEO,pdfId);
} else {
count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
}
}
convertMqEO.setId(convertId);
if (count>0) {
// 转换成功
convertMqEO.setModifyTime(new Date());
convertMqEO.setMqState(1);
convertMqEOService.updateById(convertMqEO);
} else {
// 转换失败
convertMqEO.setModifyTime(new Date());
convertMqEO.setMqState(2);
convertMqEOService.updateById(convertMqEO);
}
} else {
// 转换失败
convertMqEO.setId(convertId);
convertMqEO.setModifyTime(new Date());
convertMqEO.setMqState(2);
convertMqEOService.updateById(convertMqEO);
if(convertMqEO.getAgainNum()<=5){
throw new Exception("转换失败");
}
}
return Result.success(dPath);
} else {
logger.error("转换时未获取到文件路径!");
return Result.error("文件存储失败,请重试");
}
} catch (Exception e) {
// 转换失败
logger.error("转换过程中失败!");
logger.error(e.getMessage(),e);
convertMqEO.setId(convertId);
convertMqEO.setMqState(2);
convertMqEOService.updateById(convertMqEO);
this.restartUploadConvert(convertMqEO);
return Result.error("r0072", "文件转换失败,请重试");
}
}
public ResponseMessage restartUploadConvert(OtConvertMq convertInfo) throws Exception{
ConvertMqEO convertMqEO = new ConvertMqEO();
convertMqEO.setLawsId(convertInfo.getLawsId());
convertMqEO.setConvertType(convertInfo.getConvertType());
convertMqEO.setAttId(convertInfo.getAttId());
convertMqEO.setOriAttId(convertInfo.getOriAttId());
convertMqEO.setId(convertInfo.getId());
convertMqEO.setFilePath(convertInfo.getFilePath());
convertMqEO.setAddOrUp(convertInfo.getAddOrUp());
convertMqEO.setPdfId(convertInfo.getPdfId());
convertMqEO.setStandFileClassify(convertInfo.getStandFileClassify());
int countAdd = 0;
convertMqEO.setAddOrUp("1");
int againNumNew = Integer.valueOf(convertInfo.getAgainNum());
convertMqEO.setAgainNum(againNumNew+1);
convertMq.sendMQ(convertMqEO);
return Result.success("true","已重新加入转换","");
}
/**
* @Author yangxuenan
* @Description 修改标准法规文件表pdf信息
* Date 2018/10/31 17:09
* @Param [convertMq, pdfId]
* @return int
**/
public int updateConvertDocToFIles(OtConvertMq convertMq,String pdfId){
int countSuccess = 0;
if(SarTypeEnum.STAND.getValue().equals(convertMq.getConvertType())){
SarStandFile lawsFile = new SarStandFile();
lawsFile.setId(convertMq.getPdfId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setModifyTime(new Date());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
countSuccess = sarStandFileEODao.updateById(lawsFile);
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
// SarLawsFile lawsFile = new SarLawsFile();
// lawsFile.setId(convertMq.getPdfId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setModifyTime(new Date());
// countSuccess = sarLawsFileEODao.updateByPrimaryKeySelective(lawsFile);
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
SarBussStandFile lawsFile = new SarBussStandFile();
lawsFile.setId(convertMq.getPdfId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setUseModule(UseModuleEnum.WEB_FILE.getValue());
lawsFile.setModifyTime(new Date());
countSuccess = sarBussStandFileEODao.updateById(lawsFile);
}else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) {
// SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO();
// lawsFile.setId(convertMq.getPdfId());
// lawsFile.setRecordsId(convertMq.getLawsId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setValidFlag("0");
// lawsFile.setCreationTime(new Date());
// lawsFile.setModifyTime(new Date());
// countSuccess = sarBussRecordsFileEODao.updateByPrimaryKeySelective(lawsFile);
}
else {
// SarFileSplitItemsFileEO lawsFile = new SarFileSplitItemsFileEO();
// lawsFile.setId(convertMq.getPdfId());
// lawsFile.setAttId(pdfId);
//// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setModifyTime(new Date());
// countSuccess = sarFileSplitItemsFileEODao.updateByPrimaryKeySelective(lawsFile);
}
return countSuccess;
}
/**
* @Author yangxuenan
* @Description 添加标准法规文件表pdf信息
* Date 2018/10/30 21:52
* @Param [convertMq]
* @return int
**/
public int insertConvertDocToFiles(OtConvertMq convertMq,String pdfId,String fileOriName,String fileType) {
int countSuccess = 0;
String creationUser = LoginUserUtil.getUserId();
if(SarTypeEnum.STAND.getValue().equals(convertMq.getConvertType())){
SarStandFile lawsFile = new SarStandFile();
lawsFile.setId(UUID.randomUUID(20));
lawsFile.setStandId(convertMq.getLawsId());
// lawsFile.setResId(convertMq.getResId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setValidFlag("0");
lawsFile.setCreationUser(creationUser);
lawsFile.setCreationTime(new Date());
lawsFile.setModifyTime(new Date());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
lawsFile.setStandFileClassify(convertMq.getStandFileClassify());
lawsFile.setFileName(fileOriName+".pdf");
lawsFile.setFileSuffix("pdf");
countSuccess = sarStandFileEODao.insert(lawsFile);
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
// SarLawsFile lawsFile = new SarLawsFile();
// lawsFile.setId(UUID.randomUUID(20));
// lawsFile.setLawsId(convertMq.getLawsId());
// lawsFile.setResId(convertMq.getResId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setValidFlag("0");
// lawsFile.setCreationTime(new Date());
// lawsFile.setModifyTime(new Date());
// lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
// lawsFile.setFileName(fileOriName+".pdf");
// lawsFile.setFileSuffix("pdf");
// countSuccess = sarLawsFileEODao.insertSelective(lawsFile);
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
SarBussStandFile lawsFile = new SarBussStandFile();
lawsFile.setId(UUID.randomUUID(20));
lawsFile.setStandId(convertMq.getLawsId());
lawsFile.setResId(convertMq.getResId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setUseModule(UseModuleEnum.WEB_FILE.getValue());
lawsFile.setStandFileClassify(convertMq.getStandFileClassify());
lawsFile.setFileName(fileOriName+".pdf");
lawsFile.setFileSuffix("pdf");
lawsFile.setValidFlag(0);
lawsFile.setCreationTime(new Date());
lawsFile.setModifyTime(new Date());
countSuccess = sarBussStandFileEODao.insert(lawsFile);
}
else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) {
// SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO();
// lawsFile.setId(UUID.randomUUID(20));
// lawsFile.setRecordsId(convertMq.getLawsId());
// lawsFile.setResId(convertMq.getResId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setRecordsFileClassify(convertMq.getStandFileClassify());
// lawsFile.setFileName(fileOriName+".pdf");
// lawsFile.setFileSuffix("pdf");
// lawsFile.setValidFlag("0");
// lawsFile.setCreationTime(new Date());
// lawsFile.setModifyTime(new Date());
// countSuccess = sarBussRecordsFileEODao.insertSelective(lawsFile);
}else {
// SarFileSplitItemsFileEO lawsFile = new SarFileSplitItemsFileEO();
// lawsFile.setId(UUID.randomUUID(20));
// lawsFile.setStandId(convertMq.getLawsId());
// lawsFile.setResId(convertMq.getResId());
// lawsFile.setAttId(pdfId);
//// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setValidFlag(0);
// lawsFile.setCreationTime(new Date());
// lawsFile.setModifyTime(new Date());
// countSuccess = sarFileSplitItemsFileEODao.insertSelective(lawsFile);
}
return countSuccess;
}
/**
* 文档转换逻辑
* @param attFileEO
*/
public void insertOrUpdateStandInfo(AttFileEO attFileEO){
}
}
@@ -1,4 +1,4 @@
package com.adc.da.convert.OtConvert.controller;
package com.adc.da.convert.otConvert.controller;
import com.adc.da.att.entity.AttFileEO;
@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.convert.OtConvert.entity.OtConvert;
import com.adc.da.convert.otConvert.entity.OtConvert;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
@@ -1,6 +1,6 @@
package com.adc.da.convert.OtConvert.dao;
package com.adc.da.convert.otConvert.dao;
import com.adc.da.convert.OtConvert.entity.OtConvert;
import com.adc.da.convert.otConvert.entity.OtConvert;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
@@ -1,8 +1,8 @@
package com.adc.da.convert.OtConvert.entity;
package com.adc.da.convert.otConvert.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -1,6 +1,6 @@
package com.adc.da.convert.OtConvert.service;
package com.adc.da.convert.otConvert.service;
import com.adc.da.convert.OtConvert.entity.OtConvert;
import com.adc.da.convert.otConvert.entity.OtConvert;
import com.baomidou.mybatisplus.extension.service.IService;
/**
@@ -1,8 +1,8 @@
package com.adc.da.convert.OtConvert.service.impl;
package com.adc.da.convert.otConvert.service.impl;
import com.adc.da.convert.OtConvert.entity.OtConvert;
import com.adc.da.convert.OtConvert.dao.OtConvertDao;
import com.adc.da.convert.OtConvert.service.IOtConvertService;
import com.adc.da.convert.otConvert.entity.OtConvert;
import com.adc.da.convert.otConvert.dao.OtConvertDao;
import com.adc.da.convert.otConvert.service.IOtConvertService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@@ -0,0 +1,23 @@
package com.adc.da.convert.otConvertMq.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.convert.otConvertMq.entity.OtConvertMq;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 文档转换记录信息表 前端控制器
* </p>
*
* @author super_liu
* @since 2021-08-20
*/
@RestController
@Api(description = "|OtConvertMq|")
@RequestMapping("/otConvertMq/ot-convert-mq")
public class OtConvertMqController extends BaseController<OtConvertMq> {
}
@@ -0,0 +1,16 @@
package com.adc.da.convert.otConvertMq.dao;
import com.adc.da.convert.otConvertMq.entity.OtConvertMq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 文档转换记录信息表 Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-08-20
*/
public interface OtConvertMqDao extends BaseMapper<OtConvertMq> {
}
@@ -0,0 +1,99 @@
package com.adc.da.convert.otConvertMq.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* <p>
* 文档转换记录信息表
* </p>
*
* @author super_liu
* @since 2021-08-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="OtConvertMq对象", description="文档转换记录信息表")
public class OtConvertMq extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "消息队列编码")
@TableField("MQ_CODE")
private String mqCode;
@ApiModelProperty(value = "队列状态")
@TableField("MQ_STATE")
private Integer mqState;
@TableField("USER_ID")
private String userId;
@ApiModelProperty(value = "文件路径")
@TableField("FILE_PATH")
private String filePath;
@ApiModelProperty(value = "文件ID")
@TableField("ATT_ID")
private String attId;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private Integer validFlag;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@TableField(exist = false)
private String fileOriginPath;
//向文件表添加信息
@TableField(exist = false)
private String lawsId;
@TableField(exist = false)
private String resId;
@TableField(exist = false)
private String convertType;
@TableField(exist = false)
private String pdfPath;
@TableField(exist = false)
private String pdfId;
@TableField(exist = false)
private String addOrUp;
@TableField(exist = false)
private String oldFileName;
@TableField(exist = false)
private String standFileClassify;
@TableField(exist = false)
private String lawsFileClassify;
@TableField(exist = false)
private String oriAttId;
@TableField(exist = false)
private int againNum;
}
@@ -0,0 +1,16 @@
package com.adc.da.convert.otConvertMq.service;
import com.adc.da.convert.otConvertMq.entity.OtConvertMq;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 文档转换记录信息表 服务类
* </p>
*
* @author super_liu
* @since 2021-08-20
*/
public interface IOtConvertMqService extends IService<OtConvertMq> {
}
@@ -0,0 +1,20 @@
package com.adc.da.convert.otConvertMq.service.impl;
import com.adc.da.convert.otConvertMq.dao.OtConvertMqDao;
import com.adc.da.convert.otConvertMq.entity.OtConvertMq;
import com.adc.da.convert.otConvertMq.service.IOtConvertMqService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 文档转换记录信息表 服务实现类
* </p>
*
* @author super_liu
* @since 2021-08-20
*/
@Service
public class OtConvertMqServiceImpl extends ServiceImpl<OtConvertMqDao, OtConvertMq> implements IOtConvertMqService {
}