中瑞gps动态获取产品Id

This commit is contained in:
gityjf 2020-11-03 10:04:04 +08:00
parent 78ad12752d
commit ec92a80167
4 changed files with 63 additions and 18 deletions

View File

@ -69,6 +69,10 @@
setItemValue(0,getRow(0),"APPLY_NO",'<%=ProjectNo%>');
setItemValue(0,getRow(0),"WIRED_PERIOD",'<%=period%>');
setItemValue(0,getRow(0),"WIRELESS_PERIOD",'<%=period%>');
if('<%=source%>'=='1'){
setItemValue(0,getRow(0),"WIRED_NUM",'1');
setItemValue(0,getRow(0),"WIRELESS_NUM",'1');
}
setItemValue(0,getRow(0),"FLOWUNID",'<%=flowunid%>');
setItemValue(0,getRow(0),"PROJECT_ID",'<%=ProjectId%>');
setItemValue(0,getRow(0),"INPUTUSERID",'<%=CurUser.getUserID()%>');

View File

@ -4,13 +4,19 @@ TYsign=3474A2D7CFEC5DECD54DE8A263F7A4A9
TYsign2=3474a2d7cfec5decd54de8a263f7a4a9
TYUrl=http://121.43.178.183:9989/dispatch_intf/apiController/order
TYQueryOrderToVin=http://121.43.178.183:80/gps-intf/api2/getGpsInfosByCarVin
# \u4E2D\u745EProductId
ZR_ProfuctId=d5e89c74-6014-11e9-bdb3-6c92bf61e2
# \u4E2D\u745EappKey
# 中瑞ProductId
ZR_ProfuctId_one=d5e89c74-6014-11e9-bdb3-6c92bf61e2
ZR_ProfuctId_two=d5e89c74-6014-11e9-bdb3-6c92bf61e2
ZR_ProfuctId_three=d5e89c74-6014-11e9-bdb3-6c92bf61e2
ZR_ProfuctId_four=d5e89c74-6014-11e9-bdb3-6c92bf61e2
ZR_ProfuctId_five=d5e89c74-6014-11e9-bdb3-6c92bf61e2
# 中瑞appKey
ZR_AppKey=2C6074D0-C8E4-4BA4-A50A-E3A46EAD394A
# \u65b0\u589e\u5de5\u5355
# 中瑞下单
ZR_create_url=http://gatewayapi.lunztech.cn/api/ApiPlat/AddOrderWithVpsInfos
# \u67e5\u8be2\u5de5\u5355
# 中瑞根据车架号查询定位信息
ZR_query_url=http://gatewayapi.lunztech.cn/api/ApiPlat/GetAllEqPositionsByVIN
# \u53d6\u6d88\u5de5\u5355
# 中瑞取消订单
ZR_cancel_url=http://gatewayapi.lunztech.cn/api/ApiPlat/CancelVpsAddOrder

View File

@ -1,9 +1,12 @@
package com.tenwa.gps;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.exception.BusinessException;
import com.tenwa.httpclient.resources.GPSConfigure;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@ -199,11 +202,11 @@ public class GpsCommon {
* @throws Exception
*/
public static String zrEditCreateParameter(String applyNo, Transaction Sqlca) throws Exception {
ASResultSet res = Sqlca.getASResultSet(new SqlObject("select CAR_VIN,ADDRESS_CODE,SHOPNAME,CONTACT_NAME,CONTACT_PHONE,INSTALL_TIME,ADDRESS_DETAIL,CARTYPE,USERNAME,USERPHONE from LM_GPS_ORDER_TEMP where APPLY_NO='" + applyNo + "'"));
ASResultSet res = Sqlca.getASResultSet(new SqlObject("select WIRED_PERIOD,CAR_VIN,ADDRESS_CODE,SHOPNAME,CONTACT_NAME,CONTACT_PHONE,INSTALL_TIME,ADDRESS_DETAIL,CARTYPE,USERNAME,USERPHONE from LM_GPS_ORDER_TEMP where APPLY_NO='" + applyNo + "'"));
JSONObject params = new JSONObject();
while (res.next()) {
params.put("AppCode", applyNo);
params.put("ProductId", GPSConfigure.get("ZR_ProfuctId"));
params.put("ProductId", getProductId(res.getInt("WIRED_PERIOD")));
params.put("VIN", res.getString("CAR_VIN"));
params.put("DistrictCode", res.getString("ADDRESS_CODE"));
params.put("ShopName", res.getString("SHOPNAME"));
@ -219,6 +222,31 @@ public class GpsCommon {
return params.toString();
}
/**
* 根据安装年限选着产品中瑞
* @param period
* @return
*/
private static String getProductId(Integer period) throws Exception{
if(period > 5 || period < 1)
throw new BusinessException("gps安装年限不合法!");
String productId = null;
switch (period){
case 1:
productId = GPSConfigure.get("ZR_ProfuctId_one"); break;
case 2:
productId = GPSConfigure.get("ZR_ProfuctId_two"); break;
case 3:
productId = GPSConfigure.get("ZR_ProfuctId_three"); break;
case 4:
productId = GPSConfigure.get("ZR_ProfuctId_four"); break;
case 5:
productId = GPSConfigure.get("ZR_ProfuctId_five"); break;
}
return productId;
}
/**
* 中瑞--车架号查询工单请求参数
*
@ -247,24 +275,31 @@ public class GpsCommon {
if (i > 0) {
sb.append(",");
}
insertVal = "replace(uuid(),'-',''),'" + job.getString("appcode") + "','"+job.getString("flag")+"','" + job.getString("sbcstatus") + "'"
insertVal = "replace(uuid(),'-',''),'" + job.getString("appcode") + "','" + job.getString("flag") + "','" + job.getString("sbcstatus") + "'"
+ ",'" + job.getString("imei") + "','" + job.getString("vin") + "','" + job.getString("locationTime") + "'"
+ ",'" + job.getString("lng") + "','" + job.getString("lat") + "','" + job.getString("LocateMode") + "',date_format(now(),'%Y/%m/%d %H:%i:%s')";
sb.append("(").append(insertVal).append(")");
}
if (insertVal != null) Sqlca.executeSQL(sb.toString());
if (startUsing)Sqlca.executeSQL("update LM_GPS_ORDER_TEMP set RESULT='0',STATUS='3',MESSAGE='²éѯ³É¹¦' where CAR_VIN='" + vin + "'");
if (startUsing)
Sqlca.executeSQL("update LM_GPS_ORDER_TEMP set RESULT='0',STATUS='3',MESSAGE='查询成功' where CAR_VIN='" + vin + "'");
return startUsing;
}
/**
* 调用日志
*
* @return
* @throws Exception
*/
public static void callRecord(Map<String, String> params, Transaction Sqlca) throws Exception {
Sqlca.executeSQL(" insert into lm_gps_log values(replace(uuid(),\"-\",\"\"),'" + params.get("UPLOAD_PARAMETER") + "','" + params.get("RETURN_PARAMETER") + "',DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'" + params.get("CALL_USERID") + "','" + params.get("FLOWUNID") + "','" + params.get("PROJECT_ID") + "','" + params.get("URL") + "','" + params.get("CALL_PURPOSE") + "','" + params.get("CALL_STATUS") + "')");
public static void callRecord(Map<String, String> params) throws Exception {
JBOTransaction tx = null;
try {
tx = JBOFactory.createJBOTransaction();
Transaction Sqlca = Transaction.createTransaction(tx);
Sqlca.executeSQL(" insert into lm_gps_log values(replace(uuid(),\"-\",\"\"),'" + params.get("UPLOAD_PARAMETER") + "','" + params.get("RETURN_PARAMETER") + "',DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'" + params.get("CALL_USERID") + "','" + params.get("FLOWUNID") + "','" + params.get("PROJECT_ID") + "','" + params.get("URL") + "','" + params.get("CALL_PURPOSE") + "','" + params.get("CALL_STATUS") + "')");
} finally {
if (tx != null) tx.commit();
}
}
}

View File

@ -65,7 +65,7 @@ public class GpsController {
logMap.put("CALL_PURPOSE", tips + "--新增工单");
logMap.put("CALL_STATUS", resultMap.get("status"));//http请求状态
//添加日志记录
GpsCommon.callRecord(logMap, Sqlca);
GpsCommon.callRecord(logMap);
JSONObject job = JSONObject.fromObject(data);
String result = null;
boolean orderStatus = false;//订单是否成功状态
@ -145,7 +145,7 @@ public class GpsController {
logMap.put("PROJECT_ID", projectId);
logMap.put("CALL_PURPOSE", tips + "--取消工单");
logMap.put("CALL_STATUS", resultMap.get("status"));
GpsCommon.callRecord(logMap, Sqlca);
GpsCommon.callRecord(logMap);
JSONObject job = JSONObject.fromObject(data);
String result = null;
@ -220,7 +220,7 @@ public class GpsController {
logMap.put("PROJECT_ID", projectId);
logMap.put("CALL_PURPOSE", tips + "--根据车架号查询工单");
logMap.put("CALL_STATUS", resultMap.get("status"));
GpsCommon.callRecord(logMap, Sqlca);
GpsCommon.callRecord(logMap);
if (GpsEnum.ZR.getCode().equals(source)) {
return GpsCommon.zrQueryToVinDataPersistence(data, vin, Sqlca);
}
@ -264,7 +264,7 @@ public class GpsController {
logMap.put("PROJECT_ID", projectId);
logMap.put("CALL_PURPOSE", "天易--根据申请编号查询工单");
logMap.put("CALL_STATUS", resultMap.get("status"));
GpsCommon.callRecord(logMap, Sqlca);
GpsCommon.callRecord(logMap);
String result1 = GpsCommon.tyQueryDataPersistence(data, applyNo, tableName, Sqlca);
String result2 = queryOrderToVin(Sqlca) == true ? "查询成功!" : "查询失败!";
@ -300,7 +300,7 @@ public class GpsController {
logMap.put("PROJECT_ID", projectId);
logMap.put("CALL_PURPOSE", "天易--修改工单");
logMap.put("CALL_STATUS", resultMap.get("status"));
GpsCommon.callRecord(logMap, Sqlca);
GpsCommon.callRecord(logMap);
JSONObject job = JSONObject.fromObject(data);
String result = job.getString("result");