From 5a6693fd682012d572996555c4a47be6df2963cf Mon Sep 17 00:00:00 2001 From: super_liu <396572590@qq.com> Date: Thu, 19 Aug 2021 10:46:58 +0800 Subject: [PATCH 1/9] feat: There is no way the --- .../da/mq/service/CreateStandMQService.java | 25 ++ .../adc/da/mq/service/SendBussMQService.java | 408 ++++++++++++++++++ .../dao/SarBussionessStandDao.java | 66 +++ .../impl/SarBussionessStandServiceImpl.java | 173 +++++++- 4 files changed, 664 insertions(+), 8 deletions(-) create mode 100644 adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java index b7253717..b3271e42 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java @@ -1,5 +1,7 @@ package com.adc.da.mq.service; +import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; +import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo; import net.sf.json.JSONObject; import org.springframework.amqp.core.AmqpTemplate; import org.springframework.beans.factory.annotation.Autowired; @@ -29,4 +31,27 @@ public class CreateStandMQService { //发送消息队列 this.rabbitTemplate.convertAndSend("stand-exchange_SQ_GSAR", "stand-key_SQ_GSAR", standMap); } + + public void sendLawsMQ(SarLawsInfo sarLawsInfoEO, String addOrUpdate) throws Exception{ + JSONObject json = JSONObject.fromObject(sarLawsInfoEO); + String sarLawsInfoStr = json.toString(); + Map lawsMap = new HashMap(); + lawsMap.put("sarLaws", sarLawsInfoStr); + lawsMap.put("addOrUpdate", addOrUpdate); + + //发送消息队列 + this.rabbitTemplate.convertAndSend("laws-exchange_SQ_GSAR", "laws-key_SQ_GSAR", lawsMap); + } + + public void sendBussStandMQ(SarBussionessStand sarBussionessStandEO, String addOrUpdate) throws Exception{ + JSONObject json = JSONObject.fromObject(sarBussionessStandEO); + String sarBussInfoStr = json.toString(); + Map bussMap = new HashMap(); + bussMap.put("sarBuss", sarBussInfoStr); + bussMap.put("addOrUpdate", addOrUpdate); + + //发送消息队列 + this.rabbitTemplate.convertAndSend("buss-exchange_SQ_GSAR", "buss-key_SQ_GSAR", bussMap); + } + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java new file mode 100644 index 00000000..0779b64e --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java @@ -0,0 +1,408 @@ +//package com.adc.da.mq.service; +// +//import com.adc.da.lawss.entity.OtSvppsEO; +//import com.adc.da.lawss.entity.SarBussionessStandEO; +//import com.adc.da.lawss.entity.SarFullNumEO; +//import com.adc.da.lawss.page.SarFullNumEOPage; +//import com.adc.da.lawss.service.OtSvppsEOService; +//import com.adc.da.lawss.service.SarFullNumEOService; +//import com.adc.da.lawss.service.SarStandAndLawsEOService; +//import com.adc.da.lawss.service.SysInfoEOService; +//import com.adc.da.search.entity.StandLawsEO; +//import com.adc.da.slrs.otSvpps.service.IOtSvppsService; +//import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; +//import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; +//import com.adc.da.slrs.sysInfo.service.SysInfoEOService; +//import com.adc.da.sys.dao.DicTypeEODao; +//import com.adc.da.utils.util.InitStandAttrUtil; +//import com.rabbitmq.client.Channel; +//import net.sf.json.JSONObject; +//import org.apache.commons.lang.StringUtils; +//import org.json.JSONTokener; +//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.messaging.Message; +//import org.springframework.stereotype.Component; +// +//import java.text.ParseException; +//import java.text.SimpleDateFormat; +//import java.util.*; +//import java.util.stream.Collectors; +// +//@Component +//public class SendBussMQService { +// +// @Autowired +// private ISarStandardsInfoService sarStandardsInfoService; +// +// @Autowired +// private SysInfoEOService sysInfoEOService; +// +// @Autowired +// private DicTypeEODao dicTypeEODao; +// +// @Autowired +// private IOtSvppsService otSvppsEOService; +// +// private static final Logger logger = LoggerFactory.getLogger(SendBussMQService.class); +// +// +// @RabbitListener(bindings = @QueueBinding( +// value = @Queue(value = "createBussMQ_SQ_GSAR", durable = "true"), +// exchange = @Exchange(value = "buss-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"), +// key = "buss-key_SQ_GSAR")) +// public void createMQ(Map bussMap, Message message, Channel channel) throws Exception{ +// try{ +// try{ +// Thread.sleep(5000); +// insertOrUpdateBussInfo(bussMap); +// }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 insertOrUpdateBussInfo(Map bussMap) throws Exception { +// String addOrUpdate = bussMap.get("addOrUpdate").toString(); +// String FZRQFSRQ = null; +// if ("updateFromAct".equals(addOrUpdate)){ +// addOrUpdate = "update"; +// FZRQFSRQ = "1"; +// } +// String sarBuss = bussMap.get("sarBuss").toString(); +// JSONObject jsonobject = JSONObject.fromObject(sarBuss); +// SarBussionessStand infoEO = (SarBussionessStand) JSONObject.toBean(jsonobject, SarBussionessStand.class); +// String jsonobject1 = infoEO.getSarStandAttrEOStr(); +// Map map1 = new HashMap<>(); +// if (StringUtils.isEmpty(jsonobject1)){ +// map1.put("null","null"); +// }else { +// map1 = JSONObject.fromObject(jsonobject1); +// } +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// //修改索引信息表 +// // 往索引表中插入数据 +// String baseSearchContent = ""; +// String getCodeName = ""; +// Map saveMap = new HashMap<>(); +// String a = null; +// try{ +// a = sdf.format(infoEO.getIssueTime()); +// saveMap.put("issue_time"," "+a); +// }catch (Exception e){ +// saveMap.put("issue_time"," "); +// } +// +// +// +// //发布日期 高级查询 +// Date issue_time_data = null; +// if (StringUtils.isNotBlank(a)) { +// 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) { +// } +// } +// if (issue_time_data != null) { +// Calendar calendar = Calendar.getInstance(); +// calendar.setTime(issue_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("issue_time_data",Long.valueOf(times)); +// }else{ +// saveMap.put("issue_time_data",-1000000000000000000L); +// } +// +// try{ +// saveMap.put("put_time"," "+ sdf.format(infoEO.getPutTime())); +// }catch (Exception e){ +// saveMap.put("put_time"," "); +// } +// +// //实施日期 高级查询 +// Date put_time_data = null; +// if (StringUtils.isNotBlank(a)) { +// try { +// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// put_time_data = format.parse(saveMap.get("put_time")+" 00:00:00"); +// } catch (ParseException ignored) { +// } +// } +// if (put_time_data != null) { +// Calendar calendar = Calendar.getInstance(); +// calendar.setTime(put_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("put_time_data",Long.valueOf(times)); +// }else{ +// saveMap.put("put_time_data",-1000000000000000000L); +// } +//// saveMap.put("put_time",sdf.format(infoEO.getPutTime())); +// +// saveMap.put("id",infoEO.getId()); +// saveMap.put("standSort",infoEO.getStandSort()); +// saveMap.put("stand_sort",infoEO.getStandSort()); +// if(StringUtils.isNotEmpty(infoEO.getStandSort())){ +// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort()); +// saveMap.put("standSortShow",codeName); +// getCodeName = codeName; +// } +// String realContent = ""; +// if (map1.containsKey("QBWB")) { +// String content = String.valueOf(map1.get("QBWB")); +// String[] ids = content.split(","); +// for (String id :ids) { +// if (!"null".equals(id) && StringUtils.isNotBlank(id)) { +// if ("".equals(realContent)) { +// realContent += id; +// } else { +// realContent = realContent + "," + id; +// } +// } +// } +// } +// if (map1.containsKey("GCWB")) { +// String content = String.valueOf(map1.get("GCWB")); +// String[] ids = content.split(","); +// for (String id :ids) { +// if (!"null".equals(id) && StringUtils.isNotBlank(id)) { +// if ("".equals(realContent)) { +// realContent += id; +// } else { +// realContent = realContent + "," + id; +// } +// } +// } +// } +// saveMap.put("content",realContent); +// saveMap.put("standYear",infoEO.getStandYear()); +// saveMap.put("stand_year",infoEO.getStandYear()); +// saveMap.put("standNumber",infoEO.getStandCode()); +// saveMap.put("stand_code",infoEO.getStandCode()); +// saveMap = dealNumberMsg(saveMap,infoEO,getCodeName); +// saveMap.put("nameshow",infoEO.getStandName()); +// saveMap.put("stand_name",infoEO.getStandName()); +// saveMap.put("standEnName",infoEO.getStandEnName()); +// saveMap.put("stand_en_name",infoEO.getStandEnName()); +// saveMap.put("replaceStandNum",infoEO.getReplaceStandNum()); +// saveMap.put("replace_stand_num",infoEO.getReplaceStandNum()); +// saveMap.put("replacedStandNum",infoEO.getReplacedStandNum()); +// saveMap.put("replaced_stand_num",infoEO.getReplacedStandNum()); +// saveMap.put("statecode",infoEO.getStandStatus()); +// saveMap.put("stand_status",infoEO.getStandStatus()); +// if (StringUtils.isNotEmpty(infoEO.getStandStatus())) { +// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandStatus()); +// saveMap.put("standstateshow",codeName); +// } +// //新加字段 +// saveMap.put("country",infoEO.getApplyCountry()); +// if(StringUtils.isNotEmpty(infoEO.getApplyCountry())){ +// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getApplyCountry()); +// saveMap.put("countryShow",codeName); +// } +// // 自定义属性字段 +// String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr(); +// Map attrInfoMap = new HashMap<>(); +// if (StringUtils.isEmpty(sarStandAttrEOStr)){ +// attrInfoMap.put("null","null"); +// }else { +// attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr); +// } +// if (attrInfoMap != null && !attrInfoMap.isEmpty()) { +// attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "bussstand",baseSearchContent); +// saveMap.putAll(attrInfoMap); +// } +// String FSRQ = null; +// if (attrInfoMap != null) { +// if (attrInfoMap.containsKey("FSRQ")){ +// if ("1".equals(FZRQFSRQ)){ +// Long times = Long.valueOf(String.valueOf(attrInfoMap.get("FSRQ")).trim()); +// Date fsrq1 = new Date(times); +// attrInfoMap.put("FSRQ",sdf.format(fsrq1)); +// } +// try{ +// if (String.valueOf(attrInfoMap.get("FSRQ")).trim().length()>10) { +// FSRQ = String.valueOf(attrInfoMap.get("FSRQ")).trim().substring(0, 10) + " 00:00:00"; +// }else{ +// FSRQ = String.valueOf(attrInfoMap.get("FSRQ")).trim() + " 00:00:00"; +// } +// +// saveMap.put("FSRQString"," "+FSRQ.substring(0, 10)); +// saveMap.put("FSRQDate"," "+FSRQ.substring(0, 10).replace("-","")); +// FSRQ = String.valueOf(FSRQ.substring(0, 10).replace("-","")); +// saveMap.put("FSRQ"," "+FSRQ); +// }catch (Exception e){ +// saveMap.put("FSRQString"," "); +// saveMap.put("FSRQDate"," "+" "); +// } +// }else{ +// saveMap.put("FSRQString"," "); +// saveMap.put("FSRQDate"," "+" "); +// } +// } +// +// String FZRQ = null; +// if (attrInfoMap != null && attrInfoMap.containsKey("FZRQ")) { +// if ("1".equals(FZRQFSRQ)){ +// Long times = Long.valueOf(String.valueOf(attrInfoMap.get("FZRQ")).trim()); +// Date fzrq1 = new Date(times); +// String timeFzrq = sdf.format(fzrq1); +// if (timeFzrq.trim().length()>10){ +// timeFzrq = timeFzrq.trim().substring(0,10); +// } +// attrInfoMap.put("FZRQ",timeFzrq); +// } +// +// try{ +// if (String.valueOf(attrInfoMap.get("FZRQ")).trim().length()>10) { +// FZRQ = String.valueOf(attrInfoMap.get("FZRQ")).trim().substring(0, 10) + " 00:00:00"; +// }else{ +// FZRQ = String.valueOf(attrInfoMap.get("FZRQ")).trim() + " 00:00:00"; +// } +// +// saveMap.put("FZRQString"," "+FZRQ.substring(0,10)); +// saveMap.put("FZRQDate"," "+FZRQ.replace("-","")); +// FZRQ = String.valueOf(sdf.parse(FZRQ).getTime()); +// saveMap.put("FZRQ"," "+FZRQ); +// }catch (Exception e) { +// saveMap.put("FZRQString", " " + FZRQ); +// saveMap.put("FZRQDate"," "+" "); +// } +// } else { +// saveMap.put("FZRQString", " "); +// saveMap.put("FZRQDate"," "+" "); +// } +// +// //废止日期 高级查询 +// 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 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 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 dealNumberMsg (Map 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; +// } +// +//} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/dao/SarBussionessStandDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/dao/SarBussionessStandDao.java index b5a14085..79a5af4f 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/dao/SarBussionessStandDao.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/dao/SarBussionessStandDao.java @@ -1,10 +1,14 @@ package com.adc.da.slrs.sarBussionessStand.dao; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; +import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO; import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; +import com.adc.da.sys.entity.UserEO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import java.util.Date; import java.util.List; /** @@ -30,4 +34,66 @@ public interface SarBussionessStandDao extends BaseMapper { List getBussionessStandInfoPage(SarBussionessStandEOPage page); + List getBussionessStandInfoPageByRole(SarBussionessStandEOPage page); + + //企标复审使用 + List getBussionessStandInfoQbfs(SarBussionessStandEOPage page); + + int getBussionessStandInfoCountByRole(SarBussionessStandEOPage page); + + List getSarBussionessStand(SarBussionessStandEOPage page); + //liwenxuan:标准法规更新数量及清单:企业标准 + Integer selectBussionessStandardsCount(Date visitTime); + //liwenxuan:标准法规更新数量及清单:企业标准All + Integer selectBussionessStandardsCountAll(); + + + List selectSarBussionesDownloadFileInfo(String id); + + List selectStandardsByStandnumber(SarBussionessStand sarStandardsInfoEO); + + List selectStandByStandNumber(@Param("standCode") String standCode); + + /** + * 搜索中心查询相关推荐 + * + * @param: + * @auther: gaoyan + * @date: 2018/11/10 9:22 + */ + List selectRecommendStand(SarBussionessStandEOPage pagenew); + + List selectCloseStand(SarBussionessStandEOPage pagenew); + + List queryByPutTimeList(SarBussionessStand sarBussionessStandEO); + + int updateByStandNum(SarBussionessStand s); + + /** + * 根据唯一的标准code,修改标准的被代替标准号 + * @param: + * @auther: gaoyan + * @date: 2018/11/10 9:22 + */ + int updateRelacedNumByNumber(SarBussionessStandEOPage pagenew); + + int updateRelaceNumByNumber(SarBussionessStandEOPage pagenew); + + List selectBussStandByIdAndRole(SarBussionessStandEOPage pagenew); + + void updateReplacedNumById(SarBussionessStand sarBussionessStandEO); + + Integer selectStandColumn(@Param("columnName") String columnName); + + List standRemindInfo(@Param("standCode") String standCode, @Param("standName") String standName); + + int selectIsExit(@Param("id") String id); + + List selectPerson(String qbid); + + List selectPersonAll(String qbid); + + int updateByPrimaryKeySelectiveTimeNotNull(SarBussionessStand sarBussionessStandEO); + + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java index a20f5c1c..7ef1e6ea 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java @@ -8,6 +8,11 @@ import com.adc.da.common.SelectionTypeEnum; import com.adc.da.common.UseModuleEnum; import com.adc.da.mq.dao.OtConvertEODao; import com.adc.da.mq.service.CreateMQService; +import com.adc.da.mq.service.CreateStandMQService; +import com.adc.da.person.entity.PersonShareEO; +import com.adc.da.person.entity.TsPersonCollect; +import com.adc.da.person.page.PersonCollectEOPage; +import com.adc.da.person.page.PersonShareEOPage; import com.adc.da.person.service.IPersonCollectEOService; import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao; @@ -27,10 +32,12 @@ import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao; import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo; import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage; +import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService; import com.adc.da.slrs.sarUser.service.ITsUserService; import com.adc.da.slrs.sysInfo.service.SysInfoEOService; import com.adc.da.sys.constant.ValueStateEnum; import com.adc.da.sys.dao.DicTypeEODao; +import com.adc.da.sys.entity.DicTypeEO; import com.adc.da.sys.util.LoginUserUtil; import com.adc.da.util.UUIDUtils; import com.adc.da.utils.util.FieldConvertUtil; @@ -38,10 +45,14 @@ import com.adc.da.utils.util.InitStandAttrUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.sql.Clob; +import java.text.SimpleDateFormat; import java.util.*; /** @@ -55,6 +66,17 @@ import java.util.*; @Service public class SarBussionessStandServiceImpl extends ServiceImpl implements ISarBussionessStandService { + private static final Logger logger = LoggerFactory.getLogger(SarBussionessStandServiceImpl.class); + + @Value("${elas.flag}") + private boolean elasflag; //ES是否启用 + + @Value("${file.path}") + private String filePath;//文件存储路径 + + @Autowired + private SarBussionessStandDao sarBussionessStandEODao; + @Autowired private ITsUserService tsUserService; @@ -91,6 +113,12 @@ public class SarBussionessStandServiceImpl extends ServiceImpl newMap = new HashMap<>(); + Map oldMap = beforeSarStandardsInfo.getAttrInfoMap(); + String attrStr = sarStandardsInfoEO.getSarStandAttrEOStr(); + if (StringUtils.isNotBlank(attrStr)) { + newMap = JSONObject.fromObject(attrStr); + } + newMap = changeMap(sarStandardsInfoEO,newMap); + oldMap = changeMap(beforeSarStandardsInfo,oldMap); + String sortName = sysInfoEOService.getDicNamesByCodes(sarStandardsInfoEO.getStandSort()); + String number = sortName + " " + sarStandardsInfoEO.getStandCode(); + if (StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) { + number += "-" + sarStandardsInfoEO.getStandYear(); + } + String content = number + " 《" + sarStandardsInfoEO.getStandName() + "》"; + sarUpdLogEOService.createUpdateLog(SarTypeEnum.BUSINESS.getValue(),sarStandardsInfoEO.getId(),oldMap,newMap,content); + } + + public Map changeMap (SarBussionessStand sarStandardsInfoEO,Map map) { + map.put("country",sarStandardsInfoEO.getApplyCountry()); + map.put("standSort",sarStandardsInfoEO.getStandSort()); + map.put("standNumber",sarStandardsInfoEO.getStandCode()); + map.put("standYear",sarStandardsInfoEO.getStandYear()); + map.put("standName",sarStandardsInfoEO.getStandName()); + map.put("standEnName",sarStandardsInfoEO.getStandEnName()); + map.put("standNature",sarStandardsInfoEO.getStandNature()); + map.put("standState",sarStandardsInfoEO.getStandStatus()); + if (sarStandardsInfoEO.getIssueTime() != null) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String issueStr = format.format(sarStandardsInfoEO.getIssueTime()); + map.put("issueTime",issueStr); + } + if (sarStandardsInfoEO.getPutTime() != null) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String issueStr = format.format(sarStandardsInfoEO.getPutTime()); + map.put("putTime",issueStr); + } + map.put("replaceStandNum",sarStandardsInfoEO.getReplaceStandNum()); + map.put("replacedStandNum",sarStandardsInfoEO.getReplacedStandNum()); + return map; + } + + public void updateCollectAndShare(SarBussionessStand sarBussionessStandEO) throws Exception { + //修改收藏表中 + String number = sarBussionessStandEO.getStandCode()+ ")"; + PersonCollectEOPage personCollectEOPage = new PersonCollectEOPage(); + personCollectEOPage.setValidFlag("0"); + personCollectEOPage.setCollectResId(sarBussionessStandEO.getId()); + List listCollect = personCollectEOService.queryByList(personCollectEOPage); + if (listCollect != null && listCollect.size() > 0) { + for (TsPersonCollect getCollect : listCollect) { + TsPersonCollect collectEO = new TsPersonCollect(); + collectEO.setId(getCollect.getId()); + collectEO.setCollectTitle(sarBussionessStandEO.getStandName() + " " + "( 编号:" + number); + personCollectEOService.updateByPrimaryKeySelective(collectEO); + } + } + } + + + public void updateReplaceConnect(SarBussionessStand sarBussionessStandEO) throws Exception{ + if(StringUtils.isNotEmpty(sarBussionessStandEO.getReplaceStandNum())){ + SarBussionessStandEOPage sarStandardsInfoEOPage = new SarBussionessStandEOPage(); + //当前代替标准号的标准类别为类别name,需修改为code + String[] replaceList = sarBussionessStandEO.getReplaceStandNum().trim().split(","); + String replaceListNew[]; + int countre = 0; +// List newReplaceList = new ArrayList<>(); + if (replaceList!=null && replaceList.length>0) { + for(String replaceNum : replaceList){ + if(replaceNum.indexOf(" ")!=-1){ + String dicName = replaceNum.substring(0,replaceNum.lastIndexOf(" ")); + DicTypeEO dicTypeEO = new DicTypeEO(); + dicTypeEO.setDicTypeName(dicName); + dicTypeEO.setDicTypeCode("BUSSSTANDCLASS"); + List getDicCode = dicTypeEODao.getDicTypeByDicTypeName(dicTypeEO); + if(getDicCode!= null && getDicCode.size()>0){ + replaceNum = replaceNum.replaceFirst(dicName,getDicCode.get(0).getDicTypeCode()); + replaceList[countre] = replaceNum; + countre++; + } + } + } + } + sarStandardsInfoEOPage.setReplaceStandNumList(replaceList); +// 2021/03/30 刘慧文修改 标准类别已不存在 + if(StringUtils.isNotEmpty(sarBussionessStandEO.getStandYear())){ + sarStandardsInfoEOPage.setReplacedStandNum(sarBussionessStandEO.getStandCode()+"-"+sarBussionessStandEO.getStandYear()); + } else { + sarStandardsInfoEOPage.setReplacedStandNum(sarBussionessStandEO.getStandCode()); + } + int updateResult = sarBussionessStandEODao.updateRelacedNumByNumber(sarStandardsInfoEOPage); + + //编写预警信息 +// writeWarnings(sarBussionessStandEO); + } + if (StringUtils.isNotEmpty(sarBussionessStandEO.getReplacedStandNum())) { + SarBussionessStandEOPage sarStandardsInfoEOPage = new SarBussionessStandEOPage(); + //当前代替标准号的标准类别为类别name,需修改为code + String[] replaceList = sarBussionessStandEO.getReplacedStandNum().trim().split(","); + int countre = 0; +// List newReplaceList = new ArrayList<>(); + if (replaceList!=null && replaceList.length>0) { + for(String replaceNum : replaceList){ + if(replaceNum.indexOf(" ")!=-1){ + String dicName = replaceNum.substring(0,replaceNum.lastIndexOf(" ")); + DicTypeEO dicTypeEO = new DicTypeEO(); + dicTypeEO.setDicTypeName(dicName); + dicTypeEO.setDicTypeCode("BUSSSTANDCLASS"); + List getDicCode = dicTypeEODao.getDicTypeByDicTypeName(dicTypeEO); + if(getDicCode!= null && getDicCode.size()>0){ + replaceNum = replaceNum.replaceFirst(dicName,getDicCode.get(0).getDicTypeCode()); + replaceList[countre] = replaceNum; + countre++; + } + } + } + } + sarStandardsInfoEOPage.setReplacedStandNumList(replaceList); + // 2021/03/30 刘慧文修改 标准类别已不存在 + if(StringUtils.isNotEmpty(sarBussionessStandEO.getStandYear())){ + sarStandardsInfoEOPage.setReplaceStandNum(sarBussionessStandEO.getStandCode()+"-"+sarBussionessStandEO.getStandYear()); + } else { + sarStandardsInfoEOPage.setReplaceStandNum(sarBussionessStandEO.getStandCode()); + } + int updateResult = sarBussionessStandEODao.updateRelaceNumByNumber(sarStandardsInfoEOPage); + } + } + /*** * @Description: 新增属性表数据 * @Author: yangxuenan From 6c6d99f0880c52c2cd61033239c16cf697195a9a Mon Sep 17 00:00:00 2001 From: "zhaokaiyao@91isoft.com" <6922339zky> Date: Thu, 19 Aug 2021 16:42:10 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=86=99=E4=BA=86=E7=82=B9=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SarStandItemsServiceImpl.java | 6 +----- .../service/impl/SarStandardsInfoServiceImpl.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandItems/service/impl/SarStandItemsServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandItems/service/impl/SarStandItemsServiceImpl.java index abf3eaba..74abe2e0 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandItems/service/impl/SarStandItemsServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandItems/service/impl/SarStandItemsServiceImpl.java @@ -193,13 +193,9 @@ public class SarStandItemsServiceImpl extends ServiceImpl querySarItemAndInterpretation(FindSarItemsPageReqDTO page){ - - - + //分页查询的总数 Integer count=dao.sarItemCount(page); page.getPager().setRowCount(count); - - List sarStandItems = dao.querySarItemAndInterpretation(page); return sarStandItems; } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java index 0b3baafc..f09d5ef9 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java @@ -1137,6 +1137,17 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl */ public int updateSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception { + + /** + * 加入对应"国家/地区"的清单列表 + */ + + //1.获取标准清单的"国家/地区" + //2.判断修改的标准的"国家/地区"与清单中的是否一致,一致则添加到清单中,不一致不作处理 + + + + String standId = sarStandardsInfoEO.getId(); // 查询修改前数据信息,为修改代替标准号使用 SarStandardsInfo beforeSarStandardsInfo = dao.selectById(standId); From 4abeb55cf3ae2127c6698a18f78e091fe782f408 Mon Sep 17 00:00:00 2001 From: super_liu <396572590@qq.com> Date: Fri, 20 Aug 2021 12:00:56 +0800 Subject: [PATCH 3/9] feat: There is no way the scheduled conf --- adc-da-main/pom.xml | 5 +++ .../java/com/adc/da/AdcDaApplication.java | 2 + .../src/main/resources/application.properties | 5 +++ adc-da-slrs/pom.xml | 5 +++ .../com/adc/da/scheduled/ScheduledJob.java | 38 +++++++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java diff --git a/adc-da-main/pom.xml b/adc-da-main/pom.xml index cf4b3bc8..57f23e42 100644 --- a/adc-da-main/pom.xml +++ b/adc-da-main/pom.xml @@ -24,6 +24,11 @@ org.springframework.boot spring-boot-starter + + + org.springframework + spring-context-support + com.adc adc-da-convert diff --git a/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java b/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java index 1310d5ab..52969ab4 100644 --- a/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java +++ b/adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java @@ -12,11 +12,13 @@ import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerF import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableScheduling; @EnableEurekaClient @EnableFeignClients @ServletComponentScan @SpringBootApplication(exclude = SecurityAutoConfiguration.class) +@EnableScheduling @MapperScan(value = {"com.adc.da.file.store"}) public class AdcDaApplication { diff --git a/adc-da-main/src/main/resources/application.properties b/adc-da-main/src/main/resources/application.properties index 50c4225d..b7b6adb0 100644 --- a/adc-da-main/src/main/resources/application.properties +++ b/adc-da-main/src/main/resources/application.properties @@ -152,3 +152,8 @@ elas.flag=true # 文档转换TCP通讯地址 convert.host=127.0.0.1 #convert.host=0.0.0.0 + +# ============================================================================= +# scheduled 配置 +# ============================================================================= +isNotScheduled=false \ No newline at end of file diff --git a/adc-da-slrs/pom.xml b/adc-da-slrs/pom.xml index cb647b83..951b761a 100644 --- a/adc-da-slrs/pom.xml +++ b/adc-da-slrs/pom.xml @@ -11,6 +11,11 @@ adc-da-slrs + + + org.springframework + spring-context-support + com.adc adc-da-base diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java new file mode 100644 index 00000000..0937f48d --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java @@ -0,0 +1,38 @@ +package com.adc.da.scheduled; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.Date; + +@EnableScheduling +@Component +@Slf4j +public class ScheduledJob { + + /** + * 根据配置文件设置是否开启定时器 + */ + + @Value("${isNotScheduled}") + private boolean isNotScheduled; //是否开启定时器 + + + @Scheduled(cron="*/5 * * * * ?") + @Async + public void StandScheduledJob(){ + if(isNotScheduled){ + System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01"); + System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---End-01"); + try{ + Thread.sleep(2000); + }catch(Exception e){ + } + } + } +} From d176d93d6bff21cfcd8978951de704c0f82cdea9 Mon Sep 17 00:00:00 2001 From: super_liu <396572590@qq.com> Date: Fri, 20 Aug 2021 14:07:37 +0800 Subject: [PATCH 4/9] feat: There is no way the Buss and Convert --- adc-da-convert/pom.xml | 6 + .../da/convert/mq/CreateConvertMQService.java | 2 +- .../da/convert/mq/SendConvertMQService.java | 629 ++++++++++------ .../controller/OtConvertController.java | 4 +- .../dao/OtConvertDao.java | 4 +- .../entity/OtConvert.java | 4 +- .../service/IOtConvertService.java | 4 +- .../service/impl/OtConvertServiceImpl.java | 8 +- .../controller/OtConvertMqController.java | 23 + .../otConvertMq/dao/OtConvertMqDao.java | 16 + .../otConvertMq/entity/OtConvertMq.java | 99 +++ .../service/IOtConvertMqService.java | 16 + .../service/impl/OtConvertMqServiceImpl.java | 20 + .../mapper/OtConvert/OtConvertMapper.xml | 2 +- .../mapper/otConvertMq/OtConvertMqMapper.xml | 5 + .../adc/da/mq/service/SendBussMQService.java | 699 ++++++++---------- .../entity/SarBussStandFile.java | 11 +- .../SarBussionessStandController.java | 26 +- .../entity/SarBussionessStand.java | 3 + .../impl/SarBussionessStandServiceImpl.java | 122 ++- .../dao/SarStandAttrInfoDao.java | 2 + .../sarStandFile/dao/SarStandFileDao.java | 2 + .../SarBussStandFileMapper.xml | 4 +- .../SarBussionessStandMapper.xml | 8 +- 24 files changed, 1046 insertions(+), 673 deletions(-) rename adc-da-convert/src/main/java/com/adc/da/convert/{OtConvert => otConvert}/controller/OtConvertController.java (93%) rename adc-da-convert/src/main/java/com/adc/da/convert/{OtConvert => otConvert}/dao/OtConvertDao.java (71%) rename adc-da-convert/src/main/java/com/adc/da/convert/{OtConvert => otConvert}/entity/OtConvert.java (96%) rename adc-da-convert/src/main/java/com/adc/da/convert/{OtConvert => otConvert}/service/IOtConvertService.java (70%) rename adc-da-convert/src/main/java/com/adc/da/convert/{OtConvert => otConvert}/service/impl/OtConvertServiceImpl.java (61%) create mode 100644 adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java create mode 100644 adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java create mode 100644 adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java create mode 100644 adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java create mode 100644 adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java create mode 100644 adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml diff --git a/adc-da-convert/pom.xml b/adc-da-convert/pom.xml index cd99fdf3..b1922377 100644 --- a/adc-da-convert/pom.xml +++ b/adc-da-convert/pom.xml @@ -87,6 +87,12 @@ dom4j 2.0.0 + + com.adc + adc-da-slrs + 3.0.0 + compile + diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/mq/CreateConvertMQService.java b/adc-da-convert/src/main/java/com/adc/da/convert/mq/CreateConvertMQService.java index 0a01541f..0d12a3db 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/mq/CreateConvertMQService.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/mq/CreateConvertMQService.java @@ -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); } } diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java index 36e4c5f1..810f4fd3 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java @@ -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 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 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 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){ + + } + + +} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/controller/OtConvertController.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/controller/OtConvertController.java similarity index 93% rename from adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/controller/OtConvertController.java rename to adc-da-convert/src/main/java/com/adc/da/convert/otConvert/controller/OtConvertController.java index de2c8e8a..054a1c48 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/controller/OtConvertController.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/controller/OtConvertController.java @@ -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; diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/dao/OtConvertDao.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/dao/OtConvertDao.java similarity index 71% rename from adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/dao/OtConvertDao.java rename to adc-da-convert/src/main/java/com/adc/da/convert/otConvert/dao/OtConvertDao.java index 736f8ebd..dde7e784 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/dao/OtConvertDao.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/dao/OtConvertDao.java @@ -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; /** diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/entity/OtConvert.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/entity/OtConvert.java similarity index 96% rename from adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/entity/OtConvert.java rename to adc-da-convert/src/main/java/com/adc/da/convert/otConvert/entity/OtConvert.java index a6f90a3c..2d4e6567 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/entity/OtConvert.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/entity/OtConvert.java @@ -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; diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/service/IOtConvertService.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/service/IOtConvertService.java similarity index 70% rename from adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/service/IOtConvertService.java rename to adc-da-convert/src/main/java/com/adc/da/convert/otConvert/service/IOtConvertService.java index 5533a728..d276ba98 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/service/IOtConvertService.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/service/IOtConvertService.java @@ -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; /** diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/service/impl/OtConvertServiceImpl.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/service/impl/OtConvertServiceImpl.java similarity index 61% rename from adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/service/impl/OtConvertServiceImpl.java rename to adc-da-convert/src/main/java/com/adc/da/convert/otConvert/service/impl/OtConvertServiceImpl.java index f873f1a6..a234a431 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/OtConvert/service/impl/OtConvertServiceImpl.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvert/service/impl/OtConvertServiceImpl.java @@ -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; diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java new file mode 100644 index 00000000..4d6a5473 --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java @@ -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; + +/** +*

+ * 文档转换记录信息表 前端控制器 + *

+* +* @author super_liu +* @since 2021-08-20 +*/ +@RestController +@Api(description = "|OtConvertMq|") +@RequestMapping("/otConvertMq/ot-convert-mq") +public class OtConvertMqController extends BaseController { + +} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java new file mode 100644 index 00000000..51d2338c --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java @@ -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; + +/** + *

+ * 文档转换记录信息表 Mapper 接口 + *

+ * + * @author super_liu + * @since 2021-08-20 + */ +public interface OtConvertMqDao extends BaseMapper { + +} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java new file mode 100644 index 00000000..98d3b953 --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java @@ -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; + +/** + *

+ * 文档转换记录信息表 + *

+ * + * @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; + +} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java new file mode 100644 index 00000000..52c0d7c9 --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java @@ -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; + +/** + *

+ * 文档转换记录信息表 服务类 + *

+ * + * @author super_liu + * @since 2021-08-20 + */ +public interface IOtConvertMqService extends IService { + +} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java new file mode 100644 index 00000000..41d28dcb --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java @@ -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; + +/** + *

+ * 文档转换记录信息表 服务实现类 + *

+ * + * @author super_liu + * @since 2021-08-20 + */ +@Service +public class OtConvertMqServiceImpl extends ServiceImpl implements IOtConvertMqService { + +} diff --git a/adc-da-convert/src/main/resources/mybatis/mapper/OtConvert/OtConvertMapper.xml b/adc-da-convert/src/main/resources/mybatis/mapper/OtConvert/OtConvertMapper.xml index b7f1df3f..c97fd46e 100644 --- a/adc-da-convert/src/main/resources/mybatis/mapper/OtConvert/OtConvertMapper.xml +++ b/adc-da-convert/src/main/resources/mybatis/mapper/OtConvert/OtConvertMapper.xml @@ -1,5 +1,5 @@ - + diff --git a/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml b/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml new file mode 100644 index 00000000..480951b6 --- /dev/null +++ b/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java index 0779b64e..36afcafe 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java @@ -1,408 +1,291 @@ -//package com.adc.da.mq.service; -// -//import com.adc.da.lawss.entity.OtSvppsEO; -//import com.adc.da.lawss.entity.SarBussionessStandEO; -//import com.adc.da.lawss.entity.SarFullNumEO; -//import com.adc.da.lawss.page.SarFullNumEOPage; -//import com.adc.da.lawss.service.OtSvppsEOService; -//import com.adc.da.lawss.service.SarFullNumEOService; -//import com.adc.da.lawss.service.SarStandAndLawsEOService; -//import com.adc.da.lawss.service.SysInfoEOService; -//import com.adc.da.search.entity.StandLawsEO; -//import com.adc.da.slrs.otSvpps.service.IOtSvppsService; -//import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; -//import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; -//import com.adc.da.slrs.sysInfo.service.SysInfoEOService; -//import com.adc.da.sys.dao.DicTypeEODao; -//import com.adc.da.utils.util.InitStandAttrUtil; -//import com.rabbitmq.client.Channel; -//import net.sf.json.JSONObject; -//import org.apache.commons.lang.StringUtils; -//import org.json.JSONTokener; -//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.messaging.Message; -//import org.springframework.stereotype.Component; -// -//import java.text.ParseException; -//import java.text.SimpleDateFormat; -//import java.util.*; -//import java.util.stream.Collectors; -// -//@Component -//public class SendBussMQService { -// -// @Autowired -// private ISarStandardsInfoService sarStandardsInfoService; -// -// @Autowired -// private SysInfoEOService sysInfoEOService; -// -// @Autowired -// private DicTypeEODao dicTypeEODao; -// -// @Autowired -// private IOtSvppsService otSvppsEOService; -// -// private static final Logger logger = LoggerFactory.getLogger(SendBussMQService.class); -// -// -// @RabbitListener(bindings = @QueueBinding( -// value = @Queue(value = "createBussMQ_SQ_GSAR", durable = "true"), -// exchange = @Exchange(value = "buss-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"), -// key = "buss-key_SQ_GSAR")) -// public void createMQ(Map bussMap, Message message, Channel channel) throws Exception{ -// try{ -// try{ -// Thread.sleep(5000); -// insertOrUpdateBussInfo(bussMap); -// }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 insertOrUpdateBussInfo(Map bussMap) throws Exception { -// String addOrUpdate = bussMap.get("addOrUpdate").toString(); -// String FZRQFSRQ = null; -// if ("updateFromAct".equals(addOrUpdate)){ -// addOrUpdate = "update"; -// FZRQFSRQ = "1"; -// } -// String sarBuss = bussMap.get("sarBuss").toString(); -// JSONObject jsonobject = JSONObject.fromObject(sarBuss); -// SarBussionessStand infoEO = (SarBussionessStand) JSONObject.toBean(jsonobject, SarBussionessStand.class); -// String jsonobject1 = infoEO.getSarStandAttrEOStr(); -// Map map1 = new HashMap<>(); -// if (StringUtils.isEmpty(jsonobject1)){ -// map1.put("null","null"); -// }else { -// map1 = JSONObject.fromObject(jsonobject1); -// } -// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); -// //修改索引信息表 -// // 往索引表中插入数据 -// String baseSearchContent = ""; -// String getCodeName = ""; -// Map saveMap = new HashMap<>(); -// String a = null; -// try{ -// a = sdf.format(infoEO.getIssueTime()); -// saveMap.put("issue_time"," "+a); -// }catch (Exception e){ -// saveMap.put("issue_time"," "); -// } -// -// -// -// //发布日期 高级查询 -// Date issue_time_data = null; -// if (StringUtils.isNotBlank(a)) { -// 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) { -// } -// } -// if (issue_time_data != null) { -// Calendar calendar = Calendar.getInstance(); -// calendar.setTime(issue_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("issue_time_data",Long.valueOf(times)); -// }else{ -// saveMap.put("issue_time_data",-1000000000000000000L); -// } -// -// try{ -// saveMap.put("put_time"," "+ sdf.format(infoEO.getPutTime())); -// }catch (Exception e){ -// saveMap.put("put_time"," "); -// } -// -// //实施日期 高级查询 -// Date put_time_data = null; -// if (StringUtils.isNotBlank(a)) { -// try { -// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// put_time_data = format.parse(saveMap.get("put_time")+" 00:00:00"); -// } catch (ParseException ignored) { -// } -// } -// if (put_time_data != null) { -// Calendar calendar = Calendar.getInstance(); -// calendar.setTime(put_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("put_time_data",Long.valueOf(times)); -// }else{ -// saveMap.put("put_time_data",-1000000000000000000L); -// } -//// saveMap.put("put_time",sdf.format(infoEO.getPutTime())); -// -// saveMap.put("id",infoEO.getId()); -// saveMap.put("standSort",infoEO.getStandSort()); -// saveMap.put("stand_sort",infoEO.getStandSort()); -// if(StringUtils.isNotEmpty(infoEO.getStandSort())){ -// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort()); -// saveMap.put("standSortShow",codeName); -// getCodeName = codeName; -// } -// String realContent = ""; -// if (map1.containsKey("QBWB")) { -// String content = String.valueOf(map1.get("QBWB")); -// String[] ids = content.split(","); -// for (String id :ids) { -// if (!"null".equals(id) && StringUtils.isNotBlank(id)) { -// if ("".equals(realContent)) { -// realContent += id; -// } else { -// realContent = realContent + "," + id; -// } -// } -// } -// } -// if (map1.containsKey("GCWB")) { -// String content = String.valueOf(map1.get("GCWB")); -// String[] ids = content.split(","); -// for (String id :ids) { -// if (!"null".equals(id) && StringUtils.isNotBlank(id)) { -// if ("".equals(realContent)) { -// realContent += id; -// } else { -// realContent = realContent + "," + id; -// } -// } -// } -// } -// saveMap.put("content",realContent); -// saveMap.put("standYear",infoEO.getStandYear()); -// saveMap.put("stand_year",infoEO.getStandYear()); -// saveMap.put("standNumber",infoEO.getStandCode()); -// saveMap.put("stand_code",infoEO.getStandCode()); -// saveMap = dealNumberMsg(saveMap,infoEO,getCodeName); -// saveMap.put("nameshow",infoEO.getStandName()); -// saveMap.put("stand_name",infoEO.getStandName()); -// saveMap.put("standEnName",infoEO.getStandEnName()); -// saveMap.put("stand_en_name",infoEO.getStandEnName()); -// saveMap.put("replaceStandNum",infoEO.getReplaceStandNum()); -// saveMap.put("replace_stand_num",infoEO.getReplaceStandNum()); -// saveMap.put("replacedStandNum",infoEO.getReplacedStandNum()); -// saveMap.put("replaced_stand_num",infoEO.getReplacedStandNum()); -// saveMap.put("statecode",infoEO.getStandStatus()); -// saveMap.put("stand_status",infoEO.getStandStatus()); -// if (StringUtils.isNotEmpty(infoEO.getStandStatus())) { -// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandStatus()); -// saveMap.put("standstateshow",codeName); -// } -// //新加字段 -// saveMap.put("country",infoEO.getApplyCountry()); -// if(StringUtils.isNotEmpty(infoEO.getApplyCountry())){ -// String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getApplyCountry()); -// saveMap.put("countryShow",codeName); -// } -// // 自定义属性字段 -// String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr(); -// Map attrInfoMap = new HashMap<>(); -// if (StringUtils.isEmpty(sarStandAttrEOStr)){ -// attrInfoMap.put("null","null"); -// }else { -// attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr); -// } -// if (attrInfoMap != null && !attrInfoMap.isEmpty()) { -// attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "bussstand",baseSearchContent); -// saveMap.putAll(attrInfoMap); -// } -// String FSRQ = null; -// if (attrInfoMap != null) { -// if (attrInfoMap.containsKey("FSRQ")){ -// if ("1".equals(FZRQFSRQ)){ -// Long times = Long.valueOf(String.valueOf(attrInfoMap.get("FSRQ")).trim()); -// Date fsrq1 = new Date(times); -// attrInfoMap.put("FSRQ",sdf.format(fsrq1)); -// } -// try{ -// if (String.valueOf(attrInfoMap.get("FSRQ")).trim().length()>10) { -// FSRQ = String.valueOf(attrInfoMap.get("FSRQ")).trim().substring(0, 10) + " 00:00:00"; -// }else{ -// FSRQ = String.valueOf(attrInfoMap.get("FSRQ")).trim() + " 00:00:00"; -// } -// -// saveMap.put("FSRQString"," "+FSRQ.substring(0, 10)); -// saveMap.put("FSRQDate"," "+FSRQ.substring(0, 10).replace("-","")); -// FSRQ = String.valueOf(FSRQ.substring(0, 10).replace("-","")); -// saveMap.put("FSRQ"," "+FSRQ); -// }catch (Exception e){ -// saveMap.put("FSRQString"," "); -// saveMap.put("FSRQDate"," "+" "); -// } -// }else{ -// saveMap.put("FSRQString"," "); -// saveMap.put("FSRQDate"," "+" "); -// } -// } -// -// String FZRQ = null; -// if (attrInfoMap != null && attrInfoMap.containsKey("FZRQ")) { -// if ("1".equals(FZRQFSRQ)){ -// Long times = Long.valueOf(String.valueOf(attrInfoMap.get("FZRQ")).trim()); -// Date fzrq1 = new Date(times); -// String timeFzrq = sdf.format(fzrq1); -// if (timeFzrq.trim().length()>10){ -// timeFzrq = timeFzrq.trim().substring(0,10); -// } -// attrInfoMap.put("FZRQ",timeFzrq); -// } -// -// try{ -// if (String.valueOf(attrInfoMap.get("FZRQ")).trim().length()>10) { -// FZRQ = String.valueOf(attrInfoMap.get("FZRQ")).trim().substring(0, 10) + " 00:00:00"; -// }else{ -// FZRQ = String.valueOf(attrInfoMap.get("FZRQ")).trim() + " 00:00:00"; -// } -// -// saveMap.put("FZRQString"," "+FZRQ.substring(0,10)); -// saveMap.put("FZRQDate"," "+FZRQ.replace("-","")); -// FZRQ = String.valueOf(sdf.parse(FZRQ).getTime()); -// saveMap.put("FZRQ"," "+FZRQ); -// }catch (Exception e) { -// saveMap.put("FZRQString", " " + FZRQ); -// saveMap.put("FZRQDate"," "+" "); -// } -// } else { -// saveMap.put("FZRQString", " "); -// saveMap.put("FZRQDate"," "+" "); -// } -// -// //废止日期 高级查询 -// 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 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 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 dealNumberMsg (Map 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; -// } -// -//} +package com.adc.da.mq.service; + +import com.adc.da.search.entity.StandLawsEO; +import com.adc.da.slrs.otSvpps.service.IOtSvppsService; +import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; +import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; +import com.adc.da.slrs.sysInfo.service.SysInfoEOService; +import com.adc.da.sys.dao.DicTypeEODao; +import com.adc.da.utils.util.InitStandAttrUtil; +import com.rabbitmq.client.Channel; +import net.sf.json.JSONObject; +import org.apache.commons.lang.StringUtils; +import org.json.JSONTokener; +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.messaging.Message; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +@Component +public class SendBussMQService { + + @Autowired + private ISarStandardsInfoService sarStandardsInfoService; + + @Autowired + private SysInfoEOService sysInfoEOService; + + @Autowired + private DicTypeEODao dicTypeEODao; + + @Autowired + private IOtSvppsService otSvppsEOService; + + private static final Logger logger = LoggerFactory.getLogger(SendBussMQService.class); + + + @RabbitListener(bindings = @QueueBinding( + value = @Queue(value = "createBussMQ_SQ_GSAR", durable = "true"), + exchange = @Exchange(value = "buss-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"), + key = "buss-key_SQ_GSAR")) + public void createMQ(Map bussMap, Message message, Channel channel) throws Exception{ + try{ + try{ + Thread.sleep(5000); + insertOrUpdateBussInfo(bussMap); + }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 insertOrUpdateBussInfo(Map bussMap) throws Exception { + String addOrUpdate = bussMap.get("addOrUpdate").toString(); + String FZRQFSRQ = null; + if ("updateFromAct".equals(addOrUpdate)){ + addOrUpdate = "update"; + FZRQFSRQ = "1"; + } + String sarBuss = bussMap.get("sarBuss").toString(); + JSONObject jsonobject = JSONObject.fromObject(sarBuss); + SarBussionessStand infoEO = (SarBussionessStand) JSONObject.toBean(jsonobject, SarBussionessStand.class); + String jsonobject1 = infoEO.getSarStandAttrEOStr(); + Map map1 = new HashMap<>(); + if (StringUtils.isEmpty(jsonobject1)){ + map1.put("null","null"); + }else { + map1 = JSONObject.fromObject(jsonobject1); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //修改索引信息表 + // 往索引表中插入数据 + String baseSearchContent = ""; + String getCodeName = ""; + Map saveMap = new HashMap<>(); + String a = null; + try{ + a = sdf.format(infoEO.getIssueTime()); + saveMap.put("issue_time"," "+a); + }catch (Exception e){ + saveMap.put("issue_time"," "); + } + + + + //发布日期 高级查询 + Date issue_time_data = null; + if (StringUtils.isNotBlank(a)) { + 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) { + } + } + if (issue_time_data != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(issue_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("issue_time_data",Long.valueOf(times)); + }else{ + saveMap.put("issue_time_data",-1000000000000000000L); + } + + try{ + saveMap.put("put_time"," "+ sdf.format(infoEO.getPutTime())); + }catch (Exception e){ + saveMap.put("put_time"," "); + } + + //实施日期 高级查询 + Date put_time_data = null; + if (StringUtils.isNotBlank(a)) { + try { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + put_time_data = format.parse(saveMap.get("put_time")+" 00:00:00"); + } catch (ParseException ignored) { + } + } + if (put_time_data != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(put_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("put_time_data",Long.valueOf(times)); + }else{ + saveMap.put("put_time_data",-1000000000000000000L); + } +// saveMap.put("put_time",sdf.format(infoEO.getPutTime())); + + saveMap.put("id",infoEO.getId()); + saveMap.put("standSort",infoEO.getStandSort()); + saveMap.put("stand_sort",infoEO.getStandSort()); + if(StringUtils.isNotEmpty(infoEO.getStandSort())){ + String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort()); + saveMap.put("standSortShow",codeName); + getCodeName = codeName; + } + saveMap.put("standYear",infoEO.getStandYear()); + saveMap.put("stand_year",infoEO.getStandYear()); + saveMap.put("standNumber",infoEO.getStandCode()); + saveMap.put("stand_code",infoEO.getStandCode()); + saveMap = dealNumberMsg(saveMap,infoEO,getCodeName); + saveMap.put("nameshow",infoEO.getStandName()); + saveMap.put("stand_name",infoEO.getStandName()); + saveMap.put("standEnName",infoEO.getStandEnName()); + saveMap.put("stand_en_name",infoEO.getStandEnName()); + saveMap.put("replaceStandNum",infoEO.getReplaceStandNum()); + saveMap.put("replace_stand_num",infoEO.getReplaceStandNum()); + saveMap.put("replacedStandNum",infoEO.getReplacedStandNum()); + saveMap.put("replaced_stand_num",infoEO.getReplacedStandNum()); + saveMap.put("statecode",infoEO.getStandStatus()); + saveMap.put("stand_status",infoEO.getStandStatus()); + if (StringUtils.isNotEmpty(infoEO.getStandStatus())) { + String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandStatus()); + saveMap.put("standstateshow",codeName); + } + //新加字段 + saveMap.put("country",infoEO.getApplyCountry()); + if(StringUtils.isNotEmpty(infoEO.getApplyCountry())){ + String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getApplyCountry()); + saveMap.put("countryShow",codeName); + } + // 自定义属性字段 + String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr(); + Map attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr); + Map infoMap = infoEO.getAttrInfoMap(); + + if (attrInfoMap != null && !attrInfoMap.isEmpty()) { + attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "stand",baseSearchContent); + saveMap.putAll(attrInfoMap); + } + + saveMap.put("type","bussstand"); + saveMap.put("validFlag","0"); + saveMap.put("content",infoEO.getFileIds()); + + String fieldInfo = InitStandAttrUtil.queryField; + List 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); + } + + //当建立代替时,产生的没有文件的问题 + if (StringUtils.isBlank(String.valueOf(saveMap.get("content")))) { + String context = filterStringIsNotBlank(String.valueOf(saveMap.get("FBGBUSS")),true) + + filterStringIsNotBlank(String.valueOf(saveMap.get("BZSMBUSS")),true) + + filterStringIsNotBlank(String.valueOf(saveMap.get("LSBBBUSS")),true) + + filterStringIsNotBlank(String.valueOf(saveMap.get("QTWJBUSS")),true) + + filterStringIsNotBlank(String.valueOf(saveMap.get("GLWJBUSS")),true); + context = context.replace(",,", ","); + saveMap.put("content", context); + } + if("add".equals(addOrUpdate)){ + sarStandardsInfoService.insertIntoIndexForMap(saveMap); + } else { + sarStandardsInfoService.updateIntoIndexForMap(saveMap); + } + } + + private String filterStringIsNotBlank(String str,boolean boo){ + String f = ","; + return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str); + } + + private String dateFormatToStr(String dateStr){ + if(dateStr == null || dateStr.equals("")){ + return ""; + } + String dateToStr = ""; + try { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + dateToStr = dateFormat.format(dateFormat.parse(dateStr.trim().substring(0,10))); + }catch (Exception e){ + e.getMessage(); + } + return dateToStr; + } + + public Map dealNumberMsg (Map 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; + } + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/entity/SarBussStandFile.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/entity/SarBussStandFile.java index 81e1708e..dbe87ab6 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/entity/SarBussStandFile.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/entity/SarBussStandFile.java @@ -67,7 +67,7 @@ public class SarBussStandFile extends BaseEntity { @ApiModelProperty(value = "是否有效") @TableField("VALID_FLAG") - private String validFlag; + private Integer validFlag; @ApiModelProperty(value = "创建时间") @TableField("CREATION_TIME") @@ -86,4 +86,13 @@ public class SarBussStandFile extends BaseEntity { @TableField(exist = false) private List 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; + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/controller/SarBussionessStandController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/controller/SarBussionessStandController.java index 14d6e5a5..c6a92e00 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/controller/SarBussionessStandController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/controller/SarBussionessStandController.java @@ -10,10 +10,10 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; import com.adc.da.slrs.sarUser.service.ITsUserService; import com.adc.da.sys.entity.DicTypeEO; 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.ResponseMessage; import com.adc.da.http.Result; +import com.adc.da.util.LoginUserUtil; import com.adc.da.util.utils.StringUtils; import com.adc.da.utils.util.SarAdvanceSearchUtil; import com.alibaba.fastjson.JSONObject; @@ -168,33 +168,15 @@ public class SarBussionessStandController extends BaseController qw = new QueryWrapper<>(); - qw.eq("ID",page.getMenuId()); - qw.isNull("PARENT_ID"); - List children = iTsResourceService.list(qw); - if(!children.isEmpty() || page.getMenuId().equals("nomenu")){ - List rows = sarBussionessStandEOService.getSarBussionStandPage(page); - return Result.success(getPageInfo(page.getPager(), rows)); - } - List getMenuIdList = tsUserService.getResourceId(new TsResource()); - if (getMenuIdList != null && !getMenuIdList.isEmpty()) { - page.setMenuRoleList(getMenuIdList); - } else { - page.setMenuRoleList(null); - } - List ids = iTsResourceService.getChildMenuList(page.getMenuId()); - if (ids != null && !ids.isEmpty()) { - page.setMenuAllChildrenIdList(ids); - } - } List rows = sarBussionessStandEOService.getSarBussionStandPage(page); return Result.success(getPageInfo(page.getPager(), rows)); // if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) { diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/entity/SarBussionessStand.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/entity/SarBussionessStand.java index 908b96b3..77b9cb49 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/entity/SarBussionessStand.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/entity/SarBussionessStand.java @@ -180,6 +180,9 @@ public class SarBussionessStand extends BaseEntity { @TableField(exist = false) private Map attrInfoMap = new LinkedHashMap<>(); //属性表字段与值 + @TableField(exist = false) + private Map attrInfoCaseMap = new LinkedHashMap<>(); //属性表字段与值小写前端带入渲染 + @TableField(exist = false) private String sarStandAttrEOStr; //新增修改时属性表信息 diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java index 7ef1e6ea..9754981c 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java @@ -6,6 +6,7 @@ import com.adc.da.common.ConvertMqEO; import com.adc.da.common.SarTypeEnum; import com.adc.da.common.SelectionTypeEnum; import com.adc.da.common.UseModuleEnum; +import com.adc.da.http.Result; import com.adc.da.mq.dao.OtConvertEODao; import com.adc.da.mq.service.CreateMQService; 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.sarResource.entity.TsResource; 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.sarStandardsInfo.dao.SarStandardsInfoDao; 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.utils.util.FieldConvertUtil; import com.adc.da.utils.util.InitStandAttrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; +import org.json.JSONTokener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -89,6 +93,9 @@ public class SarBussionessStandServiceImpl extends ServiceImpl entry : getAttrMap.entrySet()) { String name = entry.getKey(); 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(); - if (org.apache.commons.lang3.StringUtils.isNotBlank(value)) { + if (StringUtils.isNotBlank(value)) { List fileObj = attFileEOService.getMultiFileInfos(value); 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(); List valArr = Arrays.asList(value.split(",")); value = dicTypeEODao.getDicNamesByCodes(valArr); @@ -564,6 +571,26 @@ public class SarBussionessStandServiceImpl extends ServiceImpl getSarBussionStandPage(SarBussionessStandEOPage page) throws Exception { + //查询当前登录人角色拥有权限的菜单 + if(page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(page.getUserId())){ + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("ID",page.getMenuId()); + qw.isNull("PARENT_ID"); + List children = iTsResourceService.list(qw); + if(children.isEmpty() && !page.getMenuId().equals("nomenu")){ + List getMenuIdList = tsUserService.getResourceUserId(page.getUserId()); + if (getMenuIdList != null && !getMenuIdList.isEmpty()) { + page.setMenuRoleList(getMenuIdList); + } else { + page.setMenuRoleList(null); + } + List ids = iTsResourceService.getChildMenuList(page.getMenuId()); + if (ids != null && !ids.isEmpty()) { + page.setMenuAllChildrenIdList(ids); + } + } + } + Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page); page.getPager().setRowCount(rowCount); List sarlist = this.baseMapper.getBussionessStandInfoPage(page); @@ -578,7 +605,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl sarlist) throws Exception { for(SarBussionessStand row : sarlist){ - attrInfo1(row); + attrInfoDetails(row); } } @@ -601,6 +628,85 @@ public class SarBussionessStandServiceImpl extends ServiceImpl getAttrMap = row.getAttrInfoMap(); + if (getAttrMap != null && getAttrMap.size() > 0) { + for (Map.Entry entry : getAttrMap.entrySet()) { + String name = entry.getKey(); + String value = ""; + List 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 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 transformUpperCase(Map orgMap) { + Map resultMap = new HashMap<>(); + + for (Map.Entry 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 fileObj = attFileEOService.getMultiFileInfos(value); + if(!fileObj.isEmpty()){ + resultMap.put(newKey + "Name", fileObj.get(0).getOldFileName()); + } + } + } + } + + return resultMap; + } + public void attrInfoDetails (SarBussionessStand row) throws Exception { String fieldInfo = InitStandAttrUtil.queryFieldBuss; String collectId = personCollectEOService.queryCollectByUserAndId(row.getId()); @@ -649,6 +755,10 @@ public class SarBussionessStandServiceImpl extends ServiceImpl { void alterStandAttr(@Param("fieldInfo") String fieldInfo); diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/dao/SarStandFileDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/dao/SarStandFileDao.java index 04e5ea64..87f47cbb 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/dao/SarStandFileDao.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/dao/SarStandFileDao.java @@ -2,6 +2,7 @@ package com.adc.da.slrs.sarStandFile.dao; import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; import java.util.List; @@ -13,6 +14,7 @@ import java.util.List; * @author super_liu * @since 2021-06-02 */ +@Repository public interface SarStandFileDao extends BaseMapper { List selectFileByStandId(String lawsId); diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussStandFile/SarBussStandFileMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussStandFile/SarBussStandFileMapper.xml index f5f571df..370bd60d 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussStandFile/SarBussStandFileMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussStandFile/SarBussStandFileMapper.xml @@ -185,9 +185,9 @@ and stand_id = #{standId} - + and id not in - + #{item} diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussionessStand/SarBussionessStandMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussionessStand/SarBussionessStandMapper.xml index 04eea3a6..1e3996d7 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussionessStand/SarBussionessStandMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussionessStand/SarBussionessStandMapper.xml @@ -20,6 +20,7 @@ + @@ -35,12 +36,13 @@ + 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 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.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_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 @@ -352,7 +354,7 @@ - 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 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) From ebfde8bd5255d9ab41e484af4dad3a6d63b3c16d Mon Sep 17 00:00:00 2001 From: "zhaokaiyao@91isoft.com" <6922339zky> Date: Fri, 20 Aug 2021 14:33:29 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E6=A0=87=E5=87=86?= =?UTF-8?q?=E9=A2=84=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/adc/da/scheduled/ScheduledJob.java | 116 ++++++++++++++++-- .../da/scheduled/dao/SarStandardInfoDao.java | 17 +++ .../da/scheduled/dao/SarStandardItemDao.java | 17 +++ .../scheduled/dao/SarStandardWarningDao.java | 15 +++ .../com/adc/da/scheduled/entity/DataDTO.java | 18 +++ .../adc/da/scheduled/entity/WarningEO.java | 22 ++++ .../sarStandWarning/SarStandardInfo.xml | 38 ++++++ .../sarStandWarning/SarStandardItem.xml | 35 ++++++ .../sarStandWarning/SarStandardWarningDao.xml | 31 +++++ 9 files changed, 300 insertions(+), 9 deletions(-) create mode 100644 adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardInfoDao.java create mode 100644 adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardItemDao.java create mode 100644 adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardWarningDao.java create mode 100644 adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/DataDTO.java create mode 100644 adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/WarningEO.java create mode 100644 adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardInfo.xml create mode 100644 adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardItem.xml create mode 100644 adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardWarningDao.xml diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java index 0937f48d..36f8023f 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java @@ -1,5 +1,11 @@ package com.adc.da.scheduled; +import com.adc.da.scheduled.dao.SarStandardInfoDao; +import com.adc.da.scheduled.dao.SarStandardItemDao; +import com.adc.da.scheduled.dao.SarStandardWarningDao; +import com.adc.da.scheduled.entity.DataDTO; +import com.adc.da.scheduled.entity.WarningEO; +import com.adc.da.util.UUIDUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -8,7 +14,9 @@ import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import java.util.Date; +import java.time.LocalDate; +import java.util.LinkedList; +import java.util.List; @EnableScheduling @Component @@ -22,17 +30,107 @@ public class ScheduledJob { @Value("${isNotScheduled}") private boolean isNotScheduled; //是否开启定时器 +// +// @Scheduled(cron="*/5 * * * * ?") +// @Async +// public void StandScheduledJob(){ +// System.out.println("hello"); +//// if(isNotScheduled){ +//// System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01"); +//// System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---End-01"); +//// try{ +//// Thread.sleep(2000); +//// }catch(Exception e){ +//// } +//// } +// } + + @Autowired + private SarStandardWarningDao sarStandardWarningDao; + + @Autowired + private SarStandardItemDao sarStandardItemDao; + + @Autowired + private SarStandardInfoDao sarStandardInfoDao; + + +// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行 @Scheduled(cron="*/5 * * * * ?") @Async - public void StandScheduledJob(){ - if(isNotScheduled){ - System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01"); - System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---End-01"); - try{ - Thread.sleep(2000); - }catch(Exception e){ - } + public void schedulingTasks() { + + + /** + * 1.查询标准属性字段表(sar_stand_attr_info) XCXSSEQ ZCCSSRQ ZRGCS + * 联接标准信息表sar_standards_info表的STAND_NAME + * 2.查询分解单(条款表) + * 3.查询预警表 + * 4.去掉预警表中已存在的的数据 + * 5.插入预警表 + */ + + /** + mark:标识预警的种类 + 3:新车标准预警 + 4:在产车标准预警 + 1:新车条款预警 + 2:在产车条款预警 + */ + System.out.println("开始执行预警!!!"); + //预警期限 + DataDTO dataDTO = new DataDTO(); + dataDTO.setStartDate(LocalDate.now().plusDays(1)) //系统日期的下一天 + .setEndDate(LocalDate.now().plusMonths(3).plusDays(1));//系统日期3个月后 + + LinkedList warningList = new LinkedList<>(); + + //分解单(条款) 新车型 mark=1 + List itemForXCXSSRQ = sarStandardItemDao.select(dataDTO, "XCXSSRQ"); + for (WarningEO warningEO : itemForXCXSSRQ) { + warningEO.setId(UUIDUtils.randomUUID20()) + .setPower("1") + .setMark("1") + .setPutTime(warningEO.getXCXSSRQ()); + } + warningList.addAll(itemForXCXSSRQ); + + //分解单(条款) 在产车型 mark=2 + List itemForZCCSSRQ = sarStandardItemDao.select(dataDTO, "ZCCSSRQ"); + for (WarningEO warningEO : itemForZCCSSRQ) { + warningEO.setId(UUIDUtils.randomUUID20()) + .setPower("1") + .setMark("2") + .setPutTime(warningEO.getZCCSSRQ()); + } + warningList.addAll(itemForZCCSSRQ); + + //标准 新车型 预警 mark=3 + List standInfoXCXSSRQ = sarStandardInfoDao.select(dataDTO, "XCXSSRQ"); + for (WarningEO warningEO : standInfoXCXSSRQ) { + warningEO.setId(UUIDUtils.randomUUID20()) + .setPower("1") + .setMark("3") + .setPutTime(warningEO.getXCXSSRQ()); + } + warningList.addAll(standInfoXCXSSRQ); + + + //标准 在产车型 mark=4 + List standInfoZCCSSRQ = sarStandardInfoDao.select(dataDTO, "ZCCSSRQ"); + for (WarningEO warningEO : standInfoZCCSSRQ) { + warningEO.setId(UUIDUtils.randomUUID20()) + .setPower("1") + .setMark("4") + .setPutTime(warningEO.getZCCSSRQ()); + } + warningList.addAll(standInfoZCCSSRQ); + + //持久化至预警表 忽略标准id和标志位都一样的数据 + if (warningList.size()!=0){ + int count = sarStandardWarningDao.ignoreInsert(warningList); + System.out.println("已预警 " + count + " 条标准或条款!!"); } } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardInfoDao.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardInfoDao.java new file mode 100644 index 00000000..f2679cbc --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardInfoDao.java @@ -0,0 +1,17 @@ +package com.adc.da.scheduled.dao; + + +import com.adc.da.scheduled.entity.DataDTO; +import com.adc.da.scheduled.entity.WarningEO; +import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO; + +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SarStandardInfoDao{ + + public List select(DataDTO date, String str); + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardItemDao.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardItemDao.java new file mode 100644 index 00000000..401c9fa4 --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardItemDao.java @@ -0,0 +1,17 @@ +package com.adc.da.scheduled.dao; + +import com.adc.da.scheduled.entity.DataDTO; +import com.adc.da.scheduled.entity.WarningEO; +import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SarStandardItemDao extends BaseMapper{ + + public List select(DataDTO date, String str); + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardWarningDao.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardWarningDao.java new file mode 100644 index 00000000..76b2394b --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/dao/SarStandardWarningDao.java @@ -0,0 +1,15 @@ +package com.adc.da.scheduled.dao; + +import com.adc.da.scheduled.entity.WarningEO; +import com.baomidou.mybatisplus.extension.service.IService; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.LinkedList; + +@Repository +public interface SarStandardWarningDao extends IService { + + public int ignoreInsert(@Param(value = "warningEOS") LinkedList warningEOS); +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/DataDTO.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/DataDTO.java new file mode 100644 index 00000000..a1977028 --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/DataDTO.java @@ -0,0 +1,18 @@ +package com.adc.da.scheduled.entity; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.time.LocalDate; + +@Data +@Accessors(chain = true) +public class DataDTO { + + private LocalDate startDate; + + private LocalDate endDate; + + private String str; + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/WarningEO.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/WarningEO.java new file mode 100644 index 00000000..dcfa2df3 --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/entity/WarningEO.java @@ -0,0 +1,22 @@ +package com.adc.da.scheduled.entity; + +import com.adc.da.base.entity.BaseEntity; +import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; + +import java.util.Date; + +@Data +@Accessors(chain = true) +public class WarningEO extends EarlyWarningEO { + private static final long serialVersionUID = 1L; + + private Date XCXSSRQ; + + private Date ZCCSSRQ; + +} diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardInfo.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardInfo.xml new file mode 100644 index 00000000..3d82bdd6 --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardInfo.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardItem.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardItem.xml new file mode 100644 index 00000000..58a4b8eb --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardItem.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardWarningDao.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardWarningDao.xml new file mode 100644 index 00000000..95d5ca67 --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandWarning/SarStandardWarningDao.xml @@ -0,0 +1,31 @@ + + + + + + + INSERT IGNORE INTO sar_stand_warning (ID, STAND_TYPE, STAND_CODE,STAND_NAME,PUT_TIME,APPLY_TYPE,DUTY_ENGINEER,ITEMS_ID,ITEMS_NAME,POLICY_ID,POLICY_NAME,MARK,POWER) + VALUES + + + ( + #{item.id} + ,#{item.standType} + ,#{item.standCode} + ,#{item.standName} + ,#{item.putTime} + ,#{item.applyType} + ,#{item.dutyEngineer} + ,#{item.itemsId} + ,#{item.itemsName} + ,#{item.policyId} + ,#{item.policyName} + ,#{item.mark} + ,#{item.power} + ) + + + + + + From aaa9598735fb9a51d3d12f805002c8a52c3bf497 Mon Sep 17 00:00:00 2001 From: super_liu <396572590@qq.com> Date: Fri, 20 Aug 2021 15:05:24 +0800 Subject: [PATCH 6/9] feat: There is no way the !!! --- adc-da-main/src/main/resources/application.properties | 2 +- .../src/main/java/com/adc/da/scheduled/ScheduledJob.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adc-da-main/src/main/resources/application.properties b/adc-da-main/src/main/resources/application.properties index b7b6adb0..a4327f1d 100644 --- a/adc-da-main/src/main/resources/application.properties +++ b/adc-da-main/src/main/resources/application.properties @@ -156,4 +156,4 @@ convert.host=127.0.0.1 # ============================================================================= # scheduled 配置 # ============================================================================= -isNotScheduled=false \ No newline at end of file +isNotScheduled=true \ No newline at end of file diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java index 36f8023f..77f6c4ef 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java @@ -56,8 +56,8 @@ public class ScheduledJob { private SarStandardInfoDao sarStandardInfoDao; -// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行 - @Scheduled(cron="*/5 * * * * ?") + @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行 +// @Scheduled(cron="*/5 * * * * ?") @Async public void schedulingTasks() { From dcfedac4bf6dd4c145feca984ab0a1f2a23cc938 Mon Sep 17 00:00:00 2001 From: yuezhihang Date: Fri, 20 Aug 2021 15:20:33 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=BE=81=E6=B1=82?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E6=B5=81=E7=A8=8B=E6=B1=87=E6=80=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SarLawsDetailedListController.java | 1 - .../controller/SarPublicIdeaAllController.java | 8 ++++++++ .../adc/da/slrs/sarStandIdea/dao/SarPublicIdeaAllDao.java | 6 ++++++ .../adc/da/slrs/sarStandIdea/entity/DetAllStandDto.java | 1 + .../adc/da/slrs/sarStandIdea/entity/SarPublicIdea.java | 3 +++ .../adc/da/slrs/sarStandIdea/entity/SarPublicIdeaAll.java | 3 +++ .../service/Impl/SarPublicIdeaAllServiceImpl.java | 2 +- .../mapper/sarStandIdea/SarPublicIdeaAllMapper.xml | 6 ++++++ 8 files changed, 28 insertions(+), 2 deletions(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsDetailedList/controller/SarLawsDetailedListController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsDetailedList/controller/SarLawsDetailedListController.java index 146af0f1..fb33ca82 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsDetailedList/controller/SarLawsDetailedListController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsDetailedList/controller/SarLawsDetailedListController.java @@ -114,7 +114,6 @@ public class SarLawsDetailedListController extends BaseController return Result.success("200",publicList); } + @ApiOperation(value = "查询流程汇总-公共意见") + @GetMapping("/getPublicIdea") + public ResponseMessage getPublicIdea(@Param("unique") String unique){ + List publicList =sarPublicIdeaAllDao.getPublicIdea(unique); + return Result.success("200",publicList); + } + @ApiOperation(value = "查询全部意见") @GetMapping("/checkIsShow") diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/dao/SarPublicIdeaAllDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/dao/SarPublicIdeaAllDao.java index 8db66f76..3719ea86 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/dao/SarPublicIdeaAllDao.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/dao/SarPublicIdeaAllDao.java @@ -3,6 +3,11 @@ package com.adc.da.slrs.sarStandIdea.dao; import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.io.Serializable; +import java.util.Collection; +import java.util.List; /** *

@@ -15,4 +20,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SarPublicIdeaAllDao extends BaseMapper { + List getPublicIdea(@Param("unique")String unique); } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/DetAllStandDto.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/DetAllStandDto.java index e0da9d35..d18ba855 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/DetAllStandDto.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/DetAllStandDto.java @@ -10,4 +10,5 @@ public class DetAllStandDto { String userId; String endTime; String Account; + String ideaId; } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdea.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdea.java index 37c296ba..470fb13a 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdea.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdea.java @@ -63,5 +63,8 @@ public class SarPublicIdea extends BaseEntity { @TableField("stand_type") private String standType; + @TableField("uniques") + private String uniques; + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdeaAll.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdeaAll.java index 54e7ba1c..c50619dd 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdeaAll.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/entity/SarPublicIdeaAll.java @@ -58,6 +58,9 @@ public class SarPublicIdeaAll extends BaseEntity { @TableField("new_text") private String newText; + @TableField("idea_id") + private String ideaId; + public static final String CID = "cid"; } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/service/Impl/SarPublicIdeaAllServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/service/Impl/SarPublicIdeaAllServiceImpl.java index 7f34cc6c..99547e00 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/service/Impl/SarPublicIdeaAllServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandIdea/service/Impl/SarPublicIdeaAllServiceImpl.java @@ -49,7 +49,7 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq("CID", detAllStandDto.getCid()); + wrapper.eq("idea_id", detAllStandDto.getIdeaId()); Page page = new Page<>(detAllStandDto.getPage(), detAllStandDto.getSize()); IPage userIPage = sarPublicIdeaAllDao.selectPage(page, wrapper); System.out.println("总条数" + userIPage.getTotal()); diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml index b0c8772d..9c776392 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml @@ -1,4 +1,10 @@ + + From 27e72dca2ea263fc9670b7d39c30a1c9c5a61a6a Mon Sep 17 00:00:00 2001 From: yuezhihang Date: Fri, 20 Aug 2021 17:49:34 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=BE=81=E6=B1=82=E6=84=8F=E8=A7=81=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml index 9c776392..8beb3f8a 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandIdea/SarPublicIdeaAllMapper.xml @@ -5,6 +5,6 @@ From fe89ba9c60d039adab7818afd69bf02bb86540eb Mon Sep 17 00:00:00 2001 From: super_liu <396572590@qq.com> Date: Fri, 20 Aug 2021 18:12:08 +0800 Subject: [PATCH 9/9] feat: There is no way the Buss and Convert --- adc-da-convert/pom.xml | 20 +- .../adc/da/convert/common/DocConverter.java | 264 ------------------ .../da/convert/common/DocConverterPdf.java | 90 +++--- .../da/convert/common/DocConverterPdfOld.java | 225 --------------- .../da/convert/mq/SendConvertMQService.java | 18 +- .../mapper/otConvertMq/OtConvertMqMapper.xml | 5 - .../main/resources/application-dev.properties | 8 + .../da/mq/{service => }/CreateMQService.java | 10 +- .../{service => }/CreateStandMQService.java | 2 +- .../mq/{service => }/SendBussMQService.java | 3 +- .../mq/{service => }/SendStandMQService.java | 3 +- .../com/adc/da/mq/dao/OtConvertEODao.java | 12 - .../controller/OtConvertMqController.java | 12 +- .../slrs}/otConvertMq/dao/OtConvertMqDao.java | 8 +- .../slrs}/otConvertMq/entity/OtConvertMq.java | 11 +- .../service/IOtConvertMqService.java | 4 +- .../service/impl/OtConvertMqServiceImpl.java | 8 +- .../SarBussStandFileController.java | 51 +++- .../dao/SarBussStandFileDao.java | 4 + .../service/ISarBussStandFileService.java | 4 + .../impl/SarBussStandFileServiceImpl.java | 10 + .../impl/SarBussionessStandServiceImpl.java | 18 +- .../sarStandFile/dao/SarStandFileDao.java | 4 + .../sarStandFile/entity/SarStandFile.java | 10 +- .../impl/SarStandardsInfoServiceImpl.java | 65 +++-- .../mapper/otConvertMq/OtConvertMqMapper.xml | 167 +++++++++++ .../sarStandFile/SarStandFileMapper.xml | 4 +- 27 files changed, 401 insertions(+), 639 deletions(-) delete mode 100644 adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverter.java delete mode 100644 adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdfOld.java delete mode 100644 adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml rename adc-da-slrs/src/main/java/com/adc/da/mq/{service => }/CreateMQService.java (92%) rename adc-da-slrs/src/main/java/com/adc/da/mq/{service => }/CreateStandMQService.java (98%) rename adc-da-slrs/src/main/java/com/adc/da/mq/{service => }/SendBussMQService.java (99%) rename adc-da-slrs/src/main/java/com/adc/da/mq/{service => }/SendStandMQService.java (99%) delete mode 100644 adc-da-slrs/src/main/java/com/adc/da/mq/dao/OtConvertEODao.java rename {adc-da-convert/src/main/java/com/adc/da/convert => adc-da-slrs/src/main/java/com/adc/da/slrs}/otConvertMq/controller/OtConvertMqController.java (76%) rename {adc-da-convert/src/main/java/com/adc/da/convert => adc-da-slrs/src/main/java/com/adc/da/slrs}/otConvertMq/dao/OtConvertMqDao.java (55%) rename {adc-da-convert/src/main/java/com/adc/da/convert => adc-da-slrs/src/main/java/com/adc/da/slrs}/otConvertMq/entity/OtConvertMq.java (96%) rename {adc-da-convert/src/main/java/com/adc/da/convert => adc-da-slrs/src/main/java/com/adc/da/slrs}/otConvertMq/service/IOtConvertMqService.java (69%) rename {adc-da-convert/src/main/java/com/adc/da/convert => adc-da-slrs/src/main/java/com/adc/da/slrs}/otConvertMq/service/impl/OtConvertMqServiceImpl.java (60%) create mode 100644 adc-da-slrs/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml diff --git a/adc-da-convert/pom.xml b/adc-da-convert/pom.xml index b1922377..f11c490a 100644 --- a/adc-da-convert/pom.xml +++ b/adc-da-convert/pom.xml @@ -22,13 +22,23 @@ adc-da-sys 3.0.0 + - com.artofsolving - jodconverter - system - 2.2.2 - ${basedir}/src/main/lib/jodconverter-2.2.2.jar + org.jodconverter + jodconverter-core + 4.2.2 + + org.jodconverter + jodconverter-spring-boot-starter + 4.2.2 + + + org.jodconverter + jodconverter-local + 4.2.2 + + org.openoffice juh diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverter.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverter.java deleted file mode 100644 index 5febe5de..00000000 --- a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverter.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.adc.da.convert.common; - -import com.artofsolving.jodconverter.DocumentConverter; -import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; - -import java.io.*; - -/** - * @Author yangxuenan - * @Description 文档转换 - * Date 2018/8/24 13:44 - * @Param - * @return - **/ -public class DocConverter { - - private static final Logger logger = LoggerFactory.getLogger(DocConverter.class); - // 环境 1:windows 2:linux - private static final int ENVIRONMENT = 1; - // (只涉及pdf2swf路径问题) - private String fileString; - // 输入路径 ,如果不设置就输出在默认的位置 - private String outputPath = ""; - //转化文件名称 - private String fileName; - //转换pdf文件 - private File pdfFile; - //转换成swf文件 - private File swfFile; - //待转换doc文件 - private File docFile; - //为文件加水印后文件路径 - String waterPdfPath; - - @Value("${convert.host}") - private String convertHost; - - public DocConverter(String fileString,String fileType) { - ini(fileString,fileType); - } - - /** - * @Author yangxuenan - * @Description 重新设置file - * Date 2018/8/24 13:50 - * @Param [fileString, fileType] - * @return void - **/ - public void setFile(String fileString,String fileType) { - ini(fileString,fileType); - } - - /** - * @Author yangxuenan - * @Description 初始化 - * Date 2018/8/24 13:50 - * @Param [fileString, fileType] - * @return void - **/ - private void ini(String fileString,String fileType) { - this.fileString = fileString; - fileName = fileString.substring(0, fileString.lastIndexOf(".")); - //判断文件类型,进行不同操作 - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - docFile = new File(fileString); - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } else if (".pdf".equals(fileType)){ - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } - } - - /** - * @Author yangxuenan - * @Description 转为PDF - * Date 2018/8/24 13:50 - * @Param [] - * @return void - **/ - private void doc2pdf() throws Exception { - if (docFile.exists()) { - if (!pdfFile.exists()) { - logger.info("转换服务地址接口:"+convertHost); - //连接openOffice - OpenOfficeConnection connection = new SocketOpenOfficeConnection(convertHost,8100); - try { - connection.connect(); - //使用openOffice将doc文件转换问pdf文件 - DocumentConverter converter = new OpenOfficeDocumentConverter(connection); - converter.convert(docFile, pdfFile); - // 关闭连接 - connection.disconnect(); - logger.info("****pdf转换成功,PDF输出:" + pdfFile.getPath()+ "****"); - } catch (java.net.ConnectException e) { - logger.error(e.getMessage(),e); - logger.info("****swf转换器异常,openoffice服务未启动!****"); - throw e; - } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) { - logger.error(e.getMessage(),e); - logger.info("****swf转换器异常,读取转换文件失败****"); - throw e; - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } else { - logger.info("****已经转换为pdf,不需要再进行转化****"); - } - } else { - logger.info("****swf转换器异常,需要转换的文档不存在,无法转换****"); - } - } - - /** - * @Author yangxuenan - * @Description 转换成 swf - * Date 2018/8/24 13:51 - * @Param [fileType] - * @return void - **/ - /*private void pdf2swf(String fileType) throws Exception { - Runtime r = Runtime.getRuntime(); - if (!swfFile.exists()) { - if (pdfFile.exists()) { - // windows环境处理 - if (ENVIRONMENT == 1) { - try { - //使用swfTools工具将pdf文件转换为swf文件 - //String paperSwfFile = swfFile.getPath().replace(".swf","%.swf"); - Process p = r.exec("G:/swftTools/pdf2swf.exe "+ waterPdfPath + " -o "+ swfFile.getPath() + " -f -T 9 -t -s languagedir=G:/xpdf/xpdf-chinese-simplified"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - //如果源文件为doc类文件,将过渡的pdf文件删除 - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - if (pdfFile.exists()) { - if(!pdfFile.delete()){ - logger.error("文件删除失败!!!"); - } - } - } - } catch (IOException e) { - logger.error(e.getMessage(),e); - throw e; - } - } else if (ENVIRONMENT == 2) {// linux环境处理 - try { - Process p = r.exec("pdf2swf " + pdfFile.getPath() - + " -o " + swfFile.getPath() + " -f -T 9 -t -s storeallcharacters"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - if (pdfFile.exists()) { - if(!pdfFile.delete()){ - logger.error("文件删除失败!!!"); - } - } - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } - } else { - logger.info("****pdf不存在,无法转换****"); - } - } else { - logger.info("****swf已经存在不需要转换****"); - } - }*/ - - static String loadStream(InputStream in) throws IOException { - - int ptr = 0; - in = new BufferedInputStream(in); - StringBuilder buffer = new StringBuilder(); - - while ((ptr = in.read()) != -1) { - buffer.append((char) ptr); - } - - return buffer.toString(); - } - - /** - * @Author yangxuenan - * @Description 转换主方法 - * Date 2018/8/24 13:51 - * @Param [fileType] - * @return boolean - **/ - public boolean conver(String fileType) { - - if (swfFile.exists()) { - logger.info("****swf转换器开始工作,该文件已经转换为swf****"); - return true; - } - - if (ENVIRONMENT == 1) { - logger.info("****swf转换器开始工作,当前设置运行环境windows****"); - } else { - logger.info("****swf转换器开始工作,当前设置运行环境linux****"); - } - try { - //判断待转换文件类型,如果为doc文件需要先转为pdf类型文件 - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - doc2pdf(); -// pdf2swf(fileType); - } else if (".pdf".equals(fileType)){ -// pdf2swf(fileType); - } - - } catch (Exception e) { - logger.error(e.getMessage(),e); - return false; - } - - if (swfFile.exists()) { - return true; - } else { - return false; - } - } - - /** - * @Author yangxuenan - * @Description 返回文件路径 - * Date 2018/8/24 13:52 - * @Param [] - * @return java.lang.String - **/ - public String getswfPath() { - if (swfFile.exists()) { - //获取转换后的swf文件路径 - String tempString = swfFile.getPath(); - tempString = tempString.replaceAll("\\\\", "/"); - return tempString; - } else { - return ""; - } - - } - - /** - * @Author yangxuenan - * @Description 设置输出路径 - * Date 2018/8/24 13:52 - * @Param [outputPath] - * @return void - **/ - public void setOutputPath(String outputPath) { - this.outputPath = outputPath; - if (!outputPath.equals("")) { - String realName = fileName.substring(fileName.lastIndexOf("/"), - fileName.lastIndexOf(".")); - if (outputPath.charAt(outputPath.length()) == '/') { - swfFile = new File(outputPath + realName + ".swf"); - } - } - } - - -} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java index 69558ac4..697cf89e 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java @@ -1,36 +1,24 @@ package com.adc.da.convert.common; -import com.artofsolving.jodconverter.DocumentConverter; -import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; -import com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter; import org.apache.commons.lang.StringUtils; +import org.jodconverter.DocumentConverter; +import org.jodconverter.OfficeDocumentConverter; +import org.jodconverter.document.DefaultDocumentFormatRegistry; +import org.jodconverter.office.DefaultOfficeManagerBuilder; +import org.jodconverter.office.OfficeException; +import org.jodconverter.office.OfficeManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + import java.io.*; public class DocConverterPdf { private static final Logger logger = LoggerFactory.getLogger(DocConverterPdf.class); - /** - * 在所需的类里 添加下面配置 - * // 文档转换远程服务IP地址 - * @Value("${convert.host}") - * private String convertHost; - * - * - * fileString : 文件全路径 - * fileType : 文件后缀类型 - * 调用方法如下 - * DocConverterPdf d = new DocConverterPdf(fileString,fileType); - * d.setConvertHost(convertHost); - * //调用conver方法开始转换 - * File getPdf = d.conver(fileType); - * - * - */ + @Autowired + private DocumentConverter converter; private static final int ENVIRONMENT = 1;// 环境 1:windows 2:linux private String fileString;// (只涉及pdf2swf路径问题) @@ -40,6 +28,7 @@ public class DocConverterPdf { private File convertPdfFile; private File swfFile; private File docFile; + private String filesType; String waterPdfPath; private String convertHost; @@ -67,6 +56,7 @@ public class DocConverterPdf { fileName = fileString.substring(0, fileString.lastIndexOf(".")); if(".doc".equals(fileType.toLowerCase()) || ".docx".equals(fileType.toLowerCase()) || ".xlsx".equals(fileType.toLowerCase()) || ".xls".equals(fileType.toLowerCase()) || ".ppt".equals(fileType.toLowerCase()) || ".pptx".equals(fileType.toLowerCase())){ docFile = new File(fileString); + filesType = fileType.toLowerCase(); convertPdfFile=new File(fileName+"_C"+ ".pdf"); pdfFile = new File(fileName + ".pdf"); swfFile = new File(fileName + ".swf"); @@ -76,6 +66,38 @@ public class DocConverterPdf { } } + /** + * openOffice目录,window 可能在C://Program Files (x86)//OpenOffice 4 + */ + private static final String openOfficeHome = "E://Software//rtpro//Foton//File//openOffice//4"; + + /** + * openOffice端口 + */ + private static final int openOfficePort = 8100; + + /** + * 转化文档 + * @param input + * @param output + */ + public static void convertFile(File input , File output) throws OfficeException { + try { + DefaultOfficeManagerBuilder defaultOfficeManagerBuilder = new DefaultOfficeManagerBuilder(); + defaultOfficeManagerBuilder.setOfficeHome(openOfficeHome); + OfficeManager officeManager = defaultOfficeManagerBuilder.build(); + officeManager.start(); + + //转换,自动识别转化类型 + OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); + converter.convert(input, output); + + officeManager.stop(); + } catch (OfficeException e) { + throw e; + } + } + /** * 转为PDF * @@ -83,22 +105,16 @@ public class DocConverterPdf { */ private void doc2pdf() throws Exception { if (!pdfFile.exists()) { - OpenOfficeConnection connection = null; logger.info("转换服务地址接口:"+convertHost); + InputStream in = null; + OutputStream out = null; try { - if(StringUtils.isNotBlank(convertHost)){ - connection = new SocketOpenOfficeConnection(convertHost,8100); - }else{ - connection = new SocketOpenOfficeConnection(8100); - } - connection.connect(); - DocumentConverter converter = new StreamOpenOfficeDocumentConverter(connection); - converter.convert(docFile, convertPdfFile); - - //addWaterToPdf(pdfFile,userId); - +// in = new FileInputStream(docFile); +// out = new FileOutputStream(convertPdfFile); + convertFile(docFile,convertPdfFile); +// converter.convert(in).as(DefaultDocumentFormatRegistry.getFormatByMediaType(filesType)). +// to(out).as(DefaultDocumentFormatRegistry.PDF); // close the connection - connection.disconnect(); // 开始设置PDF文档相关属性保证其安全性 logger.info("开始设置转换后的PDF文件安全性相关设置"); PDFEditUtils.setPDFFileSecurity(pdfFile.getAbsolutePath(),convertPdfFile.getAbsolutePath()); @@ -107,10 +123,6 @@ public class DocConverterPdf { logger.error(e.getMessage(),e); logger.info("****pdf转换器异常,openoffice服务未启动!****"); throw e; - } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) { - logger.error(e.getMessage(),e); - logger.info("****pdf转换器异常,读取转换文件失败****"); - throw e; } catch (Exception e) { logger.error(e.getMessage(),e); throw e; diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdfOld.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdfOld.java deleted file mode 100644 index d9887b21..00000000 --- a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdfOld.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.adc.da.convert.common; - -import com.artofsolving.jodconverter.DocumentConverter; -import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -public class DocConverterPdfOld { - - private static final Logger logger = LoggerFactory.getLogger(DocConverterPdf.class); - - private static final int ENVIRONMENT = 1;// 环境 1:windows 2:linux - private String fileString;// (只涉及pdf2swf路径问题) - private String outputPath = "";// 输入路径 ,如果不设置就输出在默认的位置 - private String fileName; - private File pdfFile; - private File convertPdfFile; - private File swfFile; - private File docFile; - String waterPdfPath; - - public DocConverterPdfOld(String fileString, String fileType) { - ini(fileString,fileType); - } - - /** - * 重新设置file - * - * @param fileString - */ - public void setFile(String fileString,String fileType) { - ini(fileString,fileType); - } - - /** - * 初始化 - * - * @param fileString - */ - private void ini(String fileString,String fileType) { - this.fileString = fileString; - fileName = fileString.substring(0, fileString.lastIndexOf(".")); - if(".doc".equals(fileType) || ".docx".equals(fileType) || ".xlsx".equals(fileType) || ".xls".equals(fileType) || ".ppt".equals(fileType) || ".pptx".equals(fileType)){ - docFile = new File(fileString); - convertPdfFile=new File(fileName+"_C"+ ".pdf"); - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } else if (".pdf".equals(fileType)){ - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } - } - - /** - * 转为PDF - * - * @param - */ - private void doc2pdf() throws Exception { - if (!pdfFile.exists()) { - OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); - try { - connection.connect(); - DocumentConverter converter = new OpenOfficeDocumentConverter(connection); - converter.convert(docFile, convertPdfFile); - - //addWaterToPdf(pdfFile,userId); - - // close the connection - connection.disconnect(); - // 开始设置PDF文档相关属性保证其安全性 - logger.info("开始设置转换后的PDF文件安全性相关设置"); - logger.info("****pdf转换成功,PDF输出:" + pdfFile.getPath()+ "****"); - } catch (java.net.ConnectException e) { - logger.error(e.getMessage(),e); - logger.info("****pdf转换器异常,openoffice服务未启动!****"); - throw e; - } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) { - logger.error(e.getMessage(),e); - logger.info("****pdf转换器异常,读取转换文件失败****"); - throw e; - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } else { - logger.info("****已经转换为pdf,不需要再进行转化****"); - } - } - - /** - * 转换成 swf - */ - @SuppressWarnings("unused") - /*private void pdf2swf(String fileType) throws Exception { - Runtime r = Runtime.getRuntime(); - if (!swfFile.exists()) { - if (pdfFile.exists()) { - if (ENVIRONMENT == 1) {// windows环境处理 - try { - //String paperSwfFile = swfFile.getPath().replace(".swf","%.swf"); - Process p = r.exec("G:/swftTools/pdf2swf.exe "+ waterPdfPath + " -o "+ swfFile.getPath() + " -f -T 9 -t -s languagedir=G:/xpdf/xpdf-chinese-simplified"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - *//*if (pdfFile.exists()) { - pdfFile.delete(); - }*//* - } - } catch (IOException e) { - logger.error(e.getMessage(),e); - throw e; - } - } else if (ENVIRONMENT == 2) {// linux环境处理 - try { - Process p = r.exec("pdf2swf " + pdfFile.getPath() - + " -o " + swfFile.getPath() + " -f -T 9 -t -s storeallcharacters"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - if (pdfFile.exists()) { - if(!pdfFile.delete()){ - logger.error("文件删除失败!!!"); - } - } - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } - } else { - logger.info("****pdf不存在,无法转换****"); - } - } else { - logger.info("****swf已经存在不需要转换****"); - } - }*/ - - static String loadStream(InputStream in) throws IOException { - - int ptr = 0; - in = new BufferedInputStream(in); - StringBuilder buffer = new StringBuilder(); - while ((ptr = in.read()) != -1) { - buffer.append((char) ptr); - } - - return buffer.toString(); - } - /** - * 转换主方法 - */ - @SuppressWarnings("unused") - public File conver(String fileType) { - if (ENVIRONMENT == 1) { - logger.info("****swf转换器开始工作,当前设置运行环境windows****"); - } else { - logger.info("****swf转换器开始工作,当前设置运行环境linux****"); - } - try { - if(".doc".equals(fileType) || ".docx".equals(fileType) || ".xlsx".equals(fileType) || ".xls".equals(fileType) || ".ppt".equals(fileType) || ".pptx".equals(fileType)){ - doc2pdf(); - /*pdf2swf(fileType);*/ - } else if (".pdf".equals(fileType)){ - /*pdf2swf(fileType);*/ - } - - } catch (Exception e) { - logger.error(e.getMessage(),e); - return new File(""); - } - - return pdfFile; - - } - - /** - * 返回文件路径 - * - * @param - */ - public String getswfPath() { - if (swfFile.exists()) { - String tempString = swfFile.getPath(); - tempString = tempString.replaceAll("\\\\", "/"); - return tempString; - } else { - return ""; - } - - } - - public String getpdfPath() { - if (!pdfFile.getPath().isEmpty()) { - String tempString = pdfFile.getPath(); - tempString = tempString.replaceAll("\\\\", "/"); - return tempString; - } else { - return ""; - } - - } - - /** - * 设置输出路径 - */ - public void setOutputPath(String outputPath) { - this.outputPath = outputPath; - if (!outputPath.equals("")) { - String realName = fileName.substring(fileName.lastIndexOf("/"), fileName.lastIndexOf(".")); - //TODO 此处的if判断执行的代码逻辑完全一样, 因此将其判断注释掉,直接执行 -/* if (outputPath.charAt(outputPath.length()) == '/') { - swfFile = new File(outputPath + realName + ".swf"); - } else { - swfFile = new File(outputPath + realName + ".swf"); - }*/ - swfFile = new File(outputPath + realName + ".swf"); - } - } - -} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java index 810f4fd3..6a576e23 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java @@ -2,13 +2,12 @@ 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.mq.CreateMQService; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; +import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao; import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao; @@ -84,7 +83,6 @@ public class SendConvertMQService { }finally { Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG); channel.basicAck(tag,false); - logger.debug("文档转换消息确认成功!!!!!!!!!"); } } @@ -236,7 +234,7 @@ public class SendConvertMQService { } public ResponseMessage restartUploadConvert(OtConvertMq convertInfo) throws Exception{ - ConvertMqEO convertMqEO = new ConvertMqEO(); + OtConvertMq convertMqEO = new com.adc.da.slrs.otConvertMq.entity.OtConvertMq(); convertMqEO.setLawsId(convertInfo.getLawsId()); convertMqEO.setConvertType(convertInfo.getConvertType()); convertMqEO.setAttId(convertInfo.getAttId()); @@ -271,7 +269,7 @@ public class SendConvertMQService { lawsFile.setOriAttId(convertMq.getOriAttId()); lawsFile.setModifyTime(new Date()); lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue()); - countSuccess = sarStandFileEODao.updateById(lawsFile); + countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile); } else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) { // SarLawsFile lawsFile = new SarLawsFile(); // lawsFile.setId(convertMq.getPdfId()); @@ -287,7 +285,7 @@ public class SendConvertMQService { lawsFile.setOriAttId(convertMq.getOriAttId()); lawsFile.setUseModule(UseModuleEnum.WEB_FILE.getValue()); lawsFile.setModifyTime(new Date()); - countSuccess = sarBussStandFileEODao.updateById(lawsFile); + countSuccess = sarBussStandFileEODao.updateByPrimaryKeySelective(lawsFile); }else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) { // SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO(); // lawsFile.setId(convertMq.getPdfId()); @@ -337,7 +335,7 @@ public class SendConvertMQService { lawsFile.setStandFileClassify(convertMq.getStandFileClassify()); lawsFile.setFileName(fileOriName+".pdf"); lawsFile.setFileSuffix("pdf"); - countSuccess = sarStandFileEODao.insert(lawsFile); + countSuccess = sarStandFileEODao.insertSelective(lawsFile); } else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) { // SarLawsFile lawsFile = new SarLawsFile(); // lawsFile.setId(UUID.randomUUID(20)); @@ -367,7 +365,7 @@ public class SendConvertMQService { lawsFile.setValidFlag(0); lawsFile.setCreationTime(new Date()); lawsFile.setModifyTime(new Date()); - countSuccess = sarBussStandFileEODao.insert(lawsFile); + countSuccess = sarBussStandFileEODao.insertSelective(lawsFile); } else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) { // SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO(); diff --git a/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml b/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml deleted file mode 100644 index 480951b6..00000000 --- a/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/adc-da-main/src/main/resources/application-dev.properties b/adc-da-main/src/main/resources/application-dev.properties index c9a24e7a..4665a006 100644 --- a/adc-da-main/src/main/resources/application-dev.properties +++ b/adc-da-main/src/main/resources/application-dev.properties @@ -48,6 +48,14 @@ spring.rabbitmq.host=62.234.118.181 spring.rabbitmq.port=5672 spring.rabbitmq.username=admin spring.rabbitmq.password=admin +spring.rabbitmq.listener.simple.acknowledge-mode= manual +#消费失败消息干掉 +spring.rabbitmq.listener.simple.default-requeue-rejected= true +#5秒 +spring.rabbitmq.listener.simple.retry.initial-interval= 5000 +spring.rabbitmq.listener.simple.retry.enabled= true +#最大重试5次 +spring.rabbitmq.listener.simple.retry.max-attempts= 5 # ============================================== # 文档存储路径指向 # ============================================== diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateMQService.java similarity index 92% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/CreateMQService.java index c11456a1..d913c62e 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateMQService.java @@ -1,7 +1,7 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; -import com.adc.da.common.ConvertMqEO; -import com.adc.da.mq.dao.OtConvertEODao; +import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.adc.da.util.UUIDUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.amqp.core.AmqpTemplate; @@ -18,7 +18,7 @@ public class CreateMQService { private AmqpTemplate rabbitTemplate; @Autowired - private OtConvertEODao otConvertEODao; + private OtConvertMqDao otConvertEODao; /** * @Author yangxuenan * @Description 创建消息队列 @@ -26,7 +26,7 @@ public class CreateMQService { * @Param [convert, convertType] * @return int **/ - public void sendMQ(ConvertMqEO convert) throws Exception{ + public void sendMQ(OtConvertMq convert) throws Exception{ String otId = UUIDUtils.randomUUID20(); //向OT_CONVERT_EO表中添加/修改数据 //判断用户是初次发送还是重新发送,初次将添加到数据库,重新发送将修改原数据信息 diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateStandMQService.java similarity index 98% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/CreateStandMQService.java index b3271e42..d4592457 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateStandMQService.java @@ -1,4 +1,4 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo; diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/SendBussMQService.java similarity index 99% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/SendBussMQService.java index 36afcafe..32692c49 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/SendBussMQService.java @@ -1,6 +1,5 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; -import com.adc.da.search.entity.StandLawsEO; import com.adc.da.slrs.otSvpps.service.IOtSvppsService; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendStandMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/SendStandMQService.java similarity index 99% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/SendStandMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/SendStandMQService.java index 7c20c0bc..c713507b 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendStandMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/SendStandMQService.java @@ -1,6 +1,5 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; -import com.adc.da.slrs.otSvpps.entity.OtSvpps; import com.adc.da.slrs.otSvpps.service.IOtSvppsService; import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo; import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/dao/OtConvertEODao.java b/adc-da-slrs/src/main/java/com/adc/da/mq/dao/OtConvertEODao.java deleted file mode 100644 index 502fcb5c..00000000 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/dao/OtConvertEODao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.adc.da.mq.dao; - -import com.adc.da.common.ConvertMqEO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -@Repository -public interface OtConvertEODao extends BaseMapper { - - int deleteByAttId(String value); - -} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/controller/OtConvertMqController.java similarity index 76% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/controller/OtConvertMqController.java index 4d6a5473..80de0998 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/controller/OtConvertMqController.java @@ -1,11 +1,11 @@ -package com.adc.da.convert.otConvertMq.controller; +package com.adc.da.slrs.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; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** *

@@ -16,7 +16,7 @@ import com.adc.da.base.web.BaseController; * @since 2021-08-20 */ @RestController -@Api(description = "|OtConvertMq|") +@Api(tags = "|OtConvertMq|") @RequestMapping("/otConvertMq/ot-convert-mq") public class OtConvertMqController extends BaseController { diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/dao/OtConvertMqDao.java similarity index 55% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/dao/OtConvertMqDao.java index 51d2338c..f976f3ae 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/dao/OtConvertMqDao.java @@ -1,7 +1,8 @@ -package com.adc.da.convert.otConvertMq.dao; +package com.adc.da.slrs.otConvertMq.dao; -import com.adc.da.convert.otConvertMq.entity.OtConvertMq; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; /** *

@@ -11,6 +12,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @author super_liu * @since 2021-08-20 */ +@Repository public interface OtConvertMqDao extends BaseMapper { + int deleteByAttId(String value); + } diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/entity/OtConvertMq.java similarity index 96% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/entity/OtConvertMq.java index 98d3b953..29043ef4 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/entity/OtConvertMq.java @@ -1,11 +1,8 @@ -package com.adc.da.convert.otConvertMq.entity; +package com.adc.da.slrs.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.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -14,6 +11,8 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; + /** *

* 文档转换记录信息表 @@ -95,5 +94,7 @@ public class OtConvertMq extends BaseEntity { private String oriAttId; @TableField(exist = false) private int againNum; + @TableField(exist = false) + private String fileSuffix; } diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/IOtConvertMqService.java similarity index 69% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/IOtConvertMqService.java index 52c0d7c9..9a9f8c0a 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/IOtConvertMqService.java @@ -1,6 +1,6 @@ -package com.adc.da.convert.otConvertMq.service; +package com.adc.da.slrs.otConvertMq.service; -import com.adc.da.convert.otConvertMq.entity.OtConvertMq; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.baomidou.mybatisplus.extension.service.IService; /** diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/impl/OtConvertMqServiceImpl.java similarity index 60% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/impl/OtConvertMqServiceImpl.java index 41d28dcb..44f6cad1 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/impl/OtConvertMqServiceImpl.java @@ -1,8 +1,8 @@ -package com.adc.da.convert.otConvertMq.service.impl; +package com.adc.da.slrs.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.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; +import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java index 2cf846c3..fb811286 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java @@ -1,12 +1,28 @@ package com.adc.da.slrs.sarBussStandFile.controller; +import com.adc.da.att.entity.AttFileEO; +import com.adc.da.att.service.IAttFileEOService; +import com.adc.da.http.ResponseMessage; +import com.adc.da.http.Result; +import com.adc.da.slrs.sarBussStandFile.service.ISarBussStandFileService; +import com.adc.da.slrs.standardSplit.controller.SarStandFileEOController; +import com.adc.da.slrs.standardSplit.service.SarStandAttrDetailsEOService; +import com.adc.da.slrs.standardSplit.service.SarStandFileEOService; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.slrs.sarBussStandFile.entity.SarBussStandFile; import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.RestController; import com.adc.da.base.web.BaseController; +import java.util.List; + + /** *

* 企业标准文件详情表 前端控制器 @@ -16,8 +32,39 @@ import com.adc.da.base.web.BaseController; * @since 2021-07-25 */ @RestController -@Api(description = "|SarBussStandFile|") -@RequestMapping("/sarBussStandFile/sar-buss-stand-file") +@Api(tags = "|SarBussStandFile|") +@RequestMapping("/${restPath}/lawss/sarBussStandFile") public class SarBussStandFileController extends BaseController { + private static final Logger logger = LoggerFactory.getLogger(SarStandFileEOController.class); + + @Autowired + private IAttFileEOService attFileEOService; + @Autowired + private SarStandAttrDetailsEOService sarStandAttrDetailsEOService; + + public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8"; + + @Autowired + private ISarBussStandFileService sarBussStandFileEOService; + + @ApiOperation(value = "|SarBussStandFileEO|查询转换后的文档详情") + @GetMapping("/queryConvertAtt") + /*@RequiresPermissions("lawss:sarLawsFile:list")*/ + public ResponseMessage queryConvertAtt(String attId) throws Exception { + List getList = sarBussStandFileEOService.selectFileByAttId(attId); + SarBussStandFile sarBussStandFileEO = new SarBussStandFile(); + if(getList != null && !getList.isEmpty()){ + sarBussStandFileEO = getList.get(0); + AttFileEO attFileEO = attFileEOService.getFileInfo(attId); + if(attFileEO != null){ + sarBussStandFileEO.setFileOldName(attFileEO.getOldFileName()); + } +// readStandOrLawsLogService.sendReadSOLLog("BUSS",sarBussStandFileEO); + return Result.success(sarBussStandFileEO); + } else { + return Result.success(null); + } + + } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/dao/SarBussStandFileDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/dao/SarBussStandFileDao.java index 23b127bc..f6a592ea 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/dao/SarBussStandFileDao.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/dao/SarBussStandFileDao.java @@ -30,4 +30,8 @@ public interface SarBussStandFileDao extends BaseMapper { int deleteByStandId(String standId); int insertForeach(List list); //批量新增 + + int insertSelective(SarBussStandFile sarBussStandFile); + + int updateByPrimaryKeySelective(SarBussStandFile sarBussStandFile); } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java index dfd0482c..ed6da497 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java @@ -3,6 +3,8 @@ package com.adc.da.slrs.sarBussStandFile.service; import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** *

* 企业标准文件详情表 服务类 @@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface ISarBussStandFileService extends IService { + List selectFileByAttId(String attId) throws Exception; + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java index acc8b11b..d95024f3 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java @@ -4,8 +4,11 @@ import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao; import com.adc.da.slrs.sarBussStandFile.service.ISarBussStandFileService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* 企业标准文件详情表 服务实现类 @@ -17,4 +20,11 @@ import org.springframework.stereotype.Service; @Service public class SarBussStandFileServiceImpl extends ServiceImpl implements ISarBussStandFileService { + @Autowired + private SarBussStandFileDao sarStandFileEODao; + + @Override + public List selectFileByAttId(String attId) throws Exception{ + return sarStandFileEODao.selectFileByAttId(attId); + } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java index 9754981c..2a65a976 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java @@ -6,15 +6,13 @@ import com.adc.da.common.ConvertMqEO; import com.adc.da.common.SarTypeEnum; import com.adc.da.common.SelectionTypeEnum; import com.adc.da.common.UseModuleEnum; -import com.adc.da.http.Result; -import com.adc.da.mq.dao.OtConvertEODao; -import com.adc.da.mq.service.CreateMQService; -import com.adc.da.mq.service.CreateStandMQService; -import com.adc.da.person.entity.PersonShareEO; +import com.adc.da.mq.CreateMQService; +import com.adc.da.mq.CreateStandMQService; import com.adc.da.person.entity.TsPersonCollect; import com.adc.da.person.page.PersonCollectEOPage; -import com.adc.da.person.page.PersonShareEOPage; import com.adc.da.person.service.IPersonCollectEOService; +import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao; import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; @@ -22,18 +20,14 @@ import com.adc.da.slrs.sarBussStandMenu.dao.SarBussStandMenuDao; import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu; import com.adc.da.slrs.sarBussStandVal.dao.SarBussStandValDao; import com.adc.da.slrs.sarBussStandVal.entity.SarBussStandVal; -import com.adc.da.slrs.sarBussionessStand.entity.SarBussStandMenuEO; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao; import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService; import com.adc.da.slrs.sarResource.entity.TsResource; import com.adc.da.slrs.sarResource.service.ITsResourceService; import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao; -import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao; import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; -import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo; -import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage; import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService; import com.adc.da.slrs.sarUser.service.ITsUserService; import com.adc.da.slrs.sysInfo.service.SysInfoEOService; @@ -106,7 +100,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl { int insertForeach(List list); //批量新增 + int insertSelective(SarStandFile sarStandFile); + + int updateByPrimaryKeySelective(SarStandFile sarStandFile); + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java index 49c3059f..45a89d18 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java @@ -86,20 +86,28 @@ public class SarStandFile extends BaseEntity { private String oriAttId; @Transient + @TableField(exist = false) private String resId; @Transient + @TableField(exist = false) private Integer pageCount; @Transient + @TableField(exist = false) private String fileOldName; @Transient - private List idlist = new ArrayList<>(); + @TableField(exist = false) + private List idList = new ArrayList<>(); @Transient + @TableField(exist = false) private String standFileClassifyShow; @Transient + @TableField(exist = false) private String standNumber; @Transient + @TableField(exist = false) private String standName; @Transient + @TableField(exist = false) private String sarType; diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java index 0b3baafc..e233314c 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java @@ -6,11 +6,14 @@ import com.adc.da.att.vo.AttFileVo; import com.adc.da.common.*; import com.adc.da.http.ResponseMessage; import com.adc.da.http.Result; -import com.adc.da.mq.service.CreateStandMQService; +import com.adc.da.mq.CreateMQService; +import com.adc.da.mq.CreateStandMQService; import com.adc.da.person.dao.PersonCollectEODao; import com.adc.da.person.dao.PersonShareEODao; import com.adc.da.person.service.IPersonCollectEOService; import com.adc.da.search.service.StandLawsSearchService; +import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo; import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage; import com.adc.da.slrs.sarLawsInfo.page.SarLawsItemsEOPage; @@ -29,7 +32,6 @@ import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao; import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao; import com.adc.da.slrs.sarStandItems.entity.FindSarItemsPageReqDTO; -import com.adc.da.slrs.sarStandItems.entity.SarItemVO; import com.adc.da.slrs.sarStandItems.entity.SarStandItems; import com.adc.da.slrs.sarStandItems.page.SarStandItemsEOPage; import com.adc.da.slrs.sarStandItems.service.ISarStandItemsService; @@ -74,24 +76,15 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; import java.io.File; import java.io.FileInputStream; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; import java.sql.Clob; import java.text.SimpleDateFormat; import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -182,6 +175,12 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl listFile = sarStandFileEODao.selectFileByStandIdAndId(sarStandFileEO); -// if (listFile != null) { -// if (!listFile.isEmpty()) { -// for (int f = 0; f < listFile.size(); f++) { -// //删除文件信息表数据 + if (listFile != null) { + if (!listFile.isEmpty()) { + for (int f = 0; f < listFile.size(); f++) { + //删除文件信息表数据 // sarFileInfoEODao.deleteByfileId(listFile.get(f).getId()); -// //删除转换表ot_convert数据 -// otConvertEODao.deleteByAttId(listFile.get(f).getAttId()); -// } -// } -// } + //删除转换表ot_convert数据 + otConvertEODao.deleteByAttId(listFile.get(f).getAttId()); + } + } + } sarStandPutTimeEODao.deleteByStandId(standId); // 修改属性表数据 sarStandAttrInfoEODao.deleteStandAttrByStandId(standId); diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml new file mode 100644 index 00000000..687401d3 --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + modify_time, creation_time, valid_flag, att_id, file_path, user_id, mq_state, mq_code, id + + + + + where 1=1 + + + and modify_time ${modifyTimeOperator} #{modifyTime} + + + and modify_time >= #{modifyTime1} + + + and modify_time <= #{modifyTime2} + + + and creation_time ${creationTimeOperator} #{creationTime} + + + and creation_time >= #{creationTime1} + + + and creation_time <= #{creationTime2} + + + and valid_flag ${validFlagOperator} #{validFlag} + + + and att_id ${attIdOperator} #{attId} + + + and file_path ${filePathOperator} #{filePath} + + + and user_id ${userIdOperator} #{userId} + + + and mq_state ${mqStateOperator} #{mqState} + + + and mq_code ${mqCodeOperator} #{mqCode} + + + and id ${idOperator} #{id} + + + + + + + + insert into OT_CONVERT_MQ() + values (#{modifyTime, jdbcType=TIMESTAMP}, #{creationTime, jdbcType=TIMESTAMP}, #{validFlag, jdbcType=INTEGER}, #{attId, jdbcType=VARCHAR}, #{filePath, jdbcType=VARCHAR}, #{userId, jdbcType=VARCHAR}, #{mqState, jdbcType=INTEGER}, #{mqCode, jdbcType=VARCHAR}, #{id, jdbcType=VARCHAR}) + + + + + + insert into OT_CONVERT_MQ + + modify_time, + creation_time, + valid_flag, + att_id, + file_path, + user_id, + mq_state, + mq_code, + id, + + + #{modifyTime, jdbcType=TIMESTAMP}, + #{creationTime, jdbcType=TIMESTAMP}, + #{validFlag, jdbcType=INTEGER}, + #{attId, jdbcType=VARCHAR}, + #{filePath, jdbcType=VARCHAR}, + #{userId, jdbcType=VARCHAR}, + #{mqState, jdbcType=INTEGER}, + #{mqCode, jdbcType=VARCHAR}, + #{id, jdbcType=VARCHAR}, + + + + + + update OT_CONVERT_MQ + set modify_time = #{modifyTime}, + creation_time = #{creationTime}, + valid_flag = #{validFlag}, + att_id = #{attId}, + file_path = #{filePath}, + user_id = #{userId}, + mq_state = #{mqState}, + mq_code = #{mqCode} + where id = #{id} + + + + + update OT_CONVERT_MQ + + + modify_time = #{modifyTime}, + + + creation_time = #{creationTime}, + + + valid_flag = #{validFlag}, + + + att_id = #{attId}, + + + file_path = #{filePath}, + + + user_id = #{userId}, + + + mq_state = #{mqState}, + + + mq_code = #{mqCode}, + + + where id = #{id} + + + + + + + delete from OT_CONVERT_MQ + where att_id = #{value} + + + diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml index d0c68d5c..fe7091e7 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml @@ -228,9 +228,9 @@ and stand_id = #{standId} - + and id not in - + #{item}