/files/remove/docById
根据附件ID 删除 附件
This commit is contained in:
parent
7fe12af413
commit
53a77b3fc7
@ -39,28 +39,28 @@ public class DocManageController {
|
||||
return service.attachmentDownloadById(sId, request, response);
|
||||
}
|
||||
|
||||
// @Path("/remove/docById")
|
||||
// @GET
|
||||
// public Map<String, Object> removeDocById(
|
||||
// @Context HttpServletRequest request,
|
||||
// @Context HttpServletResponse response, @Context Transaction sqlca,
|
||||
// JBOTransaction tx) throws Exception {
|
||||
// ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca);
|
||||
// try {
|
||||
// String sId = request.getParameter("id");
|
||||
//
|
||||
// if (service.removeDocById(sId, tx)) {
|
||||
// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty
|
||||
// .get("SUCCESS").toString(), "文件移除成功!");
|
||||
// } else {
|
||||
// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty
|
||||
// .get("FAIL").toString(), "文件移除失败!");
|
||||
// }
|
||||
// return ReturnMapUtil.getReturnMap();
|
||||
// } catch (Exception e) {
|
||||
// return ReturnMapUtil.rollback(e);
|
||||
// }
|
||||
// }
|
||||
@Path("/remove/docById")
|
||||
@GET
|
||||
public Map<String, Object> removeDocById(
|
||||
@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context Transaction sqlca,
|
||||
JBOTransaction tx) throws Exception {
|
||||
ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca);
|
||||
try {
|
||||
String sId = request.getParameter("id");
|
||||
|
||||
if (service.removeDocById(sId, tx)) {
|
||||
ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty
|
||||
.get("SUCCESS").toString(), "文件移除成功!");
|
||||
} else {
|
||||
ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty
|
||||
.get("FAIL").toString(), "文件移除失败!");
|
||||
}
|
||||
return ReturnMapUtil.getReturnMap();
|
||||
} catch (Exception e) {
|
||||
return ReturnMapUtil.rollback(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Path("/downloadPlist")
|
||||
@GET
|
||||
|
||||
@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.core.Context;
|
||||
|
||||
|
||||
import jbo.app.tenwa.doc.LB_DOCATTRIBUTE;
|
||||
//import jbo.app.tenwa.doc.DOC_ATTRIBUTE;
|
||||
import apx.com.amarsoft.als.doc.AppAtt;
|
||||
|
||||
@ -60,26 +62,28 @@ public class DocManageService {
|
||||
return new AppAtt();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * ¸ù¾Ý attachment no ÒÆ³ý ¸½¼þ
|
||||
// * @param sId
|
||||
// * @param tx
|
||||
// * @return
|
||||
// */
|
||||
// public boolean removeDocById(String sId, JBOTransaction tx) {
|
||||
// try {
|
||||
// BizObjectManager manage = JBOFactory
|
||||
// .getBizObjectManager(DOC_ATTRIBUTE.CLASS_NAME);
|
||||
// BizObject bo = manage.createQuery("attachmentno=:id").setParameter("id", sId)
|
||||
// .getSingleResult(true);
|
||||
// if (null == bo)
|
||||
// return true;
|
||||
// manage.deleteObject(bo);
|
||||
// return true;
|
||||
// } catch (Exception e) {
|
||||
// ARE.getLog().error(e);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* ¸ù¾Ý attachment no ÒÆ³ý ¸½¼þ
|
||||
* @param sId
|
||||
* @param tx
|
||||
* @return
|
||||
*/
|
||||
public boolean removeDocById(String sId, JBOTransaction tx) {
|
||||
try {
|
||||
BizObjectManager manage = JBOFactory
|
||||
.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME);
|
||||
BizObject bo = manage.createQuery("id=:id").setParameter("id", sId)
|
||||
.getSingleResult(true);
|
||||
if (null == bo)
|
||||
return true;
|
||||
bo.setAttributeValue("DELETEED", "Y");
|
||||
manage.saveObject(bo);
|
||||
tx.commit();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ARE.getLog().error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user