From 398a2086b589d9ee45a7553912666f3e72f4b1dc Mon Sep 17 00:00:00 2001 From: liujiaji Date: Tue, 28 Aug 2018 10:31:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=8F=91=E8=B5=B7=20?= =?UTF-8?q?=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApplyCancelController.java | 20 +++++++ .../start/service/ApplyStartService.java | 18 ++++++ .../service/impl/ApplyStartServiceImpl.java | 59 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/ApplyStartService.java create mode 100644 src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/ApplyStartServiceImpl.java diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/controller/ApplyCancelController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/controller/ApplyCancelController.java index c3d583a18..514a5ea0e 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/controller/ApplyCancelController.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/controller/ApplyCancelController.java @@ -9,7 +9,9 @@ import javax.ws.rs.Path; import javax.ws.rs.core.Context; import apx.com.amarsoft.als.apzl.apply.business.start.service.ApplyCancelService; +import apx.com.amarsoft.als.apzl.apply.business.start.service.ApplyStartService; import apx.com.amarsoft.als.apzl.apply.business.start.service.impl.ApplyCancelServiceImpl; +import apx.com.amarsoft.als.apzl.apply.business.start.service.impl.ApplyStartServiceImpl; import com.amarsoft.are.ARE; import com.amarsoft.are.jbo.JBOTransaction; @@ -35,4 +37,22 @@ public class ApplyCancelController { return ReturnMapUtil.rollback(e); } } + + @Path("/start/enable") + @POST + public Map applyStart(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] ApplyCancelController run ................."); + ARE.getLog().info("[Path] /apply/start/enable" + " run ................."); + + ApplyStartService service = new ApplyStartServiceImpl(); + try { + return service.applyStart(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/start/service/ApplyStartService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/ApplyStartService.java new file mode 100644 index 000000000..af374bb5e --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/ApplyStartService.java @@ -0,0 +1,18 @@ +package apx.com.amarsoft.als.apzl.apply.business.start.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 ApplyStartService { + Map applyStart(@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/start/service/impl/ApplyStartServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/ApplyStartServiceImpl.java new file mode 100644 index 000000000..eca63c962 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/ApplyStartServiceImpl.java @@ -0,0 +1,59 @@ +package apx.com.amarsoft.als.apzl.apply.business.start.service.impl; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; +import com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck; + +import apx.com.amarsoft.als.apzl.apply.business.start.service.ApplyStartService; + +public class ApplyStartServiceImpl implements ApplyStartService { + private Map fieldMap; + + @SuppressWarnings("unchecked") + public Map applyStart(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 applyType = fieldMap.get("applytype") == null ? "" : fieldMap + .get("applytype").toString(); + + Map body = new HashMap(); + body.put("applyResult", "true"); + if (!StringX.isSpace(applyType)) { + if ("BusinessApplyApply".equals(applyType)) { + String userid = fieldMap.get("userid") == null ? "" : fieldMap + .get("userid").toString(); + ASUser CurUser = new ASUser(userid, sqlca); + + ARE.getLog().info( + "用户:" + CurUser.getUserName() + ", 部门:" + + CurUser.getOrgName() + "请求发起申请!"); + + CustomerInfoCheck applyStartEnable = new CustomerInfoCheck(); + applyStartEnable.setId(CurUser.getOrgID()); + String result = applyStartEnable.checkDistributorStatus(tx); + result = result == null ? "" : result.trim(); + body.put("applyResult", result); + } + } + + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + +}