This commit is contained in:
liuz 2018-06-13 15:03:32 +08:00
commit 2fdaeee093
6 changed files with 1599 additions and 706 deletions

View File

@ -11,7 +11,7 @@
String sTempletNo = "DDepositReturn_TempInfo";//--Ä£°åºÅ--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
doTemp.setColTips("", "²âÊÔ");
/* doTemp.setColTips("", "²âÊÔ"); */
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
//dwTemp.ReadOnly = "-2";//Ö»¶Áģʽ

View File

@ -4,7 +4,7 @@
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply(){
AsDialog.OpenSelector("selectDealerInfo","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",function(sReturn){
AsDialog.OpenSelector("selectDealerChargeInfo","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;

View File

@ -4,7 +4,7 @@
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newApply(){
AsDialog.OpenSelector("selectDealerInfo","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",function(sReturn){
AsDialog.OpenSelector("selectDealerReturnInfo","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;

View File

@ -100,7 +100,7 @@
<param-value>GBK</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>InitCollectConfig</servlet-name>
<servlet-class>com.amarsoft.app.awe.config.InitCollectConfig</servlet-class>
@ -468,7 +468,9 @@
apx.com.amarsoft.als.currency.select.contract.controller,
<!-- 我的工作 -->
<!-- 申请列表 applytype phasetype ObjectNo -->
apx.com.amarsoft.als.apzl.apply.query,
apx.com.amarsoft.als.apzl.apply.business.query.controller,
<!-- 业务申请发起 -->
apx.com.amarsoft.als.apzl.apply.business.start.controller,
<!-- 汽车选择框 -->
apx.com.amarsoft.als.currency.select.apzl.car.controller,
<!-- 产品选择框 -->

View File

@ -8,26 +8,101 @@ import com.amarsoft.are.util.SpecialTools;
public class AweDoCommUtil {
public static void main(String[] args) throws Exception {
System.out.println(SpecialTools.real2Amarsoft("123 "));
String str = "((EXISTS( SELECT * FROM jbo.com .tenwa.lease.comm.LB_GUARANTEE_UNIT lgu "
+ "WHERE lgu.CONTRACT_ID=O.CONTRACT_ID AND lgu.ASSUROR=:customerid) "
+ "OR EXISTS( SELECT * FROM jbo.com .tenwa.lease.comm.LB_UNION_LESSEE lul "
+ "WHERE lul.CONTRACT_ID=O.CONTRACT_ID AND lul.CUSTOMER_ID=:customerid)))";
String str = "id=:id1 and (ida>=:id2 or idb<=:id3) and idc >: id4 (idd <: id5 and ide <>:id6)";
System.out.println(str);
Map<String, Object> map = new HashMap<String, Object>();
map.put("ASSUROR", "123");
map.put("ASSUROR".toLowerCase(), "123");
map.put("CUSTOMER_ID", "123");
map.put("CUSTOMER_ID".toLowerCase(), "123");
System.out.println(whereHandle(str, map));
map.put("id", "1");
map.put("ida", "2");
map.put("idb", "3");
map.put("idc", "4");
map.put("idd", "5");
map.put("ide", "6");
// map.put("ASSUROR".toLowerCase(), "123");
// map.put("CUSTOMER_ID", "123");
// map.put("CUSTOMER_ID".toLowerCase(), "123");
// System.out.println(whereHandle(str, map));
whereHandle(str, map);
}
public static String whereHandle(String sJboWhere,
Map<String, Object> paramMap) {
return whereHandle1(sJboWhere, paramMap);
return whereHandle2(sJboWhere, paramMap);
}
private static String whereHandle2(String sJboWhere,
Map<String, Object> paramMap) {
while (sJboWhere.contains(" ")) {
sJboWhere = sJboWhere.replace(" ", " ");
}
String where = sJboWhere;
String operation = "=";
if (where.contains(":")) {
String [] array = where.split(":");
String oldStr = "", newStr = "";
for (int i = 1; i < array.length; i++) {
String key = array[i - 1].trim();
String value = array[i].trim();
if (value.endsWith(")")) {
value = value.substring(0, value.length() - 1).trim();
}
String sKey = "", sKeyStr = "";
if (key.endsWith("==") || key.endsWith("!=") || key.endsWith("<>") || key.endsWith(">=") || key.endsWith("<=")
|| key.equals("!<") || key.equals("!>")) {
sKey = key.substring(0, key.length() - 2).trim();
operation = key.substring(key.length() - 2, key.length()).trim();
} else if (key.endsWith("=") || key.endsWith(">") || key.endsWith("<")) {
sKey = key.substring(0, key.length() - 1).trim();
operation = key.substring(key.length() - 1, key.length()).trim();
}
String [] keyArray = sKey.split(" ");
if (keyArray.length > 0) {
sKeyStr = keyArray[keyArray.length - 1].trim();
} else {
sKeyStr = sKey.trim();
}
if (sKeyStr.startsWith("(")) {
sKeyStr = sKeyStr.substring(1, sKeyStr.length());
}
if (sKeyStr.contains(".")) {
String [] keyArray2 = sKeyStr.split("\\.");
sKeyStr = keyArray2[keyArray2.length - 1].trim();
}
if (value.contains(" ")) {
value = value.substring(0, value.indexOf(" "));
}
value = value.trim();
if (value.endsWith(")")) {
value = value.substring(0, value.indexOf(")"));
}
oldStr = array[i - 1] + ":" + value;
// System.out.println("old: " + oldStr);
newStr = sKeyStr + operation + "'" + paramMap.get(sKeyStr) + "'";
System.out.println(sKeyStr + operation + ":" + value + " Ìæ»»³É " + newStr);
oldStr = sKeyStr + operation + ":" + value;
sJboWhere = sJboWhere.replace(oldStr, newStr);
oldStr = sKeyStr + " " + operation + ": " + value;
sJboWhere = sJboWhere.replace(oldStr, newStr);
oldStr = sKeyStr + operation + ": " + value;
sJboWhere = sJboWhere.replace(oldStr, newStr);
oldStr = sKeyStr + " " + operation + ":" + value;
sJboWhere = sJboWhere.replace(oldStr, newStr);
}
}
System.out.println(sJboWhere);
return sJboWhere;
}
private static String whereHandle1(String sJboWhere,
@ -36,24 +111,23 @@ public class AweDoCommUtil {
where = where.replace(" AND ", " and ");
where = where.replace(" OR ", " or ");
String[] array = where.split("and");
String[] array1 = null;
String sKey = "";
String newStr = "";
for (String str : array) {
if (str.contains(":")) {
array1 = str.split(":");
String[] orArray = str.split("or");
if (orArray.length >= 2) {
// [ (O.INPUTORGID=:inputOrgId , O.INPUTORGID like :inputOrgId1)]
for (String orStr : orArray) {
// O.contract_id = :contract_id
String[] array1 = orStr.split(":");
// O.contract_id = > 0
// contract_id> 1
if (array1.length != 2)
continue;
// if (array1.length != 2)
// continue;
if (!array1[0].contains(".")) {
String sKey = array1[0].toLowerCase();
sKey = array1[0].toLowerCase();
sKey = sKey.trim();
sKey = sKey.substring(0, sKey.length() - 1);
sKey = sKey.trim();
String newStr = array1[0] + "'"
newStr = array1[0] + "'"
+ paramMap.get(sKey) + "' ";
sJboWhere = sJboWhere.replace(orStr, newStr);
continue;
@ -61,47 +135,42 @@ public class AweDoCommUtil {
String[] array2 = array1[0].split("\\.");
if (array2.length < 2)
continue;
String sKey = array2[1].toLowerCase();
// inputorgid like
sKey = array2[array2.length - 1].toLowerCase().trim();
if (sKey.contains("like") || sKey.contains("LIKE")) {
String newStr = array1[0] + "'" + paramMap.get(sKey.trim().replaceAll("like", "").trim()) + "' ";
String sStr = array1[1];
while (sStr.endsWith(")")) {
newStr += ")";
sStr = sStr.substring(0, sStr.length() - 1);
}
sJboWhere = sJboWhere.replace(orStr, newStr);
newStr = array1[0] + "'" + paramMap.get(sKey.trim().replaceAll("like", "").trim()) + "' ".trim();
} else if (sKey.contains(" in ") || sKey.contains(" IN ")) {
newStr = array1[0] + "'" + paramMap.get(sKey.trim().replaceAll(" in ", "").trim()) + "' ".trim();
} else {
sKey = sKey.trim();
sKey = sKey.substring(0, sKey.length() - 1);
sKey = sKey.trim();
String newStr = array1[0] + "'"
+ paramMap.get(sKey) + "' ";
String sStr = array1[1];
while (sStr.endsWith(")")) {
newStr += ")";
sStr = sStr.substring(0, sStr.length() - 1);
}
sJboWhere = sJboWhere.replace(orStr, newStr);
sKey = sKey.substring(0, sKey.length() - 1).trim();
newStr = array1[0] + "'"
+ paramMap.get(sKey) + "' ".trim();
}
String sStr = orStr.trim();
while (sStr.endsWith(")")) {
// newStr += ")";
sStr = sStr.substring(0, sStr.length()-1);
}
sJboWhere = sJboWhere.replace(sStr, newStr);
sJboWhere += " ";
}
sJboWhere = sJboWhere.substring(0, sJboWhere.length() - 1);
} else {
// O.contract_id = :contract_id
String[] array1 = str.split(":");
// O.contract_id = > 0
// contract_id> 1
} else { // ûÓÐ or
if (array1.length != 2)
continue;
if (!array1[0].contains(".")) {
String sKey = array1[0].toLowerCase();
sKey = sKey.trim();
sKey = sKey.substring(0, sKey.length() - 1);
sKey = sKey.trim();
String newStr = array1[0] + "'"
+ paramMap.get(sKey) + "' ";
String sStr = array1[1];
if (!array1[0].contains(".")) { // ûÓÐ O. xx.
sKey = array1[0].toLowerCase().trim();
newStr = "";
if (sKey.contains(" like ") || sKey.contains(" LIKE ")) { // flowUnid like : flowUnid
newStr = array1[0] + "'" + paramMap.get(sKey.replaceAll(" like ", "").trim()) + "'".trim();
} else if (sKey.contains(" in ") || sKey.contains(" IN ")) { // flowUnid in : flowUnid
newStr = array1[0] + "'" + paramMap.get(sKey.replaceAll(" in ", "").trim()) + "'".trim();
} else { // flowUnid = || > || < : flowUnid
sKey = sKey.substring(0, sKey.length() - 1).trim();
newStr = array1[0] + "'" + paramMap.get(sKey) + "' ".trim();
}
String sStr = array1[1].trim();
while (sStr.endsWith(")")) {
newStr += ")";
sStr = sStr.substring(0, sStr.length() - 1);
@ -112,19 +181,25 @@ public class AweDoCommUtil {
String[] array2 = array1[0].split("\\.");
if (array2.length < 2)
continue;
String sKey = array2[1].toLowerCase();
sKey = sKey.trim();
sKey = sKey.substring(0, sKey.length() - 1);
sKey = sKey.trim();
String newStr = array1[0] + "'"
+ paramMap.get(sKey) + "' ";
String sStr = array1[1];
while (sStr.endsWith(")")) {
newStr += ")";
sStr = sStr.substring(0, sStr.length() - 1);
sKey = array2[array2.length - 1].toLowerCase().trim();
newStr = "";
if (sKey.contains(" like ") || sKey.contains(" LIKE ")) { // flowUnid like : flowUnid
newStr = array1[0] + "'" + paramMap.get(sKey.replaceAll(" like ", "").trim()) + "'".trim();
} else if (sKey.contains(" in ") || sKey.contains(" IN ")) { // flowUnid in : flowUnid
newStr = array1[0] + "'" + paramMap.get(sKey.replaceAll(" in ", "").trim()) + "'".trim();
} else { // flowUnid = || > || < : flowUnid
sKey = sKey.substring(0, sKey.length() - 1).trim();
newStr = array1[0] + "'" + paramMap.get(sKey) + "' ".trim();
}
sJboWhere = sJboWhere.replace(str, newStr);
}
newStr = newStr.trim();
String sStr = array1[1].trim();
while (sStr.endsWith(")")) {
newStr += ")";
sStr = sStr.substring(0, sStr.length() - 1);
}
newStr = " " + newStr + " ";
sJboWhere = sJboWhere.replace(str, newStr);
}
}
return sJboWhere;

File diff suppressed because it is too large Load Diff