diff --git a/WebContent/WEB-INF/tlds/web.xml b/WebContent/WEB-INF/tlds/web.xml index 68ad32b80..98f05553e 100644 --- a/WebContent/WEB-INF/tlds/web.xml +++ b/WebContent/WEB-INF/tlds/web.xml @@ -508,6 +508,7 @@ apx.com.amarsoft.als.business.change.controller, 信息校验 apx.com.amarsoft.als.business.verification.controller, + apx.com.amarsoft.als.apzl.apply.business.data.controller 对整个webapi进行一些通用处理的过滤器 diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 698ce5a78..8edc38ee6 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -552,6 +552,7 @@ apx.com.amarsoft.als.business.change.controller, apx.com.amarsoft.als.business.verification.controller, + apx.com.amarsoft.als.apzl.apply.business.data.controller, diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/controller/BusinessDataController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/controller/BusinessDataController.java new file mode 100644 index 000000000..98cb591df --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/controller/BusinessDataController.java @@ -0,0 +1,43 @@ +package apx.com.amarsoft.als.apzl.apply.business.data.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.data.service.BusinessDataService; +import apx.com.amarsoft.als.apzl.apply.business.data.service.impl.BusinessDataServiceImpl; +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("/business/data") +public class BusinessDataController { + + //ȡ + @Path("/flow/number") + @POST + public Map getFlowDraftNumber(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] BusinessDataController run ................."); + ARE.getLog().info( + "[Path] /business/data/flow/number" + " run ................."); + + BusinessDataService service = new BusinessDataServiceImpl(); + try { + return service.getFlowDraftNumber(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/data/service/BusinessDataService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/BusinessDataService.java new file mode 100644 index 000000000..ecc4e5106 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/BusinessDataService.java @@ -0,0 +1,18 @@ +package apx.com.amarsoft.als.apzl.apply.business.data.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 BusinessDataService { + Map getFlowDraftNumber(@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/data/service/impl/BusinessDataServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/impl/BusinessDataServiceImpl.java new file mode 100644 index 000000000..9fabfbb16 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/impl/BusinessDataServiceImpl.java @@ -0,0 +1,47 @@ +package apx.com.amarsoft.als.apzl.apply.business.data.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.util.Transaction; +import com.base.constant.RestfullConstant; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; +import com.tenwa.comm.util.jboutil.DataOperatorUtil; + +import apx.com.amarsoft.als.apzl.apply.business.data.service.BusinessDataService; + +public class BusinessDataServiceImpl implements BusinessDataService { + private Map fieldMap; + + @Override + public Map getFlowDraftNumber(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 userId = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); + String sql = "SELECT 'BusinessApplyFlow' as flowname,COUNT(*) as number FROM flow_object fo, (SELECT objectno,userid FROM flow_task GROUP BY objectno,phaseno HAVING phaseno='0010') ft WHERE fo.objectno=ft.objectno AND fo.phaseno='0010' AND fo.flowno='BusinessApplyFlow' AND ft.userid='"+userId+"' " + + "UNION ALL SELECT 'BContractApproveFlow' as flowname,COUNT(*) as number FROM flow_object fo, (SELECT objectno,userid FROM flow_task GROUP BY objectno,phaseno HAVING phaseno='0010') ft WHERE fo.objectno=ft.objectno AND fo.phaseno='0010' AND fo.flowno='BContractApproveFlow' AND ft.userid='"+userId+"' " + + "UNION ALL SELECT 'FundPaymentCarFlow' as flowname,COUNT(*) as number FROM flow_object fo, (SELECT objectno,userid FROM flow_task GROUP BY objectno,phaseno HAVING phaseno='0010') ft WHERE fo.objectno=ft.objectno AND fo.phaseno='0010' AND fo.flowno='FundPaymentCarFlow' AND ft.userid='"+userId+"' " + + "UNION ALL SELECT 'MortgageFileFlow' as flowname,COUNT(*) as number FROM flow_object fo, (SELECT objectno,userid FROM flow_task GROUP BY objectno,phaseno HAVING phaseno='0010') ft WHERE fo.objectno=ft.objectno AND fo.phaseno='0010' AND fo.flowno='MortgageFileFlow' AND ft.userid='"+userId+"' "; + List> dataList = DataOperatorUtil.getDataBySql(sql); + Map body = new HashMap(); + if(dataList.size()>0){ + for (Map map : dataList) { + body.putIfAbsent(map.get("flowname"), map.get("number")); + } + } + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + +}