提交 f0dc4e0d 编写于 作者: NoSubject's avatar NoSubject

Merge branch 'feature/批量上传附件允许修改排序号' into 'project/chinamobile-重庆移动'

[流程平台]批量上传附件允许修改排序号

See merge request o2oa/o2oa!2983

(cherry picked from commit 64b18ec4402ea0be89e65a0a7e854e5ad9859502)

7e4ad1ae 批量上传附件允许修改排序号
上级 d8488934
...@@ -28,7 +28,7 @@ class ActionManageBatchUpload extends BaseAction { ...@@ -28,7 +28,7 @@ class ActionManageBatchUpload extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionManageBatchUpload.class); private static Logger logger = LoggerFactory.getLogger(ActionManageBatchUpload.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String workIds, String site, String fileName, byte[] bytes, ActionResult<Wo> execute(EffectivePerson effectivePerson, String workIds, String site, String fileName, byte[] bytes,
FormDataContentDisposition disposition, String extraParam, String person) throws Exception { FormDataContentDisposition disposition, String extraParam, String person, Integer order) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>(); ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc); Business business = new Business(emc);
...@@ -62,11 +62,11 @@ class ActionManageBatchUpload extends BaseAction { ...@@ -62,11 +62,11 @@ class ActionManageBatchUpload extends BaseAction {
Attachment attachment = null; Attachment attachment = null;
Work work = emc.find(workId.trim(), Work.class); Work work = emc.find(workId.trim(), Work.class);
if(work!=null) { if(work!=null) {
attachment = this.concreteAttachment(work, person, site); attachment = this.concreteAttachment(work, person, site, order);
}else{ }else{
WorkCompleted workCompleted = emc.find(workId, WorkCompleted.class); WorkCompleted workCompleted = emc.find(workId, WorkCompleted.class);
if (null != workCompleted) { if (null != workCompleted) {
attachment = this.concreteAttachment(workCompleted, person, site); attachment = this.concreteAttachment(workCompleted, person, site, order);
} }
} }
if(attachment!=null){ if(attachment!=null){
...@@ -91,7 +91,7 @@ class ActionManageBatchUpload extends BaseAction { ...@@ -91,7 +91,7 @@ class ActionManageBatchUpload extends BaseAction {
} }
} }
private Attachment concreteAttachment(Work work, String person, String site) throws Exception { private Attachment concreteAttachment(Work work, String person, String site, Integer order) throws Exception {
Attachment attachment = new Attachment(); Attachment attachment = new Attachment();
attachment.setCompleted(false); attachment.setCompleted(false);
attachment.setPerson(person); attachment.setPerson(person);
...@@ -106,10 +106,13 @@ class ActionManageBatchUpload extends BaseAction { ...@@ -106,10 +106,13 @@ class ActionManageBatchUpload extends BaseAction {
attachment.setActivityName(work.getActivityName()); attachment.setActivityName(work.getActivityName());
attachment.setActivityToken(work.getActivityToken()); attachment.setActivityToken(work.getActivityToken());
attachment.setActivityType(work.getActivityType()); attachment.setActivityType(work.getActivityType());
if(order!=null){
attachment.setOrderNumber(order);
}
return attachment; return attachment;
} }
private Attachment concreteAttachment(WorkCompleted workCompleted, String person, String site) throws Exception { private Attachment concreteAttachment(WorkCompleted workCompleted, String person, String site, Integer order) throws Exception {
Attachment attachment = new Attachment(); Attachment attachment = new Attachment();
attachment.setCompleted(true); attachment.setCompleted(true);
attachment.setPerson(person); attachment.setPerson(person);
...@@ -124,6 +127,9 @@ class ActionManageBatchUpload extends BaseAction { ...@@ -124,6 +127,9 @@ class ActionManageBatchUpload extends BaseAction {
attachment.setActivityName(workCompleted.getActivityName()); attachment.setActivityName(workCompleted.getActivityName());
attachment.setActivityToken(workCompleted.getActivity()); attachment.setActivityToken(workCompleted.getActivity());
attachment.setActivityType(ActivityType.end); attachment.setActivityType(ActivityType.end);
if(order!=null){
attachment.setOrderNumber(order);
}
return attachment; return attachment;
} }
......
...@@ -1090,6 +1090,7 @@ public class AttachmentAction extends StandardJaxrsAction { ...@@ -1090,6 +1090,7 @@ public class AttachmentAction extends StandardJaxrsAction {
@JaxrsParameterDescribe("位置") @FormDataParam("site") String site, @JaxrsParameterDescribe("位置") @FormDataParam("site") String site,
@JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName, @JaxrsParameterDescribe("附件名称") @FormDataParam(FILENAME_FIELD) String fileName,
@JaxrsParameterDescribe("上传到指定用户") @FormDataParam("person") String person, @JaxrsParameterDescribe("上传到指定用户") @FormDataParam("person") String person,
@JaxrsParameterDescribe("附件排序号") @FormDataParam("orderNumber") Integer orderNumber,
@JaxrsParameterDescribe("天印扩展字段") @FormDataParam("extraParam") String extraParam, @JaxrsParameterDescribe("天印扩展字段") @FormDataParam("extraParam") String extraParam,
@FormDataParam(FILE_FIELD) final byte[] bytes, @FormDataParam(FILE_FIELD) final byte[] bytes,
@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) { @FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
...@@ -1097,7 +1098,7 @@ public class AttachmentAction extends StandardJaxrsAction { ...@@ -1097,7 +1098,7 @@ public class AttachmentAction extends StandardJaxrsAction {
EffectivePerson effectivePerson = this.effectivePerson(request); EffectivePerson effectivePerson = this.effectivePerson(request);
try { try {
result = new ActionManageBatchUpload().execute(effectivePerson, workIds, site, fileName, bytes, disposition, result = new ActionManageBatchUpload().execute(effectivePerson, workIds, site, fileName, bytes, disposition,
extraParam, person); extraParam, person, orderNumber);
} catch (Exception e) { } catch (Exception e) {
logger.error(e, effectivePerson, request, null); logger.error(e, effectivePerson, request, null);
result.error(e); result.error(e);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册