Merge branch 'develop' of

http://git2.tenwa.com.cn/ApzlDev/apzl_leasing.git into zhuhuichen

Conflicts:
	WebContent/WEB-INF/etc/jbo/jbo_app.xml
This commit is contained in:
user 2018-06-07 21:40:15 +08:00
commit be6d4857e7
16 changed files with 782 additions and 589 deletions

View File

@ -7,5 +7,5 @@
<updateXml>true</updateXml>
<warLocation></warLocation>
<extraInfo></extraInfo>
<webPath>/apzl_leasing</webPath>
<webPath>/apzl</webPath>
</tomcatProjectProperties>

View File

@ -0,0 +1,30 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
/*
Author: undefined 2018-06-04
Content: 示例详情页面
History Log:
*/
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/App/Interface/VehicleEvaluation/LBEquipmentCarTempList.jsp";
String sTempletNo = "LBEquipmentCarTempInfo";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
doTemp.setColTips("", "测试");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
//dwTemp.ReadOnly = "-2";//只读模式
dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID"));
String sButtons[][] = {
{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""}
};
sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
function returnList(){
AsControl.OpenView("<%=sPrevUrl%>", "","_self","");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,50 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2018-06-04
Content:
History Log:
*/
ASObjectModel doTemp = new ASObjectModel("LBEquipmentCarTempList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""},
{"true","","Button","估值","估值"," vehicleAppraisement()","","","","btn_icon_check",""}
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function vehicleAppraisement(){
var id = getItemValue(0,getRow(0),'ID');
console.log(id);
var result = RunJavaMethodTrans("com.tenwa.lease.app.vehicleAssessment.vehicleAssessmentController","vehicleAppraisement","id="+id);
if('SUCCESS' == result){
alert('评估成功,数据已写入数据库中');
}else if('0' == result){
alert(result);
}else{
alert('评估失败');
}
}
function newRecord(){
var sUrl = "/Tenwa/Lease/App/Interface/VehicleEvaluation/LBEquipmentCarTempInfo.jsp";
AsControl.OpenView(sUrl,'','_self','');
}
function viewAndEdit(){
var sUrl = "/Tenwa/Lease/App/Interface/VehicleEvaluation/LBEquipmentCarTempInfo.jsp";
var sPara = getItemValue(0,getRow(0),'ID');
if(typeof(sPara)=="undefined" || sPara.length==0 ){
alert("参数不能为空!");
return ;
}
AsControl.OpenView(sUrl,'ID=' +sPara ,'_self','');
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -24,12 +24,10 @@
alert("ÇëÑ¡Ôñ·¢ËÍÈÕÆÚ£¡");
return false;
}
/*
var fparams="payment_number="+'<%=CurPage.getParameter("payment_number")%>'+",senddate="+senddate+",contractlist=<%=CurPage.getParameter("contractlist")%>"+",inputuserid=<%=inputuserid%>"+",inputorgid=<%=inputorgid%>,userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>";
var sReturnInfo = RunJavaMethodTrans("com.amarsoft.app.lc.reminder.GeneratedReminderLetterAction","saveGeneratedReminderLetter",fparams);
*/
AsDialog.ClosePage(senddate);
}
</script>
<%@ include file="/IncludeEnd.jsp"%>

View File

@ -11,9 +11,9 @@
<cache name="错误代码信息" loadClass="com.amarsoft.dict.als.cache.loader.ErrMsgLoader"/>
<cache name="ObjectWindow缓存" loadClass="com.amarsoft.dict.als.cache.loader.AWEDataWindowLoader" size="50" expireTime="1200"/>
<cache name="JBO关联对象缓存" loadClass="com.amarsoft.asquery.JBORelatedObjLoader"/>
<!--
<cache name="APP_CODE缓存" loadClass="apx.com.amarsoft.als.base.constant.cache.loader.AppCodeLoader"/>
<cache name="APP_DO缓存" loadClass="apx.com.amarsoft.als.base.constant.cache.loader.AppAweDoLoader" size="10000" />
<!--
<cache name="SYSCONF_CLTYPE" loadClass="com.amarsoft.app.creditline.cache.loader.CreditLineTypeDefinitionLoader"/>额度类型信息
<cache name="SYSCONF_LIMITATIONTYPE" loadClass="com.amarsoft.app.creditline.cache.loader.LimitationTypeDefinitionLoader"/>额度限制类型信息
<cache name="SYSCONF_CL_ERROR_TYPE" loadClass="com.amarsoft.app.creditline.cache.loader.ErrorTypeDefinitionLoader"/>额度异常点类型信息

View File

@ -1,4 +1,4 @@
org.quartz.dataSource.zhulhDS.URL=jdbc:mysql://localhost:3306/apzl?rewriteBatchedStatements=true&useUnicode=true&amp;characterEncoding=GBK&amp;autoReconnect=true
org.quartz.dataSource.zhulhDS.URL=jdbc:mysql://119.3.11.192:3306/apzl?rewriteBatchedStatements=true&useUnicode=true&amp;characterEncoding=GBK&amp;autoReconnect=true
#tel6
#org.quartz.dataSource.zhulhDS.user=2sHTLrRv8sRxxaX7RrjfKQ==
#tel6_123

View File

@ -0,0 +1,80 @@
package com.tenwa.lease.app.vehicleAssessment;
/**
* 二手车评估
* @author 张磊
*/
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Logger;
import jbo.app.LB_EQUIPMENT_CAR_TEMP;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.tenwa.lease.util.VehicleAppraisementUtil;
public class vehicleAssessmentController {
private String id;
private Logger logger = Logger.getLogger(this.getClass());
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String vehicleAppraisement(JBOTransaction tx){
String result = null;
try {
BizObjectManager bomLSNT = JBOFactory.getBizObjectManager(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME,tx);
BizObject boLSNT = bomLSNT.createQuery("ID=:ID").setParameter("ID",id).getSingleResult(false);
//获取车型ID
String modelId = boLSNT.getAttribute("modelId").toString();
//获取地区编号
String zone = boLSNT.getAttribute("zone").toString();
//因为从数据库获取到的上牌日期的格式不满足接口需求,所以要利用SimpleDateFormat进行变换
Date date = new SimpleDateFormat("yyyy/MM/dd").parse(boLSNT.getAttribute("regDate").toString());
String regDate = new SimpleDateFormat("yyyy-MM-dd").format(date);
//获取车辆行驶里程
String mile = boLSNT.getAttribute("mile").toString();
//得到Car300接口返回的Json数据
String responseResult = VehicleAppraisementUtil.getVehicleAppraisementResponse(modelId, zone, regDate, mile);
JSONObject object = JSONObject.parseObject(responseResult);
boLSNT.setAttributeValue("discharge_standard", object.get("discharge_standard").toString());
boLSNT.setAttributeValue("detail_report_url", object.get("detail_report_url").toString());
//提取出Json数据中的status属性(1:成功;0:失败)并判断,如果为0,则将出错原因返回到前台
String status = object.get("status").toString();
if(status == "0"){
result = object.getString("error_msg").toString();
return result;
}
//将Json字符串中的数组数据部分转换为Json数组
List<ConcurrentHashMap> list = JSONArray.parseArray((String)object.get("eval_prices"),ConcurrentHashMap.class);
//遍历Json数组并将对应字段的数据加入到数据库中
for(int i=0;i<list.size();i++){
String condition = list.get(i).get("condition").toString();
boLSNT.setAttributeValue(condition+"_dealer_low_buy_price",list.get(i).get("dealer_low_buy_price"));
boLSNT.setAttributeValue(condition+"_dealer_buy_price",list.get(i).get("dealer_low_buy_price"));
boLSNT.setAttributeValue(condition+"_individual_low_sold_price",list.get(i).get("individual_low_sold_price"));
boLSNT.setAttributeValue(condition+"_individual_price",list.get(i).get("individual_price"));
boLSNT.setAttributeValue(condition+"_dealer_low_sold_price", list.get(i).get("dealer_low_sold_price"));
boLSNT.setAttributeValue(condition+"_dealer_price",list.get(i).get("dealer_price"));
boLSNT.setAttributeValue(condition+"_dealer_high_sold_price", list.get(i).get("dealer_high_sold_price"));
}
bomLSNT.saveObject(boLSNT);
} catch (Exception e) {
e.printStackTrace();
logger.error("执行车辆评估操作失败", e);
return "ERROR";
}
return "SUCCESS";
}
}

View File

@ -0,0 +1,56 @@
package com.tenwa.lease.util;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class VehicleAppraisementUtil {
public static String getVehicleAppraisementResponse(String modelId,String zone,String regDate,String mile){
String urlStr = "https://api.che300.com/service/getUsedCarPrice?"
+"token=ee450692cbd24e8bacb27b6f46b4d752&modelId="+modelId
+"&regDate="+regDate+"&mile="+mile+"&zone="+zone+"";
String result = VehicleAppraisementUtil.getResponseResult(urlStr);
return result;
}
//通过请求url返回Json数据
public static String getResponseResult (String url){
String line = "";
String httpResponseResult = "";
try {
HttpURLConnection connection = VehicleAppraisementUtil.getURLConnection(url);
connection.setReadTimeout(5000);
connection.setConnectTimeout(5000);
connection.connect();
BufferedReader reader = new BufferedReader(
new InputStreamReader(
connection.getInputStream(),"utf-8"));
while ((line = reader.readLine()) != null) {
httpResponseResult += line.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return httpResponseResult;
}
//获取请求需要的HttpURLConnection连接
public static HttpURLConnection getURLConnection(String url){
HttpURLConnection connection = null;
try {
URL newUrl = new URL(url);
connection = (HttpURLConnection) newUrl.openConnection();
connection.setDoOutput(false);//post请求应改为true
connection.setDoInput(true);
connection.setRequestMethod("GET");
connection.setUseCaches(false);
connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Charset", "utf-8");
connection.setRequestProperty("Accept-Charset", "utf-8");
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}
}

File diff suppressed because it is too large Load Diff