From b52037997be46abcd7f7b9e1fc799dfe389ec5f7 Mon Sep 17 00:00:00 2001 From: "zhaojixiang@fangjia.com" Date: Mon, 10 Jul 2023 12:59:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?api=E7=AE=A1=E7=90=86-=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E7=9B=91=E6=8E=A7=E5=B1=9E?= =?UTF-8?q?=E6=80=A7,=E9=BB=98=E8=AE=A4=E4=B8=8D=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/bkoff/controllers/ApiUserController.java | 4 ++++ .../java/com/fangjia/bkoff/model/ApiUserModel.java | 9 +++++++++ projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl | 9 ++++++++- .../fangjia-bkoff/src/main/webapp/apiUser/edit.ftl | 7 +++++++ .../fangjia-bkoff/src/main/webapp/apiUser/list.ftl | 10 ++++++++++ .../main/java/com/fangjia/dal/sql/model/ApiUser.java | 10 ++++++++++ .../main/java/com/fangjia/service/open/ApiUserBo.java | 9 +++++++++ 7 files changed, 57 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java index 7c782d610..7df83ddd3 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java @@ -102,6 +102,7 @@ public class ApiUserController { bo.setPurpose(apiUser.getPurpose()); bo.setDeadTime(apiUser.getDeadTime()); bo.setManager(apiUser.getManager()); + bo.setIsMonitor(apiUser.getIsMonitor()); apiUserBoList.add(bo); } @@ -183,6 +184,7 @@ public class ApiUserController { apiUser.setModificationDate(date); apiUser.setDeadTime(model.getDeadTime()); apiUser.setManager(model.getManager()); + apiUser.setIsMonitor(model.getIsMonitor()); this.apiUserService.save(apiUser); if(model.getEvaluateRate() != null && model.getEvaluateRate() != 0){ ApiUserCfg apiUserCfg = new ApiUserCfg(); @@ -222,6 +224,7 @@ public class ApiUserController { bo.setEmail(apiUser.getEmail()); bo.setDeadTime(apiUser.getDeadTime()); bo.setManager(apiUser.getManager()); + bo.setIsMonitor(apiUser.getIsMonitor()); ApiUserCfg apiUserCfg_rate = apiUserCfgService.findByUserId(apiUser.getId(), ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE); if(apiUserCfg_rate != null){ bo.setEvaluateRate((Double) apiUserCfg_rate.getCfgValue()); @@ -272,6 +275,7 @@ public class ApiUserController { dataApiUser.put("purpose", model.getPurpose()); dataApiUser.put("deadTime", model.getDeadTime()); dataApiUser.put("manager", model.getManager()); + dataApiUser.put("isMonitor", model.getIsMonitor()); this.apiUserService.update(dataApiUser, userId); //ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java index b252774f1..ad264fe9a 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/ApiUserModel.java @@ -38,6 +38,7 @@ public class ApiUserModel extends BaseModel { private Integer creditLevelStatus; private String priceType; private Map priceRatingMap; + private Integer isMonitor; public String getPriceType() { return priceType; @@ -606,4 +607,12 @@ public class ApiUserModel extends BaseModel { public void setManager(String manager) { this.manager = manager; } + + public Integer getIsMonitor() { + return isMonitor; + } + + public void setIsMonitor(Integer isMonitor) { + this.isMonitor = isMonitor; + } } diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl index 410b73fae..29ae67e83 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl @@ -57,13 +57,20 @@ 账户用途 + + 是å�¦ç›‘控 + + ä¸�监控 + 监控 + + Email diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl index caf99a2c7..31fb2f51a 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl @@ -72,6 +72,13 @@ + + 是å�¦ç›‘控 + + checked="checked" name="isMonitor" value="0" />ä¸�监控 + checked="checked" name="isMonitor" value="1" style="margin-left: 15px;"/>监控 + + Email diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/list.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/list.ftl index 0924ceb7e..37afef638 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/list.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/list.ftl @@ -53,6 +53,9 @@ 账户用途 + + 是å�¦ç›‘控 + 到期时间 @@ -114,6 +117,13 @@ 房生活 + + <#if bo.isMonitor==1> + 是 + <#else> + å�¦ + + <#if bo.deadTime??> ${bo.deadTime?string("yyyyå¹´MM月ddæ—¥")} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/ApiUser.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/ApiUser.java index 1cddeac31..52806e4df 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/ApiUser.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/ApiUser.java @@ -39,6 +39,8 @@ public class ApiUser implements SqlEntity { private String manager; + private Integer isMonitor; + @Id @Column(name = "ID") public long getId() { @@ -175,4 +177,12 @@ public class ApiUser implements SqlEntity { public void setManager(String manager) { this.manager = manager; } + @Column(name = "IS_MONITOR") + public Integer getIsMonitor() { + return isMonitor; + } + + public void setIsMonitor(Integer isMonitor) { + this.isMonitor = isMonitor; + } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java b/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java index 4eae77e54..8c09268bf 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/open/ApiUserBo.java @@ -26,6 +26,7 @@ public class ApiUserBo implements Serializable { private Date deadTime; private String manager; private String priceType; + private Integer isMonitor; public String getPriceType() { return priceType; @@ -162,4 +163,12 @@ public class ApiUserBo implements Serializable { public void setManager(String manager) { this.manager = manager; } + + public Integer getIsMonitor() { + return isMonitor; + } + + public void setIsMonitor(Integer isMonitor) { + this.isMonitor = isMonitor; + } } From dfa5c6719b77004ee6b14d982da55e581c4f2bdb Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 10 Jul 2023 16:22:43 +0800 Subject: [PATCH 2/2] update --- .../ccbevaluation/data/CcbDataStat.groovy | 77 +++- .../ronghe/BigdataCitypriceBatch.groovy | 6 +- .../ronghe/ExportDistrictRongHe.groovy | 88 ++-- .../fangjia/script/gj/AddAvgpriceBatch.groovy | 5 +- .../gj/district/FangjiaClientUtils.groovy | 2 +- .../gj/district/OfficeFieldCleanBatch.groovy | 379 +++++++++++++++++- 6 files changed, 479 insertions(+), 78 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/CcbDataStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/CcbDataStat.groovy index d7be2d646..3b095eb3c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/CcbDataStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/data/CcbDataStat.groovy @@ -19,9 +19,9 @@ class CcbDataStat { static main(args) { def task = new CcbDataStat() -// task.run() + task.run(args) // task.tradeRun() - task.regionDistStat() +// task.regionDistStat() } def regionDistStat(){ @@ -124,22 +124,37 @@ class CcbDataStat { return count } - def run(){ + def run(args){ + def citys = CcbCommonUtils.getRunningCitys(args) def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() - ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\½¨ÐÐ\\½¨Ðгɽ»\\92¸ö³ÇÊÐ×ֶθ²¸ÇÂÊÇé¿ö.xlsx",{ d-> - if(d['A']) { - def citycode = cityCodeDataMap.get(d['A']) - def total = findTotalCount(citycode) - def f_count = findDistFinishDate(citycode) - def b_count = findBuildTypeCount(citycode) - def f_pre = DataHandleUtils.getDoubleRound(2, f_count*100/total) - def b_pre = DataHandleUtils.getDoubleRound(2, b_count*100/total) - d['C'] = f_pre - d['D'] = b_pre - d['E'] = total - println d['A'] +" "+ total +" "+f_count+" "+b_count - } - }) + def rets = [] + rets << ["³ÇÊÐ","¾­Î³¶È","ÎïÒµÀàÐÍ","½¨ÖþÄê´ú","½¨ÖþÀàÐÍ","ÂÌ»¯ÂÊ","ÈÝ»ýÂÊ"] + for(def c : citys){ + def ret = [] + ret << c + def citycode = cityCodeDataMap.get(c) + def total = findTotalCount(citycode) + def lat_count = findLocationCount(citycode) + def f_count = findDistFinishDate(citycode) + def b_count = findBuildTypeCount(citycode) + def g_count = findVirescencePercent(citycode) + def c_count = findCubagePercentPercent(citycode) + def location_pre = DataHandleUtils.getDoubleRound(2, lat_count*100/total) + def f_pre = DataHandleUtils.getDoubleRound(2, f_count*100/total) + def b_pre = DataHandleUtils.getDoubleRound(2, b_count*100/total) + def g_pre = DataHandleUtils.getDoubleRound(2, g_count*100/total) + def c_pre = DataHandleUtils.getDoubleRound(2, c_count*100/total) + ret << location_pre + ret << 100 + ret << b_pre + ret << f_pre + ret << g_pre + ret << c_pre + ret << total + rets << ret + } + + ExcelUtils.write("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\½¨Ðй©ÊýÖØÒª×ֶθ²¸ÇÂÊ.xlsx", rets, "ͳ¼Æ") } def findTotalCount(citycode){ @@ -168,4 +183,32 @@ class CcbDataStat { }) return count } + + def findLocationCount(citycode){ + def sql = "select count(*) as count from bigdata_community_gj where cityid='${citycode}' and status=0 and longitude>0";//where cityId in (350200,150100) + def count = 0 + sqlInstance.eachRow(sql, { r -> + count = r.count + }) + return count + } + + def findVirescencePercent(citycode){ + def sql = "select count(*) as count from bigdata_community_gj where cityid='${citycode}' and status=0 and GREENINGRATE is not null";//where cityId in (350200,150100) + def count = 0 + sqlInstance.eachRow(sql, { r -> + count = r.count + }) + return count + } + + + def findCubagePercentPercent(citycode){ + def sql = "select count(*) as count from bigdata_community_gj where cityid='${citycode}' and status=0 and PLOTRATIO is not null";//where cityId in (350200,150100) + def count = 0 + sqlInstance.eachRow(sql, { r -> + count = r.count + }) + return count + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy index ed89f59ac..9ed8300cc 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy @@ -61,9 +61,9 @@ class BigdataCitypriceBatch extends BaseBatch{ def dealStartDate = DateUtils.addMonth(DateUtils.parseFromTightByPattern(startDate.toString(), "yyyyMMdd"), -1) def lastYearDate = DateUtils.addMonth(startDate.toString(),-12, "yyyyMMdd").toInteger(); - cityRun(citys, startDate, endDate, cityCodeMap) - regionRun(citys, startDate, endDate, cityCodeMap) -// districtRun(citys, startDate, endDate, dealStartDate, lastYearDate, cityCodeMap) +// cityRun(citys, startDate, endDate, cityCodeMap) +// regionRun(citys, startDate, endDate, cityCodeMap) + districtRun(citys, startDate, endDate, dealStartDate, lastYearDate, cityCodeMap) } def cityRun(citys, startDate, endDate, cityCodeDataMap){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy index ae9f4f058..fe3c7dd6b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy @@ -45,27 +45,27 @@ class ExportDistrictRongHe extends BaseBatch{ //°´Ììµ¼£¨Ã¿ÌìÒ»¸öÎļþ¼Ð£© // exportBigdataDealFJW2(curDate, DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()+1,-2), "yyyy-MM-dd"), new_dists) - exportPgBigdataDealFJW(curDate, DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()+1,-2), "yyyy-MM-dd"), new_dists) +// exportPgBigdataDealFJW(curDate, DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()+1,-2), "yyyy-MM-dd"), new_dists) - if(curDate.toString().endsWith("10")){ - exportBigdataCommunityGJRH()// - exportBigdataBuildingFJW()// - exportBigdataCommfeeGj()// - - exportBigdataCommbuildstruGJ()// - exportBigdataCommhousetypeGJ()// - exportBigdataCommbuildyearGj()// - exportBigdataCommhouseuseGJ()// - exportBigdataPositionGJ()// - exportBigdataDistrictFJW()// - exportBigdataAliasFJW()// - - exportBigdataBuildprojFjw() - exportBigdataCommlayoutpicFjw() - exportEvaluateRate() - - exportBigdataCityPrice(queryDate) - exportBigdataDistPrice(queryDate) +// if(curDate.toString().endsWith("10")){ +// exportBigdataCommunityGJRH()// +// exportBigdataBuildingFJW()// +// exportBigdataCommfeeGj()// +// +// exportBigdataCommbuildstruGJ()// +// exportBigdataCommhousetypeGJ()// +// exportBigdataCommbuildyearGj()// +// exportBigdataCommhouseuseGJ()// +// exportBigdataPositionGJ()// +// exportBigdataDistrictFJW()// +// exportBigdataAliasFJW()// +// +// exportBigdataBuildprojFjw() +// exportBigdataCommlayoutpicFjw() +// exportEvaluateRate() +// +// exportBigdataCityPrice(queryDate) +// exportBigdataDistPrice(queryDate) exportBigdataCommPrice(queryDate) //1ÔÂ10ÈÕ ÐÂÔö5ÕÅ±í£¬µ¼92³Ç£¬ÔöÁ¿Êý¾Ý£¬2ÔÂ10ÈÕµ¼344³Ç£¬ÆäÖÐ252³ÇËùÓÐÀúÊ·Êý¾Ý£¬92³ÇÔöÁ¿£¬3Ôºó¿ÉÄܲ»ÓÃÌṩÊý¾Ý // exportCommunityBasePrice(lastMonth) @@ -75,25 +75,25 @@ class ExportDistrictRongHe extends BaseBatch{ // exportBigdataModelingBase(lastMonth) //2ÔÂ8ºÅ ÁÙʱµ¼³öËÕÖÝÒ»ÄêµÄÊý¾Ý - exportPgBigdataForsale(houseStartDate,DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyy-MM-dd"),new_dists)//Èںϰ´·¢²¼Ê±¼äµ¼£¬¹ÀÖµ°´updatetimeµ¼³ö - } +// exportPgBigdataForsale(houseStartDate,DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyy-MM-dd"),new_dists)//Èںϰ´·¢²¼Ê±¼äµ¼£¬¹ÀÖµ°´updatetimeµ¼³ö +// } +// +// if(curDate.toString().endsWith("28")){ +// exportPgBigdataSupplierStatistics(curMonth) +// //ÒòΪÈÚºÏÔݲ»Çп⣬ËùÒÔÐèÒª¼Ó´«Ò»ÕŵÚÈý·½¾ù¼Û±íµ½ÈÚºÏÖУ¬ ´Ó1ÔÂ10ÈÕ¿ªÊ¼´«Ê䣬³¤ÆÚ¹© +// def thirdPartyMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); +//// exportThirdPartyPrice2(thirdPartyMonth, new_dists) +// exportPgThirdPartyPrice2(thirdPartyMonth, new_dists) +// exportPgCommunityBasePrice(curMonth) +// exportPgCommunityPdescribeGj(curMonth) +// exportPgBigdataModelingBase(curMonth) +// exportPgGuideStatistics(curMonth) +// } - if(curDate.toString().endsWith("28")){ - exportPgBigdataSupplierStatistics(curMonth) - //ÒòΪÈÚºÏÔݲ»Çп⣬ËùÒÔÐèÒª¼Ó´«Ò»ÕŵÚÈý·½¾ù¼Û±íµ½ÈÚºÏÖУ¬ ´Ó1ÔÂ10ÈÕ¿ªÊ¼´«Ê䣬³¤ÆÚ¹© - def thirdPartyMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); -// exportThirdPartyPrice2(thirdPartyMonth, new_dists) - exportPgThirdPartyPrice2(thirdPartyMonth, new_dists) - exportPgCommunityBasePrice(curMonth) - exportPgCommunityPdescribeGj(curMonth) - exportPgBigdataModelingBase(curMonth) - exportPgGuideStatistics(curMonth) - } - - SSHHelper jschCommand = new SSHHelper(); - System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}")); - - exportOk(curDate) +// SSHHelper jschCommand = new SSHHelper(); +// System.out.println(jschCommand.executeCommand("sh /home/ccb_rh/output/rh_package.sh ${curDate}")); +// +// exportOk(curDate) } // @@ -1184,15 +1184,15 @@ class ExportDistrictRongHe extends BaseBatch{ } def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28" - def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" + def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_COMM_BASE_PRICE_GJ_ADD_${curDate}_0001.dat" if(CommonDatautils.isWindow()){ - fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" + fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_COMM_BASE_PRICE_GJ_ADD_${curDate}_0001.dat" } def headers = [] FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false); - println "COMMUNITY_BASE_PRICE_GJNB Êý¾ÝÎļþÊä³öÍê³É......" + println "COMMUNITY_BASE_PRICE_GJ Êý¾ÝÎļþÊä³öÍê³É......" CcbFtpUtils.ftpUpload("rh", fileName, curDate) - println "COMMUNITY_BASE_PRICE_GJNB ÉÏ´«FtpÍê³É......" + println "COMMUNITY_BASE_PRICE_GJ ÉÏ´«FtpÍê³É......" } @@ -1273,9 +1273,9 @@ class ExportDistrictRongHe extends BaseBatch{ def exportPgCommunityPdescribeGj(month){ def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28" - def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat" + def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_COMM_DESCRIBE_GJ_ADD_${curDate}_0001.dat" if(CommonDatautils.isWindow()){ - fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat" + fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_COMM_DESCRIBE_GJ_ADD_${curDate}_0001.dat" } def headers = [] def allRows = [] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy index a57d7551b..db43ba788 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy @@ -29,10 +29,11 @@ class AddAvgpriceBatch { } def test(){ - def districts = CommonDatautils.findDistrictByCityAndRegions("¸£ÖÝ","district", ["Âíβ"], ["city","region","name", "estate_type2"]) + def districts = CommonDatautils.findAllDistricts("¸£ÖÝ","district", ["city","region","name", "estate_type2"]) +// def districts = CommonDatautils.findDistrictByCityAndRegions("¸£ÖÝ","district", ["Âíβ"], ["city","region","name", "estate_type2"]) for(def dist : districts){ //·¢ÖØËã¾ù¼ÛÃüÁî - addPrice(dist.city,dist.region,dist.name, dist.estate_type2, DateUtils.parseFromTightByPattern('2023-05-01','yyyy-MM-dd'),DateUtils.parseFromTightByPattern('2023-05-30','yyyy-MM-dd')) + addPrice(dist.city,dist.region,dist.name, dist.estate_type2, DateUtils.parseFromTightByPattern('2023-05-01','yyyy-MM-dd'),DateUtils.parseFromTightByPattern('2023-05-05','yyyy-MM-dd')) } } def run(){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy index a3236b53a..c84e8a3ed 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/FangjiaClientUtils.groovy @@ -164,7 +164,7 @@ class FangjiaClientUtils { // def json = HttpUtils.postForJson("http://192.168.0.100:38080/FangJiaDataService/saveData", jsonStr) // def json = HttpUtils.postForJson("http://localhost:8080/FangJiaDataService/saveData", jsonStr) - com.alibaba.fastjson.JSONObject json = HttpUtils.doPost2("http://192.168.0.100:38080/FangJiaDataService/saveData", jsonStr) + com.alibaba.fastjson.JSONObject json = HttpUtils.doPost2("http://localhost:8080/FangJiaDataService/saveData", jsonStr) if (json.status == 0) { return "³É¹¦" }else if(json.status == 1){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/OfficeFieldCleanBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/OfficeFieldCleanBatch.groovy index 9ec05ed28..7d5deda33 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/OfficeFieldCleanBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/OfficeFieldCleanBatch.groovy @@ -4,14 +4,23 @@ import com.fangjia.script.BaseBatch import com.fangjia.script.BatchOwner import com.fangjia.script.Watcher import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.common.DataHandleUtils import com.fangjia.script.gj.FiledStrand +import com.fangjia.script.looplineinfo.InsidePolygon +import com.fangjia.script.util.DbUtils import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.MongoUtils +import com.fangjia.script.util.OpenApiClient import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import org.bson.types.ObjectId +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.CountDownLatch import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicLong +import java.util.regex.Pattern /** * д×ÖÂ¥×Ö¶ÎÇåÏ´Èë¿â£¨×Ô¶¯Èë¿â£© @@ -19,6 +28,16 @@ import java.util.concurrent.Executors @BatchOwner(Watcher.GaoJuan) class OfficeFieldCleanBatch extends BaseBatch{ + def fieldsMap = ["estate_charge":"property_fee","block":"block","build_date":"build_year","estate_company":"property_company","developer":"developer", + "virescence_percent":"greening_rate","cubage_percent":"plot_ratio","build_area":"build_area","all_area":"land_area", + "car_site_count":"parking_cnt","car_site":"parking_cnt","property_life":"land_usage_period","address":"address", + "live_date":"live_date", "loop_line_info":"loop_line"]//key:seaweed±í×Ö¶Î value:es±í×Ö¶Î + + def sourceMap = ["·¿ÌìÏÂ":"·¿ÌìÏÂ","°ì°ìÍø":"°ì°ìÍø","µãµã×â":"µãµã×â","°²¾Ó¿Í":"°²¾Ó¿Í","Â¥ÅÌÍø":"Â¥ÅÌÍø"] + + static DBCollection BLOCKPOLYLINECOLL = MongoUtils.getCollectionByName("fangjia_crawl", "price_border2", "mongo.db.fangjia.com") + DBCollection OPERATION_LOG_COLL = MongoUtils.getCollectionByName("fangjia", "operation_log", "mongo.db.fangjia.com") + public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10) static main(args) { @@ -27,11 +46,13 @@ class OfficeFieldCleanBatch extends BaseBatch{ @Override void process(Object args) { - def citys = CommonDatautils.findAllCity().reverse() - for(def c : citys){ - def offices = findAllOffice(c) - strandField(offices) - } +// def citys = CommonDatautils.findAllCity().reverse() +// for(def c : citys){ +// def offices = findAllOffice(c) +// strandField(offices) +// } + + addBlock() } @@ -65,15 +86,351 @@ class OfficeFieldCleanBatch extends BaseBatch{ } - def findAllOffice(city){ - def sql = "select * from office where city='${city}'" - def rets = [] - ElasticUtils.executeSqlQuery(sql, { d-> - rets << d + def findEsDatas(c, esWebSource){ + def list = [] + ElasticUtils.executeSqlQuery("select * from community where city='${c}' and source='${esWebSource}'", {r-> + list << r }) - return rets + return list + } + + + def matchDist(city, region, name){ + def dist = CommonDatautils.findDistrict(city, region, name, "office") + return dist; + } + + def matchApi(esRets){ + def rets = new CopyOnWriteArrayList() + def totalCount = new AtomicLong() + final CountDownLatch latch = new CountDownLatch(esRets.size()) + for(def i=0;i=0.9){ + matchRets1 << r + } + } + return matchRets1 + } + + + def addFieldFromMatch(c, totalCount, analysRets){ + def fields = fieldsMap.keySet() as List + + sourceMap.each { seaweedmapSource, esWebSource -> + def esRets = findEsDatas(c, esWebSource) + def matchRets1 = matchApi(esRets) + def matchRets2 = selectRestByCredit(matchRets1) + println esWebSource +" ץȡÁ¿£º"+esRets.size()+" Æ¥ÅäÁ¿£º"+matchRets1.size()+" 0.9·ÖÒÔÉÏÁ¿£º"+matchRets2.size() + + def updateRets = processFieldsFromMatch(c , matchRets2) + println "¡¾Í¨¹ýÆ¥ÅäÌî³ä×ֶΡ¿ÍøÕ¾£º"+seaweedmapSource +" Es:"+esRets.size()+" ÈÚºÏÐ¡ÇøÕ¼±È£º"+ DataHandleUtils.getDoubleRound(2, matchRets2.size()*100/totalCount)+"%" + def precentMap = fieldUpdate(totalCount, updateRets) + println c +" "+precentMap.toString() + updateDB(c, updateRets) + println "------------------------------------------------------------------------------" + def pre1 = 0 + def pre2 = 0 + if(esRets){ + pre1 = DataHandleUtils.getDoubleRound(2, matchRets1.size()*100/esRets.size()) + pre2 = DataHandleUtils.getDoubleRound(2, matchRets2.size()*100/esRets.size()) + } + def analyRet = [] + analyRet << seaweedmapSource + analyRet << c + fields.each{key-> + analyRet << precentMap.get(key) + } + analyRet << esRets.size() + analyRet << matchRets1.size() + analyRet << matchRets2.size() + analyRet << pre1 + analyRet << pre2 + analysRets << analyRet + } + return analysRets; + } + + def fieldUpdate(total,updateRets){ + + def countMap = [:] + + for(def rm : updateRets){ + def valMap = rm.value + fieldsMap.each{seaweedfield,esField-> + if(valMap.containsKey(seaweedfield)) { + if(countMap.containsKey(seaweedfield)) { + countMap.put(seaweedfield, countMap.get(seaweedfield) + 1) + }else{ + countMap.put(seaweedfield, 1) + } + } + } + } + + println countMap.toString() + def precentMap = [:] + fieldsMap.each() {key,skey-> + if(countMap.containsKey(key)) { + precentMap.put(key, DataHandleUtils.getDoubleRound(2, countMap.get(key)*100/total)) + }else { + precentMap.put(key, 0) + } + } + return precentMap; + } + + + def processFieldsFromMatch(c,matchRets){ + def fields = fieldsMap.keySet() as List + fields << "city" + fields << "estate_type2" + def fieldValueMap = [:] + for(def matchDist : matchRets){ + def dist = CommonDatautils.findDistrictFieldById(matchDist.match_id, fields) + if(!dist){ + println c+" "+matchDist.match_id+" ²»´æÔÚ" + continue + } + def newValues = strandField(c, dist, matchDist) + if(newValues){ + println dist._id.toString()+" "+newValues.toString() + fieldValueMap.put(dist._id.toString(), newValues) + } + } + + return fieldValueMap; + } + + def strandField(c,dist, matchDist){ + def newValues = [:] + fieldsMap.each{seaweedfield,esField-> + def val = dist.get(seaweedfield) + if(!val){ + def esVal = matchDist.get(esField) + if(esVal){ + def newVal = null + if(seaweedfield == "estate_charge"){ + newVal = FiledStrand.processEstateCharge(c, FiledStrand.getNumber(esVal), dist.estate_type2) + newVal = newVal.toString() + } + if(seaweedfield == "build_date" || seaweedfield == "live_date"){ + newVal = FiledStrand.processFinishBuildingDate(esVal) + } + if(seaweedfield == "estate_company" || seaweedfield == "developer"){ + newVal = FiledStrand.processCompany(esVal) + } + if(seaweedfield =="virescence_percent"){ + newVal = FiledStrand.processVirescencePercent(esVal) + } + + if(seaweedfield =="cubage_percent"){ + newVal = FiledStrand.processCubagePercent(esVal) + } + + if(seaweedfield =="all_area" || seaweedfield =="build_area"){ + newVal = FiledStrand.processArea(esVal) + if(newVal){ + newVal = newVal.toString() + } + } + if(seaweedfield =="household_count"){ + newVal = FiledStrand.processHouseholdCount(esVal, dist.estate_type2) + } + + if(seaweedfield =="loudong_count"){ + newVal = FiledStrand.processLoudongCount(esVal) + } + + if(seaweedfield =="car_site_count"){ + newVal = FiledStrand.processCarSite(esVal) + } + if(seaweedfield =="car_site"){ + newVal = FiledStrand.processCarSiteDesc(esVal) + } + + if(seaweedfield =="property_life"){ + newVal = FiledStrand.processPropertyLife(esVal) + } + + if(seaweedfield =="alias"){ + newVal = FiledStrand.processAlias(esVal, dist.name, dist.alias) + } + + if(seaweedfield =="address"){ + newVal = FiledStrand.processAddress(esVal, dist.city) + } + if(seaweedfield =="block"){ + newVal = FiledStrand.processBlock(dist.city, dist.region, esVal) + } + + if(seaweedfield == "build_type"){ + newVal = FiledStrand.processBuildType(esVal, dist.estate_type2) + } + + if(seaweedfield == "land_property"){ + newVal = FiledStrand.processlandProperty(esVal) + } + + if(seaweedfield == "build_structure"){ + newVal = FiledStrand.processBuildStructure(esVal) + } + + if(newVal){ + newValues.put(seaweedfield, newVal) + } + } + } + } + return newValues; + } + + def addBlock(){ + def rets = findAllBlockRange() + + def offices = CommonDatautils.findAllDistricts("ÉϺ£", "office", ["city","region","name","block","lat2", "lng2"]) + for(def i=0;i<=offices.size();i++){ + final def office = offices[i] + if(office && !office.block){ + fixedThreadPool.execute(new Runnable() { + void run() { + + def lastObj = null + for (def r : rets) { + def flag = InsidePolygon.isInArea(office.lng2 / 10000000000.0, office.lat2 / 10000000000.0, r.points) + if (flag) { + lastObj = r; + break; + } + } + if (lastObj) { + def udata = [:] + udata.put("block", lastObj.name) + udata.put("status", "0") + udata.put("cat", "office") + udata.put("username", "¸ß¾ê") + udata.put("id", office._id.toString()) + def s = FangjiaClientUtils.saveOrUpdateDistrict(udata) + println s + } + } + }); + } + } + } + + def findAllBlockRange(){ + def rets = [] + def q = new BasicDBObject() + def dbcursor = BLOCKPOLYLINECOLL.find(q) + for(def d : dbcursor) { + def pointList = InsidePolygon.createPoint3(d.border); + d.points = pointList + rets << d + } + return rets; + } + + def saveOptLog(city, region, name, datas){ + def obj = new BasicDBObject(); + obj.put("city",city); + obj.put("region",region); + obj.put("district_name",name); + obj.put("category","office"); + obj.put("c_date", new Date()) + obj.put("m_date", new Date()) + obj.put("type", "update") + obj.put("data", datas) + obj.put("user_name", "¸ß¾ê") + obj.put("origin", "script") + OPERATION_LOG_COLL.save(obj) } + }