提交 7e4ad1ae 编写于 作者: O o2sword

批量上传附件允许修改排序号

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