s-HR8.5及以上版本附件的上传逻辑
目的:通过介绍此逻辑,方便二开进行附件的上传进行扩展
s-HR8.5及以上版本对附件上传逻辑进行了改进,对新增和修改单据,做了不同的附件支持,同时对bos的附件做了扩展
其核心的逻辑图和方法入口如下:
附件上传入口:com.kingdee.shr.base.syssetting.web.controller.AttachmentUploadController#uploadAttachment
附件保存后修改入口:com.kingdee.shr.base.syssetting.web.handler.EditHandler#saveAction,saveAction会调用
com.kingdee.shr.base.syssetting.web.handler.CoreHandler#saveAttachment,saveAttachment会调用
com.kingdee.shr.attachment.app.SHRAttachmentExtControllerBean._updateAffterSaveForm
新增单据上传附件通过s-HR附件扩展表的状态来区分是否要进行处理,如果状态是UNSAVE表示新增上传,需要维护附件扩展标的fboid,同时BOS附件的BoAttchAsso需要维护,并和附件进行fboid进行关联起来;修改上传s-HR附件扩展表状态为SAVE,此种状态无需处理
如果二开单据handler有重写saveAction,那么saveAction中需要调用com.kingdee.shr.base.syssetting.web.handler.CoreHandler#saveAttachment,否则涉及新增上传附件时候,附件就会丢失
附件下载入口:com.kingdee.shr.base.syssetting.web.controller.AttachmentUploadController#downloadAction
附件涉及的表如下:
s-HR的附件扩展表:T_HR_SHRAttachmentExt
BOS的附件表:T_BAS_Attachment,T_BAS_BoAttchAsso
常用查询如下:
select t0.*,t1.* from T_BAS_Attachment t0 inner join T_BAS_BoAttchAsso t1 on t0.fid = t1.fattachmentid where t1.FBOID = 'xxxx'; --s-HR 附件扩展表 SELECT * FROM T_HR_SHRAttachmentExt; --按boid查询 SELECT T0.* FROM T_BAS_Attachment T0 inner join T_BAS_BoAttchAsso T1 on T0.FID = T1.FATTACHMENTID where T1.FBOID = 'xxxx'; SELECT T0.* FROM T_BAS_Attachment T0 where T1.FID in(SELECT FAttachment FROM T_HR_SHRAttachmentExt where FBOID='xxxx');
xxxx参数换成真实的单据ID即可
8.5版本附件下载报错解决方案,报错日志如下图:
需要安装EAS的私包或者EAS附件领域的最新补丁,私包见附件;补丁:PT170267
附上s-HR附件的接口:
//附件接口 http://ip:port/shr/attachmentUpload.do?method=uploadAttachment //上传原始附件到临时服务器目录 http://ip:port/shr/attachmentUpload.do?method=initialAttachment //初始化附件下载列表 http://ip:port/shr/attachmentUpload.do?method=downloadAttachment //附件下载 http://ip:port/shr/attachmentUpload.do?method=deleteAttachment //附件删除 http://ip:port/shr/attachmentUpload.do?method=download //附件下载。直接返回需下载的文件 http://ip:port/shr/attachmentUpload.do?method=downloadAllAttachment //批量下载全部附件 http://ip:port/shr/attachmentUpload.do?method=previewAttachment //附件预览 http://ip:port/shr/attachmentUpload.do?method=updateAttachmentDescription //更新附件备注 http://ip:port/shr/attachmentUpload.do?method=updateAttachmentName //更新附件名称 http://ip:port/shr/dynamic.do?uipk=xxxx&method=save//保存请求,会自动调用附件的更新存储
s-HR8.5及以上版本附件的上传逻辑
本文2024-09-16 23:44:44发表“s-hr cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-shr-56524.html