From 7fe12af4137934adc0c77a75606348b059565266 Mon Sep 17 00:00:00 2001 From: liujiaji Date: Mon, 6 Aug 2018 12:29:35 +0800 Subject: [PATCH] =?UTF-8?q?app=20=E8=B5=84=E6=96=99=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=BF=AE=E6=94=B9=20=E2=80=9C=E5=B7=B2?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E2=80=9D=E2=80=9C=E6=9C=AA=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E2=80=9D=20app=20=E8=B5=84=E6=96=99=E6=B8=85=E5=8D=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=20=E5=BF=85=E5=A4=87=20=E6=88=96=E6=9C=89=20=E6=8A=BD?= =?UTF-8?q?=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit web.xml 添加 业务申请流程 删除附件接口 --- WebContent/WEB-INF/web.xml | 1 + .../BusinessDocDeleteController.java | 39 ++++++++++++ .../service/BusinessDocDeleteService.java | 18 ++++++ .../impl/BusinessDocDeleteServiceImpl.java | 59 +++++++++++++++++++ .../controller/LBDocAttributeController.java | 21 ++++++- .../detail/process/DocLibraryStateUpdate.java | 50 ++++++++++++++++ .../detail/service/LBDocAttributeService.java | 4 ++ .../impl/BusinessDocDetailServiceImpl.java | 5 +- .../impl/LBDocAttributeServiceImpl.java | 30 +++++++++- .../impl/BusinessDocUploadServiceImpl.java | 7 ++- 10 files changed, 227 insertions(+), 7 deletions(-) create mode 100644 src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/controller/BusinessDocDeleteController.java create mode 100644 src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/BusinessDocDeleteService.java create mode 100644 src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/impl/BusinessDocDeleteServiceImpl.java create mode 100644 src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/process/DocLibraryStateUpdate.java diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 29d76751b..88795bbd0 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -484,6 +484,7 @@ apx.com.amarsoft.als.apzl.apply.business.doc.detail.controller, apx.com.amarsoft.als.apzl.apply.business.doc.upload.controller, + apx.com.amarsoft.als.apzl.apply.business.doc.delete.controller, apx.com.amarsoft.als.apzl.apply.business.loan.controller, diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/controller/BusinessDocDeleteController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/controller/BusinessDocDeleteController.java new file mode 100644 index 000000000..a680cd076 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/controller/BusinessDocDeleteController.java @@ -0,0 +1,39 @@ +package apx.com.amarsoft.als.apzl.apply.business.doc.delete.controller; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import apx.com.amarsoft.als.apzl.apply.business.doc.delete.service.BusinessDocDeleteService; +import apx.com.amarsoft.als.apzl.apply.business.doc.delete.service.impl.BusinessDocDeleteServiceImpl; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +@Path("/file") +public class BusinessDocDeleteController { + @Path("/business/del/att") + @POST + public Map delete(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] BusinessDocDeleteController run ................."); + ARE.getLog().info( + "[Path] /file/business/del/att" + " run ................."); + + BusinessDocDeleteService service = new BusinessDocDeleteServiceImpl(); + try { + return service.delete(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/BusinessDocDeleteService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/BusinessDocDeleteService.java new file mode 100644 index 000000000..a56178fea --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/BusinessDocDeleteService.java @@ -0,0 +1,18 @@ +package apx.com.amarsoft.als.apzl.apply.business.doc.delete.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.Context; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public interface BusinessDocDeleteService { + Map delete(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception; +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/impl/BusinessDocDeleteServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/impl/BusinessDocDeleteServiceImpl.java new file mode 100644 index 000000000..f167c662d --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/delete/service/impl/BusinessDocDeleteServiceImpl.java @@ -0,0 +1,59 @@ +package apx.com.amarsoft.als.apzl.apply.business.doc.delete.service.impl; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import jbo.app.tenwa.doc.LB_DOCATTRIBUTE; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.constant.RestfullConstant; +import com.base.util.DateUtil; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; + +import apx.com.amarsoft.als.apzl.apply.business.doc.delete.service.BusinessDocDeleteService; +import apx.com.amarsoft.als.apzl.apply.business.doc.detail.process.DocLibraryStateUpdate; + +public class BusinessDocDeleteServiceImpl implements BusinessDocDeleteService { + private Map fieldMap; + + @SuppressWarnings("unchecked") + public Map delete(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception { + + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); // + + String attId = fieldMap.get("attid") == null ? "" : fieldMap.get("attid") + .toString(); + String libraryId = fieldMap.get("libraryid") == null ? "" : fieldMap.get("libraryid") + .toString(); + + BizObjectManager bom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME); + BizObject bo = bom.createQuery("id=:id AND DELETEED IS NULL").setParameter("id", attId).getSingleResult(true); + + if (null != bo) { + bo.setAttributeValue("DELETEED", "Y"); + bom.saveObject(bo); + tx.commit(); + String userId = fieldMap.get("userid") == null ? "" : fieldMap.get( + "userid").toString(); + ASUser CurUser = new ASUser(userId, sqlca); + String CurTime = DateUtil.getSystemTimeByFormat("yyyy/MM/dd HH:mm:ss"); + DocLibraryStateUpdate.update(libraryId, "-1", CurUser, CurTime, tx); + } + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/controller/LBDocAttributeController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/controller/LBDocAttributeController.java index d305a7242..eb464e243 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/controller/LBDocAttributeController.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/controller/LBDocAttributeController.java @@ -27,7 +27,7 @@ public class LBDocAttributeController { ARE.getLog() .info("[CONTROLLER] LBDocAttributeController run ................."); ARE.getLog().info( - "[Path] /apply/business/upload" + " run ................."); + "[Path] /file/att/list" + " run ................."); LBDocAttributeService service = new LBDocAttributeServiceImpl(); try { @@ -36,4 +36,23 @@ public class LBDocAttributeController { return ReturnMapUtil.rollback(e); } } + + @Path("/library/state/update") + @POST + public Map stateUpdate(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] LBDocAttributeController run ................."); + ARE.getLog().info( + "[Path] /file/library/state/update" + " run ................."); + + LBDocAttributeService service = new LBDocAttributeServiceImpl(); + try { + return service.stateUpdate(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/process/DocLibraryStateUpdate.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/process/DocLibraryStateUpdate.java new file mode 100644 index 000000000..1e047b101 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/process/DocLibraryStateUpdate.java @@ -0,0 +1,50 @@ +package apx.com.amarsoft.als.apzl.apply.business.doc.detail.process; + +import jbo.app.tenwa.doc.LB_DOCATTRIBUTE; +import jbo.app.tenwa.doc.LB_DOCLIBRARY; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOException; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.context.ASUser; + +public class DocLibraryStateUpdate { + + public static void update(String libraryId, String type, ASUser CurUser, String CurTime, JBOTransaction tx) + throws JBOException { + try { + BizObjectManager bom = JBOFactory + .getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME); + BizObject bo = bom.createQuery("ID=:ID").setParameter("ID", libraryId) + .getSingleResult(true); + + if (null == bo) + return; + tx.join(bom); + BizObjectManager attM = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME); + BizObject att = attM.createQuery("LIBRARY_ID=:LIBRARY_ID").setParameter("LIBRARY_ID", libraryId).getSingleResult(false); + switch (type) { + case "1": + if (null == att) return; // ûҵ ύ޸ + bo.setAttributeValue("BUSINESS_CHECK", "DocCheck_0"); // DocCheck_0 ύ + break; + case "-1": + if (null != att) return; // δ δύ޸ + bo.setAttributeValue("BUSINESS_CHECK", "DocCheck_2"); // DocCheck_2 δύ + break; + default: + return; + } + bo.setAttributeValue("UPDATEUSERID",CurUser.getUserID()); + bo.setAttributeValue("UPDATEORGID", CurUser.getOrgID()); + bo.setAttributeValue("UPDATETIME", CurTime); + bom.saveObject(bo); + tx.commit(); + } catch (Exception e) { + ARE.getLog().error(e); + } + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/LBDocAttributeService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/LBDocAttributeService.java index d751fe617..6fea4556b 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/LBDocAttributeService.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/LBDocAttributeService.java @@ -13,4 +13,8 @@ public interface LBDocAttributeService { Map attList(HttpServletRequest request, HttpServletResponse response, JBOTransaction tx, Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception; + + Map stateUpdate(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception; } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/BusinessDocDetailServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/BusinessDocDetailServiceImpl.java index e9e526e94..a30a76669 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/BusinessDocDetailServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/BusinessDocDetailServiceImpl.java @@ -229,14 +229,15 @@ public class BusinessDocDetailServiceImpl implements BusinessDocDetailService { : library.getAttribute("ONE_CLASSIFY").toString(); String tweClassly = library.getAttribute("TWO_CLASSIFY") == null ? "" : library.getAttribute("TWO_CLASSIFY").toString(); - + String docNature = library.getAttribute("DOC_NATURE") == null ? "" + : library.getAttribute("DOC_NATURE").toString(); libraryMap.put("libraryId", libraryId); libraryMap.put("remark", remark); libraryMap.put("docType", docType); libraryMap.put("docName", docName1); libraryMap.put("oneClassly", oneClassly); libraryMap.put("tweClassly", tweClassly); - + libraryMap.put("docNature", docNature); BizObjectManager attManage = JBOFactory .getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME); List atts = attManage diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/LBDocAttributeServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/LBDocAttributeServiceImpl.java index 61ef10c11..15f2c4a4b 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/LBDocAttributeServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/LBDocAttributeServiceImpl.java @@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jbo.app.tenwa.doc.LB_DOCATTRIBUTE; +import apx.com.amarsoft.als.apzl.apply.business.doc.detail.process.DocLibraryStateUpdate; import apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.LBDocAttributeService; import com.amarsoft.are.jbo.BizObject; @@ -16,7 +17,9 @@ import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; import com.base.constant.RestfullConstant; +import com.base.util.DateUtil; import com.base.util.MultipartDataUtil; import com.base.util.ReturnMapUtil; @@ -37,8 +40,7 @@ public class LBDocAttributeServiceImpl implements LBDocAttributeService { BizObjectManager bom = JBOFactory .getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME); - List bos = bom - .createQuery("LIBRARY_ID=:LIBRARY_ID") + List bos = bom.createQuery("LIBRARY_ID=:LIBRARY_ID") .setParameter("LIBRARY_ID", libraryId).getResultList(false); List> list = new ArrayList>(); for (BizObject bo : bos) { @@ -64,4 +66,28 @@ public class LBDocAttributeServiceImpl implements LBDocAttributeService { RestfullConstant.baseProperty.get("success").toString(), ""); return ReturnMapUtil.getReturnMap(); } + + @SuppressWarnings("unchecked") + public Map stateUpdate(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception { + + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); // + + String libraryId = fieldMap.get("id") == null ? "" : fieldMap.get("id") + .toString(); + String type = fieldMap.get("type") == null ? "" : fieldMap.get("type") + .toString(); + String userId = fieldMap.get("userid") == null ? "" : fieldMap.get( + "userid").toString(); + ASUser CurUser = new ASUser(userId, sqlca); + String CurTime = DateUtil.getSystemTimeByFormat("yyyy/MM/dd HH:mm:ss"); + DocLibraryStateUpdate.update(libraryId, type, CurUser, CurTime, tx); + + ReturnMapUtil.setReturnMap(null, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java index 99bf55c17..abac33006 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java @@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse; import jbo.app.tenwa.doc.LB_DOCLIBRARY; import jbo.app.tenwa.doc.LB_DOCRELATIVE; +import apx.com.amarsoft.als.apzl.apply.business.doc.detail.process.DocLibraryStateUpdate; import apx.com.amarsoft.als.apzl.apply.business.doc.upload.service.BusinessDocUploadService; import com.amarsoft.are.jbo.BizObject; @@ -103,6 +104,7 @@ public class BusinessDocUploadServiceImpl implements BusinessDocUploadService { library.setAttributeValue("Remark", remark); tx.join(libraryManage); libraryManage.saveObject(library); + tx.commit(); Configure CurConfig = Configure.getInstance(); BizObjectManager attrBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); for (Map file : fileList) { @@ -140,10 +142,11 @@ public class BusinessDocUploadServiceImpl implements BusinessDocUploadService { attr.setAttributeValue("FullPath",sFullPath); attr.setAttributeValue("Content_Type", file.get("fileContentType")); attr.setAttributeValue("FileSize", file.get("fileSize")); -// tx.join(attrBm); + tx.join(attrBm); attrBm.saveObject(attr); + tx.commit(); } - + DocLibraryStateUpdate.update(libraryId, "1", user, time, tx); ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty.get("success").toString(), ""); return ReturnMapUtil.getReturnMap(); }