From 3305cc5228f38586b5267a9bf49ab000e567521a Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 12 Sep 2024 10:06:53 +0800 Subject: [PATCH 001/115] update --- .../com/fangjia/script/gj/data_handle/MinglujiData.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy index ae1400128..5fefd22f6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/MinglujiData.groovy @@ -214,9 +214,10 @@ class MinglujiData { fileName = "D:\\数据\\数据建设\\名录集\\${city}_${i}.xlsx" } + println "开始读取:"+fileName File file = new File(fileName); if (file.exists()) { - ExcelUtils.modify(fileName,{d-> + ExcelUtils.multiThreadingModify(fileName,{d-> if(d['E'] && !d['Z']){ def jsonObject1 = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['E']) if(jsonObject1) { From 602b29a6b4fe90d77a598f9a12baad2e0c2b36be Mon Sep 17 00:00:00 2001 From: majintao Date: Thu, 12 Sep 2024 18:13:11 +0800 Subject: [PATCH 002/115] =?UTF-8?q?=E6=96=B0=E5=A2=9EAPI=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=95=B0=E9=87=8F=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/UsersController.java | 258 ++++++++ .../com/fangjia/open/model/ApiUserModel.java | 620 ++++++++++++++++++ 2 files changed, 878 insertions(+) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java index 951c354b3..a56938da9 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java @@ -4,22 +4,29 @@ import java.util.*; import com.fangjia.core.util.AnalyticsUtil; import com.fangjia.core.util.BeanUtils; +import com.fangjia.core.util.DataUtil; import com.fangjia.core.util.DateUtil; import com.fangjia.dal.QueryParam; +import com.fangjia.dal.mongo.model.ApiInvokeStatistical; import com.fangjia.dal.mongo.model.SendSmsLog; import com.fangjia.dal.mongo.open.model.ApiUserAuthority; import com.fangjia.dal.mongo.open.model.OpenResource; +import com.fangjia.dal.mongo.tool.model.ApiVisitCount; import com.fangjia.dal.mongo.tool.model.OpenUriAnaly; +import com.fangjia.dal.sql.model.ApiUser; import com.fangjia.open.HttpStatusCodeEnum; import com.fangjia.open.interceptors.AuthenticationBean; import com.fangjia.open.model.*; import com.fangjia.open.model.weixin.SendCodeJsonModel; import com.fangjia.open.model.weixin.SendCodeModel; +import com.fangjia.service.mongo.bkoff.ApiInvokeStatisticalService; import com.fangjia.service.open.*; +import com.fangjia.service.sql.ApiUserService; import net.sf.json.JSONObject; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.StringUtils; +import org.json.JSONArray; import org.sothis.web.mvc.ActionContext; import org.sothis.web.mvc.ActionInvocation; import org.sothis.web.mvc.annotation.Param; @@ -41,6 +48,8 @@ public class UsersController { private ApiUserAuthorityService apiUserAuthorityService; private OpenResourceService openResourceService; private OpenUriAnalyService openUriAnalyService; + private ApiUserService apiUserService; + private ApiInvokeStatisticalService apiInvokeStatisticalService; /** @@ -177,6 +186,247 @@ public class UsersController { return mav; } + public Object callDetailAction(ApiUserModel model) throws IllegalAccessException { + RestfulModelAndView mav = new RestfulModelAndView(); + Date startDate = null; + Date endDate = null; + if (StringUtils.isNotBlank(model.getBegDateStr())) { + startDate = DateUtil.parseStringToDate(model.getBegDateStr()); + } + if (StringUtils.isNotBlank(model.getEndDateStr())) { + endDate = DateUtil.parseStringToDate(model.getEndDateStr()); + } + List analys = openUriAnalyService.findOpenUriAnalyLogs(model.getUserId(), model.getUri(), startDate, endDate); + List bos = null; + model.setQuery("uri"); + + Long userId = model.getUserId(); + ApiUserAuthority authority = apiUserAuthorityService.findByUserId(userId); + Map countMap = authority.getTotalCountMap(); + ApiUser apiUser = apiUserService.findApiUserById(userId); + User user = userService.findById(userId); + if (user != null) { + model.setUserName(user.getDisplayName()); + } + + if (model.getQuery().equals("uri")) { + bos = createAnalyBosByLink(analys); + model.setChartSeries(toChartString(bos)); + } + + long date = DateUtil.parseStringToDate("2016-11-23").getTime(); + if ("uri".equals(model.getQuery()) && startDate.getTime() >= date && endDate.getTime() > date) { + List apiInvokeStatisticalList = apiInvokeStatisticalService.findApiInvokeStatisticalList(model.getUserId(), startDate, endDate); + if (bos != null && apiInvokeStatisticalList.size() > 0) { + Map> resultMap = getCountByUri(apiInvokeStatisticalList); + for (StatAnalyBo boTemp : bos) { + String url = boTemp.getKey(); + boTemp.setSuccessEffectiveTime(resultMap.get(url).get("successEffectiveCount")); + boTemp.setSuccessInvalidTime(resultMap.get(url).get("successInvalidCount")); + boTemp.setDefeatTime(resultMap.get(url).get("defeatCount")); + if (apiUser != null) { + boTemp.setDeadline(apiUser.getDeadTime()); + } + long curVistedCount = apiVisitCountService.findApiVisitCountByDay(userId, url, DateUtil.truncateDay(new Date())); + long historyCount = apiVisitCountService.findApiVisitAllCount(userId, url, DateUtil.truncateDay(new Date())); + if (countMap != null && countMap.containsKey(url)) { + Integer totalCount = countMap.get(url); + long usedCount = curVistedCount + historyCount; + boTemp.setSurplusCallCount(Integer.valueOf((int) (totalCount - usedCount))); + } + } + } + } + List resources = openResourceService.findOpenResource(null); + Map urlMap = converMapData(resources); + for (StatAnalyBo boTemp : bos) { + List apiVisitCounts = apiVisitCountService.findAllApiVisitCount(model.getUserId(), boTemp.getKey(), startDate, endDate); + int total = 0; + for (ApiVisitCount apiVisitCount : apiVisitCounts) { + total += apiVisitCount.getVisitCount(); + } + boTemp.setBillingCount(total); + boTemp.setUrlName(urlMap.get(boTemp.getKey())); + boTemp.setUrl(boTemp.getKey()); + boTemp.setKey(null); + } + +// model.setResourceMap(converMapData(resources)); + model.setStatAnalyBoList(sortStatAnaly(bos)); + BasicModel basicModel = new BasicModel(200, "ok"); + basicModel.setResult(model); + mav.setModel(basicModel); + return mav; + } + + private List createAnalyBosByLink(List analys) { + + + Map ret = new HashMap(); + Map> urlCodeMap = new HashMap>(); + int total = 0; + for (OpenUriAnaly openUriAnaly : analys) { + Integer temp = ret.get(openUriAnaly.getUrl()); + if (temp == null) { + ret.put(openUriAnaly.getUrl(), openUriAnaly.getUrlClickCount()); + } else { + ret.put(openUriAnaly.getUrl(), temp + openUriAnaly.getUrlClickCount()); + } + Map codeMap = urlCodeMap.get(openUriAnaly.getUrl()); + if (codeMap == null) { + codeMap = new HashMap(); + urlCodeMap.put(openUriAnaly.getUrl(), codeMap); + } + Map analyCodeMap = openUriAnaly.getCodeMap(); + for (String code : analyCodeMap.keySet()) { + Integer count = (Integer) analyCodeMap.get(code); + if ("200".equals(code)) { + Integer successCount = codeMap.get("successCount"); + if (successCount == null) { + codeMap.put("successCount", count); + } else { + codeMap.put("successCount", successCount + count); + } + } else { + Integer defeatCount = codeMap.get("defeatCount"); + if (defeatCount == null) { + codeMap.put("defeatCount", count); + } else { + codeMap.put("defeatCount", defeatCount + count); + } + } + } + total = total + openUriAnaly.getUrlClickCount(); + } + + List bos = new ArrayList(); + int index = 0; + double totalPercent = 0; + for (String url : ret.keySet()) { + Integer count = ret.get(url); + double percent = 0; + if (index + 1 == ret.size()) { + percent = 100 - totalPercent; + } else { + double a1 = count; + double val = a1 * 10000 / (double) total; + percent = DataUtil.roundDouble(val / 100, 2); + totalPercent = totalPercent + percent; + } + StatAnalyBo bo = new StatAnalyBo(); + bo.setKey(url); + bo.setCount(count); + bo.setPercent(percent); + Map codeMap = urlCodeMap.get(url); + bo.setSuccessTime(codeMap.get("successCount")); + bo.setDefeatTime(codeMap.get("defeatCount")); + if (codeMap.get("successCount") != null) { + bo.setSuccessRate(DataUtil.roundDouble((codeMap.get("successCount") * 100) / (double) count, 2)); + } + bos.add(bo); + + } + return bos; + } + + private List sortStatAnaly(List bos) { + Collections.sort(bos, new Comparator() { + @Override + public int compare(StatAnalyBo o1, StatAnalyBo o2) { + if (o1.getCount() > o2.getCount()) { + return -1; + } else if (o1.getCount() < o2.getCount()) { + return 1; + } + return 0; + } + }); + + return bos; + } + + private Map converMapData(List resources) { + Map map = new HashMap(); + for (OpenResource resource : resources) { + map.put(resource.getUri(), resource.getName()); + } + return map; + } + + + private Map> getCountByUri(List apiInvokeStatisticalList) { + Map> resultMap = new HashMap>(); + for (ApiInvokeStatistical apiInvokeStatistical : apiInvokeStatisticalList) { + Map detailMap = resultMap.get(apiInvokeStatistical.getRequestURI()); + if (detailMap == null) { + detailMap = new HashMap(); + resultMap.put(apiInvokeStatistical.getRequestURI(), detailMap); + } + Integer successEffectiveCount = detailMap.get("successEffectiveCount"); + Integer successInvalidCount = detailMap.get("successInvalidCount"); + Integer defeatCount = detailMap.get("defeatCount"); + Integer totalCount = detailMap.get("totalCount"); + if (successEffectiveCount != null) { + successEffectiveCount = successEffectiveCount + apiInvokeStatistical.getSuccessEffectiveTime(); + } else { + successEffectiveCount = apiInvokeStatistical.getSuccessEffectiveTime(); + } + if (successInvalidCount != null) { + successInvalidCount = successInvalidCount + apiInvokeStatistical.getSuccessInvalidTime(); + } else { + successInvalidCount = apiInvokeStatistical.getSuccessInvalidTime(); + ; + } + if (defeatCount != null) { + defeatCount = defeatCount + apiInvokeStatistical.getDefeatTime(); + } else { + defeatCount = apiInvokeStatistical.getDefeatTime(); + } + if (totalCount != null) { + totalCount = totalCount + apiInvokeStatistical.getTotalTime(); + } else { + totalCount = apiInvokeStatistical.getTotalTime(); + } + + detailMap.put("successEffectiveCount", successEffectiveCount); + detailMap.put("successInvalidCount", successInvalidCount); + detailMap.put("defeatCount", defeatCount); + detailMap.put("totalCount", totalCount); + } + + return resultMap; + } + + private String toChartString(List bos) { + JSONArray ja = new JSONArray(); + for (StatAnalyBo bo : bos) { + JSONArray array = new JSONArray(); + if (StringUtils.isNotBlank(bo.getKey())) { + if (bo.getKey().equals("level_0")) { + array.put("0s"); + } else if (bo.getKey().equals("level_1")) { + array.put("1s以下"); + } else if (bo.getKey().equals("level_2")) { + array.put("1-2s以下"); + } else if (bo.getKey().equals("level_3")) { + array.put("2-3s以下"); + } else if (bo.getKey().equals("level_4")) { + array.put("3s以上"); + } else if (bo.getKey().equals("level_100")) { + array.put("暂无数据"); + } else { + array.put(bo.getKey()); + } + } else { + array.put(bo.getUserId()); + } + + array.put(bo.getPercent()); + ja.put(array); + } + return ja.toString(); + } + public void setUserService(UserService userService) { this.userService = userService; } @@ -200,4 +450,12 @@ public class UsersController { public void setOpenUriAnalyService(OpenUriAnalyService openUriAnalyService) { this.openUriAnalyService = openUriAnalyService; } + + public void setApiUserService(ApiUserService apiUserService) { + this.apiUserService = apiUserService; + } + + public void setApiInvokeStatisticalService(ApiInvokeStatisticalService apiInvokeStatisticalService) { + this.apiInvokeStatisticalService = apiInvokeStatisticalService; + } } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/ApiUserModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/ApiUserModel.java index 22540ffea..a3c228c25 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/ApiUserModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/ApiUserModel.java @@ -1,6 +1,12 @@ package com.fangjia.open.model; +import com.fangjia.dal.mongo.model.ApiInvokeStatistical; +import com.fangjia.dal.mongo.open.model.ApiUserAuthority; +import com.fangjia.service.open.*; + import java.util.Date; +import java.util.List; +import java.util.Map; /** * API用户管理Model @@ -12,6 +18,620 @@ public class ApiUserModel extends FangjiaApiModel{ private Date endDate; private String uri; + private static final long serialVersionUID = 7044341510628330454L; + + private String begDateStr;// 查询开始日期 + private String endDateStr;// 查询结束日期 + private String statDate; + private String appKey; + private String userName; + private String displayName; + private String siteName; + private String password; + private String email; + private String ip; + private Integer isTest; + private Integer purpose; + private String msg; + private Long userId; + private String company; + private List apiUserBoList; + private List eachCityBoList; + private String limitCountMap; + private String totalCountMap; + private Integer creditLevelStatus; + private String priceType; + private Map priceRatingMap; + private Integer isMonitor; + + private String contact; + + private String phone; + + public String getPriceType() { + return priceType; + } + + public void setPriceType(String priceType) { + this.priceType = priceType; + } + + public List getEachCityBoList() { + return eachCityBoList; + } + + public void setEachCityBoList(List eachCityBoList) { + this.eachCityBoList = eachCityBoList; + } + + private Integer sum; + private Integer limit; + /*** 权限控制相关 **/ + private ApiUserBo apiUserBo; + private List authorityList; + private ApiUserAuthority authority; + private List authorityBoList; + //private List serverAreaList; + private List> serverAreaList; + private String openCitys;// 汉字说明 + private List cityFirstLetters;// 城市拼音首字母 + private String type; + private String citys;// spell + private String unCheckCitys;// 页面反选的city + private Integer status; + private boolean hasAuth; + private boolean supportLatLng; + private Integer maxFrequency; + private String frequencyPeriod; + private Integer maximum; + + private ApiInvokeStatistical apiInvokeStatistical; + private Double one; + private Double newOne; + private Double two; + private Double three; + private Double four; + private Double five; + private Date deadTime; + private String manager; + private Double evaluateRate; + + private String data; + + private Integer isCheckCount; + + private String openResourseUrisMap; + + public String getOpenResourseUrisMap() { + return openResourseUrisMap; + } + + public void setOpenResourseUrisMap(String openResourseUrisMap) { + this.openResourseUrisMap = openResourseUrisMap; + } + + public Integer getIsCheckCount() { + return isCheckCount; + } + + public void setIsCheckCount(Integer isCheckCount) { + this.isCheckCount = isCheckCount; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public String getDisplayName() { + return displayName; + } + + private String chartSeries; + + private List OpenUriAnalyBoList; + private List statAnalyBoList; + private Integer way; + private Map resourceMap; + private String query; + private Integer totalCount; + private String xAxis; + private String credits; + private String uncitys; + + public String getUncitys() { + return uncitys; + } + + public void setUncitys(String uncitys) { + this.uncitys = uncitys; + } + + public String getCredits() { + return credits; + } + + public void setCredits(String credits) { + this.credits = credits; + } + + public String getxAxis() { + return xAxis; + } + + public void setxAxis(String xAxis) { + this.xAxis = xAxis; + } + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getSiteName() { + return siteName; + } + + public void setSiteName(String siteName) { + this.siteName = siteName; + } + + public String getAppKey() { + return appKey; + } + + public void setAppKey(String appKey) { + this.appKey = appKey; + } + + public String getBegDateStr() { + return begDateStr; + } + + public void setBegDateStr(String begDateStr) { + this.begDateStr = begDateStr; + } + + public String getEndDateStr() { + return endDateStr; + } + + public void setEndDateStr(String endDateStr) { + this.endDateStr = endDateStr; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public List getApiUserBoList() { + return apiUserBoList; + } + + public void setApiUserBoList(List apiUserBoList) { + this.apiUserBoList = apiUserBoList; + } + + public ApiUserBo getApiUserBo() { + return apiUserBo; + } + + public void setApiUserBo(ApiUserBo apiUserBo) { + this.apiUserBo = apiUserBo; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public List getAuthorityList() { + return authorityList; + } + + public void setAuthorityList(List authorityList) { + this.authorityList = authorityList; + } + + public ApiUserAuthority getAuthority() { + return authority; + } + + public void setAuthority(ApiUserAuthority authority) { + this.authority = authority; + } + + + public boolean isHasAuth() { + return hasAuth; + } + + public void setHasAuth(boolean hasAuth) { + this.hasAuth = hasAuth; + } + + public boolean isSupportLatLng() { + return supportLatLng; + } + + public void setSupportLatLng(boolean supportLatLng) { + this.supportLatLng = supportLatLng; + } + + public List getAuthorityBoList() { + return authorityBoList; + } + + public void setAuthorityBoList(List authorityBoList) { + this.authorityBoList = authorityBoList; + } + + public List getCityFirstLetters() { + return cityFirstLetters; + } + + public void setCityFirstLetters(List cityFirstLetters) { + this.cityFirstLetters = cityFirstLetters; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /*public List getServerAreaList() { + return serverAreaList; + } + + public void setServerAreaList(List serverAreaList) { + this.serverAreaList = serverAreaList; + }*/ + public List> getServerAreaList() { + return serverAreaList; + } + + public void setServerAreaList(List> serverAreaList) { + this.serverAreaList = serverAreaList; + } + + public String getCitys() { + return citys; + } + + public void setCitys(String citys) { + this.citys = citys; + } + + public String getOpenCitys() { + return openCitys; + } + + public void setOpenCitys(String openCitys) { + this.openCitys = openCitys; + } + + public String getUnCheckCitys() { + return unCheckCitys; + } + + public void setUnCheckCitys(String unCheckCitys) { + this.unCheckCitys = unCheckCitys; + } + + public Integer getSum() { + return sum; + } + + public void setSum(Integer sum) { + this.sum = sum; + } + + + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public Integer getMaximum() { + return maximum; + } + + public void setMaximum(Integer maximum) { + this.maximum = maximum; + } + + public String getFrequencyPeriod() { + return frequencyPeriod; + } + + public void setFrequencyPeriod(String frequencyPeriod) { + this.frequencyPeriod = frequencyPeriod; + } + + public Integer getMaxFrequency() { + return maxFrequency; + } + + public void setMaxFrequency(Integer maxFrequency) { + this.maxFrequency = maxFrequency; + } + public List getOpenUriAnalyBoList() { + return OpenUriAnalyBoList; + } + + public void setOpenUriAnalyBoList(List openUriAnalyBoList) { + OpenUriAnalyBoList = openUriAnalyBoList; + } + + public String getChartSeries() { + return chartSeries; + } + + public void setChartSeries(String chartSeries) { + this.chartSeries = chartSeries; + } + + public String getStatDate() { + return statDate; + } + + public void setStatDate(String statDate) { + this.statDate = statDate; + } + + public Integer getWay() { + return way; + } + + public void setWay(Integer way) { + this.way = way; + } + + public Map getResourceMap() { + return resourceMap; + } + + public void setResourceMap(Map resourceMap) { + this.resourceMap = resourceMap; + } + + public List getStatAnalyBoList() { + return statAnalyBoList; + } + + public void setStatAnalyBoList(List statAnalyBoList) { + this.statAnalyBoList = statAnalyBoList; + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public ApiInvokeStatistical getApiInvokeStatistical() { + return apiInvokeStatistical; + } + + public void setApiInvokeStatistical(ApiInvokeStatistical apiInvokeStatistical) { + this.apiInvokeStatistical = apiInvokeStatistical; + } + public Double getEvaluateRate() { + return evaluateRate; + } + + public void setEvaluateRate(Double evaluateRate) { + this.evaluateRate = evaluateRate; + } + + public Integer getIsTest() { + return isTest; + } + + public void setIsTest(Integer isTest) { + this.isTest = isTest; + } + + public String getLimitCountMap() { + return limitCountMap; + } + + public void setLimitCountMap(String limitCountMap) { + this.limitCountMap = limitCountMap; + } + + public String getTotalCountMap() { + return totalCountMap; + } + + public void setTotalCountMap(String totalCountMap) { + this.totalCountMap = totalCountMap; + } + + public Integer getPurpose() { + return purpose; + } + + public void setPurpose(Integer purpose) { + this.purpose = purpose; + } + + public Map getPriceRatingMap() { + return priceRatingMap; + } + + public void setPriceRatingMap(Map priceRatingMap) { + this.priceRatingMap = priceRatingMap; + } + + public Double getOne() { + return one; + } + + public void setOne(Double one) { + this.one = one; + } + + public Double getNewOne() { + return newOne; + } + + public void setNewOne(Double newOne) { + this.newOne = newOne; + } + + public Double getTwo() { + return two; + } + + public void setTwo(Double two) { + this.two = two; + } + + public Double getThree() { + return three; + } + + public void setThree(Double three) { + this.three = three; + } + + public Double getFour() { + return four; + } + + public void setFour(Double four) { + this.four = four; + } + + public Double getFive() { + return five; + } + + public void setFive(Double five) { + this.five = five; + } + + public Integer getCreditLevelStatus() { + return creditLevelStatus; + } + + public void setCreditLevelStatus(Integer creditLevelStatus) { + this.creditLevelStatus = creditLevelStatus; + } + + public Date getDeadTime() { + return deadTime; + } + + public void setDeadTime(Date deadTime) { + this.deadTime = deadTime; + } + + public String getManager() { + return manager; + } + + public void setManager(String manager) { + this.manager = manager; + } + + public Integer getIsMonitor() { + return isMonitor; + } + + public void setIsMonitor(Integer isMonitor) { + this.isMonitor = isMonitor; + } + + public String getContact() { + return contact; + } + + public void setContact(String contact) { + this.contact = contact; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + public Date getStartDate() { return startDate; } From b363320ccba255110a065a718d7c66709f070fd4 Mon Sep 17 00:00:00 2001 From: majintao Date: Fri, 13 Sep 2024 09:52:46 +0800 Subject: [PATCH 003/115] =?UTF-8?q?API=E8=B0=83=E7=94=A8=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E6=A0=B9=E6=8D=AEuserID=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/UsersController.java | 88 ++++++++++--------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java index a56938da9..dff7d888b 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/UsersController.java @@ -134,55 +134,61 @@ public class UsersController { return json.toString(); } - public Object surplusCallCountAction() throws IllegalAccessException { + public Object surplusCallCountAction(ApiUserModel model) throws IllegalAccessException { RestfulModelAndView mav = new RestfulModelAndView(); ActionContext context = ActionContext.getContext(); HttpServletRequest request = context.getRequest(); AuthenticationBean instance = (AuthenticationBean) request.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN); + User user = null; + if (model.getUserId() != null && model.getUserId() > 0) { + user = userService.findById(model.getUserId()); + } if (null != instance) { - User user = instance.user; - List openResourceList = openResourceService.findAll(); - List list = new ArrayList(); - long id = user.getId(); - ApiUserAuthority authority = apiUserAuthorityService.findByUserId(id); - if (null != authority) { - // 用户有的uri - List userResources = new ArrayList(); - for (OpenResource openResource : openResourceList) { - if (authority.getOpenResourseUris().contains(openResource.getUri())) { - userResources.add(openResource); - } - } - Map countMap = authority.getTotalCountMap(); - if (null != countMap) { - // 改成遍历用户有的uri - for (OpenResource openResource : userResources) { - String uri = openResource.getUri(); - ApiMonitorInfo info = new ApiMonitorInfo(); - info.setApiUri(uri); - info.setApiName(openResource.getName()); - info.setUserId((int) id); - info.setUsername(user.getUserName()); - if (null != countMap.get(uri) && countMap.get(uri) > 0) { - long curVistedCount = apiVisitCountService.findApiVisitCountByDay(id, uri, DateUtil.truncateDay(new Date())); - long historyCount = apiVisitCountService.findApiVisitAllCount(id, uri, DateUtil.truncateDay(new Date())); - Integer totalCount = countMap.get(uri); - info.setTotalCallCount(Long.valueOf(totalCount)); - long usedCount = curVistedCount + historyCount; - info.setSurplusCallCount(totalCount - usedCount); - info.setUsedCallCount(usedCount); - } - list.add(info); - - } + user = instance.user; + } + if (null == instance && user == null) { + mav.setModel(new BasicModel(HttpStatusCodeEnum.BAD_REQUEST_ERROR_KEY)); + return mav; + } + List openResourceList = openResourceService.findAll(); + List list = new ArrayList(); + long id = user.getId(); + ApiUserAuthority authority = apiUserAuthorityService.findByUserId(id); + if (null != authority) { + // 用户有的uri + List userResources = new ArrayList(); + for (OpenResource openResource : openResourceList) { + if (authority.getOpenResourseUris().contains(openResource.getUri())) { + userResources.add(openResource); + } + } + Map countMap = authority.getTotalCountMap(); + if (null != countMap) { + // 改成遍历用户有的uri + for (OpenResource openResource : userResources) { + String uri = openResource.getUri(); + ApiMonitorInfo info = new ApiMonitorInfo(); + info.setApiUri(uri); + info.setApiName(openResource.getName()); + info.setUserId((int) id); + info.setUsername(user.getUserName()); + if (null != countMap.get(uri) && countMap.get(uri) > 0) { + long curVistedCount = apiVisitCountService.findApiVisitCountByDay(id, uri, DateUtil.truncateDay(new Date())); + long historyCount = apiVisitCountService.findApiVisitAllCount(id, uri, DateUtil.truncateDay(new Date())); + Integer totalCount = countMap.get(uri); + info.setTotalCallCount(Long.valueOf(totalCount)); + long usedCount = curVistedCount + historyCount; + info.setSurplusCallCount(totalCount - usedCount); + info.setUsedCallCount(usedCount); + } + list.add(info); + } } - BasicModel basicModel = new BasicModel(200, "ok"); - basicModel.setResult(list); - mav.setModel(basicModel); - } else { - mav.setModel(new BasicModel(HttpStatusCodeEnum.BAD_REQUEST_ERROR_KEY)); } + BasicModel basicModel = new BasicModel(200, "ok"); + basicModel.setResult(list); + mav.setModel(basicModel); return mav; } From 9ce61bc2fa42e2be78cef25097cd1fd5225a2431 Mon Sep 17 00:00:00 2001 From: majintao Date: Fri, 13 Sep 2024 10:24:54 +0800 Subject: [PATCH 004/115] =?UTF-8?q?API=E8=B0=83=E7=94=A8=E9=87=8F=E4=B8=BA?= =?UTF-8?q?0=E6=97=B6=E4=B8=BA=E6=97=A0=E9=99=90=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/bkoff/controllers/ApiUserController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 3f67b111c..fab71c646 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 @@ -647,7 +647,6 @@ public class ApiUserController { AuthorityBo bo = new AuthorityBo(); BeanUtils.copyProperties(openResource, bo); if (authority != null) { - bo.setHasAuth(authority.getOpenResourseUris().contains(bo.getUri())); bo.setHasAuth(authority.getOpenResourseUris().contains(bo.getUri())); model.setSupportLatLng(authority.isSupportLatLng()); bo.setLimitCountMap(authority.getLimitCountMap()); @@ -760,7 +759,9 @@ public class ApiUserController { apiCountLogService.save(apiCountLog); } } - totalCountMap.put(model.getUri(), count); + if (count == 0) { + totalCountMap.remove(model.getUri()); + } authority.setTotalCountMap(totalCountMap); } if (model.getIsCheckCount() != null) { From 2ad357c18099a2819458c42665708e27437e2ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Sat, 14 Sep 2024 16:54:27 +0800 Subject: [PATCH 005/115] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=92=89=E9=92=89?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/exceptionhander/FangjiaOpenExceptionHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/exceptionhander/FangjiaOpenExceptionHandler.java b/projects/fangjia-open/src/main/java/com/fangjia/open/exceptionhander/FangjiaOpenExceptionHandler.java index 8701acb19..35fdcb285 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/exceptionhander/FangjiaOpenExceptionHandler.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/exceptionhander/FangjiaOpenExceptionHandler.java @@ -4,6 +4,7 @@ import java.io.IOException; import javax.servlet.ServletException; +import com.fangjia.core.util.DingDingMessageUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sothis.web.mvc.ActionContext; @@ -16,6 +17,8 @@ public class FangjiaOpenExceptionHandler implements ExceptionHandler { if (LOGGER.isErrorEnabled()) { LOGGER.error("", e); } + String token = "2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c"; + DingDingMessageUtil.sendTextMessage(token, "[OpenApi]服务器内部错误,请及时关注!"); ActionContext context = ActionContext.getContext(); context.getResponse().setStatus(500); context.getResponse().setCharacterEncoding("UTF-8"); From b336a7bda437ea71cb79d2bc2046cda70b2b698b Mon Sep 17 00:00:00 2001 From: majintao Date: Wed, 18 Sep 2024 11:29:50 +0800 Subject: [PATCH 006/115] =?UTF-8?q?API=E6=B7=BB=E5=8A=A0=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E7=94=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bkoff/controllers/ApiUserController.java | 13 +++++++- .../com/fangjia/bkoff/model/ApiUserModel.java | 30 +++++++++++++++++ .../src/main/webapp/apiUser/add.ftl | 25 ++++++++++++-- .../src/main/webapp/apiUser/edit.ftl | 21 ++++++++++++ .../com/fangjia/dal/sql/model/ApiUser.java | 33 +++++++++++++++++++ .../com/fangjia/service/open/ApiUserBo.java | 30 +++++++++++++++++ 6 files changed, 149 insertions(+), 3 deletions(-) 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 fab71c646..4f2379d4b 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 @@ -133,7 +133,9 @@ public class ApiUserController { bo.setDeadTime(apiUser.getDeadTime()); bo.setManager(apiUser.getManager()); bo.setIsMonitor(apiUser.getIsMonitor()); - + bo.setIsMonitorStatistic(apiUser.getIsMonitorStatistic()); + bo.setIsMonitorUsed(apiUser.getIsMonitorUsed()); + bo.setIsWarnExpired(apiUser.getIsWarnExpired()); apiUserBoList.add(bo); } @@ -217,6 +219,9 @@ public class ApiUserController { apiUser.setIsMonitor(model.getIsMonitor()); apiUser.setContact(model.getContact()); apiUser.setPhone(model.getPhone()); + apiUser.setIsMonitorStatistic(model.getIsMonitorStatistic()); + apiUser.setIsMonitorUsed(model.getIsMonitorUsed()); + apiUser.setIsWarnExpired(model.getIsWarnExpired()); this.apiUserService.save(apiUser); // 新增用户,默认挂牌价改为默认评估价 model.setPriceType("evaluate"); @@ -253,6 +258,9 @@ public class ApiUserController { bo.setDisplayName(user.getDisplayName()); bo.setIsTest(apiUser.getIsTest()); bo.setPurpose(apiUser.getPurpose()); + bo.setIsMonitorStatistic(apiUser.getIsMonitorStatistic()); + bo.setIsMonitorUsed(apiUser.getIsMonitorUsed()); + bo.setIsWarnExpired(apiUser.getIsWarnExpired()); bo.setSiteName(apiUser.getSiteName()); bo.setIp(apiUser.getIp()); bo.setCompany(apiUser.getCompany()); @@ -317,6 +325,9 @@ public class ApiUserController { dataApiUser.put("isMonitor", model.getIsMonitor()); dataApiUser.put("contact", model.getContact()); dataApiUser.put("phone", model.getPhone()); + dataApiUser.put("isMonitorStatistic",model.getIsMonitorStatistic()); + dataApiUser.put("isMonitorUsed",model.getIsMonitorUsed()); + dataApiUser.put("isWarnExpired",model.getIsWarnExpired()); this.apiUserService.update(dataApiUser, userId); // 更改用户密码 // this.userService.updateById(user,userId); 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 f77689d9e..353a79d8c 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 @@ -44,6 +44,12 @@ public class ApiUserModel extends BaseModel { private String phone; + private Integer isMonitorStatistic; + + private Integer isMonitorUsed; + + private Integer isWarnExpired; + public String getPriceType() { return priceType; } @@ -635,4 +641,28 @@ public class ApiUserModel extends BaseModel { public void setPhone(String phone) { this.phone = phone; } + + public Integer getIsMonitorStatistic() { + return isMonitorStatistic; + } + + public void setIsMonitorStatistic(Integer isMonitorStatistic) { + this.isMonitorStatistic = isMonitorStatistic; + } + + public Integer getIsMonitorUsed() { + return isMonitorUsed; + } + + public void setIsMonitorUsed(Integer isMonitorUsed) { + this.isMonitorUsed = isMonitorUsed; + } + + public Integer getIsWarnExpired() { + return isWarnExpired; + } + + public void setIsWarnExpired(Integer isWarnExpired) { + this.isWarnExpired = isWarnExpired; + } } diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl index 0681d3bfe..01b6b9d82 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/add.ftl @@ -69,8 +69,29 @@ 鏄惁鐩戞帶 - 涓嶇洃鎺� - 鐩戞帶 + 涓嶇洃鎺� + 鐩戞帶 + + + + 鏄惁闇�瑕丄PI缁熻閲� + + 涓嶉渶瑕� + 闇�瑕� + + + + 鏄惁闇�瑕丄PI璐圭敤浣跨敤閲� + + 涓嶉渶瑕� + 闇�瑕� + + + + 鏄惁鎻愰啋鍗冲皢鍒版湡 + + 涓嶆彁閱� + 鎻愰啋 diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl index cc656fb8e..bf62526e0 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/edit.ftl @@ -95,6 +95,27 @@ checked="checked" name="isMonitor" value="1" style="margin-left: 15px;"/>鐩戞帶 + + 鏄惁闇�瑕丄PI缁熻閲� + + checked="checked" name="isMonitorStatistic" value="0" />涓嶉渶瑕� + checked="checked" name="isMonitorStatistic" value="1" style="margin-left: 15px;"/>闇�瑕� + + + + 鏄惁闇�瑕丄PI璐圭敤浣跨敤閲� + + checked="checked" name="isMonitorUsed" value="0" />涓嶉渶瑕� + checked="checked" name="isMonitorUsed" value="1" style="margin-left: 15px;"/>闇�瑕� + + + + 鏄惁鎻愰啋鍗冲皢鍒版湡 + + checked="checked" name="isWarnExpired" value="0" />涓嶆彁閱� + checked="checked" name="isWarnExpired" value="1" style="margin-left: 15px;"/>鎻愰啋 + + Email 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 20e6390c3..216e0d6cb 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 @@ -45,6 +45,12 @@ public class ApiUser implements SqlEntity { private Integer isMonitor; + private Integer isMonitorStatistic; + + private Integer isMonitorUsed; + + private Integer isWarnExpired; + @Id @Column(name = "ID") public long getId() { @@ -207,4 +213,31 @@ public class ApiUser implements SqlEntity { public void setPhone(String phone) { this.phone = phone; } + + @Column(name = "IS_MONITOR_STATISTIC") + public Integer getIsMonitorStatistic() { + return isMonitorStatistic; + } + + public void setIsMonitorStatistic(Integer isMonitorStatistic) { + this.isMonitorStatistic = isMonitorStatistic; + } + + @Column(name = "IS_MONITOR_USED") + public Integer getIsMonitorUsed() { + return isMonitorUsed; + } + + public void setIsMonitorUsed(Integer isMonitorUsed) { + this.isMonitorUsed = isMonitorUsed; + } + + @Column(name = "IS_WARN_EXPIRED") + public Integer getIsWarnExpired() { + return isWarnExpired; + } + + public void setIsWarnExpired(Integer isWarnExpired) { + this.isWarnExpired = isWarnExpired; + } } 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 f00b8e6d6..1f3da2050 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 @@ -32,6 +32,12 @@ public class ApiUserBo implements Serializable { private String phone; //联系人手机号 + private Integer isMonitorStatistic; + + private Integer isMonitorUsed; + + private Integer isWarnExpired; + public String getPriceType() { return priceType; } @@ -191,4 +197,28 @@ public class ApiUserBo implements Serializable { public void setPhone(String phone) { this.phone = phone; } + + public Integer getIsMonitorStatistic() { + return isMonitorStatistic; + } + + public void setIsMonitorStatistic(Integer isMonitorStatistic) { + this.isMonitorStatistic = isMonitorStatistic; + } + + public Integer getIsMonitorUsed() { + return isMonitorUsed; + } + + public void setIsMonitorUsed(Integer isMonitorUsed) { + this.isMonitorUsed = isMonitorUsed; + } + + public Integer getIsWarnExpired() { + return isWarnExpired; + } + + public void setIsWarnExpired(Integer isWarnExpired) { + this.isWarnExpired = isWarnExpired; + } } From 2e1b7418ff54e4dbb3a06ed99efba317fe6c5a68 Mon Sep 17 00:00:00 2001 From: majintao Date: Wed, 18 Sep 2024 18:08:36 +0800 Subject: [PATCH 007/115] =?UTF-8?q?api=E6=AC=A1=E6=95=B0=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/bkoff/controllers/ApiUserController.java | 1 + 1 file changed, 1 insertion(+) 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 4f2379d4b..6e85874c7 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 @@ -770,6 +770,7 @@ public class ApiUserController { apiCountLogService.save(apiCountLog); } } + totalCountMap.put(model.getUri(), count); if (count == 0) { totalCountMap.remove(model.getUri()); } From 04b9ac375a014f3bf4404ba68c59a49aef68dcf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Thu, 19 Sep 2024 10:09:30 +0800 Subject: [PATCH 008/115] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=84=E4=BC=B0?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/FshController.java | 2 +- .../com/fangjia/open/model/PropertyEvaluationModel.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java index d5d69a1af..87a1e84b3 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java @@ -1925,7 +1925,7 @@ public class FshController { evaluation.setFitmentCharge(model.getDecorationCost()); } evaluation.setGardenArea(model.getGardenArea()); - if (0 != model.getHall()) { + if (model.getHall() != null && 0 != model.getHall()) { evaluation.setHall(model.getHall()); } if (null != model.getFloor()) { diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java index 2abc1acf1..d6848c616 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java @@ -80,7 +80,7 @@ public class PropertyEvaluationModel extends FangjiaApiModel { /** * 厅数 */ - private int hall; + private Integer hall; /** * 卫数 @@ -361,11 +361,11 @@ public class PropertyEvaluationModel extends FangjiaApiModel { this.room = room; } - public int getHall() { + public Integer getHall() { return hall; } - public void setHall(int hall) { + public void setHall(Integer hall) { this.hall = hall; } From cf6879f13ec293e4946b44a8cc9be441a78bf0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Thu, 19 Sep 2024 10:13:40 +0800 Subject: [PATCH 009/115] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=84=E4=BC=B0?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fangjia/open/controllers/FshController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java index 87a1e84b3..f0c267e87 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java @@ -1951,7 +1951,7 @@ public class FshController { evaluation.setOtherFactor(model.getOtherFactor()); } evaluation.setRegion(model.getDistrict()); - if (0 != model.getRoom()) { + if (model.getRoom() != null && 0 != model.getRoom()) { evaluation.setRoom(model.getRoom()); } if (StringUtils.isNotBlank(model.getRoomNumber())) { From 5d13cd5af34d9bbb7013f7d793feb7d20b010e2b Mon Sep 17 00:00:00 2001 From: majintao Date: Thu, 19 Sep 2024 15:49:01 +0800 Subject: [PATCH 010/115] =?UTF-8?q?=E7=94=BB=E5=BC=80=E5=8F=91=E5=8C=BA?= =?UTF-8?q?=E5=8A=A0=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/webapp/developmentZone/edit.ftl | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl b/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl index b64ba3bac..b75eca58f 100644 --- a/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl @@ -68,8 +68,10 @@ + + -
+
@@ -312,6 +314,52 @@ fetchProvinces() + var currentMarker = null; + + function addMarker(lng, lat){ + var markerPoint = new BMap.Point(lng, lat); + + // 绉婚櫎鏃х殑鏍囪鐐� + if (currentMarker) { + map.removeOverlay(currentMarker); + } + + // 鍒涘缓鏂扮殑鏍囪鐐� + currentMarker = new BMap.Marker(markerPoint); + map.addOverlay(currentMarker); + map.setCenter(markerPoint); + + currentMarker.enableDragging(); + + currentMarker.addEventListener("dragging", function(e) { + $("#mapLng").text(e.point.lng); + $("#mapLat").text(e.point.lat); + }); + } + $("#btn_sea").click(function() { + var keyword = $.trim($("#seaAddress").val()); + + var options = { + onSearchComplete: function(results) { + console.log(results) + // 鍒ゆ柇鐘舵�佹槸鍚︽纭� + if (local.getStatus() === BMAP_STATUS_SUCCESS) { + if (results.getCurrentNumPois() > 0) { + var lng = results.getPoi(0).point.lng; + var lat = results.getPoi(0).point.lat; + addMarker(lng, lat); // 浠呮坊鍔犳爣璁扮偣 + // var mPoint = new BMap.Point(lng, lat) + // map.centerAndZoom(mPoint,15); + // drawPolygons(); // 閲嶆柊缁樺埗鍥存爮 + } + } + } + }; + + var local = new BMap.LocalSearch(map, options); + local.search(keyword); + }); + From 3165f27f91f157e51f53e0158bf3c0bb9b306834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Thu, 19 Sep 2024 15:55:04 +0800 Subject: [PATCH 011/115] =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/FshController.java | 8 ++++++-- .../com/fangjia/open/model/PropertyEvaluationModel.java | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java index f0c267e87..c8b8b64ad 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/FshController.java @@ -1925,8 +1925,12 @@ public class FshController { evaluation.setFitmentCharge(model.getDecorationCost()); } evaluation.setGardenArea(model.getGardenArea()); - if (model.getHall() != null && 0 != model.getHall()) { - evaluation.setHall(model.getHall()); + try { + if (0 != model.getHall()) { + evaluation.setHall(model.getHall()); + } + } catch (Exception ex) { + } if (null != model.getFloor()) { evaluation.setFloor(model.getFloor()); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java index d6848c616..2abc1acf1 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/PropertyEvaluationModel.java @@ -80,7 +80,7 @@ public class PropertyEvaluationModel extends FangjiaApiModel { /** * 厅数 */ - private Integer hall; + private int hall; /** * 卫数 @@ -361,11 +361,11 @@ public class PropertyEvaluationModel extends FangjiaApiModel { this.room = room; } - public Integer getHall() { + public int getHall() { return hall; } - public void setHall(Integer hall) { + public void setHall(int hall) { this.hall = hall; } From b7f0248448491f7e07844ffc89acd10f6f4e8ae5 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 20 Sep 2024 11:49:32 +0800 Subject: [PATCH 012/115] =?UTF-8?q?=E6=88=90=E4=BA=A4=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E6=94=BE=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccbevaluation/BigdataDealBatch.groovy | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy index 7c27892fa..73a7cd0b4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy @@ -68,14 +68,14 @@ class BigdataDealBatch extends BaseBatch{ //664a22000000000000000000 5-20 //664b73800000000000000000 5-21 - def citys =CcbCommonUtils.getRunningCitys(args) + def citys = CcbCommonUtils.getRunningCitys(args) println "curDate:"+curDate def allCitys = CommonDatautils.findAllCity() for(def city : allCitys){ addDealPriceMatch(city); } - updateCrawlTradeDate()//修改后抓取的成交,将时间改为本月 +// updateCrawlTradeDate()//修改后抓取的成交,将时间改为本月 def rows = [] @@ -720,38 +720,38 @@ class BigdataDealBatch extends BaseBatch{ if(!t.match_id){ def region = RegionData.formatRegion(t.city, t.region) def rMap = null - if(region || (!region && ["澄迈"].contains(t.city))) { - if(t.house_use && t.house_use.contains("商住")){ - if(!t.name.contains("商住")){ - t.name = t.name +"商住楼" - } + if(t.house_use && t.house_use.contains("商住")){ + if(!t.name.contains("商住")){ + t.name = t.name +"商住楼" } - def flag = false - def address = null - if(t.address){ - flag = t.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街|巷).+[弄号]$') - if(flag){ - address = t.address - } + } + def flag = false + def address = null + if(t.address){ + flag = t.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街|巷).+[弄号]$') + if(flag){ + address = t.address } + } - rMap = SeaweedDataMatchProcess.doMatch(t.city, region, t.name, address); - if(!rMap && !t.name.toString().endsWith("小区")){ - rMap = SeaweedDataMatchProcess.doMatch(t.city, region, t.name+"小区", address); - } + rMap = SeaweedDataMatchProcess.doMatch(t.city, region, t.name, address); + if(!rMap && !t.name.toString().endsWith("小区")){ + rMap = SeaweedDataMatchProcess.doMatch(t.city, region, t.name+"小区", address); + } - if(rMap && rMap.region==region){ + if(rMap && region && rMap.region==region){ + CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id) + }else if(rMap && rMap.address && address && region && rMap.region!=region && address.contains(rMap.address)){ + CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id) + }else if (rMap && ["澄迈"].contains(rMap.city)){ + CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id) + }else if(rMap && rMap.region!=t.region && ["开发区","八里湖新区","经济技术开发区(头屯河区)","角美台商投资区","贵州双龙航空港经济区","东津新区"].contains(t.region)){ + def lists = CommonDatautils.findDistrictList(rMap.city, null, rMap.name, "district") + if(lists && lists.size()==1){ CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id) - }else if(rMap && rMap.address && address && rMap.region!=region && address.contains(rMap.address)){ - CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id) - }else if (rMap && ["澄迈"].contains(rMap.city)){ - CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id) - }else{ - if (rMap) { - println "区域不同" - } + }else { + println "多区域" } - } println count_.get()+" "+t+" "+ rMap } From b8fd3cd4696ea554facc10f4b74856f1d5f80ce6 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 20 Sep 2024 13:33:27 +0800 Subject: [PATCH 013/115] =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy | 2 ++ .../gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy index f167832eb..3ecf7620e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy @@ -660,6 +660,7 @@ class CcbCommonUtils { udata.put("match_region", match_region) udata.put("match_name", match_name) udata.put("match_id", match_id) + udata.put("m_date", new Date()) DEAL_PRICE_COLL.update(new BasicDBObject("_id",id), new BasicDBObject('$set',udata)) } @@ -735,6 +736,7 @@ class CcbCommonUtils { def q = new BasicDBObject() q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate)) q.put("_id", new BasicDBObject('$gte', cDate)) + q.put("price_flag", new BasicDBObject('$exists', false)) def count = DEAL_PRICE_COLL.count(q) if(count>0){ def udata = new BasicDBObject() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy index f649b98ff..31476beaa 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy @@ -34,7 +34,7 @@ class FjwBigdataCommbuildtypeBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys(args) + def citys = CcbCommonUtils.getRunningCitys("all") def rets = [] def cityCodeDatas = CcbCommonUtils.findCityCodeValue() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy index e01c76779..1c11d37f6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy @@ -43,7 +43,7 @@ class FjwBigdataCommunityBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys(args) + def citys = CcbCommonUtils.getRunningCitys("all") def rows = [] def headers = []//["城市ID","行政区ID","小区ID","行政区名称","小区名称","详细地址","纬度","经度","占地总面积","建筑总面积","绿化率","容积率","车位数量","建筑年代","房屋用途", diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy index 9b84e83c3..3d8f70c98 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy @@ -50,7 +50,7 @@ class FjwBigdataDealBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys(args) + def citys = CcbCommonUtils.getRunningCitys("all") // println "curDate:"+curDate // def allCitys = CommonDatautils.findAllCity() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy index 1cb508851..6381fd180 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy @@ -85,7 +85,7 @@ class FjwBigdataForsaleBatch extends BaseBatch{ public void process(Object args) { //目前查询库中是否已存在,用的是Oracle def index = 0 - def citys = CcbCommonUtils.getRunningCitys(args) + def citys = CcbCommonUtils.getRunningCitys("all") def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy index dae99b102..eb6f29252 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy @@ -44,7 +44,7 @@ class FjwGuiDingPriceBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys(args) + def citys = CcbCommonUtils.getRunningCitys("all") def rows = [] FjwPgsqlCommUtils.deleteGuidedPrice(curDate) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy index baae234f8..00f4ee239 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy @@ -46,7 +46,7 @@ class FjwThirdPartyPriceBatch extends BaseBatch { @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys(args) + def citys = CcbCommonUtils.getRunningCitys("all") runDatas(citys) //同步历史数据 From d78711596509a2877a86b7721cb1a5182f42837e Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 20 Sep 2024 13:40:11 +0800 Subject: [PATCH 014/115] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy index eb6f29252..b2dd0c3be 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwGuiDingPriceBatch.groovy @@ -44,7 +44,7 @@ class FjwGuiDingPriceBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys("all") + def citys = CcbCommonUtils.getRunningCitys(["all"]) def rows = [] FjwPgsqlCommUtils.deleteGuidedPrice(curDate) From 92bd683c14c450b0e2d4b018e1ca4dc1726d7d61 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 20 Sep 2024 13:47:09 +0800 Subject: [PATCH 015/115] =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy | 2 +- .../script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy index 31476beaa..2a94ffa1d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommbuildtypeBatch.groovy @@ -34,7 +34,7 @@ class FjwBigdataCommbuildtypeBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys("all") + def citys = CcbCommonUtils.getRunningCitys(["all"]) def rets = [] def cityCodeDatas = CcbCommonUtils.findCityCodeValue() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy index 1c11d37f6..eb2cbf34a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataCommunityBatch.groovy @@ -43,7 +43,7 @@ class FjwBigdataCommunityBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys("all") + def citys = CcbCommonUtils.getRunningCitys(["all"]) def rows = [] def headers = []//["城市ID","行政区ID","小区ID","行政区名称","小区名称","详细地址","纬度","经度","占地总面积","建筑总面积","绿化率","容积率","车位数量","建筑年代","房屋用途", diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy index 3d8f70c98..e4a76bd99 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataDealBatch.groovy @@ -50,7 +50,7 @@ class FjwBigdataDealBatch extends BaseBatch{ @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys("all") + def citys = CcbCommonUtils.getRunningCitys(["all"]) // println "curDate:"+curDate // def allCitys = CommonDatautils.findAllCity() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy index 6381fd180..41dc71dc3 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwBigdataForsaleBatch.groovy @@ -85,7 +85,7 @@ class FjwBigdataForsaleBatch extends BaseBatch{ public void process(Object args) { //目前查询库中是否已存在,用的是Oracle def index = 0 - def citys = CcbCommonUtils.getRunningCitys("all") + def citys = CcbCommonUtils.getRunningCitys(["all"]) def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy index 00f4ee239..f1925938e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/fjwPriceBaseData/FjwThirdPartyPriceBatch.groovy @@ -46,7 +46,7 @@ class FjwThirdPartyPriceBatch extends BaseBatch { @Override public void process(Object args) { - def citys = CcbCommonUtils.getRunningCitys("all") + def citys = CcbCommonUtils.getRunningCitys(["all"]) runDatas(citys) //同步历史数据 From cb4a0f7e163cb88486dd243bbc5168ab6f3b07b7 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 20 Sep 2024 17:07:02 +0800 Subject: [PATCH 016/115] =?UTF-8?q?=E5=8A=A0=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy index 3ecf7620e..f9d5867e0 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy @@ -237,7 +237,7 @@ class CcbCommonUtils { def lists = [] println dist.name +" "+total for(def d : dbcursor){ - def key=d.city+"##"+d.match_region+"##"+d.match_name+"##"+d.area+"##"+d.avg_price+"##"+d.total_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd") + def key=d.city+"##"+d.match_region+"##"+d.match_name+"##"+d.area+"##"+d.avg_price+"##"+d.total_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd")+"##"+d.source if(!rets.contains(key)){ rets << key d.dist_id = dist._id.toString() From e59df996ea78121ec8378671478ddbf468f1d77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Fri, 20 Sep 2024 17:37:43 +0800 Subject: [PATCH 017/115] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fangjia/open/util/FileDao.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/util/FileDao.java b/projects/fangjia-open/src/main/java/com/fangjia/open/util/FileDao.java index 2919c8a6c..be6fa3e75 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/util/FileDao.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/util/FileDao.java @@ -34,8 +34,8 @@ public class FileDao { IMPORTANT_CATEGORY = Arrays.asList(System.getProperty("fangjia.important.category", "data_file,district,shop,office,avatar,flash,user_house,upload").split(",")); try { - filesCollection = new Mongo("fs.mongo.db.fangjia.com", 27000).getDB("fangjia_fs").getCollection("files"); - gridFs = new GridFS(filesCollection.getDB(), "fangjia_fs"); + filesCollection = new Mongo("fs.mongo.db.fangjia.com", 27000).getDB("fangjia").getCollection("files"); + gridFs = new GridFS(filesCollection.getDB(), "fangjia"); cappedCollection = new Mongo("capped.mongo.db.fangjia.com", Integer.getInteger("capped.mongo.port", 27000)).getDB("fangjia_fs").getCollection("files_capped"); } catch (Exception e) { e.printStackTrace(); From 197250766be9a4829760e8b5c5c0cf754b8da05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Fri, 20 Sep 2024 17:49:13 +0800 Subject: [PATCH 018/115] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fangjia/stc2/FileDao.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-static/src/main/java/com/fangjia/stc2/FileDao.java b/projects/fangjia-static/src/main/java/com/fangjia/stc2/FileDao.java index fcda0b3e4..9b22b5672 100644 --- a/projects/fangjia-static/src/main/java/com/fangjia/stc2/FileDao.java +++ b/projects/fangjia-static/src/main/java/com/fangjia/stc2/FileDao.java @@ -37,8 +37,8 @@ public class FileDao { IMPORTANT_CATEGORY = Arrays.asList(System.getProperty("fangjia.important.category", "district,shop,office,avatar,flash,user_house,upload,news,attachment").split(",")); try { - filesCollection = new Mongo("fs.mongo.db.fangjia.com", Integer.getInteger("fs.mongo.port", 27017)).getDB("fangjia_fs").getCollection("files"); - gridFs = new GridFS(filesCollection.getDB(), "fangjia_fs"); + filesCollection = new Mongo("fs.mongo.db.fangjia.com", Integer.getInteger("fs.mongo.port", 27017)).getDB("fangjia").getCollection("files"); + gridFs = new GridFS(filesCollection.getDB(), "fangjia"); cappedCollection = new Mongo("capped.mongo.db.fangjia.com", Integer.getInteger("capped.mongo.port", 27017)).getDB("fangjia_fs").getCollection("files_capped"); } catch (Exception e) { e.printStackTrace(); From 888f51f0fe92e54b2494a0e9032b0e40cbb0a4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Mon, 23 Sep 2024 09:54:40 +0800 Subject: [PATCH 019/115] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=9D=87=E4=BB=B7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/AddrSvcController.java | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java index 6b669977b..11fbd8025 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java @@ -1,10 +1,12 @@ package com.fangjia.open.controllers; import com.fangjia.core.util.HttpRequest; -import com.fangjia.dal.common.DistrictKey; import com.fangjia.dal.mongo.model.VillageIdentify; import com.fangjia.dal.seaweed.model.District; -import com.fangjia.open.dto.addressGovernance.*; +import com.fangjia.open.dto.addressGovernance.DistrictDto; +import com.fangjia.open.dto.addressGovernance.DistrictIdentifyDto; +import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto; +import com.fangjia.open.dto.addressGovernance.StructureAndCompleteDto; import com.fangjia.open.interceptors.Authority; import com.fangjia.open.interceptors.Role; import com.fangjia.open.model.AddesssMatchModel; @@ -12,7 +14,7 @@ import com.fangjia.open.model.AddressModel; import com.fangjia.open.model.BasicModel; import com.fangjia.open.model.RestfulModelAndView; import com.fangjia.open.util.CommonDtoUtils; -import com.fangjia.service.bo.DistrictStatBo; +import com.fangjia.service.bo.DistrictAvgBo; import com.fangjia.service.datastore.DistrictService; import com.fangjia.service.district.DistrictStatService; import com.fangjia.service.mongo.fangjia.VillageIdentifyService; @@ -39,9 +41,7 @@ import sun.misc.BASE64Encoder; import java.io.IOException; import java.net.Authenticator; -import java.net.InetSocketAddress; import java.net.PasswordAuthentication; -import java.net.Proxy; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; @@ -372,18 +372,26 @@ public class AddrSvcController { json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8"); BasicModel basicModel = new BasicModel(200, "ok"); if (json != null && json.size() > 0) { - MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json); + MatchedBuildingDto dto = new MatchedBuildingDto(); + if (json.containsKey("id")) { + dto.setId(json.getString("id")); + } + if (json.containsKey("city")) { + dto.setCity(json.getString("city")); + } + if (json.containsKey("district")) { + dto.setDistrict(json.getString("district")); + } + if (json.containsKey("name")) { + dto.setName(json.getString("name")); + } 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())); + //DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(dto.getCity(), dto.getDistrict(), dto.getName())); + DistrictAvgBo statBo = districtStatService.findDistrictStat(district, "district", null) ; if (null != statBo) { - if (statBo.getDistrictStat() != null) { - dto.setAvgPrice(statBo.getDistrictStat().getAvgPrice()); - } else if (statBo.getVillaDistrictStat() != null) { - dto.setAvgPrice(statBo.getVillaDistrictStat().getAvgPrice()); - } - + dto.setAvgPrice(statBo.getAvgPrice()); } } basicModel.setResult(dto); From 786ea3df36c73397662a3498f0a4dac00eae4c78 Mon Sep 17 00:00:00 2001 From: majintao Date: Mon, 23 Sep 2024 11:46:55 +0800 Subject: [PATCH 020/115] =?UTF-8?q?njcb=E6=B6=89=E5=86=9C=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/AddrSvcController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java index 11fbd8025..b1a869b94 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java @@ -389,7 +389,7 @@ public class AddrSvcController { 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())); - DistrictAvgBo statBo = districtStatService.findDistrictStat(district, "district", null) ; + DistrictAvgBo statBo = districtStatService.findDistrictStat(district, "district", null); if (null != statBo) { dto.setAvgPrice(statBo.getAvgPrice()); } @@ -514,7 +514,7 @@ public class AddrSvcController { } else { try { //如果是江苏省或者浙江省 调用齐梁的结果 - if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) { + if (result.containsKey("province") && ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province")))) { //结果比较,如果涉农结果不一致 //调用齐梁 type :1 对公 0 对私 //我们 type :1 对私 2 对共 From 673b0d656c5fb9cf2444051d5911f5ad540a5c54 Mon Sep 17 00:00:00 2001 From: majintao Date: Mon, 23 Sep 2024 13:06:27 +0800 Subject: [PATCH 021/115] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=88=BF=E6=BA=90?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E6=94=B9=E6=88=905=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/PropertyController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index ae8b64282..bca8b4100 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -178,6 +178,7 @@ public class PropertyController { private FileDao fileDao = FileDao.getInstance(); private static final int DEFAULT_PAGE_SIZE = 20; + private static final int DEFAULT_HOUSE_COUNT = 5; private static final String[] PROPERTY_SEARCH_API_FIELDS = {"address", "city", "region", "name", "lat2", "lng2", "lat", "lng", "block", "estateType2", "addrAlias", "alias"}; static final int BAI_DU_GEO = 1;// 百度系坐标 static final int GAO_DE_GEO = 2;// 高德系坐标 @@ -2780,7 +2781,7 @@ public class PropertyController { return mav; } if (model.getMax() == null || model.getMax() < 1) { - model.setMax(DEFAULT_PAGE_SIZE); + model.setMax(DEFAULT_HOUSE_COUNT); } else if (model.getMax() > 100) { model.setMax(100); } From a0d2f154300438de1851ebc79e8447233c5fc8d4 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Mon, 23 Sep 2024 16:13:08 +0800 Subject: [PATCH 022/115] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B6=89=E5=8F=B0?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccbevaluation/BigdataDealBatch.groovy | 2 +- .../script/commData/CommonDatautils.groovy | 6 +- .../fangjia/script/gj/ccb/FileUtils.groovy | 59 ++++++- .../script/gj/data_handle/DevProcess.groovy | 103 +++++++++--- .../gj/data_handle/DevUpdateTestBatch.groovy | 26 +-- .../script/gj/data_handle/PoiLocation.groovy | 42 ++++- .../gj/data_handle/TownMiddleProcess.groovy | 99 ++++++++++- .../script/gj/village/QiliangTest.groovy | 2 +- .../gj/xiamen/GaoDePoiDataProcess.groovy | 2 +- .../gj/xiamen/RelatedTaiWanBatch.groovy | 159 ++++++++++++++++++ .../script/gj/xiamen/SeaweedDataSynch.groovy | 20 +-- .../script/gj/xiamen/XmBankFtpUtils.groovy | 76 +++++++++ .../script/looplineinfo/InsidePolygon.groovy | 14 ++ .../fangjia/script/util/BaiduMapUtils.groovy | 3 +- .../yinjihaun/amap/GaoDeApiUtils.groovy | 2 +- 15 files changed, 546 insertions(+), 69 deletions(-) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankFtpUtils.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy index 73a7cd0b4..a57be2c48 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy @@ -75,7 +75,7 @@ class BigdataDealBatch extends BaseBatch{ for(def city : allCitys){ addDealPriceMatch(city); } -// updateCrawlTradeDate()//修改后抓取的成交,将时间改为本月 + updateCrawlTradeDate()//修改后抓取的成交,将时间改为本月 def rows = [] diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy index a74e9189a..660b685bf 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy @@ -4660,7 +4660,7 @@ class CommonDatautils { def q = new BasicDBObject() q.put("type","区域") q.put("district_diff",1) - q.put("city",new BasicDBObject('$in', ["中山","东莞","东方"])) + q.put("city",new BasicDBObject('$in', ["深圳市"])) def keys = new BasicDBObject() keys.put("province",1) @@ -4694,7 +4694,7 @@ class CommonDatautils { def q = new BasicDBObject() q.put("type","乡镇街道") // q.put("province",new BasicDBObject('$in', ['浙江省','江苏省','山东省'])) - q.put("city",new BasicDBObject('$in', ["中山市","东莞市","东方市"])) + q.put("city",new BasicDBObject('$in', ["深圳市"])) def keys = new BasicDBObject() keys.put("province",1) @@ -4755,7 +4755,7 @@ class CommonDatautils { def q = new BasicDBObject() q.put("type","乡镇街道") - q.put("city",new BasicDBObject('$in', ["中山","东莞","东方"])) + q.put("city",new BasicDBObject('$in', ["深圳"])) def keys = new BasicDBObject() keys.put("city",1) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy index 1a8fb81be..795297501 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ccb/FileUtils.groovy @@ -3,7 +3,7 @@ package com.fangjia.script.gj.ccb import org.apache.commons.lang.StringUtils class FileUtils { - static def batchCreateFile(ret, fileName, headers,charset, isAppend){ + static def batchCreateFile(ret, fileName, headers, charset, isAppend){ File file = new File(fileName); // if (file.exists()) { // file.delete(); @@ -51,6 +51,63 @@ class FileUtils { out.close(); } + + + static def batchCreateFileByCustomSuffix(ret, fileName, headers, charset, isAppend, suffix, lineSuffix){ + File file = new File(fileName); +// if (file.exists()) { +// file.delete(); +// } + + if (!file.getParentFile().exists()) { + boolean result = file.getParentFile().mkdirs(); + if (!result) { + System.out.println("创建目录失败"); + } + } + + + OutputStream out = new FileOutputStream(fileName, isAppend); + def sb = new StringBuffer(); + + if(headers){ + sb.append(headers.join(suffix)) + sb.append("\n"); + } + + out.write(sb.toString().getBytes(charset)); + sb.setLength(0) + + def index = 0 + for(def row : ret){ + if(row){ + index++ + sb.append(StringUtils.join(row.toArray(), suffix)) + if(index0){ + out.write(sb.toString().getBytes(charset)); + sb.setLength(0) + } + out.close(); + } + + + static def createTxtFile(ret, fileName, charset, isAppend){ File file = new File(fileName); if (!file.getParentFile().exists()) { diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevProcess.groovy index 9cd1480dd..636e2b0dc 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevProcess.groovy @@ -17,7 +17,9 @@ import com.mongodb.DBCollection import net.sf.json.JSONObject import org.apache.poi.ss.util.RegionUtil import org.bson.types.ObjectId +import org.joda.time.Instant +import java.time.format.DateTimeFormatter import java.util.regex.Pattern class DevProcess { @@ -35,11 +37,13 @@ class DevProcess { // DBCollection kfq_COLL = MongoUtils.getCollectionByName("crawl", "kfq_investchn_com", "192.168.0.206",27020) + DBCollection TOWNPOLYLINE_COLL = MongoUtils.getCollectionByAuth20190102("fangjia_crawl", "town_polyline") + static main(args) { def task = new DevProcess(); // task.run() // task.parseCityAndDist() - task.devSplitRoad() +// task.devSplitRoad() // task.devNameSplitRoad() // task.addFlag() // task.matchDev() @@ -56,7 +60,7 @@ class DevProcess { // task.createDevMapping() // task.deleteAddr() // task.deleteAddr2() -// task.synchDevTo100() + task.synchDevTo100() // task.addNewDev2() // task.addAlias() @@ -75,10 +79,15 @@ class DevProcess { // task.repeatSave() +// task.addDevInfo() + +// task.matchDevShape()//匹配开发区围栏 + } + def parseCityAndDist(){ ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\等级开发区.xlsx",{d-> if(!d['J']){ @@ -271,30 +280,30 @@ class DevProcess { while(i<20){ def fileName = "/home/goojia/gj/qzd-${i}.xlsx" if(CommonDatautils.isWindow()){ - fileName = "D:\\数据\\数据建设\\开发区\\新跑省份\\河北省\\test-${i}.xlsx" + fileName = "D:\\数据\\数据建设\\开发区\\乡镇街道围栏开发区数据.xlsx" } File file=new File(fileName); if(file.exists()){ ExcelUtils.multiThreadingModify(fileName,{d-> - if(d['C'] && !d['F']){ - def jsonObject1 = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['C']) - if(jsonObject1) { - if (jsonObject1.get("dev") && jsonObject1.get("dev") != "null") { - def devName = jsonObject1.get("dev") - def obj = findDev(devName) - d['F'] = devName - if(jsonObject1.containsKey("detail") && jsonObject1.detail.dev_confi!='null'){ - d['S'] = jsonObject1.detail.dev_confi - } - if (obj) { - d['O'] = obj._id.toString() - d['P'] = obj.name - d['U'] = obj.match_way - } - } - } - } +// if(d['C'] && !d['F']){ +// def jsonObject1 = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['C']) +// if(jsonObject1) { +// if (jsonObject1.get("dev") && jsonObject1.get("dev") != "null") { +// def devName = jsonObject1.get("dev") +// def obj = findDev(devName) +// d['F'] = devName +// if(jsonObject1.containsKey("detail") && jsonObject1.detail.dev_confi!='null'){ +// d['S'] = jsonObject1.detail.dev_confi +// } +// if (obj) { +// d['O'] = obj._id.toString() +// d['P'] = obj.name +// d['U'] = obj.match_way +// } +// } +// } +// } if(d['E'] && !d['M']) { def jsonObject = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['E']) @@ -326,7 +335,7 @@ class DevProcess { d['N'] = "信息不完整" } - if (!d['N'] && d['C'] && !d['C'].contains(road)) { + if (!d['N'] && !d['E'].contains(road)) { d['N'] = "原地址不含路" } @@ -619,7 +628,7 @@ class DevProcess { def addDevAddres3(){ def index = 0 - ExcelUtils.modify("D:\\数据\\数据建设\\开发区\\新跑省份\\新疆省入库.xlsx",{d-> + ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\开发区\\新跑省份\\河北省\\河北省开发区地址入库.xlsx",{d-> if(d['A']){ def obj = development_zone_CONN.findOne(new BasicDBObject("name", d['A'])) if(obj){ @@ -1063,4 +1072,52 @@ class DevProcess { } DEV_MAPPING_CONN2.insert(list) } + + def addDevInfo(){ + ExcelUtils.multiThreadingModify("C:\\Users\\gaojuan\\Downloads\\河北省开发区对应园区.xlsx",{d-> + if(d['C']){ + def q = new BasicDBObject().append("name", d['C']) + def obj = development_zone_CONN.findOne(q) + if(obj){ + d['A'] = obj.city + d['B'] = obj.district + } + } + }) + } + + def matchDevShape(){ + ExcelUtils.multiThreadingModify("D:\\数据\\数据建设\\开发区\\开发区-全量9-14.xlsx",{d-> + if(d['C'] && !d['I']){ + def newDev = d['E'].replace("经济技术开发区", "经济开发区").replace(d['B'].replace("省",""), "") + def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(new BasicDBObject("city",d['C']).append("district", d['D']).append("type","乡镇街道").append("street", new BasicDBObject('$regex', Pattern.compile(newDev.trim()+'.*$', Pattern.CASE_INSENSITIVE))).append("shape", new BasicDBObject('$exists',true))) + if(dbcursor.count()>0){ + println "[统计局] "+d['E'] +" "+ dbcursor.count() + if(dbcursor.count()==1){ + for(def obj : dbcursor){ + d['F'] = obj.city + d['G'] = obj.district + d['H'] = obj.street + d['I'] = "统计局相似(去省)-有围栏" + } + } + }else{ + dbcursor = TOWNPOLYLINE_COLL.find(new BasicDBObject("city",d['C']).append("region", d['D']).append("town", newDev)) + println "[乡镇街道围栏] "+d['E'] +" "+ dbcursor.count() + if(dbcursor.count()==1){ + for(def obj : dbcursor){ + d['F'] = obj.city + d['G'] = obj.region + d['H'] = obj.town + if(obj.polyline){ + d['I'] = "乡镇围栏相似(去省)-有围栏" + } + + } + } + } + + } + }); + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy index 84d14b8e0..d56afba8a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DevUpdateTestBatch.groovy @@ -19,7 +19,7 @@ import org.elasticsearch.common.xcontent.XContentType class DevUpdateTestBatch { def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009"; - DBCollection development_zone_100_CONN = MongoUtils.getCollectionByName2("fangjia", "development_zone", MONGO100_URL) + DBCollection development_zone_43_CONN = MongoUtils.getCollectionByName("fangjia_base", "development_zone", "mongo.db.fangjia.com") DBCollection DEV_MAPPING_100_CONN = MongoUtils.getCollectionByName2("fangjia", "dev_mapping", MONGO100_URL) @@ -31,8 +31,8 @@ class DevUpdateTestBatch { def task = new DevUpdateTestBatch() def path = "D:\\数据\\数据建设\\开发区\\开发区-园区.xlsx"//开发区-园区.xlsx // task.addDev(path) -// task.addDevAddress(path) - + task.addDevAddress(path) +// // task.updateHasGov("新疆维吾尔自治区","喀什地区","麦盖提县", "麦盖提镇", "是") @@ -109,7 +109,7 @@ class DevUpdateTestBatch { def addDevAddress(path){ ExcelUtils.modify(path,{ d-> if(!d['D'] && d['A']){ - def obj = development_zone_100_CONN.findOne(new BasicDBObject("name", d['A'])) + def obj = development_zone_43_CONN.findOne(new BasicDBObject("name", d['A'])) if(obj){ def q = new BasicDBObject("name", d['A']).append("type",d['B']) if(d['B'] == "乡镇街道"){ @@ -140,15 +140,15 @@ class DevUpdateTestBatch { DEV_MAPPING_100_CONN.save(o) -// o.id = o._id.toString() -// o.remove("_id") -// o.remove("c_date") -// addEs(o, "192.168.0.89", "dev_mapping") -// try{ -// addEs(o, "192.168.0.52", "dev_mapping") -// }catch(Exception e){ -// println "52 es error: "+e.printStackTrace() -// } + o.id = o._id.toString() + o.remove("_id") + o.remove("c_date") + addEs(o, "192.168.0.89", "dev_mapping") + try{ + addEs(o, "192.168.0.52", "dev_mapping") + }catch(Exception e){ + println "52 es error: "+e.printStackTrace() + } d['D'] = "已完成" }else{ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/PoiLocation.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/PoiLocation.groovy index 0ae99adbe..40e83e5ae 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/PoiLocation.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/PoiLocation.groovy @@ -21,11 +21,12 @@ 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 class PoiLocation { def MAP_POI_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009"; - DBCollection MAPPOI_CONN = MongoUtils.getCollectionByName2("fangjia", "didata_map_poi_single", MAP_POI_URL) + DBCollection MAPPOI_CONN = MongoUtils.getCollectionByName2("fangjia", "map_poi", MAP_POI_URL) public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10) def regionMap = com.fangjia.script.commData.CommonDatautils.queryDistNameByCity() @@ -35,14 +36,14 @@ class PoiLocation { static main(args) { def task = new PoiLocation(); -// task.run(); - task.regionAndStreetProcess() + task.run(); +// task.regionAndStreetProcess() } def run(){ - def citys = [""] + def citys = ["深圳市"] citys = citys.reverse() for(def city : citys){ findPois(city) @@ -80,6 +81,8 @@ class PoiLocation { def findPois(city){ def q = new BasicDBObject() q.put("city", city) + q.put("district", "坪山区") + q.put('address',new BasicDBObject('$regex', Pattern.compile('^.*兰竹东路8号.*$', Pattern.CASE_INSENSITIVE))) //名称 模糊查询 // q.put("run_status", new BasicDBObject('$ne', 1)) def keys = new BasicDBObject() @@ -151,8 +154,8 @@ class PoiLocation { for(def i=0;i + if(row['R'] && row['R']=="新增围栏"){ + def q = new BasicDBObject("city", row['B']).append("region", row['C']).append("town",row['D']) + println row['B']+" "+ row['D']+" "+TOWNPOLYLINE_COLL.count(q) + def d = TOWNPOLYLINE_COLL.findOne(q) + if(d){ + def resultMap = [:] + resultMap.type = "polygon" + def arrs = d.polyline.split("\\|") + def rets = [] + for(def s : arrs){ + def points = s.split(";") + def pointList = [] + for(def pointStr : points){ + def pointArr = pointStr.split(",") + def lon = DataHandleUtils.getDoubleRound(6, pointArr[0].toString().toDouble()) + def lat = DataHandleUtils.getDoubleRound(6, pointArr[1].toString().toDouble()) + pointList << [lon, lat] + } + rets << pointList + } + resultMap.coordinates = rets + if(rets.size()>1) { + resultMap.type = "MultiPolygon" + } + println d.city+" "+d.region+" "+d.town+" "+rets.size() + + def udata = new BasicDBObject() + udata.put("shape", resultMap) + + + def updateQuery = new BasicDBObject("name",row['N']) + DEVELOPMENT_ZONE_43_COLL.update(updateQuery, new BasicDBObject('$set',udata)) + row['S'] = "已完成" + } + } + }) + } + def checkTown(){ def q = new BasicDBObject("shape", new BasicDBObject('$exists', false)).append("type","乡镇街道") def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q) @@ -1164,4 +1216,39 @@ class TownMiddleProcess { def updateQuery = new BasicDBObject("_id", id) ADMINISTRATIVE_MAPPING_COLL.update(updateQuery, new BasicDBObject('$set',udata)) } + + def addTownCenter(){ + ExcelUtils.modify("D:\\数据\\数据建设\\乡镇街道\\乡镇街道无中心点数据.xlsx",{ row-> + def json = BaiduMapUtils.searchByAddress(row['C']+row['D']+row['E']) + if(json){ + row['J'] = json.confidence + row['K'] = json.comprehension + row['L'] = json.level + + def location = json.location; + def gmap = GeocodeUtils.geoconvBaiduToGoogle(location.lng.toDouble(), location.lat.toDouble()) + if(gmap){ + gmap.lng = DataHandleUtils.getDoubleRound(6, gmap.lng) + gmap.lat = DataHandleUtils.getDoubleRound(6, gmap.lat) + + row['F'] = gmap.lng + row['G'] = gmap.lat + row['H'] = location.lng.toDouble() + row['I'] = location.lat.toDouble() + + } + } + }) + } + + def checkCenterInTownRang(){ + def q = new BasicDBObject() + q.put("type","乡镇街道") + q.put("location", new BasicDBObject('$exists',false)) + def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q) + for(def d : dbcursor){ + + } + + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/QiliangTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/QiliangTest.groovy index 02e5d1ace..2ec4b5b3b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/QiliangTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/village/QiliangTest.groovy @@ -27,7 +27,7 @@ class QiliangTest { // task.run() def data = [ - 'address': '浙江省湖州市长兴县煤山镇工业园区山鹰大道7号', + 'address': '浙江省嘉兴市南湖区昌盛南路36号19幢嘉兴智慧产业创业园智慧大厦A座168室', 'type': '1' //1:对公 0:对私 ] def s = task.getProxyResult(data); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy index 2fa07a6d6..af7bae2a4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/GaoDePoiDataProcess.groovy @@ -89,7 +89,7 @@ class GaoDePoiDataProcess extends BaseBatch{ // synchNetwork() // println DateUtils.parseFromTightByPattern("2023-11-30","yyyy-MM-dd").getTime() // sysnchPoi() - sysnchVillage() +// sysnchVillage() // addTownship() } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy new file mode 100644 index 000000000..c1684e2f8 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/RelatedTaiWanBatch.groovy @@ -0,0 +1,159 @@ +package com.fangjia.script.gj.xiamen + +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.ccb.FileUtils +import com.fangjia.script.looplineinfo.InsidePolygon +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.MongoUtils +import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import com.rabbitmq.client.AMQP + +/** + * 厦门涉台园区数据同步 + */ +@BatchOwner(Watcher.GaoJuan) +class RelatedTaiWanBatch extends BaseBatch{ + + def curDate = Integer.parseInt(DateUtils.formatDateByPattern(new Date(), "yyyyMM")); + + DBCollection yuanqu_qiye_coll = MongoUtils.getCollectionByName("crawl", "qzd_shetai_company_detail", "192.168.0.206", 27020) + def relateTaiwn_yuanqu_datas = ["福州台商投资区","杏林台商投资区","集美台商投资区","海沧台商投资区","漳州台商投资区","泉州台商投资区","漳浦台湾农民创业园","漳平台湾农民创业园","仙游台湾农民创业园","清流台湾农民创业园","福清台湾农民创业园","惠安台湾农民创业园","海峡两岸集成电路产业合作试验区(厦门、泉州产业园)","海峡两岸生技和医疗健康产业合作区","海峡两岸农业合作试验区","海峡两岸(三明)现代林业合作实验区","漳州古雷石化基地","永泰闽台农业融合发展产业园","上杭闽台农业融合发展产业园","同安闽台农业融合发展产业园","南靖闽台农业融合发展产业园","漳浦闽台农业融合发展产业园","永春闽台农业融合发展产业园","永安闽台农业融合发展产业园","邵武闽台农业融合发展产业园","平潭闽台农业融合发展产业园","南靖闽台精密机械产业园"] + + DBCollection XM_RELATED_TW_QIYE_COLL = MongoUtils.getCollectionByName("business", "xm_related_tw_qiye", "mongo.db.fangjia.com") + DBCollection DEVELOPMENT_ZONE_43_COLL = MongoUtils.getCollectionByName("fangjia_base", "development_zone", "mongo.db.fangjia.com") + + def zimaoqu_datas = ["中国(福建)自由贸易试验区厦门片区","中国(福建)自由贸易试验区福州片区","中国(福建)自由贸易试验区平潭片区"] + + static main(args) { + runBatch(new RelatedTaiWanBatch(), args); + } + + @Override + public void process(Object args) { + createDatas() //企业库获取涉台园区企业 + updateRangeByPoint() //更改企业所在自贸区 + export() //导出数据 + } + + + def updateRangeByPoint(){ + def zimaoqu_range_datas = [] + for(def s : zimaoqu_datas){ + def dbcursor = DEVELOPMENT_ZONE_43_COLL.find(new BasicDBObject("name", s)) + for(def obj : dbcursor){ + if(obj && obj.shape){ + zimaoqu_range_datas << ["name":obj.name, "block":obj.block,"shape":obj.shape.coordinates] + } + } + } + + def dbcursor = XM_RELATED_TW_QIYE_COLL.find(new BasicDBObject()) + println dbcursor.count() + for(def r : dbcursor){ + def resKey = null + for(def m : zimaoqu_range_datas){ +// def flag = InsidePolygon.isInArea(r.lon, r.lat, InsidePolygon.createPoint5(m.shape)) + def flag = InsidePolygon.isPtInPoly(r.lon, r.lat, InsidePolygon.createPoint5(m.shape)) + if(flag){ + resKey = m.name + break + } + } + if(resKey){ + def udata = new BasicDBObject("free_trade_zone", resKey) + def updateQuery = new BasicDBObject("_id",r._id) + XM_RELATED_TW_QIYE_COLL.update(updateQuery, new BasicDBObject('$set',udata)) + } + } + + } + + def createDatas(){ + def datas = findQiyeDatas() + for(def r : datas){ + def map = getLocationInfo(r.city, r.address+r.company) + if(map && map.location){ + def arrs = map.location.split(",") + r.put("lon", DataHandleUtils.getDoubleRound(6, arrs[0].toString().toDouble())) + r.put("lat", DataHandleUtils.getDoubleRound(6, arrs[1].toString().toDouble())) + r.put("level", map.level) + } + saveToUpdate(r) + } + + } + + def saveToUpdate(datas){ + def udata = new BasicDBObject() + datas.each{k,v-> + udata.put(k,v) + } + XM_RELATED_TW_QIYE_COLL.save(udata) +// def updateQuery = new BasicDBObject("name",row['N']) +// XM_RELATED_TW_QIYE_COLL.update(updateQuery, new BasicDBObject('$set',udata)) + } + + def findQiyeDatas(){ + def datas = [] + relateTaiwn_yuanqu_datas.each { + def q = new BasicDBObject("name", it) + def dbcursor = yuanqu_qiye_coll.find(q) + for(def d : dbcursor){ + datas << ["_id":d._id, "province":d.province, "city":d.city,"address":d.address, "company":d.company, "name":d.name] + } + println it +" "+ datas.size() + } + return datas + } + + + def getLocationInfo(def city, def address){ + def gloJson = GaoDeApiUtils.geo(city, address) + def map = [:] + if(gloJson) { + def glocation = null + def level = null + if (gloJson && gloJson.get("geocodes")) { + def geocodes = gloJson.get("geocodes") + glocation = geocodes.get(0).location + level = geocodes.get(0).level + } + map.location = glocation + map.level = level + return map + } + return null + } + + def export(){ + def rows = [] + def dbcursor = XM_RELATED_TW_QIYE_COLL.find(new BasicDBObject()) + for(def r : dbcursor){ + rows << [r._id.toString(), r.province, r.city, r.address, r.company, r.name, r.free_trade_zone] + } + + def fileName = "/home/goojia/xmbank/free_trade_zone_${curDate}_init.dat" + if(CommonDatautils.isWindow()){ + fileName = "D:\\数据\\厦门\\涉台园区\\free_trade_zone_${curDate}_init.dat" + } + def allDatas = [] + allDatas.addAll(rows) +// FileUtils.batchCreateFile(rows, fileName, null, "utf-8", false); + FileUtils.batchCreateFileByCustomSuffix(rows, fileName, null, "utf-8", false, "|@|","|+|"); + XmBankFtpUtils.ftpUpload(fileName, curDate) + + def fileName2 = "/home/goojia/xmbank/free_trade_zone_${curDate}_init.dat.rdy" + if(CommonDatautils.isWindow()){ + fileName2 = "D:\\数据\\厦门\\涉台园区\\free_trade_zone_${curDate}_init.dat.rdy" + } + def rdy_datas = [rows.size().toString()] + FileUtils.batchCreateFileByCustomSuffix([rdy_datas], fileName2, null, "utf-8", false, "","|+|"); + XmBankFtpUtils.ftpUpload(fileName2, curDate) + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy index 480a0c151..5b5e79b62 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SeaweedDataSynch.groovy @@ -150,8 +150,8 @@ class SeaweedDataSynch extends BaseBatch{ final CountDownLatch latch = new CountDownLatch(dists.size()) for(def i=0;i createPoint5(def pointList){ + List alllist = new ArrayList<>(); + for(def pointArr : pointList){ + Point point = new Point(); + double x = pointArr[0]; + double y = pointArr[1]; + point.setLon(x); + point.setLat(y); + alllist.add(point); + } + return alllist + } /** * 判定一个经纬度点与区域的关系 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/BaiduMapUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/BaiduMapUtils.groovy index 2eb3fcfed..cb84af2c7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/BaiduMapUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/BaiduMapUtils.groovy @@ -99,7 +99,7 @@ class BaiduMapUtils { public static JSONObject searchByAddress(String address) { String add = URLEncoder.encode(address, "utf-8"); - String url = "http://api.map.baidu.com/geocoding/v3/?address="+ add +"&output=json&ak=9E99D3540e4dafb7894f7b9fe27fa6b5" + String url = "http://api.map.baidu.com/geocoding/v3/?address="+ add +"&output=json&ak=MZpy11ZrE8CbG4M5OznVAxIcRaBZ7aTR" boolean stop = false; int recount = 0; while(!stop && recount<3) { @@ -108,6 +108,7 @@ class BaiduMapUtils { try{ String result = request.get(url,null,"UTF-8"); JSONObject json = JSONObject.fromObject(result); + println address +" "+ json if(json.getInt("status") >= 300){ changeAK(); json = searchByAddress(address); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy index 4ec1957bd..65da1a7be 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/yinjihaun/amap/GaoDeApiUtils.groovy @@ -40,7 +40,7 @@ class GaoDeApiUtils { def static geo(city, address) { Map params = new HashMap() - params.put("key", GAO_DE_AK) + params.put("key", "a34894d151fffff94f9a33bae3d5565c")//许镕杰 params.put("city", city) params.put("address", address) String content From 2df46c820505d2743e7223657e7e7a5482f84e6a Mon Sep 17 00:00:00 2001 From: majintao Date: Tue, 24 Sep 2024 15:09:51 +0800 Subject: [PATCH 023/115] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7API?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E9=87=8F=E4=BD=BF=E7=94=A890%=E5=8F=91?= =?UTF-8?q?=E9=80=81kafka=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthenticationInterceptor.java | 836 +++++++++--------- .../util/kafka/KafkaProducerUtils.java | 7 + 2 files changed, 448 insertions(+), 395 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuthenticationInterceptor.java b/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuthenticationInterceptor.java index eff33a38f..471b6f946 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuthenticationInterceptor.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/interceptors/AuthenticationInterceptor.java @@ -14,6 +14,7 @@ import com.fangjia.open.model.RestfulModelAndView; import com.fangjia.service.open.ApiUserAuthorityService; import com.fangjia.service.open.ApiVisitCountService; import com.fangjia.service.sql.ApiUserService; +import com.fangjia.service.util.kafka.KafkaProducerUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,422 +31,467 @@ import java.util.*; * API拦截器 * * @author - * */ public class AuthenticationInterceptor implements Interceptor { - private ApiUserService apiUserService; - private ApiUserAuthorityService apiUserAuthorityService; - private ApiVisitCountService apiVisitCountService; - private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationInterceptor.class); - private static final Date OLD_USER_SPLITTED_DATE = DateUtil.parseFormatDate("2016-06-06"); - private static final List HAS_SUB_SERVICE_URIS = new ArrayList(); - private static final String SUB_SERVICE_SEPARATOR = "#"; - private static final String SERVICE_CODE_PARAM_NAME = "serviceCode"; - static { - HAS_SUB_SERVICE_URIS.add("/property/transaction"); - } - /** - * token过期时间 单位:s - */ - private static final long TOKEN_EXPIRED_TIME = 60 * 60 * 2; + private ApiUserService apiUserService; + private KafkaProducerUtils kafkaProducerUtils; + private ApiUserAuthorityService apiUserAuthorityService; + private ApiVisitCountService apiVisitCountService; + private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationInterceptor.class); + private static final Date OLD_USER_SPLITTED_DATE = DateUtil.parseFormatDate("2016-06-06"); + private static final List HAS_SUB_SERVICE_URIS = new ArrayList(); + private static final String SUB_SERVICE_SEPARATOR = "#"; + private static final String SERVICE_CODE_PARAM_NAME = "serviceCode"; + private static final String SMS_DATA_TOPIC = "sms-data-topic"; + private static final String SMS_DATA_TOPIC_PROFIX = "sendSms90-"; - public Object intercept(ActionInvocation invocation) throws ActionInvocationException { + static { + HAS_SUB_SERVICE_URIS.add("/property/transaction"); + } - Authority authority = getAuthority(invocation); - ActionContext context = invocation.getActionContext(); - HttpServletRequest request = context.getRequest(); - RestfulModelAndView ret = new RestfulModelAndView(); - ret.setViewType("rest"); - - try { - HttpCode httpCode = null; - if(!OpenConfig.getConfig().isOpenAllAuthority()) { - String token = request.getParameter("token"); - if(isNeedToken(authority)){ - httpCode = authorized(token, request); - }else if(StringUtils.isNotBlank(token)){ - ApiUser apiUser = parseApiUserByToken(FangjiaApiUtil.parse2Token(token)); - if(apiUser != null){ - User user = apiUserService.findUserById(apiUser.getId()); - AuthenticationBean.get(request, apiUser, user, null); - } - } - } - //功能方法没有设置权限或者有该方法权限 - if (authority == null || authority.role() == Role.NONE || null == httpCode) { - Object obj; - try{ - obj = invocation.invoke(); - }catch (Exception e){ - throw e; - } - return obj; - }else { - if(httpCode.getErrorCode() == 4003){ - BasicModel basicModel = BasicModel.buildBadRequestModel(httpCode.getErrorMessage().toString()); - ret.setModel(basicModel); - return ret; - }else{ - String msg = httpCode.getMessage() + "(" + httpCode.getErrorMessage() + ")"; - BasicModel basicModel = BasicModel.buildUnAuthorizedModel().setMsg(msg); - ret.setModel(basicModel); - return ret; - } - - } - } catch (Exception e) { - LOGGER.error("Authentication error : ", e); - ret.setModel(BasicModel.buildServerErrorModel()); - ret.setViewParam("code", HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - return ret; - } - - } - - private boolean isNeedToken(Authority authority){ - return authority != null && authority.role() != null && authority.role() != Role.NONE; - } - - private boolean isReachUpperLimit(ApiUserAuthority auth, String uri, String serviceCode) { - - if (auth == null || auth.getLimitCountMap() == null) { - return false; - } - Date visitDate = DateUtil.truncateDay(new Date()); - Integer upperLimit = auth.getLimitCountMap().get(uri); - Long apiVisitCount; - if (upperLimit != null && upperLimit > 0) { - apiVisitCount = apiVisitCountService.findApiVisitCount(auth.getUserId(), uri, null, visitDate); - if(apiVisitCount >= upperLimit){ - return true; - } - } - if(hasSubService(uri) && StringUtils.isNotBlank(serviceCode)){ - upperLimit = auth.getLimitCountMap().get(uri + SUB_SERVICE_SEPARATOR + serviceCode); - if (upperLimit != null && upperLimit > 0) { - apiVisitCount = apiVisitCountService.findApiVisitCount(auth.getUserId(), uri, serviceCode, visitDate); - if(apiVisitCount >= upperLimit){ - return true; - } - } - } - return false; - } - - private boolean isReachDeadline(ApiUserAuthority auth, String uri, String serviceCode){ - - if(auth.getDeadlineMap() == null){ - return false; - } - Date deadline = auth.getDeadlineMap().get(uri); - if(null != deadline && deadline.before(new Date())){ - return true; - } - if(hasSubService(uri) && StringUtils.isNotBlank(serviceCode)){ - deadline = auth.getDeadlineMap().get(uri + SUB_SERVICE_SEPARATOR + serviceCode); - if(null != deadline && deadline.before(new Date())){ - return true; - } - } - - return false; - } - - private boolean isReachSumLimit(ApiUserAuthority auth, String uri, String serviceCode) { - - if (auth == null || auth.getTotalCountMap() == null) { - return false; - } - - if(auth.getTotalCountMap() != null && auth.getTotalCountMap().get(uri) != null){ - Integer totalLimit = auth.getTotalCountMap().get(uri); - Long totalApiVisitCount; - if(totalLimit != null && totalLimit > 0){ - totalApiVisitCount = apiVisitCountService.findApiVisitTotalCount(auth.getUserId(), uri, serviceCode); - if(totalApiVisitCount >= totalLimit){ - return true; - } - } - } - if(hasSubService(uri) && StringUtils.isNotBlank(serviceCode)){ - Integer totalLimit = auth.getTotalCountMap().get(uri + SUB_SERVICE_SEPARATOR + serviceCode); - if(totalLimit != null && totalLimit > 0){ - Long totalApiVisitCount = apiVisitCountService.findApiVisitTotalCount(auth.getUserId(), uri, serviceCode); - if(totalApiVisitCount >= totalLimit){ - return true; - } - } - - } - return false; - } - - private Authority getAuthority(ActionInvocation invocation) { - Authority authority; - // 获取方法上的权限注解 - authority = invocation.getAction().getActionMethod().getAnnotation(Authority.class); - if (null != authority) { - return authority; - } - // 获取类上的权限注解 - authority = invocation.getControllerInstance().getClass().getAnnotation(Authority.class); - return authority; - } - - - /** - * 检验是否有访问该Action的权限 - * - * @param tokenStr - * @param request - * @return - * @throws Exception - */ - private HttpCode authorized(String tokenStr, HttpServletRequest request) throws Exception { - - // 检查是否为api用户 - HttpCode ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD); - Token token = FangjiaApiUtil.parse2Token(tokenStr); - ApiUser apiUser = parseApiUserByToken(token); - if (null == apiUser) { - return ret; - } - if(apiUser.getDeadTime() != null && DateUtil.truncateDay(new Date()).after(apiUser.getDeadTime())){ - return new HttpCode(OpenHttpCodeEnum.USER_EXPIRED); - } - if(!isOldUser(apiUser) && isExpired(token)){ - return new HttpCode(OpenHttpCodeEnum.TOKEN_EXPIRED); - } - if (1 == apiUser.getStatus()) { - return new HttpCode(OpenHttpCodeEnum.AUTH_FAILD, "你的账户已失效"); - } - if(StringUtils.isNotBlank(apiUser.getIp())){ - String ip = AnalyticsUtil.getIpAddress(request); - if(!isAuthIp(ip,apiUser)){ - ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD,"ip[" + ip + "]无权限访问API"); - return ret; - } - } - - String uri = request.getRequestURI(); - ApiUserAuthority auth = this.apiUserAuthorityService.findByUserId(apiUser.getId()); - if(auth != null){ - User user = apiUserService.findUserById(apiUser.getId()); - AuthenticationBean.get(request, apiUser, user, auth); - } - uri = OpenConfig.getConfig().isDevelopmentEnvironment() ? uri.replace("/fangjia-open", "") : uri; - // 检查是否有访问该Action的权限 - boolean authAction = null != auth && auth.getOpenResourseUris().contains(uri); - String cityName = request.getParameter("city"); - if(StringUtils.isBlank(cityName)){ - cityName = request.getParameter("cityName"); - } - if (StringUtils.isNotBlank(cityName)) { - boolean authCity = StringUtils.isNotBlank(apiUser.getCity()) && !StringUtils.equalsIgnoreCase(apiUser.getCity(), "all"); - if(authCity){ - cityName = request.getParameter("city"); - cityName = RegionData.formatCity(cityName); - if(!RegionData.isCity(cityName)){ - ret = new HttpCode(OpenHttpCodeEnum.ARGUMENT_INVALID); - ret.setErrorMessage("城市非法"); - return ret; - } - } - } - boolean authCity = isAuthCity(cityName, apiUser); - if (!authCity) { - ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD, "您未开通城市" + (StringUtils.isNotBlank(cityName) ? cityName : StringUtils.EMPTY) + "的权限"); - } - if (authAction && authCity) { - if(hasSubService(uri)){ - List serviceCodes = getServiceCode(request); - for(String serviceCode : serviceCodes){ - if(!auth.getOpenResourseUris().contains(uri + SUB_SERVICE_SEPARATOR + serviceCode)){ - ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD ,"无权限访问服务:" + serviceCode); - return ret; - } - if(isReachDeadline(auth, uri, serviceCode)){ - ret = new HttpCode(OpenHttpCodeEnum.SERVICE_EXPIRED, serviceCode + "服务已过期"); - return ret; - } - if(isReachUpperLimit(auth, uri, serviceCode)){ - ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT ,serviceCode + "今日已达到配额上限"); - return ret; - } - // 检测是否达到总数访问上限 - if (isReachSumLimit(auth, uri, serviceCode)) { - ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, serviceCode + "已达到配额上限"); - return ret; - } - } - - }else{ - if(isReachDeadline(auth, uri, null)){ - ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, "服务已过期"); - return ret; - } - // 检测是否达到今天访问上限 - if (isReachUpperLimit(auth, uri, null)) { - ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, "今日已达到配额上限"); - return ret; - } - // 检测是否达到总数访问上限 - if (isReachSumLimit(auth, uri, null)) { - ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, "已达到配额上限"); - return ret; - } - } - return null; - } - - return ret; - } - - - - /** - * - * @param request - * @return + /** + * token过期时间 单位:s */ - private List getServiceCode(HttpServletRequest request){ + private static final long TOKEN_EXPIRED_TIME = 60 * 60 * 2; - String serviceCode = request.getParameter(SERVICE_CODE_PARAM_NAME); - if(StringUtils.isBlank(serviceCode)){ - return Collections.emptyList(); - } - return Arrays.asList(serviceCode.split(",|,")); - } - /** - * 判断该API是否拥有子权限 - * @param uri - * @return + public Object intercept(ActionInvocation invocation) throws ActionInvocationException { + + Authority authority = getAuthority(invocation); + ActionContext context = invocation.getActionContext(); + HttpServletRequest request = context.getRequest(); + RestfulModelAndView ret = new RestfulModelAndView(); + ret.setViewType("rest"); + + try { + HttpCode httpCode = null; + if (!OpenConfig.getConfig().isOpenAllAuthority()) { + String token = request.getParameter("token"); + if (isNeedToken(authority)) { + httpCode = authorized(token, request); + } else if (StringUtils.isNotBlank(token)) { + ApiUser apiUser = parseApiUserByToken(FangjiaApiUtil.parse2Token(token)); + if (apiUser != null) { + User user = apiUserService.findUserById(apiUser.getId()); + AuthenticationBean.get(request, apiUser, user, null); + } + } + } + //功能方法没有设置权限或者有该方法权限 + if (authority == null || authority.role() == Role.NONE || null == httpCode) { + Object obj; + try { + obj = invocation.invoke(); + } catch (Exception e) { + throw e; + } + return obj; + } else { + if (httpCode.getErrorCode() == 4003) { + BasicModel basicModel = BasicModel.buildBadRequestModel(httpCode.getErrorMessage().toString()); + ret.setModel(basicModel); + return ret; + } else { + String msg = httpCode.getMessage() + "(" + httpCode.getErrorMessage() + ")"; + BasicModel basicModel = BasicModel.buildUnAuthorizedModel().setMsg(msg); + ret.setModel(basicModel); + return ret; + } + + } + } catch (Exception e) { + LOGGER.error("Authentication error : ", e); + ret.setModel(BasicModel.buildServerErrorModel()); + ret.setViewParam("code", HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return ret; + } + + } + + private boolean isNeedToken(Authority authority) { + return authority != null && authority.role() != null && authority.role() != Role.NONE; + } + + private boolean isReachUpperLimit(ApiUserAuthority auth, String uri, String serviceCode) { + + if (auth == null || auth.getLimitCountMap() == null) { + return false; + } + Date visitDate = DateUtil.truncateDay(new Date()); + Integer upperLimit = auth.getLimitCountMap().get(uri); + Long apiVisitCount; + if (upperLimit != null && upperLimit > 0) { + apiVisitCount = apiVisitCountService.findApiVisitCount(auth.getUserId(), uri, null, visitDate); + if (apiVisitCount >= upperLimit) { + return true; + } + } + if (hasSubService(uri) && StringUtils.isNotBlank(serviceCode)) { + upperLimit = auth.getLimitCountMap().get(uri + SUB_SERVICE_SEPARATOR + serviceCode); + if (upperLimit != null && upperLimit > 0) { + apiVisitCount = apiVisitCountService.findApiVisitCount(auth.getUserId(), uri, serviceCode, visitDate); + if (apiVisitCount >= upperLimit) { + return true; + } + } + } + return false; + } + + private boolean isReachDeadline(ApiUserAuthority auth, String uri, String serviceCode) { + + if (auth.getDeadlineMap() == null) { + return false; + } + Date deadline = auth.getDeadlineMap().get(uri); + if (null != deadline && deadline.before(new Date())) { + return true; + } + if (hasSubService(uri) && StringUtils.isNotBlank(serviceCode)) { + deadline = auth.getDeadlineMap().get(uri + SUB_SERVICE_SEPARATOR + serviceCode); + if (null != deadline && deadline.before(new Date())) { + return true; + } + } + + return false; + } + + private boolean isReachSumLimit(ApiUserAuthority auth, String uri, String serviceCode) { + + if (auth == null || auth.getTotalCountMap() == null) { + return false; + } + + if (auth.getTotalCountMap() != null && auth.getTotalCountMap().get(uri) != null) { + Integer totalLimit = auth.getTotalCountMap().get(uri); + Long totalApiVisitCount; + if (totalLimit != null && totalLimit > 0) { + totalApiVisitCount = apiVisitCountService.findApiVisitTotalCount(auth.getUserId(), uri, serviceCode); + if (totalApiVisitCount >= totalLimit) { + return true; + } + } + } + if (hasSubService(uri) && StringUtils.isNotBlank(serviceCode)) { + Integer totalLimit = auth.getTotalCountMap().get(uri + SUB_SERVICE_SEPARATOR + serviceCode); + if (totalLimit != null && totalLimit > 0) { + Long totalApiVisitCount = apiVisitCountService.findApiVisitTotalCount(auth.getUserId(), uri, serviceCode); + if (totalApiVisitCount >= totalLimit) { + return true; + } + } + + } + return false; + } + + private boolean isReach90SumLimit(ApiUserAuthority auth, String uri, String serviceCode) { + + if (auth == null || auth.getTotalCountMap() == null) { + return false; + } + + if (auth.getTotalCountMap() != null && auth.getTotalCountMap().get(uri) != null) { + Integer totalLimit = auth.getTotalCountMap().get(uri); + Long totalApiVisitCount; + if (totalLimit != null && totalLimit > 0) { + totalApiVisitCount = apiVisitCountService.findApiVisitTotalCount(auth.getUserId(), uri, serviceCode); + if (totalApiVisitCount.intValue() == (int) (totalLimit * 0.9)) { + return true; + } + } + } + if (hasSubService(uri) && StringUtils.isNotBlank(serviceCode)) { + Integer totalLimit = auth.getTotalCountMap().get(uri + SUB_SERVICE_SEPARATOR + serviceCode); + if (totalLimit != null && totalLimit > 0) { + Long totalApiVisitCount = apiVisitCountService.findApiVisitTotalCount(auth.getUserId(), uri, serviceCode); + if (totalApiVisitCount.intValue() == (int) (totalLimit * 0.9)) { + return true; + } + } + + } + return false; + } + + private Authority getAuthority(ActionInvocation invocation) { + Authority authority; + // 获取方法上的权限注解 + authority = invocation.getAction().getActionMethod().getAnnotation(Authority.class); + if (null != authority) { + return authority; + } + // 获取类上的权限注解 + authority = invocation.getControllerInstance().getClass().getAnnotation(Authority.class); + return authority; + } + + + /** + * 检验是否有访问该Action的权限 + * + * @param tokenStr + * @param request + * @return + * @throws Exception */ - private boolean hasSubService(String uri){ - return HAS_SUB_SERVICE_URIS.contains(uri); - } + private HttpCode authorized(String tokenStr, HttpServletRequest request) throws Exception { - /** - * 2016年06月06日以前的用户是老用户,token不过期 - * @param apiUser - * @return - */ - private boolean isOldUser(ApiUser apiUser){ - return OLD_USER_SPLITTED_DATE.after(apiUser.getCreationDate()); - } + // 检查是否为api用户 + HttpCode ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD); + Token token = FangjiaApiUtil.parse2Token(tokenStr); + ApiUser apiUser = parseApiUserByToken(token); + if (null == apiUser) { + return ret; + } + if (apiUser.getDeadTime() != null && DateUtil.truncateDay(new Date()).after(apiUser.getDeadTime())) { + return new HttpCode(OpenHttpCodeEnum.USER_EXPIRED); + } + if (!isOldUser(apiUser) && isExpired(token)) { + return new HttpCode(OpenHttpCodeEnum.TOKEN_EXPIRED); + } + if (1 == apiUser.getStatus()) { + return new HttpCode(OpenHttpCodeEnum.AUTH_FAILD, "你的账户已失效"); + } + if (StringUtils.isNotBlank(apiUser.getIp())) { + String ip = AnalyticsUtil.getIpAddress(request); + if (!isAuthIp(ip, apiUser)) { + ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD, "ip[" + ip + "]无权限访问API"); + return ret; + } + } - /** - * 判断Token是否过期 - * @param token - * @return - */ - private boolean isExpired(Token token){ - return System.currentTimeMillis() / 1000 - token.getTimestamp() > TOKEN_EXPIRED_TIME; - } + String uri = request.getRequestURI(); + ApiUserAuthority auth = this.apiUserAuthorityService.findByUserId(apiUser.getId()); + User user = apiUserService.findUserById(apiUser.getId()); + if (auth != null) { + AuthenticationBean.get(request, apiUser, user, auth); + } + uri = OpenConfig.getConfig().isDevelopmentEnvironment() ? uri.replace("/fangjia-open", "") : uri; + // 检查是否有访问该Action的权限 + boolean authAction = null != auth && auth.getOpenResourseUris().contains(uri); + String cityName = request.getParameter("city"); + if (StringUtils.isBlank(cityName)) { + cityName = request.getParameter("cityName"); + } + if (StringUtils.isNotBlank(cityName)) { + boolean authCity = StringUtils.isNotBlank(apiUser.getCity()) && !StringUtils.equalsIgnoreCase(apiUser.getCity(), "all"); + if (authCity) { + cityName = request.getParameter("city"); + cityName = RegionData.formatCity(cityName); + if (!RegionData.isCity(cityName)) { + ret = new HttpCode(OpenHttpCodeEnum.ARGUMENT_INVALID); + ret.setErrorMessage("城市非法"); + return ret; + } + } + } + boolean authCity = isAuthCity(cityName, apiUser); + if (!authCity) { + ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD, "您未开通城市" + (StringUtils.isNotBlank(cityName) ? cityName : StringUtils.EMPTY) + "的权限"); + } + if (authAction && authCity) { + if (hasSubService(uri)) { + List serviceCodes = getServiceCode(request); + for (String serviceCode : serviceCodes) { + if (!auth.getOpenResourseUris().contains(uri + SUB_SERVICE_SEPARATOR + serviceCode)) { + ret = new HttpCode(OpenHttpCodeEnum.AUTH_FAILD, "无权限访问服务:" + serviceCode); + return ret; + } + if (isReachDeadline(auth, uri, serviceCode)) { + ret = new HttpCode(OpenHttpCodeEnum.SERVICE_EXPIRED, serviceCode + "服务已过期"); + return ret; + } + if (isReachUpperLimit(auth, uri, serviceCode)) { + ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, serviceCode + "今日已达到配额上限"); + return ret; + } + // 检测是否达到总数访问上限 + if (isReachSumLimit(auth, uri, serviceCode)) { + ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, serviceCode + "已达到配额上限"); + return ret; + } + // 检测是否达到总数的90% + if (isReach90SumLimit(auth, uri, serviceCode)) { + kafkaProducerUtils.send(SMS_DATA_TOPIC, SMS_DATA_TOPIC_PROFIX + apiUser.getPhone() + "-" + user.getUserName() + "-" + uri); + } + } - /** - * - * @param ip 验证客户IP是否在注册的白名单中 - * @param apiUser - * @return - */ - private boolean isAuthIp(String ip,ApiUser apiUser){ - if(StringUtils.isBlank(ip) || StringUtils.isBlank(apiUser.getIp())){ - return false; - } - String[] ips = apiUser.getIp().split("\n"); - for(String authIp:ips){ - if(StringUtils.isNotBlank(authIp) && ip.startsWith(authIp.replaceAll("\\s", ""))){ - return true; - } - } - return false; - } + } else { + if (isReachDeadline(auth, uri, null)) { + ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, "服务已过期"); + return ret; + } + // 检测是否达到今天访问上限 + if (isReachUpperLimit(auth, uri, null)) { + ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, "今日已达到配额上限"); + return ret; + } + // 检测是否达到总数访问上限 + if (isReachSumLimit(auth, uri, null)) { + ret = new HttpCode(OpenHttpCodeEnum.UPPER_LIMIT, "已达到配额上限"); + return ret; + } + // 检测是否达到总数的90% + if (isReach90SumLimit(auth, uri, null)) { + kafkaProducerUtils.send(SMS_DATA_TOPIC, SMS_DATA_TOPIC_PROFIX + apiUser.getPhone() + "-" + user.getUserName() + "-" + uri); + } + } + return null; + } - /** - * 是否有权限访问该城市 - * - * @param cityName - * @param apiUser - * @return - */ - private boolean isAuthCity(String cityName, ApiUser apiUser) { - // 若访问当前接口不需要城市参数,则返回true - if (StringUtils.isBlank(cityName)) { - return true; - } - if(!RegionData.isCity(cityName)){ - String city = RegionData.formatCity(cityName); - if(null != city){ - cityName = city; - } - } - // 若当前接口需要城市,检查是否有访问当前城市的权限 - boolean authCity = StringUtils.isNotBlank(apiUser.getCity()) && !StringUtils.equalsIgnoreCase(apiUser.getCity(), "all"); - if (authCity) { - ServerArea city = ServerAreaData.getServerAreaByDisplayDefaultNull(cityName); - if (null != city) { - return apiUser.getCity().contains(city.getSpell()); - } - } - return true; - } - - private ApiUser parseApiUserByToken(Token token){ - - if(token == null){ - return null; - } - ApiUser apiUser = apiUserService.findApiUserById(token.getUserId()); - if(apiUser == null){ - return null; - } - if(!apiUser.getAppKey().equals(token.getAppKey())){ - return null; - } - return apiUser; - } + return ret; + } - /** - * 新版token验证 - * - * @param token - * @return - */ - private ApiUser checkNewAuthorized(String token) { + /** + * @param request + * @return + */ + private List getServiceCode(HttpServletRequest request) { - Map tokenMap = FangjiaApiUtil.parseToken(token); - if (tokenMap == null) { - return null; - } - // token验证后,拿取出的字段再去数据库验证一遍 - if (StringUtils.isNotBlank(tokenMap.get("userid")) && !"null".equals(tokenMap.get("userid"))) { - ApiUser apiUser = apiUserService.findApiUserById(Long.parseLong(tokenMap.get("userid"))); - if (apiUser != null) { - if (tokenMap.get("appKey").equals(apiUser.getAppKey())) { - return apiUser; - } - } - } - return null; - } + String serviceCode = request.getParameter(SERVICE_CODE_PARAM_NAME); + if (StringUtils.isBlank(serviceCode)) { + return Collections.emptyList(); + } + return Arrays.asList(serviceCode.split(",|,")); + } + + /** + * 判断该API是否拥有子权限 + * + * @param uri + * @return + */ + private boolean hasSubService(String uri) { + return HAS_SUB_SERVICE_URIS.contains(uri); + } + + /** + * 2016年06月06日以前的用户是老用户,token不过期 + * + * @param apiUser + * @return + */ + private boolean isOldUser(ApiUser apiUser) { + return OLD_USER_SPLITTED_DATE.after(apiUser.getCreationDate()); + } + + /** + * 判断Token是否过期 + * + * @param token + * @return + */ + private boolean isExpired(Token token) { + return System.currentTimeMillis() / 1000 - token.getTimestamp() > TOKEN_EXPIRED_TIME; + } + + /** + * @param ip 验证客户IP是否在注册的白名单中 + * @param apiUser + * @return + */ + private boolean isAuthIp(String ip, ApiUser apiUser) { + if (StringUtils.isBlank(ip) || StringUtils.isBlank(apiUser.getIp())) { + return false; + } + String[] ips = apiUser.getIp().split("\n"); + for (String authIp : ips) { + if (StringUtils.isNotBlank(authIp) && ip.startsWith(authIp.replaceAll("\\s", ""))) { + return true; + } + } + return false; + } + + /** + * 是否有权限访问该城市 + * + * @param cityName + * @param apiUser + * @return + */ + private boolean isAuthCity(String cityName, ApiUser apiUser) { + // 若访问当前接口不需要城市参数,则返回true + if (StringUtils.isBlank(cityName)) { + return true; + } + if (!RegionData.isCity(cityName)) { + String city = RegionData.formatCity(cityName); + if (null != city) { + cityName = city; + } + } + // 若当前接口需要城市,检查是否有访问当前城市的权限 + boolean authCity = StringUtils.isNotBlank(apiUser.getCity()) && !StringUtils.equalsIgnoreCase(apiUser.getCity(), "all"); + if (authCity) { + ServerArea city = ServerAreaData.getServerAreaByDisplayDefaultNull(cityName); + if (null != city) { + return apiUser.getCity().contains(city.getSpell()); + } + } + return true; + } + + private ApiUser parseApiUserByToken(Token token) { + + if (token == null) { + return null; + } + ApiUser apiUser = apiUserService.findApiUserById(token.getUserId()); + if (apiUser == null) { + return null; + } + if (!apiUser.getAppKey().equals(token.getAppKey())) { + return null; + } + return apiUser; + } - public void setApiUserService(ApiUserService apiUserService) { - this.apiUserService = apiUserService; - } + /** + * 新版token验证 + * + * @param token + * @return + */ + private ApiUser checkNewAuthorized(String token) { - public void setApiUserAuthorityService(ApiUserAuthorityService apiUserAuthorityService) { - this.apiUserAuthorityService = apiUserAuthorityService; - } + Map tokenMap = FangjiaApiUtil.parseToken(token); + if (tokenMap == null) { + return null; + } + // token验证后,拿取出的字段再去数据库验证一遍 + if (StringUtils.isNotBlank(tokenMap.get("userid")) && !"null".equals(tokenMap.get("userid"))) { + ApiUser apiUser = apiUserService.findApiUserById(Long.parseLong(tokenMap.get("userid"))); + if (apiUser != null) { + if (tokenMap.get("appKey").equals(apiUser.getAppKey())) { + return apiUser; + } + } + } + return null; + } - public void setApiVisitCountService(ApiVisitCountService apiVisitCountService) { - this.apiVisitCountService = apiVisitCountService; - } + public void setApiUserService(ApiUserService apiUserService) { + this.apiUserService = apiUserService; + } + + public void setApiUserAuthorityService(ApiUserAuthorityService apiUserAuthorityService) { + this.apiUserAuthorityService = apiUserAuthorityService; + } + + public void setApiVisitCountService(ApiVisitCountService apiVisitCountService) { + this.apiVisitCountService = apiVisitCountService; + } + + public void setKafkaProducerUtils(KafkaProducerUtils kafkaProducerUtils) { + this.kafkaProducerUtils = kafkaProducerUtils; + } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java b/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java index 6056a3003..b5a00d80f 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java @@ -2,6 +2,7 @@ package com.fangjia.service.util.kafka; import com.alibaba.fastjson.JSONObject; import com.fangjia.dal.mongo.tool.model.OpenUriLog; +import org.apache.commons.lang3.StringUtils; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.clients.producer.ProducerRecord; @@ -39,6 +40,12 @@ public class KafkaProducerUtils implements DisposableBean { ex.printStackTrace(); } } + public void send(String topic,String msg){ + if (StringUtils.isNotBlank(topic) && StringUtils.isNotBlank(msg)){ + ProducerRecord record = new ProducerRecord(topic, msg); + this.producer.send(record); + } + } @Override public void destroy() throws Exception { From d983a7992784feb3c7f7e56d852811c1b8cefb05 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Tue, 24 Sep 2024 16:08:57 +0800 Subject: [PATCH 024/115] =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy index 4bb2aff5a..668fcbb74 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy @@ -70,6 +70,10 @@ class SynchDistrictPrice extends BaseBatch{ data.put("estate_type",d.property_type) data.put("s_date", SHORT_DATE) data.put("url", d.url) + data.put("id",d.id) + data.put("ownership_type",d.ownership_type) + data.put("property_type",d.property_type) + data.put("build_type",d.build_type) data.put("c_date", new Date()) data.put("m_date", new Date()) rets << data From 5dc42248470276e3fe4e1388e35fa4ae44133ce3 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Tue, 24 Sep 2024 17:49:42 +0800 Subject: [PATCH 025/115] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E5=9D=87?= =?UTF-8?q?=E4=BB=B7=E5=8C=B9=E9=85=8D=EF=BC=8C=E7=94=A8=E6=96=B0=E5=8C=B9?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data_handle/ThirdPriceMappingBatch.groovy | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy new file mode 100644 index 000000000..9c5cccb47 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy @@ -0,0 +1,150 @@ +package com.fangjia.script.gj.data_handle + +import com.fangjia.script.BaseBatch +import com.fangjia.script.BatchOwner +import com.fangjia.script.Watcher +import com.fangjia.script.gj.district.FangjiaClientUtils +import com.fangjia.script.util.CommonUtils +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection + +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 + +/** + * 第三方小区与我们小区映射关系表 + */ +@BatchOwner(Watcher.GaoJuan) +class ThirdPriceMappingBatch extends BaseBatch{ + + public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) + + final DBCollection thirdPartyPriceColl = MongoUtils.getCollectionByName("fangjia_craw", "third_party_price", "192.168.0.235", 27018) + + final DBCollection thirdSeaweedMappingColl = MongoUtils.getCollectionByName("fangjia_craw", "third_seaweed_mapping", "192.168.0.235", 27018) + + def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); + + static main(args) { + runBatch(new ThirdPriceMappingBatch(), args); + } + + @Override + public void process(Object args) { + //将新增数据同步过来 + addNemCommunity() + //接口进行匹配 + match() + } + + def match(){ + def citys = CommonUtils.findAllCity() + for(def c : citys){ + def query = new BasicDBObject("city", c).append("match_id", new BasicDBObject('$exists', false)) + def noMatchDatas = thirdSeaweedMappingColl.find(query).toList() + matchByCity(c, noMatchDatas) + } + + } + + def matchByCity(def c, def noMatchDatas){ + def totalCount = new AtomicLong() + def addCount = new AtomicLong() + final CountDownLatch latch = new CountDownLatch(noMatchDatas.size()) + def total = noMatchDatas.size() + for(def i=0;i + udata.put(k,v) + } + udata.put("m_date", new Date()) + thirdSeaweedMappingColl.update(query, new BasicDBObject('$set', udata)) + }else{ + sd.put("m_date", new Date()) + thirdSeaweedMappingColl.save(sd) + addCount.addAndGet(1) + } + + } catch (Exception e) { + e.printStackTrace() + } finally { + latch.countDown() + } + } + }); + } + latch.await() + return addCount.get(); + } +} From 3854a5589f2d221376c226340c3d3ec618f7e275 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Tue, 24 Sep 2024 18:04:16 +0800 Subject: [PATCH 026/115] update --- .../fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy index 9c5cccb47..dd8f3e1a6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy @@ -118,7 +118,7 @@ class ThirdPriceMappingBatch extends BaseBatch{ try{ sd.put("district", sd.region) sd.removeField("region") - sd.removeField("url") +// sd.removeField("url") sd.removeField("s_date") totalCount.addAndGet(1) def query = new BasicDBObject("url", sd.url) From 60ed1fc372f5f02b6a9261d74fa7c77eb6b91ee3 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Wed, 25 Sep 2024 11:14:42 +0800 Subject: [PATCH 027/115] =?UTF-8?q?=E5=8C=B9=E9=85=8D19=E6=8D=A293?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data_handle/ThirdPriceMappingBatch.groovy | 72 +++++++++++++++++-- .../gj/district/FangjiaClientUtils.groovy | 4 +- 2 files changed, 70 insertions(+), 6 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy index dd8f3e1a6..2d7515aa7 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/ThirdPriceMappingBatch.groovy @@ -3,12 +3,15 @@ package com.fangjia.script.gj.data_handle 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.district.FangjiaClientUtils import com.fangjia.script.util.CommonUtils import com.fangjia.script.util.DateUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection +import org.bson.types.ObjectId import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.CountDownLatch @@ -28,6 +31,9 @@ class ThirdPriceMappingBatch extends BaseBatch{ final DBCollection thirdSeaweedMappingColl = MongoUtils.getCollectionByName("fangjia_craw", "third_seaweed_mapping", "192.168.0.235", 27018) + + final DBCollection dataProcessColl = MongoUtils.getCollectionByName("fangjia_craw", "data_process", "192.168.0.235", 27018) + def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); static main(args) { @@ -36,10 +42,12 @@ class ThirdPriceMappingBatch extends BaseBatch{ @Override public void process(Object args) { - //将新增数据同步过来 - addNemCommunity() - //接口进行匹配 +// //将新增数据同步过来 +// addNemCommunity() +// //接口进行匹配 match() + +// addOldMatchResult() } def match(){ @@ -63,7 +71,11 @@ class ThirdPriceMappingBatch extends BaseBatch{ void run() { try{ addCount.addAndGet(1) - def address = nmd.city + nmd.district + nmd.name + def address = nmd.city + if(nmd.district){ + address = address + nmd.district + } + address = address + nmd.name def jsonObject = FangjiaClientUtils.newMatch(nmd.city, address, "property", true) if(jsonObject) { def udata = new BasicDBObject() @@ -147,4 +159,56 @@ class ThirdPriceMappingBatch extends BaseBatch{ latch.await() return addCount.get(); } + + def addOldMatchResult(){ + def citys = ["上海"]//CommonUtils.findAllCity() + def keys = new BasicDBObject() + keys.put("_id", 1) + + for(def c : citys){ + def datas = thirdSeaweedMappingColl.find(new BasicDBObject("city", c).append("old_match_id", new BasicDBObject('$exists', false)), keys).toList() + println c +" 待关联数据:"+datas.size() + findResultFromDB(c, datas) + println c + " 关联数据结束 "+DateUtils.formatDateByPattern(new Date(),"yyyy-MM-dd HH:mm:ss") + } + } + + def findResultFromDB(city, datas){ + def addCount = new AtomicLong() + final CountDownLatch latch = new CountDownLatch(datas.size()) + def total = datas.size() + for(def i=0;i Date: Wed, 25 Sep 2024 16:02:00 +0800 Subject: [PATCH 028/115] =?UTF-8?q?=E8=B4=A2=E5=8A=9B=E8=AF=84=E7=BA=A7?= =?UTF-8?q?=E5=8A=A0=E5=8F=82=E6=95=B0=EF=BC=9Aid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/open/controllers/AddressController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java index a484fd8cf..bbceb44ab 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddressController.java @@ -2246,8 +2246,8 @@ public class AddressController { public Object financialRatingAction(CommunitySummaryRequestDto model) { RestfulModelAndView mav = new RestfulModelAndView(); - if (StringUtils.isBlank(model.getAddress()) || "null".equals(model.getAddress())) { - mav.setModel(BasicModel.buildBadRequestModel("地址不能为空")); + if ((StringUtils.isBlank(model.getAddress()) || "null".equals(model.getAddress())) && StringUtils.isBlank(model.getId())) { + mav.setModel(BasicModel.buildBadRequestModel("地址和id不能同时为空")); return mav; } @@ -2259,11 +2259,13 @@ public class AddressController { JSONObject reqBody = new JSONObject(); reqBody.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity()); - reqBody.put("address", model.getAddress()); + reqBody.put("address", StringUtils.isNotBlank(model.getAddress()) ? model.getAddress() : ""); + reqBody.put("seaweedId", StringUtils.isNotBlank(model.getId()) ? model.getId() : ""); reqBody.put("area", model.getArea()); reqBody.put("maxFloor", model.getMaxFloor()); reqBody.put("housePurpose", model.getHousePurpose()); reqBody.put("memo", model.getMemo()); + reqBody.put("showOther", false); String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/financialRating", reqBody, headers, "UTF-8"); if (result != null) { try { From c236962d2e9c23c9c8590131bf044adc61b2492c Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Thu, 26 Sep 2024 15:34:25 +0800 Subject: [PATCH 029/115] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/script/gj/district/FangjiaClientUtils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3bf6c0dc5..15e4cc80b 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 @@ -248,7 +248,7 @@ class FangjiaClientUtils { def content = null def url = null; try { - address = address.replace("{","").replace("\\","") +// address = address.replace("{","").replace("\\","") url = "http://192.168.0.93:8080/FangJiaNlpService/match?address="+URLEncoder.encode(address,"UTF-8")+"&useMap=${useMap}" // url = "http://192.168.20.242:5001/match?address="+URLEncoder.encode(address,"UTF-8")+"&useMap=${useMap}" // url = "http://192.168.0.19:31080/FangJiaNlpService/match?address="+URLEncoder.encode(address,"UTF-8")+"&useMap=${useMap}" From a68c4ef9c4fac08818472964882191f0db46dd02 Mon Sep 17 00:00:00 2001 From: majintao Date: Thu, 26 Sep 2024 17:05:18 +0800 Subject: [PATCH 030/115] =?UTF-8?q?=E5=9F=8E=E5=B8=82=E3=80=81=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E3=80=81=E5=B0=8F=E5=8C=BA=E4=BB=B7=E6=A0=BC=E6=8C=87?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mongo/dao/PropertyStatsIndexDao.java | 9 ++++ .../mongo/dao/PropertyStatsIndexDaoImpl.java | 10 ++++ .../fangjia/open/model/StatsIndexModel.java | 32 ++++++++++-- .../fangjia/PropertyStatsIndexService.java | 12 +++++ .../PropertyStatsIndexServiceImpl.java | 52 +++++++++++++++++++ .../mongo/fangjia/StatsIndexService.java | 6 ++- .../mongo/fangjia/StatsIndexServiceImpl.java | 33 ++++++++++-- 7 files changed, 145 insertions(+), 9 deletions(-) create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDao.java create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDaoImpl.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java create mode 100644 projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDao.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDao.java new file mode 100644 index 000000000..c52e73f1e --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDao.java @@ -0,0 +1,9 @@ +package com.fangjia.dal.mongo.dao; + +import com.fangjia.dal.MongoDao; +import com.fangjia.dal.mongo.model.PropertyStatsIndex; +import com.fangjia.dal.mongo.model.StatsIndex; + +public interface PropertyStatsIndexDao extends MongoDao { + +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDaoImpl.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDaoImpl.java new file mode 100644 index 000000000..6c8e5f7b8 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/PropertyStatsIndexDaoImpl.java @@ -0,0 +1,10 @@ +package com.fangjia.dal.mongo.dao; + +import com.fangjia.dal.MongoDaoImpl; +import com.fangjia.dal.mongo.model.PropertyStatsIndex; +import com.fangjia.dal.mongo.model.StatsIndex; + + +public class PropertyStatsIndexDaoImpl extends MongoDaoImpl implements PropertyStatsIndexDao { + +} diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java index ec0d88a5a..3d9a4909c 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java @@ -10,7 +10,10 @@ public class StatsIndexModel { private String id; private String city; - + private String district; + private String name; + private String type; + private String yearmonth; private Integer source; @@ -216,7 +219,28 @@ public class StatsIndexModel { public void setIfNew(Integer ifNew) { this.ifNew = ifNew; } - - - + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java new file mode 100644 index 000000000..dfd0645bc --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java @@ -0,0 +1,12 @@ +package com.fangjia.service.mongo.fangjia; + +import com.fangjia.dal.mongo.model.PropertyStatsIndex; +import com.fangjia.dal.mongo.model.StatsIndex; + +import java.util.List; + +public interface PropertyStatsIndexService { + + PropertyStatsIndex findById(String id); + PropertyStatsIndex findStatsIndex(String city, String district, String name, String yearmonth, String cat); +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java new file mode 100644 index 000000000..73bea049a --- /dev/null +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java @@ -0,0 +1,52 @@ +package com.fangjia.service.mongo.fangjia; + +import com.fangjia.dal.QueryParam; +import com.fangjia.dal.SortParam; +import com.fangjia.dal.mongo.dao.PropertyStatsIndexDao; +import com.fangjia.dal.mongo.dao.StatsIndexDao; +import com.fangjia.dal.mongo.model.PropertyStatsIndex; +import com.fangjia.dal.mongo.model.StatsIndex; +import org.apache.commons.lang.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class PropertyStatsIndexServiceImpl implements PropertyStatsIndexService { + private PropertyStatsIndexDao propertyStatsIndexDao; + + @Override + public PropertyStatsIndex findById(String id) { + return propertyStatsIndexDao.findById(id); + } + + @Override + public PropertyStatsIndex findStatsIndex(String city, String district, String name, String yearmonth, String cat) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + if (StringUtils.isNotBlank(district)) { + params.add(new QueryParam("district", district)); + } + if (StringUtils.isNotBlank(name)) { + params.add(new QueryParam("name", name)); + } + if (StringUtils.isNotBlank(yearmonth)) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + if (("商铺").equals(cat)) { + params.add(new QueryParam("cat", "shop")); + } else if (("写字楼").equals(cat)) { + params.add(new QueryParam("cat", "office")); + } else { + params.add(new QueryParam("cat", "district")); + } + List sortParams = new ArrayList(); + sortParams.add(new SortParam("yearmonth", false)); + return propertyStatsIndexDao.findFirstByParams(params, sortParams); + } + + public void setPropertyStatsIndexDao(PropertyStatsIndexDao propertyStatsIndexDao) { + this.propertyStatsIndexDao = propertyStatsIndexDao; + } +} diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java index 2e048b298..16da71c9e 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java @@ -11,13 +11,15 @@ public interface StatsIndexService { StatsIndex findByName(String city, String yearmonth); List findAllStats(String city, String yearmonth, boolean order,String cat); - +// List findAllStats(String city, String district,String type, String yearmonth, boolean order,String cat); + int findAllStatsCount(String city, String name,String cat); void deleteById(String id); StatsIndex findLatestStstsIndex(String city, String yearmonth,String cat); - + StatsIndex findStatsIndex(String city,String district,String type,String name, String yearmonth,String cat); + public List findAllStatsNocat(String yearmonth,String cat,String source) ; Integer findEarliestMonth(String city, String cat, String source); diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java index 7cb8ee88a..2530942c6 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java @@ -42,8 +42,7 @@ public class StatsIndexServiceImpl implements StatsIndexService { } @Override - public List findAllStats(String city, String yearmonth, - boolean order, String cat) { + public List findAllStats(String city, String yearmonth, boolean order, String cat) { List params = new ArrayList(); if (StringUtils.isNotBlank(city)) { params.add(new QueryParam("city", city)); @@ -124,7 +123,35 @@ public class StatsIndexServiceImpl implements StatsIndexService { return statsIndexDao.findFirstByParams(params, sortParams); } - + @Override + public StatsIndex findStatsIndex(String city, String district, String type, String name, String yearmonth, String cat) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + if (StringUtils.isNotBlank(district)) { + params.add(new QueryParam("district", district)); + } + if (StringUtils.isNotBlank(type)) { + params.add(new QueryParam("type", type)); + } + if (StringUtils.isNotBlank(name)) { + params.add(new QueryParam("name", name)); + } + if (StringUtils.isNotBlank(yearmonth)) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + if (("商铺").equals(cat)) { + params.add(new QueryParam("cat", "shop")); + } else if (("写字楼").equals(cat)) { + params.add(new QueryParam("cat", "office")); + } else { + params.add(new QueryParam("cat", "district")); + } + List sortParams = new ArrayList(); + sortParams.add(new SortParam("yearmonth", false)); + return statsIndexDao.findFirstByParams(params, sortParams); + } @Override From ccb6c9ee9aefcdbc1e47414769f157ea6aba8360 Mon Sep 17 00:00:00 2001 From: majintao Date: Thu, 26 Sep 2024 17:05:25 +0800 Subject: [PATCH 031/115] =?UTF-8?q?=E5=9F=8E=E5=B8=82=E3=80=81=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E3=80=81=E5=B0=8F=E5=8C=BA=E4=BB=B7=E6=A0=BC=E6=8C=87?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mongo/model/PropertyStatsIndex.java | 282 ++++++ .../fangjia/dal/mongo/model/StatsIndex.java | 95 +- .../controllers/StatsIndexController.java | 819 ++++++++++-------- 3 files changed, 789 insertions(+), 407 deletions(-) create mode 100644 projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java new file mode 100644 index 000000000..71076ab65 --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java @@ -0,0 +1,282 @@ +package com.fangjia.dal.mongo.model; + +import com.fangjia.dal.MongoEntity; + +import javax.persistence.*; +import java.util.Date; + +/** + * 价格指数 + */ +@Entity +@Table(name = "fangjia_stat.property_stats_index") +public class PropertyStatsIndex implements MongoEntity{ + /** + * + */ + private static final long serialVersionUID = -9102764355476337768L; + + private String id; + + private String city; + + private String district; + + private String name; + + private String yearmonth; + + private Integer source; + + private String remark; + + private Double chain; + + private Double yeartoyear; + + private Double fixedbase; + + private Double belowChain; + + private Double belowYeartoyear; + + private Double belowFixedbase; + + private Double amongChain; + + private Double amongYeartoyear; + + private Double amongFixedbase; + + private Double aboveChain; + + private Double aboveYeartoyear; + + private Double aboveFixedbase; + + private Date cDate; + + private String cat; + + private Double fangIndex; + + private Double fangChain; + + private String type; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "_id") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Column(name = "city") + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @Column(name = "district") + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + + @Column(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "c_date") + public Date getcDate() { + return cDate; + } + + public void setcDate(Date cDate) { + this.cDate = cDate; + } + + @Column(name = "yearmonth") + public String getYearmonth() { + return yearmonth; + } + + public void setYearmonth(String yearmonth) { + this.yearmonth = yearmonth; + } + + @Column(name = "source") + public Integer getSource() { + return source; + } + + public void setSource(Integer source) { + this.source = source; + } + + @Column(name = "remark") + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + @Column(name = "below_chain") + public Double getBelowChain() { + return belowChain; + } + + public void setBelowChain(Double belowChain) { + this.belowChain = belowChain; + } + + @Column(name = "below_yeartoyear") + public Double getBelowYeartoyear() { + return belowYeartoyear; + } + + public void setBelowYeartoyear(Double belowYeartoyear) { + this.belowYeartoyear = belowYeartoyear; + } + + @Column(name = "below_fixedbase") + public Double getBelowFixedbase() { + return belowFixedbase; + } + + public void setBelowFixedbase(Double belowFixedbase) { + this.belowFixedbase = belowFixedbase; + } + + @Column(name = "among_chain") + public Double getAmongChain() { + return amongChain; + } + + public void setAmongChain(Double amongChain) { + this.amongChain = amongChain; + } + + @Column(name = "among_yeartoyear") + public Double getAmongYeartoyear() { + return amongYeartoyear; + } + + public void setAmongYeartoyear(Double amongYeartoyear) { + this.amongYeartoyear = amongYeartoyear; + } + + @Column(name = "among_fixedbase") + public Double getAmongFixedbase() { + return amongFixedbase; + } + + public void setAmongFixedbase(Double amongFixedbase) { + this.amongFixedbase = amongFixedbase; + } + + @Column(name = "above_chain") + public Double getAboveChain() { + return aboveChain; + } + + public void setAboveChain(Double aboveChain) { + this.aboveChain = aboveChain; + } + + @Column(name = "above_yeartoyear") + public Double getAboveYeartoyear() { + return aboveYeartoyear; + } + + public void setAboveYeartoyear(Double aboveYeartoyear) { + this.aboveYeartoyear = aboveYeartoyear; + } + + @Column(name = "above_fixedbase") + public Double getAboveFixedbase() { + return aboveFixedbase; + } + + public void setAboveFixedbase(Double aboveFixedbase) { + this.aboveFixedbase = aboveFixedbase; + } + + @Column(name = "cat") + public String getCat() { + return cat; + } + + public void setCat(String cat) { + this.cat = cat; + } + + @Column(name = "fang_index") + public Double getFangIndex() { + return fangIndex; + } + + public void setFangIndex(Double fangIndex) { + this.fangIndex = fangIndex; + } + + @Column(name = "fang_chain") + public Double getFangChain() { + return fangChain; + } + + public void setFangChain(Double fangChain) { + this.fangChain = fangChain; + } + + @Column(name = "chain") + public Double getChain() { + return chain; + } + + public void setChain(Double chain) { + this.chain = chain; + } + + @Column(name = "yeartoyear") + public Double getYeartoyear() { + return yeartoyear; + } + + public void setYeartoyear(Double yeartoyear) { + this.yeartoyear = yeartoyear; + } + + @Column(name = "fixedbase") + public Double getFixedbase() { + return fixedbase; + } + + public void setFixedbase(Double fixedbase) { + this.fixedbase = fixedbase; + } + + @Column(name = "type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java index c0565b537..066c5f424 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java @@ -14,7 +14,7 @@ import com.fangjia.dal.MongoEntity; * 价格指数 */ @Entity -@Table(name = "fangjia.stats_index") +@Table(name = "fangjia_stat.stats_index") public class StatsIndex implements MongoEntity{ /** * @@ -24,6 +24,8 @@ public class StatsIndex implements MongoEntity{ private String id; private String city; + + private String district; private String yearmonth; @@ -31,12 +33,15 @@ public class StatsIndex implements MongoEntity{ private String remark; - private Double newChain; - - private Double newYeartoyear; - - private Double newFixedbase; - +// private Double newChain; + private Double chain; + +// private Double newYeartoyear; + private Double yeartoyear; + +// private Double newFixedbase; + private Double fixedbase; + private Double belowChain; private Double belowYeartoyear; @@ -62,6 +67,8 @@ public class StatsIndex implements MongoEntity{ private Double fangIndex; private Double fangChain; + + private String type; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "_id") @@ -82,6 +89,14 @@ public class StatsIndex implements MongoEntity{ this.city = city; } + @Column(name = "district") + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } @Column(name = "c_date") public Date getcDate() { @@ -118,34 +133,6 @@ public class StatsIndex implements MongoEntity{ public void setRemark(String remark) { this.remark = remark; } - - @Column(name = "new_chain") - public Double getNewChain() { - return newChain; - } - - public void setNewChain(Double newChain) { - this.newChain = newChain; - } - - @Column(name = "new_yeartoyear") - public Double getNewYeartoyear() { - return newYeartoyear; - } - - public void setNewYeartoyear(Double newYeartoyear) { - this.newYeartoyear = newYeartoyear; - } - - @Column(name = "new_fixedbase") - public Double getNewFixedbase() { - return newFixedbase; - } - - public void setNewFixedbase(Double newFixedbase) { - this.newFixedbase = newFixedbase; - } - @Column(name = "below_chain") public Double getBelowChain() { return belowChain; @@ -253,6 +240,40 @@ public class StatsIndex implements MongoEntity{ public void setFangChain(Double fangChain) { this.fangChain = fangChain; } - - + + @Column(name = "chain") + public Double getChain() { + return chain; + } + + public void setChain(Double chain) { + this.chain = chain; + } + + @Column(name = "yeartoyear") + public Double getYeartoyear() { + return yeartoyear; + } + + public void setYeartoyear(Double yeartoyear) { + this.yeartoyear = yeartoyear; + } + + @Column(name = "fixedbase") + public Double getFixedbase() { + return fixedbase; + } + + public void setFixedbase(Double fixedbase) { + this.fixedbase = fixedbase; + } + + @Column(name = "type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java index 68d977495..4f6fd841f 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java @@ -5,7 +5,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap; +import com.fangjia.dal.mongo.model.PropertyStatsIndex; +import com.fangjia.dal.seaweed.model.District; import com.fangjia.open.model.BasicModel; +import com.fangjia.service.datastore.DistrictService; +import com.fangjia.service.mongo.fangjia.PropertyStatsIndexService; +import com.fangjia.service.open.FangjiaOfficialAreaService; import org.apache.commons.lang.StringUtils; import com.fangjia.core.util.DistrictCodeUtils; @@ -22,380 +28,453 @@ import com.fangjia.service.bo.IndexBo; import com.fangjia.service.bo.LandPriceIndexBo; import com.fangjia.service.mongo.fangjia.LandPriceIndexService; import com.fangjia.service.mongo.fangjia.StatsIndexService; +import org.sothis.core.util.CollectionUtils; public class StatsIndexController { - private StatsIndexService statsIndexService; - private LandPriceIndexService landPriceIndexService; + private StatsIndexService statsIndexService; + private LandPriceIndexService landPriceIndexService; - /** - *查询 - * param y:city : ,yearmonth: yyyyMM cat:商铺,写字楼,住宅 - */ - @Authority(role = Role.USER) - public Object searchAction(StatsIndexModel model) throws Exception { - RestfulModelAndView mav = new RestfulModelAndView(); - mav.setViewType("rest"); - if(StringUtils.isBlank(model.getCity())){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "请输入城市编码")); - return mav; - } - String cityName = DistrictCodeUtils.getCityName(model.getCity()); - if(cityName == null){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); - return mav; - } - if (StringUtils.isBlank(model.getYearmonth())) { - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "请输入要查询的年月")); - return mav; - } - Map resMap = new HashMap(); - List statsIndexs=statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true,model.getCat()); - List statsIndexList=new ArrayList(); - if("商铺".equalsIgnoreCase(model.getCat()) || "写字楼".equalsIgnoreCase(model.getCat())){ - for(StatsIndex statsIndex:statsIndexs){ - StatsIndex newStatsIndex=new StatsIndex(); - newStatsIndex.setFangChain(statsIndex.getFangChain()); - newStatsIndex.setFangIndex(statsIndex.getFangIndex()); - newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); - if(StringUtils.isNotBlank(newStatsIndex.getCity())){ - statsIndexList.add(newStatsIndex); - } - } - }else{ - for(StatsIndex statsIndex:statsIndexs){ - StatsIndex newStatsIndex=new StatsIndex(); - newStatsIndex.setNewChain(statsIndex.getNewChain()); - newStatsIndex.setNewYeartoyear(statsIndex.getNewYeartoyear()); - newStatsIndex.setNewFixedbase(statsIndex.getNewFixedbase()); - - newStatsIndex.setBelowChain(statsIndex.getBelowChain()); - newStatsIndex.setBelowYeartoyear(statsIndex.getBelowYeartoyear()); - newStatsIndex.setBelowFixedbase(statsIndex.getBelowFixedbase()); - - newStatsIndex.setAmongChain(statsIndex.getAmongChain()); - newStatsIndex.setAmongYeartoyear(statsIndex.getAmongYeartoyear()); - newStatsIndex.setAmongFixedbase(statsIndex.getAmongFixedbase()); - - newStatsIndex.setAboveChain(statsIndex.getAboveChain()); - newStatsIndex.setAboveYeartoyear(statsIndex.getAboveYeartoyear()); - newStatsIndex.setAboveFixedbase(statsIndex.getAboveFixedbase()); - - newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(String.valueOf(statsIndex.getSource())); - if(StringUtils.isNotBlank(newStatsIndex.getCity())){ - statsIndexList.add(newStatsIndex); - } - } - } - if(statsIndexList.isEmpty()){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "请检查输入的城市或者年月")); - return mav; - } - resMap.put("results",statsIndexList.get(0)); - if(statsIndexList.size()>0){ - resMap.put("count", statsIndexList.size()); - if("商铺".equals(model.getCat())){ - resMap.put("type", "商铺"); - }else if("写字楼".equals(model.getCat())){ - resMap.put("type", "写字楼"); - }else{ - resMap.put("type", "住宅"); - } - } - mav.setModel(resMap); - return mav; - } + private FangjiaOfficialAreaService fangjiaOfficialAreaService; + private DistrictService districtService; - /** - *查询新房指数 - * param yearmonth: yyyyMM - */ - @Authority(role = Role.USER) - public Object searchNewDistrictIndexAction(StatsIndexModel model) throws Exception { - RestfulModelAndView mav = new RestfulModelAndView(); - mav.setViewType("rest"); - if(StringUtils.isNotBlank(model.getCity())){ - String cityName = DistrictCodeUtils.getCityName(model.getCity()); - if(cityName == null){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); - return mav; - } - model.setCity(cityName); - } - if(StringUtils.isBlank(model.getYearmonth())){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); - return mav; - } - List statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅"); - List statsIndexList = new ArrayList(); - - if(statsIndexs != null && statsIndexs.size() > 0){ - for(StatsIndex statsIndex : statsIndexs){ - IndexBo newStatsIndex = new IndexBo(); - newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); - newStatsIndex.setMOM(statsIndex.getNewChain()); - newStatsIndex.setYOY(statsIndex.getNewYeartoyear()); - newStatsIndex.setFixedBase(statsIndex.getNewFixedbase()); - newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); - if(StringUtils.isNotBlank(newStatsIndex.getCity())){ - statsIndexList.add(newStatsIndex); - } - } - } - - if(statsIndexList.isEmpty()){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); - return mav; - } - - Map resMap = new HashMap(); - resMap.put("results",statsIndexList); - resMap.put("count", statsIndexList.size()); - resMap.put("type", "新建商品房"); - mav.setModel(resMap); - return mav; - } - - /** - *查询二手房指数 - * param yearmonth: yyyyMM - */ - @Authority(role = Role.USER) - public Object searchDistrictIndexAction(StatsIndexModel model) throws Exception { - RestfulModelAndView mav = new RestfulModelAndView(); - mav.setViewType("rest"); - if(StringUtils.isNotBlank(model.getCity())){ - String cityName = DistrictCodeUtils.getCityName(model.getCity()); - if(cityName == null){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); - return mav; - } - model.setCity(cityName); - } - if(StringUtils.isBlank(model.getYearmonth())){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); - return mav; - } - List statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅"); - List statsIndexList = new ArrayList(); - - if(statsIndexs != null && statsIndexs.size() > 0){ - for(StatsIndex statsIndex:statsIndexs){ - IndexBo newStatsIndex = new IndexBo(); - newStatsIndex.setSmallMOM(statsIndex.getBelowChain()); - newStatsIndex.setSmallYOY(statsIndex.getBelowYeartoyear()); - newStatsIndex.setSmallFixedBase(statsIndex.getBelowFixedbase()); - - newStatsIndex.setMediumMOM(statsIndex.getAmongChain()); - newStatsIndex.setMediumYOY(statsIndex.getAmongYeartoyear()); - newStatsIndex.setMediumFixedBase(statsIndex.getAmongFixedbase()); - - newStatsIndex.setLargeMOM(statsIndex.getAboveChain()); - newStatsIndex.setLargeYOY(statsIndex.getAboveYeartoyear()); - newStatsIndex.setLargeFixedBase(statsIndex.getAboveFixedbase()); - - newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); - newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); - if(StringUtils.isNotBlank(newStatsIndex.getCity())){ - statsIndexList.add(newStatsIndex); - }else{ - System.out.println(statsIndex.getCity()); - } - } - } - - if(statsIndexList.isEmpty()){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); - return mav; - } - - Map resMap = new HashMap(); - resMap.put("results",statsIndexList); - resMap.put("count", statsIndexList.size()); - resMap.put("type", "二手住宅"); - mav.setModel(resMap); - return mav; - } - - /** - *查询商铺指数 - * param yearmonth: yyyyMM - */ - @Authority(role = Role.USER) - public Object searchShopIndexAction(StatsIndexModel model) throws Exception { - RestfulModelAndView mav = new RestfulModelAndView(); - mav.setViewType("rest"); - if(StringUtils.isNotBlank(model.getCity())){ - String cityName = DistrictCodeUtils.getCityName(model.getCity()); - if(cityName == null){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); - return mav; - } - model.setCity(cityName); - } - if(StringUtils.isBlank(model.getYearmonth())){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); - return mav; - } - List statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "商铺"); - List statsIndexList = new ArrayList(); - - if(statsIndexs != null && statsIndexs.size() > 0){ - for(StatsIndex statsIndex:statsIndexs){ - IndexBo newStatsIndex = new IndexBo(); - newStatsIndex.setMOM(statsIndex.getFangChain()); - newStatsIndex.setIndex(statsIndex.getFangIndex()); - newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); - newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); - if(StringUtils.isNotBlank(newStatsIndex.getCity())){ - statsIndexList.add(newStatsIndex); - } - } - } - - if(statsIndexList.isEmpty()){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); - return mav; - } - - Map resMap = new HashMap(); - resMap.put("results",statsIndexList); - resMap.put("count", statsIndexList.size()); - resMap.put("type", "商铺"); - mav.setModel(resMap); - return mav; - } - - /** - *查询写字楼指数 - * yearmonth: yyyyMM - */ - @Authority(role = Role.USER) - public Object searchOfficeIndexAction(StatsIndexModel model) throws Exception { - RestfulModelAndView mav = new RestfulModelAndView(); - mav.setViewType("rest"); - if(StringUtils.isNotBlank(model.getCity())){ - String cityName = DistrictCodeUtils.getCityName(model.getCity()); - if(cityName == null){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); - return mav; - } - model.setCity(cityName); - } - if(StringUtils.isBlank(model.getYearmonth())){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); - return mav; - } - - List statsIndexs=statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "写字楼"); - List statsIndexList = new ArrayList(); - - if(statsIndexs != null && statsIndexs.size() > 0){ - for(StatsIndex statsIndex:statsIndexs){ - IndexBo newStatsIndex = new IndexBo(); - newStatsIndex.setMOM(statsIndex.getFangChain()); - newStatsIndex.setIndex(statsIndex.getFangIndex()); - newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); - newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); - if(StringUtils.isNotBlank(newStatsIndex.getCity())){ - statsIndexList.add(newStatsIndex); - } - } - } - - if(statsIndexList.isEmpty()){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); - return mav; - } - - Map resMap = new HashMap(); - resMap.put("results",statsIndexList); - resMap.put("count", statsIndexList.size()); - resMap.put("type", "写字楼"); - mav.setModel(resMap); - return mav; - } - - /** - *查询 - * param city:城市 , year:年份 - */ - @Authority(role = Role.USER) - public Object searchLandIndexAction(LandPriceIndexModel model) { - RestfulModelAndView mav = new RestfulModelAndView(); - mav.setViewType("rest"); - if(StringUtils.isNotBlank(model.getCity())) { - String cityName = DistrictCodeUtils.getCityName(model.getCity()); - if(cityName == null){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); - return mav; - } - model.setCity(cityName); - } - if(model.getYear() <= 0){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年份必须输入,格式:yyyy")); - return mav; - } - List landPriceIndexList = new ArrayList(); - if(StringUtils.isNotBlank(model.getCity())) { - landPriceIndexList = landPriceIndexService.findByCityAndYear(model.getCity(), model.getYear()); - } else { - landPriceIndexList = landPriceIndexService.findAllByYear(model.getYear()); - } - List landPriceIndexBoList = new ArrayList(); - - if(landPriceIndexList != null && landPriceIndexList.size() > 0){ - for(LandPriceIndex landPriceIndex:landPriceIndexList){ - LandPriceIndexBo landPriceIndexBo = new LandPriceIndexBo(); - - landPriceIndexBo.setCity(DistrictCodeUtils.getCityCode(landPriceIndex.getCity())); - landPriceIndexBo.setYear(landPriceIndex.getYear()); - landPriceIndexBo.setCompositeIndex(landPriceIndex.getComprehensiveIndex()); - landPriceIndexBo.setCommercialIndex(landPriceIndex.getCommercialIndex()); - landPriceIndexBo.setResidentialIndex(landPriceIndex.getDistrictIndex()); - landPriceIndexBo.setIndustrialIndex(landPriceIndex.getIndustryIndex()); - - if(StringUtils.isNotBlank(landPriceIndexBo.getCity())){ - landPriceIndexBoList.add(landPriceIndexBo); - } - } - } - - if(landPriceIndexBoList.isEmpty()){ - mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); - return mav; - } - - Map resMap = new HashMap(); - resMap.put("results",landPriceIndexBoList); - resMap.put("count", landPriceIndexBoList.size()); - resMap.put("type", "土地"); - mav.setModel(resMap); - return mav; - } - - private String getSourceString(int source){ - if(source == 1){ - return "统计局"; - }else if(source == 2){ - return "房价网"; - }else if(source == 3){ - return "手工输入"; - } - return ""; - } - - public void setStatsIndexService(StatsIndexService statsIndexService) { - this.statsIndexService = statsIndexService; - } + private PropertyStatsIndexService propertyStatsIndexService; - public void setLandPriceIndexService(LandPriceIndexService landPriceIndexService) { - this.landPriceIndexService = landPriceIndexService; - } + /** + * 查询城市级别价格指数 + * param y:city : ,yearmonth: yyyyMM cat:商铺,写字楼,住宅 + */ + @Authority(role = Role.USER) + public Object cityAction(StatsIndexModel model) throws Exception { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getCity())) { + mav.setModel(BasicModel.buildBadRequestModel("请输入城市编码")); + return mav; + } + if (StringUtils.isBlank(model.getYearmonth())) { + mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月")); + return mav; + } + String cityName = DistrictCodeUtils.getCityName(model.getCity()); + if (cityName == null) { + mav.setModel(BasicModel.buildBadRequestModel("无法匹配到该城市编码")); + return mav; + } + Map resMap = new HashMap(); + StatsIndex statsIndex = statsIndexService.findStatsIndex(cityName, "", "城市", "", model.getYearmonth(), model.getCat()); + if (statsIndex != null) { + StatsIndex newStatsIndex = new StatsIndex(); + newStatsIndex.setChain(statsIndex.getChain()); + newStatsIndex.setYeartoyear(statsIndex.getYeartoyear()); + newStatsIndex.setFixedbase(statsIndex.getFixedbase()); + newStatsIndex.setBelowChain(statsIndex.getBelowChain()); + newStatsIndex.setBelowYeartoyear(statsIndex.getBelowYeartoyear()); + newStatsIndex.setBelowFixedbase(statsIndex.getBelowFixedbase()); + + newStatsIndex.setAmongChain(statsIndex.getAmongChain()); + newStatsIndex.setAmongYeartoyear(statsIndex.getAmongYeartoyear()); + newStatsIndex.setAmongFixedbase(statsIndex.getAmongFixedbase()); + + newStatsIndex.setAboveChain(statsIndex.getAboveChain()); + newStatsIndex.setAboveYeartoyear(statsIndex.getAboveYeartoyear()); + newStatsIndex.setAboveFixedbase(statsIndex.getAboveFixedbase()); + + newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); + newStatsIndex.setYearmonth(model.getYearmonth()); + resMap.put("results", newStatsIndex); + } + resMap.put("status", "200"); + resMap.put("msg", "ok"); + mav.setModel(resMap); + return mav; + } + + /** + * 查询区域级别价格指数 + * + * @param model + * @return + * @throws Exception + */ + + @Authority(role = Role.USER) + public Object districtAction(StatsIndexModel model) throws Exception { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getDistrict())) { + mav.setModel(BasicModel.buildBadRequestModel("请输入区域编码")); + return mav; + } + if (StringUtils.isBlank(model.getYearmonth())) { + mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月")); + return mav; + } + FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(model.getDistrict()); + if (fangjiaOfficialAreaMap == null) { + mav.setModel(BasicModel.buildBadRequestModel("无法匹配到该区域编码")); + return mav; + } + Map resMap = new HashMap(); + StatsIndex statsIndex = statsIndexService.findStatsIndex(fangjiaOfficialAreaMap.getFangjiaCity(), fangjiaOfficialAreaMap.getFangjiaDistrict(), "区域", "", model.getYearmonth(), model.getCat()); + if (statsIndex != null) { + StatsIndex newStatsIndex = new StatsIndex(); + newStatsIndex.setChain(statsIndex.getChain()); + newStatsIndex.setYeartoyear(statsIndex.getYeartoyear()); + newStatsIndex.setFixedbase(statsIndex.getFixedbase()); + newStatsIndex.setDistrict(model.getDistrict()); + newStatsIndex.setYearmonth(model.getYearmonth()); + resMap.put("results", newStatsIndex); + } + resMap.put("status", "200"); + resMap.put("msg", "ok"); + mav.setModel(resMap); + return mav; + } + + /** + * 小区价格指数 + * + * @param model + * @return + * @throws Exception + */ + @Authority(role = Role.USER) + public Object propertyAction(StatsIndexModel model) throws Exception { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getId())) { + mav.setModel(BasicModel.buildBadRequestModel("请输入小区id")); + return mav; + } + if (StringUtils.isBlank(model.getYearmonth())) { + mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月")); + return mav; + } + District district = districtService.findById(model.getId()); + if (district == null) { + mav.setModel(BasicModel.buildBadRequestModel("无法匹配到小区")); + return mav; + } + Map resMap = new HashMap(); + PropertyStatsIndex statsIndex = propertyStatsIndexService.findStatsIndex(district.getCity(), district.getRegion(), district.getName(), model.getYearmonth(), model.getCat()); + if (statsIndex != null) { + PropertyStatsIndex newStatsIndex = new PropertyStatsIndex(); + newStatsIndex.setChain(statsIndex.getChain()); + newStatsIndex.setYeartoyear(statsIndex.getYeartoyear()); + newStatsIndex.setFixedbase(statsIndex.getFixedbase()); + newStatsIndex.setDistrict(model.getDistrict()); + newStatsIndex.setYearmonth(model.getYearmonth()); + newStatsIndex.setId(model.getId()); + resMap.put("results", newStatsIndex); + } + + resMap.put("status", "200"); + resMap.put("msg", "ok"); + mav.setModel(resMap); + return mav; + } + + /** + * 查询新房指数 + * param yearmonth: yyyyMM + */ + @Authority(role = Role.USER) + public Object searchNewDistrictIndexAction(StatsIndexModel model) throws Exception { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isNotBlank(model.getCity())) { + String cityName = DistrictCodeUtils.getCityName(model.getCity()); + if (cityName == null) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); + return mav; + } + model.setCity(cityName); + } + if (StringUtils.isBlank(model.getYearmonth())) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); + return mav; + } + List statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅"); + List statsIndexList = new ArrayList(); + + if (statsIndexs != null && statsIndexs.size() > 0) { + for (StatsIndex statsIndex : statsIndexs) { + IndexBo newStatsIndex = new IndexBo(); + newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); + newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setMOM(statsIndex.getChain()); + newStatsIndex.setYOY(statsIndex.getYeartoyear()); + newStatsIndex.setFixedBase(statsIndex.getFixedbase()); + newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); + if (StringUtils.isNotBlank(newStatsIndex.getCity())) { + statsIndexList.add(newStatsIndex); + } + } + } + + if (statsIndexList.isEmpty()) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); + return mav; + } + + Map resMap = new HashMap(); + resMap.put("results", statsIndexList); + resMap.put("count", statsIndexList.size()); + resMap.put("type", "新建商品房"); + mav.setModel(resMap); + return mav; + } + + /** + * 查询二手房指数 + * param yearmonth: yyyyMM + */ + @Authority(role = Role.USER) + public Object searchDistrictIndexAction(StatsIndexModel model) throws Exception { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isNotBlank(model.getCity())) { + String cityName = DistrictCodeUtils.getCityName(model.getCity()); + if (cityName == null) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); + return mav; + } + model.setCity(cityName); + } + if (StringUtils.isBlank(model.getYearmonth())) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); + return mav; + } + List statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅"); + List statsIndexList = new ArrayList(); + + if (statsIndexs != null && statsIndexs.size() > 0) { + for (StatsIndex statsIndex : statsIndexs) { + IndexBo newStatsIndex = new IndexBo(); + newStatsIndex.setSmallMOM(statsIndex.getBelowChain()); + newStatsIndex.setSmallYOY(statsIndex.getBelowYeartoyear()); + newStatsIndex.setSmallFixedBase(statsIndex.getBelowFixedbase()); + + newStatsIndex.setMediumMOM(statsIndex.getAmongChain()); + newStatsIndex.setMediumYOY(statsIndex.getAmongYeartoyear()); + newStatsIndex.setMediumFixedBase(statsIndex.getAmongFixedbase()); + + newStatsIndex.setLargeMOM(statsIndex.getAboveChain()); + newStatsIndex.setLargeYOY(statsIndex.getAboveYeartoyear()); + newStatsIndex.setLargeFixedBase(statsIndex.getAboveFixedbase()); + + newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); + newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); + if (StringUtils.isNotBlank(newStatsIndex.getCity())) { + statsIndexList.add(newStatsIndex); + } else { + System.out.println(statsIndex.getCity()); + } + } + } + + if (statsIndexList.isEmpty()) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); + return mav; + } + + Map resMap = new HashMap(); + resMap.put("results", statsIndexList); + resMap.put("count", statsIndexList.size()); + resMap.put("type", "二手住宅"); + mav.setModel(resMap); + return mav; + } + + /** + * 查询商铺指数 + * param yearmonth: yyyyMM + */ + @Authority(role = Role.USER) + public Object searchShopIndexAction(StatsIndexModel model) throws Exception { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isNotBlank(model.getCity())) { + String cityName = DistrictCodeUtils.getCityName(model.getCity()); + if (cityName == null) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); + return mav; + } + model.setCity(cityName); + } + if (StringUtils.isBlank(model.getYearmonth())) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); + return mav; + } + List statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "商铺"); + List statsIndexList = new ArrayList(); + + if (statsIndexs != null && statsIndexs.size() > 0) { + for (StatsIndex statsIndex : statsIndexs) { + IndexBo newStatsIndex = new IndexBo(); + newStatsIndex.setMOM(statsIndex.getFangChain()); + newStatsIndex.setIndex(statsIndex.getFangIndex()); + newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); + newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); + if (StringUtils.isNotBlank(newStatsIndex.getCity())) { + statsIndexList.add(newStatsIndex); + } + } + } + + if (statsIndexList.isEmpty()) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); + return mav; + } + + Map resMap = new HashMap(); + resMap.put("results", statsIndexList); + resMap.put("count", statsIndexList.size()); + resMap.put("type", "商铺"); + mav.setModel(resMap); + return mav; + } + + /** + * 查询写字楼指数 + * yearmonth: yyyyMM + */ + @Authority(role = Role.USER) + public Object searchOfficeIndexAction(StatsIndexModel model) throws Exception { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isNotBlank(model.getCity())) { + String cityName = DistrictCodeUtils.getCityName(model.getCity()); + if (cityName == null) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); + return mav; + } + model.setCity(cityName); + } + if (StringUtils.isBlank(model.getYearmonth())) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); + return mav; + } + + List statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "写字楼"); + List statsIndexList = new ArrayList(); + + if (statsIndexs != null && statsIndexs.size() > 0) { + for (StatsIndex statsIndex : statsIndexs) { + IndexBo newStatsIndex = new IndexBo(); + newStatsIndex.setMOM(statsIndex.getFangChain()); + newStatsIndex.setIndex(statsIndex.getFangIndex()); + newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); + newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); + if (StringUtils.isNotBlank(newStatsIndex.getCity())) { + statsIndexList.add(newStatsIndex); + } + } + } + + if (statsIndexList.isEmpty()) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); + return mav; + } + + Map resMap = new HashMap(); + resMap.put("results", statsIndexList); + resMap.put("count", statsIndexList.size()); + resMap.put("type", "写字楼"); + mav.setModel(resMap); + return mav; + } + + /** + * 查询 + * param city:城市 , year:年份 + */ + @Authority(role = Role.USER) + public Object searchLandIndexAction(LandPriceIndexModel model) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isNotBlank(model.getCity())) { + String cityName = DistrictCodeUtils.getCityName(model.getCity()); + if (cityName == null) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码")); + return mav; + } + model.setCity(cityName); + } + if (model.getYear() <= 0) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年份必须输入,格式:yyyy")); + return mav; + } + List landPriceIndexList = new ArrayList(); + if (StringUtils.isNotBlank(model.getCity())) { + landPriceIndexList = landPriceIndexService.findByCityAndYear(model.getCity(), model.getYear()); + } else { + landPriceIndexList = landPriceIndexService.findAllByYear(model.getYear()); + } + List landPriceIndexBoList = new ArrayList(); + + if (landPriceIndexList != null && landPriceIndexList.size() > 0) { + for (LandPriceIndex landPriceIndex : landPriceIndexList) { + LandPriceIndexBo landPriceIndexBo = new LandPriceIndexBo(); + + landPriceIndexBo.setCity(DistrictCodeUtils.getCityCode(landPriceIndex.getCity())); + landPriceIndexBo.setYear(landPriceIndex.getYear()); + landPriceIndexBo.setCompositeIndex(landPriceIndex.getComprehensiveIndex()); + landPriceIndexBo.setCommercialIndex(landPriceIndex.getCommercialIndex()); + landPriceIndexBo.setResidentialIndex(landPriceIndex.getDistrictIndex()); + landPriceIndexBo.setIndustrialIndex(landPriceIndex.getIndustryIndex()); + + if (StringUtils.isNotBlank(landPriceIndexBo.getCity())) { + landPriceIndexBoList.add(landPriceIndexBo); + } + } + } + + if (landPriceIndexBoList.isEmpty()) { + mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在")); + return mav; + } + + Map resMap = new HashMap(); + resMap.put("results", landPriceIndexBoList); + resMap.put("count", landPriceIndexBoList.size()); + resMap.put("type", "土地"); + mav.setModel(resMap); + return mav; + } + + private String getSourceString(int source) { + if (source == 1) { + return "统计局"; + } else if (source == 2) { + return "房价网"; + } else if (source == 3) { + return "手工输入"; + } + return ""; + } + + public void setStatsIndexService(StatsIndexService statsIndexService) { + this.statsIndexService = statsIndexService; + } + + public void setLandPriceIndexService(LandPriceIndexService landPriceIndexService) { + this.landPriceIndexService = landPriceIndexService; + } + + public void setFangjiaOfficialAreaService(FangjiaOfficialAreaService fangjiaOfficialAreaService) { + this.fangjiaOfficialAreaService = fangjiaOfficialAreaService; + } + + public void setDistrictService(DistrictService districtService) { + this.districtService = districtService; + } + + public void setPropertyStatsIndexService(PropertyStatsIndexService propertyStatsIndexService) { + this.propertyStatsIndexService = propertyStatsIndexService; + } } From 7047b18b0e12f79acfdfd957d78cb328bc1ec37a Mon Sep 17 00:00:00 2001 From: majintao Date: Fri, 27 Sep 2024 09:57:29 +0800 Subject: [PATCH 032/115] =?UTF-8?q?=E5=9F=8E=E5=B8=82=E3=80=81=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E3=80=81=E5=B0=8F=E5=8C=BA=E4=BB=B7=E6=A0=BC=E6=8C=87?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mongo/model/PropertyStatsIndex.java | 10 +- .../fangjia/dal/mongo/model/StatsIndex.java | 8 +- .../open/controllers/HouseController.java | 2 +- .../controllers/StatsIndexController.java | 24 +- .../fangjia/open/model/StatsIndexModel.java | 6 +- .../fangjia/PropertyStatsIndexService.java | 2 +- .../PropertyStatsIndexServiceImpl.java | 11 +- .../mongo/fangjia/StatsIndexService.java | 12 +- .../mongo/fangjia/StatsIndexServiceImpl.java | 321 +++++++++--------- 9 files changed, 193 insertions(+), 203 deletions(-) diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java index 71076ab65..923e94247 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/PropertyStatsIndex.java @@ -24,7 +24,7 @@ public class PropertyStatsIndex implements MongoEntity{ private String name; - private String yearmonth; + private Integer yearmonth; private Integer source; @@ -109,16 +109,16 @@ public class PropertyStatsIndex implements MongoEntity{ public void setcDate(Date cDate) { this.cDate = cDate; } - + @Column(name = "yearmonth") - public String getYearmonth() { + public Integer getYearmonth() { return yearmonth; } - public void setYearmonth(String yearmonth) { + public void setYearmonth(Integer yearmonth) { this.yearmonth = yearmonth; } - + @Column(name = "source") public Integer getSource() { return source; diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java index 066c5f424..3dd495898 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/StatsIndex.java @@ -27,7 +27,7 @@ public class StatsIndex implements MongoEntity{ private String district; - private String yearmonth; + private Integer yearmonth; private Integer source; @@ -106,13 +106,13 @@ public class StatsIndex implements MongoEntity{ public void setcDate(Date cDate) { this.cDate = cDate; } - + @Column(name = "yearmonth") - public String getYearmonth() { + public Integer getYearmonth() { return yearmonth; } - public void setYearmonth(String yearmonth) { + public void setYearmonth(Integer yearmonth) { this.yearmonth = yearmonth; } 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 f3548c9cc..f0a5f24dd 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 @@ -1170,7 +1170,7 @@ public class HouseController { || statsIndex.getBelowFixedbase() == null) { return null; } - Date endDate = DateUtil.parseDate(statsIndex.getYearmonth(), "yyyyMM"); + Date endDate = DateUtil.parseDate(statsIndex.getYearmonth().toString(), "yyyyMM"); Calendar c = Calendar.getInstance(); c.setTime(endDate); c.add(Calendar.MONTH, -1); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java index 4f6fd841f..5e2514098 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/StatsIndexController.java @@ -51,7 +51,7 @@ public class StatsIndexController { mav.setModel(BasicModel.buildBadRequestModel("请输入城市编码")); return mav; } - if (StringUtils.isBlank(model.getYearmonth())) { + if (null == model.getYearmonth()) { mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月")); return mav; } @@ -106,7 +106,7 @@ public class StatsIndexController { mav.setModel(BasicModel.buildBadRequestModel("请输入区域编码")); return mav; } - if (StringUtils.isBlank(model.getYearmonth())) { + if (null == model.getYearmonth()) { mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月")); return mav; } @@ -147,7 +147,7 @@ public class StatsIndexController { mav.setModel(BasicModel.buildBadRequestModel("请输入小区id")); return mav; } - if (StringUtils.isBlank(model.getYearmonth())) { + if (null == model.getYearmonth()) { mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月")); return mav; } @@ -157,7 +157,7 @@ public class StatsIndexController { return mav; } Map resMap = new HashMap(); - PropertyStatsIndex statsIndex = propertyStatsIndexService.findStatsIndex(district.getCity(), district.getRegion(), district.getName(), model.getYearmonth(), model.getCat()); + PropertyStatsIndex statsIndex = propertyStatsIndexService.findStatsIndex(district.getCity(), district.getRegion(), district.getName(), model.getYearmonth()); if (statsIndex != null) { PropertyStatsIndex newStatsIndex = new PropertyStatsIndex(); newStatsIndex.setChain(statsIndex.getChain()); @@ -191,7 +191,7 @@ public class StatsIndexController { } model.setCity(cityName); } - if (StringUtils.isBlank(model.getYearmonth())) { + if (null == model.getYearmonth()) { mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); return mav; } @@ -202,7 +202,7 @@ public class StatsIndexController { for (StatsIndex statsIndex : statsIndexs) { IndexBo newStatsIndex = new IndexBo(); newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setYearmonth(statsIndex.getYearmonth().toString()); newStatsIndex.setMOM(statsIndex.getChain()); newStatsIndex.setYOY(statsIndex.getYeartoyear()); newStatsIndex.setFixedBase(statsIndex.getFixedbase()); @@ -242,7 +242,7 @@ public class StatsIndexController { } model.setCity(cityName); } - if (StringUtils.isBlank(model.getYearmonth())) { + if (null == model.getYearmonth()) { mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); return mav; } @@ -265,7 +265,7 @@ public class StatsIndexController { newStatsIndex.setLargeFixedBase(statsIndex.getAboveFixedbase()); newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setYearmonth(statsIndex.getYearmonth().toString()); newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); if (StringUtils.isNotBlank(newStatsIndex.getCity())) { statsIndexList.add(newStatsIndex); @@ -304,7 +304,7 @@ public class StatsIndexController { } model.setCity(cityName); } - if (StringUtils.isBlank(model.getYearmonth())) { + if (null == model.getYearmonth()) { mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); return mav; } @@ -317,7 +317,7 @@ public class StatsIndexController { newStatsIndex.setMOM(statsIndex.getFangChain()); newStatsIndex.setIndex(statsIndex.getFangIndex()); newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setYearmonth(statsIndex.getYearmonth().toString()); newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); if (StringUtils.isNotBlank(newStatsIndex.getCity())) { statsIndexList.add(newStatsIndex); @@ -354,7 +354,7 @@ public class StatsIndexController { } model.setCity(cityName); } - if (StringUtils.isBlank(model.getYearmonth())) { + if (null == model.getYearmonth()) { mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM")); return mav; } @@ -368,7 +368,7 @@ public class StatsIndexController { newStatsIndex.setMOM(statsIndex.getFangChain()); newStatsIndex.setIndex(statsIndex.getFangIndex()); newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity())); - newStatsIndex.setYearmonth(statsIndex.getYearmonth()); + newStatsIndex.setYearmonth(statsIndex.getYearmonth().toString()); newStatsIndex.setSource(String.valueOf(statsIndex.getSource())); if (StringUtils.isNotBlank(newStatsIndex.getCity())) { statsIndexList.add(newStatsIndex); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java index 3d9a4909c..305d4f6fe 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/StatsIndexModel.java @@ -14,7 +14,7 @@ public class StatsIndexModel { private String name; private String type; - private String yearmonth; + private Integer yearmonth; private Integer source; @@ -68,11 +68,11 @@ public class StatsIndexModel { this.city = city; } - public String getYearmonth() { + public Integer getYearmonth() { return yearmonth; } - public void setYearmonth(String yearmonth) { + public void setYearmonth(Integer yearmonth) { this.yearmonth = yearmonth; } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java index dfd0645bc..e4399d1bc 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexService.java @@ -8,5 +8,5 @@ import java.util.List; public interface PropertyStatsIndexService { PropertyStatsIndex findById(String id); - PropertyStatsIndex findStatsIndex(String city, String district, String name, String yearmonth, String cat); + PropertyStatsIndex findStatsIndex(String city, String district, String name, Integer yearmonth); } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java index 73bea049a..191b5437b 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/PropertyStatsIndexServiceImpl.java @@ -20,7 +20,7 @@ public class PropertyStatsIndexServiceImpl implements PropertyStatsIndexService } @Override - public PropertyStatsIndex findStatsIndex(String city, String district, String name, String yearmonth, String cat) { + public PropertyStatsIndex findStatsIndex(String city, String district, String name, Integer yearmonth) { List params = new ArrayList(); if (StringUtils.isNotBlank(city)) { params.add(new QueryParam("city", city)); @@ -31,16 +31,9 @@ public class PropertyStatsIndexServiceImpl implements PropertyStatsIndexService if (StringUtils.isNotBlank(name)) { params.add(new QueryParam("name", name)); } - if (StringUtils.isNotBlank(yearmonth)) { + if (null == yearmonth) { params.add(new QueryParam("yearmonth", yearmonth)); } - if (("商铺").equals(cat)) { - params.add(new QueryParam("cat", "shop")); - } else if (("写字楼").equals(cat)) { - params.add(new QueryParam("cat", "office")); - } else { - params.add(new QueryParam("cat", "district")); - } List sortParams = new ArrayList(); sortParams.add(new SortParam("yearmonth", false)); return propertyStatsIndexDao.findFirstByParams(params, sortParams); diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java index 16da71c9e..55c6bfc7e 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexService.java @@ -8,19 +8,19 @@ public interface StatsIndexService { StatsIndex findById(String id); - StatsIndex findByName(String city, String yearmonth); + StatsIndex findByName(String city, Integer yearmonth); - List findAllStats(String city, String yearmonth, boolean order,String cat); + List findAllStats(String city, Integer yearmonth, boolean order,String cat); // List findAllStats(String city, String district,String type, String yearmonth, boolean order,String cat); - int findAllStatsCount(String city, String name,String cat); + int findAllStatsCount(String city, Integer yearmonth,String cat); void deleteById(String id); - StatsIndex findLatestStstsIndex(String city, String yearmonth,String cat); - StatsIndex findStatsIndex(String city,String district,String type,String name, String yearmonth,String cat); + StatsIndex findLatestStstsIndex(String city, Integer yearmonth,String cat); + StatsIndex findStatsIndex(String city,String district,String type,String name, Integer yearmonth,String cat); - public List findAllStatsNocat(String yearmonth,String cat,String source) ; + public List findAllStatsNocat(Integer yearmonth,String cat,String source) ; Integer findEarliestMonth(String city, String cat, String source); diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java index 2530942c6..915e63544 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/mongo/fangjia/StatsIndexServiceImpl.java @@ -20,179 +20,176 @@ import com.fangjia.service.cnAnalyzer.CnTokenizer; import com.fangjia.service.datastore.DistrictService; public class StatsIndexServiceImpl implements StatsIndexService { - private StatsIndexDao statsIndexDao; + private StatsIndexDao statsIndexDao; - @Override - public StatsIndex findById(String id) { - return statsIndexDao.findById(id); - } + @Override + public StatsIndex findById(String id) { + return statsIndexDao.findById(id); + } - @Override - public StatsIndex findByName(String city, String yearmonth) { - List params = new ArrayList(1); - if (StringUtils.isNotEmpty(city)) { - params.add(new QueryParam("city", city)); - } - if (StringUtils.isNotEmpty(city)) { - params.add(new QueryParam("yearmonth", yearmonth)); - } - List allNearbys = statsIndexDao.findAllByParams(params, - null, 0, Integer.MAX_VALUE); - return allNearbys.get(0); - } + @Override + public StatsIndex findByName(String city, Integer yearmonth) { + List params = new ArrayList(1); + if (StringUtils.isNotEmpty(city)) { + params.add(new QueryParam("city", city)); + } + if (null != yearmonth) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + List allNearbys = statsIndexDao.findAllByParams(params, + null, 0, Integer.MAX_VALUE); + return allNearbys.get(0); + } - @Override - public List findAllStats(String city, String yearmonth, boolean order, String cat) { - List params = new ArrayList(); - if (StringUtils.isNotBlank(city)) { - params.add(new QueryParam("city", city)); - } - if (StringUtils.isNotBlank(yearmonth)) { - params.add(new QueryParam("yearmonth", yearmonth)); - } - if (("商铺").equals(cat)) { - params.add(new QueryParam("cat", "shop")); - } else if (("写字楼").equals(cat)) { - params.add(new QueryParam("cat", "office")); - } else { - params.add(new QueryParam("cat", "district")); - } - List sortParams = new ArrayList(2); - sortParams.add(new SortParam("yearmonth", order)); - sortParams.add(new SortParam("cDate", order)); - List allNearbys = statsIndexDao.findAllByParams(params,sortParams); - return allNearbys; - } + @Override + public List findAllStats(String city, Integer yearmonth, boolean order, String cat) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + if (null != yearmonth) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + if (("商铺").equals(cat)) { + params.add(new QueryParam("cat", "shop")); + } else if (("写字楼").equals(cat)) { + params.add(new QueryParam("cat", "office")); + } else { + params.add(new QueryParam("cat", "district")); + } + List sortParams = new ArrayList(2); + sortParams.add(new SortParam("yearmonth", order)); + sortParams.add(new SortParam("cDate", order)); + List allNearbys = statsIndexDao.findAllByParams(params, sortParams); + return allNearbys; + } - private List createQueryParam(String city, String yearmonth) { - List params = new ArrayList(); - if (StringUtils.isNotBlank(city)) { - params.add(new QueryParam("city", city)); - } - if (StringUtils.isNotBlank(yearmonth)) { - params.add(new QueryParam("yearmonth", yearmonth)); - } - return params; - } + private List createQueryParam(String city, Integer yearmonth) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + if (null != yearmonth) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + return params; + } - @Override - public int findAllStatsCount(String city, String yearmonth, String cat) { - List params = new ArrayList(); - if (StringUtils.isNotBlank(city)) { - params.add(new QueryParam("city", city)); - } - if (StringUtils.isNotBlank(yearmonth)) { - params.add(new QueryParam("yearmonth", yearmonth)); - } - if (StringUtils.isNotBlank(cat)) { - params.add(new QueryParam("cat", cat)); - } else { - params.add(new QueryParam("cat", "district")); - } - List allNearbys = statsIndexDao.findAllByParams(params); - if (allNearbys.size() == 0) { - allNearbys = statsIndexDao.findAllByParams(createQueryParam(city, - yearmonth)); - } - return allNearbys.size(); - } + @Override + public int findAllStatsCount(String city, Integer yearmonth, String cat) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + if (null != yearmonth) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + if (StringUtils.isNotBlank(cat)) { + params.add(new QueryParam("cat", cat)); + } else { + params.add(new QueryParam("cat", "district")); + } + List allNearbys = statsIndexDao.findAllByParams(params); + if (allNearbys.size() == 0) { + allNearbys = statsIndexDao.findAllByParams(createQueryParam(city, + yearmonth)); + } + return allNearbys.size(); + } - @Override - public void deleteById(String id) { - statsIndexDao.deleteById(id); - } + @Override + public void deleteById(String id) { + statsIndexDao.deleteById(id); + } - public void setStatsIndexDao(StatsIndexDao statsIndexDao) { - this.statsIndexDao = statsIndexDao; - } + public void setStatsIndexDao(StatsIndexDao statsIndexDao) { + this.statsIndexDao = statsIndexDao; + } - @Override - public StatsIndex findLatestStstsIndex(String city, String yearmonth, String cat) { - List params = new ArrayList(); - if (StringUtils.isNotBlank(city)) { - params.add(new QueryParam("city", city)); - } - if (StringUtils.isNotBlank(yearmonth)) { - params.add(new QueryParam("yearmonth", yearmonth)); - } - if(StringUtils.isNotBlank(cat)){ - params.add(new QueryParam("cat", cat)); - } - List sortParams = new ArrayList(); - sortParams.add(new SortParam("yearmonth", false)); - return statsIndexDao.findFirstByParams(params, sortParams); - } + @Override + public StatsIndex findLatestStstsIndex(String city, Integer yearmonth, String cat) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + if (null != yearmonth) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + if (StringUtils.isNotBlank(cat)) { + params.add(new QueryParam("cat", cat)); + } + List sortParams = new ArrayList(); + sortParams.add(new SortParam("yearmonth", false)); + return statsIndexDao.findFirstByParams(params, sortParams); + } - @Override - public StatsIndex findStatsIndex(String city, String district, String type, String name, String yearmonth, String cat) { - List params = new ArrayList(); - if (StringUtils.isNotBlank(city)) { - params.add(new QueryParam("city", city)); - } - if (StringUtils.isNotBlank(district)) { - params.add(new QueryParam("district", district)); - } - if (StringUtils.isNotBlank(type)) { - params.add(new QueryParam("type", type)); - } - if (StringUtils.isNotBlank(name)) { - params.add(new QueryParam("name", name)); - } - if (StringUtils.isNotBlank(yearmonth)) { - params.add(new QueryParam("yearmonth", yearmonth)); - } - if (("商铺").equals(cat)) { - params.add(new QueryParam("cat", "shop")); - } else if (("写字楼").equals(cat)) { - params.add(new QueryParam("cat", "office")); - } else { - params.add(new QueryParam("cat", "district")); - } - List sortParams = new ArrayList(); - sortParams.add(new SortParam("yearmonth", false)); - return statsIndexDao.findFirstByParams(params, sortParams); - } + @Override + public StatsIndex findStatsIndex(String city, String district, String type, String name, Integer yearmonth, String cat) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + if (StringUtils.isNotBlank(district)) { + params.add(new QueryParam("district", district)); + } + if (StringUtils.isNotBlank(type)) { + params.add(new QueryParam("type", type)); + } + if (null != yearmonth) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + if (("商铺").equals(cat)) { + params.add(new QueryParam("cat", "shop")); + } else if (("写字楼").equals(cat)) { + params.add(new QueryParam("cat", "office")); + } else { + params.add(new QueryParam("cat", "district")); + } + List sortParams = new ArrayList(); + sortParams.add(new SortParam("yearmonth", false)); + return statsIndexDao.findFirstByParams(params, sortParams); + } - @Override - public List findAllStatsNocat(String yearmonth,String cat,String source) { - List params = new ArrayList(); - if (StringUtils.isNotBlank(yearmonth)) { - params.add(new QueryParam("yearmonth", yearmonth)); - } - if(StringUtils.isNotBlank(cat)){ - params.add(new QueryParam("cat", cat)); - } - if(StringUtils.isNotBlank(source)){ - params.add(new QueryParam("source", Integer.valueOf(source))); - } - List sortParams = new ArrayList(2); - List allNearbys = statsIndexDao.findAllByParams(params, - sortParams); - return allNearbys; - } + @Override + public List findAllStatsNocat(Integer yearmonth, String cat, String source) { + List params = new ArrayList(); + if (null != yearmonth) { + params.add(new QueryParam("yearmonth", yearmonth)); + } + if (StringUtils.isNotBlank(cat)) { + params.add(new QueryParam("cat", cat)); + } + if (StringUtils.isNotBlank(source)) { + params.add(new QueryParam("source", Integer.valueOf(source))); + } + List sortParams = new ArrayList(2); + List allNearbys = statsIndexDao.findAllByParams(params, + sortParams); + return allNearbys; + } - @Override - public Integer findEarliestMonth(String city, String cat, String source) { - List params = new ArrayList(); - if(StringUtils.isNotBlank(cat)){ - params.add(new QueryParam("cat", cat)); - } - if(StringUtils.isNotBlank(source)){ - params.add(new QueryParam("source", Integer.valueOf(source))); - } - if(StringUtils.isNotBlank(city)){ - params.add(new QueryParam("city", city)); - } - List statsIndexList = statsIndexDao.findAllByParams(params, null, 0, Integer.MAX_VALUE, new String[]{"yearmonth"}); - Integer min = null; - for(StatsIndex statsIndex : statsIndexList){ - Integer yearMonth = Integer.valueOf(statsIndex.getYearmonth()); - if(min == null || yearMonth < min){ - min = yearMonth; - } - } - return min; - } + @Override + public Integer findEarliestMonth(String city, String cat, String source) { + List params = new ArrayList(); + if (StringUtils.isNotBlank(cat)) { + params.add(new QueryParam("cat", cat)); + } + if (StringUtils.isNotBlank(source)) { + params.add(new QueryParam("source", Integer.valueOf(source))); + } + if (StringUtils.isNotBlank(city)) { + params.add(new QueryParam("city", city)); + } + List statsIndexList = statsIndexDao.findAllByParams(params, null, 0, Integer.MAX_VALUE, new String[]{"yearmonth"}); + Integer min = null; + for (StatsIndex statsIndex : statsIndexList) { + Integer yearMonth = Integer.valueOf(statsIndex.getYearmonth()); + if (min == null || yearMonth < min) { + min = yearMonth; + } + } + return min; + } } From 3c8b595944d5897a1cbadce9a3b9cf9752069cac Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 27 Sep 2024 16:20:59 +0800 Subject: [PATCH 033/115] =?UTF-8?q?=E4=BD=8F=E5=AE=85=E6=8C=87=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/trade/ImportIndexStats.groovy | 380 +++++++++++++----- 1 file changed, 286 insertions(+), 94 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy index 3b78a5f46..e27cd6de4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy @@ -9,6 +9,7 @@ import com.fangjia.script.BatchOwner import com.fangjia.script.Watcher import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.MongoUtils import com.mongodb.BasicDBObject import com.mongodb.DBCollection @@ -23,16 +24,25 @@ import java.sql.ResultSet class ImportIndexStats extends BaseBatch{ //public final static DBCollection under_line = new Mongo("192.168.0.136", 27017).getDB('fangjia').getCollection('stats_index'); public static final DBCollection on_line = MongoUtils.getCollectionByName("fangjia", "stats_index", "mongo.db.fangjia.com") + public static final DBCollection STATS_INDEX_COLL = MongoUtils.getCollectionByName("fangjia_stat", "stats_index", "mongo.db.fangjia.com") public static final DBCollection REGION_STAT_COLL = MongoUtils.getCollectionByName("fangjia", "region_stat", "mongo.db.fangjia.com") - //public static final DSCollection SEAWATER_COLL = new DataStore("192.168.0.65", 27777).getCollection("fangjia.seawater") - + + final DBCollection indices_price_house_sellColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_sell", "192.168.0.206", 27020) + final DBCollection indices_price_house_sell_typeColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_sell_type", "192.168.0.206", 27020) + + final DBCollection indices_price_house_newColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_new", "192.168.0.206", 27020) + final DBCollection indices_price_house_new_typeColl = MongoUtils.getCollectionByName("crawl", "indices_price_house_new_type", "192.168.0.206", 27020) + + //DSCollection seawater = new DataStore("192.168.0.65", 27777).getCollection("fangjia.seawater") private static def cityList=["北京", "天津", "石家庄", "太原", "呼和浩特", "沈阳", "大连", "长春", "哈尔滨", "上海", "南京", "杭州", "宁波", "合肥", "福州", "厦门", "南昌", "济南", "青岛", "郑州", "武汉", "长沙", "广州", "深圳", "南宁", "海口", "重庆", "成都", "贵阳", "昆明", "西安", "兰州", "西宁", "银川", "乌鲁木齐", "唐山", "秦皇岛", "包头", "丹东", "锦州", "吉林", "牡丹江", "无锡", "扬州", "徐州", "温州", "金华", "蚌埠", "安庆", "泉州", "九江", "赣州", "烟台", "济宁", "洛阳", "平顶山", "宜昌", "襄阳", "岳阳", "常德", "惠州", "湛江", "韶关", "桂林", "北海", "三亚", "泸州", "南充", "遵义", "大理"]; - public static final def dingjiYear = 2016; + + + public static final def dingjiYear = 2015; private static final String address = "jdbc:es://http://seawater.es.db.fangjia.com:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s" private static final EsDataSource dataSource = new EsDataSource() @@ -50,14 +60,18 @@ class ImportIndexStats extends BaseBatch{ @Override public void process(Object args) { + +// updateDataType() +// synch() +// synchTjjIndex()//同步统计局抓取过来的指数 + +// Calendar calendar=Calendar.getInstance(); +// def month= calendar.get(Calendar.MONTH)+1; +// def year= calendar.get(Calendar.YEAR); +// def date = createDateString(year, month, 0, ""); +// calculatePriceIndex(year, month); - Calendar calendar=Calendar.getInstance(); - def month= calendar.get(Calendar.MONTH)+1; - def year= calendar.get(Calendar.YEAR); - def date = createDateString(year, month, 0, ""); - calculatePriceIndex(year, month); - - /*def s = "201601" + def s = "201601" def startDate = null; def stop = false; while(!stop){ @@ -67,12 +81,12 @@ class ImportIndexStats extends BaseBatch{ def date = createDateString(year, month, 0, ""); s = DateUtils.addMonth(date, 1, "yyyyMM") - if(year==2017 && month==7){ + if(year==2024 && month==8){ stop = true; } calculatePriceIndex(year, month); println "运行......"+date - }*/ + } } @@ -95,28 +109,21 @@ class ImportIndexStats extends BaseBatch{ def result = [:]; calculateAvgPriceIndex(city, year, month, result); - - def curMonthPriceMap = findHouse2(city, createDateString(year, month, 1, "-"), createDateString(year, month + 1, 1, "-")); - def lastMonthPriceMap = findHouse2(city, createDateString(year, month-1, 1, "-"), createDateString(year, month , 1, "-")); - def lastYearPriceMap = findHouse2(city, createDateString(year-1, month, 1, "-"), createDateString(year-1, month + 1, 1, "-")); - def fixPriceMap = findHouse2(city, createDateString(dingjiYear, month, 1, "-"), createDateString(dingjiYear, month+1 , 1, "-")); - - calculateAreaPriceInfex(result, 90, curMonthPriceMap.get("0_90"),lastMonthPriceMap.get("0_90"),lastYearPriceMap.get("0_90"), fixPriceMap.get("0_90"));//0-90 - calculateAreaPriceInfex(result, 144, curMonthPriceMap.get("90-144"),lastMonthPriceMap.get("90-144"),lastYearPriceMap.get("90-144"), fixPriceMap.get("90-144"));//90-144 - calculateAreaPriceInfex(result, 1000, curMonthPriceMap.get("144_500"),lastMonthPriceMap.get("144_500"),lastYearPriceMap.get("144_500"), fixPriceMap.get("144_500"));//144-1000 -// calculateAreaPriceInfex(city, year, month, result, 0, 90);//0-90 -// calculateAreaPriceInfex(city, year, month, result, 90, 144);//90-144 -// calculateAreaPriceInfex(city, year, month, result, 144, 1000);//144-1000 + calculateAreaPriceInfex(result, city, year, month, 90);//0-90 + calculateAreaPriceInfex(result, city, year, month, 144);//90-144 + calculateAreaPriceInfex(result, city, year, month, 1000);//144-1000 + - checkPriceIndex(result); +// checkPriceIndex(result);//涨跌幅控制 index++; if(result){ result.city = city; - result.yearmonth = date; + result.yearmonth = date.toInteger(); result.source = 2; result.remark = "均价计算"; result.cat = "district"; + result.type = "城市" savePriceIndex(result); } println "${index}"+ result; @@ -124,39 +131,55 @@ class ImportIndexStats extends BaseBatch{ } } - //计算新建住房的价格指数 + //计算住房的价格指数 def calculateAvgPriceIndex(def city, def year, def month, def result){ - def curMonthPrice = findCityByDates(city, createDateString(year, month, 1, "-"), createDateString(year, month + 1, 1, "-")); +// def curMonthPrice = findCityByDates(city, createDateString(year, month, 1, "-"), createDateString(year, month + 1, 1, "-")); + def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString())),"yyyyMMdd") + def endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+(month.toString()))),"yyyyMMdd") + def curMonthPrice = findHouse3(city, startDate.toInteger(), endDate.toInteger(), null) float markup = 0f; float yearMarkup = 0f; float dingJiMarkup = 0f; //环比涨跌幅 - def lastMonthPrice = findCityByDates(city, createDateString(year, month - 1, 1, "-"), createDateString(year, month, 1, "-")); + +// def lastMonthPrice = findCityByDates(city, createDateString(year, month - 1, 1, "-"), createDateString(year, month, 1, "-")); + startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString()),-1),"yyyyMMdd") + endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString()),-1),"yyyyMMdd") + def lastMonthPrice = findHouse3(city, startDate.toInteger(), endDate.toInteger(), null) if(lastMonthPrice){ markup = curMonthPrice *100/lastMonthPrice markup = DataUtil.getDoubleRound(1,markup); - }else{ - def v = random(-3, 3) + 100; - markup = v; } +// else{ +// def v = random(-3, 3) + 100; +// markup = v; +// } //同比涨跌幅 - def lastYearPrice = findCityByDates(city, createDateString(year-1, month, 1, "-"), createDateString(year-1, month+1 , 1, "-")); +// def lastYearPrice = findCityByDates(city, createDateString(year-1, month, 1, "-"), createDateString(year-1, month+1 , 1, "-")); + startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM((year-1).toString()+month.toString())),"yyyyMMdd") + endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM((year-1).toString()+(month.toString()))),"yyyyMMdd") + def lastYearPrice = findHouse3(city, startDate.toInteger(), endDate.toInteger(), null) if(lastYearPrice){ yearMarkup = curMonthPrice * 100/lastYearPrice; yearMarkup = DataUtil.getRound(1,yearMarkup); - }else{ - def v = random(-5, 5) + 100; - yearMarkup = v; } +// else{ +// def v = random(-5, 5) + 100; +// yearMarkup = v; +// } //定基涨跌幅 - def dingJiPrice = findCityByDates(city, createDateString(dingjiYear, month, 1, "-"), createDateString(dingjiYear, month+1 , 1, "-")); +// def dingJiPrice = findCityByDates(city, createDateString(dingjiYear, month, 1, "-"), createDateString(dingjiYear, month+1 , 1, "-")); + startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD2(dingjiYear.toString()+"0101")),"yyyyMMdd") + endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD2(dingjiYear.toInteger()+"1231")),"yyyyMMdd") + def dingJiPrice = findHouse3(city, startDate, endDate, null) if(dingJiPrice){ dingJiMarkup = curMonthPrice*100/dingJiPrice; dingJiMarkup = DataUtil.getRound(1,dingJiMarkup); - }else{ - def v = random(-8, 8) + 100; - dingJiMarkup = v; } +// else{ +// def v = random(-8, 8) + 100; +// dingJiMarkup = v; +// } if(markup){ result.markup = markup; @@ -173,45 +196,53 @@ class ImportIndexStats extends BaseBatch{ return result; } - + + //计算住宅按平米分类的价格指数 - def calculateAreaPriceInfex(def result, def endArea, def curHousePrices1, def lastMonthHousePrices1, def lastYearHousePrice2, def dingjiHousePrices3){ - //def curHousePrices1 = findHouse(city, startArea, endArea, createDateString(year, month, 1, "-"), createDateString(year, month + 1, 1, "-")); - def cur_price = getAvgPrice(curHousePrices1); + def calculateAreaPriceInfex(def result, def city, def year, def month, def endArea){ + def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString())),"yyyyMMdd") + def endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+(month.toString()))),"yyyyMMdd") + def cur_price = findHouse3(city, startDate, endDate, endArea); def areaMarkup = 0; def areaYearMarkup = 0; def areaDingJiMarkup = 0; //环比涨跌幅 - //def lastMonthHousePrices1 = findHouse(city, startArea, endArea, createDateString(year, month-1, 1, "-"), createDateString(year, month , 1, "-")); - def lastMonthlt90_price = getAvgPrice(lastMonthHousePrices1); + startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString()),-1),"yyyyMMdd") + endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString()),-1),"yyyyMMdd") + def lastMonthlt90_price = findHouse3(city, startDate, endDate, endArea); if(cur_price && lastMonthlt90_price){ areaMarkup = cur_price*100/lastMonthlt90_price areaMarkup = DataUtil.getRound(1,areaMarkup); - }else{ - def v = random(-3, 3) + 100; - areaMarkup = v; } +// else{ +// def v = random(-3, 3) + 100; +// areaMarkup = v; +// } - //def lastYearHousePrice2 = findHouse(city, startArea, endArea, createDateString(year-1, month, 1, "-"), createDateString(year-1, month + 1, 1, "-")); - def lastYearprice = getAvgPrice(lastYearHousePrice2); + startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM((year-1).toString()+month.toString())),"yyyyMMdd") + endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM((year-1).toString()+(month.toString()))),"yyyyMMdd") + def lastYearprice = findHouse3(city, startDate, endDate, endArea); //同比涨跌幅 if(cur_price && lastYearprice){ areaYearMarkup = cur_price *100/lastYearprice areaYearMarkup = DataUtil.getRound(1,areaYearMarkup); - }else{ - def v = random(-5, 5) + 100; - areaYearMarkup = v; } +// else{ +// def v = random(-5, 5) + 100; +// areaYearMarkup = v; +// } //定基涨跌幅 - //def dingjiHousePrices3 = findHouse(city, startArea, endArea, createDateString(2010, month, 1, "-"), createDateString(2010, month+1 , 1, "-")); - def dingJiPrice = getAvgPrice(dingjiHousePrices3); + startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD2(dingjiYear.toString()+"0101")),"yyyyMMdd") + endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD2(dingjiYear.toInteger()+"1231")),"yyyyMMdd") + def dingJiPrice = findHouse3(city, startDate, endDate, endArea); if(cur_price && dingJiPrice){ areaDingJiMarkup = cur_price *100/dingJiPrice areaDingJiMarkup = DataUtil.getRound(1,areaDingJiMarkup); - }else{ - def v = random(-8, 8) + 100; - areaDingJiMarkup = v; } +// else{ +// def v = random(-8, 8) + 100; +// areaDingJiMarkup = v; +// } if(areaMarkup){ @@ -320,27 +351,56 @@ class ImportIndexStats extends BaseBatch{ // def dbCursor = seawater.find(q, keys).batchSize(5000); // Iterator it = dbCursor.iterator() - ResultSet rs = dataSource.connection.createStatement().executeQuery(sqlBuffer.toString()) println city +" : "+startDate+" "+endDate +" "+startArea+"-"+endArea def prices = []; - while (rs.next()) { + ElasticUtils.executeSqlQuery(sqlBuffer.toString(),{ rs-> def area = (Double) rs.getObject("area") def totalPrice = (Integer) rs.getObject("total_price") - if(!totalPrice){ - continue; - } - if(area <= 25 && area>=500){ - continue; - } + def price = totalPrice.toInteger()/area.toDouble(); if(price > 1000 && price < 200000){ prices << price.toInteger() } - } + }) return prices; } + + + def findHouse3(def city,def startDate, def endDate, def endArea){ + + final StringBuffer sqlBuffer = new StringBuffer() + sqlBuffer.append("SELECT avg(avg_price) as avg_price FROM \"seawater-20*\" WHERE 1=1") + sqlBuffer.append(" and city = '").append(city).append("'") + sqlBuffer.append(" and cat = 'sell'") + sqlBuffer.append(" and p_date >="+startDate).append(" and p_date <="+endDate); + sqlBuffer.append(" and avg_price < 300000") + if(endArea){ + if(endArea ==90){ + sqlBuffer.append(" and area>=25 and area<90 and total_price>0") + }else if (endArea == 144){ + sqlBuffer.append(" and area>=90 and area<144 and total_price>0 ") + }else if (endArea > 144){ + sqlBuffer.append(" and area>=144 and total_price>0 ") + } + } + + def avg_price = null; + try{ + ElasticUtils.executeSqlQuery(sqlBuffer.toString(),{ rs-> + avg_price = rs.avg_price + }) + }catch(Exception e){ + avg_price = findHouse3(city,startDate, endDate, endArea); + println e.getMessage() + } + if(avg_price){ + return (int)avg_price; + } + + return null + } @@ -367,21 +427,14 @@ class ImportIndexStats extends BaseBatch{ } sqlBuffer.append(" and cat = 'sell'") sqlBuffer.append(" and p_date >="+startDate).append(" and p_date <="+endDate); - sqlBuffer.append(" ORDER BY p_date desc limit 5000") + sqlBuffer.append(" and area>=25 and area<=500 and total_price>0 ORDER BY p_date desc limit 5000") def priceMap = [:]; try{ - ResultSet rs = dataSource.connection.createStatement().executeQuery(sqlBuffer.toString()) - while (rs.next()) { - def area = (Double) rs.getObject("area") - def totalPrice = (Integer) rs.getObject("total_price") - if(!totalPrice){ - continue; - } - if(area <= 25 && area>=500){ - continue; - } - + ElasticUtils.executeSqlQuery(sqlBuffer.toString(),{ rs-> + def area = rs.area + def totalPrice = rs.total_price + def areaKey = ""; if(area>0 && area<90){ areaKey = "0_90"; @@ -403,7 +456,7 @@ class ImportIndexStats extends BaseBatch{ prices << price.toInteger() } - } + }) }catch(Exception e){ findHouse2(city,startDate, endDate); } @@ -470,11 +523,12 @@ class ImportIndexStats extends BaseBatch{ } def findPriceIndexCitys(def date){ DBObject q = new BasicDBObject(); - q.put("yearmonth", date); - + q.put("yearmonth", date.toInteger()); + q.put("cat", "district") + DBObject keys = new BasicDBObject(); keys.put("city", 1) - def cursor = on_line.find(q, keys); + def cursor = STATS_INDEX_COLL.find(q, keys); def citys = []; for(def dbo : cursor){ if(!citys.contains(dbo.city)){ @@ -492,8 +546,7 @@ class ImportIndexStats extends BaseBatch{ DBObject keys = new BasicDBObject(); keys.put("city", 1) - def cursor = on_line.find(q, keys); - def citys = []; + def cursor = STATS_INDEX_COLL.find(q, keys); for(def dbo : cursor){ def id = dbo.get("_id"); return id; @@ -510,13 +563,13 @@ class ImportIndexStats extends BaseBatch{ dbo.put("cat",result.cat); dbo.put("c_date",new Date()); if(result.markup){ - dbo.put("new_chain", result.markup.toDouble()); + dbo.put("chain", result.markup.toDouble()); } if(result.yearMarkup){ - dbo.put("new_yeartoyear", result.yearMarkup.toDouble()); + dbo.put("yeartoyear", result.yearMarkup.toDouble()); } if(result.dingJiMarkup){ - dbo.put("new_fixedbase", result.dingJiMarkup.toDouble()); + dbo.put("fixedbase", result.dingJiMarkup.toDouble()); } if(result.areaMarkup90){ @@ -560,12 +613,151 @@ class ImportIndexStats extends BaseBatch{ if(id){ DBObject q = new BasicDBObject() q.put("_id", id) - on_line.update(q, new BasicDBObject('$set', dbo)); + STATS_INDEX_COLL.update(q, new BasicDBObject('$set', dbo)); }else{ - on_line.save(dbo); + STATS_INDEX_COLL.save(dbo); } - - } - + + def updateDataType(){ + def cursor = on_line.find(new BasicDBObject()).batchSize(5000) + def index = 0 + for(def d : cursor){ + index++ + def udata = new BasicDBObject() + udata.put("yearmonth", d.yearmonth.toInteger()) + on_line.update(new BasicDBObject("_id", d._id), new BasicDBObject('$set', udata)) + println index + } + } + + def synch(){ + def cursor = on_line.find(new BasicDBObject()).batchSize(5000) + for(def d : cursor){ + STATS_INDEX_COLL.save(d) + } + } + + + def synchTjjIndex(){ + def s = "202401" + def startDate = null; + def stop = false; + while(!stop){ + startDate = DateUtils.parseFromTightYYYYMM(s); + def year = startDate.getYear()+1900; + def month = startDate.month+1; + + def date = createDateString(year, month, 0, ""); + createTjjData(date) + println "运行......"+date+".......保存完成" + + s = DateUtils.addMonth(date, 1, "yyyyMM") + + if(year==2024 && month==8){ + stop = true; + } + + } + } + + def createTjjData(date){ + def queryStartDate = DateUtils.parseFromTightByPattern(date+"01", "yyyyMMdd") + def queryEndDate = DateUtils.parseFromTightByPattern(date+"05", "yyyyMMdd") + def sellIndexMap = findTjjIndex(indices_price_house_sellColl, queryStartDate, queryEndDate) + def sellIndexAreaMap = findTjjAreaIndex(indices_price_house_sell_typeColl, queryStartDate, queryEndDate) + + def newIndexMap = findTjjIndex(indices_price_house_newColl, queryStartDate, queryEndDate) + def newAreaIndexAreaMap = findTjjAreaIndex(indices_price_house_new_typeColl, queryStartDate, queryEndDate) + def rets = [] + sellIndexMap.each{city, d-> + def dbo = new BasicDBObject() + dbo.put("city",d.city) + dbo.put("yearmonth",date.toInteger()) + dbo.put("source" ,1) + dbo.put("remark" , "统计局数据导入") + dbo.put("cat" , "district") + dbo.put("c_date" , new Date()) + dbo.put("m_date" , new Date()) + dbo.put("type" , "城市") + dbo.put("chain" ,d.mom) + dbo.put("yeartoyear" , d.yoy) + dbo.put("fixedbase" , d.fixedbase) + + + def areaMap = sellIndexAreaMap.get(d.city) + def areaObj1 = areaMap.get("90") + dbo.put("below_chain" , areaObj1.mom) + dbo.put("below_yeartoyear" , areaObj1.yoy) + dbo.put("below_fixedbase" , areaObj1.fixedbase) + + def areaObj2 = areaMap.get("90-144") + dbo.put("among_chain" , areaObj2.mom) + dbo.put("among_yeartoyear" , areaObj2.yoy) + dbo.put("among_fixedbase" , areaObj2.fixedbase) + + def areaObj3 = areaMap.get("144") + dbo.put("above_chain" , areaObj3.mom) + dbo.put("above_yeartoyear" , areaObj3.yoy) + dbo.put("above_fixedbase" , areaObj3.fixedbase) + + def newObj = newIndexMap.get(d.city) + dbo.put("new_chain" , newObj.mom) + dbo.put("new_yeartoyear" , newObj.yoy) + dbo.put("new_fixedbase" , newObj.fixedbase) + + def newAreaMap = newAreaIndexAreaMap.get(d.city) + def areaNewObj1 = newAreaMap.get("90") + dbo.put("new_below_chain" , areaNewObj1.mom) + dbo.put("new_below_yeartoyear" , areaNewObj1.yoy) + dbo.put("new_below_fixedbase" , areaNewObj1.fixedbase) + + def areaNewObj2 = newAreaMap.get("90-144") + dbo.put("new_among_chain" , areaNewObj2.mom) + dbo.put("new_among_yeartoyear" , areaNewObj2.yoy) + dbo.put("new_among_fixedbase" , areaNewObj2.fixedbase) + + def areaNewObj3 = newAreaMap.get("144") + dbo.put("new_above_chain" , areaNewObj3.mom) + dbo.put("new_above_yeartoyear" , areaNewObj3.yoy) + dbo.put("new_above_fixedbase" , areaNewObj3.fixedbase) + + rets << dbo + } + STATS_INDEX_COLL.insert(rets) + } + + def findTjjIndex(coll, queryStartDate, queryEndDate){ + def q = new BasicDBObject() + q.put("date", new BasicDBObject('$gte',queryStartDate).append('$lte', queryEndDate)) + def dbcursor = coll.find(q) + def map = [:] + for(def d : dbcursor){ + def o = map.get(d.city) + if(!o){ + map.put(d.city,d) + } + } + return map; + } + + def findTjjAreaIndex(coll,queryStartDate, queryEndDate){ + def q = new BasicDBObject() + q.put("date", new BasicDBObject('$gte',queryStartDate).append('$lte', queryEndDate)) + def dbcursor = coll.find(q) + def map = [:] + for(def d : dbcursor){ + def areaMap = map.get(d.city) + if(!areaMap){ + areaMap = [:] + map.put(d.city, areaMap) + } + def o = areaMap.get(d.area) + if(!o){ + areaMap.put(d.area, d) + } + } + return map; + } + } From 9f867bf85284754722753fc495250128e8aaf925 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 27 Sep 2024 16:26:45 +0800 Subject: [PATCH 034/115] =?UTF-8?q?=E4=BD=8F=E5=AE=85=E6=8C=87=E6=95=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../script/trade/ImportIndexStats.groovy | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy index e27cd6de4..f36ccec6a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy @@ -81,11 +81,11 @@ class ImportIndexStats extends BaseBatch{ def date = createDateString(year, month, 0, ""); s = DateUtils.addMonth(date, 1, "yyyyMM") - if(year==2024 && month==8){ + if(year==2024 && month==9){ stop = true; } calculatePriceIndex(year, month); - println "运行......"+date + println "运行......"+date+" 完成" } @@ -94,15 +94,15 @@ class ImportIndexStats extends BaseBatch{ def calculatePriceIndex(def year, def month){ def citys =CommonDatautils.findAllCity(); def date = createDateString(year, month, 0, ""); - def haveIndexCitys = findPriceIndexCitys(date); + def haveIndexCitys = findPriceIndexCitys(date.toInteger()); def index = 0; if(citys){ for(def city : citys){ - if(cityList.contains(city)){ + if(haveIndexCitys.contains(city)){ continue; } - def id = findPriceIndex(city, date); + def id = findPriceIndex(city, date.toInteger()); if(id){//已计算 continue; } @@ -125,8 +125,10 @@ class ImportIndexStats extends BaseBatch{ result.cat = "district"; result.type = "城市" savePriceIndex(result); + println "${index}"+ result+" "; + }else{ + println "${index}"+ result+" "+city +" 无数据"; } - println "${index}"+ result; } } } @@ -523,7 +525,7 @@ class ImportIndexStats extends BaseBatch{ } def findPriceIndexCitys(def date){ DBObject q = new BasicDBObject(); - q.put("yearmonth", date.toInteger()); + q.put("yearmonth", date); q.put("cat", "district") DBObject keys = new BasicDBObject(); @@ -543,6 +545,7 @@ class ImportIndexStats extends BaseBatch{ DBObject q = new BasicDBObject(); q.put("yearmonth", date); q.put("city", city); + q.put("cat", "district"); DBObject keys = new BasicDBObject(); keys.put("city", 1) From 0e5fa242af2fc22eed6ff28999ff26449869c1c6 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 27 Sep 2024 16:36:34 +0800 Subject: [PATCH 035/115] =?UTF-8?q?=E5=8E=A6=E9=97=A8=E6=B6=89=E5=8F=B0?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../groovy/com/fangjia/script/gj/xiamen/XmBankFtpUtils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankFtpUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankFtpUtils.groovy index 1c1638c3c..5de2c1f4a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankFtpUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/XmBankFtpUtils.groovy @@ -12,7 +12,7 @@ class XmBankFtpUtils { static def ftpPort = 17495 static def ftpUser = "xmbank" static def ftpPassword = "Xmbank123!@#" - static def ftpPath = "/output/company" + static def ftpPath = "/output/free_trade_zone" From 778d50e38a808d6f6a8916603fd445b5e3793323 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 27 Sep 2024 17:19:20 +0800 Subject: [PATCH 036/115] =?UTF-8?q?=E7=A9=BA=E5=80=BC=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../groovy/com/fangjia/script/trade/ImportIndexStats.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy index f36ccec6a..6b186692a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/trade/ImportIndexStats.groovy @@ -148,7 +148,7 @@ class ImportIndexStats extends BaseBatch{ startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString()),-1),"yyyyMMdd") endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM(year.toString()+month.toString()),-1),"yyyyMMdd") def lastMonthPrice = findHouse3(city, startDate.toInteger(), endDate.toInteger(), null) - if(lastMonthPrice){ + if(curMonthPrice && lastMonthPrice){ markup = curMonthPrice *100/lastMonthPrice markup = DataUtil.getDoubleRound(1,markup); } @@ -161,7 +161,7 @@ class ImportIndexStats extends BaseBatch{ startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMM((year-1).toString()+month.toString())),"yyyyMMdd") endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMM((year-1).toString()+(month.toString()))),"yyyyMMdd") def lastYearPrice = findHouse3(city, startDate.toInteger(), endDate.toInteger(), null) - if(lastYearPrice){ + if(curMonthPrice && lastYearPrice){ yearMarkup = curMonthPrice * 100/lastYearPrice; yearMarkup = DataUtil.getRound(1,yearMarkup); } @@ -174,7 +174,7 @@ class ImportIndexStats extends BaseBatch{ startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightYYYYMMDD2(dingjiYear.toString()+"0101")),"yyyyMMdd") endDate = DateUtils.formatDateByPattern(DateUtils.getLastDayOfMonth(DateUtils.parseFromTightYYYYMMDD2(dingjiYear.toInteger()+"1231")),"yyyyMMdd") def dingJiPrice = findHouse3(city, startDate, endDate, null) - if(dingJiPrice){ + if(curMonthPrice && dingJiPrice){ dingJiMarkup = curMonthPrice*100/dingJiPrice; dingJiMarkup = DataUtil.getRound(1,dingJiMarkup); } From 404f8cb58081cec36e51ac5c9be929a02993e828 Mon Sep 17 00:00:00 2001 From: majintao Date: Fri, 27 Sep 2024 18:31:38 +0800 Subject: [PATCH 037/115] =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=8C=BA=E5=9B=B4?= =?UTF-8?q?=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DevelopmentZoneController.java | 19 +- .../controllers/IndexStatsController.java | 6 +- .../bkoff/model/DevelopmentZoneModel.java | 10 + .../src/main/webapp/developmentZone/edit.ftl | 613 ++++++++---------- .../main/webapp/developmentZone/editFence.ftl | 531 +++++++++++++++ .../src/main/webapp/developmentZone/list.ftl | 5 +- .../dal/mongo/model/DevelopmentZone.java | 11 + .../fangjia/dal/mongo/model/StatsIndex.java | 33 +- 8 files changed, 875 insertions(+), 353 deletions(-) create mode 100644 projects/fangjia-bkoff/src/main/webapp/developmentZone/editFence.ftl diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DevelopmentZoneController.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DevelopmentZoneController.java index 4b04e0c41..9cc24280f 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DevelopmentZoneController.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DevelopmentZoneController.java @@ -33,9 +33,9 @@ public class DevelopmentZoneController { if (pager.getCurrentPage() > 100) { pager.setCurrentPage(1); } - long countDev = developmentZoneService.countDev(model.getProvince(),model.getCityName1(), model.getName(), model.getLevel()); + long countDev = developmentZoneService.countDev(model.getProvince(), model.getCityName1(), model.getName(), model.getLevel()); pager.setTotalRows((int) countDev); - List developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(),model.getCityName1(), model.getName(), model.getLevel(), pager); + List developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(), model.getCityName1(), model.getName(), model.getLevel(), pager); model.setDevelopmentZoneList(developmentZones); model.setPager(pager); return model; @@ -59,6 +59,15 @@ public class DevelopmentZoneController { return model; } + public Object editFenceAction(DevelopmentZoneModel model) { + if (model.getId() == null) { + return model; + } + + model.setDevelopmentZone(developmentZoneService.findDevelopmentZone(model.getId())); + return model; + } + public Object deleteAction(LatlngPolygonModel model) { JsonModel ret = new JsonModel(); if (model.getId() == null) { @@ -127,6 +136,7 @@ public class DevelopmentZoneController { entity.setUrl(StringUtils.isBlank(model.getUrl()) ? "" : model.getUrl()); entity.setCityName1(StringUtils.isBlank(model.getCityName1()) ? "" : model.getCityName1()); entity.setDistrict(StringUtils.isBlank(model.getDistrict()) ? "" : model.getDistrict()); + entity.setImgUrl(StringUtils.isBlank(model.getImgUrl()) ? "" : model.getImgUrl()); //记录操作人员 entity.setOperator(user.getRealName()); developmentZoneService.saveDevelopmentZone(entity); @@ -201,9 +211,12 @@ public class DevelopmentZoneController { if (StringUtils.isNotBlank(model.getCityName1())) { udata.put("cityName1", model.getCityName1()); } - if (StringUtils.isNotBlank(model.getDistrict())){ + if (StringUtils.isNotBlank(model.getDistrict())) { udata.put("district", model.getDistrict()); } + if (StringUtils.isNotBlank(model.getImgUrl())){ + udata.put("imgUrl", model.getImgUrl()); + } udata.put("createTime", new Date()); //记录操作人员 udata.put("operator", user.getRealName()); diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/IndexStatsController.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/IndexStatsController.java index 3c555754b..394b7b033 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/IndexStatsController.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/IndexStatsController.java @@ -34,13 +34,13 @@ public class IndexStatsController { SimpleDateFormat sdf=new SimpleDateFormat("yyyyMM"); yearmonth=sdf.format(date); } - List statsIndexs=statsIndexService.findAllStatsNocat(yearmonth,"district",model.getSource()); + List statsIndexs=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"district",model.getSource()); Integer earliestMonth = statsIndexService.findEarliestMonth(null, null, model.getSource()); model.setEarliestMonth(earliestMonth.toString().substring(0, 4) + "-" + earliestMonth.toString().substring(4)); List newStats=new ArrayList(); List oldStats=new ArrayList(); - List shopStats=statsIndexService.findAllStatsNocat(yearmonth,"shop",model.getSource()); - List officeStats=statsIndexService.findAllStatsNocat(yearmonth,"office",model.getSource()); + List shopStats=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"shop",model.getSource()); + List officeStats=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"office",model.getSource()); if(statsIndexs!=null && statsIndexs.size()>0){ for(StatsIndex stat:statsIndexs){ StatsIndex newstat=new StatsIndex(); diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/DevelopmentZoneModel.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/DevelopmentZoneModel.java index 54f85ab42..a4b4e7552 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/DevelopmentZoneModel.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/DevelopmentZoneModel.java @@ -35,6 +35,8 @@ public class DevelopmentZoneModel extends BaseModel { private String cityName1; + private String imgUrl; + public String getAlias() { return alias; } @@ -194,4 +196,12 @@ public class DevelopmentZoneModel extends BaseModel { public void setCityName1(String cityName1) { this.cityName1 = cityName1; } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } } diff --git a/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl b/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl index b75eca58f..7c48ce0c8 100644 --- a/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/developmentZone/edit.ftl @@ -1,368 +1,297 @@ <#ftl attributes={"content_type":"text/html; charset=UTF-8"}> <#compress> - - - - - 寮�鍙戝尯鍥存爮鍒楄〃 - - - - -<#include "/common_js.ftl" /> -<#include "/layout/header.ftl" /> -
-