This commit is contained in:
liujiaji 2018-08-11 15:33:46 +08:00
parent b33b31518b
commit 02c2f5cc15
8 changed files with 272 additions and 42 deletions

View File

@ -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<String, Object> 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);
}
}
}

View File

@ -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<String, Object> docList(@Context HttpServletRequest request,
@Context HttpServletResponse response, @Context JBOTransaction tx,
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil)
throws Exception;
}

View File

@ -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<String, Object> fieldMap;
@SuppressWarnings("unchecked")
@Override
public Map<String, Object> docList(HttpServletRequest request,
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
ReturnMapUtil ReturnMapUtil) throws Exception {
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
.readRequestParam(request, "UTF-8");
fieldMap = (Map<String, Object>) 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<Object> list = new ArrayList<Object>();
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);
}
}

View File

@ -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<Object> list) {
String s="";
String type = "";
String docList = "";
try {
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = (Map<String, Object>) 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;i<itemnos.length;i++){
s+="'"+itemnos[i]+"',";
}
if(s.length()>0){
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<String, Object> map = (Map<String, Object>) 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<String, Object> map = (Map<String, Object>) 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;i<itemnos.length;i++){
// s+="'"+itemnos[i]+"',";
// }
// if(s.length()>0){
// 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;i<itemnos.length;i++){
s+="'"+itemnos[i]+"',";
}
if(s.length()>0){
s=s.substring(0, s.length()-1);
}
try {
ASUser CurUser = new ASUser(userId);
Map<String,String> docParam=new HashMap<String,String>();

View File

@ -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);
}
/**
* 根据流程编号获取客户IDCUSTOMER_PERSON_TEMP表中ID流程编号均不唯一

View File

@ -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<String, Object> fieldMap;
public void setFieldMap(Map<String, Object> 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<String, Object> queryDefaultDo(HttpServletRequest request,
Transaction sqlca, JBOTransaction tx, ReturnMapUtil ReturnMapUtil)
throws Exception {
setParamMap(fieldMap);
return getData(request, sqlca, tx, ReturnMapUtil);
}
}

View File

@ -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 :");

View File

@ -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为产品节点配置中节点名
/*Map<String,String>fixedParam;//固定参数用来取前台参数
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")));
}