diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/controller/PayDocListController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/controller/PayDocListController.java new file mode 100644 index 000000000..4124868ec --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/controller/PayDocListController.java @@ -0,0 +1,39 @@ +package apx.com.amarsoft.als.apzl.apply.business.doc.detail.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.detail.service.PayDocListService; +import apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.impl.PayDocListServiceImpl; + +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 PayDocListController { + @Path("/comm/doc/list") + @POST + public Map docList(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] PayDocListController run ................."); + ARE.getLog().info( + "[Path] /file/comm/doc/list" + " run ................."); + + PayDocListService service = new PayDocListServiceImpl(); + try { + return service.docList(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/service/PayDocListService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/PayDocListService.java new file mode 100644 index 000000000..0d05094c7 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/PayDocListService.java @@ -0,0 +1,18 @@ +package apx.com.amarsoft.als.apzl.apply.business.doc.detail.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 PayDocListService { + Map docList(@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/detail/service/impl/PayDocListServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/PayDocListServiceImpl.java new file mode 100644 index 000000000..10269cb61 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/detail/service/impl/PayDocListServiceImpl.java @@ -0,0 +1,74 @@ +package apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.amarsoft.app.lc.workflow.action.GetFlowAction; +import com.amarsoft.app.util.ProductParamUtil; +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.MultipartDataUtil; +import com.base.util.ReturnMapUtil; +import com.tenwa.doc.action.DocListInitAction; + +import apx.com.amarsoft.als.apzl.apply.business.doc.detail.service.PayDocListService; +import apx.com.amarsoft.als.apzl.apply.business.start.init.InitDocListTools; +import apx.com.amarsoft.als.doc.manage.PayDocListDoManage; + +public class PayDocListServiceImpl implements PayDocListService { + private Map fieldMap; + @SuppressWarnings("unchecked") + @Override + public Map docList(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 objectNo = fieldMap.get("OBJECTNO") == null ? "" : fieldMap + .get("OBJECTNO").toString(); + fieldMap.put("OBJECTNO", objectNo); + fieldMap.put("OBJECTNO".toLowerCase(), objectNo); + fieldMap.put("FLOWUNID", objectNo); + fieldMap.put("FLOWUNID".toLowerCase(), objectNo); + fieldMap.put("FLOW_UNID", objectNo); + fieldMap.put("FLOW_UNID".toLowerCase(), objectNo); + + String otherWhere = ""; + BizObject flow=GetFlowAction.getFlowBussinessObject(objectNo);//流程对象 + String productId = flow.getAttribute("productId").getString(); + + List list = new ArrayList(); + try { + list = ProductParamUtil.getProductDocInfo(productId, "PRD0412"); + } catch (Exception e) { + ARE.getLog().error(e); + } + String s = ""; + try { + s = InitDocListTools.getdocClassItemno(list); + if (!StringX.isSpace(s)) { + s = s.split("@")[0]; + } + } catch (Exception e) { + ARE.getLog().error(e); + } + + otherWhere = DocListInitAction.getFlowWhere(flow,"","rela"); + otherWhere += " and O.doc_Class_Itemno in (" + s + ")"; + PayDocListDoManage manage = new PayDocListDoManage(); + manage.setDono("FlowPayDocList"); + manage.setFieldMap(fieldMap); + manage.setsAddWhere(otherWhere); + return manage.queryDefaultDo(request, sqlca, tx, ReturnMapUtil); + } + +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java index 381bb75bb..3db45afd8 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java @@ -19,7 +19,41 @@ import com.amarsoft.context.ASUser; import com.tenwa.doc.action.DocListInitAction; public class InitDocListTools { - @SuppressWarnings({ "rawtypes", "unchecked" }) + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static String getdocClassItemno (List list) { + String s=""; + String type = ""; + String docList = ""; + try { + for (int i = 0; i < list.size(); i++) { + Map map = (Map) list.get(i); + if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) { + type = map.get("TYPE").toString(); + if ("SingleRow".equals(type)) { + docList = map.get("DOCLIST").toString(); + } else { + List l = (List) map.get("DOCCONFIG"); + docList = l.toString(); + } + } + } + String docClassItemno = docList;// CurPage.getParameter("docList"); + String[] itemnos=docClassItemno.split(","); + + for(int i=0;i0){ + s=s.substring(0, s.length()-1); + } + return s+"@"+docClassItemno; + } catch (Exception e) { + ARE.getLog().error(e); + } + return ""; + } + public static boolean initDocList(String flowUnid, String userId, String carAttributes) throws Exception { try { BizObjectManager objectManage = JBOFactory @@ -51,30 +85,35 @@ public class InitDocListTools { ARE.getLog().error(e); return false; } - String type = ""; - String docList = ""; - for (int i = 0; i < list.size(); i++) { - Map map = (Map) list.get(i); - if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) { - type = map.get("TYPE").toString(); - if ("SingleRow".equals(type)) { - docList = map.get("DOCLIST").toString(); - } else { - List l = (List) map.get("DOCCONFIG"); - docList = l.toString(); - } - } +// String type = ""; +// String docList = ""; +// for (int i = 0; i < list.size(); i++) { +// Map map = (Map) list.get(i); +// if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) { +// type = map.get("TYPE").toString(); +// if ("SingleRow".equals(type)) { +// docList = map.get("DOCLIST").toString(); +// } else { +// List l = (List) map.get("DOCCONFIG"); +// docList = l.toString(); +// } +// } +// } +// String docClassItemno = docList;// CurPage.getParameter("docList"); +// String[] itemnos=docClassItemno.split(","); +// String s=""; +// for(int i=0;i0){ +// s=s.substring(0, s.length()-1); +// } + String s = getdocClassItemno(list); + String docClassItemno = ""; + if (s.length() > 0) { + s = s.split("@")[0]; + docClassItemno = s.split("@")[1]; } - String docClassItemno = docList;// CurPage.getParameter("docList"); - String[] itemnos=docClassItemno.split(","); - String s=""; - for(int i=0;i0){ - s=s.substring(0, s.length()-1); - } - try { ASUser CurUser = new ASUser(userId); Map docParam=new HashMap(); diff --git a/src_app_fresh/apx/com/amarsoft/als/base/awe/execute/method/BusinessCustomerMethod.java b/src_app_fresh/apx/com/amarsoft/als/base/awe/execute/method/BusinessCustomerMethod.java index 3a6987f8c..649b1dbc1 100644 --- a/src_app_fresh/apx/com/amarsoft/als/base/awe/execute/method/BusinessCustomerMethod.java +++ b/src_app_fresh/apx/com/amarsoft/als/base/awe/execute/method/BusinessCustomerMethod.java @@ -1,11 +1,15 @@ package apx.com.amarsoft.als.base.awe.execute.method; +import net.sf.json.JSONObject; import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; +import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT; +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.base.util.JsonUtil; public class BusinessCustomerMethod { @@ -28,6 +32,28 @@ public class BusinessCustomerMethod { } return bo.getAttribute("customerid").toString(); } + + public String getCustomerIdByFlowUnid(String flowUnid) throws JBOException { + String certId = ""; + + BizObjectManager fboM = JBOFactory + .getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); + BizObject fbo = fboM.createQuery("flow_unid=:flow_unid") + .setParameter("flow_unid", flowUnid).getSingleResult(false); + + if (null == fbo) return ""; + String jsonStr = fbo.getAttribute("FixedFlowParam") == null ? "" : fbo.getAttribute("FixedFlowParam").toString(); + if ("".equals(jsonStr)) return ""; + try { + JSONObject jo = JsonUtil.str2JSONObject(jsonStr); + certId = jo.get("certid") == null ? "" : jo.getString("certid"); + } catch (Exception e) { + ARE.getLog().error(e); + return ""; + } + if ("".equals(certId)) return ""; + return getCustomerIdByCertId(certId); + } /** * 根据流程编号,获取客户ID(CUSTOMER_PERSON_TEMP表中,ID,流程编号均不唯一) diff --git a/src_app_fresh/apx/com/amarsoft/als/doc/manage/PayDocListDoManage.java b/src_app_fresh/apx/com/amarsoft/als/doc/manage/PayDocListDoManage.java new file mode 100644 index 000000000..cb5be20f5 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/doc/manage/PayDocListDoManage.java @@ -0,0 +1,46 @@ +package apx.com.amarsoft.als.doc.manage; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import apx.com.amarsoft.als.base.awe.AbstractAweDoQueryManage; + +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; +import com.base.util.ReturnMapUtil; + +public class PayDocListDoManage extends AbstractAweDoQueryManage { + private String sAddWhere; + private String dono; + private Map fieldMap; + + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + + public void setDono(String dono) { + this.dono = dono; + } + + public void getGroupId() { + sGroupId = this.dono; + } + + public void getOtherWhere() { + super.sOtherWhere = StringX.isSpace(sAddWhere) ? "" + : this.sAddWhere; + } + + public void setsAddWhere(String sAddWhere) { + this.sAddWhere = sAddWhere; + } + + public Map queryDefaultDo(HttpServletRequest request, + Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil) + throws Exception { + setParamMap(fieldMap); + return getData(request, sqlca, tx, ReturnMapUtil); + } +} \ No newline at end of file diff --git a/src_core/com/tenwa/util/SecurityUtil.java b/src_core/com/tenwa/util/SecurityUtil.java index 93fdfd091..f3ab2f945 100644 --- a/src_core/com/tenwa/util/SecurityUtil.java +++ b/src_core/com/tenwa/util/SecurityUtil.java @@ -105,6 +105,7 @@ public class SecurityUtil { } public static void main(String[] args) throws Exception { +// String message = "apzl@2018", key = ""; String message = "apzl", key = ""; String entryptedMsg = encrypt(message, key); System.out.println("encrypted message is below :"); diff --git a/src_core/com/tenwa/util/test.java b/src_core/com/tenwa/util/test.java index f3e37e9ca..5fcb85b12 100644 --- a/src_core/com/tenwa/util/test.java +++ b/src_core/com/tenwa/util/test.java @@ -5,25 +5,12 @@ import com.tenwa.flow.treeview.action.BaseInitTreeView; public class test { public static void main(String[] args) { - // TODO Auto-generated method stub - BaseInitTreeView TreeView=new BaseInitTreeView(); + String sql = "select se.seriesid,se.seriesname from (" + + "SELECT seriesid,max(seriesname) seriesname,max(brandid) brandid FROM vi_car_data where 1=1 group by seriesid" + + ") se WHERE se.seriesname IS NOT NULL AND se.brandid='#brandid' ORDER BY se.seriesname DESC"; - //注:itemName为前台左树图中节点中文名,codeno为产品节点配置中节点名 - /*MapfixedParam;//固定参数用来取前台参数 - TreeView.addBeforeNodeByCode(itemName, codeno);//在节点之胶增加节点 - TreeView.addChildrenNodeByCode(itemName, codeno);//在节点下面增加子节点 - TreeView.addFirstNodeByCode(codeno);//在开始位置增加子节点 - TreeView.addLastNodeByCode(codeno);//在结束位置增加子节点 - TreeView.moveTreeItem(itemName, afterItem);//将节点A移到节点B之前 - TreeView.moveTreeItemToFirst(itemName);//将节点移到最开始 - TreeView.moveTreeItemToLast(itemName);//将节点移到最后 - TreeView.AddNodeUrlParam(itemName, param);//更新节点参数,param为Map - TreeView.updateNodeUrl(itemName, URL);//更新节点的URL - TreeView.updateNodeTemplateNo(itemName, templateNo);//更新节点的模板编号 - TreeView.updateNodeSetReadOnly(itemName, readType);//设置节只读 -*/ - - + System.out.println(sql.substring(sql.toUpperCase().lastIndexOf("WHERE"), sql.length())); + System.out.println(sql.substring(0, sql.toLowerCase().lastIndexOf("where"))); }