diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/zxbank/service/impl/ZxBankServiceImpl.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/zxbank/service/impl/ZxBankServiceImpl.java index 20d0b981..fb7872d9 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/zxbank/service/impl/ZxBankServiceImpl.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/zxbank/service/impl/ZxBankServiceImpl.java @@ -11,7 +11,9 @@ import com.hzya.frame.basedao.service.impl.BaseService; import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl; import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; import com.hzya.frame.seeyon.dao.ICtpAttachmentDao; +import com.hzya.frame.seeyon.dao.ICtpFileDao; import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; +import com.hzya.frame.seeyon.entity.CtpFileEntity; import com.hzya.frame.seeyon.util.OARestUtil; import com.hzya.frame.seeyon.util.SM2Util; import com.hzya.frame.seeyon.zxbank.dao.IZxBankDao; @@ -72,6 +74,9 @@ public class ZxBankServiceImpl extends BaseService impleme @Value("${zx.publicKey:}") private String publicKey; + + @Autowired + private ICtpFileDao ctpFileDao; @Override public JsonResultEntity queryArchives(JSONObject json) { JSONObject jsonObject = json.getJSONObject("jsonStr"); @@ -364,41 +369,51 @@ public class ZxBankServiceImpl extends BaseService impleme zxBankEntity.setReceipt(sub_reference); zxBankEntity.setDataSourceCode("HT-OA"); zxBankDao.updateElecStatusZX(zxBankEntity); - //根据附件id查询附件业务数据 - String file_url = jsonObject.getString("fileUrl"); - CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); - ctpAttachmentEntity.setFile_url(file_url); - String att_reference = zxBankEntity.getSummaryId();//Summary_id - ctpAttachmentEntity.setSub_reference(sub_reference); - ctpAttachmentEntity.setAtt_reference(att_reference); - ctpAttachmentEntity.setDataSourceCode("HT-OA"); - List ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity); - //如果没有查询到数据,就新增附件业务,否则更新 - if (ctpAttachmentEntities.size() == 0) { - String category = jsonObject.getString("category"); - String type = jsonObject.getString("type"); - String filename = jsonObject.getString("filename"); - String mime_type = jsonObject.getString("mimeType"); - String attachment_size = jsonObject.getString("size"); - String id = String.valueOf(UUIDLong.longUUID()); - ctpAttachmentEntity.setCategory(category); - ctpAttachmentEntity.setFilename(filename); - ctpAttachmentEntity.setType(type); - ctpAttachmentEntity.setMime_type(mime_type); - ctpAttachmentEntity.setAttachment_size(attachment_size); - ctpAttachmentEntity.setId(id); - ctpAttachmentEntity.setCategory("66"); - ctpAttachmentEntity.setCreatedate(new Date()); + //根据附件id查询附件信息 + CtpFileEntity ctpFileEntity=new CtpFileEntity(); + ctpFileEntity.setId(jsonObject.getString("fileUrl")); + ctpFileEntity.setDataSourceCode("HT-OA"); + List query = ctpFileDao.queryCtpFileById(ctpFileEntity); + if(CollectionUtils.isNotEmpty(query)) { + CtpFileEntity ctpFile = query.get(0); + //根据附件id查询附件业务数据 + String file_url = jsonObject.getString("fileUrl"); + CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); + ctpAttachmentEntity.setFile_url(file_url); + String att_reference = zxBankEntity.getSummaryId();//Summary_id + ctpAttachmentEntity.setSub_reference(sub_reference); + ctpAttachmentEntity.setAtt_reference(att_reference); ctpAttachmentEntity.setDataSourceCode("HT-OA"); - ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity); - } else { - if (ctpAttachmentEntities.size() > 1) { - throw new BaseSystemException("OA附件业务表中查到多条记录"); + List ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity); + //如果没有查询到数据,就新增附件业务,否则更新 + if (ctpAttachmentEntities.size() == 0) { + String category =ctpFile.getCategory(); + String type =ctpFile.getType(); + String filename =ctpFile.getFilename(); + String mime_type =ctpFile.getMime_type(); + String attachment_size =ctpFile.getFile_size(); + String id = String.valueOf(UUIDLong.longUUID()); + ctpAttachmentEntity.setCategory(category); + ctpAttachmentEntity.setFilename(filename); + ctpAttachmentEntity.setType(type); + ctpAttachmentEntity.setMime_type(mime_type); + ctpAttachmentEntity.setAttachment_size(attachment_size); + ctpAttachmentEntity.setId(id); + ctpAttachmentEntity.setCategory("66"); + ctpAttachmentEntity.setCreatedate(new Date()); + ctpAttachmentEntity.setDataSourceCode("HT-OA"); + ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity); + } else { + if (ctpAttachmentEntities.size() > 1) { + throw new BaseSystemException("OA附件业务表中查到多条记录"); + } + //更新数据到OA附件业务表中 + ctpAttachmentDao.updateCtpAttachment(ctpAttachmentEntity); } - //更新数据到OA附件业务表中 - ctpAttachmentDao.updateCtpAttachment(ctpAttachmentEntity); + logger.info("=====电子回单执行完毕======="); + }else{ + logger.info("========根据附件id:{}没有查询到附件信息======",jsonObject.getString("fileUrl")); } - logger.info("=====电子回单执行完毕======="); } pdfFile.delete(); }