更新二手车车辆指导价显示不正确
This commit is contained in:
parent
289d16a769
commit
405049e8bd
@ -1,39 +1,42 @@
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
|
||||
/*
|
||||
Author: undefined 2018-06-04
|
||||
Content: 示例详情页面
|
||||
History Log:
|
||||
*/
|
||||
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
|
||||
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(sFlowUnid);
|
||||
|
||||
String sButtons[][] = {
|
||||
/* {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
|
||||
{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} */
|
||||
{"true","","Button","评估校验","评估校验","vehicleAppraisement()","","","","btn_icon_check"}
|
||||
};
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
function vehicleAppraisement(){
|
||||
var flowunid = "<%=sFlowUnid%>";
|
||||
var result = RunJavaMethodTrans("com.tenwa.lease.app.vehicleAssessment.vehicleAssessmentController","vehicleAppraisement","FlowUnid="+flowunid);
|
||||
if('SUCCESS' == result){
|
||||
alert('评估成功,数据已写入数据库中');
|
||||
location.reload();
|
||||
}else if('ERROR' == result){
|
||||
alert('评估失败');
|
||||
}else{
|
||||
alert(result);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
|
||||
/*
|
||||
Author: undefined 2018-06-04
|
||||
Content: 示例详情页面
|
||||
History Log:
|
||||
*/
|
||||
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
|
||||
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(sFlowUnid);
|
||||
|
||||
String sButtons[][] = {
|
||||
/* {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
|
||||
{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} */
|
||||
{"true","","Button","评估校验","评估校验","vehicleAppraisement()","","","","btn_icon_check"}
|
||||
};
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
function vehicleAppraisement(){
|
||||
var flowunid = "<%=sFlowUnid%>";
|
||||
var result = RunJavaMethodTrans("com.tenwa.lease.app.vehicleAssessment.vehicleAssessmentController","vehicleAppraisement","FlowUnid="+flowunid);
|
||||
if('SUCCESS' == result){
|
||||
alert('评估成功,数据已写入数据库中');
|
||||
location.reload();
|
||||
}else if('ERROR' == result){
|
||||
alert('评估失败');
|
||||
}else{
|
||||
alert(result);
|
||||
}
|
||||
}
|
||||
$(function(){
|
||||
setItemValue(0,getRow(),"NOW_TOTAL",getItemValue(0,getRow(),"NOW_TOTAL")/10000);
|
||||
})
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -76,7 +76,7 @@
|
||||
}
|
||||
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
|
||||
if(null!=ishistory&&ishistory.equals("true")&&(!"起租后合同基本信息变更(汽车)".equals(flowName))){
|
||||
doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据
|
||||
// doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据
|
||||
}
|
||||
doTemp.setDefaultValue("equip_type", sEquipType);
|
||||
CurPage.getCurComp().setAttribute("RightType", null);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -137,20 +137,20 @@ public class FileTemplateUtil {
|
||||
}
|
||||
|
||||
public String getContractClass(Transaction Sqlca){
|
||||
if("BAIC_MOTOR".equals(operationType)){
|
||||
if("BAIC_MOTOR".equals(operationType)){//北汽财务
|
||||
if("01".equals(leasform)){
|
||||
return "[{'fileTemplate':\""+"[{'text':'合同(直租)','value':'b20b919c6144480b9466e4ea9b0da142'}]"+"\"}]";
|
||||
}else{
|
||||
return "[{'fileTemplate':\""+"[{'text':'合同(售后回租)','value':'115905186577406ea5414dd14e592e7d'}]"+"\"}]";
|
||||
}
|
||||
}else if ("DYCD".equals(operationType)){
|
||||
}else if ("DYCD".equals(operationType)){//第一车贷
|
||||
return "[{'fileTemplate':\""+"[{'text':'合同(售后回租)','value':'8d4232a5423e491ca905e77c54105a85'}]"+"\"}]";
|
||||
}else if ("ZYC".equals(operationType)){
|
||||
}else if ("ZYC".equals(operationType)){//专用车产品
|
||||
return "[{'fileTemplate':\""+"[{'text':'合同(售后回租)','value':'35aab6dbac5f4ba292cd67a0914eae2e'}]"+"\"}]";
|
||||
}else if ("KJZL".equals(operationType)){
|
||||
}else if ("KJZL".equals(operationType)){//凯捷租赁
|
||||
return "[{'fileTemplate':\""+"[{'text':'合同(售后回租)_凯捷','value':'a4fcbd2990d1479a9ba8ce440155f2f0'}]"+"\"}]";
|
||||
}else{
|
||||
if("01".equals(leasform)){
|
||||
if("01".equals(leasform)){//直租
|
||||
/*return "[{'fileTemplate':\""+"[{'text':'融资租赁合同-C端直租','value':'24aba365e2794a018814ae81341486bf'},"
|
||||
+ "{'text':'直租个人授权协议书','value':'3334eed6051248b88cd4f2a22e93ac96'},]"+"\"}]";*/
|
||||
return "[{'fileTemplate':\""+"[{'text':'合同(直租)','value':'24aba365e2794a018814ae81341486bf'}]"+"\"}]";
|
||||
|
||||
@ -1,132 +1,134 @@
|
||||
package com.tenwa.lease.app.vehicleAssessment;
|
||||
/**
|
||||
* 二手车评估
|
||||
* @author 张磊
|
||||
*/
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import jbo.app.LB_EQUIPMENT_CAR_TEMP;
|
||||
import jbo.sys.CODE_LIBRARY;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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 FlowUnid;
|
||||
|
||||
private Logger logger = Logger.getLogger(this.getClass());
|
||||
|
||||
|
||||
public String getFlowUnid() {
|
||||
return FlowUnid;
|
||||
}
|
||||
|
||||
public void setFlowUnid(String flowUnid) {
|
||||
FlowUnid = flowUnid;
|
||||
}
|
||||
|
||||
public String vehicleAppraisement(JBOTransaction tx){
|
||||
try {
|
||||
BizObjectManager bomLSNT = JBOFactory.getBizObjectManager(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME,tx);
|
||||
BizObjectManager codeSNT = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME,tx);
|
||||
if(bomLSNT != null){
|
||||
BizObject boLSNT = bomLSNT.createQuery("flowunid=:FLOWUNID").setParameter("FLOWUNID",FlowUnid).getSingleResult(true);
|
||||
//获取车型ID
|
||||
String modelId = boLSNT.getAttribute("modelId").getString();
|
||||
//获取用户选择的所属地区
|
||||
//天津天津市河东区
|
||||
String area = boLSNT.getAttribute("zone").getString();
|
||||
if(area.indexOf("上海") != -1){
|
||||
area = "上海上海市";
|
||||
}else if(area.indexOf("重庆") != -1){
|
||||
area = "重庆重庆市";
|
||||
}else if(area.indexOf("北京") != -1){
|
||||
area = "北京北京市";
|
||||
}else if(area.indexOf("天津") != -1){
|
||||
//area = "天津市市辖区";
|
||||
area = "天津天津市";
|
||||
}else if(area.indexOf("地区") != -1){
|
||||
area = area.substring(0,area.indexOf("地区")+2);
|
||||
}else if(area.indexOf("市") != -1){
|
||||
area = area.substring(0,area.indexOf("市")+1);
|
||||
}else if(area.indexOf("区") != -1){
|
||||
area = area.substring(0,area.indexOf("区")+1);
|
||||
}else if(area.indexOf("自治州") != -1){
|
||||
area = area.substring(0,area.indexOf("自治州")+3);
|
||||
}else if(area.indexOf("自治县") != -1){
|
||||
area = area.substring(0,area.indexOf("自治县")+3);
|
||||
}else if(area.indexOf("县") != -1){
|
||||
area = area.substring(0,area.indexOf("县")+1);
|
||||
}else if(area.indexOf("盟") != -1){
|
||||
area = area.substring(0,area.indexOf("盟")+1);
|
||||
}
|
||||
else{
|
||||
return "请返回租赁车辆基本信息页面填写地区!";
|
||||
}
|
||||
//到数据字典中查询对应的行政编号作为接口入参的zone参数
|
||||
String zone = "";
|
||||
if(codeSNT != null){
|
||||
BizObject zoneResult = codeSNT.createQuery("select itemname,itemno FROM O WHERE codeno='AreaCode' AND itemname=:AREA")
|
||||
.setParameter("AREA",area).getSingleResult(false);
|
||||
if(zoneResult != null){
|
||||
zone = zoneResult.getAttribute("itemno").getString();
|
||||
}
|
||||
}
|
||||
//因为从数据库获取到的上牌日期的格式不满足接口需求,所以要利用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();
|
||||
if(mile == null || regDate == null || zone == null){
|
||||
return "请到租赁车辆基本信息页面完善相关信息!";
|
||||
}
|
||||
//得到Car300接口返回的Json数据
|
||||
String responseResult = VehicleAppraisementUtil.getVehicleAppraisementResponse(modelId, zone, regDate, mile);
|
||||
//String responseResult = ReadJSON.ReadFile("D://che300new.txt");
|
||||
JSONObject object = JSONObject.parseObject(responseResult);
|
||||
String status = object.get("status").toString();
|
||||
//提取出Json数据中的status属性(1:成功;0:失败)并判断,如果为0,则将出错原因返回到前台
|
||||
if("0".equals(status)){
|
||||
String errormsg = object.getString("error_msg");
|
||||
return "评估失败,原因为:"+errormsg;
|
||||
}
|
||||
boLSNT.setAttributeValue("discharge_standard", object.get("discharge_standard").toString());
|
||||
boLSNT.setAttributeValue("NOW_TOTAL", object.get("model_price").toString());
|
||||
boLSNT.setAttributeValue("detail_report_url", object.get("detail_report_url").toString());
|
||||
//将Json字符串中的数组数据部分转换为Json数组
|
||||
@SuppressWarnings("rawtypes")
|
||||
List<HashMap> list = JSONArray.parseArray(JSON.toJSONString(object.get("eval_prices")),HashMap.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";
|
||||
}
|
||||
}
|
||||
package com.tenwa.lease.app.vehicleAssessment;
|
||||
/**
|
||||
* 二手车评估
|
||||
* @author 张磊
|
||||
*/
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import jbo.app.LB_EQUIPMENT_CAR_TEMP;
|
||||
import jbo.sys.CODE_LIBRARY;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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 FlowUnid;
|
||||
|
||||
private Logger logger = Logger.getLogger(this.getClass());
|
||||
|
||||
|
||||
public String getFlowUnid() {
|
||||
return FlowUnid;
|
||||
}
|
||||
|
||||
public void setFlowUnid(String flowUnid) {
|
||||
FlowUnid = flowUnid;
|
||||
}
|
||||
|
||||
public String vehicleAppraisement(JBOTransaction tx){
|
||||
try {
|
||||
BizObjectManager bomLSNT = JBOFactory.getBizObjectManager(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME,tx);
|
||||
BizObjectManager codeSNT = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME,tx);
|
||||
if(bomLSNT != null){
|
||||
BizObject boLSNT = bomLSNT.createQuery("flowunid=:FLOWUNID").setParameter("FLOWUNID",FlowUnid).getSingleResult(true);
|
||||
//获取车型ID
|
||||
String modelId = boLSNT.getAttribute("modelId").getString();
|
||||
//获取用户选择的所属地区
|
||||
//天津天津市河东区
|
||||
String area = boLSNT.getAttribute("zone").getString();
|
||||
if(area.indexOf("上海") != -1){
|
||||
area = "上海上海市";
|
||||
}else if(area.indexOf("重庆") != -1){
|
||||
area = "重庆重庆市";
|
||||
}else if(area.indexOf("北京") != -1){
|
||||
area = "北京北京市";
|
||||
}else if(area.indexOf("天津") != -1){
|
||||
//area = "天津市市辖区";
|
||||
area = "天津天津市";
|
||||
}else if(area.indexOf("地区") != -1){
|
||||
area = area.substring(0,area.indexOf("地区")+2);
|
||||
}else if(area.indexOf("市") != -1){
|
||||
area = area.substring(0,area.indexOf("市")+1);
|
||||
}else if(area.indexOf("区") != -1){
|
||||
area = area.substring(0,area.indexOf("区")+1);
|
||||
}else if(area.indexOf("自治州") != -1){
|
||||
area = area.substring(0,area.indexOf("自治州")+3);
|
||||
}else if(area.indexOf("自治县") != -1){
|
||||
area = area.substring(0,area.indexOf("自治县")+3);
|
||||
}else if(area.indexOf("县") != -1){
|
||||
area = area.substring(0,area.indexOf("县")+1);
|
||||
}else if(area.indexOf("盟") != -1){
|
||||
area = area.substring(0,area.indexOf("盟")+1);
|
||||
}
|
||||
else{
|
||||
return "请返回租赁车辆基本信息页面填写地区!";
|
||||
}
|
||||
//到数据字典中查询对应的行政编号作为接口入参的zone参数
|
||||
String zone = "";
|
||||
if(codeSNT != null){
|
||||
BizObject zoneResult = codeSNT.createQuery("select itemname,itemno FROM O WHERE codeno='AreaCode' AND itemname=:AREA")
|
||||
.setParameter("AREA",area).getSingleResult(false);
|
||||
if(zoneResult != null){
|
||||
zone = zoneResult.getAttribute("itemno").getString();
|
||||
}
|
||||
}
|
||||
//因为从数据库获取到的上牌日期的格式不满足接口需求,所以要利用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();
|
||||
if(mile == null || regDate == null || zone == null){
|
||||
return "请到租赁车辆基本信息页面完善相关信息!";
|
||||
}
|
||||
//得到Car300接口返回的Json数据
|
||||
String responseResult = VehicleAppraisementUtil.getVehicleAppraisementResponse(modelId, zone, regDate, mile);
|
||||
//String responseResult = ReadJSON.ReadFile("D://che300new.txt");
|
||||
JSONObject object = JSONObject.parseObject(responseResult);
|
||||
String status = object.get("status").toString();
|
||||
//提取出Json数据中的status属性(1:成功;0:失败)并判断,如果为0,则将出错原因返回到前台
|
||||
if("0".equals(status)){
|
||||
String errormsg = object.getString("error_msg");
|
||||
return "评估失败,原因为:"+errormsg;
|
||||
}
|
||||
BigDecimal model_price = new BigDecimal(object.get("model_price").toString());
|
||||
boLSNT.setAttributeValue("discharge_standard", object.get("discharge_standard").toString());
|
||||
boLSNT.setAttributeValue("NOW_TOTAL", model_price.multiply(new BigDecimal(10000)));
|
||||
boLSNT.setAttributeValue("detail_report_url", object.get("detail_report_url").toString());
|
||||
//将Json字符串中的数组数据部分转换为Json数组
|
||||
@SuppressWarnings("rawtypes")
|
||||
List<HashMap> list = JSONArray.parseArray(JSON.toJSONString(object.get("eval_prices")),HashMap.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";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user