+385
-99
@@ -1,154 +1,424 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.BeanUtils;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.mongo.model.CzbankSampleLog;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
import com.fangjia.open.interceptors.Role;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.CzbankSampleModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.open.util.EvaluationFactorUtil;
|
||||
import com.fangjia.open.ws.query.CollateralSampleQuery;
|
||||
import com.fangjia.open.ws.query.EvaluationQuery;
|
||||
import com.fangjia.service.api.AddressMatchProxyService;
|
||||
import com.fangjia.service.bo.Collateral;
|
||||
import com.fangjia.service.bo.EvaluationResult;
|
||||
import com.fangjia.service.bo.Sample;
|
||||
import com.fangjia.service.datastore.CzbankSampleService;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.datastore.EvaluationService;
|
||||
import com.fangjia.service.datastore.bean.CollateralSampleQueryBean;
|
||||
import com.fangjia.service.mongo.fangjia.CzbankSampleLogService;
|
||||
import com.fangjia.service.open.FangjiaOfficialAreaService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import net.sf.json.JsonConfig;
|
||||
import net.sf.json.util.PropertyFilter;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.cxf.interceptor.Fault;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 浙商银行风险缓释项目接口
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public class CzbankController {
|
||||
|
||||
|
||||
private CzbankSampleService czbankSampleService;
|
||||
private DistrictService districtService;
|
||||
private CzbankSampleLogService czbankSampleLogService;
|
||||
private FangjiaOfficialAreaService fangjiaOfficialAreaService;
|
||||
private AddressMatchProxyService addressMatchProxyService;
|
||||
private EvaluationService evaluationService;
|
||||
|
||||
private List<String> PROPERTY_TYPE_CODE_LIST = Arrays.asList("01", "02");
|
||||
|
||||
|
||||
/**
|
||||
* 样本查询接口
|
||||
* @param request
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object sampleAction(HttpServletRequest request){
|
||||
@Authority(role = Role.USER)
|
||||
public Object sampleAction(CzbankSampleModel model){
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
List<CollateralSampleQueryBean> queryBeans = null;
|
||||
try {
|
||||
queryBeans = parseParams(request);
|
||||
} catch (Exception e) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel(e.getMessage()));
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
if(StringUtils.isBlank(model.getCltNo())){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("cltNo押品编号不能为空"));
|
||||
return mav;
|
||||
}
|
||||
if(queryBeans == null || queryBeans.isEmpty()){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数无效"));
|
||||
|
||||
if (StringUtils.isBlank(model.getProvince()) ||StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getDistrict())
|
||||
|| StringUtils.isBlank(model.getBuildingName()) || StringUtils.isBlank(model.getPropertyTypeCode())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数缺失:province(省),city(城市),district(区域),buildingName(名称),propertyTypeCode(物业类型编码)是必须参数"));
|
||||
return mav;
|
||||
}
|
||||
String paramMax = request.getParameter("max");
|
||||
if(StringUtils.isBlank(paramMax) || !StringUtils.isNumeric(paramMax)){
|
||||
paramMax = "5";
|
||||
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(model.getDistrict());
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjiaCity(model.getDistrict());
|
||||
}
|
||||
int max = Integer.valueOf(paramMax);
|
||||
if(max < 1 || max > 20){
|
||||
max = 5;
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地区信息无法映射到房价网的地区信息->(province:" + model.getProvince() + " ,city: " + model.getCity() + " ,district: " + model.getDistrict() + ")"));
|
||||
return mav;
|
||||
}
|
||||
List<Collateral> collateralList = czbankSampleService.findSample(queryBeans, max);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(collateralList));
|
||||
|
||||
|
||||
|
||||
String propertyTypeCode = model.getPropertyTypeCode();
|
||||
if(StringUtils.isBlank(propertyTypeCode)){
|
||||
propertyTypeCode = "01";
|
||||
}
|
||||
if(!PROPERTY_TYPE_CODE_LIST.contains(propertyTypeCode)){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("propertyTypeCode取值非法"));
|
||||
return mav;
|
||||
}
|
||||
if(model.getStrctureArea() <= 0){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("strctureArea取值非法"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
if (model.getFloorNumber() != null && (model.getFloorNumber() <= 0 || model.getFloorNumber() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floorNumber,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (model.getAboveFloorAmount() != null && (model.getAboveFloorAmount() <= 0 || model.getAboveFloorAmount() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floorAmount,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (model.getAboveFloorAmount() != null && model.getAboveFloorAmount() != null && model.getFloorNumber()> model.getAboveFloorAmount()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Integer decrCondCode = model.getDecrCondCode();
|
||||
if(decrCondCode == null){
|
||||
decrCondCode = 2;
|
||||
}
|
||||
if(decrCondCode > 5 || decrCondCode < 1){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("decrCondCode取值非法"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Integer towardDirectCode = model.getTowardDirectCode();
|
||||
if(towardDirectCode == null || towardDirectCode == 0){
|
||||
towardDirectCode = 3;
|
||||
}
|
||||
if(towardDirectCode > 10 || towardDirectCode < 1){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("towardDirectCode取值非法"));
|
||||
return mav;
|
||||
}
|
||||
CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean();
|
||||
BeanUtils.copyProperties(model, queryBean);
|
||||
queryBean.setFangjiaCity(fangjiaOfficialAreaMap.getFangjiaCity());
|
||||
queryBean.setFangjiaDistrict(fangjiaOfficialAreaMap.getFangjiaDistrict());
|
||||
|
||||
District property = districtService.findByNameAndAlias(queryBean.getFangjiaCity(), queryBean.getFangjiaDistrict(), model.getBuildingName(), "district");
|
||||
if(property == null){
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("city", queryBean.getFangjiaCity());
|
||||
params.put("suggestDistrict", queryBean.getFangjiaDistrict());
|
||||
if(StringUtils.isBlank(queryBean.getAddress())){
|
||||
params.put("address", model.getBuildingName());
|
||||
}else{
|
||||
params.put("address", queryBean.getAddress());
|
||||
params.put("suggestName", model.getBuildingName());
|
||||
}
|
||||
params.put("category", "district");
|
||||
String result = addressMatchProxyService.parser(params);
|
||||
if (result != null) {
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
if(json.getInt("code")==200){
|
||||
Map<String, Object> map = (Map<String, Object>) json.get("result");
|
||||
if((Integer)map.get("precise")>=0){
|
||||
property = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name"), "district");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(property == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该楼盘不存在 city:" + queryBean.getFangjiaCity() + " region:" + queryBean.getFangjiaDistrict() + " name:" + model.getBuildingName()));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
queryBean.setProperty(property);
|
||||
List<CollateralSampleQueryBean> queryBeans = new ArrayList<CollateralSampleQueryBean>();
|
||||
queryBeans.add(queryBean);
|
||||
List<Collateral> collaterals = czbankSampleService.findSample(queryBeans, 5);
|
||||
long time = System.currentTimeMillis() - start;
|
||||
Map<String, Object> stat = new HashMap<String, Object>();
|
||||
for(Collateral collateral : collaterals){
|
||||
// stat.put(collateral.getCltNo(), collateral.getSample());
|
||||
stat.put("cltNo", collateral.getCltNo());
|
||||
stat.put("sample", collateral.getSample());
|
||||
}
|
||||
for(CollateralSampleQueryBean qb : queryBeans){
|
||||
JsonConfig jsonConfig = new JsonConfig();
|
||||
jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
|
||||
@Override
|
||||
public boolean apply(Object o, String s, Object o1) {
|
||||
return o1 == null;
|
||||
}
|
||||
});
|
||||
qb.setProperty(null);
|
||||
JSONObject query = JSONObject.fromObject(qb, jsonConfig);
|
||||
CzbankSampleLog log = new CzbankSampleLog();
|
||||
log.setCaseId(qb.getCltNo());
|
||||
log.setCreatedDate(new Date());
|
||||
log.setQuery(DataUtil.toMongoDbObj(query));
|
||||
List<Sample> samples = (List)stat.get("sample");
|
||||
if(samples != null){
|
||||
log.setSamples(DataUtil.toMongoDbObj(JSONArray.fromObject(samples, jsonConfig)));
|
||||
}
|
||||
log.setTime(time);
|
||||
czbankSampleLogService.save(log);
|
||||
}
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(stat));
|
||||
return mav;
|
||||
}
|
||||
|
||||
private List<CollateralSampleQueryBean> parseParams(HttpServletRequest request) throws Exception {
|
||||
String xml = null;
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
public Object evaluationAction(EvaluationQuery evaluationQuery) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
District property = null;
|
||||
try {
|
||||
xml = IOUtils.toString(request.getInputStream(), "UTF-8");
|
||||
if (StringUtils.isBlank(evaluationQuery.getCity()) || StringUtils.isBlank(evaluationQuery.getDistrict()) || StringUtils.isBlank(evaluationQuery.getName())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数缺失:city(城市),district(区域),buildingName(名称)是必须参数"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if(evaluationQuery.getSize() <= 0){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("size不能为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (evaluationQuery.getCarportPrice() != null && (evaluationQuery.getCarportPrice() < 0 || evaluationQuery.getCarportPrice() > 1000000)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("carportPrice(车位)取值不合法"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (evaluationQuery.getMaxFloor() != null && (evaluationQuery.getMaxFloor() <= 0 || evaluationQuery.getMaxFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("maxFloor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if (evaluationQuery.getFloor() != null && (evaluationQuery.getFloor() <= 0 || evaluationQuery.getFloor() > 59)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("floor取值非法,正确范围[1,60)"));
|
||||
return mav;
|
||||
}
|
||||
if (evaluationQuery.getMaxFloor() != null && evaluationQuery.getFloor() != null && evaluationQuery.getFloor() > evaluationQuery.getMaxFloor()) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("所在楼层不能大于总楼层"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(evaluationQuery.getDistrict());
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjiaCity(evaluationQuery.getDistrict());
|
||||
}
|
||||
if(fangjiaOfficialAreaMap == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("地区信息无法映射到房价网的地区信息->(province:" + evaluationQuery.getProvince() + " ,city: " + evaluationQuery.getCity() + " ,district: " + evaluationQuery.getDistrict() + ")"));
|
||||
return mav;
|
||||
}
|
||||
String fangjiaCity = fangjiaOfficialAreaMap.getFangjiaCity();
|
||||
String fangjiaDistrict = fangjiaOfficialAreaMap.getFangjiaDistrict();
|
||||
|
||||
property = districtService.findByNameAndAlias(fangjiaCity, fangjiaDistrict, evaluationQuery.getName(), "district");
|
||||
if(property == null){
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("city", fangjiaCity);
|
||||
params.put("suggestDistrict", fangjiaDistrict);
|
||||
if(StringUtils.isBlank(evaluationQuery.getAddress())){
|
||||
params.put("address", evaluationQuery.getName());
|
||||
}else{
|
||||
params.put("address", evaluationQuery.getAddress());
|
||||
params.put("suggestName", evaluationQuery.getName());
|
||||
}
|
||||
params.put("category", "district");
|
||||
String result = addressMatchProxyService.parser(params);
|
||||
if (result != null) {
|
||||
JSONObject json = JSONObject.fromObject(result);
|
||||
if(json.getInt("code")==200){
|
||||
Map<String, Object> map = (Map<String, Object>) json.get("result");
|
||||
if((Integer)map.get("precise")>=0){
|
||||
property = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name"), "district");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(property == null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该楼盘不存在 city:" + fangjiaCity + " region:" + fangjiaDistrict + " name:" + evaluationQuery.getName()));
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(property != null){
|
||||
if(StringUtils.isNotBlank(fangjiaDistrict) && !property.getRegion().equals(fangjiaDistrict)){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该楼盘不存在 city:" + fangjiaCity + " region:" + fangjiaDistrict + " name:" + evaluationQuery.getName()));
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
if(StringUtils.isBlank(xml)){
|
||||
throw new Exception("数据读取异常");
|
||||
}
|
||||
Document document;
|
||||
try{
|
||||
document = DocumentHelper.parseText(xml);
|
||||
}catch (Exception e){
|
||||
throw e;
|
||||
throw new Fault(e);
|
||||
}
|
||||
EvaluationResult result = null;
|
||||
if (property != null) {
|
||||
HttpServletRequest request = ActionContext.getContext().getRequest();
|
||||
Evaluation evaluation = evaluationService.evaluate(property, buildEvaluation(evaluationQuery, request),
|
||||
evaluationQuery.getCalDate());
|
||||
|
||||
|
||||
Element root = document.getRootElement();
|
||||
List<Element> params = root.elements();
|
||||
List<CollateralSampleQueryBean> queryBeans = new ArrayList<CollateralSampleQueryBean>();
|
||||
for(Element param : params){
|
||||
|
||||
String cltNo = param.elementText("cltNo");
|
||||
if(StringUtils.isBlank(cltNo)){
|
||||
throw new Exception("cltNo不能为空");
|
||||
if(null != evaluation && evaluation.getTotalPrice()!=null){
|
||||
result = new EvaluationResult();
|
||||
result.setTotalPrice(evaluation.getTotalPrice());
|
||||
result.setAvgPrice(evaluation.getAvgPrice());
|
||||
}else{
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该楼盘暂无法估值!"));
|
||||
return mav;
|
||||
}
|
||||
String city = param.elementText("city");
|
||||
if(StringUtils.isBlank(city)){
|
||||
throw new Exception("city不能为空,cltNo:" + cltNo);
|
||||
}
|
||||
String district = param.elementText("district");
|
||||
if(StringUtils.isBlank(district)){
|
||||
throw new Exception("district不能为空,cltNo:" + cltNo);
|
||||
}
|
||||
String buildingName = param.elementText("buildingName");
|
||||
if(StringUtils.isBlank(buildingName)){
|
||||
throw new Exception("buildingName不能为空,cltNo:" + cltNo);
|
||||
}
|
||||
District d = districtService.findOneByKey(new DistrictKey(city, district, buildingName), "district");
|
||||
if(d == null){
|
||||
throw new Exception("楼盘不存在,cltNo:" + cltNo);
|
||||
}
|
||||
String propertyTypeCode = param.elementText("propertyTypeCode");
|
||||
if(StringUtils.isBlank(propertyTypeCode)){
|
||||
throw new Exception("propertyTypeCode不能为空,cltNo:" + cltNo);
|
||||
}
|
||||
if(!"1".equals(propertyTypeCode) && !"0".equals(propertyTypeCode)){
|
||||
throw new Exception("propertyTypeCode取值非法,cltNo:" + cltNo);
|
||||
}
|
||||
String floorNumber = param.elementText("floorNumber");
|
||||
if(StringUtils.isBlank(floorNumber) || !StringUtils.isNumeric(floorNumber)){
|
||||
throw new Exception("floorNumber取值非法,cltNo:" + cltNo);
|
||||
}
|
||||
String strctureArea = param.elementText("strctureArea");
|
||||
if(StringUtils.isBlank(strctureArea) || !DataUtil.isNumeric(strctureArea)){
|
||||
throw new Exception("strctureArea取值非法,cltNo:" + cltNo);
|
||||
}
|
||||
String decrCondCode = param.elementText("decrCondCode");
|
||||
if(StringUtils.isBlank(decrCondCode)){
|
||||
decrCondCode = "2";
|
||||
}
|
||||
if(!StringUtils.isNumeric(decrCondCode) || (Integer.valueOf(decrCondCode) > 5 || Integer.valueOf(decrCondCode) < 1)){
|
||||
throw new Exception("decrCondCode取值非法,cltNo:" + cltNo);
|
||||
}
|
||||
String towardDirectCode = param.elementText("towardDirectCode");
|
||||
if(StringUtils.isBlank(towardDirectCode)){
|
||||
towardDirectCode = "3";
|
||||
}
|
||||
if(!StringUtils.isNumeric(towardDirectCode) || (Integer.valueOf(towardDirectCode) > 10 || Integer.valueOf(towardDirectCode) < 1)){
|
||||
throw new Exception("towardDirectCode取值非法,cltNo:" + cltNo);
|
||||
}
|
||||
CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean();
|
||||
queryBean.setCltNo(cltNo);
|
||||
queryBean.setCity(city);
|
||||
queryBean.setDistrict(district);
|
||||
queryBean.setBuildingName(buildingName);
|
||||
queryBean.setPropertyTypeCode(propertyTypeCode);
|
||||
queryBean.setFloorNumber(Integer.valueOf(floorNumber));
|
||||
queryBean.setStrctureArea(Double.valueOf(strctureArea));
|
||||
queryBean.setTowardDirectCode(Integer.valueOf(towardDirectCode));
|
||||
queryBean.setDecrCondCode(Integer.valueOf(decrCondCode));
|
||||
queryBean.setProperty(d);
|
||||
queryBeans.add(queryBean);
|
||||
}
|
||||
return queryBeans;
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(result));
|
||||
return mav;
|
||||
}
|
||||
|
||||
private Evaluation buildEvaluation(EvaluationQuery model, HttpServletRequest request) {
|
||||
Evaluation evaluation = new Evaluation();
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setRegion(model.getDistrict());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(model.getBuildingNumber())) {
|
||||
evaluation.setHouseNum(model.getBuildingNumber());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(model.getRoomNumber())) {
|
||||
evaluation.setRoomNum(model.getRoomNumber());
|
||||
}
|
||||
evaluation.setArea(model.getSize());
|
||||
|
||||
if (null != model.getFloor()) {
|
||||
evaluation.setFloor(model.getFloor());
|
||||
}
|
||||
if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) {
|
||||
evaluation.setHeight(model.getMaxFloor());
|
||||
}
|
||||
if (0 != model.getRoom()) {
|
||||
evaluation.setRoom(model.getRoom());
|
||||
}
|
||||
if (0 != model.getHall()) {
|
||||
evaluation.setHall(model.getHall());
|
||||
}
|
||||
if (0 != model.getToilet()) {
|
||||
evaluation.setToilet(model.getToilet());
|
||||
}
|
||||
evaluation.setEstateType(EvaluationFactorUtil.PROPERTY_TYPES.get(model.getPropertyType()));
|
||||
evaluation.setDirection(EvaluationFactorUtil.DIRECTION.get(model.getDirection()));
|
||||
evaluation.setFitment(EvaluationFactorUtil.EVALUATION_MODEL_FITMENT.get(EvaluationFactorUtil.FITMENT.get(model.getDecoration())));
|
||||
if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) {
|
||||
evaluation.setFitmentAge(model.getDecorationAge());
|
||||
}
|
||||
|
||||
if (model.getDecorationCost() != null && model.getDecorationCost() > 0) {
|
||||
evaluation.setFitmentCharge(model.getDecorationCost());
|
||||
}
|
||||
evaluation.setSight(EvaluationFactorUtil.SIGHT.get(model.getView()));
|
||||
evaluation.setNoise(EvaluationFactorUtil.NOISE.get(model.getNoise()));
|
||||
|
||||
if (model.getGardenSize()!=null && 0 != model.getGardenSize()) {
|
||||
evaluation.setGardenArea(((Number) model.getGardenSize()).doubleValue());
|
||||
}
|
||||
if (model.getBasementSize()!=null && 0 != model.getBasementSize()) {
|
||||
evaluation.setBasementArea(((Number) model.getBasementSize()).doubleValue());
|
||||
}
|
||||
|
||||
if (model.getAtticSize()!=null && 0 != model.getAtticSize()) {
|
||||
evaluation.setAtticArea(((Number) model.getAtticSize()).doubleValue());
|
||||
}
|
||||
|
||||
// if (0 != model.getOuterSize()) {
|
||||
// evaluation.setOtherFactor(((Number) model.getOuterSize()).doubleValue());
|
||||
// }
|
||||
|
||||
String worryFacility = model.getNegativeFactor();
|
||||
evaluation.setWorryFacility(EvaluationFactorUtil.NEGATIVE_FACTOR.get(worryFacility));
|
||||
if (0 != model.getAge()) {
|
||||
evaluation.setAge(model.getAge());
|
||||
}
|
||||
evaluation.setCarportPrice(model.getCarportPrice());
|
||||
|
||||
if (model.getFacilities() != null) {
|
||||
String facilities = model.getFacilities();
|
||||
String[] fs = facilities.split(",");
|
||||
for (int i = 0; i < fs.length; i++) {
|
||||
fs[i] = EvaluationFactorUtil.FACILITIES.get(fs[i]);
|
||||
}
|
||||
evaluation.setFacilities(convertToString(fs));
|
||||
}
|
||||
|
||||
evaluation.setCreationDate(new Date());
|
||||
evaluation.setModificationDate(new Date());
|
||||
|
||||
|
||||
String ip = AnalyticsUtil.getIpAddress(request);
|
||||
evaluation.setIp(ip);
|
||||
|
||||
String fromUserId = (String) request.getAttribute("from_user_id");
|
||||
if (StringUtils.isNotBlank(fromUserId)) {
|
||||
evaluation.setFromUserId(String.valueOf(fromUserId));
|
||||
}
|
||||
evaluation.setSource("cz_property_evaluation");
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
private String convertToString(String[] strs) {
|
||||
if (ArrayUtils.isNotEmpty(strs)) {
|
||||
StringBuffer ret = new StringBuffer();
|
||||
for (String str : strs) {
|
||||
if (StringUtils.isEmpty(ret.toString())) {
|
||||
ret.append(str);
|
||||
} else {
|
||||
ret.append(",").append(str);
|
||||
}
|
||||
}
|
||||
return ret.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCzbankSampleService(CzbankSampleService czbankSampleService) {
|
||||
this.czbankSampleService = czbankSampleService;
|
||||
}
|
||||
@@ -156,4 +426,20 @@ public class CzbankController {
|
||||
public void setDistrictService(DistrictService districtService) {
|
||||
this.districtService = districtService;
|
||||
}
|
||||
|
||||
public void setCzbankSampleLogService(CzbankSampleLogService czbankSampleLogService) {
|
||||
this.czbankSampleLogService = czbankSampleLogService;
|
||||
}
|
||||
|
||||
public void setFangjiaOfficialAreaService(FangjiaOfficialAreaService fangjiaOfficialAreaService) {
|
||||
this.fangjiaOfficialAreaService = fangjiaOfficialAreaService;
|
||||
}
|
||||
|
||||
public void setAddressMatchProxyService(AddressMatchProxyService addressMatchProxyService) {
|
||||
this.addressMatchProxyService = addressMatchProxyService;
|
||||
}
|
||||
|
||||
public void setEvaluationService(EvaluationService evaluationService) {
|
||||
this.evaluationService = evaluationService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.fangjia.open.model;
|
||||
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
public class CzbankSampleModel extends FangjiaApiModel{
|
||||
private String cltNo;
|
||||
private String province;
|
||||
/**城市*/
|
||||
private String city;
|
||||
/**区域*/
|
||||
private String district;
|
||||
/**小区名*/
|
||||
private String buildingName;
|
||||
/**楼栋名称*/
|
||||
private String buildingNoName;
|
||||
/**物业类型编码*/
|
||||
private String propertyTypeCode;
|
||||
/**是否有电梯 0:无 1:有*/
|
||||
private Integer isElevator;
|
||||
/**总楼层*/
|
||||
private Integer aboveFloorAmount;
|
||||
/**所在楼层*/
|
||||
private Integer floorNumber;
|
||||
/**
|
||||
* 装修情况编码
|
||||
* 1:毛坯
|
||||
* 2:简装(默认)
|
||||
* 3:精装
|
||||
* 4:豪装
|
||||
* */
|
||||
private Integer decrCondCode;
|
||||
/**面积**/
|
||||
private Double strctureArea;
|
||||
/**
|
||||
* 朝向情况编码
|
||||
* 1:西南
|
||||
* 2:东南
|
||||
* 3:南(默认)
|
||||
* 4:西北
|
||||
* 5:东北
|
||||
* 6:东
|
||||
* 7:西
|
||||
* 8:北
|
||||
* 9:东西
|
||||
* 10:南北
|
||||
* */
|
||||
private Integer towardDirectCode;
|
||||
private Date updateDate;
|
||||
|
||||
public String getCltNo() {
|
||||
return cltNo;
|
||||
}
|
||||
|
||||
public void setCltNo(String cltNo) {
|
||||
this.cltNo = cltNo;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getBuildingName() {
|
||||
return buildingName;
|
||||
}
|
||||
|
||||
public void setBuildingName(String buildingName) {
|
||||
this.buildingName = buildingName;
|
||||
}
|
||||
|
||||
public String getBuildingNoName() {
|
||||
return buildingNoName;
|
||||
}
|
||||
|
||||
public void setBuildingNoName(String buildingNoName) {
|
||||
this.buildingNoName = buildingNoName;
|
||||
}
|
||||
|
||||
public String getPropertyTypeCode() {
|
||||
return propertyTypeCode;
|
||||
}
|
||||
|
||||
public void setPropertyTypeCode(String propertyTypeCode) {
|
||||
this.propertyTypeCode = propertyTypeCode;
|
||||
}
|
||||
|
||||
public Integer getIsElevator() {
|
||||
return isElevator;
|
||||
}
|
||||
|
||||
public void setIsElevator(Integer isElevator) {
|
||||
this.isElevator = isElevator;
|
||||
}
|
||||
|
||||
public Integer getAboveFloorAmount() {
|
||||
return aboveFloorAmount;
|
||||
}
|
||||
|
||||
public void setAboveFloorAmount(Integer aboveFloorAmount) {
|
||||
this.aboveFloorAmount = aboveFloorAmount;
|
||||
}
|
||||
|
||||
public Integer getFloorNumber() {
|
||||
return floorNumber;
|
||||
}
|
||||
|
||||
public void setFloorNumber(Integer floorNumber) {
|
||||
this.floorNumber = floorNumber;
|
||||
}
|
||||
|
||||
public Integer getDecrCondCode() {
|
||||
return decrCondCode;
|
||||
}
|
||||
|
||||
public void setDecrCondCode(Integer decrCondCode) {
|
||||
this.decrCondCode = decrCondCode;
|
||||
}
|
||||
|
||||
public Double getStrctureArea() {
|
||||
return strctureArea;
|
||||
}
|
||||
|
||||
public void setStrctureArea(Double strctureArea) {
|
||||
this.strctureArea = strctureArea;
|
||||
}
|
||||
|
||||
public Integer getTowardDirectCode() {
|
||||
return towardDirectCode;
|
||||
}
|
||||
|
||||
public void setTowardDirectCode(Integer towardDirectCode) {
|
||||
this.towardDirectCode = towardDirectCode;
|
||||
}
|
||||
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
}
|
||||
@@ -405,11 +405,7 @@ public class CzbankServiceImpl implements CzbankService {
|
||||
}
|
||||
evaluation.setFacilities(convertToString(fs));
|
||||
}
|
||||
|
||||
// if (StringUtils.isNotBlank(model.getInsidepos())) {
|
||||
// evaluation.setInsidepos(model.getInsidepos());
|
||||
// }
|
||||
|
||||
|
||||
evaluation.setCreationDate(new Date());
|
||||
evaluation.setModificationDate(new Date());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user