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
+6
View File
@@ -87,6 +87,12 @@
<artifactId>dom4j</artifactId> <artifactId>dom4j</artifactId>
<version>2.0.0</version> <version>2.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-slrs</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
@@ -22,6 +22,6 @@ public class CreateConvertMQService {
public void sendConvertMQ(AttFileEO attFileEO){ 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; package com.adc.da.convert.mq;
//
//import com.adc.da.att.entity.AttFileEO; import com.adc.da.att.entity.AttFileEO;
//import com.adc.da.att.service.IAttFileEOService; import com.adc.da.att.service.IAttFileEOService;
//import com.adc.da.convert.common.DocConverterPdf; import com.adc.da.common.ConvertMqEO;
//import com.adc.da.util.http.ResponseMessage; import com.adc.da.common.SarTypeEnum;
//import com.adc.da.util.http.Result; import com.adc.da.common.UseModuleEnum;
//import com.adc.da.util.utils.StringUtils; import com.adc.da.convert.common.DocConverterPdf;
//import com.rabbitmq.client.Channel; import com.adc.da.convert.otConvertMq.entity.OtConvertMq;
//import org.slf4j.Logger; import com.adc.da.convert.otConvertMq.service.IOtConvertMqService;
//import org.slf4j.LoggerFactory; import com.adc.da.mq.service.CreateMQService;
//import org.springframework.amqp.rabbit.annotation.Exchange; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
//import org.springframework.amqp.rabbit.annotation.Queue; import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
//import org.springframework.amqp.rabbit.annotation.QueueBinding; import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
//import org.springframework.amqp.rabbit.annotation.RabbitListener; import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
//import org.springframework.amqp.support.AmqpHeaders; import com.adc.da.sys.util.LoginUserUtil;
//import org.springframework.beans.factory.annotation.Autowired; import com.adc.da.util.http.ResponseMessage;
//import org.springframework.beans.factory.annotation.Value; import com.adc.da.util.http.Result;
//import org.springframework.messaging.Message; import com.adc.da.util.utils.StringUtils;
//import org.springframework.stereotype.Component; import com.adc.da.util.utils.UUID;
// import com.rabbitmq.client.Channel;
//import java.io.File; import org.slf4j.Logger;
//import java.util.Date; import org.slf4j.LoggerFactory;
//import java.util.Map; import org.springframework.amqp.rabbit.annotation.Exchange;
// import org.springframework.amqp.rabbit.annotation.Queue;
//@Component import org.springframework.amqp.rabbit.annotation.QueueBinding;
//public class SendConvertMQService { import org.springframework.amqp.rabbit.annotation.RabbitListener;
// import org.springframework.amqp.support.AmqpHeaders;
// // 文档转换远程服务IP地址 import org.springframework.beans.factory.annotation.Autowired;
// @Value("${convert.host}") import org.springframework.beans.factory.annotation.Value;
// private String convertHost; import org.springframework.messaging.Message;
// import org.springframework.stereotype.Component;
// @Autowired
// private IAttFileEOService iAttFileEOService; import java.io.File;
// import java.util.Date;
// private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class); import java.util.Map;
//
// @RabbitListener(bindings = @QueueBinding( @Component
// value = @Queue(value = "createConvertStandMQ_SQ_GSAR", durable = "true"), public class SendConvertMQService {
// exchange = @Exchange(value = "convert-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
// key = "convert-key_SQ_GSAR")) // 文档转换远程服务IP地址
// public void createMQ(AttFileEO attFileEO, Message message, Channel channel) throws Exception{ @Value("${convert.host}")
// try{ private String convertHost;
// try{
// Thread.sleep(5000); @Value("${server.port}")
// insertOrUpdateStandInfo(attFileEO); private String port;
// }catch(InterruptedException e){
// logger.error(e.toString()); @Value("${file.path}")
// Thread.currentThread().interrupt(); private String localFilePath;
// }
// } catch (Exception e) { @Autowired
// logger.error("文档转换消息队列进入添加数据方法前失败!"); private IAttFileEOService attFileEOService;
// logger.error(e.getMessage(),e);
// }finally { @Autowired
// Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG); private CreateMQService convertMq;
// channel.basicAck(tag,false);
// logger.debug("文档转换消息确认成功!!!!!!!!!"); @Autowired
// } private IOtConvertMqService convertMqEOService;
//
// } @Autowired
// private SarStandFileDao sarStandFileEODao;
// public void insertConvertMsg(Map<String,Object> convertInfo) throws Exception{
// String attId = ""; @Autowired
// String filePath = ""; private SarBussStandFileDao sarBussStandFileEODao;
// String otId = "";
// String addUpFlag = ""; private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
// String convertType = "";
// String standFileClassify = ""; @RabbitListener(bindings = @QueueBinding(
// String lawsFileClassify = ""; value = @Queue(value = "createConvertStandMQ_SQ_GSAR", durable = "true"),
// //资源与文件关联表转换成功的ID exchange = @Exchange(value = "convert-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
// String standFilePdfId = ""; key = "convert-key_SQ_GSAR"))
// if(convertInfo.get("attId") != null){ public void createMQ(Map<String,Object> convertInfo, Message message, Channel channel) throws Exception{
// attId = convertInfo.get("attId").toString(); try{
// } try{
// if(convertInfo.get("path") != null){ Thread.sleep(5000);
// filePath = convertInfo.get("path").toString(); insertConvertMsg(convertInfo);
// } }catch(InterruptedException e){
// if(convertInfo.get("otId") != null){ logger.error(e.toString());
// otId = convertInfo.get("otId").toString(); Thread.currentThread().interrupt();
// } }
// if(convertInfo.get("addUpFlag") != null){ } catch (Exception e) {
// addUpFlag = convertInfo.get("addUpFlag").toString(); logger.error("文档转换消息队列进入添加数据方法前失败!");
// } logger.error(e.getMessage(),e);
// if(convertInfo.get("convertType") != null){ }finally {
// convertType = convertInfo.get("convertType").toString(); Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
// } channel.basicAck(tag,false);
// if(convertInfo.get("standFilePdfId") != null){ logger.debug("文档转换消息确认成功!!!!!!!!!");
// standFilePdfId = convertInfo.get("standFilePdfId").toString(); }
// }
// if(convertInfo.get("standFileClassify") != null){ }
// standFileClassify = convertInfo.get("standFileClassify").toString();
// } public void insertConvertMsg(Map<String,Object> convertInfo) throws Exception{
// if(convertInfo.get("lawsFileClassify") != null){ String attId = "";
// lawsFileClassify = convertInfo.get("lawsFileClassify").toString(); String filePath = "";
// } String otId = "";
// String addUpFlag = "";
// //更改完转换表信息后开始转换 String convertType = "";
// OtConvertMqEO convertMqEO = new OtConvertMqEO(); String standFileClassify = "";
// if("0".equals(addUpFlag)){ String lawsFileClassify = "";
// convertMqEO.setLawsId(convertInfo.get("lawsId").toString()); //资源与文件关联表转换成功的ID
//// convertMqEO.setResId(convertInfo.get("resId").toString()); String standFilePdfId = "";
// } if(convertInfo.get("attId") != null){
// convertMqEO.setConvertType(convertType); attId = convertInfo.get("attId").toString();
// convertMqEO.setAttId(attId); }
// convertMqEO.setOriAttId(attId); if(convertInfo.get("path") != null){
// convertMqEO.setId(otId); filePath = convertInfo.get("path").toString();
// convertMqEO.setFilePath(filePath); }
// convertMqEO.setAddOrUp(addUpFlag); if(convertInfo.get("otId") != null){
// convertMqEO.setPdfId(standFilePdfId); otId = convertInfo.get("otId").toString();
// convertMqEO.setStandFileClassify(standFileClassify); }
// convertMqEO.setLawsFileClassify(lawsFileClassify); if(convertInfo.get("addUpFlag") != null){
// int i = Integer.valueOf(convertInfo.get("againNum").toString()); addUpFlag = convertInfo.get("addUpFlag").toString();
// convertMqEO.setAgainNum(i); }
// docUploadConvert(convertMqEO); if(convertInfo.get("convertType") != null){
// } convertType = convertInfo.get("convertType").toString();
// }
// /** if(convertInfo.get("standFilePdfId") != null){
// * @Author yangxuenan standFilePdfId = convertInfo.get("standFilePdfId").toString();
// * @Description 文件转换 }
// * Date 2018/8/21 15:51 if(convertInfo.get("standFileClassify") != null){
// * @Param [path] standFileClassify = convertInfo.get("standFileClassify").toString();
// * @return com.adc.da.util.http.ResponseMessage }
// **/ if(convertInfo.get("lawsFileClassify") != null){
// public ResponseMessage docUploadConvert(OtConvertMqEO convertMqEO) throws Exception{ lawsFileClassify = convertInfo.get("lawsFileClassify").toString();
// //保存在数据库中的ID }
// String path = localFilePath + convertMqEO.getFilePath();
// String convertId = convertMqEO.getId(); //更改完转换表信息后开始转换
// try { OtConvertMq convertMqEO = new OtConvertMq();
// //进入转换方法中,修改OT_CONVERT表中状态为转换中 if("0".equals(addUpFlag)){
// convertMqEO.setId(convertId); convertMqEO.setLawsId(convertInfo.get("lawsId").toString());
// convertMqEO.setModifyTime(new Date()); // convertMqEO.setResId(convertInfo.get("resId").toString());
// convertMqEO.setMqState(3); }
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO); convertMqEO.setConvertType(convertType);
// //开始转换。。。。。。 convertMqEO.setAttId(attId);
// if(!"".equals(path)){ convertMqEO.setOriAttId(attId);
// String converfilename = path.replaceAll("\\\\", "/"); convertMqEO.setId(otId);
// logger.info("*****上传路径:*******"+localFilePath); convertMqEO.setFilePath(filePath);
// logger.info("************文件路径:**********" + convertMqEO.getFilePath()); convertMqEO.setAddOrUp(addUpFlag);
// logger.info("************接口:**********" + port); convertMqEO.setPdfId(standFilePdfId);
// logger.info("*****上传路径替换,加入文件名*******"+converfilename); convertMqEO.setStandFileClassify(standFileClassify);
// //截取文件类型 convertMqEO.setLawsFileClassify(lawsFileClassify);
// int index = converfilename.lastIndexOf("."); int i = Integer.valueOf(convertInfo.get("againNum").toString());
// String fileType = converfilename.substring(index,converfilename.length()); convertMqEO.setAgainNum(i);
// String fileOriName = converfilename.substring(0,index); docUploadConvert(convertMqEO);
// //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法 }
// DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
// d.setConvertHost(convertHost); /**
// //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf; * @Author yangxuenan
// File getPdf = d.conver(fileType); * @Description 文件转换
// //调用getswfPath()方法,打印转换后的swf文件路径 * Date 2018/8/21 15:51
// String dPath = d.getpdfPath(); * @Param [path]
// logger.info("*****转换后的pdf文件路径*******"+dPath); * @return com.adc.da.util.http.ResponseMessage
// //判断是否转换成功,修改数据状态 **/
// if(!dPath.isEmpty() && getPdf.length()>0){ public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{
// // 上传转换后文件 //保存在数据库中的ID
// String pdfId = attFileEOService.saveFileAttId(getPdf); String path = localFilePath + convertMqEO.getFilePath();
// logger.info("////////转换后文件id"+pdfId); String convertId = convertMqEO.getId();
// int count = 0; try {
// if("0".equals(convertMqEO.getAddOrUp())){ //进入转换方法中,修改OT_CONVERT表中状态为转换中
// count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType); convertMqEO.setId(convertId);
// } else { convertMqEO.setModifyTime(new Date());
// //查询之前在资源与文件关联表中是否有转换成功的数据,如果有执行修改,没有执行新增 convertMqEO.setMqState(3);
// if(StringUtils.isNotEmpty(convertMqEO.getPdfId())){ convertMqEOService.updateById(convertMqEO);
// count = updateConvertDocToFIles(convertMqEO,pdfId); //开始转换。。。。。。
// } else { if(!"".equals(path)){
// count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType); String converfilename = path.replaceAll("\\\\", "/");
// } logger.info("*****上传路径:*******"+localFilePath);
// } logger.info("************文件路径:**********" + convertMqEO.getFilePath());
// convertMqEO.setId(convertId); logger.info("************接口:**********" + port);
// if (count>0) { logger.info("*****上传路径替换,加入文件名*******"+converfilename);
// // 转换成功 //截取文件类型
// convertMqEO.setModifyTime(new Date()); int index = converfilename.lastIndexOf(".");
// convertMqEO.setMqState(1); String fileType = converfilename.substring(index,converfilename.length());
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO); String fileOriName = converfilename.substring(0,index);
// } else { //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
// // 转换失败 DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
// convertMqEO.setModifyTime(new Date()); d.setConvertHost(convertHost);
// convertMqEO.setMqState(2); //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO); File getPdf = d.conver(fileType);
// } //调用getswfPath()方法,打印转换后的swf文件路径
// } else { String dPath = d.getpdfPath();
// // 转换失败 logger.info("*****转换后的pdf文件路径*******"+dPath);
// convertMqEO.setId(convertId); //判断是否转换成功,修改数据状态
// convertMqEO.setModifyTime(new Date()); if(!dPath.isEmpty() && getPdf.length()>0){
// convertMqEO.setMqState(2); // 上传转换后文件
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO); String pdfId = attFileEOService.saveFileAttId(getPdf);
// if(convertMqEO.getAgainNum()<=5){ logger.info("////////转换后文件id"+pdfId);
// throw new Exception("转换失败"); int count = 0;
// } if("0".equals(convertMqEO.getAddOrUp())){
// } count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
// return Result.success(dPath); } else {
// } else { //查询之前在资源与文件关联表中是否有转换成功的数据,如果有执行修改,没有执行新增
// logger.error("转换时未获取到文件路径!"); if(StringUtils.isNotEmpty(convertMqEO.getPdfId())){
// return Result.error("文件存储失败,请重试"); count = updateConvertDocToFIles(convertMqEO,pdfId);
// } } else {
// } catch (Exception e) { count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
// // 转换失败 }
// logger.error("转换过程中失败!"); }
// logger.error(e.getMessage(),e); convertMqEO.setId(convertId);
// convertMqEO.setId(convertId); if (count>0) {
// convertMqEO.setMqState(2); // 转换成功
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO); convertMqEO.setModifyTime(new Date());
// this.restartUploadConvert(convertMqEO); convertMqEO.setMqState(1);
// return Result.error("r0072", "文件转换失败,请重试"); convertMqEOService.updateById(convertMqEO);
// } } else {
// } // 转换失败
// convertMqEO.setModifyTime(new Date());
// /** convertMqEO.setMqState(2);
// * 文档转换逻辑 convertMqEOService.updateById(convertMqEO);
// * @param attFileEO }
// */ } else {
// public void insertOrUpdateStandInfo(AttFileEO attFileEO){ // 转换失败
// 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; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; 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 io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController; 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; 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.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField; 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; 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.entity.OtConvert;
import com.adc.da.convert.OtConvert.dao.OtConvertDao; import com.adc.da.convert.otConvert.dao.OtConvertDao;
import com.adc.da.convert.OtConvert.service.IOtConvertService; import com.adc.da.convert.otConvert.service.IOtConvertService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; 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 {
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.convert.OtConvert.dao.OtConvertDao"> <mapper namespace="com.adc.da.convert.otConvert.dao.OtConvertDao">
</mapper> </mapper>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.convert.otConvertMq.dao.OtConvertMqDao">
</mapper>
@@ -1,408 +1,291 @@
//package com.adc.da.mq.service; package com.adc.da.mq.service;
//
//import com.adc.da.lawss.entity.OtSvppsEO; import com.adc.da.search.entity.StandLawsEO;
//import com.adc.da.lawss.entity.SarBussionessStandEO; import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
//import com.adc.da.lawss.entity.SarFullNumEO; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
//import com.adc.da.lawss.page.SarFullNumEOPage; import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
//import com.adc.da.lawss.service.OtSvppsEOService; import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
//import com.adc.da.lawss.service.SarFullNumEOService; import com.adc.da.sys.dao.DicTypeEODao;
//import com.adc.da.lawss.service.SarStandAndLawsEOService; import com.adc.da.utils.util.InitStandAttrUtil;
//import com.adc.da.lawss.service.SysInfoEOService; import com.rabbitmq.client.Channel;
//import com.adc.da.search.entity.StandLawsEO; import net.sf.json.JSONObject;
//import com.adc.da.slrs.otSvpps.service.IOtSvppsService; import org.apache.commons.lang.StringUtils;
//import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import org.json.JSONTokener;
//import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; import org.slf4j.Logger;
//import com.adc.da.slrs.sysInfo.service.SysInfoEOService; import org.slf4j.LoggerFactory;
//import com.adc.da.sys.dao.DicTypeEODao; import org.springframework.amqp.rabbit.annotation.Exchange;
//import com.adc.da.utils.util.InitStandAttrUtil; import org.springframework.amqp.rabbit.annotation.Queue;
//import com.rabbitmq.client.Channel; import org.springframework.amqp.rabbit.annotation.QueueBinding;
//import net.sf.json.JSONObject; import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.apache.commons.lang.StringUtils; import org.springframework.amqp.support.AmqpHeaders;
//import org.json.JSONTokener; import org.springframework.beans.factory.annotation.Autowired;
//import org.slf4j.Logger; import org.springframework.messaging.Message;
//import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component;
//import org.springframework.amqp.rabbit.annotation.Exchange;
//import org.springframework.amqp.rabbit.annotation.Queue; import java.text.ParseException;
//import org.springframework.amqp.rabbit.annotation.QueueBinding; import java.text.SimpleDateFormat;
//import org.springframework.amqp.rabbit.annotation.RabbitListener; import java.util.*;
//import org.springframework.amqp.support.AmqpHeaders; import java.util.stream.Collectors;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.messaging.Message; @Component
//import org.springframework.stereotype.Component; public class SendBussMQService {
//
//import java.text.ParseException; @Autowired
//import java.text.SimpleDateFormat; private ISarStandardsInfoService sarStandardsInfoService;
//import java.util.*;
//import java.util.stream.Collectors; @Autowired
// private SysInfoEOService sysInfoEOService;
//@Component
//public class SendBussMQService { @Autowired
// private DicTypeEODao dicTypeEODao;
// @Autowired
// private ISarStandardsInfoService sarStandardsInfoService; @Autowired
// private IOtSvppsService otSvppsEOService;
// @Autowired
// private SysInfoEOService sysInfoEOService; private static final Logger logger = LoggerFactory.getLogger(SendBussMQService.class);
//
// @Autowired
// private DicTypeEODao dicTypeEODao; @RabbitListener(bindings = @QueueBinding(
// value = @Queue(value = "createBussMQ_SQ_GSAR", durable = "true"),
// @Autowired exchange = @Exchange(value = "buss-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
// private IOtSvppsService otSvppsEOService; key = "buss-key_SQ_GSAR"))
// public void createMQ(Map<String,Object> bussMap, Message message, Channel channel) throws Exception{
// private static final Logger logger = LoggerFactory.getLogger(SendBussMQService.class); try{
// try{
// Thread.sleep(5000);
// @RabbitListener(bindings = @QueueBinding( insertOrUpdateBussInfo(bussMap);
// value = @Queue(value = "createBussMQ_SQ_GSAR", durable = "true"), }catch(InterruptedException e){
// exchange = @Exchange(value = "buss-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"), logger.error(e.toString());
// key = "buss-key_SQ_GSAR")) Thread.currentThread().interrupt();
// public void createMQ(Map<String,Object> bussMap, Message message, Channel channel) throws Exception{ }
// try{ } catch (Exception e) {
// try{ logger.error("搜索中心企业标准消息队列进入转换前失败!");
// Thread.sleep(5000); logger.error(e.getMessage(),e);
// insertOrUpdateBussInfo(bussMap); } finally {
// }catch(InterruptedException e){ Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
// logger.error(e.toString()); channel.basicAck(tag,false);
// Thread.currentThread().interrupt(); logger.debug("消息确认成功!!!!!!!!!");
// } }
// } catch (Exception e) { }
// logger.error("搜索中心企业标准消息队列进入转换前失败!");
// logger.error(e.getMessage(),e); public void insertOrUpdateBussInfo(Map<String,Object> bussMap) throws Exception {
// } finally { String addOrUpdate = bussMap.get("addOrUpdate").toString();
// Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG); String FZRQFSRQ = null;
// channel.basicAck(tag,false); if ("updateFromAct".equals(addOrUpdate)){
// logger.debug("消息确认成功!!!!!!!!!"); addOrUpdate = "update";
// } FZRQFSRQ = "1";
// } }
// String sarBuss = bussMap.get("sarBuss").toString();
// public void insertOrUpdateBussInfo(Map<String,Object> bussMap) throws Exception { JSONObject jsonobject = JSONObject.fromObject(sarBuss);
// String addOrUpdate = bussMap.get("addOrUpdate").toString(); SarBussionessStand infoEO = (SarBussionessStand) JSONObject.toBean(jsonobject, SarBussionessStand.class);
// String FZRQFSRQ = null; String jsonobject1 = infoEO.getSarStandAttrEOStr();
// if ("updateFromAct".equals(addOrUpdate)){ Map<String,Object> map1 = new HashMap<>();
// addOrUpdate = "update"; if (StringUtils.isEmpty(jsonobject1)){
// FZRQFSRQ = "1"; map1.put("null","null");
// } }else {
// String sarBuss = bussMap.get("sarBuss").toString(); map1 = JSONObject.fromObject(jsonobject1);
// JSONObject jsonobject = JSONObject.fromObject(sarBuss); }
// SarBussionessStand infoEO = (SarBussionessStand) JSONObject.toBean(jsonobject, SarBussionessStand.class); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// String jsonobject1 = infoEO.getSarStandAttrEOStr(); //修改索引信息表
// Map<String,Object> map1 = new HashMap<>(); // 往索引表中插入数据
// if (StringUtils.isEmpty(jsonobject1)){ String baseSearchContent = "";
// map1.put("null","null"); String getCodeName = "";
// }else { Map<String,Object> saveMap = new HashMap<>();
// map1 = JSONObject.fromObject(jsonobject1); String a = null;
// } try{
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); a = sdf.format(infoEO.getIssueTime());
// //修改索引信息表 saveMap.put("issue_time"," "+a);
// // 往索引表中插入数据 }catch (Exception e){
// String baseSearchContent = ""; saveMap.put("issue_time"," ");
// String getCodeName = ""; }
// Map<String,Object> saveMap = new HashMap<>();
// String a = null;
// try{
// a = sdf.format(infoEO.getIssueTime()); //发布日期 高级查询
// saveMap.put("issue_time"," "+a); Date issue_time_data = null;
// }catch (Exception e){ if (StringUtils.isNotBlank(a)) {
// saveMap.put("issue_time"," "); try {
// } SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// issue_time_data = format.parse(saveMap.get("issue_time")+" 00:00:00");
// } catch (ParseException ignored) {
// }
// //发布日期 高级查询 }
// Date issue_time_data = null; if (issue_time_data != null) {
// if (StringUtils.isNotBlank(a)) { Calendar calendar = Calendar.getInstance();
// try { calendar.setTime(issue_time_data);
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int month = calendar.get(Calendar.MONTH)+1;
// issue_time_data = format.parse(saveMap.get("issue_time")+" 00:00:00"); String times = calendar.get(Calendar.YEAR) + String.format("%02d", month) + String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH));
// } catch (ParseException ignored) { saveMap.put("issue_time_data",Long.valueOf(times));
// } }else{
// } saveMap.put("issue_time_data",-1000000000000000000L);
// if (issue_time_data != null) { }
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(issue_time_data); try{
// int month = calendar.get(Calendar.MONTH)+1; saveMap.put("put_time"," "+ sdf.format(infoEO.getPutTime()));
// String times = calendar.get(Calendar.YEAR) + String.format("%02d", month) + String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH)); }catch (Exception e){
// saveMap.put("issue_time_data",Long.valueOf(times)); saveMap.put("put_time"," ");
// }else{ }
// saveMap.put("issue_time_data",-1000000000000000000L);
// } //实施日期 高级查询
// Date put_time_data = null;
// try{ if (StringUtils.isNotBlank(a)) {
// saveMap.put("put_time"," "+ sdf.format(infoEO.getPutTime())); try {
// }catch (Exception e){ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// saveMap.put("put_time"," "); put_time_data = format.parse(saveMap.get("put_time")+" 00:00:00");
// } } catch (ParseException ignored) {
// }
// //实施日期 高级查询 }
// Date put_time_data = null; if (put_time_data != null) {
// if (StringUtils.isNotBlank(a)) { Calendar calendar = Calendar.getInstance();
// try { calendar.setTime(put_time_data);
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int month = calendar.get(Calendar.MONTH)+1;
// put_time_data = format.parse(saveMap.get("put_time")+" 00:00:00"); String times = calendar.get(Calendar.YEAR) + String.format("%02d", month) + String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH));
// } catch (ParseException ignored) { saveMap.put("put_time_data",Long.valueOf(times));
// } }else{
// } saveMap.put("put_time_data",-1000000000000000000L);
// if (put_time_data != null) { }
// Calendar calendar = Calendar.getInstance(); // saveMap.put("put_time",sdf.format(infoEO.getPutTime()));
// calendar.setTime(put_time_data);
// int month = calendar.get(Calendar.MONTH)+1; saveMap.put("id",infoEO.getId());
// String times = calendar.get(Calendar.YEAR) + String.format("%02d", month) + String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH)); saveMap.put("standSort",infoEO.getStandSort());
// saveMap.put("put_time_data",Long.valueOf(times)); saveMap.put("stand_sort",infoEO.getStandSort());
// }else{ if(StringUtils.isNotEmpty(infoEO.getStandSort())){
// saveMap.put("put_time_data",-1000000000000000000L); String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort());
// } saveMap.put("standSortShow",codeName);
//// saveMap.put("put_time",sdf.format(infoEO.getPutTime())); getCodeName = codeName;
// }
// saveMap.put("id",infoEO.getId()); saveMap.put("standYear",infoEO.getStandYear());
// saveMap.put("standSort",infoEO.getStandSort()); saveMap.put("stand_year",infoEO.getStandYear());
// saveMap.put("stand_sort",infoEO.getStandSort()); saveMap.put("standNumber",infoEO.getStandCode());
// if(StringUtils.isNotEmpty(infoEO.getStandSort())){ saveMap.put("stand_code",infoEO.getStandCode());
// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort()); saveMap = dealNumberMsg(saveMap,infoEO,getCodeName);
// saveMap.put("standSortShow",codeName); saveMap.put("nameshow",infoEO.getStandName());
// getCodeName = codeName; saveMap.put("stand_name",infoEO.getStandName());
// } saveMap.put("standEnName",infoEO.getStandEnName());
// String realContent = ""; saveMap.put("stand_en_name",infoEO.getStandEnName());
// if (map1.containsKey("QBWB")) { saveMap.put("replaceStandNum",infoEO.getReplaceStandNum());
// String content = String.valueOf(map1.get("QBWB")); saveMap.put("replace_stand_num",infoEO.getReplaceStandNum());
// String[] ids = content.split(","); saveMap.put("replacedStandNum",infoEO.getReplacedStandNum());
// for (String id :ids) { saveMap.put("replaced_stand_num",infoEO.getReplacedStandNum());
// if (!"null".equals(id) && StringUtils.isNotBlank(id)) { saveMap.put("statecode",infoEO.getStandStatus());
// if ("".equals(realContent)) { saveMap.put("stand_status",infoEO.getStandStatus());
// realContent += id; if (StringUtils.isNotEmpty(infoEO.getStandStatus())) {
// } else { String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandStatus());
// realContent = realContent + "," + id; saveMap.put("standstateshow",codeName);
// } }
// } //新加字段
// } saveMap.put("country",infoEO.getApplyCountry());
// } if(StringUtils.isNotEmpty(infoEO.getApplyCountry())){
// if (map1.containsKey("GCWB")) { String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getApplyCountry());
// String content = String.valueOf(map1.get("GCWB")); saveMap.put("countryShow",codeName);
// String[] ids = content.split(","); }
// for (String id :ids) { // 自定义属性字段
// if (!"null".equals(id) && StringUtils.isNotBlank(id)) { String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr();
// if ("".equals(realContent)) { Map<String,Object> attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr);
// realContent += id; Map<String,Object> infoMap = infoEO.getAttrInfoMap();
// } else {
// realContent = realContent + "," + id; if (attrInfoMap != null && !attrInfoMap.isEmpty()) {
// } attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "stand",baseSearchContent);
// } saveMap.putAll(attrInfoMap);
// } }
// }
// saveMap.put("content",realContent); saveMap.put("type","bussstand");
// saveMap.put("standYear",infoEO.getStandYear()); saveMap.put("validFlag","0");
// saveMap.put("stand_year",infoEO.getStandYear()); saveMap.put("content",infoEO.getFileIds());
// saveMap.put("standNumber",infoEO.getStandCode());
// saveMap.put("stand_code",infoEO.getStandCode()); String fieldInfo = InitStandAttrUtil.queryField;
// saveMap = dealNumberMsg(saveMap,infoEO,getCodeName); List<String> fieldInfoList = Arrays.asList(fieldInfo .split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList());
// saveMap.put("nameshow",infoEO.getStandName());
// saveMap.put("stand_name",infoEO.getStandName()); // 动态存储属性字段
// saveMap.put("standEnName",infoEO.getStandEnName()); for (String field : fieldInfoList) {
// saveMap.put("stand_en_name",infoEO.getStandEnName()); saveMap.put(field,attrInfoMap.getOrDefault(field,""));
// saveMap.put("replaceStandNum",infoEO.getReplaceStandNum()); String fieldValue = "";
// saveMap.put("replace_stand_num",infoEO.getReplaceStandNum()); if(infoMap.get(field) != null && StringUtils.isNotBlank(infoMap.get(field).toString())){
// saveMap.put("replacedStandNum",infoEO.getReplacedStandNum()); Object json= new JSONTokener(infoMap.get(field).toString()).nextValue();
// saveMap.put("replaced_stand_num",infoEO.getReplacedStandNum()); if(!json.toString().equals("null")){
// saveMap.put("statecode",infoEO.getStandStatus()); fieldValue = infoMap.get(field).toString();
// saveMap.put("stand_status",infoEO.getStandStatus()); }
// if (StringUtils.isNotEmpty(infoEO.getStandStatus())) { }
// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandStatus()); saveMap.put(field+"Name",fieldValue);
// saveMap.put("standstateshow",codeName); }
// }
// //新加字段 //当建立代替时,产生的没有文件的问题
// saveMap.put("country",infoEO.getApplyCountry()); if (StringUtils.isBlank(String.valueOf(saveMap.get("content")))) {
// if(StringUtils.isNotEmpty(infoEO.getApplyCountry())){ String context = filterStringIsNotBlank(String.valueOf(saveMap.get("FBGBUSS")),true)
// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getApplyCountry()); + filterStringIsNotBlank(String.valueOf(saveMap.get("BZSMBUSS")),true)
// saveMap.put("countryShow",codeName); + filterStringIsNotBlank(String.valueOf(saveMap.get("LSBBBUSS")),true)
// } + filterStringIsNotBlank(String.valueOf(saveMap.get("QTWJBUSS")),true)
// // 自定义属性字段 + filterStringIsNotBlank(String.valueOf(saveMap.get("GLWJBUSS")),true);
// String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr(); context = context.replace(",,", ",");
// Map<String,Object> attrInfoMap = new HashMap<>(); saveMap.put("content", context);
// if (StringUtils.isEmpty(sarStandAttrEOStr)){ }
// attrInfoMap.put("null","null"); if("add".equals(addOrUpdate)){
// }else { sarStandardsInfoService.insertIntoIndexForMap(saveMap);
// attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr); } else {
// } sarStandardsInfoService.updateIntoIndexForMap(saveMap);
// if (attrInfoMap != null && !attrInfoMap.isEmpty()) { }
// attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "bussstand",baseSearchContent); }
// saveMap.putAll(attrInfoMap);
// } private String filterStringIsNotBlank(String str,boolean boo){
// String FSRQ = null; String f = ",";
// if (attrInfoMap != null) { return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);
// if (attrInfoMap.containsKey("FSRQ")){ }
// if ("1".equals(FZRQFSRQ)){
// Long times = Long.valueOf(String.valueOf(attrInfoMap.get("FSRQ")).trim()); private String dateFormatToStr(String dateStr){
// Date fsrq1 = new Date(times); if(dateStr == null || dateStr.equals("")){
// attrInfoMap.put("FSRQ",sdf.format(fsrq1)); return "";
// } }
// try{ String dateToStr = "";
// if (String.valueOf(attrInfoMap.get("FSRQ")).trim().length()>10) { try {
// FSRQ = String.valueOf(attrInfoMap.get("FSRQ")).trim().substring(0, 10) + " 00:00:00"; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// }else{ dateToStr = dateFormat.format(dateFormat.parse(dateStr.trim().substring(0,10)));
// FSRQ = String.valueOf(attrInfoMap.get("FSRQ")).trim() + " 00:00:00"; }catch (Exception e){
// } e.getMessage();
// }
// saveMap.put("FSRQString"," "+FSRQ.substring(0, 10)); return dateToStr;
// saveMap.put("FSRQDate"," "+FSRQ.substring(0, 10).replace("-","")); }
// FSRQ = String.valueOf(FSRQ.substring(0, 10).replace("-",""));
// saveMap.put("FSRQ"," "+FSRQ); public Map<String,Object> dealNumberMsg (Map<String,Object> saveMap,SarBussionessStand infoEO,String getCodeName) {
// }catch (Exception e){ /*if(StringUtils.isNotEmpty(infoEO.getStandYear())){
// saveMap.put("FSRQString"," "); String num = getCodeName + " " + infoEO.getStandCode() + "-" + infoEO.getStandYear();
// saveMap.put("FSRQDate"," "+" "); saveMap.put("numbershow",num);
// } int index = infoEO.getStandCode().indexOf(".");
// }else{ int index1 = infoEO.getStandCode().indexOf(":");
// saveMap.put("FSRQString"," "); String numberExpNull = "";
// saveMap.put("FSRQDate"," "+" "); if(index > -1){
// } numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
// } + "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
// }else if(index1 > -1){
// String FZRQ = null; numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
// if (attrInfoMap != null && attrInfoMap.containsKey("FZRQ")) { + "-" + getCodeName + infoEO.getStandCode().substring(0,index1) + "-" + infoEO.getStandCode().substring(0,index1);
// if ("1".equals(FZRQFSRQ)){ }else{
// Long times = Long.valueOf(String.valueOf(attrInfoMap.get("FZRQ")).trim()); numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","");
// Date fzrq1 = new Date(times); }
// String timeFzrq = sdf.format(fzrq1); } else {
// if (timeFzrq.trim().length()>10){ String number = getCodeName + " " + infoEO.getStandCode();
// timeFzrq = timeFzrq.trim().substring(0,10); saveMap.put("numbershow",number);
// } String numberExpNull = "";
// attrInfoMap.put("FZRQ",timeFzrq); int index = infoEO.getStandCode().indexOf(".");
// } if(index > -1){
// numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","")
// try{ + "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
// if (String.valueOf(attrInfoMap.get("FZRQ")).trim().length()>10) { }else{
// FZRQ = String.valueOf(attrInfoMap.get("FZRQ")).trim().substring(0, 10) + " 00:00:00"; numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","");
// }else{ }
// FZRQ = String.valueOf(attrInfoMap.get("FZRQ")).trim() + " 00:00:00"; saveMap.put("numberExpNull",numberExpNull);
// } }*/
// String number = infoEO.getStandCode();
// saveMap.put("FZRQString"," "+FZRQ.substring(0,10)); saveMap.put("numbershow",number);
// saveMap.put("FZRQDate"," "+FZRQ.replace("-","")); String numberExpNull = "";
// FZRQ = String.valueOf(sdf.parse(FZRQ).getTime()); int index = infoEO.getStandCode().indexOf(".");
// saveMap.put("FZRQ"," "+FZRQ); if(index > -1){
// }catch (Exception e) { numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","")
// saveMap.put("FZRQString", " " + FZRQ); + "-" + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
// saveMap.put("FZRQDate"," "+" "); }else{
// } numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","");
// } else { }
// saveMap.put("FZRQString", " "); saveMap.put("numberExpNull",numberExpNull);
// saveMap.put("FZRQDate"," "+" "); return saveMap;
// } }
//
// //废止日期 高级查询 }
// Date fzrq_time_data = null;
// if (StringUtils.isNotBlank(a)) {
// try {
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// fzrq_time_data = format.parse(saveMap.get("FZRQString")+" 00:00:00");
// } catch (ParseException ignored) {
// }
// }
// if (fzrq_time_data != null) {
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(fzrq_time_data);
// int month = calendar.get(Calendar.MONTH)+1;
// String times = calendar.get(Calendar.YEAR) + String.format("%02d", month) + String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH));
// saveMap.put("FZRQ",Long.valueOf(times));
// }else{
// saveMap.put("FZRQ",-1000000000000000000L);
// }
// saveMap.put("type","bussstand");
//
// String fieldInfo = InitStandAttrUtil.queryField;
// List<String> fieldInfoList = Arrays.asList(fieldInfo .split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList());
//
// // 动态存储属性字段
// for (String field : fieldInfoList) {
// saveMap.put(field,attrInfoMap.getOrDefault(field,""));
// String fieldValue = "";
// if(infoMap.get(field) != null && StringUtils.isNotBlank(infoMap.get(field).toString())){
// Object json= new JSONTokener(infoMap.get(field).toString()).nextValue();
// if(!json.toString().equals("null")){
// fieldValue = infoMap.get(field).toString();
// }
// }
// saveMap.put(field+"Name",fieldValue);
// }
//
// //添加次数
// SarFullNumEOPage sarFullNumEOPage = new SarFullNumEOPage();
// sarFullNumEOPage.setSarId(infoEO.getId());
// List<SarFullNumEO> sarFullNumEOList = sarFullNumEOService.queryByList(sarFullNumEOPage);
// String num = "";
// if (null != sarFullNumEOList && !sarFullNumEOList.isEmpty()){
// num = sarFullNumEOList.get(0).getReadNum();
// }
// if (StringUtils.isEmpty(num)){
// saveMap.put("readNum", 0L);
// }else {
// saveMap.put("readNum", Long.valueOf(num));
// }
// if (saveMap.containsKey("QBMJ") && null != saveMap.get("QBMJ") && !String.valueOf(saveMap.get("QBMJ")).equals("ACF675Z88W")) {
// saveMap.put("baseSearchContent", baseSearchContent);
// saveMap.put("validFlag", "0");
// saveMap.put("content", infoEO.getFileIds());
// if ("add".equals(addOrUpdate)) {
// sarStandAndLawsEOService.insertIntoIndexForMap(saveMap);
// } else {
// sarStandAndLawsEOService.updateIntoIndexForMap(saveMap);
// }
// }else{
// if (saveMap.containsKey("QBMJ") && null != saveMap.get("QBMJ") && String.valueOf(saveMap.get("QBMJ")).equals("ACF675Z88W")){
// StandLawsEO standLawsEO = new StandLawsEO();
// standLawsEO.setId(infoEO.getId());
// standLawsEO.setType("bussstand");
// sarStandAndLawsEOService.deleteFomrIndex(standLawsEO);
// }else{
// if ("add".equals(addOrUpdate)) {
// sarStandAndLawsEOService.insertIntoIndexForMap(saveMap);
// } else {
// sarStandAndLawsEOService.updateIntoIndexForMap(saveMap);
// }
// }
// }
// }
//
// public Map<String,Object> dealNumberMsg (Map<String,Object> saveMap,SarBussionessStand infoEO,String getCodeName) {
// /*if(StringUtils.isNotEmpty(infoEO.getStandYear())){
// String num = getCodeName + " " + infoEO.getStandCode() + "-" + infoEO.getStandYear();
// saveMap.put("numbershow",num);
// int index = infoEO.getStandCode().indexOf(".");
// int index1 = infoEO.getStandCode().indexOf(":");
// String numberExpNull = "";
// if(index > -1){
// numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
// + "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
// }else if(index1 > -1){
// numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
// + "-" + getCodeName + infoEO.getStandCode().substring(0,index1) + "-" + infoEO.getStandCode().substring(0,index1);
// }else{
// numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","");
// }
// } else {
// String number = getCodeName + " " + infoEO.getStandCode();
// saveMap.put("numbershow",number);
// String numberExpNull = "";
// int index = infoEO.getStandCode().indexOf(".");
// if(index > -1){
// numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","")
// + "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
// }else{
// numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","");
// }
// saveMap.put("numberExpNull",numberExpNull);
// }*/
// String number = infoEO.getStandCode();
// saveMap.put("numbershow",number);
// String numberExpNull = "";
// int index = infoEO.getStandCode().indexOf(".");
// if(index > -1){
// numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","")
// + "-" + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
// }else{
// numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","");
// }
// saveMap.put("numberExpNull",numberExpNull);
// return saveMap;
// }
//
//}
@@ -67,7 +67,7 @@ public class SarBussStandFile extends BaseEntity {
@ApiModelProperty(value = "是否有效") @ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG") @TableField("VALID_FLAG")
private String validFlag; private Integer validFlag;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME") @TableField("CREATION_TIME")
@@ -86,4 +86,13 @@ public class SarBussStandFile extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private List<String> idList = new ArrayList<>(); private List<String> idList = new ArrayList<>();
@TableField(exist = false)
private String useModule;
@TableField(exist = false)
private String resId;
@TableField(exist = false)
private Integer pageCount;
@TableField(exist = false)
private String fileOldName;
} }
@@ -10,10 +10,10 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.adc.da.slrs.sarUser.service.ITsUserService; import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.sys.entity.DicTypeEO; import com.adc.da.sys.entity.DicTypeEO;
import com.adc.da.sys.service.IDicTypeEOService; import com.adc.da.sys.service.IDicTypeEOService;
import com.adc.da.sys.util.LoginUserUtil;
import com.adc.da.http.PageInfo; import com.adc.da.http.PageInfo;
import com.adc.da.http.ResponseMessage; import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result; import com.adc.da.http.Result;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.utils.StringUtils; import com.adc.da.util.utils.StringUtils;
import com.adc.da.utils.util.SarAdvanceSearchUtil; import com.adc.da.utils.util.SarAdvanceSearchUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@@ -168,33 +168,15 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
page.setAdvanceSearchStr(null); page.setAdvanceSearchStr(null);
} }
} }
page.setUserId(LoginUserUtil.getUserId()); if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
if(StringUtils.isNotBlank(page.getPaixu())){ if(StringUtils.isNotBlank(page.getPaixu())){
String sql = page.getPaixu()+" "+page.getShunxu(); String sql = page.getPaixu()+" "+page.getShunxu();
page.setSql(sql); page.setSql(sql);
}else{ }else{
page.setOrderBy("SAR_BUSSIONESS_STAND.MODIFY_TIME DESC"); page.setOrderBy("SAR_BUSSIONESS_STAND.MODIFY_TIME DESC");
} }
if(page.getMenuId() != null ){
QueryWrapper<TsResource> qw = new QueryWrapper<>();
qw.eq("ID",page.getMenuId());
qw.isNull("PARENT_ID");
List<TsResource> children = iTsResourceService.list(qw);
if(!children.isEmpty() || page.getMenuId().equals("nomenu")){
List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
return Result.success(getPageInfo(page.getPager(), rows));
}
List<String> getMenuIdList = tsUserService.getResourceId(new TsResource());
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
page.setMenuRoleList(getMenuIdList);
} else {
page.setMenuRoleList(null);
}
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}
List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page); List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
return Result.success(getPageInfo(page.getPager(), rows)); return Result.success(getPageInfo(page.getPager(), rows));
// if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) { // if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
@@ -180,6 +180,9 @@ public class SarBussionessStand extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private Map<String, Object> attrInfoMap = new LinkedHashMap<>(); //属性表字段与值 private Map<String, Object> attrInfoMap = new LinkedHashMap<>(); //属性表字段与值
@TableField(exist = false)
private Map<String, Object> attrInfoCaseMap = new LinkedHashMap<>(); //属性表字段与值小写前端带入渲染
@TableField(exist = false) @TableField(exist = false)
private String sarStandAttrEOStr; //新增修改时属性表信息 private String sarStandAttrEOStr; //新增修改时属性表信息
@@ -6,6 +6,7 @@ import com.adc.da.common.ConvertMqEO;
import com.adc.da.common.SarTypeEnum; import com.adc.da.common.SarTypeEnum;
import com.adc.da.common.SelectionTypeEnum; import com.adc.da.common.SelectionTypeEnum;
import com.adc.da.common.UseModuleEnum; import com.adc.da.common.UseModuleEnum;
import com.adc.da.http.Result;
import com.adc.da.mq.dao.OtConvertEODao; import com.adc.da.mq.dao.OtConvertEODao;
import com.adc.da.mq.service.CreateMQService; import com.adc.da.mq.service.CreateMQService;
import com.adc.da.mq.service.CreateStandMQService; import com.adc.da.mq.service.CreateStandMQService;
@@ -27,6 +28,7 @@ import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService; import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarResource.entity.TsResource; import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarResource.service.ITsResourceService; import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao; import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
@@ -42,9 +44,11 @@ import com.adc.da.sys.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils; import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.FieldConvertUtil; import com.adc.da.utils.util.FieldConvertUtil;
import com.adc.da.utils.util.InitStandAttrUtil; import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.json.JSONTokener;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -89,6 +93,9 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
@Autowired @Autowired
private ITsResourceService iTsResourceService; private ITsResourceService iTsResourceService;
@Autowired
private SarStandAttrInfoDao sarStandAttrInfoEODao;
@Autowired @Autowired
private SysInfoEOService sysInfoEOService; private SysInfoEOService sysInfoEOService;
@@ -423,7 +430,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
sarStandFileEO.setCreationUser(LoginUserUtil.getUserId()); sarStandFileEO.setCreationUser(LoginUserUtil.getUserId());
sarStandFileEO.setCreationTime(new Date()); sarStandFileEO.setCreationTime(new Date());
sarStandFileEO.setModifyTime(new Date()); sarStandFileEO.setModifyTime(new Date());
sarStandFileEO.setValidFlag("0"); sarStandFileEO.setValidFlag(0);
sarStandFileEO.setStandId(standId); //标准ID sarStandFileEO.setStandId(standId); //标准ID
sarStandFileEO.setUseModel(UseModuleEnum.SOURCE_FILE.getValue()); //文件使用模式 sarStandFileEO.setUseModel(UseModuleEnum.SOURCE_FILE.getValue()); //文件使用模式
sarStandFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20()); sarStandFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20());
@@ -439,7 +446,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
newFileEO.setCreationUser(LoginUserUtil.getUserId()); newFileEO.setCreationUser(LoginUserUtil.getUserId());
newFileEO.setCreationTime(new Date()); newFileEO.setCreationTime(new Date());
newFileEO.setModifyTime(new Date()); newFileEO.setModifyTime(new Date());
newFileEO.setValidFlag("0"); newFileEO.setValidFlag(0);
newFileEO.setStandId(standId); //标准ID newFileEO.setStandId(standId); //标准ID
newFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20()); newFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20());
newFileEO.setAttId(fileInfo.getId()); //文件ID newFileEO.setAttId(fileInfo.getId()); //文件ID
@@ -501,13 +508,13 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) { for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey(); String name = entry.getKey();
String value = ""; String value = "";
if (entry.getValue() != null && InitStandAttrUtil.fileFieldList != null && InitStandAttrUtil.fileFieldList.size() > 0 && InitStandAttrUtil.fileFieldList.contains(name)) { if (entry.getValue() != null && InitStandAttrUtil.fileFieldListBuss != null && InitStandAttrUtil.fileFieldListBuss.size() > 0 && InitStandAttrUtil.fileFieldListBuss.contains(name)) {
value = entry.getValue().toString(); value = entry.getValue().toString();
if (org.apache.commons.lang3.StringUtils.isNotBlank(value)) { if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value); List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
entry.setValue(fileObj); entry.setValue(fileObj);
} }
}else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) { }else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
value = entry.getValue().toString(); value = entry.getValue().toString();
List<String> valArr = Arrays.asList(value.split(",")); List<String> valArr = Arrays.asList(value.split(","));
value = dicTypeEODao.getDicNamesByCodes(valArr); value = dicTypeEODao.getDicNamesByCodes(valArr);
@@ -564,6 +571,26 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
@Override @Override
public List<SarBussionessStand> getSarBussionStandPage(SarBussionessStandEOPage page) throws Exception { public List<SarBussionessStand> getSarBussionStandPage(SarBussionessStandEOPage page) throws Exception {
//查询当前登录人角色拥有权限的菜单
if(page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(page.getUserId())){
QueryWrapper<TsResource> qw = new QueryWrapper<>();
qw.eq("ID",page.getMenuId());
qw.isNull("PARENT_ID");
List<TsResource> children = iTsResourceService.list(qw);
if(children.isEmpty() && !page.getMenuId().equals("nomenu")){
List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
page.setMenuRoleList(getMenuIdList);
} else {
page.setMenuRoleList(null);
}
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}
}
Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page); Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page);
page.getPager().setRowCount(rowCount); page.getPager().setRowCount(rowCount);
List<SarBussionessStand> sarlist = this.baseMapper.getBussionessStandInfoPage(page); List<SarBussionessStand> sarlist = this.baseMapper.getBussionessStandInfoPage(page);
@@ -578,7 +605,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
*/ */
public void attrInfo (List<SarBussionessStand> sarlist) throws Exception { public void attrInfo (List<SarBussionessStand> sarlist) throws Exception {
for(SarBussionessStand row : sarlist){ for(SarBussionessStand row : sarlist){
attrInfo1(row); attrInfoDetails(row);
} }
} }
@@ -601,6 +628,85 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
} }
} }
public void attrInfoShowSearchDetails(SarBussionessStand row,String type) throws Exception {
if (row != null) {
attrInfoSearchDetails(row,type);
Map<String, Object> getAttrMap = row.getAttrInfoMap();
if (getAttrMap != null && getAttrMap.size() > 0) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
List<String> valArr = new ArrayList<>();
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
if(StringUtils.isNotBlank(entry.getValue().toString())){
Object json= new JSONTokener(entry.getValue().toString()).nextValue();
if(json instanceof org.json.JSONArray){
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(),String.class);
}else {
value = entry.getValue().toString();
valArr = Arrays.asList(value.split(","));
}
if(!valArr.isEmpty()){
value = dicTypeEODao.getDicNamesByCodes(valArr);
}
}
entry.setValue(value);
}
}
}
}
}
public void attrInfoSearchDetails(SarBussionessStand row,String type) throws Exception {
String fieldInfo = InitStandAttrUtil.queryField;
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
row.setCollectId(collectId);
// 查询属性表数据
if (StringUtils.isNotBlank(fieldInfo)) {
Map<String, Object> getAttrMap = new TreeMap<>();
if(type.equals("add")){
String sarStandAttrEOStr = row.getSarStandAttrEOStr();
getAttrMap = JSONObject.fromObject(sarStandAttrEOStr);
}else {
getAttrMap = sarStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
}
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
// 遍历修改所有clob类型的值
for (String clobField : InitStandAttrUtil.clobFieldList) {
Clob clobValue = (Clob) getAttrMap.get(clobField);
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
getAttrMap.put(clobField, fieldValue);
}
}
if (getAttrMap != null && !getAttrMap.isEmpty()) {
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
}
row.setAttrInfoMap(getAttrMap);
}
}
private Map<String, Object> transformUpperCase(Map<String, Object> orgMap) {
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<String, Object> entry : orgMap.entrySet()) {
String newKey = entry.getKey().toLowerCase();
resultMap.put(newKey, orgMap.get(entry.getKey()));
if (entry.getValue() != null && InitStandAttrUtil.fileFieldListBuss != null && !InitStandAttrUtil.fileFieldListBuss.isEmpty() && InitStandAttrUtil.fileFieldListBuss.contains(entry.getKey())) {
String value = entry.getValue().toString();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
if(!fileObj.isEmpty()){
resultMap.put(newKey + "Name", fileObj.get(0).getOldFileName());
}
}
}
}
return resultMap;
}
public void attrInfoDetails (SarBussionessStand row) throws Exception { public void attrInfoDetails (SarBussionessStand row) throws Exception {
String fieldInfo = InitStandAttrUtil.queryFieldBuss; String fieldInfo = InitStandAttrUtil.queryFieldBuss;
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId()); String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
@@ -649,6 +755,10 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
getAttrMap.putAll(newMap); getAttrMap.putAll(newMap);
} }
if (getAttrMap != null && !getAttrMap.isEmpty()) {
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
}
row.setAttrInfoMap(getAttrMap); row.setAttrInfoMap(getAttrMap);
} }
} }
@@ -4,6 +4,7 @@ import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
import com.adc.da.sys.common.SelectionResult; import com.adc.da.sys.common.SelectionResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -16,6 +17,7 @@ import java.util.Map;
* @author super_liu * @author super_liu
* @since 2021-06-01 * @since 2021-06-01
*/ */
@Repository
public interface SarStandAttrInfoDao extends BaseMapper<SarStandAttrInfo> { public interface SarStandAttrInfoDao extends BaseMapper<SarStandAttrInfo> {
void alterStandAttr(@Param("fieldInfo") String fieldInfo); void alterStandAttr(@Param("fieldInfo") String fieldInfo);
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarStandFile.dao;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@@ -13,6 +14,7 @@ import java.util.List;
* @author super_liu * @author super_liu
* @since 2021-06-02 * @since 2021-06-02
*/ */
@Repository
public interface SarStandFileDao extends BaseMapper<SarStandFile> { public interface SarStandFileDao extends BaseMapper<SarStandFile> {
List<SarStandFile> selectFileByStandId(String lawsId); List<SarStandFile> selectFileByStandId(String lawsId);
@@ -185,9 +185,9 @@
<if test="standId != null" > <if test="standId != null" >
and stand_id = #{standId} and stand_id = #{standId}
</if> </if>
<if test="idlist != null"> <if test="idList != null">
and id not in and id not in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")"> <foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
@@ -20,6 +20,7 @@
<result column="stand_nature" property="standNature" /> <result column="stand_nature" property="standNature" />
<result column="stand_sort" property="standSort" /> <result column="stand_sort" property="standSort" />
<result column="stand_year" property="standYear" /> <result column="stand_year" property="standYear" />
<result column="text_status_buss" property="textStatusBuss" />
</resultMap> </resultMap>
<resultMap id="BaseResultMapExcel" type="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" > <resultMap id="BaseResultMapExcel" type="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
@@ -35,12 +36,13 @@
<result column="standNatrueShow" property="standNatrueShow" /> <result column="standNatrueShow" property="standNatrueShow" />
<result column="standSortShow" property="standSortShow" /> <result column="standSortShow" property="standSortShow" />
<result column="stand_year" property="standYear" /> <result column="stand_year" property="standYear" />
<result column="text_status_buss" property="textStatusBuss" />
</resultMap> </resultMap>
<!-- SAR_BUSSIONESS_STAND table all fields --> <!-- SAR_BUSSIONESS_STAND table all fields -->
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
modify_time, creation_time, valid_flag, stand_status, replaced_stand_num,replace_stand_num, modify_time, creation_time, valid_flag, stand_status, replaced_stand_num,replace_stand_num,
put_time, issue_time,stand_en_name,stand_name, stand_code, id,apply_country, stand_nature, stand_sort put_time, issue_time,stand_en_name,stand_name, stand_code, id,apply_country, stand_nature, stand_sort,text_status_buss
</sql> </sql>
<sql id="Base_Column_List_show" > <sql id="Base_Column_List_show" >
stand_year,dicapplyCountry.DIC_TYPE_NAME as applyCountryShow,dicstandSort.DIC_TYPE_NAME as standSortShow, stand_year,dicapplyCountry.DIC_TYPE_NAME as applyCountryShow,dicstandSort.DIC_TYPE_NAME as standSortShow,
@@ -48,7 +50,7 @@
SAR_BUSSIONESS_STAND.creation_time, SAR_BUSSIONESS_STAND.valid_flag, SAR_BUSSIONESS_STAND.creation_time, SAR_BUSSIONESS_STAND.valid_flag,
SAR_BUSSIONESS_STAND.apply_country, SAR_BUSSIONESS_STAND.stand_nature,SAR_BUSSIONESS_STAND.stand_sort, SAR_BUSSIONESS_STAND.apply_country, SAR_BUSSIONESS_STAND.stand_nature,SAR_BUSSIONESS_STAND.stand_sort,
stand_status, replaced_stand_num,replace_stand_num,put_time,issue_time,stand_en_name, stand_status, replaced_stand_num,replace_stand_num,put_time,issue_time,stand_en_name,
stand_name, stand_code,SAR_BUSSIONESS_STAND.id,dicstandStatus.DIC_TYPE_NAME as standStatusShow stand_name, stand_code,SAR_BUSSIONESS_STAND.id,dicstandStatus.DIC_TYPE_NAME as standStatusShow,SAR_BUSSIONESS_STAND.text_status_buss
</sql> </sql>
<sql id="Group_Column_List_show" > <sql id="Group_Column_List_show" >
@@ -352,7 +354,7 @@
<!-- 分页查询条件 --> <!-- 分页查询条件 -->
<sql id="SarBussionInfo_Where_Clause"> <sql id="SarBussionInfo_Where_Clause">
left join TS_DICTYPE dicstandStatus ON ( dicstandStatus.dic_type_code = SAR_BUSSIONESS_STAND.STAND_STATUS AND dicstandStatus.dic_id IS NOT NULL and dicstandStatus.valid_flag = 0) left join TS_DICTYPE dicstandStatus ON ( dicstandStatus.dic_type_code = SAR_BUSSIONESS_STAND.TEXT_STATUS_BUSS AND dicstandStatus.dic_id IS NOT NULL and dicstandStatus.valid_flag = 0)
left join TS_DICTYPE dicstandNature ON ( dicstandNature.dic_type_code = SAR_BUSSIONESS_STAND.STAND_NATURE AND dicstandNature.dic_id IS NOT NULL and dicstandNature.valid_flag = 0) left join TS_DICTYPE dicstandNature ON ( dicstandNature.dic_type_code = SAR_BUSSIONESS_STAND.STAND_NATURE AND dicstandNature.dic_id IS NOT NULL and dicstandNature.valid_flag = 0)
left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0) left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0)
left join TS_DICTYPE dicapplyCountry ON ( dicapplyCountry.dic_type_code = SAR_BUSSIONESS_STAND.APPLY_COUNTRY AND dicapplyCountry.dic_id IS NOT NULL and dicapplyCountry.valid_flag = 0) left join TS_DICTYPE dicapplyCountry ON ( dicapplyCountry.dic_type_code = SAR_BUSSIONESS_STAND.APPLY_COUNTRY AND dicapplyCountry.dic_id IS NOT NULL and dicapplyCountry.valid_flag = 0)