From c4eebbfe36b73a1f1691955cb36a1f46c222cfb6 Mon Sep 17 00:00:00 2001 From: mjt <13607600062@163.com> Date: Tue, 19 Dec 2023 10:51:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=97=E4=BA=A4=E6=89=80=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deliverables/auto/pom.xml | 2 +- .../address/main.css.baiduyun.uploading.cfg | Bin 0 -> 3472 bytes .../audit/list.css.baiduyun.uploading.cfg | Bin 0 -> 3130 bytes .../style/theme.css.baiduyun.uploading.cfg | Bin 0 -> 3472 bytes .../open/controllers/AaController.java | 24 +- .../ComprehensiveQueryController.java | 1316 ++++++++++++++ .../open/controllers/HouseController.java | 6 +- .../open/controllers/TestController.java | 1608 +++++++++++++++++ .../com/fangjia/open/dto/CityNewPriceDto.java | 3 +- .../open/dto/HouseValueInformationDto.java | 57 + .../open/model/HouseInfomationModel.java | 941 ++++++++++ .../fangjia-open/~$网开放接å�£æ–‡æ¡£V1.0.doc | Bin 162 -> 0 bytes .../datepicker.css.baiduyun.uploading.cfg | Bin 0 -> 3472 bytes .../whyGreen/img.gif.baiduyun.uploading.cfg | Bin 0 -> 3472 bytes .../style/common.css.baiduyun.uploading.cfg | Bin 0 -> 3130 bytes .../datepicker.css.baiduyun.uploading.cfg | Bin 0 -> 3130 bytes .../dialogBox.css.baiduyun.uploading.cfg | Bin 0 -> 3146 bytes .../sdklog/sdkclient_CommunicateLog_info | 0 .../majintao/sdklog/sdkclient_EMAYSDK_info | 0 .../com/fangjia/script/majintao/test.groovy | 71 + .../com/fangjia/script/util/ExcelUtils.groovy | 39 + .../datastore/CzbankSampleServiceImpl.java | 913 +++++----- .../service/datastore/DistrictService.java | 1 + .../datastore/DistrictServiceImpl.java | 58 + 24 files changed, 4581 insertions(+), 458 deletions(-) create mode 100644 projects/fangjia-bkoff/src/main/webapp/style/address/main.css.baiduyun.uploading.cfg create mode 100644 projects/fangjia-bkoff/src/main/webapp/style/audit/list.css.baiduyun.uploading.cfg create mode 100644 projects/fangjia-bkoff/src/main/webapp/style/theme.css.baiduyun.uploading.cfg create mode 100644 projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java create mode 100644 projects/fangjia-open/src/main/java/com/fangjia/open/controllers/TestController.java create mode 100644 projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseValueInformationDto.java create mode 100644 projects/fangjia-open/src/main/java/com/fangjia/open/model/HouseInfomationModel.java delete mode 100644 projects/fangjia-open/~$网开放接å�£æ–‡æ¡£V1.0.doc create mode 100644 projects/fangjia-pds/src/main/webapp/static/v1.2/js/skin/whyGreen/datepicker.css.baiduyun.uploading.cfg create mode 100644 projects/fangjia-pds/src/main/webapp/static/v1.2/js/skin/whyGreen/img.gif.baiduyun.uploading.cfg create mode 100644 projects/fangjia-pds/src/main/webapp/static/v1.2/style/common.css.baiduyun.uploading.cfg create mode 100644 projects/fangjia-pds/src/main/webapp/static/v1.2/style/datepicker.css.baiduyun.uploading.cfg create mode 100644 projects/fangjia-pds/src/main/webapp/static/v1.2/style/dialogBox.css.baiduyun.uploading.cfg create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_CommunicateLog_info create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_EMAYSDK_info create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test.groovy diff --git a/deliverables/auto/pom.xml b/deliverables/auto/pom.xml index 292ddf9d6..831bfe4c9 100644 --- a/deliverables/auto/pom.xml +++ b/deliverables/auto/pom.xml @@ -18,6 +18,6 @@ goojia-auto - ../../projects/goojia-auto + diff --git a/projects/fangjia-bkoff/src/main/webapp/style/address/main.css.baiduyun.uploading.cfg b/projects/fangjia-bkoff/src/main/webapp/style/address/main.css.baiduyun.uploading.cfg new file mode 100644 index 0000000000000000000000000000000000000000..74aacef5ada7833601f385ed190fe1df87d9b2c8 GIT binary patch literal 3472 zcmW;PNmnXC3Bp}Y>v;#yy5JVjL_3ulaK23M0lAD{G>Z)d(_S111 zr9pa0)pU?f(=NTHzf@26>_2JZxJ#XMmA=wAO?h_GdAdm(-VdI?({oy+qts{p;qj4b zBEHiW&RaTTz2^7KcAk2WkBv{$UTUUQT0&c-f1c(%?qsN@g3L2Mx1LXUFQAOrUejax zO&6?1u@{atpSs^QpAPGvJY5k}(QVZ{q$gE%#V_!xrlCxA_ouEUSodl;cdfcE9G{dZ z@ovb!Oo!>6_X$3?#v1ZP1vAxrr%FYcgSZ#@S`f-K=u&bjrpWT4;-$!IJy`11p|LT=SL|!?F>lUj_HJ~c<~glv z(2vzwh49O}!n2R#i_CreOFaL{@&si;!E+4DS(PJvN^%V|?-h?B^ew-+YYoRI`O6t~ zq`I{{7cf?^w{)8unYiA{S;F$u@3E)gyioZy+nPtr`>Lw`(XB!EHTxwNzjT^X;E1h7 zfdM{es%&FB^gK1A_C8h7jp0WX3IiHTPmnfVC45hT+IGcFnNp1<&ZljO9d~O_q*KV?0N6I>NG@eg5cM!0Zc` z4XjXbjYvdYl#}&jjoqyRvyFvE9$er0@eM8BK>zl5;^14#v8JrR> zKahURyvWhWv8&vtHLL-3&hXh$V648VE9TA^uSZNT;e5Nh`J&Ov?=dQPEXkxgeOo4x_H&?lWlDklF zja962F^{^Qn|NNR`xx2?#?bf>=8>oyn)YFR%Xh%*lFwSy9woZ!nwe48&Y>KG>>D$q z$+E+x?1-qEylox@Z%T*nLawozpCDAs(X!uH_6e`}t&1v(8}g~i^PrY^b0=(XkdNgG z70S*xjOOM_4_aSDneK0VpJb`i;S;MrjAE6Y<^EJMheNd$)O7;;SoQ|xE+{n9^#+_% z$}MG|yNlUdRQrTdJ$Ng~E1p-GL#+70A=b39-){K~W?^Df@DdY+F}Y#!7Yb1LRu z%$bStSOcTx=vO0icz6AB^kFSvwpCKm?|ZtB_%Bpc@-FW=U*!1X*~T;8@S(f5{0r*E zPP5<@T`9A6VaCoel&vQJm%QifKh8#0=n02wV;3qa=?cQ73K#tMReLA@HAV}1#V*vr<|cP4 zX37rxG24%8bZ_pwbw88q+kFROh1aWYY~U39&cwy~{wj0qk3AXNSaxNps=hAcugE2g zHU_b0KIgv1yIO+VrqUzT+iE;kZxN#s|1u66`A%evx!uikVL+vO2rU_7&A#RxUrzB| zRFMAz;(&kjA=Z`9=mOTx``pf+KVoB#>>4>!N$lJ2)OwIF`WRYmRJ+5Z>+Tzy*iYjt z;+F3(^li3uXd3Fo${6qODV(zB_&R8?7Cb-Uu@7?&f9n2G<_k4-WsY^Qic_p_$GI;v zj5h2~?0fhu_-~Ev$-UCwJ=g;gLw8LY%~f)W>sY2Qs%+Hpf@1^v#OM->QRaIie}M*< zdG>8Q-D4BG`3LrE+Wg4fQelOEUEUSUBZx=1#v3uv-#779d9HA)^By_hjqkI?{CTF? z9OJ(H6;GkVDf~;%#}F&V;v4D9$R_t|p7$ZFLf#2R+5 z@+WNHFo?Ml_s_UT|F$eM6}6z&9FN9N)YzBd&|L+Sv5KaA+kEeN#tdvyZHP~sA{+L( zh)=WUjmI6{4Hd?h*AIp-bohl7h}SsvjK$pl!1KXb$EYIe9Y%Dr!)u982iAeAVt?DH zZSMRt7VF%B>c4n3bAMv@FRG}3-FdEZD{~80L)4v2BhMe1Ls9Lq_PmPT$`QNzMuy1w z0rL-|cc^8E6ZSgXruY(sF02=R=SIeKSc!@{+j@KgYb4vd-zT-kZdSnko=1~5@%<8C zo-ub~J&iAiVb-!DXO+TpelZVv@ZvvD>|$N$bG+ich#fz6^%bm|v9^&|$7;EPP%^%G ezHy3g#-7~q1$ttJ-im*~uRzt9F>C!;$?+fcv_iT7 literal 0 HcmV?d00001 diff --git a/projects/fangjia-bkoff/src/main/webapp/style/audit/list.css.baiduyun.uploading.cfg b/projects/fangjia-bkoff/src/main/webapp/style/audit/list.css.baiduyun.uploading.cfg new file mode 100644 index 0000000000000000000000000000000000000000..f612f71b524355fba633a11914c31a0045cf7c33 GIT binary patch literal 3130 zcmW;P%T_Ww5C!0jeH8{GDC*!0L_iTmQB+{YMG?8lL;6mCshr;R@6(6tE#0P8`j>`j%h?s(s&QJSX9bgy^M zVx2B{?9v9#JU!@rW;fE;Om~p4jE~cCs-#7lL7S#CZxa@8B9zjR$X{&Q-fvh>p$znW zr*8Vy^OkbP9avQjcK$9@jCgXPHBxjgn{Wb3)br{W4t zeb#SKHVwQt@{O?>Z##&-m@F~K%%yRXF{e#v5?gF0! z)wfV9#=EX2tUBaZif>tL<)w+`ea7G*?*$A8n14Wz`7X0*&~*&y(p=W~eX@C%-7hT0 z-bOrT`s-L9XZh*y`xLJVp&$o!nH=-U=~+`e{o_Uf|dh zzmTC0s9TEj2x9?zBX1KUAD(S7^H^@(ue=54Ddo@lmMo&~OH`f7+qJwe^*>?pD^Ft? zxYSpbfmeJUsH|bz_dZrpCp^}4e2bIg6LWG2=T7EpdQZh{KtF*t#kJ#p<97Eqg4uuGBChlKq7#u z-=i#-dv9-|gvL`fGQw@yO=(~*=aqotivm0-~Anh zWg3=HzujMPjuq|1Z>Hzob8Y;ZUzL&*+(xdY_Y=IklmxR8ui)JDY|~J|a3=Fd>|?!Y zWeW0ID;Zp36{}p-QQdn5&qunivUzO69r}%oOkgco&2T@V`%&CK{&l?e?pvJR&Eq@! z7WQEql~K`iz@^{{uM3tn7Ds0GmhDum7R^1#MOE_dzSaMsCnEpy+VUG}T|isV@weaTVqtkJ#hp&|*erq90RPlIf_w zE!?JPJNFmkEqJl_#C%oc<%`81UK{z0@3=1hn$AZUd-ff@711uBo_qiDehzm;$180$ zehq#%tbbL>F|;pP=|kH27NW+xytiW1RA3F(8>K~7Lu1dzKFt0R`w9EKku!6$$6}A? zfOj{`f9za6?4Dr7*H(n`BPR`dI--7v-@|$gx54V1hHp&%;Ivu3W~)K0bx&D!#y&E3 zMJ-L>7R24)e2}TwFRoN&tOoJDwITkBRK2f(VSWi^!*^jA>lge|( z{T}+#@7oMS1x2Mq6@2K6lgppki#hG;8^ha)+=1L<_040I)z3=CX0*-u$LS_^wqI5o z+3%X~U>5aUcHPkaA&c=1-^=$I#!)S6`RPKdVS1&vpdGpkFiRp0MeK=P7q?2m5Bt6d z-(p{g&|$GQ68RZu?XsL#v}0ZAyT=!C;8$aNPTdclHL8}@sDaVgL%TS|dYjZL#zrP$UFyM#wfoesDB@g>W3A2M8vElB4zXi|XN^Ui_ukpWZ0Fn$`pz)# zLMUMtC)y^9*eCap%2dW06Q{E#27j2xdK9y94?oTY0mn$v)0uu_MIJAFEalTC7^nIK|ob$><77M-F?gIIBjLO)?d+ O_6CpmkFZbwx&8+h3kqxi literal 0 HcmV?d00001 diff --git a/projects/fangjia-bkoff/src/main/webapp/style/theme.css.baiduyun.uploading.cfg b/projects/fangjia-bkoff/src/main/webapp/style/theme.css.baiduyun.uploading.cfg new file mode 100644 index 0000000000000000000000000000000000000000..0c2959a189fbb34962c4435e33a0b7b4d772ef0c GIT binary patch literal 3472 zcmXBX$yPE;5Cq^_^C~Vx@K;>QBp^4Qg-P5P(?yAhl$jI!f<|!Sd z(=<+Z=`|gt!*rhh(meg9YI-pKon9RGsg-WhS9(elmaTM|Zqu6eqvu_EPK$Jsx<S>wYpe@orPcs(xA{?cH$Wu0b&u6R`P{zjQ zX^?(!y3cc0sg_o3s(x2&T4@jG$JFLAVbPS$V;ah;&3}Q{Q5uO*`$=6K z?ueX5tnZ<2WV&3BxhwFVLgjRW|4H+J|(amQ8-IY#yjP z#bV;=na7*)HrD%DpGSVL;x!Av zI26B>QOB}diE{;G3424gnVA>YzL-TUw|-AO1?Pp#d&X8QqVJDn^^a~fy0461WAQ_$ z2?b7!H7Ib0&xI_T*p56;bkqTlPkGG6+2a#6If2umeADQmnCH+Bpe=BH^n2z!gn8q9 z$kpy=1{?N!yhfSrI_FsQRLN?e()5|#0@6h8f9?yp_FdhwP|=1A$`lyqw`Y{Q|D12z z$b^P#(OWFWVh&sv>bLJ&Y z{N8tDU6sQM>fG-g&at8$INywPT|dp&_%&p5fZMZU<@o^bflPwgGq2!$>Dre=9m6;8 zc7c7YH#a$hqPsN(S6Ia=7k$+BT*vcD-lx#UFh=G_Fi&{h(zFX}C*C2eYc?xh`;=(Q zYpSDq&XE{**)}?(ZsZS_sO6y^tBBiVQGnGFBi@UioQG`7Y)gLUFkY}2seUheUAd1H zyRD*M&Z7BPFaLPoWfe-eykj)eI~{0U9woZJvmNTGDjl|1{bCfW>@?S>jKj#xEj~M* zU-0HM?nD1z^W%P`jtzOonsRQwEQ@RLH{vWERp(SjEAe8*4-T=WMfdL@bY%Q1;@E7w zZB_m)ow$`plQOZl{ogY$=3@=4$~o#)%N#yjzo2(vox(iBx2)a|bRV-{$fyW!-}x%W zFUuy&c*95Tn&L007dy>@RaB*9v<)?Oj*(~;yuQS}H2&?ZWrc<~^vqq!sDSf~?S1 zHsbVh?{sN85Fz%LU+1w%eSWbEenb8hvxaZYF=e~Ms70l+@j2@?oPyt}NU^@p#gF~5 zgIiO)HuNLeS7rQ@0kO|Acr)t*Aq+E3xNX!TR$)H?!q8-`FGDW-eqB`}T*tAH|D0 zE+DLB`-e%}-42`BPva}1&-MrUCXYmYLY-I{->vY90dkP)S;a__`g;+Kh-$-9(*129w&+#SDkn0x83*UId z_l*9rkN&*MYE>Y_8ulRbA-3-rM6bmCGwxBpjghI08c-{af%!9xyCNLBD`WD6|AcLm z?E}l`z&h1N_%u}{GM@3+>YjHN_xUaO|I6ze!&f@|KnlbjP951t?|_ePA^)z>0K%ukrV7=1u3L3uG=rBt1N5kebQd}~~qd7{ITSLE5$eP^)7qJ8)s z$~AVg0`3ni>a>ZkiTLu2-ih@zz8pqb%d(h96pnA3=z|Wt_|Fr&SR48buXrzF$B$io s39DkRY39IKC1(&yHpSlI6yJ;;vEvK$OwaZC$G261s?jkk^;nAWA0pgA00000 literal 0 HcmV?d00001 diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AaController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AaController.java index d83085e01..ce11d95e3 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AaController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AaController.java @@ -22,16 +22,16 @@ public class AaController { private AddressModeParserChain addressModeParserChain; public Object pickAction() throws Exception { - File file = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\ÉϺ£-0730.txt"); - File file2 = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\ÉϺ£-0730_picker.txt"); + File file = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\上海-0730.txt"); + File file2 = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\上海-0730_picker.txt"); if (file2.exists()) { file2.delete(); } - BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file2, true), "GBK")); // Ö¸¶¨±àÂë¸ñʽ£¬ÒÔÃâ¶ÁȡʱÖÐÎÄ×Ö·ûÒì³£ + BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file2, true), "GBK")); // 指定编ç �æ ¼å¼�,以å…�读å�–时中文字符异常 - // È«²¿Ð´È뻺´æÖеÄÄÚÈÝ + // 全部写入缓存中的内容 - InputStreamReader read = new InputStreamReader(new FileInputStream(file), "utf-8");// ¿¼Âǵ½±àÂë¸ñʽ + InputStreamReader read = new InputStreamReader(new FileInputStream(file), "utf-8");// 考虑到编ç �æ ¼å¼� BufferedReader bufferedReader = new BufferedReader(read); String lineTxt = null; while ((lineTxt = bufferedReader.readLine()) != null) { @@ -42,7 +42,7 @@ public class AaController { List tokens = CnAddressTokenizer.tokenizer(lineTxt); addressPickerChain.doPick(tokens, ret); - // parserChain.doParse("ÉϺ£", lineTxt, ret); + // parserChain.doParse("上海", lineTxt, ret); ret.remove(AddressAnalyseResultKeyEnum.orgAddress.name()); // ret.remove(AddressAnalyseResultKeyEnum.shortAddress.name()); @@ -64,16 +64,16 @@ public class AaController { } public Object parseAction() throws Exception { - File file = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\ÉϺ£-0730.txt"); - File file2 = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\ÉϺ£-0730_parser.txt"); + File file = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\上海-0730.txt"); + File file2 = new File("C:\\Users\\yk\\Desktop\\yongjia\\test\\上海-0730_parser.txt"); if (file2.exists()) { file2.delete(); } - BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file2, true), "GBK")); // Ö¸¶¨±àÂë¸ñʽ£¬ÒÔÃâ¶ÁȡʱÖÐÎÄ×Ö·ûÒì³£ + BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file2, true), "GBK")); // 指定编ç �æ ¼å¼�,以å…�读å�–时中文字符异常 - // È«²¿Ð´È뻺´æÖеÄÄÚÈÝ + // 全部写入缓存中的内容 - InputStreamReader read = new InputStreamReader(new FileInputStream(file), "utf-8");// ¿¼Âǵ½±àÂë¸ñʽ + InputStreamReader read = new InputStreamReader(new FileInputStream(file), "utf-8");// 考虑到编ç �æ ¼å¼� BufferedReader bufferedReader = new BufferedReader(read); String lineTxt = null; while ((lineTxt = bufferedReader.readLine()) != null) { @@ -81,7 +81,7 @@ public class AaController { ret.put(AddressAnalyseResultKeyEnum.orgAddress.name(), lineTxt); System.out.println(lineTxt); - addressModeParserChain.doParse("ÉϺ£", lineTxt, ret); + addressModeParserChain.doParse("上海", lineTxt, ret); ret.remove(AddressAnalyseResultKeyEnum.orgAddress.name()); ret.remove(AddressAnalyseResultKeyEnum.shortAddress.name()); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java new file mode 100644 index 000000000..710ced096 --- /dev/null +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/ComprehensiveQueryController.java @@ -0,0 +1,1316 @@ +package com.fangjia.open.controllers; + +import com.fangjia.core.util.*; +import com.fangjia.dal.common.DistrictKey; +import com.fangjia.dal.mongo.fangjia.model.ServerArea; +import com.fangjia.dal.mongo.model.ApiUserCfg; +import com.fangjia.dal.mongo.model.DistrictFacilitys; +import com.fangjia.dal.mongo.model.Evaluation; +import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap; +import com.fangjia.dal.mongo.model.bkoff.Loudong; +import com.fangjia.dal.mongo.open.model.ApiUserAuthority; +import com.fangjia.dal.mongo.open.model.EvaluateRatio; +import com.fangjia.dal.seaweed.model.District; +import com.fangjia.open.HttpCode; +import com.fangjia.open.OpenHttpCodeEnum; +import com.fangjia.open.dto.HouseValueInformationDto; +import com.fangjia.open.dto.UniversalDto; +import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto; +import com.fangjia.open.interceptors.AuthenticationBean; +import com.fangjia.open.interceptors.Authority; +import com.fangjia.open.interceptors.Role; +import com.fangjia.open.model.*; +import com.fangjia.open.util.CommonDtoUtils; +import com.fangjia.open.util.CommonUtils; +import com.fangjia.open.ws.query.SampleQuery; +import com.fangjia.service.api.AddressMatchProxyService; +import com.fangjia.service.api.ApiUserCfgService; +import com.fangjia.service.bo.Collateral; +import com.fangjia.service.bo.DistrictStatBo; +import com.fangjia.service.bo.Sample; +import com.fangjia.service.datastore.*; +import com.fangjia.service.datastore.bean.CollateralSampleQueryBean; +import com.fangjia.service.district.*; +import com.fangjia.service.mongo.bkoff.HouseLoudongService; +import com.fangjia.service.mongo.bkoff.LoudongService; +import com.fangjia.service.mongo.fangjia.*; +import com.fangjia.service.open.*; +import com.fangjia.service.tool.OpenLogService; +import com.fangjia.service.web.AddressService; +import net.sf.json.JSONObject; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DateUtils; +import org.slf4j.Logger; +import org.sothis.web.mvc.ActionContext; + +import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; +import java.util.*; + +import static com.poseidon.util.TypeConverter.convertToString; + +/** + * @author 13607 + * @since 2023/12/12 10:29 + */ +@Authority(role = Role.USER) +public class ComprehensiveQueryController { + private DistrictService districtService; + + private DistrictStatService districtStatService; + + private FangjiaOfficialAreaService fangjiaOfficialAreaService; + private AddressMatchProxyService addressMatchProxyService; + + private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class); + private HouseLoudongService houseLoudongService; + private LoudongService loudongService; + private EvaluationService evaluationService; + private BatchEvaluateService batchEvaluateService; + private ApiUserAuthorityService apiUserAuthorityService; + private AverageStatisticsService averageStatisticsService; + private ServerAreaService serverAreaService; + private ApiUserCfgService apiUserCfgService; + private OpenApiLogService openApiLogService; + private EvaluateFactorService evaluateFactorService; + + private CzbankSampleService czbankSampleService; + + private DistrictFacilitysService districtFacilitysService; + + private static final int DEFAULT_PAGE_SIZE = 20; + private static final String[] PROPERTY_SEARCH_API_FIELDS = {"address", "city", "region", "name", "lat2", "lng2", "lat", "lng", "block", "estateType2", "addrAlias"}; + static final int BAI_DU_GEO = 1;// °Ù¶ÈÏµ×ø±ê + static final int GAO_DE_GEO = 2;// ¸ßµÂÏµ×ø±ê + + + + private EvaluateRatioService evaluateRatioService; + + private static final int EVALUATE_SHOW_DETAIL = 1; + private static final Map PROPERTY_TYPES = new HashMap() { + { + put(null, "ÆÕͨסլ"); + put("0", "ÆÕͨסլ"); + put("1", "±ðÊû"); + put("2", "ÉÌס"); + } + }; + + private static final Map DIRECTION = new HashMap() { + { + put(null, "ÄÏ"); + put("1", "Î÷ÄÏ"); + put("2", "¶«ÄÏ"); + put("3", "ÄÏ"); + put("4", "Î÷±±"); + put("5", "¶«±±"); + put("6", "¶«"); + put("7", "Î÷"); + put("8", "±±"); + put("9", "¶«Î÷"); + put("10", "Äϱ±"); + } + }; + + private static final Map FITMENT = new HashMap() { + { + put(null, "¼ò×°"); + put("1", "ëÅ÷"); + put("2", "¼ò×°"); + put("3", "¾«×°"); + put("4", "ºÀ×°"); + } + }; + + private static final Map EVALUATION_MODEL_FITMENT = new HashMap() { + { + put(null, "¼òµ¥×°ÐÞ"); + put("¼ò×°", "¼òµ¥×°ÐÞ"); + put("ëÅ÷", "ëÅ÷"); + put("¾«×°", "¾«×°ÐÞ"); + put("ºÀ×°", "ºÀ»ª×°ÐÞ"); + } + }; + + private static final Map SIGHT = new HashMap() { + { + put(null, "Ò»°ã"); + put("1", "¾°¹Û·¿"); + put("2", "²à¾°¹Û·¿"); + put("3", "Ò»°ã"); + put("4", "²î"); + } + }; + + private static final Map NOISE = new HashMap() { + { + put(null, "ÎÞÔëÒô"); + put("0", "ÎÞÔëÒô"); + put("1", "ÔëÒô½ÏС"); + put("2", "ÔëÒô´ó"); + } + }; + private static final Map FACILITIES = new HashMap() { + { + put("0", "½¡Éí·¿"); + put("1", "ÓÎÓ¾³Ø"); + put("2", "»áËù"); + put("3", "ÍøÇò³¡"); + put("4", "Çò³¡"); + put("5", "ÆåÅÆÊÒ"); + put("6", "Í£³µ³¡"); + put("7", "ͼÊé¹Ý"); + put("8", "»î¶¯ÖÐÐÄ"); + } + }; + + private static final Map NEGATIVE_FACTOR = new HashMap() { + { + put(null, "ÎÞ"); + put("1", "ºÜ½ü"); + put("2", "½Ï½ü"); + put("3", "ÎÞ"); + } + }; + + + Map listKeyMap = new HashMap() { + { + put("school", "schools"); + put("hospital", "hospitals"); + put("bank", "banks"); + put("supermarket", "supermarkets"); + put("market", "markets"); + put("beautySalon", "beautySalons"); + put("gym", "gyms"); + put("park", "parks"); + put("bus", "buses"); + put("metro", "metros"); + put("dock", "docks"); + put("airport", "airports"); + put("trainStation", "trainStations"); + put("restaurant", "restaurants"); + put("hotel", "hotels"); + } + }; + + private static final Map CITYLEVEL_MAP = new HashMap() { + { + put("1000", "one");// Ò»Ïß + put("1500", "newOne");// ÐÂÒ»Ïß + put("2000", "two");// ¶þÏß + put("3000", "three");// ÈýÏß + put("4000", "four");// ËÄÏß + put("5000", "five");// ÎåÏß + } + }; + + public Object houseValueInformationAction(HouseInfomationModel model, HttpServletRequest httpServletRequest) { + + // Ô­Ð¡Çø¾ù¼Û + HouseValueInformationDto houseValueInformation = new HouseValueInformationDto(); + RestfulModelAndView mav = new RestfulModelAndView(); + + if (StringUtils.isBlank(model.getAddress()) || StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(String.valueOf(model.getSize()))) { + mav.setModel(BasicModel.buildBadRequestModel("³ÇÊÐ(city),µØÖ·(address),Ãæ»ý(size)Ϊ±ØÌî×Ö¶Î")); + return mav; + } + + HttpRequest httpRequest = new HttpRequest(); + JSONObject json = null; + Map communityAvgPriceParams = new HashMap(); + communityAvgPriceParams.put("city", model.getCity()); + communityAvgPriceParams.put("address", model.getAddress()); + communityAvgPriceParams.put("category", model.getCategory()); + communityAvgPriceParams.put("useMap", String.valueOf(model.isUseMap())); + JSONObject matchResponse = null; + try { + matchResponse = httpRequest.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/v2/match", communityAvgPriceParams, "UTF-8"); + } catch (HttpRequestException e) { + + } + if(matchResponse == null || !matchResponse.containsKey("result") || !matchResponse.getJSONObject("result").containsKey("id")) { + mav.setModel(BasicModel.buildBadRequestModel("¸ÃµØÖ·²»Ö§³Ö¹À¼Û£¡")); + return mav; + } + String id = matchResponse.getJSONObject("result").getString("id"); + District district = districtService.findById(id); + if (district == null) { + mav.setModel(BasicModel.buildBadRequestModel("¸ÃµØÖ·²»Ö§³Ö¹À¼Û£¡")); + return mav; + } + + MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, matchResponse.getJSONObject("result")); + DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(district)); + if (null != statBo) { + if (statBo.getDistrictStat() != null) { + dto.setAvgPrice(statBo.getDistrictStat().getAvgPrice()); + } else if (statBo.getVillaDistrictStat() != null) { + dto.setAvgPrice(statBo.getVillaDistrictStat().getAvgPrice()); + } + + } + // ±£´æÐ¡Çø¾ù¼ÛµÄ·µ»Ø½á¹û + houseValueInformation.setCommunityAvgPrice(dto); + + //Ô­·¿ÎݼÛÖµÆÀ¹À + //¸ù¾Ýmodel¸øPropertyEvaluationModel¸³Öµ + PropertyEvaluationModel propertyEvaluationModel = createPropertyEvaluationModelFromHouseInfomationModel(model); + boolean villaFlag = DataUtil.isVilla(propertyEvaluationModel.getSize(), propertyEvaluationModel.getName(), propertyEvaluationModel.getHeight(), propertyEvaluationModel.getRoom()); + String propertyType = district.getEstateType2(); + if (villaFlag && StringUtils.isNotBlank(propertyType) && !propertyType.equals("±ðÊû")) { + District bieShuDistrict = districtService.findByNameAndAlias(district.getCity(), district.getRegion(), district.getName() + "±ðÊû", "district"); + if (bieShuDistrict != null) { + district = bieShuDistrict; + } + } + propertyEvaluationModel.setDistrict(district.getRegion()); + propertyEvaluationModel.setName(district.getName()); + try { + evaluateAction(propertyEvaluationModel, httpServletRequest, houseValueInformation, mav); + } catch (IllegalAccessException e) { + + } +// houseValueInformation.setAddressValue(modelAndView); + + //·¿Ô´Ñù±¾ + + //¹¹ÔìsampleQuery¶ÔÏó + SampleQuery sampleQuery = new SampleQuery(); + sampleQuery.setCity(model.getCity()); + sampleQuery.setStrctureArea(model.getSize()); + sampleQuery.setAddress(model.getAddress()); + +// RestfulModelAndView houseCaseMav = new RestfulModelAndView(); + List querys = null; + try { + querys = convertSampileQueryToBean(district,sampleQuery); + } catch (Exception e) { + mav.setModel(BasicModel.buildBadRequestModel(e.getMessage())); + return mav; + } + if (null == sampleQuery.getMax()) { + sampleQuery.setMax(10); + } + // ´Ë´¦Âý + long start = System.currentTimeMillis(); + List collaterals = czbankSampleService.findSample2(querys, sampleQuery.getMax()); + long end = System.currentTimeMillis(); + System.out.println("ÓÃʱ:"+(end-start)); + Collateral collateral = collaterals.get(0); + List samples = collateral.getSample(); + UniversalDto houseCaseDto = UniversalDto.newDto(); + if (null != collateral.getMaxPrice()) { + houseCaseDto.append("maxUnitPrice", collateral.getMaxPrice()); + } + if (null != collateral.getMinPrice()) { + houseCaseDto.append("minUnitPrice", collateral.getMinPrice()); + } + houseCaseDto.append("datas", samples); +// if(samples!= null && samples.size()>=2){ +// Sample minSample = samples.get(samples.size()-2); +// Sample maxSample = samples.get(samples.size()-1); +// dto.append("minUnitPrice", minSample.getUnitPrice()); +// dto.append("maxUnitPrice", maxSample.getUnitPrice()); +// } +// if(samples.size()>2){ +// dto.append("datas", samples.subList(0, samples.size()-2)); +// }else{ +// dto.append("datas", samples); +// } + +// houseCaseMav.setModel(BasicModel.buildOKModel().setResult(dto)); +// return houseCaseMav; + + //½«·¿Ô´Êý¾Ý·Åµ½½á¹û¼¯ + houseValueInformation.setHouseCase(houseCaseDto); + + // Ô­ÖܱßPOI + DistrictFacilitys facilitys = districtFacilitysService.findByDistrict(district); + // ½«ÖܱßPOIÊý¾Ý·Åµ½½á¹û¼¯ + houseValueInformation.setSurroundingPoi(facilitys); + mav.setModel(BasicModel.buildOKModel().setResult(houseValueInformation)); + return mav; + } + + private PropertyEvaluationModel createPropertyEvaluationModelFromHouseInfomationModel(HouseInfomationModel model) { + PropertyEvaluationModel propertyModel = new PropertyEvaluationModel(); + propertyModel.setCity(model.getCity()); + propertyModel.setAddress(model.getAddress()); + propertyModel.setSize(model.getSize()); + + if (StringUtils.isNotBlank(model.getDistrict())) { + propertyModel.setDistrict(model.getDistrict()); + } + if (StringUtils.isNotBlank(model.getName())) { + propertyModel.setName(model.getName()); + } + if (StringUtils.isNotBlank(model.getBuildingNumber())) { + propertyModel.setBuildingNumber(model.getBuildingNumber()); + } + if (StringUtils.isNotBlank(model.getUnitNumber())) { + propertyModel.setUnitNumber(model.getUnitNumber()); + } + if (model.getFloor() != null && model.getFloor() != 0) { + propertyModel.setFloor(model.getFloor()); + } + if (model.getMaxFloor() != null && model.getMaxFloor() != 0) { + propertyModel.setMaxFloor(model.getMaxFloor()); + } + if (model.getRoom() != null && model.getRoom() != 0) { + propertyModel.setRoom(model.getRoom()); + } + if (model.getHall() != 0) { + propertyModel.setHall(model.getHall()); + } + if (model.getToilet() != 0) { + propertyModel.setToilet(model.getToilet()); + } + if (model.getCalDate() != null) { + propertyModel.setCalDate(model.getCalDate()); + } + if (model.getPropertyType() != null) { + propertyModel.setPropertyType(model.getPropertyType()); + } + if (StringUtils.isNotBlank(model.getDirection())) { + propertyModel.setDirection(model.getDirection()); + } + if (StringUtils.isNotBlank(model.getDecoration())) { + propertyModel.setDecoration(model.getDecoration()); + } + + if (model.getDecorationCost() != null && model.getDecorationCost() != 0) { + propertyModel.setDecorationCost(model.getDecorationCost()); + } + + if (model.getDecorationAge() != 0) { + propertyModel.setDecorationAge(model.getDecorationAge()); + } + if (StringUtils.isNotBlank(model.getView())) { + propertyModel.setView(model.getView()); + } + if (StringUtils.isNotBlank(model.getNoise())) { + propertyModel.setNoise(model.getNoise()); + } + if (model.getGardenSize() != null && model.getGardenSize() != 0) { + propertyModel.setGardenSize(model.getGardenSize()); + } + if (model.getBasementSize() != null && model.getBasementSize() != 0) { + propertyModel.setBasementSize(model.getBasementSize()); + } + if (model.getOuterSize() != null && model.getOuterSize() != 0) { + propertyModel.setOuterSize(model.getOuterSize()); + } + if (model.getAtticSize() != null && model.getAtticSize() != 0) { + propertyModel.setAtticSize(model.getAtticSize()); + } + if (StringUtils.isNotBlank(model.getNegativeFactor())) { + propertyModel.setNegativeFactor(model.getNegativeFactor()); + } + if (model.getAge() != 0) { + propertyModel.setAge(model.getAge()); + } + if (model.getCarportPrice() != null && model.getCarportPrice() != 0) { + propertyModel.setCarportPrice(model.getCarportPrice()); + } + + if (StringUtils.isNotBlank(model.getFacilities())) { + propertyModel.setFacilities(model.getFacilities()); + } + if (StringUtils.isNotBlank(model.getInsidePosition())) { + propertyModel.setInsidePosition(model.getInsidePosition()); + } + return propertyModel; + } + + private List convertSampileQueryToBean(District district,SampleQuery... queries) throws Exception { + + List queryBeans = new ArrayList(queries.length); + for (SampleQuery q : queries) { + + CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean(); + BeanUtils.copyProperties(q, queryBean); + queryBean.setProperty(district); + String estateType = queryBean.getProperty().getEstateType2(); + queryBean.setPropertyTypeCode("01"); + if (StringUtils.isNotBlank(estateType)) { + if (estateType.equals("ÆÕͨסլ")) { + queryBean.setPropertyTypeCode("01"); + } else if (estateType.equals("±ðÊû")) { + queryBean.setPropertyTypeCode("02"); + } else if (estateType.equals("ÉÌס")) { + queryBean.setPropertyTypeCode("03"); + } + } + + Integer decrCondCode = queryBean.getDecrCondCode(); + if (decrCondCode == null) { + decrCondCode = 2; + } + if (decrCondCode > 5 || decrCondCode < 1) { + throw new Exception("decrCondCodeȡֵ·Ç·¨"); + } + Integer towardDirectCode = queryBean.getTowardDirectCode(); + if (towardDirectCode == null) { + towardDirectCode = 3; + } + if (towardDirectCode > 10 || towardDirectCode < 1) { + throw new Exception("towardDirectCodeȡֵ·Ç·¨"); + } + queryBeans.add(queryBean); + } + return queryBeans; + } + + private void adjustPriceByRatio(District district, Evaluation evaluation) { + + try { + ApiUserCfg apiUserCfg_pt = apiUserCfgService.findByUserId(Long.valueOf(evaluation.getFromUserId()), ApiUserCfg.ApiUserCfgKey.PRICE_TYPE); + if (apiUserCfg_pt != null && apiUserCfg_pt.getCfgValue() != null) { + String priceType = apiUserCfg_pt.getCfgValue().toString(); + // ÆÀ¹À¼ÛÔòϵÊýµ÷Õû + if (StringUtils.isNotBlank(priceType) && "evaluate".equals(priceType)) { + EvaluateRatio evaluateRatio = null; + if (StringUtils.isNotBlank(district.getRegion())) { + evaluateRatio = evaluateRatioService.findByCityAndRegion(district.getCity(), district.getRegion()); + } + if (evaluateRatio == null) { + evaluateRatio = evaluateRatioService.findByCity(district.getCity()); + } + if (evaluateRatio != null) { + // ϵÊýÌí¼Ó + long totalPrice = evaluation.getBigTotalPrice(); + totalPrice = (long) (totalPrice * (1 + evaluateRatio.getRatio())); + evaluation.setBigTotalPrice(totalPrice); + evaluation.setAvgPrice((int) (totalPrice / evaluation.getArea())); + } + } + } + } catch (Exception ex) { + LOGGER.error("ϵÊýϵ÷Òì³£{}", ex.getMessage()); + } + } + + public Object evaluateAction(PropertyEvaluationModel model, HttpServletRequest request, HouseValueInformationDto houseValueInformation, RestfulModelAndView mav) + throws NumberFormatException, IllegalAccessException { +// RestfulModelAndView mav = new RestfulModelAndView(); +// mav.setViewType("rest"); + if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName()) + || StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) { + mav.setModel(BasicModel.buildBadRequestModel("²ÎÊý·Ç·¨:³ÇÊÐ,ÇøÓò,Ð¡ÇøÃû,Ãæ»ý(size)Ϊ±ØÌîÏî")); + return mav; + } + if (model.getCity().endsWith("ÊÐ")) { + model.setCity(model.getCity().replaceAll("ÊÐ$", "")); + } + if (StringUtils.isNotBlank(request.getParameter("calDate"))) { + Date calDate = null; + try { + calDate = DateUtils.parseDate(request.getParameter("calDate"), new String[]{"yyyy-MM-dd"}); + } catch (ParseException e) { + + } + if (calDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("calDate:Êý¾ÝÀàÐͲ»ºÏ·¨")); + return mav; + } else { + model.setCalDate(calDate); + } + } + /* Ïȵ½CPDB¿âÖвéÕÒÐ¡Çø */ + District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), + "district"); + if (district == null) { + if (model.getDistrict().contains("ÊÐÏ½Çø") || model.getDistrict().contains(model.getCity())) { + district = districtService.findByNameAndAlias(model.getCity(), null, model.getName(), "district"); + } + if (district == null) { + mav.setModel(BasicModel.buildBadRequestModel("¸ÃÐ¡Çø²»´æÔÚ")); + return mav; + } + } + model.setName(district.getName()); + + if (model.getCarportPrice() != null && (model.getCarportPrice() < 0 || model.getCarportPrice() > 1000000)) { + mav.setModel(BasicModel.buildBadRequestModel("carportPrice(³µÎ»)ȡֵ²»ºÏ·¨")); + return mav; + } + if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("maxFloorȡֵ·Ç·¨,ÕýÈ··¶Î§[1,60)")); + return mav; + } + + if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("floorȡֵ·Ç·¨,ÕýÈ··¶Î§[1,60)")); + return mav; + } + if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) { + mav.setModel(BasicModel.buildBadRequestModel("ËùÔÚÂ¥²ã²»ÄÜ´óÓÚ×ÜÂ¥²ã")); + return mav; + } + + if (model.getFloor() == null) { + JSONObject structureOb = addressMatchProxyService.addressStructure(district.getCity(), model.getAddress()); + if (structureOb != null) { + if (structureOb.containsKey("buildingNumber")) { + model.setBuildingNumber(structureOb.getString("buildingNumber")); + } + + if (structureOb.containsKey("roomNumber")) { + String roomNumber = structureOb.getString("roomNumber"); + model.setFloor(getFloor(roomNumber)); + } + + } + } + + if (model.getMaxFloor() == null && model.getFloor() != null && StringUtils.isNotBlank(model.getBuildingNumber())) { + Loudong loudong = loudongService.findForEvaluate(district.getId(), model.getBuildingNumber(), model.getUnitNumber()); + if (loudong != null && loudong.getFloors() >= model.getFloor()) { + model.setMaxFloor(loudong.getFloors()); + } + } + model.setRegion(district.getRegion()); + model.setDistrictName(district.getName()); + if (StringUtils.isBlank(model.getPropertyType())) { + if (district.getEstateType2() != null && district.getEstateType2().contains("±ðÊû")) { + model.setPropertyType("1"); + } + } + + if (model.getCalDate() != null) { + if (new Date().before(model.getCalDate())) { + model.setCalDate(DateUtil.getFirstDayOfWeek(new Date())); + } else { + model.setCalDate(DateUtil.getFirstDayOfWeek(model.getCalDate())); + } + } else { + model.setCalDate(DateUtil.getFirstDayOfWeek(new Date())); + } + + + Evaluation evaluation = evaluationService.evaluate(district, buildEvaluation(model, request), + model.getCalDate()); + Double cityPriceCredit = null; + if (StringUtils.isNotBlank(evaluation.getFromUserId())) { + try { + ApiUserAuthority apiUserAuthority = apiUserAuthorityService + .findByUserId(Long.valueOf(evaluation.getFromUserId())); + if (apiUserAuthority.getCityCreditMap() != null + && apiUserAuthority.getCityCreditMap().containsKey(evaluation.getCity())) { + cityPriceCredit = apiUserAuthority.getCityCreditMap().get(evaluation.getCity()); + if (cityPriceCredit > 1 || cityPriceCredit < 0) { + cityPriceCredit = null; + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + this.adjustPriceByRatio(district, evaluation); + } + + // µ÷ÕûÃæ»ý²»Í¬Ãæ»ý¼Û¸ñ + try { + DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); + int orgAvgPrice = 0; + if (districtStatBo != null) { + if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("±ðÊû") && districtStatBo.getVillaDistrictStat() != null) { + orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); + } else if (districtStatBo.getDistrictStat() != null) { + orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + } + } + if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) { + int factorPrice = evaluation.getAvgPrice(); + int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice); + Integer minPrice = (int) (evaluation.getAvgPrice() * 0.95); + Integer maxPrice = (int) (evaluation.getAvgPrice() * 1.05); + // Æ«Àë¶È³¬¹ý5%²»½øÐе÷Õû + if (minPrice <= avgPrice && avgPrice <= maxPrice) { + evaluation.setAvgPrice(avgPrice); + evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea())); + } + } + } catch (Exception ex) { + LOGGER.error("µ÷ÕûÃæ»ý²»Í¬Ãæ»ý¼Û¸ñÒì³£{}", ex.getMessage()); + } + + if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0 + && (cityPriceCredit == null || evaluation.getCredit() >= cityPriceCredit)) { + Map districtPriceMap = new HashMap(); + districtPriceMap.put("city", district.getCity()); + districtPriceMap.put("district", district.getRegion()); + districtPriceMap.put("name", district.getName()); + districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice()); + districtPriceMap.put("avgPrice", evaluation.getAvgPrice()); + + // ¸ù¾Ý³ÇÊÐµÈ ¼¶ÉèÖÃD¼¶¿ÉÐÅ¶È + ApiUserAuthority apiUserAuthority = apiUserAuthorityService + .findByUserId(Long.valueOf(evaluation.getFromUserId())); + if (apiUserAuthority != null && null != apiUserAuthority.getCreditLevelStatus() + && apiUserAuthority.getCreditLevelStatus() == 1) { + double dCredit = 0.61; + if (null != apiUserAuthority.getPriceRatingMap()) { + ServerArea serverArea = serverAreaService.findByDisplay(evaluation.getCity()); + Map rateMap = apiUserAuthority.getPriceRatingMap(); + if (null != rateMap) { + dCredit = rateMap.get(CITYLEVEL_MAP.get(serverArea.getNewCityGrade().toString())); + } + } + Map rMap = getLastEvaluationPrice(district, evaluation, dCredit); + + if (model.getScope() == EVALUATE_SHOW_DETAIL) { + if (null != rMap) { + if (rMap.containsKey("level")) { + districtPriceMap.put("level", rMap.get("level")); + } + if (rMap.containsKey("other_price")) { + districtPriceMap.put("other_price", rMap.get("other_price")); + } + } + } + + Long lastPrice = (Long) rMap.get("lastPrice"); + + if (null != lastPrice) { + districtPriceMap.put("totalPrice", lastPrice); + if (lastPrice > 0 && lastPrice != evaluation.getBigTotalPrice()) { + districtPriceMap.put("avgPrice", (int) (lastPrice / evaluation.getArea())); + } + } else { + mav.setModel(BasicModel.buildOKModel().setMsg("ÔÝʱ²»Ö§³Ö¸ÃÐ¡ÇøµÄ¹À¼Û").markNoData()); + return mav; + } + + } else { + districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice()); + } + + if (model.getScope() == EVALUATE_SHOW_DETAIL) { + districtPriceMap.put("evaluateWay", evaluation.getEvaluateWay()); + districtPriceMap.put("credit", evaluation.getCredit()); + districtPriceMap.put("id", evaluation.getId()); + } + // ½«ÆÀ¹À¼Û·Åµ½½á¹û¼¯ + houseValueInformation.setAddressValue(districtPriceMap); +// mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); + try { + if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) { + openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/property/evaluate"); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return mav; + } else { + evaluationService.remove(evaluation.getId()); + mav.setModel(BasicModel.buildOKModel().setMsg("ÔÝʱ²»Ö§³Ö¸ÃÐ¡ÇøµÄ¹À¼Û").markNoData()); + return mav; + } + } + + private Integer getFloor(String roomNumber) { + if (StringUtils.isNotBlank(roomNumber) && DataUtil.isNumber(roomNumber)) { + if (roomNumber.length() == 3) { + return Integer.valueOf(roomNumber.substring(0, 1)); + } else if (roomNumber.length() == 4) { + return Integer.valueOf(roomNumber.substring(0, 2)); + } else { + return null; + } + } + return null; + } + + private Evaluation buildEvaluation(PropertyEvaluationModel model, HttpServletRequest request) { + Evaluation evaluation = new Evaluation(); + evaluation.setCity(model.getCity()); + evaluation.setRegion(model.getRegion()); + evaluation.setDistrictName(model.getName()); + evaluation.setDirection(DIRECTION.get(model.getDirection())); + evaluation.setFitment(EVALUATION_MODEL_FITMENT.get(FITMENT.get(StringUtils.isNotBlank(model.getDecoration()) ? + model.getDecoration() : model.getFitment()))); + evaluation.setNoise(NOISE.get(model.getNoise())); + evaluation.setEstateType(PROPERTY_TYPES.get(model.getPropertyType())); + evaluation.setSight(SIGHT.get(model.getView())); + evaluation.setAtticArea(model.getAtticSize()); + evaluation.setTerraceArea(model.getOuterSize()); + evaluation.setBasementArea(model.getBasementSize()); + evaluation.setGardenArea(model.getGardenSize()); + String worryFacility = model.getNegativeFactor(); + evaluation.setWorryFacility(NEGATIVE_FACTOR.get(worryFacility)); + evaluation.setCreationDate(new Date()); + evaluation.setModificationDate(new Date()); + evaluation.setClientNo(model.getClientNo()); + if (0 != model.getAge()) { + evaluation.setAge(model.getAge()); + } + evaluation.setArea(model.getSize()); + if (ArrayUtils.isNotEmpty(model.getBuildQuality())) { + evaluation.setBuildQuality(convertToString(model.getBuildQuality())); + } + if (StringUtils.isNotBlank(model.getBuildType())) { + evaluation.setBuildType(model.getBuildType()); + } + if (StringUtils.isNotBlank(model.getCarport())) { + evaluation.setCarport(model.getCarport()); + } + if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) { + evaluation.setFitmentAge(model.getDecorationAge()); + } + evaluation.setCarportPrice(model.getCarportPrice()); + evaluation.setCity(model.getCity()); + evaluation.setDistrictName(model.getName()); + if (model.getDecorationCost() != null && model.getDecorationCost() > 0) { + evaluation.setFitmentCharge(model.getDecorationCost()); + } + if (0 != model.getHall()) { + evaluation.setHall(model.getHall()); + } + if (null != model.getFloor()) { + evaluation.setFloor(model.getFloor()); + } + if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) { + evaluation.setHeight(model.getMaxFloor()); + } + if (StringUtils.isNotBlank(model.getBuildingNumber())) { + evaluation.setHouseNum(model.getBuildingNumber()); + } + if (StringUtils.isNotBlank(model.getHouseProperty())) { + evaluation.setHouseProperty(model.getHouseProperty()); + } + if (StringUtils.isNotBlank(model.getInsidepos())) { + evaluation.setInsidepos(model.getInsidepos()); + } + if (StringUtils.isNotBlank(model.getLightingVentilation())) { + evaluation.setLightingVentilation(model.getLightingVentilation()); + } + + if (StringUtils.isNotBlank(model.getOtherFactor())) { + evaluation.setOtherFactor(model.getOtherFactor()); + } + evaluation.setRegion(model.getDistrict()); + if (null != model.getRoom()) { + evaluation.setRoom(model.getRoom()); + } + if (StringUtils.isNotBlank(model.getRoomNumber())) { + evaluation.setRoomNum(model.getRoomNumber()); + } + if (StringUtils.isNotBlank(model.getSideset())) { + evaluation.setSideset(model.getSideset()); + } + if (0 != model.getToilet()) { + evaluation.setToilet(model.getToilet()); + } + if (model.getFacilities() != null) { + String facilities = model.getFacilities(); + String[] fs = facilities.split(","); + for (int i = 0; i < fs.length; i++) { + fs[i] = FACILITIES.get(fs[i]); + } + evaluation.setFacilities(convertToString(fs)); + } + + if (StringUtils.isNotBlank(model.getFacade())) { + evaluation.setFacade(model.getFacade()); + } + if (StringUtils.isNotBlank(model.getTraffice())) { + evaluation.setTraffice(model.getTraffice()); + } + if (StringUtils.isNotBlank(model.getShape())) { + evaluation.setShape(model.getShape()); + } + if (StringUtils.isNotBlank(model.getObstacle())) { + evaluation.setObstacle(model.getObstacle()); + } + if (StringUtils.isNotBlank(model.getIndustry())) { + evaluation.setIndustry(model.getIndustry()); + } + if (StringUtils.isNotBlank(model.getSupportDevice())) { + evaluation.setSupportDevice(model.getSupportDevice()); + } + if (StringUtils.isNotBlank(model.getLeftPosition())) { + evaluation.setLeftPosition(model.getLeftPosition()); + } + if (StringUtils.isNotBlank(model.getShopType())) { + evaluation.setShopType(model.getShopType()); + } + if (StringUtils.isNotBlank(model.getShopUnique())) { + evaluation.setShopUnique(model.getShopUnique()); + } + if (StringUtils.isNotBlank(model.getLocation())) { + evaluation.setLocation(model.getLocation()); + } + if (model.isNewDistrict()) { + evaluation.setNewDistrict(model.isNewDistrict()); + } + String ip = AnalyticsUtil.getIpAddress(ActionContext.getContext().getRequest()); + evaluation.setIp(ip); + AuthenticationBean authenticationBean = (AuthenticationBean) request + .getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); + if (authenticationBean != null && authenticationBean.apiUser != null) { + evaluation.setFromUserId(String.valueOf(authenticationBean.apiUser.getId())); + } + evaluation.setSource("api_property_evaluation"); + return evaluation; + } + + private Map getLastEvaluationPrice(District district, Evaluation evaluation, double dCredit) + throws NumberFormatException, IllegalAccessException { + Date startDate = DateUtil.parseDate(DateUtil.addMonth(new Date(), -6), "yyyy-MM-dd"); + // µÚÈý·½¼Û¸ñ + Map otherPriceRets = averageStatisticsService.findFirstAverageStatictics(district.getCity(), + district.getRegion(), district.getName(), district.getCategory(), startDate); + if (null == otherPriceRets) { + otherPriceRets = new HashMap(); + } + + otherPriceRets.put("fjw_price", evaluation.getAvgPrice()); + Map levelMap = getPriceLevel(otherPriceRets, evaluation.getCredit()); + Long lastPrice = getLastPrice(levelMap, otherPriceRets, evaluation, dCredit); + + Map rMap = new HashMap(); + rMap.put("lastPrice", lastPrice); + if (null != levelMap && levelMap.containsKey("level")) { + String priceLevel = (String) levelMap.get("level"); + rMap.put("level", priceLevel); + } + rMap.put("other_price", otherPriceRets); + return rMap; + } + + private Map getPriceLevel(Map otherPriceRets, double credit) { + + Integer avgPrice = (Integer) otherPriceRets.get("fjw_price"); + + int keyCount = 0; + int commonCount = 0; + int isExistCount = 0; + + List prices = new ArrayList(); + List smallPrices = new ArrayList(); + + if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + int mod = avgPrice - fangguguPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(fangguguPrice); + } + isExistCount++; + } + if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + int mod = avgPrice - yungujiaPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(yungujiaPrice); + } + + isExistCount++; + } + + if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + int mod = avgPrice - zhugezhaofangPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(zhugezhaofangPrice); + } + + isExistCount++; + } + + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + int mod = avgPrice - lianjiaPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(lianjiaPrice); + } + isExistCount++; + } + if (null != otherPriceRets.get("anjuke_price")) { + Integer anjukePrice = (Integer) otherPriceRets.get("anjuke_price"); + int mod = avgPrice - anjukePrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(anjukePrice); + } else { + prices.add(anjukePrice); + } + + isExistCount++; + } + if (null != otherPriceRets.get("ganji_price")) { + Integer ganjiPrice = (Integer) otherPriceRets.get("ganji_price"); + int mod = avgPrice - ganjiPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(ganjiPrice); + } else { + prices.add(ganjiPrice); + } + + isExistCount++; + } + if (null != otherPriceRets.get("soufan_price")) { + Integer soufan_price = (Integer) otherPriceRets.get("soufan_price"); + int mod = avgPrice - soufan_price; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(soufan_price); + } else { + prices.add(soufan_price); + } + + isExistCount++; + } + if (null != otherPriceRets.get("tobushi_price")) { + Integer tobushi = (Integer) otherPriceRets.get("tobushi_price"); + int mod = avgPrice - tobushi; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(tobushi); + } else { + prices.add(tobushi); + } + + isExistCount++; + } + + if (null != otherPriceRets.get("zhongyuan_price")) { + Integer zhongyuanPrice = (Integer) otherPriceRets.get("zhongyuan_price"); + int mod = avgPrice - zhongyuanPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(zhongyuanPrice); + } else { + prices.add(zhongyuanPrice); + } + + isExistCount++; + } + + Map retMap = new HashMap(); + String level = null; + if (keyCount >= 2) { + level = "A"; + } else if (keyCount >= 1 && commonCount >= 1) { + level = "A"; + } else if (keyCount >= 1 || commonCount >= 2) { + level = "B"; + } else if (commonCount >= 1) { + level = "C"; + } else if (isExistCount == 0) { + level = "D"; + } else if (isExistCount >= 1) { + if (isExistCount == 1) { + level = "D"; + } else { + level = "E"; + } + } + + if (credit == 0) { + level = "E"; + } + + if (StringUtils.isNotBlank(level)) { + retMap.put("level", level); + retMap.put("prices", prices); + retMap.put("small_prices", smallPrices); + } + return retMap; + } + + private Long getLastPrice(Map retMap, Map otherPriceRets, Evaluation evaluation, double dCredit) { + Long lastPrice = null; + if (null != retMap) { + String priceLevel = (String) retMap.get("level"); + + if (priceLevel.equals("D")) { + + lastPrice = inputResultByWebsite(otherPriceRets, evaluation, dCredit); + + } else if (priceLevel.equals("E")) { + if (evaluation.getCredit() >= 0.65) { + lastPrice = evaluation.getBigTotalPrice(); + } else { + List prices = (List) retMap.get("prices"); + int avgPrice = 0; + if (prices != null) { + avgPrice = findNewPrice(prices, evaluation.getAvgPrice()); + } + // ÔÚ dCreditÓë0.65Ö®¼ä + if (evaluation.getCredit() >= dCredit && dCredit < 0.65) { + if (avgPrice > 0) { + Double newTotalPrice = avgPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + Double newTotalPrice = lianjiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + Double newTotalPrice = zhugezhaofangPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + Double newTotalPrice = yungujiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + Double newTotalPrice = fangguguPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } + } else if (evaluation.getCredit() < dCredit) {// ÔÚdCreditÒÔÏ + if (avgPrice > 0) { + Double newTotalPrice = avgPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + Double newTotalPrice = lianjiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + Double newTotalPrice = zhugezhaofangPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + Double newTotalPrice = yungujiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + Double newTotalPrice = fangguguPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } + } + } + } + + } else if (priceLevel.equals("C")) { + List smallPrices = (List) retMap.get("small_prices"); + if (smallPrices != null) { + smallPrices.add(evaluation.getAvgPrice()); + int avgPrice = sum(smallPrices) / smallPrices.size(); + Double newTotalPrice = avgPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } + return lastPrice; + } + + private Integer sum(List smallPrices) { + int sum = 0; + for (int price : smallPrices) { + sum += price; + } + return sum; + } + + private Long inputResultByWebsite(Map otherPriceRets, Evaluation evaluation, double dCredit) { + Long lastPrice = null; + if (evaluation.getCredit() >= dCredit) { + lastPrice = evaluation.getBigTotalPrice(); + } else { + if (evaluation.getCredit() < dCredit) { + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + Double newTotalPrice = lianjiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + Double newTotalPrice = zhugezhaofangPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + Double newTotalPrice = yungujiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + Double newTotalPrice = fangguguPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } + return lastPrice; + } + + private Integer findNewPrice(List prices, int avgPrice) { + int minValue1 = Integer.MAX_VALUE; + List> values = new ArrayList>(); + int fjw_price = avgPrice; + + // ÕÒ³ö×îС²î + for (int i = 0; i < prices.size() - 1; i++) { + int a = prices.get(i); + for (int j = i + 1; j < prices.size(); j++) { + int b = prices.get(j); + int mod = Math.abs(a - b); + if (mod < minValue1) { + minValue1 = mod; + } + } + } + + // ¸ù¾Ý×îС²îÕÒ³ö½á¹û + for (int i = 0; i < prices.size() - 1; i++) { + int a = prices.get(i); + for (int j = i + 1; j < prices.size(); j++) { + int b = prices.get(j); + int mod = Math.abs(a - b); + if (mod == minValue1) { + values.add(Arrays.asList(a, b)); + } + } + } + + int minValue2 = Integer.MAX_VALUE; + int lastValue = 0; + if (values.size() >= 1) { + for (List value : values) { + int newPrice = (value.get(0) + value.get(1)) / 2; + int mod = Math.abs(fjw_price - newPrice); + if (mod < minValue2) { + minValue2 = mod; + lastValue = newPrice; + } + } + } + + if (lastValue > 0) { + double temp = DataUtil.getDoubleRound(2, minValue1 * 100 / lastValue); + temp = Math.abs(temp); + if (temp > 15) { + lastValue = 0; + } + } + return lastValue; + } + + + + + public void setEvaluationService(EvaluationService evaluationService) { + this.evaluationService = evaluationService; + } + + public void setDistrictService(DistrictService districtService) { + this.districtService = districtService; + } + + public void setAddressService(AddressService addressService) { + } + + public void setDistrictStatService(DistrictStatService districtStatService) { + this.districtStatService = districtStatService; + } + + protected AddressMatchLogService addressMatchLogService; + + public void setAddressMatchLogService(AddressMatchLogService addressMatchLogService) { + this.addressMatchLogService = addressMatchLogService; + } + + + + public BatchEvaluateService getBatchEvaluateService() { + return batchEvaluateService; + } + + public void setBatchEvaluateService(BatchEvaluateService batchEvaluateService) { + this.batchEvaluateService = batchEvaluateService; + } + + public void setAddressMatchProxyService(AddressMatchProxyService addressMatchProxyService) { + this.addressMatchProxyService = addressMatchProxyService; + } + + public void setLoudongService(LoudongService loudongService) { + this.loudongService = loudongService; + } + + public void setApiUserAuthorityService(ApiUserAuthorityService apiUserAuthorityService) { + this.apiUserAuthorityService = apiUserAuthorityService; + } + + public void setAverageStatisticsService(AverageStatisticsService averageStatisticsService) { + this.averageStatisticsService = averageStatisticsService; + } + + public void setServerAreaService(ServerAreaService serverAreaService) { + this.serverAreaService = serverAreaService; + } + + public void setApiUserCfgService(ApiUserCfgService apiUserCfgService) { + this.apiUserCfgService = apiUserCfgService; + } + + public void setOpenApiLogService(OpenApiLogService openApiLogService) { + this.openApiLogService = openApiLogService; + } + + public void setFangjiaOfficialAreaService(FangjiaOfficialAreaService fangjiaOfficialAreaService) { + this.fangjiaOfficialAreaService = fangjiaOfficialAreaService; + } + + + public void setEvaluateRatioService(EvaluateRatioService evaluateRatioService) { + this.evaluateRatioService = evaluateRatioService; + } + + + public void setEvaluateFactorService(EvaluateFactorService evaluateFactorService) { + this.evaluateFactorService = evaluateFactorService; + } + + public void setCzbankSampleService(CzbankSampleService czbankSampleService) { + this.czbankSampleService = czbankSampleService; + } + + public void setDistrictFacilitysService(DistrictFacilitysService districtFacilitysService) { + this.districtFacilitysService = districtFacilitysService; + } + +} + diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java index 083ae48f0..f3548c9cc 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/HouseController.java @@ -903,7 +903,10 @@ public class HouseController { if(null == sampleQuery.getMax()){ sampleQuery.setMax(10); } + long start = System.currentTimeMillis(); List collaterals = czbankSampleService.findSample2(querys, sampleQuery.getMax()); + long end = System.currentTimeMillis(); + System.out.println("ÓÃʱ:"+(end-start)); Collateral collateral = collaterals.get(0); List samples = collateral.getSample(); UniversalDto dto = UniversalDto.newDto(); @@ -913,7 +916,8 @@ public class HouseController { if(null != collateral.getMinPrice()){ dto.append("minUnitPrice", collateral.getMinPrice()); } - dto.append("datas", samples); + + dto.append("datas", samples); // if(samples!= null && samples.size()>=2){ // Sample minSample = samples.get(samples.size()-2); // Sample maxSample = samples.get(samples.size()-1); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/TestController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/TestController.java new file mode 100644 index 000000000..07fbed914 --- /dev/null +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/TestController.java @@ -0,0 +1,1608 @@ +/* +package com.fangjia.open.controllers; + +import com.fangjia.core.util.*; +import com.fangjia.dal.common.DistrictKey; +import com.fangjia.dal.mongo.fangjia.model.ServerArea; +import com.fangjia.dal.mongo.model.ApiUserCfg; +import com.fangjia.dal.mongo.model.DistrictFacilitys; +import com.fangjia.dal.mongo.model.Evaluation; +import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap; +import com.fangjia.dal.mongo.model.bkoff.Loudong; +import com.fangjia.dal.mongo.open.model.ApiUserAuthority; +import com.fangjia.dal.mongo.open.model.EvaluateRatio; +import com.fangjia.dal.seaweed.model.District; +import com.fangjia.open.HttpCode; +import com.fangjia.open.OpenHttpCodeEnum; +import com.fangjia.open.dto.HouseValueInformationDto; +import com.fangjia.open.dto.UniversalDto; +import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto; +import com.fangjia.open.interceptors.AuthenticationBean; +import com.fangjia.open.model.*; +import com.fangjia.open.util.CommonDtoUtils; +import com.fangjia.open.util.CommonUtils; +import com.fangjia.open.ws.query.SampleQuery; +import com.fangjia.service.api.AddressMatchProxyService; +import com.fangjia.service.api.ApiUserCfgService; +import com.fangjia.service.bo.Collateral; +import com.fangjia.service.bo.DistrictStatBo; +import com.fangjia.service.bo.Sample; +import com.fangjia.service.datastore.*; +import com.fangjia.service.datastore.bean.CollateralSampleQueryBean; +import com.fangjia.service.district.*; +import com.fangjia.service.mongo.bkoff.HouseLoudongService; +import com.fangjia.service.mongo.bkoff.LoudongService; +import com.fangjia.service.mongo.fangjia.*; +import com.fangjia.service.open.*; +import com.fangjia.service.tool.OpenLogService; +import com.fangjia.service.web.AddressService; +import net.sf.json.JSONObject; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DateUtils; +import org.slf4j.Logger; +import org.sothis.web.mvc.ActionContext; +import org.sothis.web.mvc.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; +import java.util.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import static com.poseidon.util.TypeConverter.convertToString; + +*/ +/** + * @author 13607 + * @since 2023/12/12 10:29 + *//* + + + +public class TestController { + private DistrictService districtService; + + private DistrictStatService districtStatService; + + private FangjiaOfficialAreaService fangjiaOfficialAreaService; + private AddressMatchProxyService addressMatchProxyService; + + private static final Logger LOGGER = LoggerFactory.getLogger(PropertyController.class); + private HouseLoudongService houseLoudongService; + private LoudongService loudongService; + private EvaluationService evaluationService; + private BatchEvaluateService batchEvaluateService; + private ApiUserAuthorityService apiUserAuthorityService; + private AverageStatisticsService averageStatisticsService; + private ServerAreaService serverAreaService; + private ApiUserCfgService apiUserCfgService; + private OpenApiLogService openApiLogService; + private EvaluateFactorService evaluateFactorService; + + private CzbankSampleService czbankSampleService; + + private DistrictFacilitysService districtFacilitysService; + + private static final int DEFAULT_PAGE_SIZE = 20; + private static final String[] PROPERTY_SEARCH_API_FIELDS = {"address", "city", "region", "name", "lat2", "lng2", "lat", "lng", "block", "estateType2", "addrAlias"}; + static final int BAI_DU_GEO = 1;// °Ù¶ÈÏµ×ø±ê + static final int GAO_DE_GEO = 2;// ¸ßµÂÏµ×ø±ê + + + private EvaluateRatioService evaluateRatioService; + + private static final int EVALUATE_SHOW_DETAIL = 1; + private static final Map PROPERTY_TYPES = new HashMap() { + { + put(null, "ÆÕͨסլ"); + put("0", "ÆÕͨסլ"); + put("1", "±ðÊû"); + put("2", "ÉÌס"); + } + }; + + private static final Map DIRECTION = new HashMap() { + { + put(null, "ÄÏ"); + put("1", "Î÷ÄÏ"); + put("2", "¶«ÄÏ"); + put("3", "ÄÏ"); + put("4", "Î÷±±"); + put("5", "¶«±±"); + put("6", "¶«"); + put("7", "Î÷"); + put("8", "±±"); + put("9", "¶«Î÷"); + put("10", "Äϱ±"); + } + }; + + private static final Map FITMENT = new HashMap() { + { + put(null, "¼ò×°"); + put("1", "ëÅ÷"); + put("2", "¼ò×°"); + put("3", "¾«×°"); + put("4", "ºÀ×°"); + } + }; + + private static final Map EVALUATION_MODEL_FITMENT = new HashMap() { + { + put(null, "¼òµ¥×°ÐÞ"); + put("¼ò×°", "¼òµ¥×°ÐÞ"); + put("ëÅ÷", "ëÅ÷"); + put("¾«×°", "¾«×°ÐÞ"); + put("ºÀ×°", "ºÀ»ª×°ÐÞ"); + } + }; + + private static final Map SIGHT = new HashMap() { + { + put(null, "Ò»°ã"); + put("1", "¾°¹Û·¿"); + put("2", "²à¾°¹Û·¿"); + put("3", "Ò»°ã"); + put("4", "²î"); + } + }; + + private static final Map NOISE = new HashMap() { + { + put(null, "ÎÞÔëÒô"); + put("0", "ÎÞÔëÒô"); + put("1", "ÔëÒô½ÏС"); + put("2", "ÔëÒô´ó"); + } + }; + private static final Map FACILITIES = new HashMap() { + { + put("0", "½¡Éí·¿"); + put("1", "ÓÎÓ¾³Ø"); + put("2", "»áËù"); + put("3", "ÍøÇò³¡"); + put("4", "Çò³¡"); + put("5", "ÆåÅÆÊÒ"); + put("6", "Í£³µ³¡"); + put("7", "ͼÊé¹Ý"); + put("8", "»î¶¯ÖÐÐÄ"); + } + }; + + private static final Map NEGATIVE_FACTOR = new HashMap() { + { + put(null, "ÎÞ"); + put("1", "ºÜ½ü"); + put("2", "½Ï½ü"); + put("3", "ÎÞ"); + } + }; + + + Map listKeyMap = new HashMap() { + { + put("school", "schools"); + put("hospital", "hospitals"); + put("bank", "banks"); + put("supermarket", "supermarkets"); + put("market", "markets"); + put("beautySalon", "beautySalons"); + put("gym", "gyms"); + put("park", "parks"); + put("bus", "buses"); + put("metro", "metros"); + put("dock", "docks"); + put("airport", "airports"); + put("trainStation", "trainStations"); + put("restaurant", "restaurants"); + put("hotel", "hotels"); + } + }; + + private static final Map CITYLEVEL_MAP = new HashMap() { + { + put("1000", "one");// Ò»Ïß + put("1500", "newOne");// ÐÂÒ»Ïß + put("2000", "two");// ¶þÏß + put("3000", "three");// ÈýÏß + put("4000", "four");// ËÄÏß + put("5000", "five");// ÎåÏß + } + }; + + + //È«¾Öjson + private JSONObject globalJson = null; + + + public Object houseValueInformationAction(HouseInfomationModel model, HttpServletRequest httpServletRequest) throws IllegalAccessException, HttpRequestException { + + HouseValueInformationDto houseValueInformation = new HouseValueInformationDto(); + RestfulModelAndView mav = new RestfulModelAndView(); + + if (StringUtils.isBlank(model.getAddress()) || StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(String.valueOf(model.getSize()))) { + mav.setModel(BasicModel.buildBadRequestModel("³ÇÊÐ(city),µØÖ·(address),Ãæ»ý(size)Ϊ±ØÌî×Ö¶Î")); + return mav; + } + + HttpRequest httpRequest = new HttpRequest(); + + Map communityAvgPriceParams = new HashMap(); + communityAvgPriceParams.put("city", model.getCity()); + communityAvgPriceParams.put("address", model.getAddress()); + communityAvgPriceParams.put("category", model.getCategory()); + communityAvgPriceParams.put("useMap", String.valueOf(model.isUseMap())); + globalJson = httpRequest.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", communityAvgPriceParams, "UTF-8"); + + // ´´½¨Ïß³Ì³Ø + ExecutorService executorService = Executors.newFixedThreadPool(5); + + Future avgPriceFuture = executorService.submit(new UpdateCommunityAvgPriceCallable(globalJson, mav)); + Future> future2 = executorService.submit(new UpdateAddressValueCallable( globalJson, model, mav, httpServletRequest)); + Future future3 = executorService.submit(new UpdateHouseCaseCallable(houseValueInformation, globalJson, model, mav)); + Future future4 = executorService.submit(new UpdateSurroundingPoiCallable(houseValueInformation, globalJson, model, mav)); + + try { + // »ñÈ¡Ïß³ÌÈÎÎñµÄ·µ»Ø½á¹û + MatchedBuildingDto avgPrice = avgPriceFuture.get(); + if (avgPrice!=null){ + houseValueInformation.setCommunityAvgPrice(avgPrice); + }else { + mav.setModel(BasicModel.buildServerErrorModel().setMsg("·þÎñÉý¼¶ÖÐ...")); + } + Map result2 = future2.get(); + UniversalDto result3 = future3.get(); + DistrictFacilitys result4 = future4.get(); + + // ¸ù¾ÝÐèÒª´¦Àí·µ»Ø½á¹û + // ... + } catch (Exception e) { + // ´¦ÀíÒì³£ + e.printStackTrace(); + } + + + // ¹Ø±ÕÏß³Ì³Ø + executorService.shutdown(); + return mav; + + + } + + private class UpdateCommunityAvgPriceCallable implements Callable { + private JSONObject globalJson; + private ModelAndView mav; + + public UpdateCommunityAvgPriceCallable( JSONObject globalJson, ModelAndView mav) { + this.globalJson = globalJson; + this.mav = mav; + } + + @Override + public MatchedBuildingDto call() throws Exception { + synchronized (globalJson) { + + try { + //ÐÂÆ¥Åä½Ó¿Ú + JSONObject json = globalJson; + BasicModel basicModel = new BasicModel(200, "ok"); + if (json != null && json.size() > 0) { + MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json); + + District district = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(), "district"); + if (null != district) { + DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(dto.getCity(), dto.getDistrict(), dto.getName())); + if (null != statBo) { + if (statBo.getDistrictStat() != null) { + dto.setAvgPrice(statBo.getDistrictStat().getAvgPrice()); + } else if (statBo.getVillaDistrictStat() != null) { + dto.setAvgPrice(statBo.getVillaDistrictStat().getAvgPrice()); + } + + } + } +// basicModel.setResult(dto); + // ±£´æÐ¡Çø¾ù¼ÛµÄ·µ»Ø½á¹û + return dto; + } + } catch (Exception e) { + e.printStackTrace(); + return null; + } + return null; + } + } + } + + private class UpdateAddressValueCallable implements Callable { + private JSONObject globalJson; + + private HouseInfomationModel model; + + private RestfulModelAndView mav; + private HttpServletRequest httpServletRequest; + + public UpdateAddressValueCallable(JSONObject globalJson, HouseInfomationModel model, RestfulModelAndView mav, HttpServletRequest httpServletRequest) { + this.globalJson = globalJson; + this.model = model; + this.mav = mav; + this.httpServletRequest = httpServletRequest; + } + + @Override + public MatchedBuildingDto call() throws Exception { + //¸ù¾Ýmodel¸øPropertyEvaluationModel¸³Öµ + PropertyEvaluationModel propertyEvaluationModel = createPropertyEvaluationModelFromHouseInfomationModel(model); + +// RestfulModelAndView propertyEvaluationMav = new RestfulModelAndView(); +// mav.setViewType("rest"); +// if (StringUtils.isBlank(propertyEvaluationModel.getCity()) || StringUtils.isBlank(propertyEvaluationModel.getAddress()) || propertyEvaluationModel.getSize() <= 0) { +// mav.setModel(BasicModel.buildBadRequestModel("²ÎÊý·Ç·¨:³ÇÊÐ,µØÖ·,Ãæ»ý(size)Ϊ±ØÌîÏî")); +// return mav; +// } + if (propertyEvaluationModel.getDistrict() != null) { + //ÇøÓò±àÂëת·¿¼ÛÍøÇøÓò + FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(propertyEvaluationModel.getDistrict()); + if (fangjiaOfficialAreaMap != null) { + propertyEvaluationModel.setDistrict(fangjiaOfficialAreaMap.getFangjiaDistrict()); + } + } + + boolean villaFlag = DataUtil.isVilla(propertyEvaluationModel.getSize(), propertyEvaluationModel.getName(), propertyEvaluationModel.getHeight(), propertyEvaluationModel.getRoom()); + + District district = null; + Map params = new HashMap(); + params.put("city", propertyEvaluationModel.getCity()); + if (StringUtils.isNotBlank(propertyEvaluationModel.getDistrict())) { + params.put("suggestDistrict", propertyEvaluationModel.getDistrict()); + } + params.put("address", propertyEvaluationModel.getAddress()); + if (StringUtils.isNotBlank(propertyEvaluationModel.getName())) { + params.put("suggestName", propertyEvaluationModel.getName()); + } + params.put("category", "district"); + String result = addressMatchProxyService.parser(params); + if (result != null) { + JSONObject json = globalJson; + json = JSONObject.fromObject(result); + if (json.getInt("code") == 200) { + Map map = (Map) json.get("result"); + if ((Integer) map.get("precise") >= 0) { + String propertyType = (String) map.get("propertyType"); + if (villaFlag && StringUtils.isNotBlank(propertyType) && !propertyType.equals("±ðÊû")) { + district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name") + "±ðÊû", "district"); + } + if (null == district) { + district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name"), "district"); + } + + } + } + } + + if (district == null) { + mav.setModel(BasicModel.buildBadRequestModel("¸ÃµØÖ·²»Ö§³Ö¹À¼Û£¡")); +// return mav; + } + propertyEvaluationModel.setDistrict(district.getRegion()); + propertyEvaluationModel.setName(district.getName()); + try { + evaluateAction(propertyEvaluationModel, httpServletRequest, mav); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + } + + private class UpdateAddressValueRunnable implements Runnable { + private HouseValueInformationDto houseValueInformation; + + private JSONObject globalJson; + + private HouseInfomationModel model; + + private RestfulModelAndView mav; + private HttpServletRequest httpServletRequest; + + public UpdateAddressValueRunnable(HouseValueInformationDto houseValueInformation, JSONObject globalJson, HouseInfomationModel model, RestfulModelAndView mav, HttpServletRequest httpServletRequest) { + this.houseValueInformation = houseValueInformation; + this.globalJson = globalJson; + this.model = model; + this.mav = mav; + this.httpServletRequest = httpServletRequest; + } + + @Override + public void run() { + //¸ù¾Ýmodel¸øPropertyEvaluationModel¸³Öµ + PropertyEvaluationModel propertyEvaluationModel = createPropertyEvaluationModelFromHouseInfomationModel(model); + +// RestfulModelAndView propertyEvaluationMav = new RestfulModelAndView(); +// mav.setViewType("rest"); +// if (StringUtils.isBlank(propertyEvaluationModel.getCity()) || StringUtils.isBlank(propertyEvaluationModel.getAddress()) || propertyEvaluationModel.getSize() <= 0) { +// mav.setModel(BasicModel.buildBadRequestModel("²ÎÊý·Ç·¨:³ÇÊÐ,µØÖ·,Ãæ»ý(size)Ϊ±ØÌîÏî")); +// return mav; +// } + if (propertyEvaluationModel.getDistrict() != null) { + //ÇøÓò±àÂëת·¿¼ÛÍøÇøÓò + FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(propertyEvaluationModel.getDistrict()); + if (fangjiaOfficialAreaMap != null) { + propertyEvaluationModel.setDistrict(fangjiaOfficialAreaMap.getFangjiaDistrict()); + } + } + + boolean villaFlag = DataUtil.isVilla(propertyEvaluationModel.getSize(), propertyEvaluationModel.getName(), propertyEvaluationModel.getHeight(), propertyEvaluationModel.getRoom()); + + District district = null; + Map params = new HashMap(); + params.put("city", propertyEvaluationModel.getCity()); + if (StringUtils.isNotBlank(propertyEvaluationModel.getDistrict())) { + params.put("suggestDistrict", propertyEvaluationModel.getDistrict()); + } + params.put("address", propertyEvaluationModel.getAddress()); + if (StringUtils.isNotBlank(propertyEvaluationModel.getName())) { + params.put("suggestName", propertyEvaluationModel.getName()); + } + params.put("category", "district"); + String result = addressMatchProxyService.parser(params); + if (result != null) { + JSONObject json = globalJson; + json = JSONObject.fromObject(result); + if (json.getInt("code") == 200) { + Map map = (Map) json.get("result"); + if ((Integer) map.get("precise") >= 0) { + String propertyType = (String) map.get("propertyType"); + if (villaFlag && StringUtils.isNotBlank(propertyType) && !propertyType.equals("±ðÊû")) { + district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name") + "±ðÊû", "district"); + } + if (null == district) { + district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name"), "district"); + } + + } + } + } + + if (district == null) { + mav.setModel(BasicModel.buildBadRequestModel("¸ÃµØÖ·²»Ö§³Ö¹À¼Û£¡")); +// return mav; + } + propertyEvaluationModel.setDistrict(district.getRegion()); + propertyEvaluationModel.setName(district.getName()); + try { + evaluateAction(propertyEvaluationModel, httpServletRequest, houseValueInformation, mav); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + } + + private class UpdateHouseCaseRunnable implements Runnable { + private HouseValueInformationDto houseValueInformation; + + private JSONObject globalJson; + + private HouseInfomationModel model; + private RestfulModelAndView mav; + + public UpdateHouseCaseRunnable(HouseValueInformationDto houseValueInformation, JSONObject globalJson, HouseInfomationModel model, RestfulModelAndView mav) { + this.houseValueInformation = houseValueInformation; + this.globalJson = globalJson; + this.model = model; + this.mav = mav; + } + + @Override + public void run() { + //·¿Ô´Ñù±¾ + + //¹¹ÔìsampleQuery¶ÔÏó + SampleQuery sampleQuery = new SampleQuery(); + sampleQuery.setCity(model.getCity()); + sampleQuery.setStrctureArea(model.getSize()); + sampleQuery.setAddress(model.getAddress()); + +// RestfulModelAndView houseCaseMav = new RestfulModelAndView(); + List querys = null; + try { + querys = convertSampileQueryToBean(sampleQuery); + } catch (Exception e) { + mav.setModel(BasicModel.buildBadRequestModel(e.getMessage())); + } + if (null == sampleQuery.getMax()) { + sampleQuery.setMax(10); + } + // ´Ë´¦Âý + long start = System.currentTimeMillis(); + List collaterals = czbankSampleService.findSample2(querys, sampleQuery.getMax()); + long end = System.currentTimeMillis(); + System.out.println("ÓÃʱ:" + (end - start)); + Collateral collateral = collaterals.get(0); + List samples = collateral.getSample(); + UniversalDto dto = UniversalDto.newDto(); + if (null != collateral.getMaxPrice()) { + dto.append("maxUnitPrice", collateral.getMaxPrice()); + } + if (null != collateral.getMinPrice()) { + dto.append("minUnitPrice", collateral.getMinPrice()); + } + dto.append("datas", samples); + houseValueInformation.setHouseCase(dto); + + } + } + + private class UpdateSurroundingPoiRunnable implements Runnable { + private HouseValueInformationDto houseValueInformation; + + private JSONObject globalJson; + + private HouseInfomationModel model; + private RestfulModelAndView mav; + + public UpdateSurroundingPoiRunnable(HouseValueInformationDto houseValueInformation, JSONObject globalJson, HouseInfomationModel model, RestfulModelAndView mav) { + this.houseValueInformation = houseValueInformation; + this.globalJson = globalJson; + this.model = model; + this.mav = mav; + } + + @Override + public void run() { + //ÖܱßPOI + +// RestfulModelAndView mav = new RestfulModelAndView(); +// mav.setViewType("rest"); + if (StringUtils.isBlank(model.getAddress())) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "µØÖ·±ØÐëÊäÈë")); +// return mav; + } else { + String cat = "district"; + + HttpRequest request = new HttpRequest(); +// json = null; +// Map poiParams = new HashMap(); +// poiParams.put("city", model.getCity()); +// poiParams.put("address", model.getAddress()); +// poiParams.put("category", "property"); + //ÐÂÆ¥Åä½Ó¿Ú +// json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", poiParams, "UTF-8"); + JSONObject json = globalJson; + District property = null; + if (json != null && json.size() > 0) { + MatchedBuildingDto matchedBuildingDto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json); + property = districtService.findByNameAndAlias(matchedBuildingDto.getCity(), matchedBuildingDto.getDistrict(), matchedBuildingDto.getName(), cat); + if (null == property) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "Ð¡ÇøÊý¾Ý²»´æÔÚ")); +// return mav; + } + DistrictFacilitys facilitys = districtFacilitysService.findByDistrict(property); +// mav.setModel(BasicModel.buildOKModel().setResult(facilitys)); + // ½«ÖܱßPOIÊý¾Ý·Åµ½½á¹û¼¯ + houseValueInformation.setSurroundingPoi(facilitys); + } else { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "Ð¡ÇøÊý¾Ý²»´æÔÚ")); + } + } +// return mav; +// houseValueInformation.setSurroundingPoi(mav); + + mav.setModel(BasicModel.buildOKModel().setResult(houseValueInformation)); +// return mav; + } + } + + private PropertyEvaluationModel createPropertyEvaluationModelFromHouseInfomationModel(HouseInfomationModel model) { + PropertyEvaluationModel propertyModel = new PropertyEvaluationModel(); + propertyModel.setCity(model.getCity()); + propertyModel.setAddress(model.getAddress()); + propertyModel.setSize(model.getSize()); + + if (StringUtils.isNotBlank(model.getDistrict())) { + propertyModel.setDistrict(model.getDistrict()); + } + if (StringUtils.isNotBlank(model.getName())) { + propertyModel.setName(model.getName()); + } + if (StringUtils.isNotBlank(model.getBuildingNumber())) { + propertyModel.setBuildingNumber(model.getBuildingNumber()); + } + if (StringUtils.isNotBlank(model.getUnitNumber())) { + propertyModel.setUnitNumber(model.getUnitNumber()); + } + if (model.getFloor() != null && model.getFloor() != 0) { + propertyModel.setFloor(model.getFloor()); + } + if (model.getMaxFloor() != null && model.getMaxFloor() != 0) { + propertyModel.setMaxFloor(model.getMaxFloor()); + } + if (model.getRoom() != null && model.getRoom() != 0) { + propertyModel.setRoom(model.getRoom()); + } + if (model.getHall() != 0) { + propertyModel.setHall(model.getHall()); + } + if (model.getToilet() != 0) { + propertyModel.setToilet(model.getToilet()); + } + if (model.getCalDate() != null) { + propertyModel.setCalDate(model.getCalDate()); + } + if (model.getPropertyType() != null) { + propertyModel.setPropertyType(model.getPropertyType()); + } + if (StringUtils.isNotBlank(model.getDirection())) { + propertyModel.setDirection(model.getDirection()); + } + if (StringUtils.isNotBlank(model.getDecoration())) { + propertyModel.setDecoration(model.getDecoration()); + } + + if (model.getDecorationCost() != null && model.getDecorationCost() != 0) { + propertyModel.setDecorationCost(model.getDecorationCost()); + } + + if (model.getDecorationAge() != 0) { + propertyModel.setDecorationAge(model.getDecorationAge()); + } + if (StringUtils.isNotBlank(model.getView())) { + propertyModel.setView(model.getView()); + } + if (StringUtils.isNotBlank(model.getNoise())) { + propertyModel.setNoise(model.getNoise()); + } + if (model.getGardenSize() != null && model.getGardenSize() != 0) { + propertyModel.setGardenSize(model.getGardenSize()); + } + if (model.getBasementSize() != null && model.getBasementSize() != 0) { + propertyModel.setBasementSize(model.getBasementSize()); + } + if (model.getOuterSize() != null && model.getOuterSize() != 0) { + propertyModel.setOuterSize(model.getOuterSize()); + } + if (model.getAtticSize() != null && model.getAtticSize() != 0) { + propertyModel.setAtticSize(model.getAtticSize()); + } + if (StringUtils.isNotBlank(model.getNegativeFactor())) { + propertyModel.setNegativeFactor(model.getNegativeFactor()); + } + if (model.getAge() != 0) { + propertyModel.setAge(model.getAge()); + } + if (model.getCarportPrice() != null && model.getCarportPrice() != 0) { + propertyModel.setCarportPrice(model.getCarportPrice()); + } + + if (StringUtils.isNotBlank(model.getFacilities())) { + propertyModel.setFacilities(model.getFacilities()); + } + if (StringUtils.isNotBlank(model.getInsidePosition())) { + propertyModel.setInsidePosition(model.getInsidePosition()); + } + return propertyModel; + } + + private List convertSampileQueryToBean(SampleQuery... queries) throws Exception { + + List queryBeans = new ArrayList(queries.length); + for (SampleQuery q : queries) { + + CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean(); + BeanUtils.copyProperties(q, queryBean); +// String propertyTypeCode = queryBean.getPropertyTypeCode(); +// if(!Arrays.asList("01", "02", "03").contains(propertyTypeCode)){ +// throw new Exception("propertyTypeCodeȡֵ·Ç·¨"); +// } + String cat = "district"; + + if (StringUtils.isNotBlank(queryBean.getCity()) && StringUtils.isNotBlank(queryBean.getDistrict()) && StringUtils.isNotBlank(queryBean.getBuildingName())) { + District property = districtService.findByNameAndAlias(queryBean.getCity(), queryBean.getDistrict(), queryBean.getBuildingName(), cat); + if (property == null) { + throw new Exception("δÕÒµ½¸ÃÐ¡Çø"); + } + queryBean.setProperty(property); + } else if (StringUtils.isNotBlank(queryBean.getAddress())) { + HttpRequest request = new HttpRequest(); + JSONObject json = null; + String address = queryBean.getAddress().replace(" ", "").replace("%", ""); +// Map params = new HashMap(); +// params.put("city", queryBean.getCity()); +// params.put("address", address); +// params.put("category", "property"); + //ÐÂÆ¥Åä½Ó¿Ú +// json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8"); + json = globalJson; + if (json != null && json.size() > 0) { + MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json); + District property = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(), cat); + if (property == null) { + throw new Exception("δÕÒµ½¸ÃÐ¡Çø"); + } + queryBean.setProperty(property); + } else { + throw new Exception("δÕÒµ½¸ÃÐ¡Çø"); + } + } + String estateType = queryBean.getProperty().getEstateType2(); + queryBean.setPropertyTypeCode("01"); + if (StringUtils.isNotBlank(estateType)) { + if (estateType.equals("ÆÕͨסլ")) { + queryBean.setPropertyTypeCode("01"); + } else if (estateType.equals("±ðÊû")) { + queryBean.setPropertyTypeCode("02"); + } else if (estateType.equals("ÉÌס")) { + queryBean.setPropertyTypeCode("03"); + } + } + + Integer decrCondCode = queryBean.getDecrCondCode(); + if (decrCondCode == null) { + decrCondCode = 2; + } + if (decrCondCode > 5 || decrCondCode < 1) { + throw new Exception("decrCondCodeȡֵ·Ç·¨"); + } + Integer towardDirectCode = queryBean.getTowardDirectCode(); + if (towardDirectCode == null) { + towardDirectCode = 3; + } + if (towardDirectCode > 10 || towardDirectCode < 1) { + throw new Exception("towardDirectCodeȡֵ·Ç·¨"); + } + queryBeans.add(queryBean); + } + return queryBeans; + } + + private void adjustPriceByRatio(District district, Evaluation evaluation) { + + try { + ApiUserCfg apiUserCfg_pt = apiUserCfgService.findByUserId(Long.valueOf(evaluation.getFromUserId()), ApiUserCfg.ApiUserCfgKey.PRICE_TYPE); + if (apiUserCfg_pt != null && apiUserCfg_pt.getCfgValue() != null) { + String priceType = apiUserCfg_pt.getCfgValue().toString(); + // ÆÀ¹À¼ÛÔòϵÊýµ÷Õû + if (StringUtils.isNotBlank(priceType) && "evaluate".equals(priceType)) { + EvaluateRatio evaluateRatio = null; + if (StringUtils.isNotBlank(district.getRegion())) { + evaluateRatio = evaluateRatioService.findByCityAndRegion(district.getCity(), district.getRegion()); + } + if (evaluateRatio == null) { + evaluateRatio = evaluateRatioService.findByCity(district.getCity()); + } + if (evaluateRatio != null) { + // ϵÊýÌí¼Ó + long totalPrice = evaluation.getBigTotalPrice(); + totalPrice = (long) (totalPrice * (1 + evaluateRatio.getRatio())); + evaluation.setBigTotalPrice(totalPrice); + evaluation.setAvgPrice((int) (totalPrice / evaluation.getArea())); + } + } + } + } catch (Exception ex) { + LOGGER.error("ϵÊýϵ÷Òì³£{}", ex.getMessage()); + } + } + + public Object evaluateAction(PropertyEvaluationModel model, HttpServletRequest request, HouseValueInformationDto houseValueInformation, RestfulModelAndView mav) + throws NumberFormatException, IllegalAccessException { +// RestfulModelAndView mav = new RestfulModelAndView(); +// mav.setViewType("rest"); + if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName()) + || StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) { + mav.setModel(BasicModel.buildBadRequestModel("²ÎÊý·Ç·¨:³ÇÊÐ,ÇøÓò,Ð¡ÇøÃû,Ãæ»ý(size)Ϊ±ØÌîÏî")); + return mav; + } + if (model.getCity().endsWith("ÊÐ")) { + model.setCity(model.getCity().replaceAll("ÊÐ$", "")); + } + if (StringUtils.isNotBlank(request.getParameter("calDate"))) { + Date calDate = null; + try { + calDate = DateUtils.parseDate(request.getParameter("calDate"), new String[]{"yyyy-MM-dd"}); + } catch (ParseException e) { + + } + if (calDate == null) { + mav.setModel(BasicModel.buildBadRequestModel("calDate:Êý¾ÝÀàÐͲ»ºÏ·¨")); + return mav; + } else { + model.setCalDate(calDate); + } + } +// Ïȵ½CPDB¿âÖвéÕÒÐ¡Çø + + District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), + "district"); + if (district == null) { + if (model.getDistrict().contains("ÊÐÏ½Çø") || model.getDistrict().contains(model.getCity())) { + district = districtService.findByNameAndAlias(model.getCity(), null, model.getName(), "district"); + } + if (district == null) { + mav.setModel(BasicModel.buildBadRequestModel("¸ÃÐ¡Çø²»´æÔÚ")); + return mav; + } + } + model.setName(district.getName()); + + if (model.getCarportPrice() != null && (model.getCarportPrice() < 0 || model.getCarportPrice() > 1000000)) { + mav.setModel(BasicModel.buildBadRequestModel("carportPrice(³µÎ»)ȡֵ²»ºÏ·¨")); + return mav; + } + if (model.getMaxFloor() != null && (model.getMaxFloor() <= 0 || model.getMaxFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("maxFloorȡֵ·Ç·¨,ÕýÈ··¶Î§[1,60)")); + return mav; + } + + if (model.getFloor() != null && (model.getFloor() <= 0 || model.getFloor() > 59)) { + mav.setModel(BasicModel.buildBadRequestModel("floorȡֵ·Ç·¨,ÕýÈ··¶Î§[1,60)")); + return mav; + } + if (model.getMaxFloor() != null && model.getFloor() != null && model.getFloor() > model.getMaxFloor()) { + mav.setModel(BasicModel.buildBadRequestModel("ËùÔÚÂ¥²ã²»ÄÜ´óÓÚ×ÜÂ¥²ã")); + return mav; + } + + if (model.getFloor() == null) { + JSONObject structureOb = addressMatchProxyService.addressStructure(district.getCity(), model.getAddress()); + if (structureOb != null) { + if (structureOb.containsKey("buildingNumber")) { + model.setBuildingNumber(structureOb.getString("buildingNumber")); + } + + if (structureOb.containsKey("roomNumber")) { + String roomNumber = structureOb.getString("roomNumber"); + model.setFloor(getFloor(roomNumber)); + } + + } + } + + if (model.getMaxFloor() == null && model.getFloor() != null && StringUtils.isNotBlank(model.getBuildingNumber())) { + Loudong loudong = loudongService.findForEvaluate(district.getId(), model.getBuildingNumber(), model.getUnitNumber()); + if (loudong != null && loudong.getFloors() >= model.getFloor()) { + model.setMaxFloor(loudong.getFloors()); + } + } + model.setRegion(district.getRegion()); + model.setDistrictName(district.getName()); + if (StringUtils.isBlank(model.getPropertyType())) { + if (district.getEstateType2() != null && district.getEstateType2().contains("±ðÊû")) { + model.setPropertyType("1"); + } + } + + if (model.getCalDate() != null) { + if (new Date().before(model.getCalDate())) { + model.setCalDate(DateUtil.getFirstDayOfWeek(new Date())); + } else { + model.setCalDate(DateUtil.getFirstDayOfWeek(model.getCalDate())); + } + } else { + model.setCalDate(DateUtil.getFirstDayOfWeek(new Date())); + } + + + Evaluation evaluation = evaluationService.evaluate(district, buildEvaluation(model, request), + model.getCalDate()); + Double cityPriceCredit = null; + if (StringUtils.isNotBlank(evaluation.getFromUserId())) { + try { + ApiUserAuthority apiUserAuthority = apiUserAuthorityService + .findByUserId(Long.valueOf(evaluation.getFromUserId())); + if (apiUserAuthority.getCityCreditMap() != null + && apiUserAuthority.getCityCreditMap().containsKey(evaluation.getCity())) { + cityPriceCredit = apiUserAuthority.getCityCreditMap().get(evaluation.getCity()); + if (cityPriceCredit > 1 || cityPriceCredit < 0) { + cityPriceCredit = null; + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + this.adjustPriceByRatio(district, evaluation); + } + + // µ÷ÕûÃæ»ý²»Í¬Ãæ»ý¼Û¸ñ + try { + DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); + int orgAvgPrice = 0; + if (districtStatBo != null) { + if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("±ðÊû") && districtStatBo.getVillaDistrictStat() != null) { + orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice(); + } else if (districtStatBo.getDistrictStat() != null) { + orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice(); + } + } + if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) { + int factorPrice = evaluation.getAvgPrice(); + int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice); + Integer minPrice = (int) (evaluation.getAvgPrice() * 0.95); + Integer maxPrice = (int) (evaluation.getAvgPrice() * 1.05); + // Æ«Àë¶È³¬¹ý5%²»½øÐе÷Õû + if (minPrice <= avgPrice && avgPrice <= maxPrice) { + evaluation.setAvgPrice(avgPrice); + evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea())); + } + } + } catch (Exception ex) { + LOGGER.error("µ÷ÕûÃæ»ý²»Í¬Ãæ»ý¼Û¸ñÒì³£{}", ex.getMessage()); + } + + if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0 + && (cityPriceCredit == null || evaluation.getCredit() >= cityPriceCredit)) { + Map districtPriceMap = new HashMap(); + districtPriceMap.put("city", district.getCity()); + districtPriceMap.put("district", district.getRegion()); + districtPriceMap.put("name", district.getName()); + districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice()); + districtPriceMap.put("avgPrice", evaluation.getAvgPrice()); + + // ¸ù¾Ý³ÇÊÐµÈ ¼¶ÉèÖÃD¼¶¿ÉÐÅ¶È + ApiUserAuthority apiUserAuthority = apiUserAuthorityService + .findByUserId(Long.valueOf(evaluation.getFromUserId())); + if (apiUserAuthority != null && null != apiUserAuthority.getCreditLevelStatus() + && apiUserAuthority.getCreditLevelStatus() == 1) { + double dCredit = 0.61; + if (null != apiUserAuthority.getPriceRatingMap()) { + ServerArea serverArea = serverAreaService.findByDisplay(evaluation.getCity()); + Map rateMap = apiUserAuthority.getPriceRatingMap(); + if (null != rateMap) { + dCredit = rateMap.get(CITYLEVEL_MAP.get(serverArea.getNewCityGrade().toString())); + } + } + Map rMap = getLastEvaluationPrice(district, evaluation, dCredit); + + if (model.getScope() == EVALUATE_SHOW_DETAIL) { + if (null != rMap) { + if (rMap.containsKey("level")) { + districtPriceMap.put("level", rMap.get("level")); + } + if (rMap.containsKey("other_price")) { + districtPriceMap.put("other_price", rMap.get("other_price")); + } + } + } + + Long lastPrice = (Long) rMap.get("lastPrice"); + + if (null != lastPrice) { + districtPriceMap.put("totalPrice", lastPrice); + if (lastPrice > 0 && lastPrice != evaluation.getBigTotalPrice()) { + districtPriceMap.put("avgPrice", (int) (lastPrice / evaluation.getArea())); + } + } else { + mav.setModel(BasicModel.buildOKModel().setMsg("ÔÝʱ²»Ö§³Ö¸ÃÐ¡ÇøµÄ¹À¼Û").markNoData()); + return mav; + } + + } else { + districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice()); + } + + if (model.getScope() == EVALUATE_SHOW_DETAIL) { + districtPriceMap.put("evaluateWay", evaluation.getEvaluateWay()); + districtPriceMap.put("credit", evaluation.getCredit()); + districtPriceMap.put("id", evaluation.getId()); + } + // ½«ÆÀ¹À¼Û·Åµ½½á¹û¼¯ + houseValueInformation.setAddressValue(districtPriceMap); +// mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); + try { + if (StringUtils.isNotBlank(evaluation.getFromUserId()) && !evaluation.getFromUserId().equals("1007497")) { + openApiLogService.saveLog(CommonUtils.convertToMap(model), districtPriceMap, evaluation, "/property/evaluate"); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return mav; + } else { + evaluationService.remove(evaluation.getId()); + mav.setModel(BasicModel.buildOKModel().setMsg("ÔÝʱ²»Ö§³Ö¸ÃÐ¡ÇøµÄ¹À¼Û").markNoData()); + return mav; + } + } + + private Integer getFloor(String roomNumber) { + if (StringUtils.isNotBlank(roomNumber) && DataUtil.isNumber(roomNumber)) { + if (roomNumber.length() == 3) { + return Integer.valueOf(roomNumber.substring(0, 1)); + } else if (roomNumber.length() == 4) { + return Integer.valueOf(roomNumber.substring(0, 2)); + } else { + return null; + } + } + return null; + } + + private Evaluation buildEvaluation(PropertyEvaluationModel model, HttpServletRequest request) { + Evaluation evaluation = new Evaluation(); + evaluation.setCity(model.getCity()); + evaluation.setRegion(model.getRegion()); + evaluation.setDistrictName(model.getName()); + evaluation.setDirection(DIRECTION.get(model.getDirection())); + evaluation.setFitment(EVALUATION_MODEL_FITMENT.get(FITMENT.get(StringUtils.isNotBlank(model.getDecoration()) ? + model.getDecoration() : model.getFitment()))); + evaluation.setNoise(NOISE.get(model.getNoise())); + evaluation.setEstateType(PROPERTY_TYPES.get(model.getPropertyType())); + evaluation.setSight(SIGHT.get(model.getView())); + evaluation.setAtticArea(model.getAtticSize()); + evaluation.setTerraceArea(model.getOuterSize()); + evaluation.setBasementArea(model.getBasementSize()); + evaluation.setGardenArea(model.getGardenSize()); + String worryFacility = model.getNegativeFactor(); + evaluation.setWorryFacility(NEGATIVE_FACTOR.get(worryFacility)); + evaluation.setCreationDate(new Date()); + evaluation.setModificationDate(new Date()); + evaluation.setClientNo(model.getClientNo()); + if (0 != model.getAge()) { + evaluation.setAge(model.getAge()); + } + evaluation.setArea(model.getSize()); + if (ArrayUtils.isNotEmpty(model.getBuildQuality())) { + evaluation.setBuildQuality(convertToString(model.getBuildQuality())); + } + if (StringUtils.isNotBlank(model.getBuildType())) { + evaluation.setBuildType(model.getBuildType()); + } + if (StringUtils.isNotBlank(model.getCarport())) { + evaluation.setCarport(model.getCarport()); + } + if (model.getDecorationAge() >= 1 && model.getDecorationAge() <= 5) { + evaluation.setFitmentAge(model.getDecorationAge()); + } + evaluation.setCarportPrice(model.getCarportPrice()); + evaluation.setCity(model.getCity()); + evaluation.setDistrictName(model.getName()); + if (model.getDecorationCost() != null && model.getDecorationCost() > 0) { + evaluation.setFitmentCharge(model.getDecorationCost()); + } + if (0 != model.getHall()) { + evaluation.setHall(model.getHall()); + } + if (null != model.getFloor()) { + evaluation.setFloor(model.getFloor()); + } + if (model.getMaxFloor() != null && 0 != model.getMaxFloor()) { + evaluation.setHeight(model.getMaxFloor()); + } + if (StringUtils.isNotBlank(model.getBuildingNumber())) { + evaluation.setHouseNum(model.getBuildingNumber()); + } + if (StringUtils.isNotBlank(model.getHouseProperty())) { + evaluation.setHouseProperty(model.getHouseProperty()); + } + if (StringUtils.isNotBlank(model.getInsidepos())) { + evaluation.setInsidepos(model.getInsidepos()); + } + if (StringUtils.isNotBlank(model.getLightingVentilation())) { + evaluation.setLightingVentilation(model.getLightingVentilation()); + } + + if (StringUtils.isNotBlank(model.getOtherFactor())) { + evaluation.setOtherFactor(model.getOtherFactor()); + } + evaluation.setRegion(model.getDistrict()); + if (null != model.getRoom()) { + evaluation.setRoom(model.getRoom()); + } + if (StringUtils.isNotBlank(model.getRoomNumber())) { + evaluation.setRoomNum(model.getRoomNumber()); + } + if (StringUtils.isNotBlank(model.getSideset())) { + evaluation.setSideset(model.getSideset()); + } + if (0 != model.getToilet()) { + evaluation.setToilet(model.getToilet()); + } + if (model.getFacilities() != null) { + String facilities = model.getFacilities(); + String[] fs = facilities.split(","); + for (int i = 0; i < fs.length; i++) { + fs[i] = FACILITIES.get(fs[i]); + } + evaluation.setFacilities(convertToString(fs)); + } + + if (StringUtils.isNotBlank(model.getFacade())) { + evaluation.setFacade(model.getFacade()); + } + if (StringUtils.isNotBlank(model.getTraffice())) { + evaluation.setTraffice(model.getTraffice()); + } + if (StringUtils.isNotBlank(model.getShape())) { + evaluation.setShape(model.getShape()); + } + if (StringUtils.isNotBlank(model.getObstacle())) { + evaluation.setObstacle(model.getObstacle()); + } + if (StringUtils.isNotBlank(model.getIndustry())) { + evaluation.setIndustry(model.getIndustry()); + } + if (StringUtils.isNotBlank(model.getSupportDevice())) { + evaluation.setSupportDevice(model.getSupportDevice()); + } + if (StringUtils.isNotBlank(model.getLeftPosition())) { + evaluation.setLeftPosition(model.getLeftPosition()); + } + if (StringUtils.isNotBlank(model.getShopType())) { + evaluation.setShopType(model.getShopType()); + } + if (StringUtils.isNotBlank(model.getShopUnique())) { + evaluation.setShopUnique(model.getShopUnique()); + } + if (StringUtils.isNotBlank(model.getLocation())) { + evaluation.setLocation(model.getLocation()); + } + if (model.isNewDistrict()) { + evaluation.setNewDistrict(model.isNewDistrict()); + } + String ip = AnalyticsUtil.getIpAddress(ActionContext.getContext().getRequest()); + evaluation.setIp(ip); + AuthenticationBean authenticationBean = (AuthenticationBean) request + .getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); + if (authenticationBean != null && authenticationBean.apiUser != null) { + evaluation.setFromUserId(String.valueOf(authenticationBean.apiUser.getId())); + } + evaluation.setSource("api_property_evaluation"); + return evaluation; + } + + private Map getLastEvaluationPrice(District district, Evaluation evaluation, double dCredit) + throws NumberFormatException, IllegalAccessException { + Date startDate = DateUtil.parseDate(DateUtil.addMonth(new Date(), -6), "yyyy-MM-dd"); + // µÚÈý·½¼Û¸ñ + Map otherPriceRets = averageStatisticsService.findFirstAverageStatictics(district.getCity(), + district.getRegion(), district.getName(), district.getCategory(), startDate); + if (null == otherPriceRets) { + otherPriceRets = new HashMap(); + } + + otherPriceRets.put("fjw_price", evaluation.getAvgPrice()); + Map levelMap = getPriceLevel(otherPriceRets, evaluation.getCredit()); + Long lastPrice = getLastPrice(levelMap, otherPriceRets, evaluation, dCredit); + + Map rMap = new HashMap(); + rMap.put("lastPrice", lastPrice); + if (null != levelMap && levelMap.containsKey("level")) { + String priceLevel = (String) levelMap.get("level"); + rMap.put("level", priceLevel); + } + rMap.put("other_price", otherPriceRets); + return rMap; + } + + private Map getPriceLevel(Map otherPriceRets, double credit) { + + Integer avgPrice = (Integer) otherPriceRets.get("fjw_price"); + + int keyCount = 0; + int commonCount = 0; + int isExistCount = 0; + + List prices = new ArrayList(); + List smallPrices = new ArrayList(); + + if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + int mod = avgPrice - fangguguPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(fangguguPrice); + } + isExistCount++; + } + if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + int mod = avgPrice - yungujiaPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(yungujiaPrice); + } + + isExistCount++; + } + + if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + int mod = avgPrice - zhugezhaofangPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(zhugezhaofangPrice); + } + + isExistCount++; + } + + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + int mod = avgPrice - lianjiaPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + keyCount++; + } else { + prices.add(lianjiaPrice); + } + isExistCount++; + } + if (null != otherPriceRets.get("anjuke_price")) { + Integer anjukePrice = (Integer) otherPriceRets.get("anjuke_price"); + int mod = avgPrice - anjukePrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(anjukePrice); + } else { + prices.add(anjukePrice); + } + + isExistCount++; + } + if (null != otherPriceRets.get("ganji_price")) { + Integer ganjiPrice = (Integer) otherPriceRets.get("ganji_price"); + int mod = avgPrice - ganjiPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(ganjiPrice); + } else { + prices.add(ganjiPrice); + } + + isExistCount++; + } + if (null != otherPriceRets.get("soufan_price")) { + Integer soufan_price = (Integer) otherPriceRets.get("soufan_price"); + int mod = avgPrice - soufan_price; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(soufan_price); + } else { + prices.add(soufan_price); + } + + isExistCount++; + } + if (null != otherPriceRets.get("tobushi_price")) { + Integer tobushi = (Integer) otherPriceRets.get("tobushi_price"); + int mod = avgPrice - tobushi; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(tobushi); + } else { + prices.add(tobushi); + } + + isExistCount++; + } + + if (null != otherPriceRets.get("zhongyuan_price")) { + Integer zhongyuanPrice = (Integer) otherPriceRets.get("zhongyuan_price"); + int mod = avgPrice - zhongyuanPrice; + double temp = DataUtil.getDoubleRound(2, mod * 100 / avgPrice); + temp = Math.abs(temp); + if (temp <= 15) { + commonCount++; + smallPrices.add(zhongyuanPrice); + } else { + prices.add(zhongyuanPrice); + } + + isExistCount++; + } + + Map retMap = new HashMap(); + String level = null; + if (keyCount >= 2) { + level = "A"; + } else if (keyCount >= 1 && commonCount >= 1) { + level = "A"; + } else if (keyCount >= 1 || commonCount >= 2) { + level = "B"; + } else if (commonCount >= 1) { + level = "C"; + } else if (isExistCount == 0) { + level = "D"; + } else if (isExistCount >= 1) { + if (isExistCount == 1) { + level = "D"; + } else { + level = "E"; + } + } + + if (credit == 0) { + level = "E"; + } + + if (StringUtils.isNotBlank(level)) { + retMap.put("level", level); + retMap.put("prices", prices); + retMap.put("small_prices", smallPrices); + } + return retMap; + } + + private Long getLastPrice(Map retMap, Map otherPriceRets, Evaluation evaluation, double dCredit) { + Long lastPrice = null; + if (null != retMap) { + String priceLevel = (String) retMap.get("level"); + + if (priceLevel.equals("D")) { + + lastPrice = inputResultByWebsite(otherPriceRets, evaluation, dCredit); + + } else if (priceLevel.equals("E")) { + if (evaluation.getCredit() >= 0.65) { + lastPrice = evaluation.getBigTotalPrice(); + } else { + List prices = (List) retMap.get("prices"); + int avgPrice = 0; + if (prices != null) { + avgPrice = findNewPrice(prices, evaluation.getAvgPrice()); + } + // ÔÚ dCreditÓë0.65Ö®¼ä + if (evaluation.getCredit() >= dCredit && dCredit < 0.65) { + if (avgPrice > 0) { + Double newTotalPrice = avgPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + Double newTotalPrice = lianjiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + Double newTotalPrice = zhugezhaofangPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + Double newTotalPrice = yungujiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + Double newTotalPrice = fangguguPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } + } else if (evaluation.getCredit() < dCredit) {// ÔÚdCreditÒÔÏ + if (avgPrice > 0) { + Double newTotalPrice = avgPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + Double newTotalPrice = lianjiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + Double newTotalPrice = zhugezhaofangPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + Double newTotalPrice = yungujiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + Double newTotalPrice = fangguguPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } + } + } + } + + } else if (priceLevel.equals("C")) { + List smallPrices = (List) retMap.get("small_prices"); + if (smallPrices != null) { + smallPrices.add(evaluation.getAvgPrice()); + int avgPrice = sum(smallPrices) / smallPrices.size(); + Double newTotalPrice = avgPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } + return lastPrice; + } + + private Integer sum(List smallPrices) { + int sum = 0; + for (int price : smallPrices) { + sum += price; + } + return sum; + } + + private Long inputResultByWebsite(Map otherPriceRets, Evaluation evaluation, double dCredit) { + Long lastPrice = null; + if (evaluation.getCredit() >= dCredit) { + lastPrice = evaluation.getBigTotalPrice(); + } else { + if (evaluation.getCredit() < dCredit) { + if (null != otherPriceRets.get("lianjia_price")) { + Integer lianjiaPrice = (Integer) otherPriceRets.get("lianjia_price"); + Double newTotalPrice = lianjiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("zhugezhaofang_price")) { + Integer zhugezhaofangPrice = (Integer) otherPriceRets.get("zhugezhaofang_price"); + Double newTotalPrice = zhugezhaofangPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("yungujia_price")) { + Integer yungujiaPrice = (Integer) otherPriceRets.get("yungujia_price"); + Double newTotalPrice = yungujiaPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else if (null != otherPriceRets.get("fanggugu_price")) { + Integer fangguguPrice = (Integer) otherPriceRets.get("fanggugu_price"); + Double newTotalPrice = fangguguPrice * evaluation.getArea(); + lastPrice = newTotalPrice.longValue(); + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } else { + lastPrice = evaluation.getBigTotalPrice(); + } + } + return lastPrice; + } + + private Integer findNewPrice(List prices, int avgPrice) { + int minValue1 = Integer.MAX_VALUE; + List> values = new ArrayList>(); + int fjw_price = avgPrice; + + // ÕÒ³ö×îС²î + for (int i = 0; i < prices.size() - 1; i++) { + int a = prices.get(i); + for (int j = i + 1; j < prices.size(); j++) { + int b = prices.get(j); + int mod = Math.abs(a - b); + if (mod < minValue1) { + minValue1 = mod; + } + } + } + + // ¸ù¾Ý×îС²îÕÒ³ö½á¹û + for (int i = 0; i < prices.size() - 1; i++) { + int a = prices.get(i); + for (int j = i + 1; j < prices.size(); j++) { + int b = prices.get(j); + int mod = Math.abs(a - b); + if (mod == minValue1) { + values.add(Arrays.asList(a, b)); + } + } + } + + int minValue2 = Integer.MAX_VALUE; + int lastValue = 0; + if (values.size() >= 1) { + for (List value : values) { + int newPrice = (value.get(0) + value.get(1)) / 2; + int mod = Math.abs(fjw_price - newPrice); + if (mod < minValue2) { + minValue2 = mod; + lastValue = newPrice; + } + } + } + + if (lastValue > 0) { + double temp = DataUtil.getDoubleRound(2, minValue1 * 100 / lastValue); + temp = Math.abs(temp); + if (temp > 15) { + lastValue = 0; + } + } + return lastValue; + } + + + public void setEvaluationService(EvaluationService evaluationService) { + this.evaluationService = evaluationService; + } + + public void setDistrictService(DistrictService districtService) { + this.districtService = districtService; + } + + public void setAddressService(AddressService addressService) { + } + + public void setDistrictStatService(DistrictStatService districtStatService) { + this.districtStatService = districtStatService; + } + + protected AddressMatchLogService addressMatchLogService; + + public void setAddressMatchLogService(AddressMatchLogService addressMatchLogService) { + this.addressMatchLogService = addressMatchLogService; + } + + + public BatchEvaluateService getBatchEvaluateService() { + return batchEvaluateService; + } + + public void setBatchEvaluateService(BatchEvaluateService batchEvaluateService) { + this.batchEvaluateService = batchEvaluateService; + } + + public void setAddressMatchProxyService(AddressMatchProxyService addressMatchProxyService) { + this.addressMatchProxyService = addressMatchProxyService; + } + + public void setLoudongService(LoudongService loudongService) { + this.loudongService = loudongService; + } + + public void setApiUserAuthorityService(ApiUserAuthorityService apiUserAuthorityService) { + this.apiUserAuthorityService = apiUserAuthorityService; + } + + public void setAverageStatisticsService(AverageStatisticsService averageStatisticsService) { + this.averageStatisticsService = averageStatisticsService; + } + + public void setServerAreaService(ServerAreaService serverAreaService) { + this.serverAreaService = serverAreaService; + } + + public void setApiUserCfgService(ApiUserCfgService apiUserCfgService) { + this.apiUserCfgService = apiUserCfgService; + } + + public void setOpenApiLogService(OpenApiLogService openApiLogService) { + this.openApiLogService = openApiLogService; + } + + public void setFangjiaOfficialAreaService(FangjiaOfficialAreaService fangjiaOfficialAreaService) { + this.fangjiaOfficialAreaService = fangjiaOfficialAreaService; + } + + + public void setEvaluateRatioService(EvaluateRatioService evaluateRatioService) { + this.evaluateRatioService = evaluateRatioService; + } + + + public void setEvaluateFactorService(EvaluateFactorService evaluateFactorService) { + this.evaluateFactorService = evaluateFactorService; + } + + public void setCzbankSampleService(CzbankSampleService czbankSampleService) { + this.czbankSampleService = czbankSampleService; + } + + public void setDistrictFacilitysService(DistrictFacilitysService districtFacilitysService) { + this.districtFacilitysService = districtFacilitysService; + } + +} + +*/ diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/dto/CityNewPriceDto.java b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/CityNewPriceDto.java index 438808ffc..4b09649d3 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/dto/CityNewPriceDto.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/CityNewPriceDto.java @@ -7,7 +7,8 @@ import com.fangjia.dal.mongo.model.CityNewPrice; import com.fangjia.dal.mongo.model.RegionSellStat; @SuppressWarnings("serial") -public class CityNewPriceDto implements Serializable{ +public class +CityNewPriceDto implements Serializable{ /** * diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseValueInformationDto.java b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseValueInformationDto.java new file mode 100644 index 000000000..a10089a40 --- /dev/null +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/HouseValueInformationDto.java @@ -0,0 +1,57 @@ +package com.fangjia.open.dto; + +import com.fangjia.dal.mongo.model.DistrictFacilitys; +import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto; +import com.fangjia.open.model.RestfulModelAndView; + +import java.util.Map; + +/** + * @author 13607 + * @since 2023/12/12 10:47 + */ +public class HouseValueInformationDto { + // 原å°�区å�‡ä»·è¿”回值 + private MatchedBuildingDto communityAvgPrice; + // 原房屋价值评估返回值 + private Map addressValue; + + //原房æº�样本返回值 + private UniversalDto houseCase; + + //原周边POI返回值 + private DistrictFacilitys surroundingPoi; + + public MatchedBuildingDto getCommunityAvgPrice() { + return communityAvgPrice; + } + + public void setCommunityAvgPrice(MatchedBuildingDto communityAvgPrice) { + this.communityAvgPrice = communityAvgPrice; + } + + public Map getAddressValue() { + return addressValue; + } + + public void setAddressValue(Map addressValue) { + this.addressValue = addressValue; + } + + public UniversalDto getHouseCase() { + return houseCase; + } + + public void setHouseCase(UniversalDto houseCase) { + this.houseCase = houseCase; + } + + public DistrictFacilitys getSurroundingPoi() { + return surroundingPoi; + } + + public void setSurroundingPoi(DistrictFacilitys surroundingPoi) { + this.surroundingPoi = surroundingPoi; + } +} + diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/HouseInfomationModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/HouseInfomationModel.java new file mode 100644 index 000000000..52cbca930 --- /dev/null +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/HouseInfomationModel.java @@ -0,0 +1,941 @@ +package com.fangjia.open.model; + +import java.util.Date; + +/** + * @author 13607 + * @since 2023/12/12 14:27 + */ +public class HouseInfomationModel extends FangjiaApiModel { + private String city; + private String address; + private String category; + private boolean useMap; + + /** + * ÅжÏÊDz»ÊÇÓз¿¹À¼Û + */ + private boolean isYouFang; + + /** + * ÅжÏÊDz»ÊÇÓÑ´ï + */ + private boolean isYouDa; + + /** + * ÇøÓò + */ + private String region; + + /** + * ÇøÓò(а汾¹À¼Û) + **/ + private String district; + + /** + * Ð¡ÇøÃû + */ + private String districtName; + /** + * Ð¡ÇøÃû(а汾) + */ + private String name; + /** + * Â¥ºÅ + */ + private String unitNumber; + /** + * ÐÂÂ¥ºÅ + */ + private String houseNumber; + + private String id; + /** + * ÊҺŠ+ */ + private String roomNumber; + + /** + * Ãæ»ý + */ + private double size; + + /** + * ËùÔÚÂ¥²ã + */ + private Integer floor; + + /** + * ×ÜÂ¥²ã + */ + private Integer height; + + /** + * ÊÒÊý + */ + private Integer room; + + /** + * ÌüÊý + */ + private int hall; + + /** + * ÎÀÊý + */ + private int toilet; + + /** + * ¹À¼Ûʱ¼ä + */ + private Date calDate; + + private String propertyType; + + + /** + * ½¨ÖþÀàÐÍ + */ + private String buildType; + + /** + * ³¯Ïò + */ + private String direction; + + /** + * ×°ÐÞÇé¿ö + */ + private String fitment; + + /** + * ×°ÐÞ¼Û¸ñ + */ + private int fitmentCharge; + + /** + * ¾°¹ÛÇé¿ö + */ + private String view; + + /** + * ÔëÒôÇé¿ö + */ + private String noise; + + /** + * »¨Ô°Ãæ»ý + */ + private Double gardenArea; + + /** + * µØÏÂÊÒÃæ»ý + */ + private Double basementArea; + + /** + * Ñá¶ñÒòËØ + */ + private String[] worryFactor; + + /** + * ·¿Áä + */ + private int age; + + /** + * ×ÔÓгµÎ» + */ + private String carport; + + /** + * Ð¡ÇøÅäÌ× + */ + private String facilities; + + /** + * Ð¡ÇøÎ»Öà + */ + private String insidepos; + + /** + * ×°ÐÞÄêÏÞ + */ + private int fitmentAge; + + /** + * ²É¹âͨ·ç + */ + private String lightingVentilation; + + /** + * ±ßÌ××°Öà + */ + private String sideset; + + /** + * ½¨ÖþÖÊÁ¿ + */ + private String[] buildQuality; + + /** + * Ñá¶ñÉèÊ© + */ + private String worryFacility; + + /** + * ²úȨÊôÐÔ + */ + private String houseProperty; + + /** + * ÆäËûÒòËØ + */ + private String otherFactor; + + /** + * ÃÅÃæ¿ª¼ä + */ + private String facade; + + /** + * ¹«¹²½»Í¨ + */ + private String traffice; + + /** + * ÐÎ×´ + */ + private String shape; + + /** + * Õϰ­Îï + */ + private String obstacle; + + /** + * ¾­ÓªÐÔÖÊ + */ + private String industry; + + /** + * ÅäÌ×É豸 + */ + private String supportDevice; + + /** + * ¾àÀë·öÌÝλÖà + */ + private String leftPosition; + + /** + * ÉÌÆÌÀàÐÍ + */ + private String shopType; + + /** + * ÉÌÆÌΨһÐÔ + */ + private String shopUnique; + + /** + * ÉÌÆÌλÖà + */ + private String location; + + private String kind; + + private boolean isNewDistrict; + + private Integer carportPrice; + + private String keyword; + + private String buildingNumber; + + private Integer maxFloor; + + private String decoration; + + private Integer decorationCost; + + private Double gardenSize; + private Double basementSize; + private Double outerSize; + private Double atticSize; + private String negativeFactor; + private String insidePosition; + private int decorationAge; + + private boolean convert; + + private String estateType; + private String periodType; + private Integer periodCount; + + + private Integer houseType; + private String clientNo; + private int scope; + + private Integer maxPrice; + private Integer minPrice; + + private Integer radius; + private Integer limit; + private String app; + + private String user; + + private Integer avgPrice; + + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public boolean isUseMap() { + return useMap; + } + + public void setUseMap(boolean useMap) { + this.useMap = useMap; + } + + public boolean isYouFang() { + return isYouFang; + } + + public void setYouFang(boolean youFang) { + isYouFang = youFang; + } + + public boolean isYouDa() { + return isYouDa; + } + + public void setYouDa(boolean youDa) { + isYouDa = youDa; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + public String getDistrictName() { + return districtName; + } + + public void setDistrictName(String districtName) { + this.districtName = districtName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUnitNumber() { + return unitNumber; + } + + public void setUnitNumber(String unitNumber) { + this.unitNumber = unitNumber; + } + + public String getHouseNumber() { + return houseNumber; + } + + public void setHouseNumber(String houseNumber) { + this.houseNumber = houseNumber; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRoomNumber() { + return roomNumber; + } + + public void setRoomNumber(String roomNumber) { + this.roomNumber = roomNumber; + } + + public double getSize() { + return size; + } + + public void setSize(double size) { + this.size = size; + } + + public Integer getFloor() { + return floor; + } + + public void setFloor(Integer floor) { + this.floor = floor; + } + + public Integer getHeight() { + return height; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public Integer getRoom() { + return room; + } + + public void setRoom(Integer room) { + this.room = room; + } + + public int getHall() { + return hall; + } + + public void setHall(int hall) { + this.hall = hall; + } + + public int getToilet() { + return toilet; + } + + public void setToilet(int toilet) { + this.toilet = toilet; + } + + public Date getCalDate() { + return calDate; + } + + public void setCalDate(Date calDate) { + this.calDate = calDate; + } + + public String getPropertyType() { + return propertyType; + } + + public void setPropertyType(String propertyType) { + this.propertyType = propertyType; + } + + public String getBuildType() { + return buildType; + } + + public void setBuildType(String buildType) { + this.buildType = buildType; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getFitment() { + return fitment; + } + + public void setFitment(String fitment) { + this.fitment = fitment; + } + + public int getFitmentCharge() { + return fitmentCharge; + } + + public void setFitmentCharge(int fitmentCharge) { + this.fitmentCharge = fitmentCharge; + } + + public String getView() { + return view; + } + + public void setView(String view) { + this.view = view; + } + + public String getNoise() { + return noise; + } + + public void setNoise(String noise) { + this.noise = noise; + } + + public Double getGardenArea() { + return gardenArea; + } + + public void setGardenArea(Double gardenArea) { + this.gardenArea = gardenArea; + } + + public Double getBasementArea() { + return basementArea; + } + + public void setBasementArea(Double basementArea) { + this.basementArea = basementArea; + } + + public String[] getWorryFactor() { + return worryFactor; + } + + public void setWorryFactor(String[] worryFactor) { + this.worryFactor = worryFactor; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getCarport() { + return carport; + } + + public void setCarport(String carport) { + this.carport = carport; + } + + public String getFacilities() { + return facilities; + } + + public void setFacilities(String facilities) { + this.facilities = facilities; + } + + public String getInsidepos() { + return insidepos; + } + + public void setInsidepos(String insidepos) { + this.insidepos = insidepos; + } + + public int getFitmentAge() { + return fitmentAge; + } + + public void setFitmentAge(int fitmentAge) { + this.fitmentAge = fitmentAge; + } + + public String getLightingVentilation() { + return lightingVentilation; + } + + public void setLightingVentilation(String lightingVentilation) { + this.lightingVentilation = lightingVentilation; + } + + public String getSideset() { + return sideset; + } + + public void setSideset(String sideset) { + this.sideset = sideset; + } + + public String[] getBuildQuality() { + return buildQuality; + } + + public void setBuildQuality(String[] buildQuality) { + this.buildQuality = buildQuality; + } + + public String getWorryFacility() { + return worryFacility; + } + + public void setWorryFacility(String worryFacility) { + this.worryFacility = worryFacility; + } + + public String getHouseProperty() { + return houseProperty; + } + + public void setHouseProperty(String houseProperty) { + this.houseProperty = houseProperty; + } + + public String getOtherFactor() { + return otherFactor; + } + + public void setOtherFactor(String otherFactor) { + this.otherFactor = otherFactor; + } + + public String getFacade() { + return facade; + } + + public void setFacade(String facade) { + this.facade = facade; + } + + public String getTraffice() { + return traffice; + } + + public void setTraffice(String traffice) { + this.traffice = traffice; + } + + public String getShape() { + return shape; + } + + public void setShape(String shape) { + this.shape = shape; + } + + public String getObstacle() { + return obstacle; + } + + public void setObstacle(String obstacle) { + this.obstacle = obstacle; + } + + public String getIndustry() { + return industry; + } + + public void setIndustry(String industry) { + this.industry = industry; + } + + public String getSupportDevice() { + return supportDevice; + } + + public void setSupportDevice(String supportDevice) { + this.supportDevice = supportDevice; + } + + public String getLeftPosition() { + return leftPosition; + } + + public void setLeftPosition(String leftPosition) { + this.leftPosition = leftPosition; + } + + public String getShopType() { + return shopType; + } + + public void setShopType(String shopType) { + this.shopType = shopType; + } + + public String getShopUnique() { + return shopUnique; + } + + public void setShopUnique(String shopUnique) { + this.shopUnique = shopUnique; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getKind() { + return kind; + } + + public void setKind(String kind) { + this.kind = kind; + } + + public boolean isNewDistrict() { + return isNewDistrict; + } + + public void setNewDistrict(boolean newDistrict) { + isNewDistrict = newDistrict; + } + + public Integer getCarportPrice() { + return carportPrice; + } + + public void setCarportPrice(Integer carportPrice) { + this.carportPrice = carportPrice; + } + + public String getKeyword() { + return keyword; + } + + public void setKeyword(String keyword) { + this.keyword = keyword; + } + + public String getBuildingNumber() { + return buildingNumber; + } + + public void setBuildingNumber(String buildingNumber) { + this.buildingNumber = buildingNumber; + } + + public Integer getMaxFloor() { + return maxFloor; + } + + public void setMaxFloor(Integer maxFloor) { + this.maxFloor = maxFloor; + } + + public String getDecoration() { + return decoration; + } + + public void setDecoration(String decoration) { + this.decoration = decoration; + } + + public Integer getDecorationCost() { + return decorationCost; + } + + public void setDecorationCost(Integer decorationCost) { + this.decorationCost = decorationCost; + } + + public Double getGardenSize() { + return gardenSize; + } + + public void setGardenSize(Double gardenSize) { + this.gardenSize = gardenSize; + } + + public Double getBasementSize() { + return basementSize; + } + + public void setBasementSize(Double basementSize) { + this.basementSize = basementSize; + } + + public Double getOuterSize() { + return outerSize; + } + + public void setOuterSize(Double outerSize) { + this.outerSize = outerSize; + } + + public Double getAtticSize() { + return atticSize; + } + + public void setAtticSize(Double atticSize) { + this.atticSize = atticSize; + } + + public String getNegativeFactor() { + return negativeFactor; + } + + public void setNegativeFactor(String negativeFactor) { + this.negativeFactor = negativeFactor; + } + + public String getInsidePosition() { + return insidePosition; + } + + public void setInsidePosition(String insidePosition) { + this.insidePosition = insidePosition; + } + + public int getDecorationAge() { + return decorationAge; + } + + public void setDecorationAge(int decorationAge) { + this.decorationAge = decorationAge; + } + + public boolean isConvert() { + return convert; + } + + public void setConvert(boolean convert) { + this.convert = convert; + } + + public String getEstateType() { + return estateType; + } + + public void setEstateType(String estateType) { + this.estateType = estateType; + } + + public String getPeriodType() { + return periodType; + } + + public void setPeriodType(String periodType) { + this.periodType = periodType; + } + + public Integer getPeriodCount() { + return periodCount; + } + + public void setPeriodCount(Integer periodCount) { + this.periodCount = periodCount; + } + + public Integer getHouseType() { + return houseType; + } + + public void setHouseType(Integer houseType) { + this.houseType = houseType; + } + + public String getClientNo() { + return clientNo; + } + + public void setClientNo(String clientNo) { + this.clientNo = clientNo; + } + + public int getScope() { + return scope; + } + + public void setScope(int scope) { + this.scope = scope; + } + + public Integer getMaxPrice() { + return maxPrice; + } + + public void setMaxPrice(Integer maxPrice) { + this.maxPrice = maxPrice; + } + + public Integer getMinPrice() { + return minPrice; + } + + public void setMinPrice(Integer minPrice) { + this.minPrice = minPrice; + } + + public Integer getRadius() { + return radius; + } + + public void setRadius(Integer radius) { + this.radius = radius; + } + + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public String getApp() { + return app; + } + + public void setApp(String app) { + this.app = app; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public Integer getAvgPrice() { + return avgPrice; + } + + public void setAvgPrice(Integer avgPrice) { + this.avgPrice = avgPrice; + } +} + diff --git a/projects/fangjia-open/~$网开放接å�£æ–‡æ¡£V1.0.doc b/projects/fangjia-open/~$网开放接å�£æ–‡æ¡£V1.0.doc deleted file mode 100644 index cf2f054826792c44dd1eade6fd6cf626586dd309..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 162 zcmZQ8PtB`L%wr%8urZV~q%!0&R5Bz2Nx~q+bulx;gmk7Wj#*4hj_FJZFE*iQYFLuU U&@d^T2_`5DWM}}f0y8rU05BmA{{R30 diff --git a/projects/fangjia-pds/src/main/webapp/static/v1.2/js/skin/whyGreen/datepicker.css.baiduyun.uploading.cfg b/projects/fangjia-pds/src/main/webapp/static/v1.2/js/skin/whyGreen/datepicker.css.baiduyun.uploading.cfg new file mode 100644 index 0000000000000000000000000000000000000000..898a600ea14498d104d6ffb39aa0af439aaa6072 GIT binary patch literal 3472 zcmW;P%T_8e5CzbT{S^lypcjWAA}9!o_+W;jJmnz@!q?wjy?S+%PO46wI;l>=dpb?! z^p<+*Go7bmx=n{PP5V?y&-!=i!}XNv=|26Y_cUTzPj{)C)~sK=Z__Z%(nV_O-Ld#i zB_7+ff%BDGdLP&g_1&c#$YtZBbdsuRk>=25>CD@N#gho<=}6=;n@8{0tY=W(^i9)i z`b%xSG1g93Y3X<9xnxsM$2h;F29FVonrvQDUsetNGrZ2zK%|QHt=}B1XF1&YJ@-3v z{ZJyu`cnLP`j=L$ukm>_b}3?HFqX|$?3G-1V&3y^^BKBtMVxA__!h-(LM*yRa;;`L z4Ol-x-NpIk`@mJR!tOn$sjO#3Z=yHc;Gh=X|dmh6#%s-&Vd{@}q%IgHug}JQp`(*P>-7yv; zZ$ln){SB;7GJUH2-dSBi$kU)f$q}DpJ>N2(^L$`2H&_3Ry;FRlf5|`UrbV-r(V3hl zv@Ss}%kvz?VFoH0g_< z&rsiFw-l!hV*z_Zw~3JtzmH<(u>A2XdkfApnLp@TvWU7rm(>~FF6qA1-}d|yV?==q zeODCd;nR|34cmeDk%~Iy@hy+3ILDaBoLs=Up?pnmQOsNDr_g4&zIa}{i!krq&)IB0 zW(+p$k9iF;w(Bg%oVQY@cA2I_b~8vLxgWHTvbk@nmYEs7l0gCUH_sP-d)#jMG~^hw zu-01_`Ay6Qn;qWAYQ2J8Xx_zrlGWP<+;6r~QF+%Vhf!8{lfatmuD5G4f<$cQP z9+MW9Iox+5>{MQn&t>Mj$mS_Ld(>&+bD+Sx{HEAO?Y#RcUoq{#*=luIHsIy6@BT*C z6`Yn(r=C5WV?{f4&-FC@ejC5!cO`>U+=i~D_fx!IWfIJWyn^$c-$yxAF`Uc$h<&U# z_gMxxt+i@dVil`g)KSBG70;LP>gd;< zGal>Zfp;%cA&<)!MiaGi1Fgv;PxmjjeKlI4!w=*=MzP9{v-v6DFfh`^XUp>!-jv3% zGpyMBX%EcfmAqq3xiwzErz8GGoQ1369?NJcUaa`RA=b2a&n<+TtU_b=8N=POKNj^I zn-@w%O-1cR&3qVtF~K=E$bVz-QrTGQURAK>ouGs&#_3czE90d?2k9FYvMI9 zIhTD!#6O;M7&UswdN|DHHNMpx+!~c$ajVg}EZ<{{a_sXMti`()F>1R3XGWQC_CwVf z*|xCgiXW>)?58hUTQ>b{9%5aIm8}iy;9IL@mOH+&M>dSKWD@)K%FMlp7xOrSu$Jus zlZI9(7yD_PA|BcPLEmIOp;V|7E8{eq^;Pyg#OdHt?-ATSMyD_*@JHIOBDdw#5INSt zbDUy*i+Oy7)e>>SD{6bs?^Ud__Px1?-QXa*SfAn)c*e4>uHvk?qV16Hr|SpeKZ;JM z7~f0q?TUXygHATLF>lW@>&hlLg;F~xJsC#L#g4Op7T-~*@Zi}qzia--;@oRh=vZ~H zjGr0{W#&dFqBX@YunQe-snhXZhFCBbXQW>v>ukOj-s2>2CD$J+e(;Si{8;aSeVl*V znOY?Xv4%a1+Q&9_(x{ba4{?wA+vpj~=n87d^=kYYuciq9v;Wzi`xIj^Tl1ksK9FlBWAMBYK~7G zR#8^5zpdpqaqo@AI#-naFRN-cKjSQq*iWzEMwT0quV7vBdJ^f)`*+46W+T>~DesLK zv8%5|h?w6n_ZY39=AnG(uTZMWKL?=!>yzD`k#{;QctxHy)prf+O|+F~U#_v69pV1W zqDq@MO~lEwsCHsKjg!M5)3PAuIfdhF6LoL{FaGnyF4llP!7ILt*zsdmU%)CEs~I`f lSIRO7C2L}Daf&nJjo5Jly;h-*{NrqOMAfL6I6KBV_8(;YLcst4 literal 0 HcmV?d00001 diff --git a/projects/fangjia-pds/src/main/webapp/static/v1.2/js/skin/whyGreen/img.gif.baiduyun.uploading.cfg b/projects/fangjia-pds/src/main/webapp/static/v1.2/js/skin/whyGreen/img.gif.baiduyun.uploading.cfg new file mode 100644 index 0000000000000000000000000000000000000000..8a5c576b88e91f764f7f98014b7504746bce445f GIT binary patch literal 3472 zcmXBWOII?z5(VIl{VNPWP}IR0C>KEl1-u|LP(4UB;9#U z$LTVS(_?y1<#du-=`Vez-*lCp^&is2^^_W^oBpNOG=*%WPU@#`=z-^bdQ0ud)a;N z+F>g|SLiR&S^9#$=I6m!g<@pzA)9@w89TUgs!}$xZegDq=4gD`hpf<^RUjH`b+H<)?(_BCFLs_ie2e-W5N8 zvTk6l8h>$ha5XVM%D4fsQ0V(^lW6j5ZQxRn5#2muPVOMzZM_srmbdQM(1*# zsr5PbOL>+t{6Lo=Z+U#De9M0U@|4OD%UlIJw2N6)F8C?X8fCs$5F_kcxS9L8nhfa| zGuE-})^zT0tZ;ADZDwTR{y?+9<<9@5r|>+Nc~9ROBG!FbR;TJ#QTMg}JO4j4rYdlu zuciWz{Iq3R=XT_IYDFE3*vR9PPLA`KlM6gIDqq)oLbHYa7~7oJf&Xj26P#VY=WMng zG6!4uoTyRe_B+e5;ORW8_NAJ>!ObyE<^HFAl+FFE)iO7uH5rsRADiEIaZ43wK{oaL zx2smPzdV(*8CjaYJZD$p*SvK(pULIIb&%Dy>r`aS#xbS7$O>eGQkTycJn^omL&T0f z<>!*CgZe#jaKgb0jR9{{*amlP?J};hd+d&`y4A)0=!@Dt!jI$-GqY8PzDiEqm!3bN zx>VX+7U&)*94MWLsbsOMY@Q{Xq^@4j1*JVt#1`va}{s7SVv9IRX*={xx_ZcF)}`)60_5{x^Hpq>778`!>mQ+RiY`c4=bwY zH=^;FVPj=f_5ATtbVby;_&UT9t_JL!R=l%^G)k~V|5N?(wFu=OQ9E(3TIbkSa_P%( z!vB(XXvGYbWViJHYvt6i-FPbEF2Xjc)YM@odWNHC?89?Q6;@OpF&^>N#~r({BIZs_ zhBPa5S{N48D_S>P=k!goj8~X`{5E{7^~Vb9(^z77rMc(l2D+?gn9az7dS0Hf5@Y@C z@OG%}{rAmS7himPV!ou#W3VrX{FXV?ARN86CmT;15Pl`G{S5;Bzec zC98jYxrVB9kLy!Z3Cow7wB$3OI-x)0dWyFNbtZ>6A;b=Rz);KH26tSK;l3%ydnb0n z0_NIGovPWVyxMkneBbweUFv)BF_$s3@r_zz_~S3Wd6!0ZYVZWPr`l1AeKx;wQt64_ z8tub2F!U+?<2KgwmFrsW6IF~o9NtdNN352O`n+JPb9$+_s9ntNXBbM@|ER|K~ z$~p06wP|X{m!<2vz#gZK0v8SXGcMxY8)u`I$fD;9UZMs^cv~DDo2waoTl)m6O8?`yXGlxwd6$qW*TvB z+iQKA!yA6;MkdC;RA@(O>9@diDZ^JzV)vJLIu_IArYB zp2q1e{YwX_md?{Qy{5l(k{#_9A@CT4P9Uv>w8U4 z={IYMv8&WdOZT`gVLGWq^JD6Yn2Bzw<}nRb)fHdRb&y6fooJuCmvKF);nMxUy>P5J zQHE~FzetDa1G-Jmz*s}Zs9>&|bviY+ag?}nVC0SZH@uHjPK_P%ambOC`-+~XBWfB! z-(&q&>DoEq$d$Tg@}6jar|VR~UNu(D9`xuxbM%ef$lau;isv|cbxr++);r#JdbXUKjO(y{z_&Y z=hageUl{)f)r5*Q*5qLo&nGv^lnk=wLglymmJqS-4^*|!w+7#r`mbDn<(P5cSl=lJ z?&!HtWsBO8=b06?C*n&Tukw^Ak2yKUbH@3W-kO}}*!Qp%v_87Foi&^{&WAkPgRI~i zz9edt)qdt0%bt$1+jX8!;R;MMwQsd|^4#~Vmcopls-Q~w*!4?X!GWIVuAXlmesQL) zHI_5xVPSMvt`q8Jw6*X@#4&X>=ni%JdMf<<71uY`H0K==H_#V+ioK#mOU0U6(NnjA z*ZS{OT9fYyen{IwUq^kD{O*K?xtJSyo8td6e|UEXKcYEi=9{)YC!gKlJikKSP;^04 zS>BBd8<}ci8aeho&r?L+QE@@fmirU+y;2ctXX34VqVyWiTI(9Jn`?~s{!G;;G%c~d zy57+oJKCOep(p(MGTsn(s)9Y*rjDiOJ-VM%63V8cLi45jKn>yAf-^htvESU}3d&mH z;F7A?)jALYcg!5QbpQk-sYx!zW*Dy;_yPW8%Yi`bNog+E!GB#F5 zQ_q%`ilb(Y9nsQ)*um3*E#w-jd5EDZuI>7w|5;C5=Q-+1`(A9<-2UV@_nCq>%ylv0 zLdE$;(F=w%u{{wLzQ1u}D9Z^SR#g2_6uay^&rdaLI8 z*1U-w@Q9Y!pTfOZ%YW4T!hKr96MffWV+Kb?w(v_zVmEk(9%au4YKZsY4(cT{>|Jn7ryzEJRvE57M%@oz?2YL0)LLlL+1d>UJ+tYFMsS3 z@jZRiTEh(UJjA{dJKGhmt@pW=ksGn`jqDn^P)XgaeaOF-?>^Vk6SbhOWbBjX+dTgh zzW3Gm>-igF%+GFiXP~M%hI8mPC5_x)rssqEU!31U-;4jEa6`|Z>?IKu%-`^l=}v2| zvU8OcygSe;D4ZBO6gx8;yHu88UUP?1$aebV!w=RD6r3(pFFyz>u`B`jMUF~7sSmKK>|VYFeD z#UESjD)Ig;sEI%5zdVm~eDPISS^G~I+Z2uYx2sj~&4fO)+fbdX;OYKX&|Eqf^SSp+B`Ad3Z_DpS};=FWT==F`pgo#I6&6 GME?Ouc?#qJ literal 0 HcmV?d00001 diff --git a/projects/fangjia-pds/src/main/webapp/static/v1.2/style/datepicker.css.baiduyun.uploading.cfg b/projects/fangjia-pds/src/main/webapp/static/v1.2/style/datepicker.css.baiduyun.uploading.cfg new file mode 100644 index 0000000000000000000000000000000000000000..20cd31e152242f4a6f34e924019ff6e20fa5f20e GIT binary patch literal 3130 zcmW;O%U0?@5Cza4`zs7YP_GU_MG#a3-!lXS0eOgm@b!0BudF1U?y6I#PE|VTr-M{U zZ|Na@q~mm$nrWBDX`8C)$^0h0J04R#-KF2uPeYdVbd$Pi$@67;gQa?Z1b|COU_?N01-e9AI8&04jwzc!k|o#C^S zbsg%t^%utttOn!<8P{3-(B%fpR%WoHdkMog%-^9$y{l}R^4f=Vs+Ki=A8ekeJHle< zX~1J@zJc|A*5{mGpVb9~5)B%Z9P%lc`IhmNXNSd9t^Qf-Q+#HA&OiF*nq~{D6FGm< z`UHAKp2raWSeIG0aQqOtg@2LdktnZFCKS98yOdQq#iuA%FY}(U=s{nx`*c5{$*cIK zjQS?Kxj45lX0TUu`?T`zelKPb%OBT@r{Fx1dB@zGMfCl#td8h*M)$e-Th~7^h7>q8 zcR_&%e6D3#!?x#nsG|;ee9L1jP66|%$tj#G%Gb;uirIvI0BwTnv+Jev5aylpDOdYG zGgz@N@ako@%ba7;(@9plLel}e38bOicgB0U_AT8qQPB$-lrevEedf2tt;we$$Ed>6 zY+d9xF&k_)co+0~6}!;9i~DEpw^O*^Y@?$}jt|Hyy#HCGq-2?lc9HKHSI&>-d?*8R@%<2x4 zYb=YnZ$#MWyhA=`*>{%f6rK;%xyENlfxi64*hcU4y_GMRw&ARe+AJIJO8LFNl64iQ zIn=T11J1Fd9XO|ETJGQ0&-h))-~hLQWA6C??-!W_vjMN*eB*vEhjR?4^4?<~`^{a> zplGzzEpx15my14Xcs|GTR^An8Z!mh+doWLVb!pmywHEJ?Rh!M6*FGg0@*3%=jk5Cud`@9 z_RAgbhpa*gmoJPy^~x2r7LO9$zu3O&(JCE&Aa5~>U3Qe~Q^uiZrHjv+=P$f5jpNI( zVDo3(Q^yN=$DY!(UdE>_{z{ygqv{;VXf9st_`xCew7%;a!d33j`1*|CuGtqvJ;vsl z646u9d(kuR)}O6cFYHqawV0XY~7)WsPOL;XR|8 z_!H{ImuA8$s!}rBfEizoo@giH|B8EKe&amL3ccdcv34t?J#jzTUW6{h74gMc;8Hc}vTkS19^^0;DSBzE zHecc{jCWYZ{u8=a=^lINCENx3j$@<}J#3buMJHcUx+VXpP+Qh3_R&9&;&=4I(CVc) z@n!3Zw9TDzkNvB;c(-Ei(`v=si0vAeI+e<}j9D+??75Caiv4}8F7bW5f?X4@fyuG# zt0MmKoWiKlJNCmtu4}xjMYuI8z2H`(b49)djEd|_7%auR6ft_c0cS#)Z}tP-8QETA z(G@>-iTIvA8?D*A<~qc_5naD#q71Gz}#tctxyx9O7T^LhZke;!87^@eaSXNU;OPf9XxO3A6+2MKONZ zjNry!M^nUd?xiz!(SsGo40`;hz2o`;c@Kwswo!u`oFDj0m40GbfU<)T^?l8~G|dQ8 zt7p0_-k;c2;{BUq6MxX#T*nc-_$vH(A73C|V)RD8eWNmU;%_Vd1>);}kK0;=9ZofT z;@cS2h@I<))t7q3J9kdG0fdcMW3h(jW5@4U9bn#Oy)=5J;SEMxa|_s?#xqt?&pLHt I*NH!(|6U^t761SM literal 0 HcmV?d00001 diff --git a/projects/fangjia-pds/src/main/webapp/static/v1.2/style/dialogBox.css.baiduyun.uploading.cfg b/projects/fangjia-pds/src/main/webapp/static/v1.2/style/dialogBox.css.baiduyun.uploading.cfg new file mode 100644 index 0000000000000000000000000000000000000000..e271d60c6d7179abb5c6a6d1fbf205b49b833855 GIT binary patch literal 3146 zcmXBWOII?@4h7&E`&S%*+|ZUuD?7fpzSJitu zN!9e09@A&4q*7|7Lz z1$K?)7)ldzGhOhTQdrZ0Erx>UGRz{6K8`$uPxaZVdC%C9w;`_)tQNFe_XRaY*T~qF zYF(<|5^kPxz_5|)hVKDl!N`u!r~W=uQxo@1-5KjS{SB49l+7~*6TD-d z=ULaTc}M4>K1Fe#BI|wyo^_S1P;!iCqhr6A`jpQ3g_5PpPx&k%x8)i=oZy-n`%;l+ z#(E87B6dVUV0UnQ@*l`&Mqku;?&-$8MAh0=q9?CT#}J-fulR4}aSHcNRxjR8ur$nw zp|~YQ9hK=qp3?YbH24mgl3^BEW&g*2?%sp9LP+mtu$*-pZtQo!cJpbGe*egbJ6jWpr z)o#eENx_DWGgw2TFK{~WK48r7=2`YxzqWYVu&SziPf1kc&Alk@z}|-1#ImLOOl__) zzlp5!_%#}Hx0ZFUpdSAyXl9i!;g9d3tO5n~yvq<`HkM$-{BGz+bgAX3K>Z)zBe*+H zYgz_87j(wVp3uJ*_a&!T54JQ+MBVehbp6RD=JP=Qr_^+KhgU&$Zy@Hy*HyE~tBm)H zB_}4Lp6EP<9bZONJ63|Nj$F(9h=vNzz1Ua1-tvlSu2rqf_Ci5j#uZF+if)YbV18x2 z+e5tLmxGXFU8q-lFJp?k)W#Z9=kbB7o2ibj#0u0Bm4_P9F%yp|oXP4)C)$+U!^->B zvOJscqn<07HnZ8Z^>%}$f~}uraDwHW$_F~%TqAt(9dx1mH(z3Pe3iq8>sj~ivmDwK zP1JZ`Hk8fRSR*=WyTfo#&xZCPjH|lNs`yeLfdfxcZ zckv4;*1Kg^k8kz|2=9E`{0h9E*_J9$Rmb?6{wR7E8OmC?7LaSAj*M2s)c9P$?$CD* z|Aw^%XP&XQj1|>1zTF@BF5pbuzv}_d=#{FV|nWuSNW~`}8yBW3d$&vG1Hw za|?f`V+EGJh#JJ`SIn#l-#=GQMzJQunzo_gQ)a)O2ddSV{gy}0+r-!#+;@2lXlYPi zk$+b=;#JKz@<$a=ikD019?N!yRd;j)) z#kZVgc@Vdwr{-Q$_ZR_n zTs3%c_L#WdXe?v@;PvY1US)TDpZQiq#Yw5m`+@yLbz|2r;yh&kQSZDAzWKjmoO-(z zagBc^m)K7qq3z`UDw7-yZ*Z4X6kyz77_sc>x>loRHqy=%uJm*x-?kpk)oU%sQ#1I| z(+|I*iZyY))BY=qSSw?XJQp+JS#lrgN0B}D`W&t}Z>;cbUVO~NW6uQ$ zv8Tl>z4tU>Z^ipBY>Vl>W=v2)dFSbDmokX!@E4uP2|1nMP80Knt zn$6Y+{IQ?LJ{c#_1@@T#u>vjqF6p|%68re8n#3xx@gGV`DmYc!4n!*67)hCR+J zO`V8SWL{)^^>MChK!~s8BFnX_{?!aIYTv=zg?!{2+3=11u`cc(mX4S^u{kIQh-GSr z^i^aRC)zpPHTmvYYuG9{^CE85?vGELwMzWjV&crwG4J+t#u*^y=Vw-zIF;Ut9`M|; z^ySl{r@{Wmz7`SZmN8|>JSIO7`;|xD@@9ABfDkmyX^SqYn0BY=*dq^ueMlJii WeyEKKm5jdekMrr&TbxS%=l6e?G6w7b literal 0 HcmV?d00001 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_CommunicateLog_info b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_CommunicateLog_info new file mode 100644 index 000000000..e69de29bb diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_EMAYSDK_info b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/sdklog/sdkclient_EMAYSDK_info new file mode 100644 index 000000000..e69de29bb diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test.groovy new file mode 100644 index 000000000..e6b861ff6 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/majintao/test.groovy @@ -0,0 +1,71 @@ +package com.fangjia.script.majintao + +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.util.ExcelUtils +import net.sf.json.JSONObject + + +ExcelUtils.removeEmptyRow("F:\\¹À¼Ò\\Îļþ\\±±½»Ëù\\testcopy.xlsx") +ExcelUtils.singleThreadingModify("F:\\¹À¼Ò\\Îļþ\\±±½»Ëù\\testcopy.xlsx", { List items -> + String excelFilePath = "F:\\¹À¼Ò\\Îļþ\\±±½»Ëù\\testcopy.xlsx"; + String comprehensiveUrl = "http://192.168.10.15:9180/comprehensiveQuery/houseValueInformation"; + String communityUrl = "http://192.168.10.15:9180/addrSvc/avgPrice"; + String valueUrl = "http://192.168.10.15:9180/property/addressEvaluate"; + String caseUrl = "http://192.168.10.15:9180/house/case"; + String poiUrl = "http://192.168.10.15:9180/district/addrFacilitys"; + + HttpRequest httpRequest = new HttpRequest(); + map = new HashMap() + + String city = items['A'] + String address = items['B'] + double size = items['C'] + + System.out.println(city + "---" + address + "----" + size); + + map.put("city", city) + map.put("address", address) + map.put("size", size.toString()) + map.put("strctureArea", size.toString()) + map.put("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB") + + if (!address.contains("%")) { + // ·¢ËÍHTTPÇëÇó + long start + long end + +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(communityUrl, map, "UTF-8") +// +// +// end = System.currentTimeMillis(); +// items['D'] = String.valueOf(end - start); +// +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(valueUrl, map, "UTF-8") +// end = System.currentTimeMillis(); +// items['E'] = String.valueOf(end - start); +// +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(caseUrl, map, "UTF-8") +// end = System.currentTimeMillis(); +// items['F'] = String.valueOf(end - start); +// +// start = System.currentTimeMillis(); +// httpRequest.getJsonContent(poiUrl, map, "UTF-8") +// end = System.currentTimeMillis(); +// items['G'] = String.valueOf(end - start); + + start = System.currentTimeMillis(); + def content = httpRequest.getJsonContent(comprehensiveUrl, map, "UTF-8") + end = System.currentTimeMillis(); + items['H'] = String.valueOf(end - start); + println content.get("msg") + if(content.get("msg").contains("¸ÃµØÖ·²»Ö§³Ö¹À¼Û£¡")) { + items['I'] = "¸ÃµØÖ·²»Ö§³Ö¹À¼Û£¡" + } + } + + +}) + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy index 4d263c58e..87c14b741 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/ExcelUtils.groovy @@ -443,6 +443,45 @@ public class ExcelUtils{ } + public static singleThreadingModify(String fileName, Closure closure, Integer srcSheetIndex = 0, String destSheetName = null){ + if(!destSheetName){ + def inp = new FileInputStream(fileName); + Workbook workbook = WorkbookFactory.create(inp) + workbook.setForceFormulaRecalculation(true) + Sheet sheet = workbook.getSheetAt(srcSheetIndex); + destSheetName = sheet.getSheetName(); + } + + def data = ExcelUtils.read(fileName, srcSheetIndex, 0) + def body = data.subList(1, data.size()) + def nThread = Runtime.getRuntime().availableProcessors() * 3 + println nThread + ExecutorService executorService = Executors.newFixedThreadPool(3) + final AtomicInteger counter = new AtomicInteger(0) + final double total = body.size() + for(int i = 0 ; i < body.size(); i++){ + final row = body[i] + executorService.submit(new Runnable() { + @Override + void run() { + try{ + closure.call(row) + int count = counter.incrementAndGet() + if(count % 1000 == 0){ + println(DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")+"Ö´Ðнø¶È:${com.fangjia.core.util.DataUtil.roundDouble((count * 100)/total, 2)}%") + } + }catch (Exception e){ + println(row) + e.printStackTrace() + } + } + }) + } + executorService.shutdown() + executorService.awaitTermination(30, TimeUnit.DAYS) + ExcelUtils.write(fileName, data, destSheetName) + } + public static Object getCellValue(Cell cell){ diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java index 31ac175fe..d066c60a4 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/CzbankSampleServiceImpl.java @@ -37,18 +37,19 @@ import java.util.regex.Pattern; /** * ÕãÉÌÒøÐзçÏÕ»ºÊÍÑù±¾Êý¾Ý½Ó¿ÚʵÏÖÀà + * * @author wenyan */ -public class CzbankSampleServiceImpl implements CzbankSampleService{ +public class CzbankSampleServiceImpl implements CzbankSampleService { private static String[] DEAL_PRICE_FIELDS = new String[]{"city", "region", "districtName", "houseNumber", "totalPrice", "avgPrice", "area", "roomNumber", "fitment", "direction", "floor", "height", "tradeDate", "address"}; private static String[] HOUSE_FIELDS = new String[]{"city", "region", "districtName", "totalPrice", "avgPrice", - "area", "fitment", "direction", "floor", "height", "publishDate", "address", "estateType","url"}; + "area", "fitment", "direction", "floor", "height", "publishDate", "address", "estateType", "url"}; - public static String[] TAGS =new String[]{"¶À¶°", "ÁªÅÅ", "µþ¼Ó", "˫ƴ", "»¨Ô°Ãæ»ý", "Ó¾³Ø", "±ðÊû", "´ø»¨Ô°", "Ñó·¿", "µþÆ´", "¶ÀÔº", "ÁªÌå", "΢Êû", "´óƽÊû"}; + public static String[] TAGS = new String[]{"¶À¶°", "ÁªÅÅ", "µþ¼Ó", "˫ƴ", "»¨Ô°Ãæ»ý", "Ó¾³Ø", "±ðÊû", "´ø»¨Ô°", "Ñó·¿", "µþÆ´", "¶ÀÔº", "ÁªÌå", "΢Êû", "´óƽÊû"}; private DealPriceDao dealPriceDao; private HouseDao houseDao; @@ -63,10 +64,10 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ public List findSample(List queryBeans, int max) { List collateralList = new ArrayList(); - for(CollateralSampleQueryBean queryBean : queryBeans){ + for (CollateralSampleQueryBean queryBean : queryBeans) { Collateral collateral = new Collateral(); collateral.setCltNo(queryBean.getCltNo()); - if(queryBean.getProperty() != null){ + if (queryBean.getProperty() != null) { collateral.setSample(findSampleByQuery(queryBean, max)); } collateralList.add(collateral); @@ -78,10 +79,10 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ public List findSample2(List queryBeans, int max) { List collateralList = new ArrayList(); - for(CollateralSampleQueryBean queryBean : queryBeans){ - if(queryBean.getProperty() != null){ - Collateral collateral = findSampleByQuery2(queryBean, max); - if(null != collateral){ + for (CollateralSampleQueryBean queryBean : queryBeans) { + if (queryBean.getProperty() != null) { + Collateral collateral = findSampleByQuery2(queryBean, max); + if (null != collateral) { collateralList.add(collateral); } } @@ -95,34 +96,34 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ SampleWrapper target = convertQueryBean2Sample(queryBean); District district = queryBean.getProperty(); - List querySamples= new ArrayList(); + List querySamples = new ArrayList(); List samples = findShopSampleByDistrict(district.getCity(), district.getRegion(), district.getName(), district.getAlias()); scoreForSample(samples, target); - for(SampleWrapper sample : samples){ + for (SampleWrapper sample : samples) { sample.setProperty(queryBean.getProperty()); } querySamples.addAll(samples); - if(querySamples.size() < max){ + if (querySamples.size() < max) { district = districtService.findOneByKey(new DistrictKey(queryBean.getFangjiaCity(), queryBean.getFangjiaDistrict(), queryBean.getBuildingName()), "shop"); List districts = districtService.findNearestDistrict(district, 1000, 5); - for(District d : districts){ + for (District d : districts) { d = districtService.findById(d.getId()); List nearlySample = findShopSampleByDistrict(d.getCity(), d.getRegion(), d.getName(), district.getAlias()); - for(SampleWrapper sample : nearlySample){ + for (SampleWrapper sample : nearlySample) { sample.setProperty(d); } scoreForSample(nearlySample, target); querySamples.addAll(nearlySample); - if(querySamples.size() > max){ + if (querySamples.size() > max) { break; } } } List selectedSample = new ArrayList(max); Set priceUniqueKeys = new HashSet(); - for(int i = 0; i < querySamples.size() && selectedSample.size() < max;i++){ + for (int i = 0; i < querySamples.size() && selectedSample.size() < max; i++) { SampleWrapper wrapper = querySamples.get(i); - if(priceUniqueKeys.contains(wrapper.getUnitPrice())){ + if (priceUniqueKeys.contains(wrapper.getUnitPrice())) { continue; } priceUniqueKeys.add(wrapper.getUnitPrice()); @@ -131,7 +132,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ fillOthersInfo(selectedSample); List sampleList = new ArrayList(selectedSample.size()); - for(SampleWrapper sampleWrapper : selectedSample){ + for (SampleWrapper sampleWrapper : selectedSample) { ShopSample sample = new ShopSample(); BeanUtils.copyProperties(sampleWrapper, sample); sample.setProjectId(sampleWrapper.getProperty().getId()); @@ -141,14 +142,13 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ } - - private List findShopSampleByDistrict(String city, String region, String name, List alias){ + private List findShopSampleByDistrict(String city, String region, String name, List alias) { List names = new ArrayList(); names.add(name); - if(alias != null){ - for(String alia : alias){ - if(StringUtils.isNotBlank(alia) && alia.length() > 2 && !names.contains(alia)){ + if (alias != null) { + for (String alia : alias) { + if (StringUtils.isNotBlank(alia) && alia.length() > 2 && !names.contains(alia)) { names.add(alia); } } @@ -157,8 +157,8 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ List samples = new ArrayList(); List houseQuery = new ArrayList(); - houseQuery.add(new QueryParam("city", city )); - houseQuery.add(new QueryParam("region", region )); + houseQuery.add(new QueryParam("city", city)); + houseQuery.add(new QueryParam("region", region)); BooleanQuery nameQuery = new BooleanQuery(); int c = 0; for (String n : names) { @@ -183,9 +183,9 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ houseQuery.add(new QueryParam("category", "shop_sell")); List houses = houseDao.findAllByParams(houseQuery, houseSortParams, 0, 500, HOUSE_FIELDS); FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertFangjiaToOfficial(city, region); - for(House house : houses){ + for (House house : houses) { SampleWrapper sampleWrapper = convertHouse2Sample(house); - if(fangjiaOfficialAreaMap != null){ + if (fangjiaOfficialAreaMap != null) { sampleWrapper.setProvince(fangjiaOfficialAreaMap.getProvinceCode()); sampleWrapper.setCity(fangjiaOfficialAreaMap.getCityCode()); sampleWrapper.setDistrict(fangjiaOfficialAreaMap.getDistrictCode()); @@ -195,55 +195,55 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ return samples; } - private List findSampleByQuery(CollateralSampleQueryBean queryBean, int max){ + private List findSampleByQuery(CollateralSampleQueryBean queryBean, int max) { SampleWrapper target = convertQueryBean2Sample(queryBean); District district = queryBean.getProperty(); DistrictStat districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), new Date()); - if(districtStat == null){ - districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), DateUtil.add( new Date(), -7)); + if (districtStat == null) { + districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), DateUtil.add(new Date(), -7)); } - List querySamples= new ArrayList(); + List querySamples = new ArrayList(); // List samples = findSampleByDistrict(district.getCity(), district.getRegion(), district.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(),queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat); - List samples = findJnbankSampleByDistrict(district.getCity(), district.getRegion(), district.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(),queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat); + List samples = findJnbankSampleByDistrict(district.getCity(), district.getRegion(), district.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(), queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat); // scoreForSample(samples, target); sortForSample(samples, target); - for(SampleWrapper sample : samples){ + for (SampleWrapper sample : samples) { sample.setProperty(queryBean.getProperty()); } querySamples.addAll(samples); - if(querySamples.size() < max){ + if (querySamples.size() < max) { district = districtService.findOneByKey(new DistrictKey(district.getCity(), district.getRegion(), district.getName()), "district"); List districts = districtService.findNearestDistrict(district, 1000, 5); - for(District d : districts){ + for (District d : districts) { d = districtService.findById(d.getId()); //List nearlySample = findSampleByDistrict(d.getCity(), d.getRegion(), d.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(),queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat); - List nearlySample = findJnbankSampleByDistrict(d.getCity(), d.getRegion(), d.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(),queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat); + List nearlySample = findJnbankSampleByDistrict(d.getCity(), d.getRegion(), d.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(), queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat); - for(SampleWrapper sample : nearlySample){ + for (SampleWrapper sample : nearlySample) { sample.setProperty(d); } // scoreForSample(nearlySample, target); sortForSample(nearlySample, target); querySamples.addAll(nearlySample); - if(querySamples.size() > max){ + if (querySamples.size() > max) { break; } } } - if(querySamples.isEmpty()){ + if (querySamples.isEmpty()) { SampleWrapper standardSample = createStandardSample(queryBean); - if(standardSample != null){ + if (standardSample != null) { standardSample.setProperty(queryBean.getProperty()); querySamples.add(standardSample); } } List selectedSample = new ArrayList(max); Set priceUniqueKeys = new HashSet(); - for(int i = 0; i < querySamples.size() && selectedSample.size() < max;i++){ + for (int i = 0; i < querySamples.size() && selectedSample.size() < max; i++) { SampleWrapper wrapper = querySamples.get(i); - if(priceUniqueKeys.contains(wrapper.getUnitPrice())){ + if (priceUniqueKeys.contains(wrapper.getUnitPrice())) { continue; } priceUniqueKeys.add(wrapper.getUnitPrice()); @@ -252,7 +252,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ fillOthersInfo(selectedSample); List sampleList = new ArrayList(selectedSample.size()); - for(SampleWrapper sampleWrapper : selectedSample){ + for (SampleWrapper sampleWrapper : selectedSample) { Sample sample = new Sample(); BeanUtils.copyProperties(sampleWrapper, sample); sampleList.add(sample); @@ -262,87 +262,88 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ /** * Ìí¼ÓÑù±¾µÄÆäËûÐÅÏ¢ + * * @param samples */ - private void fillOthersInfo(List samples){ - for(SampleWrapper sample : samples){ + private void fillOthersInfo(List samples) { + for (SampleWrapper sample : samples) { District district = sample.getProperty(); Date finishBuildingDate = DateUtil.parseStringToDate(district.getFinishBuildingDate()); - if(finishBuildingDate != null){ - sample.setCompleteDate(DateUtil.formatByPattern(finishBuildingDate,"yyyy-MM-dd")); + if (finishBuildingDate != null) { + sample.setCompleteDate(DateUtil.formatByPattern(finishBuildingDate, "yyyy-MM-dd")); } - if(district.getLat2() != null && district.getLat2() > 0){ + if (district.getLat2() != null && district.getLat2() > 0) { sample.setLatitude(district.getLat2() / 10000000000d); - sample.setLongitude(district.getLng2()/ 10000000000d); + sample.setLongitude(district.getLng2() / 10000000000d); } - if(StringUtils.isNotBlank(district.getAddress()) && district.getAddress().length() < 80){ + if (StringUtils.isNotBlank(district.getAddress()) && district.getAddress().length() < 80) { sample.setBuildingAddr(district.getAddress()); } - if("¸Ö½á¹¹".equals(district.getBuildStructure())){ + if ("¸Ö½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(10); - }else if("¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure()) - || "¸Ö¡¢¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure())){ + } else if ("¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure()) + || "¸Ö¡¢¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(20); - }else if("»ìºÏ½á¹¹".equals(district.getBuildStructure())){ + } else if ("»ìºÏ½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(30); - }else if("שľ½á¹¹".equals(district.getBuildStructure())){ + } else if ("שľ½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(40); } String propertyLife; - if(district.getCategory().equals("shop")){//ÉÌÆÌ×ÜÊÇÓÃÄêÏÞÉèÖÃΪ40Äê + if (district.getCategory().equals("shop")) {//ÉÌÆÌ×ÜÊÇÓÃÄêÏÞÉèÖÃΪ40Äê propertyLife = "40"; - }else{ - if(sample.getBuildStructureCode() != null){ - if("10".equals(sample.getBuildStructureCode())){ + } else { + if (sample.getBuildStructureCode() != null) { + if ("10".equals(sample.getBuildStructureCode())) { propertyLife = "70"; - }else if("20".equals(sample.getBuildStructureCode())){ + } else if ("20".equals(sample.getBuildStructureCode())) { propertyLife = "60"; - }else if("40".equals(sample.getBuildStructureCode())){ + } else if ("40".equals(sample.getBuildStructureCode())) { propertyLife = "40"; - }else if("30".equals(sample.getBuildStructureCode())){ + } else if ("30".equals(sample.getBuildStructureCode())) { propertyLife = "50"; - }else{ + } else { propertyLife = "60"; } - }else{ + } else { propertyLife = "60"; } } sample.setHouseUseLimit(Integer.valueOf(propertyLife)); sample.setBuildingRemainLife(getRemainUseYear(district, propertyLife)); - if(sample.getBuildingRemainLife() != null){ + if (sample.getBuildingRemainLife() != null) { sample.setHouseHadUsed(sample.getHouseUseLimit() - sample.getBuildingRemainLife()); } //֮ǰÊÇ·¿Ô´Ãû³Æ¼Ó¡°ÉÌס¡±£¬Õâ¿éÊǽ«·¿Ô´Ãû³ÆÓÃÐ¡ÇøÃû³ÆÌî³ä - if(StringUtils.isNotBlank(sample.getBuildingName()) && sample.getBuildingName().contains("(ÉÌס)")){ - if(!district.getName().contains("ÉÌס") && !district.getName().contains("ÉÌÒµ")){ + if (StringUtils.isNotBlank(sample.getBuildingName()) && sample.getBuildingName().contains("(ÉÌס)")) { + if (!district.getName().contains("ÉÌס") && !district.getName().contains("ÉÌÒµ")) { sample.setBuildingName(district.getName() + "(ÉÌס)"); } } - if("district".equals(district.getCategory())){ - if(sample.getAboveFloorAmount() != null && sample.getAboveFloorAmount() > 6){ + if ("district".equals(district.getCategory())) { + if (sample.getAboveFloorAmount() != null && sample.getAboveFloorAmount() > 6) { sample.setIsElevator(1); - }else{ + } else { sample.setIsElevator(0); } - if("±ðÊû".equals(district.getEstateType2())){ + if ("±ðÊû".equals(district.getEstateType2())) { sample.setPropertyTypeCode("02"); - }else{ + } else { sample.setPropertyTypeCode("01"); } String yearMonth = DateUtil.formatByPattern(sample.getSampleDate(), "yyyyMM"); DistrictSellStat districtSellStat = districtSellStatService.findByYearMonth(district.getCity(), district.getRegion(), district.getName(), Integer.valueOf(yearMonth)); - if(districtSellStat != null){ + if (districtSellStat != null) { sample.setDealDayPriceIndex(new Double(String.valueOf(districtSellStat.getAvgPrice()))); } DistrictStat districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), new Date()); - if(districtStat != null && districtStat.getAvgPrice() > 0){ + if (districtStat != null && districtStat.getAvgPrice() > 0) { sample.setCurrentPriceIndex(new Double(String.valueOf(districtStat.getAvgPrice()))); - if(sample.getDealDayPriceIndex() == null && DateUtil.getThisSunday(sample.getSampleDate()).equals(DateUtil.getThisSunday(new Date()))){ + if (sample.getDealDayPriceIndex() == null && DateUtil.getThisSunday(sample.getSampleDate()).equals(DateUtil.getThisSunday(new Date()))) { sample.setDealDayPriceIndex(sample.getCurrentPriceIndex()); } } @@ -353,37 +354,38 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ /** * Ìí¼ÓÑù±¾µÄÆäËûÐÅÏ¢ + * * @param samples */ - private void fillOthersSimpleInfo(List samples){ - for(SampleWrapper sample : samples){ + private void fillOthersSimpleInfo(List samples) { + for (SampleWrapper sample : samples) { District district = sample.getProperty(); Date finishBuildingDate = DateUtil.parseStringToDate(district.getFinishBuildingDate()); - if(finishBuildingDate != null){ - sample.setCompleteDate(DateUtil.formatByPattern(finishBuildingDate,"yyyy-MM-dd")); + if (finishBuildingDate != null) { + sample.setCompleteDate(DateUtil.formatByPattern(finishBuildingDate, "yyyy-MM-dd")); } - if(district.getLat2() != null && district.getLat2() > 0){ + if (district.getLat2() != null && district.getLat2() > 0) { sample.setLatitude(district.getLat2() / 10000000000d); - sample.setLongitude(district.getLng2()/ 10000000000d); + sample.setLongitude(district.getLng2() / 10000000000d); } - if(StringUtils.isNotBlank(district.getAddress()) && district.getAddress().length() < 80){ + if (StringUtils.isNotBlank(district.getAddress()) && district.getAddress().length() < 80) { sample.setBuildingAddr(district.getAddress()); } - if("¸Ö½á¹¹".equals(district.getBuildStructure())){ + if ("¸Ö½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(10); - }else if("¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure()) - || "¸Ö¡¢¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure())){ + } else if ("¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure()) + || "¸Ö¡¢¸Ö½î»ìÄýÍÁ½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(20); - }else if("»ìºÏ½á¹¹".equals(district.getBuildStructure())){ + } else if ("»ìºÏ½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(30); - }else if("שľ½á¹¹".equals(district.getBuildStructure())){ + } else if ("שľ½á¹¹".equals(district.getBuildStructure())) { sample.setBuildStructureCode(40); } //֮ǰÊÇ·¿Ô´Ãû³Æ¼Ó¡°ÉÌס¡±£¬Õâ¿éÊǽ«·¿Ô´Ãû³ÆÓÃÐ¡ÇøÃû³ÆÌî³ä - if(StringUtils.isNotBlank(sample.getBuildingName()) && sample.getBuildingName().contains("(ÉÌס)")){ - if(!district.getName().contains("ÉÌס") && !district.getName().contains("ÉÌÒµ")){ + if (StringUtils.isNotBlank(sample.getBuildingName()) && sample.getBuildingName().contains("(ÉÌס)")) { + if (!district.getName().contains("ÉÌס") && !district.getName().contains("ÉÌÒµ")) { sample.setBuildingName(district.getName() + "(ÉÌס)"); } } @@ -391,91 +393,126 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ } - - - private Collateral findSampleByQuery2(CollateralSampleQueryBean queryBean, int max){ + private Collateral findSampleByQuery2(CollateralSampleQueryBean queryBean, int max) { SampleWrapper target = convertQueryBean2Sample(queryBean); District district = queryBean.getProperty(); DistrictStat districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), new Date()); - if(districtStat == null){ - districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), DateUtil.add( new Date(), -7)); + if (districtStat == null) { + districtStat = districtStatService.findOneDistrictStatsSort(district.getCity(), district.getRegion(), district.getName(), DateUtil.add(new Date(), -7)); } - List querySamples= new ArrayList(); - List samples = findBeijiaoShouSampleByDistrict(district.getCity(), district.getRegion(), district.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(),queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat, target.getStrctureArea(), 500); + List keys = new ArrayList(); + List querySamples = new ArrayList(); + String key = district.getName() + "_" + district.getRegion() + "_" + district.getCity(); + // ÐÞ¸Ä + keys.add(key); + if (district.getAlias() != null) { + for (String alia : district.getAlias()) { + if (StringUtils.isNotBlank(alia)) { + key = alia + "_" + district.getRegion() + "_" + district.getCity(); + if (!keys.contains(key)) { + keys.add(key); + } + } + } + } + List samples = findBeijiaoShouSampleByDistrict(keys, district.getEstateType2(), queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat, target.getStrctureArea(), 20); + keys.clear(); sortForSample(samples, target); SampleWrapper maxSample = null; SampleWrapper minSample = null; - for(SampleWrapper sample : samples){ + + querySamples.addAll(samples); + if (querySamples.size() < max) { + district = districtService.findOneByKey(new DistrictKey(district.getCity(), district.getRegion(), district.getName()), "district"); + List districts = districtService.doFindNearestHasHouseDistrict(district, 3000, 50); + for (District d : districts) { + key = d.getName() + "_" + d.getRegion() + "_" + d.getCity(); + if (!keys.contains(key)) { + keys.add(key); + } + if (d.getAlias() != null) { + for (String alia : d.getAlias()) { + if (StringUtils.isNotBlank(alia)) { + key = alia + "_" + d.getRegion() + "_" + d.getCity(); + if (!keys.contains(key)) { + keys.add(key); + } + } + } + } + if (keys.size() > 10) { + if (querySamples.size() > max) { + break; + } else { + List nearlySample = findBeijiaoShouSampleByDistrict(keys, district.getEstateType2(), queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat, target.getStrctureArea(), 200); + + + for (SampleWrapper sample : nearlySample) { + sample.setProperty(d); + } + sortForSample(nearlySample, target); + HashMap> map = new HashMap>(); + //½«Ñù±¾°´Ð¡ÇøÃû·Ö×é + for (SampleWrapper sample : nearlySample) { + String districtName = sample.getBuildingName(); + if (!map.containsKey(districtName)) { + List sampleWrappers = new ArrayList(); + sampleWrappers.add(sample); + map.put(districtName,sampleWrappers); + }else { + map.get(districtName).add(sample); + } + } + //½«Êý¾Ý·ÅÈëÑù±¾²Ö¿â + for (Map.Entry> entry : map.entrySet()) { + //³¬¹ýÁ½¸ö£¬Ö»È¡Á½¸ö + // È¡Èý¸ö + if (entry.getValue().size()>=3){ + querySamples.addAll(entry.getValue().subList(0,2)); + }else { + // ²»³¬¹ýÁ½¸ö£¬È«²¿·ÅÈë + querySamples.addAll(entry.getValue()); + } + } +// if(nearlySample.size()>=2){ +// querySamples.addAll(nearlySample.subList(0,2)); +// }else{ +// querySamples.addAll(nearlySample); +// } + + } + keys.clear(); + } + + } + } + for (SampleWrapper sample : querySamples) { sample.setProperty(queryBean.getProperty()); - if(maxSample==null){ - maxSample = new SampleWrapper(); + if (maxSample == null) { +// maxSample = new SampleWrapper(); maxSample = sample; - }else{ - if(sample.getUnitPrice()>maxSample.getUnitPrice()){ + } else { + if (sample.getUnitPrice() > maxSample.getUnitPrice()) { maxSample = sample; } } - if(minSample==null){ - minSample = new SampleWrapper(); + if (minSample == null) { +// minSample = new SampleWrapper(); minSample = sample; - }else{ - if(sample.getUnitPrice() districts = districtService.findNearestDistrict(district, 3000, 50); - for(District d : districts){ - d = districtService.findById(d.getId()); - List nearlySample = findBeijiaoShouSampleByDistrict(d.getCity(), d.getRegion(), d.getName(), district.getAlias(), district.getMasterDistrictNname(), district.getEstateType2(),queryBean.getPropertyTypeCode(), queryBean.getUpdateDate(), districtStat, target.getStrctureArea(), 20); - - for(SampleWrapper sample : nearlySample){ - sample.setProperty(d); - } - sortForSample(nearlySample, target); -// for(SampleWrapper sample : nearlySample){ -// if(maxSample==null){ -// maxSample = new SampleWrapper(); -// maxSample = sample; -// }else{ -// if(sample.getUnitPrice()>maxSample.getUnitPrice()){ -// maxSample = sample; -// } -// } -// -// if(minSample==null){ -// minSample = new SampleWrapper(); -// minSample = sample; -// }else{ -// if(sample.getUnitPrice() max){ - break; - }else{ - if(nearlySample.size()>=2){ - querySamples.addAll(nearlySample.subList(0,2)); - }else{ - querySamples.addAll(nearlySample); - } - - } - } - } List selectedSample = new ArrayList(max); Set priceUniqueKeys = new HashSet(); - for(int i = 0; i < querySamples.size() && selectedSample.size() < max;i++){ + for (int i = 0; i < querySamples.size() && selectedSample.size() < max; i++) { SampleWrapper wrapper = querySamples.get(i); - if(priceUniqueKeys.contains(wrapper.getUnitPrice())){ + if (priceUniqueKeys.contains(wrapper.getUnitPrice())) { continue; } priceUniqueKeys.add(wrapper.getUnitPrice()); @@ -484,7 +521,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ fillOthersSimpleInfo(selectedSample); List sampleList = new ArrayList(selectedSample.size()); - for(SampleWrapper sampleWrapper : selectedSample){ + for (SampleWrapper sampleWrapper : selectedSample) { Sample sample = new Sample(); BeanUtils.copyProperties(sampleWrapper, sample); sampleList.add(sample); @@ -495,14 +532,14 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ collateral.setCltNo(queryBean.getCltNo()); collateral.setSample(sampleList); - if(minSample!=null){ + if (minSample != null) { // Sample sample = new Sample(); // BeanUtils.copyProperties(minSample, sample); // sampleList.add(sample); collateral.setMinPrice(minSample.getUnitPrice()); } - if(maxSample!=null){ + if (maxSample != null) { // Sample sample = new Sample(); // BeanUtils.copyProperties(maxSample, sample); // sampleList.add(sample); @@ -513,14 +550,13 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ } - - /** * ´´½¨Ò»¸ö±ê×¼Ñù±¾ + * * @param queryBean * @return */ - private SampleWrapper createStandardSample(CollateralSampleQueryBean queryBean){ + private SampleWrapper createStandardSample(CollateralSampleQueryBean queryBean) { SampleWrapper sample = new SampleWrapper(); sample.setCity(queryBean.getCity()); @@ -535,24 +571,24 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ sample.setSampleId(queryBean.getProperty().getId()); sample.setSampleDate(DateUtil.getThisSunday(new Date())); int avgPrice = districtStatService.findLatestDistrictAvgPrice(queryBean.getProperty().getCity(), queryBean.getProperty().getRegion(), queryBean.getProperty().getBlock(), queryBean.getProperty().getName()); - if(avgPrice != 0){ + if (avgPrice != 0) { sample.setUnitPrice(avgPrice); - }else{ + } else { return null; } return sample; } - /** * Ñù±¾ÌØÕ÷Õý¹æ»¯ + * * @param samples * @return */ - private List scoreForSample(List samples, SampleWrapper targetSample){ + private List scoreForSample(List samples, SampleWrapper targetSample) { - if(samples.isEmpty()){ + if (samples.isEmpty()) { return samples; } MaxMinModel areaMaxMin = new MaxMinModel(); @@ -562,78 +598,78 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ samples.add(0, targetSample); long now = System.currentTimeMillis(); - for(SampleWrapper sample : samples){ - if(sample.getStrctureArea() > areaMaxMin.max){ + for (SampleWrapper sample : samples) { + if (sample.getStrctureArea() > areaMaxMin.max) { areaMaxMin.max = sample.getStrctureArea(); } - if(sample.getStrctureArea() < areaMaxMin.min){ + if (sample.getStrctureArea() < areaMaxMin.min) { areaMaxMin.min = sample.getStrctureArea(); } - if(sample.getFloorNumber() != null && sample.getFloorNumber() > floorMaxMin.max){ - floorMaxMin.max = (double)sample.getFloorNumber(); + if (sample.getFloorNumber() != null && sample.getFloorNumber() > floorMaxMin.max) { + floorMaxMin.max = (double) sample.getFloorNumber(); } - if(sample.getFloorNumber() != null && sample.getFloorNumber() < floorMaxMin.min){ - floorMaxMin.min = (double)sample.getFloorNumber(); + if (sample.getFloorNumber() != null && sample.getFloorNumber() < floorMaxMin.min) { + floorMaxMin.min = (double) sample.getFloorNumber(); } - long freshness = (now - sample.getSampleDate().getTime())/(1000 * 60 * 60 * 24); - if(freshness > freshnessMaxMin.max){ + long freshness = (now - sample.getSampleDate().getTime()) / (1000 * 60 * 60 * 24); + if (freshness > freshnessMaxMin.max) { freshnessMaxMin.max = (double) freshness; } - if(freshness < freshnessMaxMin.min){ - freshnessMaxMin.min = (double)freshness; + if (freshness < freshnessMaxMin.min) { + freshnessMaxMin.min = (double) freshness; } - if(sample.getUnitPrice() != null){ - if(sample.getUnitPrice() > avgPriceMaxMin.max){ - avgPriceMaxMin.max = (double)sample.getUnitPrice(); + if (sample.getUnitPrice() != null) { + if (sample.getUnitPrice() > avgPriceMaxMin.max) { + avgPriceMaxMin.max = (double) sample.getUnitPrice(); } - if(sample.getUnitPrice() < avgPriceMaxMin.min){ - avgPriceMaxMin.min = (double)sample.getUnitPrice(); + if (sample.getUnitPrice() < avgPriceMaxMin.min) { + avgPriceMaxMin.min = (double) sample.getUnitPrice(); } } } - for(SampleWrapper sample : samples){ - Double areaScore,floorScore,freshnessScore,fitmentScore,directionScore,caseTypeScore,avgPriceScore; - if(areaMaxMin.max == areaMaxMin.min){ + for (SampleWrapper sample : samples) { + Double areaScore, floorScore, freshnessScore, fitmentScore, directionScore, caseTypeScore, avgPriceScore; + if (areaMaxMin.max == areaMaxMin.min) { areaScore = 1d; - }else{ - areaScore = (sample.getStrctureArea() - areaMaxMin.min) /(areaMaxMin.max - areaMaxMin.min); + } else { + areaScore = (sample.getStrctureArea() - areaMaxMin.min) / (areaMaxMin.max - areaMaxMin.min); } - if(floorMaxMin.min == floorMaxMin.max){ + if (floorMaxMin.min == floorMaxMin.max) { floorScore = 1.0; - }else if(sample.getFloorNumber() != null){ - floorScore = (sample.getFloorNumber() - floorMaxMin.min)/(floorMaxMin.max - floorMaxMin.min); - }else{ + } else if (sample.getFloorNumber() != null) { + floorScore = (sample.getFloorNumber() - floorMaxMin.min) / (floorMaxMin.max - floorMaxMin.min); + } else { floorScore = 0.0; } - if(freshnessMaxMin.max == freshnessMaxMin.min){ + if (freshnessMaxMin.max == freshnessMaxMin.min) { freshnessScore = 1.0; - }else{ - freshnessScore = ((now - sample.getSampleDate().getTime())/(1000 * 60 * 60 * 24 * 7) - freshnessMaxMin.min)/(freshnessMaxMin.max - freshnessMaxMin.min); + } else { + freshnessScore = ((now - sample.getSampleDate().getTime()) / (1000 * 60 * 60 * 24 * 7) - freshnessMaxMin.min) / (freshnessMaxMin.max - freshnessMaxMin.min); } - if(null != sample.getDecrCondCode() && sample.getDecrCondCode().equals(targetSample.getDecrCondCode())){ + if (null != sample.getDecrCondCode() && sample.getDecrCondCode().equals(targetSample.getDecrCondCode())) { fitmentScore = 1.0; - }else{ + } else { fitmentScore = 0.0; } - if(null !=sample.getTowardDirectCode() && sample.getTowardDirectCode().equals(targetSample.getTowardDirectCode())){ + if (null != sample.getTowardDirectCode() && sample.getTowardDirectCode().equals(targetSample.getTowardDirectCode())) { directionScore = 1.0; - }else{ + } else { directionScore = 0.0; } - if(sample.getCaseTypeCode() == null){ + if (sample.getCaseTypeCode() == null) { caseTypeScore = 1.0; - }else if("02".equals(sample.getCaseTypeCode())){ + } else if ("02".equals(sample.getCaseTypeCode())) { caseTypeScore = 0.8; - }else if("03".equals(sample.getCaseTypeCode())){ + } else if ("03".equals(sample.getCaseTypeCode())) { caseTypeScore = 0.3; - }else{ + } else { caseTypeScore = 0.0; } - if(targetSample.getUnitPrice() == null){ + if (targetSample.getUnitPrice() == null) { avgPriceScore = 1.0; - }else{ - avgPriceScore = (sample.getUnitPrice() - avgPriceMaxMin.min)/(avgPriceMaxMin.max - avgPriceMaxMin.min); + } else { + avgPriceScore = (sample.getUnitPrice() - avgPriceMaxMin.min) / (avgPriceMaxMin.max - avgPriceMaxMin.min); } sample.getNormalizedFactor().put("areaScore", areaScore); sample.getNormalizedFactor().put("floorScore", floorScore); @@ -644,19 +680,19 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ sample.getNormalizedFactor().put("avgPriceScore", avgPriceScore); } - for(SampleWrapper sample : samples){ + for (SampleWrapper sample : samples) { double score = 0.0; - score += ( Math.abs(targetSample.getNormalizedFactor().get("areaScore") - sample.getNormalizedFactor().get("areaScore")) ) * 5; - score += ( Math.abs(targetSample.getNormalizedFactor().get("floorScore") - sample.getNormalizedFactor().get("floorScore")) ) * 3; - score += ( Math.abs(targetSample.getNormalizedFactor().get("freshnessScore") - sample.getNormalizedFactor().get("freshnessScore")) ) * 20; - score += ( Math.abs(targetSample.getNormalizedFactor().get("fitmentScore") - sample.getNormalizedFactor().get("fitmentScore")) ) * 2; - score += ( Math.abs(targetSample.getNormalizedFactor().get("directionScore") - sample.getNormalizedFactor().get("directionScore")) ) * 2; - score += ( Math.abs(targetSample.getNormalizedFactor().get("caseTypeScore") - sample.getNormalizedFactor().get("caseTypeScore")) ) * 1; - score += ( Math.abs(targetSample.getNormalizedFactor().get("avgPriceScore") - sample.getNormalizedFactor().get("avgPriceScore")) ) * 70; - try{ - sample.setSampleLevel(DataUtil.roundDouble(score, 5)); - }catch(Exception e){ - e.printStackTrace(); + score += (Math.abs(targetSample.getNormalizedFactor().get("areaScore") - sample.getNormalizedFactor().get("areaScore"))) * 5; + score += (Math.abs(targetSample.getNormalizedFactor().get("floorScore") - sample.getNormalizedFactor().get("floorScore"))) * 3; + score += (Math.abs(targetSample.getNormalizedFactor().get("freshnessScore") - sample.getNormalizedFactor().get("freshnessScore"))) * 20; + score += (Math.abs(targetSample.getNormalizedFactor().get("fitmentScore") - sample.getNormalizedFactor().get("fitmentScore"))) * 2; + score += (Math.abs(targetSample.getNormalizedFactor().get("directionScore") - sample.getNormalizedFactor().get("directionScore"))) * 2; + score += (Math.abs(targetSample.getNormalizedFactor().get("caseTypeScore") - sample.getNormalizedFactor().get("caseTypeScore"))) * 1; + score += (Math.abs(targetSample.getNormalizedFactor().get("avgPriceScore") - sample.getNormalizedFactor().get("avgPriceScore"))) * 70; + try { + sample.setSampleLevel(DataUtil.roundDouble(score, 5)); + } catch (Exception e) { + e.printStackTrace(); } } Collections.sort(samples); @@ -665,12 +701,12 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ } - private List sortForSample(List samples, final SampleWrapper targetSample){ + private List sortForSample(List samples, final SampleWrapper targetSample) { - if(samples.isEmpty()){ + if (samples.isEmpty()) { return samples; } - if(null == targetSample.getStrctureArea()){ + if (null == targetSample.getStrctureArea()) { return samples; } // if(samples!=null && samples.size() < max){ @@ -685,15 +721,15 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ }); List prices = new ArrayList(); - for(SampleWrapper sample : samples){ - if(!prices.contains(sample.getUnitPrice())){ + for (SampleWrapper sample : samples) { + if (!prices.contains(sample.getUnitPrice())) { prices.add(sample.getUnitPrice()); - if(prices.size()>=10){ + if (prices.size() >= 10) { break; } } } - final Integer midPrice = (int)median(prices); + final Integer midPrice = (int) median(prices); Collections.sort(samples, new Comparator() { public int compare(SampleWrapper o1, SampleWrapper o2) { Integer d1 = Math.abs(o1.getUnitPrice() - midPrice); @@ -708,49 +744,50 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ double j = 0; Collections.sort(total); int size = total.size(); - if(size % 2 == 1){ - j = total.get((size-1)/2); - }else { - j = (total.get(size/2-1) + total.get(size/2) + 0.0)/2; + if (size % 2 == 1) { + j = total.get((size - 1) / 2); + } else { + j = (total.get(size / 2 - 1) + total.get(size / 2) + 0.0) / 2; } return j; } /** * ²éÕÒÐ¡ÇøÑù±¾ + * * @param city * @param region * @param name * @param alias - * @param estateType Óû§²éѯÎïÒµÀàÐÍ + * @param estateType Óû§²éѯÎïÒµÀàÐÍ * @param startDate * @param distEstateType Ð¡ÇøÎïÒµÀàÐÍ * @return */ - private List findSampleByDistrict(String city, String region, String name, List alias, String masterName, String distEstateType, String estateType, Date startDate, DistrictStat districtStat){ + private List findSampleByDistrict(String city, String region, String name, List alias, String masterName, String distEstateType, String estateType, Date startDate, DistrictStat districtStat) { List names = new ArrayList(); names.add(ClientUtils.escapeQueryChars(name)); - if(alias != null){ - for(String alia : alias){ - if(StringUtils.isNotBlank(alia) && alia.length() >= 2 && !names.contains(alia)){ + if (alias != null) { + for (String alia : alias) { + if (StringUtils.isNotBlank(alia) && alia.length() >= 2 && !names.contains(alia)) { names.add(ClientUtils.escapeQueryChars(alia)); } } } - if(StringUtils.isNotBlank(masterName)){ - names.add(ClientUtils.escapeQueryChars(masterName)); + if (StringUtils.isNotBlank(masterName)) { + names.add(ClientUtils.escapeQueryChars(masterName)); } List samples = new ArrayList(); List houseQuery = new ArrayList(); - houseQuery.add(new QueryParam("city", city )); - houseQuery.add(new QueryParam("region", region )); - if(districtStat != null && districtStat.getAvgPrice() > 0){ + houseQuery.add(new QueryParam("city", city)); + houseQuery.add(new QueryParam("region", region)); + if (districtStat != null && districtStat.getAvgPrice() > 0) { int avgPrice = districtStat.getAvgPrice(); - houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int)(avgPrice * 0.5 )));//0.85 - houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int)(avgPrice * 1.5 )));//1.15 + houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int) (avgPrice * 0.5)));//0.85 + houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int) (avgPrice * 1.5)));//1.15 } BooleanQuery nameQuery = new BooleanQuery(); int c = 0; @@ -758,21 +795,21 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ if (StringUtils.isNotBlank(name)) { if (name.indexOf("£¨") > -1 || name.indexOf("£©") > -1 || name.indexOf("(") > -1 || name.indexOf(")") > -1 | name.indexOf("[") > -1 || name.indexOf("]") > -1 || name.indexOf("-") > -1 || name.indexOf("{") > -1 - || name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1|| name.indexOf("\\") > -1) { + || name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1 || name.indexOf("\\") > -1) { continue; } c++; nameQuery.add(new TermQuery(new Term("district_name", n)), BooleanClause.Occur.SHOULD); } } - - if(nameQuery.clauses().size()==0){ - return samples; + + if (nameQuery.clauses().size() == 0) { + return samples; } BooleanQuery srQuery = new BooleanQuery(); srQuery.add(nameQuery, BooleanClause.Occur.MUST); houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery))); - if(startDate != null){ + if (startDate != null) { houseQuery.add(new QueryParam("publishDate", QueryParam.GREATER_THAN_OPERATOR, startDate)); } @@ -782,89 +819,89 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ int height = 0; int maxFloor = 0; boolean allSampleHasHeight = true; - for(House house : houses){ - if(StringUtils.isNotBlank(estateType) && estateType.equals("01")){//01:ÆÕͨסլ 02:±ðÊû - if(StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("±ðÊû")){ + for (House house : houses) { + if (StringUtils.isNotBlank(estateType) && estateType.equals("01")) {//01:ÆÕͨסլ 02:±ðÊû + if (StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("±ðÊû")) { continue; } - if(isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())){ + if (isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())) { continue; } - }else if(StringUtils.isNotBlank(estateType) && estateType.equals("02")){ - if(house.getHeight()!=null && house.getHeight()>=10){ + } else if (StringUtils.isNotBlank(estateType) && estateType.equals("02")) { + if (house.getHeight() != null && house.getHeight() >= 10) { continue; } - if(house.getFloor()!=null && house.getFloor()>=10){ + if (house.getFloor() != null && house.getFloor() >= 10) { continue; } } SampleWrapper sample = convertHouse2Sample(house); - if(isAvailableSample(sample)){ + if (isAvailableSample(sample)) { samples.add(sample); } - if(sample.getAboveFloorAmount() == null){ + if (sample.getAboveFloorAmount() == null) { allSampleHasHeight = false; - }else if(sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100){ - height = sample.getAboveFloorAmount() ; + } else if (sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100) { + height = sample.getAboveFloorAmount(); } - if(sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor){ + if (sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor) { maxFloor = sample.getFloorNumber(); } //ÕãÉ̲âÊÔÌØÒâÌí¼Ó - if(house.getDistrictName().equals("ÐÂãþÈý´å") && house.getArea()>=35 && house.getArea()<=55){ + if (house.getDistrictName().equals("ÐÂãþÈý´å") && house.getArea() >= 35 && house.getArea() <= 55) { sample.setDoorNo("502"); sample.setBuildingNoName("56"); } - if(StringUtils.isNotBlank(house.getEstateType())){ - if(house.getEstateType().contains("ÉÌÒµ") || house.getEstateType().contains("ÉÌס") || house.getEstateType().contains("°ì¹«")){ - sample.setBuildingName(house.getDistrictName() +"(ÉÌס)"); + if (StringUtils.isNotBlank(house.getEstateType())) { + if (house.getEstateType().contains("ÉÌÒµ") || house.getEstateType().contains("ÉÌס") || house.getEstateType().contains("°ì¹«")) { + sample.setBuildingName(house.getDistrictName() + "(ÉÌס)"); } - }else{ - if(StringUtils.isNotBlank(distEstateType) && (distEstateType.contains("ÉÌס") && (!name.contains("ÉÌס") || !name.contains("ÉÌÒµ")) )){ + } else { + if (StringUtils.isNotBlank(distEstateType) && (distEstateType.contains("ÉÌס") && (!name.contains("ÉÌס") || !name.contains("ÉÌÒµ")))) { sample.setBuildingName(house.getDistrictName() + "(ÉÌס)"); } } } List dealPriceQuery = new ArrayList(); - dealPriceQuery.add(new QueryParam("city", city )); - dealPriceQuery.add(new QueryParam("region", region )); + dealPriceQuery.add(new QueryParam("city", city)); + dealPriceQuery.add(new QueryParam("region", region)); dealPriceQuery.add(new QueryParam("districtName", QueryParam.IN_OPERATOR, names)); - if(startDate != null){ - dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, startDate )); - }else{ - dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, DateUtil.add(new Date(), Calendar.MONTH, -3) )); + if (startDate != null) { + dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, startDate)); + } else { + dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, DateUtil.add(new Date(), Calendar.MONTH, -3))); } - List dealPriceSortParams = new ArrayList(); + List dealPriceSortParams = new ArrayList(); dealPriceSortParams.add(new SortParam("tradeDate", false)); List dealPrices = dealPriceDao.findAllByParams(dealPriceQuery, dealPriceSortParams, 0, 100, DEAL_PRICE_FIELDS); - for(DealPrice dealPrice : dealPrices){ + for (DealPrice dealPrice : dealPrices) { SampleWrapper sample = convertDealPrice2Sample(dealPrice); - if(isAvailableSample(sample)){ + if (isAvailableSample(sample)) { samples.add(sample); } - if(sample.getAboveFloorAmount() == null){ + if (sample.getAboveFloorAmount() == null) { allSampleHasHeight = false; - }else if(sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100){ - height = sample.getAboveFloorAmount() ; + } else if (sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100) { + height = sample.getAboveFloorAmount(); } - if(sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor){ + if (sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor) { maxFloor = sample.getFloorNumber(); } } - if(!allSampleHasHeight){ - if(height == 0){//Èç¹ûûÓÐÂ¥¸ßµ½Â¥¶°¿âÀïѰÕÒ×î¸ßµÄÂ¥¸ß + if (!allSampleHasHeight) { + if (height == 0) {//Èç¹ûûÓÐÂ¥¸ßµ½Â¥¶°¿âÀïѰÕÒ×î¸ßµÄÂ¥¸ß height = findHeight(city, region, name); } - if(height == 0){//Èç¹ûÂ¥¶°¿âûÓÐʹÓ÷¿Ô´ÖеÄ×î´óÂ¥²ã + if (height == 0) {//Èç¹ûÂ¥¶°¿âûÓÐʹÓ÷¿Ô´ÖеÄ×î´óÂ¥²ã height = maxFloor; } - if(height == 0){//ûÓÐÂ¥¸ßÐÅϢʹÓÃĬÈϵÄÂ¥¸ß - if(estateType == "01"){//סլĬÈÏ6Â¥ + if (height == 0) {//ûÓÐÂ¥¸ßÐÅϢʹÓÃĬÈϵÄÂ¥¸ß + if (estateType == "01") {//סլĬÈÏ6Â¥ height = 6; - }else{//±ðÊûĬÈÏÈý´å + } else {//±ðÊûĬÈÏÈý´å height = 3; } } @@ -872,18 +909,18 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertFangjiaToOfficial(city, region); - for(SampleWrapper sample : samples){ - if(sample.getAboveFloorAmount() == null){ + for (SampleWrapper sample : samples) { + if (sample.getAboveFloorAmount() == null) { sample.setAboveFloorAmount(height); } - if(sample.getFloorNumber() == null){ - if("01".equals(estateType)){ - sample.setFloorNumber((sample.getAboveFloorAmount()/2)); - }else{ + if (sample.getFloorNumber() == null) { + if ("01".equals(estateType)) { + sample.setFloorNumber((sample.getAboveFloorAmount() / 2)); + } else { sample.setFloorNumber(1); } } - if(fangjiaOfficialAreaMap != null){ + if (fangjiaOfficialAreaMap != null) { sample.setProvince(fangjiaOfficialAreaMap.getProvinceCode()); sample.setCity(fangjiaOfficialAreaMap.getCityCode()); sample.setDistrict(fangjiaOfficialAreaMap.getDistrictCode()); @@ -896,27 +933,28 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ /** * ½­ÄÏÐвéÕÒÐ¡ÇøÑù±¾£¨ÓÅÏÈʹÓñ´¿ÇÁ´¼Ò£© + * * @param city * @param region * @param name * @param alias - * @param estateType Óû§²éѯÎïÒµÀàÐÍ + * @param estateType Óû§²éѯÎïÒµÀàÐÍ * @param startDate * @param distEstateType Ð¡ÇøÎïÒµÀàÐÍ * @return */ - private List findJnbankSampleByDistrict(String city, String region, String name, List alias, String masterName, String distEstateType, String estateType, Date startDate, DistrictStat districtStat){ + private List findJnbankSampleByDistrict(String city, String region, String name, List alias, String masterName, String distEstateType, String estateType, Date startDate, DistrictStat districtStat) { List names = new ArrayList(); names.add(ClientUtils.escapeQueryChars(name)); - if(alias != null){ - for(String alia : alias){ - if(StringUtils.isNotBlank(alia) && alia.length() >= 2 && !names.contains(alia)){ + if (alias != null) { + for (String alia : alias) { + if (StringUtils.isNotBlank(alia) && alia.length() >= 2 && !names.contains(alia)) { names.add(ClientUtils.escapeQueryChars(alia)); } } } - if(StringUtils.isNotBlank(masterName)){ + if (StringUtils.isNotBlank(masterName)) { names.add(ClientUtils.escapeQueryChars(masterName)); } @@ -924,12 +962,12 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ List nolianjiaSamples = new ArrayList(); List houseQuery = new ArrayList(); - houseQuery.add(new QueryParam("city", city )); - houseQuery.add(new QueryParam("region", region )); - if(districtStat != null && districtStat.getAvgPrice() > 0){ + houseQuery.add(new QueryParam("city", city)); + houseQuery.add(new QueryParam("region", region)); + if (districtStat != null && districtStat.getAvgPrice() > 0) { int avgPrice = districtStat.getAvgPrice(); - houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int)(avgPrice * 0.5 )));//0.85 - houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int)(avgPrice * 1.5 )));//1.15 + houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, (int) (avgPrice * 0.5)));//0.85 + houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, (int) (avgPrice * 1.5)));//1.15 } BooleanQuery nameQuery = new BooleanQuery(); int c = 0; @@ -937,7 +975,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ if (StringUtils.isNotBlank(name)) { if (name.indexOf("£¨") > -1 || name.indexOf("£©") > -1 || name.indexOf("(") > -1 || name.indexOf(")") > -1 | name.indexOf("[") > -1 || name.indexOf("]") > -1 || name.indexOf("-") > -1 || name.indexOf("{") > -1 - || name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1|| name.indexOf("\\") > -1) { + || name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1 || name.indexOf("\\") > -1) { continue; } c++; @@ -945,13 +983,13 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ } } - if(nameQuery.clauses().size()==0){ + if (nameQuery.clauses().size() == 0) { return samples; } BooleanQuery srQuery = new BooleanQuery(); srQuery.add(nameQuery, BooleanClause.Occur.MUST); houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery))); - if(startDate != null){ + if (startDate != null) { houseQuery.add(new QueryParam("publishDate", QueryParam.GREATER_THAN_OPERATOR, startDate)); } @@ -961,93 +999,93 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ int height = 0; int maxFloor = 0; boolean allSampleHasHeight = true; - for(House house : houses){ - if(StringUtils.isNotBlank(estateType) && estateType.equals("01")){//01:ÆÕͨסլ 02:±ðÊû - if(StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("±ðÊû")){ + for (House house : houses) { + if (StringUtils.isNotBlank(estateType) && estateType.equals("01")) {//01:ÆÕͨסլ 02:±ðÊû + if (StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("±ðÊû")) { continue; } - if(isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())){ + if (isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())) { continue; } - }else if(StringUtils.isNotBlank(estateType) && estateType.equals("02")){ - if(house.getHeight()!=null && house.getHeight()>=10){ + } else if (StringUtils.isNotBlank(estateType) && estateType.equals("02")) { + if (house.getHeight() != null && house.getHeight() >= 10) { continue; } - if(house.getFloor()!=null && house.getFloor()>=10){ + if (house.getFloor() != null && house.getFloor() >= 10) { continue; } } SampleWrapper sample = convertHouse2Sample(house); - if(isAvailableSample(sample)){ - if(house.getUrl().contains("lianjia.com") || house.getUrl().contains("ke.com")){ + if (isAvailableSample(sample)) { + if (house.getUrl().contains("lianjia.com") || house.getUrl().contains("ke.com")) { samples.add(sample); - }else{ + } else { nolianjiaSamples.add(sample); } } - if(sample.getAboveFloorAmount() == null){ + if (sample.getAboveFloorAmount() == null) { allSampleHasHeight = false; - }else if(sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100){ - height = sample.getAboveFloorAmount() ; + } else if (sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100) { + height = sample.getAboveFloorAmount(); } - if(sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor){ + if (sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor) { maxFloor = sample.getFloorNumber(); } //ÕãÉ̲âÊÔÌØÒâÌí¼Ó - if(house.getDistrictName().equals("ÐÂãþÈý´å") && house.getArea()>=35 && house.getArea()<=55){ + if (house.getDistrictName().equals("ÐÂãþÈý´å") && house.getArea() >= 35 && house.getArea() <= 55) { sample.setDoorNo("502"); sample.setBuildingNoName("56"); } - if(StringUtils.isNotBlank(house.getEstateType())){ - if(house.getEstateType().contains("ÉÌÒµ") || house.getEstateType().contains("ÉÌס") || house.getEstateType().contains("°ì¹«")){ - sample.setBuildingName(house.getDistrictName() +"(ÉÌס)"); + if (StringUtils.isNotBlank(house.getEstateType())) { + if (house.getEstateType().contains("ÉÌÒµ") || house.getEstateType().contains("ÉÌס") || house.getEstateType().contains("°ì¹«")) { + sample.setBuildingName(house.getDistrictName() + "(ÉÌס)"); } - }else{ - if(StringUtils.isNotBlank(distEstateType) && (distEstateType.contains("ÉÌס") && (!name.contains("ÉÌס") || !name.contains("ÉÌÒµ")) )){ + } else { + if (StringUtils.isNotBlank(distEstateType) && (distEstateType.contains("ÉÌס") && (!name.contains("ÉÌס") || !name.contains("ÉÌÒµ")))) { sample.setBuildingName(house.getDistrictName() + "(ÉÌס)"); } } } List dealPriceQuery = new ArrayList(); - dealPriceQuery.add(new QueryParam("city", city )); - dealPriceQuery.add(new QueryParam("region", region )); + dealPriceQuery.add(new QueryParam("city", city)); + dealPriceQuery.add(new QueryParam("region", region)); dealPriceQuery.add(new QueryParam("districtName", QueryParam.IN_OPERATOR, names)); - if(startDate != null){ - dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, startDate )); - }else{ - dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, DateUtil.add(new Date(), Calendar.MONTH, -3) )); + if (startDate != null) { + dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, startDate)); + } else { + dealPriceQuery.add(new QueryParam("tradeDate", QueryParam.GREATER_THAN_OPERATOR, DateUtil.add(new Date(), Calendar.MONTH, -3))); } - List dealPriceSortParams = new ArrayList(); + List dealPriceSortParams = new ArrayList(); dealPriceSortParams.add(new SortParam("tradeDate", false)); List dealPrices = dealPriceDao.findAllByParams(dealPriceQuery, dealPriceSortParams, 0, 100, DEAL_PRICE_FIELDS); - for(DealPrice dealPrice : dealPrices){ + for (DealPrice dealPrice : dealPrices) { SampleWrapper sample = convertDealPrice2Sample(dealPrice); - if(isAvailableSample(sample)){ + if (isAvailableSample(sample)) { samples.add(sample); } - if(sample.getAboveFloorAmount() == null){ + if (sample.getAboveFloorAmount() == null) { allSampleHasHeight = false; - }else if(sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100){ - height = sample.getAboveFloorAmount() ; + } else if (sample.getAboveFloorAmount() > 0 && sample.getAboveFloorAmount() > height && sample.getAboveFloorAmount() < 100) { + height = sample.getAboveFloorAmount(); } - if(sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor){ + if (sample.getFloorNumber() != null && sample.getFloorNumber() > maxFloor) { maxFloor = sample.getFloorNumber(); } } - if(!allSampleHasHeight){ - if(height == 0){//Èç¹ûûÓÐÂ¥¸ßµ½Â¥¶°¿âÀïѰÕÒ×î¸ßµÄÂ¥¸ß + if (!allSampleHasHeight) { + if (height == 0) {//Èç¹ûûÓÐÂ¥¸ßµ½Â¥¶°¿âÀïѰÕÒ×î¸ßµÄÂ¥¸ß height = findHeight(city, region, name); } - if(height == 0){//Èç¹ûÂ¥¶°¿âûÓÐʹÓ÷¿Ô´ÖеÄ×î´óÂ¥²ã + if (height == 0) {//Èç¹ûÂ¥¶°¿âûÓÐʹÓ÷¿Ô´ÖеÄ×î´óÂ¥²ã height = maxFloor; } - if(height == 0){//ûÓÐÂ¥¸ßÐÅϢʹÓÃĬÈϵÄÂ¥¸ß - if(estateType == "01"){//סլĬÈÏ6Â¥ + if (height == 0) {//ûÓÐÂ¥¸ßÐÅϢʹÓÃĬÈϵÄÂ¥¸ß + if (estateType == "01") {//סլĬÈÏ6Â¥ height = 6; - }else{//±ðÊûĬÈÏÈý´å + } else {//±ðÊûĬÈÏÈý´å height = 3; } } @@ -1055,22 +1093,22 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertFangjiaToOfficial(city, region); - if(samples.size()<10){ + if (samples.size() < 10) { samples.addAll(nolianjiaSamples); } - for(SampleWrapper sample : samples){ - if(sample.getAboveFloorAmount() == null){ + for (SampleWrapper sample : samples) { + if (sample.getAboveFloorAmount() == null) { sample.setAboveFloorAmount(height); } - if(sample.getFloorNumber() == null){ - if("01".equals(estateType)){ - sample.setFloorNumber((sample.getAboveFloorAmount()/2)); - }else{ + if (sample.getFloorNumber() == null) { + if ("01".equals(estateType)) { + sample.setFloorNumber((sample.getAboveFloorAmount() / 2)); + } else { sample.setFloorNumber(1); } } - if(fangjiaOfficialAreaMap != null){ + if (fangjiaOfficialAreaMap != null) { sample.setProvince(fangjiaOfficialAreaMap.getProvinceCode()); sample.setCity(fangjiaOfficialAreaMap.getCityCode()); sample.setDistrict(fangjiaOfficialAreaMap.getDistrictCode()); @@ -1082,120 +1120,104 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ } - - private List findBeijiaoShouSampleByDistrict(String city, String region, String name, List alias, String masterName, String distEstateType, String estateType, Date startDate, DistrictStat districtStat, Double area, Integer maxResultCount){ - - List names = new ArrayList(); - names.add(ClientUtils.escapeQueryChars(name)); - if(alias != null){ - for(String alia : alias){ - if(StringUtils.isNotBlank(alia) && alia.length() >= 2 && !names.contains(alia)){ - names.add(ClientUtils.escapeQueryChars(alia)); - } - } - } - if(StringUtils.isNotBlank(masterName)){ - names.add(ClientUtils.escapeQueryChars(masterName)); - } - + private List findBeijiaoShouSampleByDistrict(List districtNameKeys, String distEstateType, String estateType, Date startDate, DistrictStat districtStat, Double area, Integer maxResultCount) { List samples = new ArrayList(); List nolianjiaSamples = new ArrayList(); List houseQuery = new ArrayList(); - houseQuery.add(new QueryParam("city", city )); - houseQuery.add(new QueryParam("region", region )); - Integer minPrice = null; Integer maxPrice = null; - if(districtStat != null && districtStat.getAvgPrice() > 0){ + if (districtStat != null && districtStat.getAvgPrice() > 0) { int avgPrice = districtStat.getAvgPrice(); - minPrice = (int)(avgPrice * 0.8 ); - maxPrice = (int)(avgPrice * 1.2 ); + minPrice = (int) (avgPrice * 0.8); + maxPrice = (int) (avgPrice * 1.2); houseQuery.add(new QueryParam("avgPrice", QueryParam.GREATER_THAN_EQUAL_OPERATOR, minPrice));//0.85 houseQuery.add(new QueryParam("avgPrice", QueryParam.LESS_THAN_EQUAL_OPERATOR, maxPrice));//1.15 } - if(area != null && area > 0){ - double stepArea = DataUtil.getDoubleRound(2,area*0.2); - if(stepArea<15){ + if (area != null && area > 0) { + double stepArea = DataUtil.getDoubleRound(2, area * 0.2); + if (stepArea < 15) { stepArea = 15; } - houseQuery.add(new QueryParam("area", QueryParam.GREATER_THAN_EQUAL_OPERATOR, area - stepArea)); - houseQuery.add(new QueryParam("area", QueryParam.LESS_THAN_EQUAL_OPERATOR, area + stepArea)); + double paramValue = DataUtil.getDoubleRound(2, area - stepArea); + houseQuery.add(new QueryParam("area", QueryParam.GREATER_THAN_EQUAL_OPERATOR, paramValue)); + double paramValue1 = DataUtil.getDoubleRound(2, area + stepArea); + houseQuery.add(new QueryParam("area", QueryParam.LESS_THAN_EQUAL_OPERATOR, paramValue1)); } BooleanQuery nameQuery = new BooleanQuery(); int c = 0; - for (String n : names) { + for (String name : districtNameKeys) { if (StringUtils.isNotBlank(name)) { - if (name.indexOf("£¨") > -1 || name.indexOf("£©") > -1 || name.indexOf("(") > -1 || name.indexOf(")") > -1 - | name.indexOf("[") > -1 || name.indexOf("]") > -1 || name.indexOf("-") > -1 || name.indexOf("{") > -1 - || name.indexOf("}") > -1 || name.indexOf("{") > -1 || name.indexOf("}") > -1 || name.indexOf(":") > -1|| name.indexOf("\\") > -1) { - continue; - } + name = ClientUtils.escapeQueryChars(name); c++; - nameQuery.add(new TermQuery(new Term("district_name", n)), BooleanClause.Occur.SHOULD); + nameQuery.add(new TermQuery(new Term("districtname_key", name)), BooleanClause.Occur.SHOULD); } } - - if(nameQuery.clauses().size()==0){ + if (nameQuery.clauses().size() == 0) { return samples; } BooleanQuery srQuery = new BooleanQuery(); srQuery.add(nameQuery, BooleanClause.Occur.MUST); + houseQuery.add(new QueryParam("$sr", new SrQuery(srQuery))); - if(startDate != null){ + if (startDate != null) { houseQuery.add(new QueryParam("publishDate", QueryParam.GREATER_THAN_OPERATOR, startDate)); } + //ÏÞÖÆ·µ»ØÎĵµÊý + // ÔÚ´Ë´¦ÉèÖ÷µ»Ø½á¹ûµÄÊýÁ¿ÏÞÖÆ +// houseQuery.add(new QueryParam("$limit", 5)); + List houseSortParams = new ArrayList(); houseSortParams.add(new SortParam("publishDate", false)); List houses = houseDao.findAllByParams(houseQuery, houseSortParams, 0, maxResultCount, HOUSE_FIELDS); int height = 0; int maxFloor = 0; boolean allSampleHasHeight = true; - for(House house : houses){ - if(StringUtils.isNotBlank(estateType) && estateType.equals("01")){//01:ÆÕͨסլ 02:±ðÊû - if(StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("±ðÊû")){ + for (House house : houses) { + if (StringUtils.isNotBlank(estateType) && estateType.equals("01")) {//01:ÆÕͨסլ 02:±ðÊû + if (StringUtils.isNotBlank(house.getEstateType()) && house.getEstateType().contains("±ðÊû")) { continue; } - if(isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())){ + if (isVilla(house.getArea(), house.getName(), house.getHeight(), house.getRoom())) { continue; } - }else if(StringUtils.isNotBlank(estateType) && estateType.equals("02")){ - if(house.getHeight()!=null && house.getHeight()>=10){ + } else if (StringUtils.isNotBlank(estateType) && estateType.equals("02")) { + if (house.getHeight() != null && house.getHeight() >= 10) { continue; } - if(house.getFloor()!=null && house.getFloor()>=10){ + if (house.getFloor() != null && house.getFloor() >= 10) { continue; } } - Integer avgPrice = (int)(house.getTotalPrice()/house.getArea()); - if(minPrice !=null && (avgPricemaxPrice)){ + Integer avgPrice = (int) (house.getTotalPrice() / house.getArea()); + if (minPrice != null && (avgPrice < minPrice || avgPrice > maxPrice)) { continue; } house.setAvgPrice(avgPrice); SampleWrapper sample = convertHouse2Sample(house); - if(isAvailableSample(sample)){ - if(house.getUrl().contains("lianjia.com") || house.getUrl().contains("ke.com")){ + if (isAvailableSample(sample)) { + if (house.getUrl().contains("lianjia.com") || house.getUrl().contains("ke.com")) { samples.add(sample); - }else{ + } else { nolianjiaSamples.add(sample); } } //ÕãÉ̲âÊÔÌØÒâÌí¼Ó - if(house.getDistrictName().equals("ÐÂãþÈý´å") && house.getArea()>=35 && house.getArea()<=55){ + if (house.getDistrictName().equals("ÐÂãþÈý´å") && house.getArea() >= 35 && house.getArea() <= 55) { sample.setDoorNo("502"); sample.setBuildingNoName("56"); } - if(StringUtils.isNotBlank(house.getEstateType())){ - if(house.getEstateType().contains("ÉÌÒµ") || house.getEstateType().contains("ÉÌס") || house.getEstateType().contains("°ì¹«")){ - sample.setBuildingName(house.getDistrictName() +"(ÉÌס)"); + if (StringUtils.isNotBlank(house.getEstateType())) { + if (house.getEstateType().contains("ÉÌÒµ") || house.getEstateType().contains("ÉÌס") || house.getEstateType().contains("°ì¹«")) { + sample.setBuildingName(house.getDistrictName() + "(ÉÌס)"); } - }else{ - if(StringUtils.isNotBlank(distEstateType) && (distEstateType.contains("ÉÌס") && (!name.contains("ÉÌס") || !name.contains("ÉÌÒµ")) )){ + } else { + if (StringUtils.isNotBlank(distEstateType) && (distEstateType.contains("ÉÌס") && (!house.getDistrictName().contains("ÉÌס") || !house.getDistrictName().contains("ÉÌÒµ")))) { sample.setBuildingName(house.getDistrictName() + "(ÉÌס)"); } } @@ -1204,21 +1226,21 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ // FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertFangjiaToOfficial(city, region); - if(samples.size()<10){ + if (samples.size() < 10) { samples.addAll(nolianjiaSamples); } - for(SampleWrapper sample : samples){ + for (SampleWrapper sample : samples) { // if(sample.getAboveFloorAmount() == null){ // sample.setAboveFloorAmount(height); // } - if(sample.getFloorNumber() == null){ - if("01".equals(estateType)){ + if (sample.getFloorNumber() == null) { + if ("01".equals(estateType)) { // System.out.println(sample.getAboveFloorAmount()); - if(sample.getAboveFloorAmount()!=null){ - sample.setFloorNumber((sample.getAboveFloorAmount()/2)); + if (sample.getAboveFloorAmount() != null) { + sample.setFloorNumber((sample.getAboveFloorAmount() / 2)); } - }else{ + } else { sample.setFloorNumber(1); } } @@ -1234,12 +1256,13 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ /** * ¸ù¾ÝÐ¡ÇøÃûÔÚÂ¥¶°¿âÖвéѯ×î´óµÄÂ¥¸ß + * * @param city * @param region * @param name * @return */ - private int findHeight(String city, String region, String name){ + private int findHeight(String city, String region, String name) { List query = new ArrayList(); query.add(new QueryParam("city", city)); @@ -1249,7 +1272,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ List sortParams = new ArrayList(); sortParams.add(new SortParam("floors", false)); Loudong loudong = loudongDao.findFirstByParams(query, sortParams); - if(loudong == null){ + if (loudong == null) { return 0; } return loudong.getFloors(); @@ -1260,7 +1283,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ * @param dealPrice * @return */ - private SampleWrapper convertDealPrice2Sample(DealPrice dealPrice){ + private SampleWrapper convertDealPrice2Sample(DealPrice dealPrice) { SampleWrapper sample = new SampleWrapper(); sample.setSampleId(dealPrice.getId()); @@ -1278,14 +1301,14 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ sample.setDetailAddress(dealPrice.getAddress()); sample.setDoorNo(dealPrice.getRoomNumber()); sample.setBuildingNoName(dealPrice.getHouseNumber()); - if(sample.getUnitPrice() == null && dealPrice.getTotalPrice() != null && dealPrice.getArea() != null && dealPrice.getArea() != 0){ - sample.setUnitPrice((int)(dealPrice.getTotalPrice() / dealPrice.getArea())); + if (sample.getUnitPrice() == null && dealPrice.getTotalPrice() != null && dealPrice.getArea() != null && dealPrice.getArea() != 0) { + sample.setUnitPrice((int) (dealPrice.getTotalPrice() / dealPrice.getArea())); } return sample; } - private SampleWrapper convertQueryBean2Sample(CollateralSampleQueryBean queryBean){ + private SampleWrapper convertQueryBean2Sample(CollateralSampleQueryBean queryBean) { SampleWrapper sample = new SampleWrapper(); sample.setCity(queryBean.getFangjiaCity()); sample.setDistrict(queryBean.getFangjiaDistrict()); @@ -1296,13 +1319,13 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ sample.setTowardDirectCode(queryBean.getTowardDirectCode()); sample.setSampleDate(new Date()); Integer avgPrice = districtStatService.findLatestDistrictAvgPrice(sample.getCity(), sample.getDistrict(), null, sample.getBuildingName()); - if(avgPrice != 0){ + if (avgPrice != 0) { sample.setUnitPrice(avgPrice); } return sample; } - private SampleWrapper convertQueryBean2Sample(ShopCollateralSampleQueryBean queryBean){ + private SampleWrapper convertQueryBean2Sample(ShopCollateralSampleQueryBean queryBean) { SampleWrapper sample = new SampleWrapper(); sample.setCity(queryBean.getFangjiaCity()); sample.setDistrict(queryBean.getFangjiaDistrict()); @@ -1315,10 +1338,11 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ /** * °Ñ¹ÒÅÆ·¿Ô´×ª»»³ÉÑù±¾Êý¾Ý + * * @param house * @return */ - private SampleWrapper convertHouse2Sample(House house){ + private SampleWrapper convertHouse2Sample(House house) { SampleWrapper sample = new SampleWrapper(); sample.setSampleId(house.getId()); sample.setCity(house.getCity()); @@ -1333,19 +1357,20 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ sample.setTowardDirectCode(HouseValidator.formatDirectionToCode(house.getDirection())); sample.setSampleDate(house.getPublishDate()); sample.setDetailAddress(house.getAddress()); - if(sample.getUnitPrice() == null && house.getTotalPrice() != null && house.getArea() != null){ - sample.setUnitPrice((int)(house.getTotalPrice()/house.getArea())); + if (sample.getUnitPrice() == null && house.getTotalPrice() != null && house.getArea() != null) { + sample.setUnitPrice((int) (house.getTotalPrice() / house.getArea())); } return sample; } /** * ÅжÏÑù±¾ÊÇ·ñ¿ÉÓà + * * @param sample * @return */ - private boolean isAvailableSample(SampleWrapper sample){ - if(sample.getStrctureArea() > 500 || sample.getStrctureArea() < 10){ + private boolean isAvailableSample(SampleWrapper sample) { + if (sample.getStrctureArea() > 500 || sample.getStrctureArea() < 10) { return false; } @@ -1363,14 +1388,14 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ return null; } - private Integer getBuildYear(String finishDate, String liveDate, String buildDate ,Date openDate) { + private Integer getBuildYear(String finishDate, String liveDate, String buildDate, Date openDate) { Integer finishYear = getYearFormDate(finishDate); Integer liveYear = getYearFormDate(liveDate); Integer buildYear = getYearFormDate(buildDate); Integer openYear = null; - if(openDate != null){ - openYear = Integer.valueOf(DateUtil.formatByPattern(openDate,"yyyy")); + if (openDate != null) { + openYear = Integer.valueOf(DateUtil.formatByPattern(openDate, "yyyy")); } int minYear = Integer.MAX_VALUE; if (finishYear != null && finishYear < minYear) { @@ -1382,42 +1407,42 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ if (buildYear != null && buildYear < minYear) { minYear = buildYear; } - if(openYear != null && openYear < minYear){ + if (openYear != null && openYear < minYear) { minYear = openYear; } - if(minYear == Integer.MAX_VALUE){ + if (minYear == Integer.MAX_VALUE) { return null; } return minYear; } - public String getOpenDate(District district){ - if(district.getOpenDate()!=null){ + public String getOpenDate(District district) { + if (district.getOpenDate() != null) { return DateUtil.formatToYYYYMMDD(district.getOpenDate()); } - if(StringUtils.isNotBlank(district.getLiveDate())){ + if (StringUtils.isNotBlank(district.getLiveDate())) { return DateUtil.formatToYYYYMMDD(DateUtil.parseStringToDate(district.getLiveDate())); } - if(StringUtils.isNotBlank(district.getFinishBuildingDate())){ + if (StringUtils.isNotBlank(district.getFinishBuildingDate())) { return DateUtil.formatToYYYYMMDD(DateUtil.parseStringToDate(district.getFinishBuildingDate())); } return null; } - private Integer getHouseUseYear(Integer minYear, String s){ + private Integer getHouseUseYear(Integer minYear, String s) { - if(StringUtils.isBlank(s)){ + if (StringUtils.isBlank(s)) { return null; } - if(minYear != null && minYear > 0){ + if (minYear != null && minYear > 0) { int curYear = new Date().getYear() + 1900; int shengYuYear = curYear - minYear; - if( shengYuYear > 0 && shengYuYear <= 70){ - Integer year = extractYear(s); - if(year !=null && year > 0 && year <= 70){ + if (shengYuYear > 0 && shengYuYear <= 70) { + Integer year = extractYear(s); + if (year != null && year > 0 && year <= 70) { int useYear = year - shengYuYear; - if(year > 0 && year <= 70){ + if (year > 0 && year <= 70) { return useYear; } @@ -1427,19 +1452,19 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ return null; } - private Integer extractYear(String s){ + private Integer extractYear(String s) { Pattern p = Pattern.compile("(\\d+)"); Matcher m = p.matcher(s); - if(m.find()){ + if (m.find()) { return Integer.parseInt(m.group(1)); } return null; } - private Integer getYearFormDate(String dateStr){ - if(dateStr != null && StringUtils.isNotBlank(dateStr)){ + private Integer getYearFormDate(String dateStr) { + if (dateStr != null && StringUtils.isNotBlank(dateStr)) { Date date = DateUtil.parseStringToDate(dateStr); - if(date != null){ + if (date != null) { int year = date.getYear() + 1900; return year; } @@ -1449,6 +1474,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ /** * ÊÇ·ñÊDZðÊû + * * @return */ public boolean isVilla(Double area, String name, Integer height, Integer room) { @@ -1503,7 +1529,8 @@ public class CzbankSampleServiceImpl implements CzbankSampleService{ public void setDistrictSellStatService(DistrictSellStatService districtSellStatService) { this.districtSellStatService = districtSellStatService; } - class MaxMinModel{ + + class MaxMinModel { Double min = Double.MAX_VALUE; Double max = 0d; diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java index 5c48fa0b4..d1f56da79 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java @@ -522,6 +522,7 @@ public interface DistrictService extends ModeService { public District findOneByKey(DistrictKey districtKey, String cat); List findNearestDistrict(District district, int radiusMeters, int limit); + List doFindNearestHasHouseDistrict(District district, int radiusMeters, int limit) ; List findNearestDistrict(District district, int radiusMeters, String[] fields, int limit); diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java index 4f9dc8686..c5f8d917c 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java @@ -2297,6 +2297,22 @@ public class DistrictServiceImpl implements DistrictService { return list; } + @SuppressWarnings("unchecked") + public List findNearestHasHouseDistrict(District district, int radiusMeters, int limit) { + String cacheKey = district.getCity() + "#" + district.getRegion() + "#" + district.getName() + "#" + radiusMeters + "#_if_sell_1" + limit; + Object obj = CacheUtils.getValue(this.getClass(), cacheKey); + if (obj != null) { + return (List) obj; + } + ArrayList list = new ArrayList(); + List nlist = doFindNearestHasHouseDistrict(district, radiusMeters, limit); + if (nlist.size() > 0) { + list = (ArrayList) nlist; + } + CacheUtils.putValue(CachePolicyEnum.LONG, this.getClass(), cacheKey, list); + return list; + } + public List findNearestDistrict(District district, int radiusMeters, String[] fields, int limit) { String cacheKey = district.getCity() + "#" + district.getRegion() + "#" + district.getName() + "#" + radiusMeters + "#" + limit; @@ -2437,6 +2453,48 @@ public class DistrictServiceImpl implements DistrictService { return new ArrayList(ret); } + public List doFindNearestHasHouseDistrict(District district, int radiusMeters, int limit) { + if (district == null || district.getLat() == null || district.getLng() == null || district.getLat() <= 0 + || district.getLng() <= 0) { + return Collections.EMPTY_LIST; + } + + List params = new ArrayList(); + params.add(new QueryParam("category", "district")); + params.add(new QueryParam("city", district.getCity())); + params.add(new QueryParam("visible", 0)); + params.add(new QueryParam("ifSell", 1)); + SdQuery sdQuery = new SdQuery(); + sdQuery.setPoint((double) district.getLat() / 10000000000.0 + "," + (double) district.getLng() / 10000000000.0); + sdQuery.setField("lat_lng"); + sdQuery.setDistance(String.valueOf((double) radiusMeters / 1000.0)); + params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery)); + List list = districtDao.findAllByParams(params, null, 0, limit * 2, + new String[] { "city", "region", "name", "estateType2", "id" }); + if (list.isEmpty()) { + return list; + } + + List ret = new ArrayList(); + for (District d : list) { + if (district.getName().equals(d.getName()) && district.getRegion().equals(d.getRegion()) + && district.getCity().equals(d.getCity())) { + continue; + } + if (d.getEstateType2() != null) { + if (d.getEstateType2().indexOf(district.getEstateType2()) > -1) { + ret.add(d); + } + } + } + + if (ret.size() > limit) { + ret = ret.subList(0, limit); + } + + return new ArrayList(ret); + } + public List doFindNearestDistrict(District district, int radiusMeters, String[] fields, int limit) { if (district == null || district.getLat() == null || district.getLng() == null || district.getLat() <= 0