电子回单附件关系表的值取附件表的值

This commit is contained in:
hecan 2025-05-09 14:01:14 +08:00
parent f2b6c1fc5e
commit 3150b7364e
1 changed files with 47 additions and 32 deletions

View File

@ -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.dao.impl.MdmModuleSourceDaoImpl;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao; 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.CtpAttachmentEntity;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import com.hzya.frame.seeyon.util.OARestUtil; import com.hzya.frame.seeyon.util.OARestUtil;
import com.hzya.frame.seeyon.util.SM2Util; import com.hzya.frame.seeyon.util.SM2Util;
import com.hzya.frame.seeyon.zxbank.dao.IZxBankDao; import com.hzya.frame.seeyon.zxbank.dao.IZxBankDao;
@ -72,6 +74,9 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
@Value("${zx.publicKey:}") @Value("${zx.publicKey:}")
private String publicKey; private String publicKey;
@Autowired
private ICtpFileDao ctpFileDao;
@Override @Override
public JsonResultEntity queryArchives(JSONObject json) { public JsonResultEntity queryArchives(JSONObject json) {
JSONObject jsonObject = json.getJSONObject("jsonStr"); JSONObject jsonObject = json.getJSONObject("jsonStr");
@ -364,41 +369,51 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
zxBankEntity.setReceipt(sub_reference); zxBankEntity.setReceipt(sub_reference);
zxBankEntity.setDataSourceCode("HT-OA"); zxBankEntity.setDataSourceCode("HT-OA");
zxBankDao.updateElecStatusZX(zxBankEntity); zxBankDao.updateElecStatusZX(zxBankEntity);
//根据附件id查询附件业务数据 //根据附件id查询附件信息
String file_url = jsonObject.getString("fileUrl"); CtpFileEntity ctpFileEntity=new CtpFileEntity();
CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); ctpFileEntity.setId(jsonObject.getString("fileUrl"));
ctpAttachmentEntity.setFile_url(file_url); ctpFileEntity.setDataSourceCode("HT-OA");
String att_reference = zxBankEntity.getSummaryId();//Summary_id List<CtpFileEntity> query = ctpFileDao.queryCtpFileById(ctpFileEntity);
ctpAttachmentEntity.setSub_reference(sub_reference); if(CollectionUtils.isNotEmpty(query)) {
ctpAttachmentEntity.setAtt_reference(att_reference); CtpFileEntity ctpFile = query.get(0);
ctpAttachmentEntity.setDataSourceCode("HT-OA"); //根据附件id查询附件业务数据
List<CtpAttachmentEntity> ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity); String file_url = jsonObject.getString("fileUrl");
//如果没有查询到数据就新增附件业务否则更新 CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity();
if (ctpAttachmentEntities.size() == 0) { ctpAttachmentEntity.setFile_url(file_url);
String category = jsonObject.getString("category"); String att_reference = zxBankEntity.getSummaryId();//Summary_id
String type = jsonObject.getString("type"); ctpAttachmentEntity.setSub_reference(sub_reference);
String filename = jsonObject.getString("filename"); ctpAttachmentEntity.setAtt_reference(att_reference);
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());
ctpAttachmentEntity.setDataSourceCode("HT-OA"); ctpAttachmentEntity.setDataSourceCode("HT-OA");
ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity); List<CtpAttachmentEntity> ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity);
} else { //如果没有查询到数据就新增附件业务否则更新
if (ctpAttachmentEntities.size() > 1) { if (ctpAttachmentEntities.size() == 0) {
throw new BaseSystemException("OA附件业务表中查到多条记录"); 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附件业务表中 logger.info("=====电子回单执行完毕=======");
ctpAttachmentDao.updateCtpAttachment(ctpAttachmentEntity); }else{
logger.info("========根据附件id:{}没有查询到附件信息======",jsonObject.getString("fileUrl"));
} }
logger.info("=====电子回单执行完毕=======");
} }
pdfFile.delete(); pdfFile.delete();
} }