Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj

This commit is contained in:
2025-03-17 15:13:06 +08:00
207 changed files with 17219 additions and 7547 deletions
+1
View File
@@ -21,3 +21,4 @@ deliverables/*/.idea
/projects/fangjia-open/.idea
*.idea*
classes
**/sdklog/*
Vendored
+6 -6
View File
@@ -2,7 +2,7 @@
pipeline {
agent any
parameters {
choice(name: 'PROJECT_NAME', choices: ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke'], description: '请选择发布的项目')
choice(name: 'PROJECT_NAME', choices: ['chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen'], description: '请选择发布的项目')
}
tools {
jdk 'JDK8'
@@ -17,7 +17,7 @@ pipeline {
stage('Maven Build') {
steps {
script {
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke']
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen']
for (def project : projects) {
if (params.PROJECT_NAME == project) {
dir("deliverables/${project}") {
@@ -33,8 +33,8 @@ pipeline {
stage('Docker Build') {
steps {
script {
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke']
def imagesName = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke"]
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen']
def imagesName = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke", 'fangjiaopen': 'fangjia-open']
for (def project : projects) {
if (params.PROJECT_NAME == project) {
dir("projects/${imagesName[project]}") {
@@ -53,8 +53,8 @@ pipeline {
stage('K8S Deploy') {
steps {
script {
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke']
def k8s_config_map = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke"]
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen']
def k8s_config_map = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke", 'fangjiaopen': 'fangjia-open']
for (def project : projects) {
if (params.PROJECT_NAME == project) {
dir("deliverables/k8s") {
+26 -7
View File
@@ -1,4 +1,4 @@
:apiVersion: apps/v1
apiVersion: apps/v1
kind: Deployment
metadata:
name: fangjia-open
@@ -37,20 +37,39 @@ spec:
- containerPort: 8080
name: web
protocol: TCP
# readinessProbe:
# httpGet:
# path: /k8s/readiness
# port: web
# initialDelaySeconds: 5
# periodSeconds: 10
# livenessProbe:
# httpGet:
# path: /k8s/liveness
# port: web
# initialDelaySeconds: 10
# periodSeconds: 5
volumeMounts:
- name: host-time
mountPath: /etc/localtime
- name: nfs
- name: goojiaconfig
mountPath: /home/goojia/goojiaconfig
volumes:
- name: host-time
hostPath:
path: /etc/localtime
- name: nfs
nfs:
path: /home/nfs_data/goojiaconfig
server: 192.168.0.18
- name: goojiaconfig
cephfs:
monitors:
- 192.168.0.208:6789
- 192.168.0.209:6789
- 192.168.0.210:6789
user: admin
path: /k8s/goojiaconfig
secretRef:
name: ceph-secret
readOnly: false
---
apiVersion: v1
@@ -69,4 +88,4 @@ spec:
ports:
- port: 8080
targetPort: 8080
nodePort: 38089
nodePort: 31088
@@ -0,0 +1,84 @@
package com.fangjia.bkoff.controllers;
import com.alibaba.excel.util.DateUtils;
import com.fangjia.bkoff.model.ApiCountLogModel;
import com.fangjia.bkoff.model.ApiUserModel;
import com.fangjia.bkoff.model.JsonModel;
import com.fangjia.core.util.*;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
import com.fangjia.dal.mongo.model.ApiCountLog;
import com.fangjia.dal.mongo.model.ApiInvokeStatistical;
import com.fangjia.dal.mongo.model.ApiUserCfg;
import com.fangjia.dal.mongo.model.bkoff.BkoffUsers;
import com.fangjia.dal.mongo.open.model.ApiJsonViewConfig;
import com.fangjia.dal.mongo.open.model.ApiUserAuthority;
import com.fangjia.dal.mongo.open.model.OpenResource;
import com.fangjia.dal.mongo.tool.model.ApiCountCity;
import com.fangjia.dal.mongo.tool.model.ApiVisitCount;
import com.fangjia.dal.mongo.tool.model.OpenResourceCount;
import com.fangjia.dal.mongo.tool.model.OpenUriAnaly;
import com.fangjia.dal.sql.model.ApiUser;
import com.fangjia.dal.sql.model.User;
import com.fangjia.service.api.ApiUserCfgService;
import com.fangjia.service.mongo.bkoff.ApiInvokeStatisticalService;
import com.fangjia.service.mongo.bkoff.BkoffUsersService;
import com.fangjia.service.mongo.fangjia.ApiCountLogService;
import com.fangjia.service.mongo.fangjia.ServerAreaService;
import com.fangjia.service.open.*;
import com.fangjia.service.sql.ApiUserService;
import com.fangjia.service.sql.UserService;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.json.JSONArray;
import org.sothis.core.util.CollectionUtils;
import org.sothis.core.util.Pager;
import org.sothis.web.mvc.ActionContext;
import org.sothis.web.mvc.annotation.Param;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* apiÓû§¿ªÍ¨µÈ¹ÜÀícontroller
*
* @author
*/
public class ApiCountLogController {
private BkoffUsersService bkoffUsersService;
private ApiCountLogService apiCountLogService;
public Object listAction(ApiCountLogModel model) {
Pager pager = model.getPager(30);
if (pager.getCurrentPage() > 100) {
pager.setCurrentPage(1);
}
List<ApiCountLog> apiCountLogList = apiCountLogService.findApiCountLog(model.getUserId(), model.getUri(),pager);
model.setApiCountLogList(apiCountLogList);
pager.setTotalRows(apiCountLogList.size());
model.setPager(pager);
return model;
}
public void setBkoffUsersService(BkoffUsersService bkoffUsersService) {
this.bkoffUsersService = bkoffUsersService;
}
public void setApiCountLogService(ApiCountLogService apiCountLogService) {
this.apiCountLogService = apiCountLogService;
}
}
@@ -9,8 +9,11 @@ import com.fangjia.bkoff.model.JsonModel;
import com.fangjia.core.util.*;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
import com.fangjia.dal.mongo.model.ApiCountLog;
import com.fangjia.dal.mongo.model.ApiInvokeStatistical;
import com.fangjia.dal.mongo.model.ApiUserCfg;
import com.fangjia.dal.mongo.model.RegionBlock;
import com.fangjia.dal.mongo.model.bkoff.BkoffUsers;
import com.fangjia.dal.mongo.open.model.ApiJsonViewConfig;
import com.fangjia.dal.mongo.open.model.ApiUserAuthority;
import com.fangjia.dal.mongo.open.model.OpenResource;
@@ -21,7 +24,11 @@ import com.fangjia.dal.mongo.tool.model.OpenUriAnaly;
import com.fangjia.dal.sql.model.ApiUser;
import com.fangjia.dal.sql.model.User;
import com.fangjia.service.api.ApiUserCfgService;
import com.fangjia.service.bo.ServerAreaBo;
import com.fangjia.service.mongo.bkoff.ApiInvokeStatisticalService;
import com.fangjia.service.mongo.bkoff.BkoffUsersService;
import com.fangjia.service.mongo.fangjia.ApiCountLogService;
import com.fangjia.service.mongo.fangjia.RegionBlockService;
import com.fangjia.service.mongo.fangjia.ServerAreaService;
import com.fangjia.service.open.*;
import com.fangjia.service.sql.ApiUserService;
@@ -73,6 +80,10 @@ public class ApiUserController {
private ApiInvokeStatisticalService apiInvokeStatisticalService;
private ApiVisitCountService apiVisitCountService;
private ApiCountCityService apiCountCityService;
private BkoffUsersService bkoffUsersService;
private ApiCountLogService apiCountLogService;
private RegionBlockService regionBlockService;
/**
* 所有api用户的信息展示
@@ -89,7 +100,21 @@ public class ApiUserController {
* @param ApiUser
* :用户的appKey username、等资料
*/
List<ApiUser> apiUsers = this.apiUserService.findApiUsersByParamsSortDate(null);
ArrayList<QueryParam> queryParams = new ArrayList<QueryParam>();
if (model.getStatus() != null) {
queryParams.add(new QueryParam("status", model.getStatus()));
} else {
queryParams.add(new QueryParam("status", 0));
}
if (model.getIsTest() != null) {
queryParams.add(new QueryParam("isTest", model.getIsTest()));
} else {
queryParams.add(new QueryParam("isTest", 0));
}
if (model.getPurpose() != null) {
queryParams.add(new QueryParam("purpose", model.getPurpose()));
}
List<ApiUser> apiUsers = this.apiUserService.findApiUsersByParamsSortDate(queryParams);
List<ApiUserBo> apiUserBoList = new ArrayList<ApiUserBo>();
for (ApiUser apiUser : apiUsers) {
User user = this.userService.findById(apiUser.getId());
@@ -113,7 +138,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);
}
@@ -195,9 +222,14 @@ public class ApiUserController {
apiUser.setDeadTime(model.getDeadTime());
apiUser.setManager(model.getManager());
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");
model.setPriceType("2B");
modifyUserCfg(id, ApiUserCfg.ApiUserCfgKey.PRICE_TYPE, model.getPriceType());
if (model.getEvaluateRate() != null && model.getEvaluateRate() != 0) {
ApiUserCfg apiUserCfg = new ApiUserCfg();
@@ -231,6 +263,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());
@@ -238,6 +273,8 @@ public class ApiUserController {
bo.setDeadTime(apiUser.getDeadTime());
bo.setManager(apiUser.getManager());
bo.setIsMonitor(apiUser.getIsMonitor());
bo.setContact(apiUser.getContact());
bo.setPhone(apiUser.getPhone());
ApiUserCfg apiUserCfg_rate = apiUserCfgService.findByUserId(apiUser.getId(), ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE);
if (apiUserCfg_rate != null) {
bo.setEvaluateRate((Double) apiUserCfg_rate.getCfgValue());
@@ -291,6 +328,11 @@ public class ApiUserController {
dataApiUser.put("deadTime", model.getDeadTime());
dataApiUser.put("manager", model.getManager());
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);
@@ -424,6 +466,7 @@ public class ApiUserController {
ApiUserAuthority apiUserAuthority = apiUserAuthorityService.findByUserId(model.getUserId());
Map<String, Double> cityCreditMap = apiUserAuthority.getCityCreditMap();
model.setDisplayName(user.getDisplayName() == null ? "" : user.getDisplayName());
model.setProvinceList(getProvinceList());
model.setCityFirstLetters(Arrays.asList(getCityFirstLetter()));
List<ServerArea> serverAreaList = serverAreaService.findAll();// Load城市列表
if (StringUtils.isBlank(model.getType()) || "all".equals(model.getType())) {// 字母分组列表
@@ -444,6 +487,19 @@ public class ApiUserController {
}
serverAreaLetterList.add(map);
}
if (model.getType().equals(serverArea.getProvince())) {
Map<String, Object> map = new HashMap<String, Object>();
if (null != cityCreditMap && cityCreditMap.get(serverArea.getDisplay()) != null) {
map.put("key0", serverArea);
java.text.DecimalFormat df = new java.text.DecimalFormat("######0.00");
String rate = df.format(cityCreditMap.get(serverArea.getDisplay()));
map.put("key1", rate);
} else {
map.put("key0", serverArea);
map.put("key1", null);
}
serverAreaLetterList.add(map);
}
}
model.setServerAreaList(serverAreaLetterList);
}
@@ -586,7 +642,8 @@ public class ApiUserController {
* @param AuthorityBo
* :用户的appKey username、等资料
*/
List<OpenResource> openResourceList = openResourceService.findAll();
List<QueryParam> queryParams = Arrays.asList(new QueryParam("pubStatus", 1));
List<OpenResource> openResourceList = openResourceService.findOpenResource(queryParams);
List<AuthorityBo> authorityBoList = new ArrayList<AuthorityBo>();
ApiUserAuthority authority = apiUserAuthorityService.findByUserId(model.getUserId());
if (authority == null) {
@@ -621,7 +678,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());
@@ -677,6 +733,9 @@ public class ApiUserController {
public Object saveAuthAction(ApiUserModel model, HttpServletRequest request) throws IllegalAccessException {
List<OpenResource> openResourceList = openResourceService.findAll();
Map<String, String> apiMap = converMapData(openResourceList);
model.setViewType("json");
model.setViewParam("config", null);
Long userId = model.getUserId();
@@ -690,6 +749,7 @@ public class ApiUserController {
authority.setSupportLatLng(model.isSupportLatLng());
apiUserAuthorityService.save(authority);
} else {
Map<String, Integer> countMap = authority.getTotalCountMap();
if (model.getLimit() != null) {
Map<String, Integer> limitCountMap = authority.getLimitCountMap();
if (limitCountMap == null) {
@@ -703,7 +763,37 @@ public class ApiUserController {
if (totalCountMap == null) {
totalCountMap = new HashMap<String, Integer>();
}
totalCountMap.put(model.getUri(), model.getSum());
Integer count = model.getSum();
//增加次数修改日志
ApiCountLog apiCountLog = new ApiCountLog();
if (countMap != null && countMap.containsKey(model.getUri())) {
String bkoffUserId = (String) ThreadLocalData.getInstance().get(ThreadLocalKey.UserId);
User user = userService.findById(userId);
BkoffUsers bkoffUser = bkoffUsersService.findBkoffUsersById(bkoffUserId);
apiCountLog.setUserId(userId);
apiCountLog.setUserName(user.getDisplayName());
apiCountLog.setUri(model.getUri());
apiCountLog.setUriName(apiMap.get(model.getUri()));
apiCountLog.setOperator(bkoffUser.getRealName());
Integer oldCount = countMap.get(model.getUri());
apiCountLog.setOldCount(oldCount);
apiCountLog.setNewCount(count);
if (count > oldCount) {
apiCountLog.setOperate("增加" + (count - oldCount) + "次");
} else if (oldCount > count) {
apiCountLog.setOperate("减少" + (oldCount - count) + "次");
}
apiCountLog.setOperateTime(new Date());
// 次数改变了再记录
if (!count.equals(oldCount)) {
apiCountLogService.save(apiCountLog);
}
}
totalCountMap.put(model.getUri(), count);
if (count == 0) {
totalCountMap.remove(model.getUri());
}
authority.setTotalCountMap(totalCountMap);
}
if (model.getIsCheckCount() != null) {
@@ -1255,7 +1345,7 @@ public class ApiUserController {
dataList.add(row);
}
String dateStr ="("+ DateUtils.format(startDate, "yyyy/MM/dd") + "—" + DateUtils.format(endDate, "yyyy/MM/dd") +")";
String dateStr = "(" + DateUtils.format(startDate, "yyyy/MM/dd") + "—" + DateUtils.format(endDate, "yyyy/MM/dd") + ")";
String fileName = "用户账号使用统计" + dateStr + ".xlsx";
// ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build();
String displayName = URLEncoder.encode(fileName, "UTF-8");
@@ -1265,10 +1355,10 @@ public class ApiUserController {
Sheet sheet = workbook.createSheet("用户账号使用统计");
List<String> head = Arrays.asList(
"用户ID", "账号", "合同到期时间", "接口", "接口名称", "剩余使用次数",
"访问次数(近一周)", "日均访问量(近一周)","成功并有效(近一周)", "成功并无效(近一周)","失败次数(近一周)",
"访问次数(近一月)", "日均访问量(近一月)","成功并有效(近一月)", "成功并无效(近一月)","失败次数(近一月)",
"访问次数"+dateStr, "日均访问量"+dateStr,"成功并有效"+dateStr, "成功并无效"+dateStr,"失败次数"+dateStr
);
"访问次数(近一周)", "日均访问量(近一周)", "成功并有效(近一周)", "成功并无效(近一周)", "失败次数(近一周)",
"访问次数(近一月)", "日均访问量(近一月)", "成功并有效(近一月)", "成功并无效(近一月)", "失败次数(近一月)",
"访问次数" + dateStr, "日均访问量" + dateStr, "成功并有效" + dateStr, "成功并无效" + dateStr, "失败次数" + dateStr
);
// 创建表头
Row headRow = sheet.createRow(0);
for (int i = 0; i < head.size(); i++) {
@@ -1875,6 +1965,15 @@ public class ApiUserController {
"T", "W", "X", "Y", "Z"};
return cityFirstLetter;
}
private List<String> getProvinceList(){
List<String> provinces = Arrays.asList(
"山东", "福建", "河北", "河南", "湖北", "湖南", "江西", "海南",
"黑龙江", "陕西", "贵州", "新疆", "江苏", "安徽", "西藏",
"吉林", "山西", "甘肃", "宁夏", "四川", "浙江", "广西",
"云南", "直辖市", "内蒙古", "辽宁", "广东", "青海"
);
return provinces;
}
private Map<String, Map<String, Integer>> getCountByUri(List<ApiInvokeStatistical> apiInvokeStatisticalList) {
@@ -2032,4 +2131,144 @@ public class ApiUserController {
model.setViewParam("location", "/apiUser/list");
return model;
}
private Map<String, List<CityBo>> splitCityInProvince(List<ServerAreaBo> allCitys) {
if (CollectionUtils.isEmpty(allCitys)) {
return Collections.emptyMap();
}
List<RegionBlock> regionBlocks = regionBlockService.getRegionBlockList();
Map<String, List<RegionBlock>> regionMap = new TreeMap<String, List<RegionBlock>>();
for (RegionBlock regionBlock : regionBlocks) {
List<RegionBlock> regionBlockList = regionMap.get(regionBlock.getCity());
if (regionBlockList == null) {
regionBlockList = new ArrayList<RegionBlock>();
}
regionBlockList.add(regionBlock);
regionMap.put(regionBlock.getCity(), regionBlockList);
}
Map<String, List<CityBo>> ret = new HashMap<String, List<CityBo>>();
for (ServerAreaBo city : allCitys) {
String province = "";
if (city.getProvince() == null || city.getProvince() == "") {
province = null;
} else if (city.getProvince().equals("上海") || city.getProvince().equals("北京") || city.getProvince().equals("天津")
|| city.getProvince().equals("重庆")) {
province = "直辖市";
} else {
province = city.getProvince();
}
if (province != null) {
List<CityBo> cityBoList = ret.get(province);
if (CollectionUtils.isEmpty(cityBoList)) {
cityBoList = new ArrayList<CityBo>();
}
CityBo bo = new CityBo();
BeanUtils.copyProperties(city, bo);
List<RegionBlock> getRegionBlock = regionMap.get(city.getDisplay());
if (getRegionBlock != null) {
for (int i = getRegionBlock.size() - 1; i >= 0; i--) {
try {
if (getRegionBlock.get(i).getRegionType() != null && getRegionBlock.get(i).getRegionType() != 2) {
getRegionBlock.remove(i);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
bo.setCityRegion(getRegionBlock);
cityBoList.add(bo);
ret.put(province, cityBoList);
}
}
return ret;
}
public void setBkoffUsersService(BkoffUsersService bkoffUsersService) {
this.bkoffUsersService = bkoffUsersService;
}
public void setApiCountLogService(ApiCountLogService apiCountLogService) {
this.apiCountLogService = apiCountLogService;
}
public void setRegionBlockService(RegionBlockService regionBlockService) {
this.regionBlockService = regionBlockService;
}
public class CityBo {
private String id;
private String display;
private String spell;
private String name;
private List<RegionBlock> cityRegion;
private int haveDistrict; // 0:没有 , > 0:有
private Map<String, Integer> cityRegionHaveDistrict; // 区域有无小区统计 0:没有
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
public String getSpell() {
return spell;
}
public void setSpell(String spell) {
this.spell = spell;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<RegionBlock> getCityRegion() {
return cityRegion;
}
public void setCityRegion(List<RegionBlock> cityRegion) {
this.cityRegion = cityRegion;
}
public int getHaveDistrict() {
return haveDistrict;
}
public void setHaveDistrict(int haveDistrict) {
this.haveDistrict = haveDistrict;
}
public Map<String, Integer> getCityRegionHaveDistrict() {
return cityRegionHaveDistrict;
}
public void setCityRegionHaveDistrict(Map<String, Integer> cityRegionHaveDistrict) {
this.cityRegionHaveDistrict = cityRegionHaveDistrict;
}
}
}
@@ -3,9 +3,11 @@ package com.fangjia.bkoff.controllers;
import com.fangjia.bkoff.model.DevelopmentZoneModel;
import com.fangjia.bkoff.model.JsonModel;
import com.fangjia.bkoff.model.LatlngPolygonModel;
import com.fangjia.bkoff.util.ExcelUtils;
import com.fangjia.core.util.GeoUtils;
import com.fangjia.core.util.ThreadLocalData;
import com.fangjia.core.util.ThreadLocalKey;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.mongo.model.DevelopmentZone;
import com.fangjia.dal.mongo.model.LatlngPolygon;
import com.fangjia.dal.mongo.model.StatsIndex;
@@ -13,9 +15,19 @@ import com.fangjia.dal.mongo.model.bkoff.BkoffUsers;
import com.fangjia.service.mongo.bkoff.BkoffUsersService;
import com.fangjia.service.mongo.fangjia.DevelopmentZoneService;
import com.fangjia.service.mongo.fangjia.LatlngPolygonService;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import org.apache.commons.lang.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.sothis.core.util.Pager;
import org.sothis.web.mvc.ActionContext;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import static com.fangjia.core.util.GeoUtils.LAT;
@@ -33,9 +45,9 @@ public class DevelopmentZoneController {
if (pager.getCurrentPage() > 100) {
pager.setCurrentPage(1);
}
long countDev = developmentZoneService.countDev(model.getProvince(), model.getName(), model.getLevel());
long countDev = developmentZoneService.countDev(model.getProvince(), model.getCityName1(), model.getName(), model.getLevel(), model.getOperateResult());
pager.setTotalRows((int) countDev);
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(), model.getName(), model.getLevel(), pager);
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(), model.getCityName1(), model.getName(), model.getLevel(), model.getOperateResult(), pager);
model.setDevelopmentZoneList(developmentZones);
model.setPager(pager);
return model;
@@ -59,6 +71,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) {
@@ -110,6 +131,7 @@ public class DevelopmentZoneController {
Object coordinates = convertGeoList(model.getBdShape());
shape.put("coordinates", coordinates);
entity.setShape(shape);
entity.setOperateResult("已处理");
}
entity.setLevel(model.getLevel());
@@ -127,6 +149,8 @@ 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.setOperateResult(StringUtils.isBlank(model.getOperateResult()) ? "" : model.getOperateResult());
//记录操作人员
entity.setOperator(user.getRealName());
developmentZoneService.saveDevelopmentZone(entity);
@@ -168,6 +192,7 @@ public class DevelopmentZoneController {
Object coordinates = convertGeoList(model.getBdShape());
shape.put("coordinates", coordinates);
udata.put("shape", shape);
udata.put("operateResult", "已处理");
}
if (StringUtils.isNotBlank(model.getAlias())) {
String aliasString = model.getAlias().replaceAll(",", ",");
@@ -201,9 +226,15 @@ 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());
}
if (StringUtils.isNotBlank(model.getOperateResult())){
udata.put("operateResult", model.getOperateResult());
}
udata.put("createTime", new Date());
//记录操作人员
udata.put("operator", user.getRealName());
@@ -259,5 +290,22 @@ public class DevelopmentZoneController {
return gdLocationList;
}
public Object uploadAction(DevelopmentZoneModel model) throws IOException, UnirestException, JSONException {
JsonModel ret = new JsonModel();
Map<String, Object> data = new HashMap<String, Object>();
File file = model.getFile();
HttpResponse<String> response = Unirest.post("http://open.fangjia.com/files/uploadGridFs")
.field("file", file)
.field("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB")
.asString();
// 获取返回的链接
JSONObject jsonResponse = new JSONObject(response.getBody());
String link = jsonResponse.getJSONObject("result").getString("link");
data.put("imgUrl", link);
data.put("msg", "图片上传成功");
ret.setJsonModel(data);
return ret;
}
}
@@ -89,6 +89,7 @@ public class DistrictController {
private DealPriceService dealPriceService;
private AverageStatisticsService averageStatisticsService;
private static List<String> distTypes = Arrays.asList("多层", "小高层", "超高层", "高层", "花园洋房", "老洋房", "四合院");
private static List<String> villaTypes = Arrays.asList("独栋", "双拼", "联排", "叠加");
private static List<String> shopTypes = Arrays.asList("多层", "小高层", "超高层", "高层", "独栋", "双拼", "联排", "叠加");
@@ -1178,7 +1179,7 @@ public class DistrictController {
JsonModel model = new JsonModel();
List<District> districts = districtService.findByKey(city, region, name, cat);
List<District> districts = districtService.findAllByNameAndCat(city, region, name, cat);
boolean exist = false;
if (StringUtils.isNotBlank(id)) {
for (District district2 : districts) {
@@ -2284,7 +2285,6 @@ public class DistrictController {
data.put("markMap", markMap);
data.put("modificationDate", new Date());
districtService.updateById(data, district.getId());
//创建更新任务,用为更新常州农商行数据
createJnTask(district.getId(), null);
msg = "保存成功了!!!";
@@ -4211,5 +4211,4 @@ public class DistrictController {
public void setAverageStatisticsService(AverageStatisticsService averageStatisticsService) {
this.averageStatisticsService = averageStatisticsService;
}
}
@@ -34,13 +34,13 @@ public class IndexStatsController {
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMM");
yearmonth=sdf.format(date);
}
List<StatsIndex> statsIndexs=statsIndexService.findAllStatsNocat(yearmonth,"district",model.getSource());
List<StatsIndex> 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<StatsIndex> newStats=new ArrayList<StatsIndex>();
List<StatsIndex> oldStats=new ArrayList<StatsIndex>();
List<StatsIndex> shopStats=statsIndexService.findAllStatsNocat(yearmonth,"shop",model.getSource());
List<StatsIndex> officeStats=statsIndexService.findAllStatsNocat(yearmonth,"office",model.getSource());
List<StatsIndex> shopStats=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"shop",model.getSource());
List<StatsIndex> officeStats=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"office",model.getSource());
if(statsIndexs!=null && statsIndexs.size()>0){
for(StatsIndex stat:statsIndexs){
StatsIndex newstat=new StatsIndex();
@@ -2,10 +2,7 @@ package com.fangjia.bkoff.controllers;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.fangjia.bkoff.model.JsonModel;
import org.apache.commons.lang.StringUtils;
@@ -42,6 +39,15 @@ public class OpenResourceController {
}
public Object doAddAction(OpenResourceModel model) {
List<OpenResource> openResource = this.openResourceService.findOpenResource(null);
HashSet<Integer> apiCodeSet = new HashSet<Integer>();
for (OpenResource resource : openResource) {
apiCodeSet.add(resource.getApiCode());
}
if (model.getApiCode() != 0 && apiCodeSet.contains(model.getApiCode())){
model.setMsg("APICodeÒÑ´æÔÚ");
return model;
}
if (!"doAdd".equals(model.getMethod())) {
return model;
}
@@ -70,7 +76,9 @@ public class OpenResourceController {
OpenResource r = new OpenResource();
r.setUri(uri);
r.setName(name);
r.setApiCode(model.getApiCode());
r.setSaveResult(model.getSave_result());
r.setPubStatus(model.getPubStatus() ? 1 : 0);
r.setDescription(model.getDescription());
this.openResourceService.save(r);
model.setMsg("添加成功!");
@@ -80,6 +88,7 @@ public class OpenResourceController {
public Object doChangeAction(OpenResourceModel model){
Map<String, Object> data = new HashMap<String, Object>();
data.put("saveResult",model.getSave_result());
data.put("pubStatus",model.getPubStatus() ? 1 : 0);
this.openResourceService.update(data,model.getId());
model.setMsg("保存成功");
JsonModel model1 = new JsonModel();
@@ -105,6 +114,9 @@ public class OpenResourceController {
if (StringUtils.isNotBlank(model.getDescription())) {
data.put("description", model.getDescription());
}
if (0 != model.getApiCode()){
data.put("apiCode",model.getApiCode());
}
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("uri", uri));
params.add(new QueryParam("name", name));
@@ -141,7 +153,7 @@ public class OpenResourceController {
/**
* 格式化URI
*
*
* @param uri
* @return
*/
@@ -422,9 +422,11 @@ public class fjtEvaluationController {
row.createCell(6).setCellValue(bo.getCardId());
row.createCell(7).setCellValue(bo.getEmail());
row.createCell(8).setCellValue(allRoles.get(String.valueOf(bo.getRole())));
row.createCell(9).setCellValue(bo.getCharge() + "房豆");
row.createCell(9).setCellValue("");
row.createCell(10).setCellValue(DateUtil.formatByPattern(bo.getDateCreated(),"yyyy年MM月dd日"));
row.createCell(13).setCellValue(bo.getAccountChecker());
row.createCell(14).setCellValue(DateUtil.formatByPattern(bo.getEvaluationDate(), "yyyy年MM月dd日"));
row.createCell(14).setCellValue("");
row.createCell(17).setCellValue(DateUtil.formatByPattern(bo.getEvaluationDate(), "yyyy年MM月dd日"));
}
}
@@ -0,0 +1,116 @@
package com.fangjia.bkoff.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.fangjia.dal.mongo.model.ApiCountLog;
import com.fangjia.dal.mongo.model.Township;
import java.util.Date;
import java.util.List;
public class ApiCountLogModel extends BaseModel {
@JSONField(name = "id")
private String id;
@JSONField(name = "user_id")
private Long userId;
@JSONField(name = "uri")
private String uri;
@JSONField(name = "user_name")
private String uriName;
@JSONField(name = "operate")
private String operate;
@JSONField(name = "operator")
private String operator;
@JSONField(name = "operate_time")
private Date operateTime;
// 修改次数前总次数
@JSONField(name = "old_count")
private Integer oldCount;
// 修改次数后的次数
@JSONField(name = "new_count")
private Integer newCount;
private List<ApiCountLog> apiCountLogList;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getUriName() {
return uriName;
}
public void setUriName(String uriName) {
this.uriName = uriName;
}
public String getOperate() {
return operate;
}
public void setOperate(String operate) {
this.operate = operate;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public Date getOperateTime() {
return operateTime;
}
public void setOperateTime(Date operateTime) {
this.operateTime = operateTime;
}
public Integer getOldCount() {
return oldCount;
}
public void setOldCount(Integer oldCount) {
this.oldCount = oldCount;
}
public Integer getNewCount() {
return newCount;
}
public void setNewCount(Integer newCount) {
this.newCount = newCount;
}
public List<ApiCountLog> getApiCountLogList() {
return apiCountLogList;
}
public void setApiCountLogList(List<ApiCountLog> apiCountLogList) {
this.apiCountLogList = apiCountLogList;
}
}
@@ -40,6 +40,16 @@ public class ApiUserModel extends BaseModel {
private Map<String,Double> priceRatingMap;
private Integer isMonitor;
private String contact;
private String phone;
private Integer isMonitorStatistic;
private Integer isMonitorUsed;
private Integer isWarnExpired;
public String getPriceType() {
return priceType;
}
@@ -70,7 +80,7 @@ public class ApiUserModel extends BaseModel {
private String type;
private String citys;// spell
private String unCheckCitys;// Ò³Ãæ·´Ñ¡µÄcity
private int status;
private Integer status;
private String uri;
private boolean hasAuth;
private boolean supportLatLng;
@@ -94,6 +104,8 @@ public class ApiUserModel extends BaseModel {
private Integer isCheckCount;
private String openResourseUrisMap;
private List<String> provinceList;
public String getOpenResourseUrisMap() {
return openResourseUrisMap;
@@ -378,15 +390,15 @@ public class ApiUserModel extends BaseModel {
this.limit = limit;
}
public int getStatus() {
public Integer getStatus() {
return status;
}
public void setStatus(int status) {
public void setStatus(Integer status) {
this.status = status;
}
public String getCompany() {
public String getCompany() {
return company;
}
@@ -615,4 +627,52 @@ public class ApiUserModel extends BaseModel {
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 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;
}
public List<String> getProvinceList() {
return provinceList;
}
public void setProvinceList(List<String> provinceList) {
this.provinceList = provinceList;
}
}
@@ -3,6 +3,7 @@ package com.fangjia.bkoff.model;
import com.fangjia.dal.mongo.model.DevelopmentZone;
import com.fangjia.dal.mongo.model.LatlngPolygon;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -35,6 +36,12 @@ public class DevelopmentZoneModel extends BaseModel {
private String cityName1;
private String imgUrl;
private File file;
private String operateResult;
public String getAlias() {
return alias;
}
@@ -194,4 +201,29 @@ 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;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getOperateResult() {
return operateResult;
}
public void setOperateResult(String operateResult) {
this.operateResult = operateResult;
}
}
@@ -28,6 +28,9 @@ public class OpenResourceModel extends BaseModel {
private Boolean save_result;
private OpenResource or;
private Boolean pubStatus;
private int apiCode;
public String getExceptId() {
return exceptId;
@@ -116,4 +119,20 @@ public class OpenResourceModel extends BaseModel {
public void setSave_result(Boolean save_result) {
this.save_result = save_result;
}
public Boolean getPubStatus() {
return pubStatus;
}
public void setPubStatus(Boolean pubStatus) {
this.pubStatus = pubStatus;
}
public int getApiCode() {
return apiCode;
}
public void setApiCode(int apiCode) {
this.apiCode = apiCode;
}
}
@@ -77,4 +77,4 @@ merchantno=10000469946
#appKey
appKey=SQKK10000469946
#\u7EDF\u4E00\u9274\u6743\u7ED1\u5361\u8BF7\u6C42
authbindcardreqUri=/rest/v1.0/paperorder/unified/pay
authbindcardreqUri=/rest/v1.0/paperorder/unified/pay
@@ -0,0 +1,63 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>客户API次数操作日志</title>
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<#include "/common_js.ftl" />
<#include "/layout/header.ftl" />
<div class="main-content">
<form action="../apiCountLog/list" id="_search_log_form">
<div>
<label for="userId">用户ID:</label>
<input type="text" name="userId" id="userId" class="input-medium" style="margin-top:9px;"
value="${userId!}"></input>
<label for="uri">uri:</label>
<input type="text" name="uri" id="uri" class="input-medium" style="margin-top:9px;"
value="${uri!}"></input>
<input id="queryBtn" class="btn btn-primary" type="submit" value="查询"/>
</div>
</form>
<div class="list" style="margin-top:5px;">
<span style="font-size:12px;">查询到<b style="color:red;">${pager.totalRows!}</b>条记录</span>
<table style="float:left;" name="reginTable" class="regionTab">
<tr>
<th>用户ID</th>
<th>用户昵称</th>
<th>uri</th>
<th>API名称</th>
<th>操作</th>
<th>原次数</th>
<th>现次数</th>
<th>操作人员</th>
<th>修改日期</th>
</tr>
<#list apiCountLogList as it>
<tr>
<td>${it.userId!}</td>
<td>${it.userName!}</td>
<td>${it.uri!}</td>
<td>${it.uriName!}</td>
<td>${it.operate!}</td>
<td>${it.oldCount!}</td>
<td>${it.newCount!}</td>
<td>${it.operator!}</td>
<td>${it.operateTime!?string("yyyy-MM-dd HH:mm:ss")}</td>
</tr>
</#list>
</table>
<#if pager??>
<@d_pager controller="apiCountLog" action="list" currentPage=pager.currentPage totalPages=pager.totalPages theme="full"/>
</#if>
</div>
</div>
</body>
</html>
</#compress>
@@ -34,12 +34,12 @@
<form id="addForm" action="doAdd" method="post">
<tr>
<td><b>昵称</b></td>
<td><input name="displayName" value="${displayName!}"/></td>
<td><input id="displayName" name="displayName" placeholder="必填项" value="${displayName!}"/></td>
</tr>
<tr>
<td><b>用户名</b></td>
<input name="userId" value="${userId!}" type="hidden"/>
<td><input id="userName" name="userName" value="${userName!}"/></td>
<td><input id="userName" name="userName" placeholder="必填项" value="${userName!}"/></td>
</tr>
<tr>
<td><b>密码</b></td>
@@ -59,7 +59,7 @@
<td>账户用途</td>
<td>
<select name="purpose">
<option value="">请选择</option>
<#-- <option value="">请选择</option>-->
<option value="1">API</option>
<option value="2">PDS</option>
<option value="4">房生活</option>
@@ -69,21 +69,54 @@
<tr>
<td>是否监控</td>
<td>
<input type="radio" name="isMonitor" value="0" checked="checked"/>不监控
<input type="radio" name="isMonitor" value="1" style="margin-left: 15px;"/>监控
<input type="radio" name="isMonitor" value="0" />不监控
<input type="radio" name="isMonitor" value="1" checked="checked" style="margin-left: 15px;"/>监控
</td>
</tr>
<tr>
<td>是否需要API统计量</td>
<td>
<input type="radio" name="isMonitorStatistic" value="0" />不需要
<input type="radio" checked="checked" name="isMonitorStatistic" value="1" style="margin-left: 15px;"/>需要
</td>
</tr>
<tr>
<td>是否需要API费用使用量</td>
<td>
<input type="radio" name="isMonitorUsed" value="0" />不需要
<input type="radio" checked="checked" name="isMonitorUsed" value="1" style="margin-left: 15px;"/>需要
</td>
</tr>
<tr>
<td>是否提醒即将到期</td>
<td>
<input type="radio" name="isWarnExpired" value="0" />不提醒
<input type="radio" checked="checked" name="isWarnExpired" value="1" style="margin-left: 15px;"/>提醒
</td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" value="${email!}"/></td>
<td>
<div style="display: inline-block;">
<textarea id="email" name="email" rows="5" cols="12"
style="height: 100px;width: 250px;float: left">${email!}</textarea>
</div>
<div style="display: inline-block;">
(每行一个,第一个为发送,其余抄送)<br/>
例子:<br/>
123456@qq.com<br/>
88888@163.com<br/>
987654@gmail.com
</div>
</td>
</tr>
<tr>
<td>销售负责人</td>
<td><input name="manager" value="${manager!}"/></td>
<td><input id="manager" name="manager" placeholder="必填项" value="${manager!}"/></td>
</tr>
<tr>
<td>公司</td>
<td><input name="company" value="${company!}"/></td>
<td><input id="company" name="company" placeholder="必填项" value="${company!}"/></td>
</tr>
<tr>
<td>估价调整比率</td>
@@ -92,13 +125,21 @@
</tr>
<tr>
<td>siteName</td>
<td><input name="siteName" value="${siteName!}"/></td>
<td><input name="siteName" value="${siteName!}"/></td>
</tr>
<tr>
<td>到期时间</td>
<td><input name="deadTime"
<td><input name="deadTime" id="deadTime" placeholder="必填项"
onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-{%d+7}'})"/></td>
</tr>
<tr>
<td>客户联系人</td>
<td><input id="contact" name="contact" placeholder="必填项" value="${contact!}"/></td>
</tr>
<tr>
<td>客户联系人电话</td>
<td><input id="phone" name="phone" placeholder="必填项" value="${phone!}"/></td>
</tr>
<tr>
<td>ip地址</td>
<td><textarea id="ip" name="ip" rows="5" cols="12"
@@ -125,6 +166,57 @@
return false
}
}
// 检查其他字段是否为空
var displayName = $.trim($("#displayName").val());
var userName = $.trim($("#userName").val());
var password = $.trim($("#password").val());
var email = $.trim($("#email").val());
var manager = $.trim($("#manager").val());
var company = $.trim($("#company").val());
var deadTime = $.trim($("#deadTime").val());
var contact = $.trim($("#contact").val());
var phone = $.trim($("#phone").val());
if (displayName === '') {
alert("昵称不能为空!");
return false;
}
if (userName === '') {
alert("用户名不能为空!");
return false;
}
if (password === '') {
alert("密码不能为空!");
return false;
}
if (email === '') {
alert("邮箱不能为空!");
return false;
}
if (manager === '') {
alert("销售负责人不能为空!");
return false;
}
if (company === '') {
alert("公司不能为空!");
return false;
}
if (deadTime === '') {
alert("到期时间不能为空!");
return false;
}
if (contact === '') {
alert("客户联系人不能为空!");
return false;
}
if (phone === '') {
alert("客户联系人电话不能为空!");
return false;
}
if (email === '') {
alert("邮箱不能为空!");
return false;
}
if (_userNameCheck) {
$("#addForm").submit();
}
@@ -579,7 +579,7 @@
<#if way==1>
<a href="../apiUser/userVisitStat?userId=${bo.userId}&way=2&begDate=<#if begDate??>${begDate!}</#if>&endDate=<#if endDate??>${endDate}</#if>&statDate=<#if statDate??>${statDate}</#if>">${bo.key!}</a>
<#else>
<a href="../apiUser/userVisitStat?uri=${bo.key}&way=1&begDate=<#if begDate??>${begDate!}</#if>&endDate=<#if endDate??>${endDate}</#if>&statDate=<#if statDate??>${statDate}</#if>">${bo.key!}</a>
<a href="../apiUser/userVisitStat?userId=${userId!}&uri=${bo.key}&way=1&begDate=<#if begDate??>${begDate!}</#if>&endDate=<#if endDate??>${endDate}</#if>&statDate=<#if statDate??>${statDate}</#if>">${bo.key!}</a>
</#if>
</td>
<#if way?? && way==1>
@@ -787,7 +787,6 @@
function submitForm(action) {
const form = document.getElementById('myForm');
if (action === 'query') {
debugger
form.action = "<#if way?? && way==0>../apiUser/pandect<#else>../apiUser/apiVisitStat</#if>";
} else if (action === 'download') {
form.action = "../apiUser/export";
@@ -7,6 +7,11 @@
<title>api用户权限控制</title>
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="../style/theme.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="../bootstrap/css/bootstrap.min.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="../style/main_simple.css?v=${version}" />
<script type="text/javascript" src="../js/jquery-1.9.1.js?v=${version}"></script>
<script type="text/javascript" src="../bootstrap/js/bootstrap.min.js?v=${version}"></script>
<script type="text/javascript" src="../js/jquery.form.js?v=${version}"></script>
<#include "/common_js.ftl" />
<script type="text/javascript">
</script>
@@ -30,6 +35,11 @@
top: 0;
background-color: #f2f2f2;
}
.resizable-td {
resize: horizontal; /* 允许水平调整大小 */
overflow: auto; /* 显示滚动条以便查看超出部分 */
min-width: 50px; /* 设置最小宽度,防止过于缩小 */
}
</style>
</head>
@@ -53,25 +63,33 @@
<thead>
<tr>
API数量:&nbsp<b>${authorityBoList?size}</b>个
<th align="center" width="15%">
<th align="center" width="50px">
APICode
</th>
<th align="center" width="100px">
uri
</th>
<th align="center" width="15%">
<th align="center" width="100px">
API名称
</th>
<th align="center" width="10%">
是否有权限<input type="checkbox" id="auth" >全选</input>
<th align="center" width="60px">
是否有权限</br>
<input type="checkbox" id="auth" >全选</input>
</th>
<th align="center" width="30%">
<th align="center" width="100px">
访问最大次数(每天)/(总数)
</th>
<th align="center" width="10%">
是否按查得计费<input type="checkbox" id="isCheckCount" >全选</input>
<th align="center" width="60px">
访问次数修改
</th>
<th align="center" width="10%">
<th align="center" width="70px">
是否按查得计费</br>
<input type="checkbox" id="isCheckCount" >全选</input>
</th>
<th align="center" width="70px">
计费次数(当天)/(历史)
</th>
<th align="center" width="15%">
<th align="center" width="150px">
操作
</th>
</tr>
@@ -80,10 +98,13 @@
<#list authorityBoList as bo>
<tr>
<td align="center">
${bo.apiCode!}
</td>
<td align="center" class="resizable-td">
<input type="hidden" id="uri_${bo_index + 1}" value="${bo.uri!}"></input>
${bo.uri!}
</td>
<td align="center">
<td align="center" class="resizable-td">
${bo.name!}
</td>
<td align="center">
@@ -91,19 +112,26 @@
</td>
<td align="center">
<#if bo.limitCountMap?? && bo.limitCountMap[bo.uri!]??>
<input type="text" value="${bo.limitCountMap[bo.uri!]}" name="limit" id="limit_${bo_index + 1}" style="width:80px;" ></input>
<input type="text" value="${bo.limitCountMap[bo.uri!]}" name="limit" id="limit_${bo_index + 1}" style="width:40px;" readonly></input>
<#else>
<input type="text" value="" name="limit" id="limit_${bo_index + 1}" style="width:80px;" ></input>
<input type="text" value="" name="limit" id="limit_${bo_index + 1}" style="width:60px;" readonly></input>
</#if>
&nbsp;&nbsp;/
/
<#if bo.totalCountMap?? && bo.totalCountMap[bo.uri!]??>
<input type="text" value="${bo.totalCountMap[bo.uri!]}" name="sum" id="sum_${bo_index + 1}" style="width:80px;" ></input>
<input type="text" value="${bo.totalCountMap[bo.uri!]}" name="sum" id="sum_${bo_index + 1}" style="width:40px;" readonly ></input>
<#else>
<input type="text" value="" name="sum" id="sum_${bo_index + 1}" style="width:80px;" ></input>
<input type="text" value="" name="sum" id="sum_${bo_index + 1}" style="width:60px;" readonly></input>
</#if>
</td>
<td>
<button type="button" data-toggle="modal" data-target="#myModal" id="add_${bo_index + 1}">
增加
</button>
<button type="button" data-toggle="modal" data-target="#myModal" id="reduce_${bo_index + 1}">
减少
</button>
</td>
<td align="center">
<input type="checkbox" <#if bo.isCheckCount==1>checked </#if> id="isCheckCount_${bo_index + 1}" ></input>
</td>
@@ -111,6 +139,9 @@
<td align="center">
<input type="button" id="save_${bo_index + 1}" value="保存">
<input type="button" data-uri="${bo.uri!}" data-userid = "${authority.userId!}" value="编辑字段"/>
<a href="../apiCountLog/list?userId=${userId!}&uri=${bo.uri!}">
<button>日志查看</button>
</a>
</td>
</tr>
</#list>
@@ -130,6 +161,26 @@
</table>
</div>
</div>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">修改次数</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" id="editForm">
<div class="control-group">
<label class="control-label" for="countInput">次数</label>
<div class="controls">
<input type="text" id="countInput" name="countInput" value="" /> 次
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary" id="submitCount" data-dismiss="modal" aria-hidden="true">保存</button>
<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
<div class="theme-popover" id = "dialog" style="width:450px;">
<div class="theme-poptit">
<a href="javascript:;" title="关闭" class="close">×</a>
@@ -1,6 +1,6 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -18,45 +18,110 @@
<input type="hidden" id="citys" value="${citys!}"></input>
<div style="color: red;"><#if openCitys??&&openCitys?length gt 0>${displayName!''}已经开通${openCitys!}<#else>${displayName!''}尚未开通任何城市</#if>
</div>
<br/><br/><br/>
<div style="color: red;">${message!}</div>
<div style = "border-top:1px solid #DDD;border-bottom:1px solid #DDD;padding-top:5px; padding-left:20px;font-size:25px;">
<div style="margin-bottom: 20px; text-align: center;">
<button id="toggleToPinyin" >按拼音选</button>
<button id="toggleToProvince" >按省份选</button>
</div>
<span id="provinceFilter" style="display: block; border: 1px solid #DDD; padding: 10px;">
<a href = "city?userId=${userId!}">全部</a>
<#list provinceList as provinceName>
<a href="city?userId=${userId!}&type=${provinceName}&filter=province"
<#if (province?? && province == provinceName)>style='background:#82C1EF;'</#if>>
${provinceName}
</a>
</#list>
</span>
<span id="pinyinFilter" style="display: none; border: 1px solid #DDD; padding: 10px;">
<a href = "city?userId=${userId!}">全部</a>
<#list cityFirstLetters as letter>
<a href = "city?userId=${userId!}&type=${letter}" <#if (type?? && (type == '${letter}'))>style = 'background:#82C1EF;border: 1px solid #DDD;'</#if>>${letter}</a>
<a href = "city?userId=${userId!}&type=${letter}&filter=pinyin" <#if (type?? && (type == '${letter}'))>style = 'background:#82C1EF;border: 1px solid #DDD;'</#if>>${letter}</a>
</#list>
</div>
<div style="margin-top:35px;">
</span>
<div>
&nbsp;&nbsp;&nbsp;&nbsp;
<#if serverAreaList??>
<#assign submitId='_submit_button'>
<#-- <#list serverAreaList as serverArea>
<input type="checkbox" id="city_${serverArea.spell!}" <#if citys??&&(citys?index_of(serverArea.spell) gt -1||citys=='all') >checked </#if> />${serverArea.display!}
</#list>-->
<table align="center" border="1" width="60%">
<tr>
<td style="text-align: center;width: 50%;">城市</td>
<td style="text-align: center;">可信度</td>
</tr>
<#list serverAreaList as map>
<#assign submitId='_submit_button'>
<table align="center" border="1" width="60%">
<tr>
<td style="text-align: center; width: 50%;">
<input type="checkbox" id="select_all" /> 全选
</td>
<td style="text-align: center;">可信度</td>
</tr>
<#list serverAreaList as map>
<tr>
<td> <input type="checkbox" id="city_${map['key0'].spell!}" <#if citys??&&(citys?index_of((map['key0'].spell + ",")) gt -1||citys=='all') >checked </#if> value="${map['key0'].display!}" />${map['key0'].display!}</td>
<td style="text-align: center;"><input type="text" id="credit_${map['key0'].spell!}" value="${map['key1']!}"/></td>
<td>
<input type="checkbox" class="city_checkbox" id="city_${map['key0'].spell!}"
<#if citys?? && (citys?index_of((map['key0'].spell + ",")) gt -1 || citys == 'all') >checked</#if>
value="${map['key0'].display!}" />
${map['key0'].display!}
</td>
<td style="text-align: center;">
<input type="text" id="credit_${map['key0'].spell!}" value="${map['key1']!}" />
</td>
</tr>
</#list>
</table>
</#list>
</table>
<#else>
<#assign submitId='_submit_button_all'>
<input type="checkbox" <#if citys??&&citys=='all'>checked</#if> id="_checkbox_select_all"/>全选
<input type="checkbox" <#if citys?? && citys == 'all'>checked</#if> id="_checkbox_select_all" /> 全选
</#if>
<br/><br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" id="${submitId!}" value="确定"/>
</div>
<br /><br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" id="${submitId!}" value="确定" />
</div>
</div>
<script type="text/javascript" src="../js/apiUser/city.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const urlParams = new URLSearchParams(window.location.search);
const filter = urlParams.get('filter') || 'pinyin'; // 默认为拼音
// 根据 URL 参数设置显示的过滤器
if (filter === 'province') {
document.getElementById('provinceFilter').style.display = 'block';
document.getElementById('pinyinFilter').style.display = 'none';
} else {
document.getElementById('provinceFilter').style.display = 'none';
document.getElementById('pinyinFilter').style.display = 'block';
}
// 切换到按省份筛选
document.getElementById('toggleToProvince').addEventListener('click', function () {
document.getElementById('provinceFilter').style.display = 'block';
document.getElementById('pinyinFilter').style.display = 'none';
});
// 切换到按拼音筛选
document.getElementById('toggleToPinyin').addEventListener('click', function () {
document.getElementById('provinceFilter').style.display = 'none';
document.getElementById('pinyinFilter').style.display = 'block';
});
// 全选复选框点击事件
const selectAllCheckbox = document.getElementById('select_all');
const cityCheckboxes = document.querySelectorAll('.city_checkbox');
selectAllCheckbox.addEventListener('change', function () {
const isChecked = selectAllCheckbox.checked;
cityCheckboxes.forEach(function (checkbox) {
checkbox.checked = isChecked;
});
});
// 子复选框点击事件,更新全选状态
cityCheckboxes.forEach(function (checkbox) {
checkbox.addEventListener('change', function () {
const allChecked = Array.from(cityCheckboxes).every(cb => cb.checked);
selectAllCheckbox.checked = allChecked;
});
});
});
</script>
</body>
</html>
@@ -95,17 +95,50 @@
<input type="radio" <#if apiUserBo?? && apiUserBo.isMonitor?? && apiUserBo.isMonitor == 1>checked="checked"</#if> name="isMonitor" value="1" style="margin-left: 15px;"/>监控
</td>
</tr>
<tr>
<td>是否需要API统计量</td>
<td>
<input type="radio" <#if apiUserBo?? && apiUserBo.isMonitorStatistic?? && apiUserBo.isMonitorStatistic == 0>checked="checked"</#if> name="isMonitorStatistic" value="0" />不需要
<input type="radio" <#if apiUserBo?? && apiUserBo.isMonitorStatistic?? && apiUserBo.isMonitorStatistic == 1>checked="checked"</#if> name="isMonitorStatistic" value="1" style="margin-left: 15px;"/>需要
</td>
</tr>
<tr>
<td>是否需要API费用使用量</td>
<td>
<input type="radio" <#if apiUserBo?? && apiUserBo.isMonitorUsed?? && apiUserBo.isMonitorUsed == 0>checked="checked"</#if> name="isMonitorUsed" value="0" />不需要
<input type="radio" <#if apiUserBo?? && apiUserBo.isMonitorUsed?? && apiUserBo.isMonitorUsed == 1>checked="checked"</#if> name="isMonitorUsed" value="1" style="margin-left: 15px;"/>需要
</td>
</tr>
<tr>
<td>是否提醒即将到期</td>
<td>
<input type="radio" <#if apiUserBo?? && apiUserBo.isWarnExpired?? && apiUserBo.isWarnExpired == 0>checked="checked"</#if> name="isWarnExpired" value="0" />不提醒
<input type="radio" <#if apiUserBo?? && apiUserBo.isWarnExpired?? && apiUserBo.isWarnExpired == 1>checked="checked"</#if> name="isWarnExpired" value="1" style="margin-left: 15px;"/>提醒
</td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" value="${apiUserBo.email!}"/></td>
<td>
<div style="display: inline-block;">
<textarea id="email" name="email" rows="5" cols="12"
style="height: 100px;width: 250px;float: left">${apiUserBo.email!}</textarea>
</div>
<div style="display: inline-block;">
(每行一个,第一个为发送,其余抄送)<br/>
例子:<br/>
123456@qq.com<br/>
88888@163.com<br/>
987654@gmail.com
</div>
</td>
</tr>
<tr>
<td>销售负责人</td>
<td><input name="manager" value="${apiUserBo.manager!}" /></td>
<td><input id="manager" name="manager" placeholder="必填项" value="${apiUserBo.manager!}" /></td>
</tr>
<tr>
<td>公司</td>
<td><input name="company" value="${apiUserBo.company!}"/></td>
<td><input id="company" name="company" placeholder="必填项" value="${apiUserBo.company!}"/></td>
</tr>
<tr>
<td>估价调整比率</td>
@@ -117,8 +150,8 @@
<td>
<select id="slt_priceType" name="priceType" style="width: 100px">
<option value=""></option>
<option value="sell" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("sell")!=-1>selected</#if>>挂牌价</option>
<option value="evaluate" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("evaluate")!=-1>selected</#if>>评估价</option>
<option value="2C" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("2C")!=-1>selected</#if>>挂牌价</option>
<option value="2B" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("2B")!=-1>selected</#if>>评估价</option>
</select>
</td>
</tr>
@@ -128,7 +161,15 @@
</tr>
<tr>
<td>到期时间</td>
<td><input name="deadTime" value="<#if apiUserBo.deadTime??>${apiUserBo.deadTime?string("yyyy-MM-dd")}</#if>" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td>
<td><input id="deadTime" name="deadTime" placeholder="必填项" value="<#if apiUserBo.deadTime??>${apiUserBo.deadTime?string("yyyy-MM-dd")}</#if>" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td>
</tr>
<tr>
<td>客户联系人</td>
<td><input id="contact" name="contact" placeholder="必填项" value="${apiUserBo.contact!}"/></td>
</tr>
<tr>
<td>客户联系人电话</td>
<td><input id="phone" name="phone" placeholder="必填项" value="${apiUserBo.phone!}"/></td>
</tr>
<tr>
<td>ip地址</td>
@@ -156,6 +197,42 @@
return false
}
}
// 检查其他字段是否为空
var email = $.trim($("#email").val());
var manager = $.trim($("#manager").val());
var company = $.trim($("#company").val());
var deadTime = $.trim($("#deadTime").val());
var contact = $.trim($("#contact").val());
var phone = $.trim($("#phone").val());
if (email === '') {
alert("邮箱不能为空!");
return false;
}
if (manager === '') {
alert("销售负责人不能为空!");
return false;
}
if (company === '') {
alert("公司不能为空!");
return false;
}
if (deadTime === '') {
alert("到期时间不能为空!");
return false;
}
if (contact === '') {
alert("客户联系人不能为空!");
return false;
}
if (phone === '') {
alert("客户联系人电话不能为空!");
return false;
}
if (email === '') {
alert("邮箱不能为空!");
return false;
}
$("#submitForm").attr("action", "update");
$("#submitForm").submit();
}
@@ -47,6 +47,35 @@
<div style="padding-left:5px;">
共有用户<b>${apiUserBoList?size}</b>个
</div>
<form action="../apiUser/list" id="_search_log_form">
<div>
<div class="form-group">
<label for="purpose" class="form-label">账号用途:</label>
<select name="purpose" class="form-select">
<option value="1" <#if purpose?? && purpose == 1>selected</#if> >API</option>
<option value="2"<#if purpose?? && purpose == 2>selected</#if> >PDS</option>
<option value="4"<#if purpose?? && purpose == 4>selected</#if> >房生活</option>
<option >请选择</option>
</select>
</div>
<div class="form-group">
<label for="isTest" class="form-label">账号类型:</label>
<select name="isTest" class="form-select">
<option value="0" <#if isTest?? && isTest == 0>selected</#if> >正式账号</option>
<option value="1" <#if isTest?? && isTest == 1>selected</#if> >测试账号</option>
<option value="2" <#if isTest?? && isTest == 2>selected</#if> >内部账号</option>
</select>
</div>
<div class="form-group">
<label for="status" class="form-label">账号状态:</label>
<select name="status" class="form-select">
<option value="0" <#if status?? && status == 0>selected</#if> >正常</option>
<option value="1" <#if status?? && status == 1>selected</#if> >禁用</option>
</select>
</div>
<input id="queryBtn" class="btn btn-primary form-button" type="submit" value="查询"/>
</div>
</form>
<table width="100%">
<thead>
<tr>
@@ -177,5 +206,23 @@
</div>
</div>
</body>
<style>
.form-label {
font-size: 15px; /* 增加标签的字体大小 */
}
.form-select {
font-size: 15px; /* 增加选择框的字体大小 */
margin-right: 10px; /* 调整选择框之间的间距 */
}
.form-button {
font-size: 15px; /* 增加按钮的字体大小 */
}
.form-group {
display: inline-block; /* 使每个表单组不换行 */
}
</style>
</html>
</#compress>
@@ -1,320 +1,344 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>开发区围栏列表</title>
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}" />
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<#include "/common_js.ftl" />
<#include "/layout/header.ftl" />
<div class="main-content">
<div class="menuButton">
<a href="../developmentZone/list" class="list">开发区列表</a>&nbsp;&nbsp;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>开发区围栏列表</title>
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<#include "/common_js.ftl" />
<#include "/layout/header.ftl" />
<div class="main-content">
<div class="menuButton">
<a href="../developmentZone/list" class="list">开发区列表</a>&nbsp;&nbsp;
</div>
<div class="list">
<form id="form1">
<#if developmentZone??>
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
</#if>
<table>
<tr>
<td>
<label for="province">所在省份:</label>
</td>
<td>
<select id="province" name="province" onchange="updateCityAndDistrict()">
<#-- <#if developmentZone.province??>-->
<#-- <option value="${developmentZone.province}">${developmentZone.province}</option>-->
<#-- <#else>-->
<#-- <option value="">请选择省份</option>-->
<#-- </#if>-->
</select>
</td>
</tr>
<tr>
<td>
<label for="cityName1">城市:</label>
</td>
<td>
<select id="cityName1" name="cityName1" onchange="updateDistrict()">
<!-- Options for cities will be populated by JavaScript -->
</select>
</td>
</tr>
<tr>
<td>
<label for="district">区域:</label>
</td>
<td>
<select id="district" name="district">
<!-- Options for districts will be populated by JavaScript -->
</select>
</td>
</tr>
<tr>
<td>
<label for="name">开发区名称:</label>
</td>
<td>
<input id="name" name="name" type="text"
placeholder="必填"
style="width:200px "
value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
</td>
</tr>
<tr>
<td>
<label for="alias">别名:</label>
</td>
<td>
<input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" style="width:200px "
value="<#if developmentZone??><#list (developmentZone.alias)! as alia>${alia + ','}</#list><#else></#if>"/>
</td>
</tr>
<tr>
<td>
<label for="nameEn">开发区名称拼音:</label>
</td>
<td>
<input id="nameEn" name="nameEn" type="text" style="width:200px "
value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
</td>
</tr>
<tr>
<td>
<label for="level">级别:</label>
</td>
<td>
<input id="level" name="level" type="text" placeholder="必填" style="width:200px "
value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
</td>
</tr>
<tr>
<td>
<label for="address">地址:</label>
</td>
<td>
<input id="address" name="address" type="text" style="width:300px "
value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
</td>
</tr>
<tr>
<td>
<label for="area">所在地区:</label>
</td>
<td>
<input id="area" name="area" type="text" style="width:200px "
value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
</td>
</tr>
<tr>
<td>
<label for="buildDate">建立年代:</label>
</td>
<td>
<input id="buildDate" name="buildDate" type="text" style="width:200px "
value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
</td>
</tr>
<tr>
<td>
<label for="type">类型:</label>
</td>
<td>
<input id="type" name="type" type="text" style="width:300px "
value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
</td>
</tr>
<tr>
<td>
<label for="url">URL:</label>
</td>
<td>
<input id="url" name="url" type="text" style="width:500px "
value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
</td>
</tr>
<tr>
<td>
<label for="imgUrl">开发区图片URL:</label>
</td>
<td>
<input id="imgUrl" name="imgUrl" type="text" style="width:500px "
value="<#if developmentZone??>${developmentZone.imgUrl!}</#if>"/><br>
</td>
<#-- s-->
<td> <input type="file" id="fileInput" accept="image/*"></td>
</tr>
<tr>
<td>
<label for="industry">主导产业:</label>
</td>
<td>
<input id="industry" name="industry" type="text" style="width:300px "
value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
</td>
</tr>
<tr>
<td>
<label for="block">区块:</label>
</td>
<td>
<input id="block" name="block" type="text"
value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
</td>
</tr>
<tr>
<td>
<label for="operateResult">操作结果:</label>
</td>
<td>
<select id="operateResult" name="operateResult">
<option value="" ></option>
<option value="已处理" >已处理</option>
<option value="无结果" >无结果</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td>
<input id="saveOrUpdate" type="button" value="提交"/>
</td>
</tr>
</table>
</form>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
// 当文件选择变化时触发事件
document.getElementById('fileInput').addEventListener('change', async () => {
const fileInput = document.getElementById('fileInput');
const file = fileInput.files[0];
<div>
<form id="form1">
<#if developmentZone??>
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
</#if>
if (!file) {
alert('请选择一个文件!');
return;
}
<table>
<tr>
<td>
<#if developmentZone??>
<@d_city defaultValue="${developmentZone.cityName1!}" callback="changeCity" callbackField="display" name="cityDisplay" />
<#else>
<@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" />
</#if>
</td>
<td>
<label for="province">所在省份:</label>
<select id="province" name="province" onchange="updateCityAndDistrict()">
<#if province??>
<option value="${province}">${province}</option>
<#else>
<option value="">请选择省份</option>
</#if>
</select>
// 使用 FormData 传输文件
const formData = new FormData();
formData.append('file', file);
<label for="cityName1">城市:</label>
<select id="cityName1" name="cityName1" onchange="updateDistrict()">
<!-- Options for cities will be populated by JavaScript -->
</select>
<label for="district">区域:</label>
<select id="district" name="district">
<!-- Options for districts will be populated by JavaScript -->
</select>
<label for="name">开发区名称:</label> <input id="name" name="name" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
<label for="alias">别名:</label>
<input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" value="<#if developmentZone??><#list (developmentZone.alias)! as alia>${alia + ','}</#list><#else></#if>"/>
<label for="nameEn">开发区名称拼音:</label> <input id="nameEn" name="nameEn" type="text" value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
</br>
<label for="level">级别:</label> <input id="level" name="level" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
<label for="address">地址:</label> <input id="address" name="address" type="text" value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
<label for="area">所在地区:</label> <input id="area" name="area" type="text" value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
<label for="buildDate">建立年代:</label><input id="buildDate" name="buildDate" type="text" value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
<label for="type">类型:</label><input id="type" name="type" type="text" value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
<label for="url">URL:</label><input id="url" name="url" type="text" value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
<label for="industry">主导产业:</label><input id="industry" name="industry" type="text" value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
<label for="block">区块:</label><input id="block" name="block" type="text" value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
<input id="saveOrUpdate" type="button" value="提交"/>
</td>
$.ajax({
url: '../developmentZone/upload',
type: 'POST',
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (data) {
document.getElementById('imgUrl').value = JSON.parse(data).imgUrl;
alert('上传成功!');
console.log(data);
},
error: function (returndata) {
alert("上传失败!");
}
});
});
</script>
<script>
$(document).ready(function () {
fetchProvinces();
</tr>
<tr>
<td colspan="2">
<input name="bdShape" id="bdShape" type="hidden"/>
<div id="allmap" style="width:100%;height:900px;"></div>
</td>
</tr>
</table>
</form>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
fetchProvinces();
$('#province').change(function () {
updateCityAndDistrict();
});
$('#province').change(function() {
updateCityAndDistrict();
$('#cityName1').change(function () {
updateDistrict();
});
});
$('#cityName1').change(function() {
updateDistrict();
});
});
function fetchProvinces() {
$.ajax({
type: 'GET',
url: '../developmentZone/provinces',
dataType: 'json',
success: function (data) {
let provinceSelect = $('#province');
provinceSelect.empty();
provinceSelect.append('<option value="">请选择省份</option>');
$.each(data, function (index, province) {
provinceSelect.append('<option value="' + province + '">' + province + '</option>');
});
},
error: function () {
// 处理错误
}
});
}
function fetchProvinces() {
$.ajax({
type: 'GET',
url: '../developmentZone/provinces',
dataType: 'json',
success: function(data) {
let provinceSelect = $('#province');
provinceSelect.empty();
provinceSelect.append('<option value="">请选择省份</option>');
$.each(data, function(index, province) {
provinceSelect.append('<option value="' + province + '">' + province + '</option>');
function updateCityAndDistrict() {
let province = $('#province').val();
let citySelect = $('#cityName1');
let districtSelect = $('#district');
citySelect.empty();
districtSelect.empty();
citySelect.append('<option value="">请选择城市</option>');
districtSelect.append('<option value="">请选择区域</option>');
if (province) {
$.ajax({
type: 'GET',
url: '../developmentZone/cities',
data: {province: province},
dataType: 'json',
success: function (data) {
$.each(data, function (index, city) {
citySelect.append('<option value="' + city + '">' + city + '</option>');
});
},
error: function () {
// 处理错误
}
});
},
error: function() {
// 处理错误
}
});
}
}
function updateCityAndDistrict() {
let province = $('#province').val();
let citySelect = $('#cityName1');
let districtSelect = $('#district');
function updateDistrict() {
let cityName1 = $('#cityName1').val();
let districtSelect = $('#district');
citySelect.empty();
districtSelect.empty();
citySelect.append('<option value="">请选择城市</option>');
districtSelect.append('<option value="">请选择区域</option>');
districtSelect.empty();
districtSelect.append('<option value="">请选择区域</option>');
if (province) {
$.ajax({
type: 'GET',
url: '../developmentZone/cities',
data: { province: province },
if (cityName1) {
$.ajax({
type: 'GET',
url: '../developmentZone/districts',
data: {cityName1: cityName1},
dataType: 'json',
success: function (data) {
$.each(data, function (index, district) {
districtSelect.append('<option value="' + district + '">' + district + '</option>');
});
},
error: function () {
// 处理错误
}
});
}
}
</script>
<script type="application/javascript">
$("#saveOrUpdate").click(function () {
// 更新表单中的点位置数据
// updatePolygonPoints();
jQuery.ajax({
type: 'POST',
url: '../developmentZone/saveOrUpdate',
data: $("#form1").serialize(),
dataType: 'json',
success: function(data) {
$.each(data, function(index, city) {
citySelect.append('<option value="' + city + '">' + city + '</option>');
});
timeout: 100000,
success: function (data) {
alert(data.msg);
location.href = "list";
},
error: function() {
// 处理错误
error: function () {
}
});
}
}
function updateDistrict() {
let cityName1 = $('#cityName1').val();
let districtSelect = $('#district');
districtSelect.empty();
districtSelect.append('<option value="">请选择区域</option>');
if (cityName1) {
$.ajax({
type: 'GET',
url: '../developmentZone/districts',
data: { cityName1: cityName1 },
dataType: 'json',
success: function(data) {
$.each(data, function(index, district) {
districtSelect.append('<option value="' + district + '">' + district + '</option>');
});
},
error: function() {
// 处理错误
}
});
}
}
</script>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
<!--加载鼠标绘制工具-->
<script type="text/javascript" src="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
<link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
<!--加载检索信息窗口-->
<script type="text/javascript" src="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
<link rel="stylesheet" href="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css" />
<script type="application/javascript">
var map = new BMap.Map("allmap"); // 创建Map实例
if($("#cityDisplay").val()) {
map.centerAndZoom($("#cityDisplay").val(), 13);
}else {
map.centerAndZoom('上海', 13);
}
map.enableScrollWheelZoom(true);
function changeCity(display){
clearAll();
map.centerAndZoom(display, 13);
}
var overlays = [];
var overlaycomplete = function(e){
overlays.push(e.overlay);
var points = e.overlay.getPath();
var bdShape = [];
for(var i=0;i<points.length;i++) {
var location = [];
location.push(points[i].lng );
location.push(points[i].lat );
bdShape.push(location);
}
$("#bdShape").val(bdShape.join(";"));
// 在创建多边形后立即启用编辑
e.overlay.enableEditing();
};
var styleOptions = {
strokeColor:"red", //边线颜色。
fillColor:"red", //填充颜色。当参数为空时,圆形将没有填充效果。
strokeWeight: 1, //边线的宽度,以像素为单位。
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
strokeStyle: 'solid' //边线的样式,solid或dashed。
}
//实例化鼠标绘制工具
var drawingManager = new BMapLib.DrawingManager(map, {
isOpen: true, //是否开启绘制模式
enableDrawingTool: true, //是否显示工具栏
drawingToolOptions: {
anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
offset: new BMap.Size(5, 5), //偏离值
},
circleOptions: styleOptions, //圆的样式
polylineOptions: styleOptions, //线的样式
polygonOptions: styleOptions, //多边形的样式
rectangleOptions: styleOptions //矩形的样式
});
//添加鼠标绘制工具监听事件,用于获取绘制结果
drawingManager.addEventListener('overlaycomplete', overlaycomplete);
function clearAll() {
for(var i = 0; i < overlays.length; i++){
map.removeOverlay(overlays[i]);
}
overlays.length = 0;
}
// 添加点击覆盖物事件监听器
map.addEventListener("click", function(e) {
// 判断点击的是否是已存在的覆盖物
if (e.overlay) {
// 如果是多边形或折线,则可以编辑
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
// 开启覆盖物编辑功能
e.overlay.enableEditing();
}
// 如果是标记点,则可以拖动
else if (e.overlay instanceof BMap.Marker) {
// 开启标记点拖动功能
e.overlay.enableDragging();
}
}
});
// 添加覆盖物编辑完成事件监听器
map.addEventListener("overlaycomplete", function(e) {
// 判断新增的覆盖物是否是多边形或折线
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
// 添加覆盖物编辑完成事件监听器
e.overlay.addEventListener("lineupdate", function() {
// 编辑完成后获取更新后的路径点,并更新表单中的数据
var points = e.overlay.getPath();
var bdShape = [];
for (var i = 0; i < points.length; i++) {
var location = [];
location.push(points[i].lng);
location.push(points[i].lat);
bdShape.push(location);
}
$("#bdShape").val(bdShape.join(";"));
});
}
});
$("#saveOrUpdate").click(function(){
// 更新表单中的点位置数据
updatePolygonPoints();
jQuery.ajax({
type: 'POST',
url: '../developmentZone/saveOrUpdate',
data: $("#form1").serialize(),
dataType: 'json',
timeout: 100000,
success: function(data) {
alert(data.msg);
location.href="list";
},
error : function() {
}
});
});
</script>
// 更新表单中的多边形点位置数据
function updatePolygonPoints() {
var polygons = map.getOverlays(BMap.Polygon);
for (var i = 0; i < polygons.length; i++) {
// 确保当前对象是一个多边形对象
if (polygons[i] instanceof BMap.Polygon) {
var points = polygons[i].getPath();
var bdShape = [];
for (var j = 0; j < points.length; j++) {
var location = [];
location.push(points[j].lng);
location.push(points[j].lat);
bdShape.push(location);
}
// 将更新后的点位置数据更新到表单中
$("#bdShape").val(bdShape.join(";"));
}
}
}
fetchProvinces()
</script>
</body>
</html>
</body>
</html>
</#compress>
@@ -0,0 +1,535 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>开发区围栏列表</title>
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
<link rel="stylesheet" type="text/css" href="../style/my.css?v=${version}"/>
<link rel="stylesheet" type="text/css" href="../style/theme.css?v=${version}"/>
<link rel="stylesheet" type="text/css" href="../style/jquery.autocomplete.css?v=${version}"/>
<style>
.row-fluid .span2 {
width: 100%;
*width: 100%;
}
</style>
</head>
<body>
<#include "/common_js.ftl" />
<div class="row-fluid">
<div class="span7">
<form id="form1">
<div class="input-append">
<#if developmentZone??>
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
</#if>
<div style="float: left">
<img id="myImage" src="${developmentZone.imgUrl!'/path/to/default/image.jpg'}"
style="width: 800px; height: 800px; object-fit: contain; "
loading="lazy"/>
<#-- <img id="myImage" src="${developmentZone.imgUrl}"/>-->
<br/>
<input id="draw" type="button" value="画图"/> &nbsp;&nbsp;
<input id="line" type="button" value="串联" onclick="line"/> &nbsp;&nbsp;
<input id="saveOrUpdate" type="button" value="提交"/>
<textarea type="area" id="a" style="display: none"></textarea>
<br/>
点1:<input value="" id="a1" style="width: 80px">
点1经纬度:<input value="" id="b1"><input id="location1" type="button" value="校准"/>
<br/>
点2:<input value="" id="a2" style="width: 80px">
点2经纬度:<input value="" id="b2"><input id="location2" type="button" value="校准"/>
<br/>
</div>
<div>
<div>
<@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" showCountry = "1" />
</div>
<input type="text" id="seaAddress"/>
<input type="button" id="btn_sea" value="查询"/>
<input name="bdShape" id="bdShape" type="hidden"/>
<div id="allmap" style="height:900px;margin-left: -30px"></div>
</div>
</form>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function () {
fetchProvinces();
$('#province').change(function () {
updateCityAndDistrict();
});
$('#cityName1').change(function () {
updateDistrict();
});
});
function fetchProvinces() {
$.ajax({
type: 'GET',
url: '../developmentZone/provinces',
dataType: 'json',
success: function (data) {
let provinceSelect = $('#province');
provinceSelect.empty();
provinceSelect.append('<option value="">请选择省份</option>');
$.each(data, function (index, province) {
provinceSelect.append('<option value="' + province + '">' + province + '</option>');
});
},
error: function () {
// 处理错误
}
});
}
function updateCityAndDistrict() {
let province = $('#province').val();
let citySelect = $('#cityName1');
let districtSelect = $('#district');
citySelect.empty();
districtSelect.empty();
citySelect.append('<option value="">请选择城市</option>');
districtSelect.append('<option value="">请选择区域</option>');
if (province) {
$.ajax({
type: 'GET',
url: '../developmentZone/cities',
data: {province: province},
dataType: 'json',
success: function (data) {
$.each(data, function (index, city) {
citySelect.append('<option value="' + city + '">' + city + '</option>');
});
},
error: function () {
// 处理错误
}
});
}
}
function updateDistrict() {
let cityName1 = $('#cityName1').val();
let districtSelect = $('#district');
districtSelect.empty();
districtSelect.append('<option value="">请选择区域</option>');
if (cityName1) {
$.ajax({
type: 'GET',
url: '../developmentZone/districts',
data: {cityName1: cityName1},
dataType: 'json',
success: function (data) {
$.each(data, function (index, district) {
districtSelect.append('<option value="' + district + '">' + district + '</option>');
});
},
error: function () {
// 处理错误
}
});
}
}
</script>
<script type="text/javascript"
src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
<!--加载鼠标绘制工具-->
<script type="text/javascript"
src="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
<link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"/>
<!--加载检索信息窗口-->
<script type="text/javascript"
src="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
<link rel="stylesheet" href="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css"/>
<script type="application/javascript">
var map = new BMap.Map("allmap"); // 创建Map实例
if ($("#cityDisplay").val()) {
map.centerAndZoom($("#cityDisplay").val(), 13);
} else {
map.centerAndZoom('上海', 13);
}
map.enableScrollWheelZoom(true);
function changeCity(display) {
clearAll();
map.centerAndZoom(display, 13);
}
var overlays = [];
var overlaycomplete = function (e) {
overlays.push(e.overlay);
// var points = e.overlay.getPath();
var bdShape = [];
for (var i = 0; i < points.length; i++) {
var location = [];
location.push(points[i].lng);
location.push(points[i].lat);
bdShape.push(location);
}
$("#bdShape").val(bdShape.join(";"));
// 在创建多边形后立即启用编辑
e.overlay.enableEditing();
};
var styleOptions = {
strokeColor: "red", //边线颜色。
fillColor: "red", //填充颜色。当参数为空时,圆形将没有填充效果。
strokeWeight: 1, //边线的宽度,以像素为单位。
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
strokeStyle: 'solid' //边线的样式,solid或dashed。
}
//实例化鼠标绘制工具
var drawingManager = new BMapLib.DrawingManager(map, {
isOpen: true, //是否开启绘制模式
enableDrawingTool: true, //是否显示工具栏
drawingToolOptions: {
anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
offset: new BMap.Size(5, 5), //偏离值
},
circleOptions: styleOptions, //圆的样式
polylineOptions: styleOptions, //线的样式
polygonOptions: styleOptions, //多边形的样式
rectangleOptions: styleOptions //矩形的样式
});
//添加鼠标绘制工具监听事件,用于获取绘制结果
drawingManager.addEventListener('overlaycomplete', overlaycomplete);
function clearAll() {
for (var i = 0; i < overlays.length; i++) {
map.removeOverlay(overlays[i]);
}
overlays.length = 0;
}
var currentInput = null; // 记录当前选择的输入框
// 绑定输入框的点击事件
$("#b1, #b2").click(function () {
currentInput = $(this); // 记录当前输入框
});
// 添加点击覆盖物事件监听器
map.addEventListener("click", function (e) {
// 判断点击的是否是已存在的覆盖物
if (e.overlay) {
// 如果是多边形或折线,则可以编辑
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
// 开启覆盖物编辑功能
e.overlay.enableEditing();
}
// 如果是标记点,则可以拖动
else if (e.overlay instanceof BMap.Marker) {
// 开启标记点拖动功能
e.overlay.enableDragging();
}
}
var lng = e.point.lng;
var lat = e.point.lat;
// 更新经纬度输入框
// $("#mapLng").val(lng);
if (currentInput) {
currentInput.val(lng + ',' + lat); // 更新当前输入框的值
}
// 可选:添加标记点
addMarker(lng, lat);
map.setCenter(e.point);
});
// 添加覆盖物编辑完成事件监听器
map.addEventListener("overlaycomplete", function (e) {
// 判断新增的覆盖物是否是多边形或折线
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
// 添加覆盖物编辑完成事件监听器
e.overlay.addEventListener("lineupdate", function () {
// 编辑完成后获取更新后的路径点,并更新表单中的数据
var points = e.overlay.getPath();
var bdShape = [];
for (var i = 0; i < points.length; i++) {
var location = [];
location.push(points[i].lng);
location.push(points[i].lat);
bdShape.push(location);
}
$("#bdShape").val(bdShape.join(";"));
});
}
});
$("#saveOrUpdate").click(function () {
// 更新表单中的点位置数据
updatePolygonPoints();
jQuery.ajax({
type: 'POST',
url: '../developmentZone/saveOrUpdate',
data: $("#form1").serialize(),
dataType: 'json',
timeout: 100000,
success: function (data) {
alert(data.msg);
location.href = "list";
},
error: function () {
}
});
});
// 更新表单中的多边形点位置数据
function updatePolygonPoints() {
var polygons = map.getOverlays(BMap.Polygon);
for (var i = 0; i < polygons.length; i++) {
// 确保当前对象是一个多边形对象
if (polygons[i] instanceof BMap.Polygon) {
var points = polygons[i].getPath();
var bdShape = [];
for (var j = 0; j < points.length; j++) {
var location = [];
location.push(points[j].lng);
location.push(points[j].lat);
bdShape.push(location);
}
// 将更新后的点位置数据更新到表单中
$("#bdShape").val(bdShape.join(";"));
}
}
}
fetchProvinces()
var currentMarker = null;
function addMarker(lng, lat) {
// 移除旧的标记点
if (currentMarker) {
map.removeOverlay(currentMarker);
}
clearAll()
var markerPoint = new BMap.Point(lng, lat);
// 创建新的标记点
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);
});
function interpolate(start, end, factor) {
return start + (end - start) * factor;
}
function re_location1(event) {
// 获取图片在页面上的位置
const rect = this.getBoundingClientRect();
// 计算点击相对于图片的位置
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
// 显示点击的坐标
// document.getElementById("a1").value = val(x+','+y);
document.getElementById("a1").value = x + ',' + y;
}
function re_location2(event) {
// 获取图片在页面上的位置
const rect = this.getBoundingClientRect();
// 计算点击相对于图片的位置
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
// 显示点击的坐标
document.getElementById("a2").value = x + ',' + y;
}
function bound(event) {
const rect = this.getBoundingClientRect();
const imgWidth = rect.width;
const imgHeight = rect.height;
point_a1_x = parseFloat(document.getElementById("a1").value.split(',')[0])
point_a1_y = parseFloat(document.getElementById("a1").value.split(',')[1])
point_a2_x = parseFloat(document.getElementById("a2").value.split(',')[0])
point_a2_y = parseFloat(document.getElementById("a2").value.split(',')[1])
geo_b1_x = parseFloat(document.getElementById("b1").value.split(',')[0])
geo_b1_y = parseFloat(document.getElementById("b1").value.split(',')[1])
geo_b2_x = parseFloat(document.getElementById("b2").value.split(',')[0])
geo_b2_y = parseFloat(document.getElementById("b2").value.split(',')[1])
const knownPoints = {
pixel1: {x: point_a1_x, y: point_a1_y}, // 已知像素1
lat1: geo_b1_y, lon1: geo_b1_x, // 已知经纬度1
pixel2: {x: point_a2_x, y: point_a2_y}, // 已知像素2
lat2: geo_b2_y, lon2: geo_b2_x // 已知经纬度2
};
// 获取点击位置的像素坐标
const x = event.clientX;
const y = event.clientY;
console.log(x + "," + y)
// 将像素坐标转换为经纬度
point = pixelToLatLon({x, y}, knownPoints);
var point = new BMap.Point(point.lon.toFixed(6), point.lat.toFixed(6));
var marker = new BMap.Marker(point);
map.addOverlay(marker);
// 显示点击的坐标
if (document.getElementById("a").value == "") {
document.getElementById("a").value = point.lng + ',' + point.lat;
} else {
document.getElementById("a").value = document.getElementById("a").value + ";" + point.lng + ',' + point.lat;
}
bb = document.getElementById("a").value
$("#bdShape").val(document.getElementById("a").value)
point_array = bb.split(";")
if (point_array.length > 2) {
points = []
for (let i = 0; i < point_array.length; i++) {
points.push(new BMap.Point(point_array[i].split(",")[0], point_array[i].split(",")[1]))
}
var polygon = new BMap.Polygon(points, {
zIndex: 10,
fillOpacity: 0.3,
strokeStyle: 'dashed',
strokeColor: 'blue',
strokeWeight: 2,
strokeOpacity: 0.3,
fillColor: 'pink'
});
var bounds = polygon.getBounds();
// 获取多边形的中心点
var center = bounds.getCenter();
map.centerAndZoom(center, map.getZoom());
}
}
function pixelToLatLon(px, knownPoints) {
const {pixel1, lat1, lon1, pixel2, lat2, lon2} = knownPoints;
// 计算像素坐标在已知点之间的比例
const xRatio = (px.x - pixel1.x) / (pixel2.x - pixel1.x);
const yRatio = (px.y - pixel1.y) / (pixel2.y - pixel1.y);
// 通过线性插值计算经纬度
const lat = lat1 + (lat2 - lat1) * yRatio;
const lon = lon1 + (lon2 - lon1) * xRatio;
return {lat, lon};
}
function line() {
bb = document.getElementById("a").value
point_array = bb.split(";")
points = []
for (let i = 0; i < point_array.length; i++) {
points.push(new BMap.Point(point_array[i].split(",")[0], point_array[i].split(",")[1]))
}
var polygon = new BMap.Polygon(points, {
zIndex: 10,
fillOpacity: 0.3,
strokeStyle: 'dashed',
strokeColor: 'blue',
strokeWeight: 2,
strokeOpacity: 0.3,
fillColor: 'blue'
});
map.addOverlay(polygon);
// // 计算面积
// const area = BMapLib.GeometryUtil.getArea(polygon.getPath());
// document.getElementById("calc_area").value = area * 0.000001; // 转换为平方公里
}
document.getElementById("location1").addEventListener("click", function (event) {
// 移除初始事件
document.getElementById("myImage").removeEventListener('click', bound);
document.getElementById("myImage").removeEventListener('click', re_location2);
document.getElementById("myImage").addEventListener('click', re_location1);
});
document.getElementById("location2").addEventListener("click", function (event) {
// 移除初始事件
document.getElementById("myImage").removeEventListener('click', bound);
document.getElementById("myImage").removeEventListener('click', re_location1);
document.getElementById("myImage").addEventListener('click', re_location2);
});
document.getElementById("draw").addEventListener("click", function (event) {
if (currentMarker) {
map.removeOverlay(currentMarker);
}
clearAll()
// 移除初始事件
document.getElementById("myImage").removeEventListener('click', re_location2);
document.getElementById("myImage").removeEventListener('click', re_location1);
document.getElementById("myImage").addEventListener('click', bound);
document.getElementById("a").value = ""
});
document.getElementById("line").addEventListener("click", line)
// var map = new BMap.Map("allmap");
var scaleCtrl = new BMap.ScaleControl(); // 添加比例尺控件
map.addControl(scaleCtrl);
// var zoomCtrl = new BMap.ZoomControl(); // 添加缩放控件
// map.addControl(zoomCtrl);
// var point = new BMap.Point(119.798515, 25.665635);
var marker = new BMap.Marker(point);
// map.centerAndZoom(point, 10);
map.addOverlay(marker);
</script>
</body>
</html>
</#compress>
@@ -21,12 +21,21 @@
<label for="province">省份:</label>
<input type="text" name="province" id="province" class="input-medium" style="margin-top:9px;"
value="${province!}"></input>
<label for="cityName1">城市:</label>
<input type="text" name="cityName1" id="cityName1" class="input-medium" style="margin-top:9px;"
value="${cityName1!}"></input>
<label for="name">名称:</label>
<input type="text" name="name" id="name" class="input-medium" style="margin-top:9px;"
value="${name!}"></input>
<label for="name">开发区级别:</label>
<input type="text" name="level" id="level" class="input-medium" style="margin-top:9px;"
value="${level!}"></input>
<label for="operateResult" class="form-label">操作结果:</label>
<select id="operateResult" name="operateResult">
<option value="" ></option>
<option value="已处理" <#if operateResult?? && operateResult == "已处理">selected</#if> >已处理</option>
<option value="无结果" <#if operateResult?? && operateResult == "无结果">selected</#if> >无结果</option>
</select>
<input id="queryBtn" class="btn btn-primary" type="submit" value="查询"/>
@@ -43,6 +52,7 @@
<th>城市</th>
<th>区域</th>
<th>区块</th>
<th>操作结果</th>
<th>是否有围栏</th>
<th>操作人员</th>
<th>修改日期</th>
@@ -50,7 +60,7 @@
</tr>
<#list developmentZoneList as it>
<tr>
<td>${it.name!}</td>
<td><a href="../developmentZone/edit?id=${it.id!}" target="_blank">${it.name!}</a></td>
<td>
<#if it.alias??>
<#list it.alias as item>
@@ -65,16 +75,25 @@
<td>${it.cityName1!}</td>
<td>${it.district!}</td>
<td>${it.block!}</td>
<td>${it.operateResult!}</td>
<td>
<#if it.bdShape?has_content>
已有围栏
</#if>
</td>
<td>${it.operator!}</td>
<td>${it.createTime!?string("yyyy-MM-dd HH:mm:ss")}</td>
<td>
<#if it.createTime??>
${it.createTime!?string("yyyy-MM-dd HH:mm:ss")}
<#else>
</#if>
</td>
<td>
<a href="show?id=${it.id!}" target="_blank">查看</a>
<a href="../developmentZone/edit?id=${it.id!}" target="_blank">新建围栏</a>
<a href="../developmentZone/editFence?id=${it.id!}" target="_blank">新建围栏</a>
<#-- <a name="del${it_index}" href="javascript:;" ref="delete?id=${it.id!}">删除</a>-->
</td>
@@ -20,7 +20,10 @@
<div>
<form id="form1">
<#if developmentZone??>
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
<#if developmentZone??>
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
<input type="hidden" id="areaInSquareKilometers" name="areaInSquareKilometers" value=""/>
</#if>
</#if>
<table>
<tr>
@@ -47,6 +50,10 @@
<td>名称</td>
<td>${developmentZone.name!}</td>
</tr>
<tr>
<td>面积</td>
<td id="areaDisplay"></td>
</tr>
<tr>
<td>别名</td>
<td>
@@ -61,13 +68,19 @@
<td>区块</td>
<td>${developmentZone.block!}</td>
</tr>
</table>
</form>
<table style="margin-top: -100px;border: none">
<tr>
<#-- <td>开发区图片</td>-->
<td><img id="myImage" src="${developmentZone.imgUrl!'/path/to/default/image.jpg'}"
style="width: 800px; height: 800px; object-fit: contain;"/></td>
<td colspan="2">
<div id="allmap" style="width:1024px;height:600px;"></div>
<div id="allmap" style="width:1024px;height:500px;"></div>
</td>
</tr>
</table>
</form>
</div>
</div>
@@ -92,12 +105,56 @@
new BMap.Point(${latlng[0]?string("#.######")}, ${latlng[1]?string("#.######")})<#if latlng_index lt developmentZone.bdShape.coordinates?size>, </#if>
</#list>
], {strokeColor: "blue", strokeWeight: 2, strokeOpacity: 0.5});
</#if>
map.centerAndZoom(polygon.getBounds().getCenter(), 13);
map.addOverlay(polygon); //增加多边形
// 处理coords的格式
var coords = [
<#list developmentZone.bdShape.coordinates as latlng>
{
lat: ${latlng[1]?string("#.######")},
lng: ${latlng[0]?string("#.######")}
}<#if latlng_index lt developmentZone.bdShape.coordinates?size>, </#if>
</#list>
];
function haversine(lat1, lon1, lat2, lon2) {
const R = 6371; // 地球半径(公里)
const lat1Rad = lat1 * (Math.PI / 180);
const lat2Rad = lat2 * (Math.PI / 180);
const deltaLat = (lat2 - lat1) * (Math.PI / 180);
const deltaLon = (lon2 - lon1) * (Math.PI / 180);
const a = Math.sin(deltaLat / 2) ** 2 +
Math.cos(lat1Rad) * Math.cos(lat2Rad) *
Math.sin(deltaLon / 2) ** 2;
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c; // 返回距离(公里)
}
function calculateArea(coords) {
let area = 0;
const n = coords.length;
for (let i = 0; i < n; i++) {
const j = (i + 1) % n;
area += coords[i].lng * coords[j].lat;
area -= coords[j].lng * coords[i].lat;
}
area = Math.abs(area) / 2; // 平方度
// 转换为平方公里
const conversionFactor = 111.32; // 大约每度经纬度的公里数(考虑到地球的曲率)
return area * conversionFactor * conversionFactor; // 返回面积(平方公里)
}
const areaInDegrees = calculateArea(coords);
// const areaInSquareKilometers = areaInDegrees * 123.5; // 转换为平方公里
const areaInSquareKilometers = areaInDegrees; // 转换为平方公里
document.getElementById('areaInSquareKilometers').value = areaInSquareKilometers.toFixed(2);
document.getElementById('areaDisplay').innerText = areaInSquareKilometers.toFixed(2) + ' 平方公里';
</#if>
</script>
</body>
@@ -643,7 +643,7 @@
<script type="text/javascript" src="../js/kindeditor-4.0/lang/zh_CN.js"></script>
<script type="text/javascript" src="../js/numValidator.js"></script>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=65d0404c8a96fc2a630d9621c10c25bf"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=a71942d982d7f8570a24a4d3363935e7"></script>
<script type="text/javascript">
$(document).ready(function(){
@@ -1053,7 +1053,7 @@
<script type="text/javascript" src="../js/numValidator.js"></script>
<#--<script language="javascript" src="http://app.mapabc.com/apis?t=javascriptmap&v=3.1.1&key=b0a7db0b3a30f944a21c3682064dc70ef5b738b062f6479a5eca39725798b1ee300bd8d5de3a4ae3"></script>-->
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=65d0404c8a96fc2a630d9621c10c25bf"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=a71942d982d7f8570a24a4d3363935e7"></script>
<script type="text/javascript">
var flag=false;
$(document).ready(function(){
@@ -44,7 +44,7 @@
<input type="text" id="seaAddress2" />
<input type="button" id="btn_sea2" value="查询" />
</div>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=65d0404c8a96fc2a630d9621c10c25bf"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=a71942d982d7f8570a24a4d3363935e7"></script>
<script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
<script>
//debugger;
@@ -590,7 +590,7 @@
<script type="text/javascript" src="../js/kindeditor-4.0/kindeditor.js"></script>
<script type="text/javascript" src="../js/kindeditor-4.0/lang/zh_CN.js"></script>
<script type="text/javascript" src="../js/numValidator.js"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=65d0404c8a96fc2a630d9621c10c25bf"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.3&key=a71942d982d7f8570a24a4d3363935e7"></script>
<#--<script language="javascript" src="http://app.mapabc.com/apis?t=javascriptmap&v=3.1.1&key=b0a7db0b3a30f944a21c3682064dc70ef5b738b062f6479a5eca39725798b1ee300bd8d5de3a4ae3"></script>-->
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
<script type="text/javascript">
@@ -112,4 +112,60 @@ $(document).ready(function() {
});
});
});
// 当点击"增加"按钮时
$('button[data-target="#myModal"]').click(
function () {
var idNum = $(this).closest('tr').index() + 1; // 获取按钮所在行的索引
var isAdd = $(this).attr('id').startsWith('add'); // 判断是增加还是减少
// 动态设置模态框标题
if (isAdd) {
$('#myModalLabel').text('增加次数');
} else {
$('#myModalLabel').text('减少次数');
}
// 绑定修改次数的功能
$('#submitCount').unbind('click').click(function() {
modifyCount(isAdd, idNum);
});
// var id_num = $(this).closest('tr').index();
// var totalInputId = '#sum_' + (id_num + 1);
// var totalValue = parseInt($(totalInputId).val()) || 0; // 获取当前总次数的值
//
// // 解除之前的绑定事件
// $('#editSubmit').unbind('click').click(function () {
// var addedCount = parseInt($('#cityPop').val()) || 0; // 获取用户输入的次数
//
// var newTotal = totalValue + addedCount; // 将输入的次数加到当前总次数上
//
// $(totalInputId).val(newTotal); // 更新总次数输入框的值
//
// $("input[id='save_"+(id_num+1)+"']").trigger('click');
// });
});
function modifyCount(isAdd, idNum) {
var totalInputId = '#sum_' + idNum;
var totalValue = parseInt($(totalInputId).val()) || 0; // 获取当前总次数的值
var count = parseInt($('#countInput').val()) || 0; // 获取用户输入的次数
var newTotal = isAdd ? totalValue + count : totalValue - count; // 根据增加或减少计算新的总次数
if (newTotal < 0) {
newTotal = 0; // 确保总次数不为负数
}
$(totalInputId).val(newTotal); // 更新总次数输入框的值
$('#countInput').val(''); // 清空输入框的值
// 调用 #auth 的点击事件(根据需求)
$("input[id='save_"+(idNum)+"']").trigger('click');
}
});
@@ -295,6 +295,7 @@
<@menuitem uri='/creditRate/list' text="价格可信度与匹配率关系" />
<@menuitem uri='/czBank/sampleLogs' text="浙商银行" />
<@menuitem uri='/villageIdentify/importResult' text="涉农结果导入" />
<@menuitem uri='/apiCountLog/list?purpose=1&isTest=0&status=0' text="API次数日志" />
</ul>
</li>
@@ -23,6 +23,7 @@ table{text-align: left;}
<form id="_form" action="doAdd" method="post">
<input name="method" value="doAdd" type="hidden"/>
<table style = "border:0px;">
<tr><td width="20%"><strong>APICode</strong></td><td width="30%"><input size="35" id="apiCode" name="apiCode" value="${apiCode!}"/></td><td width="50%"><font color="red" id="_apiCode_error"></font></td></tr>
<tr><td width="20%"><strong>名称</strong></td><td width="30%"><input size="35" id="name" name="name" value="${name!}"/></td><td width="50%"><font color="red" id="_name_error"></font></td></tr>
<tr><td><strong>URI</strong></td><td><input size="35" id="uri" name="uri" value="${uri!}"/></td><td><font color="red" id="_uri_error"></font></td></tr>
<tr><td><strong>说明</strong></td><td colspan="2"><input size="40" id="description" name="description" value="${description!}"/></td></tr>
@@ -32,6 +33,12 @@ table{text-align: left;}
<label><input name="save_result" type="radio" value="true" checked/>监控 </label>
</td>
</tr>
<tr><td><strong>是否对外</strong></td>
<td colspan="2">
<label><input name="pubStatus" type="radio" value="true" />不对外 </label>
<label><input name="pubStatus" type="radio" value="true" checked/>对外 </label>
</td>
</tr>
<tr><td clospan="2"><input type="button" id="_sub" value="创建"/></td></tr>
</table>
</form>
@@ -24,6 +24,11 @@ table{text-align: left;}
<input type="hidden" name="id" value="${or.id}"/>
<input name="method" value="doUpdate" type="hidden"/>
<table style = "border:0px;">
<tr><td width="20%"><strong>APICode</strong></td><td width="30%"><#if apiCode != 0>
<input size="35" id="apiCode" name="apiCode" value="${apiCode}"/>
<#else>
<input size="35" id="apiCode" name="apiCode" value="${or.apiCode}"/>
</#if></td><td width="50%"><font color="red" id="_apiCode_error"></font></td></tr>
<tr><td width="20%"><strong>名称</strong></td><td width="30%"><input size="35" id="name" name="name" value="${name!or.name}"/></td><td width="50%"><font color="red" id="_name_error"></font></td></tr>
<tr><td><strong>URI</strong></td><td><input size="35" id="uri" name="uri" value="${uri!or.uri}"/></td><td><font color="red" id="_uri_error"></font></td></tr>
<tr><td><strong>说明</strong></td><td colspan="2"><input size="40" id="description" name="description" value="${description!or.description}"/></td></tr>
@@ -47,8 +47,8 @@
<table>
<thead>
<tr>
<th align="center" width="15%">
ID
<th align="center" width="50px">
APICode
</th>
<th align="center" width="15%">
名称
@@ -56,15 +56,18 @@
<th align="center" width="15%">
URI
</th>
<th align="center" width="10%">
<th align="center" width="100px">
监控返回结果
</th>
<th align="center" width="100px">
是否对外
</th>
<th align="center" width="20%">
说明
</th>
<th align="center" width="10%">
是否有字权限
</th>
<#-- <th align="center" width="10%">-->
<#-- 是否有字权限-->
<#-- </th>-->
<th>
操作
</th>
@@ -74,7 +77,7 @@
<#list ors as or>
<tr>
<td align="center">
${or.id}
${or.apiCode!}
</td>
<td align="center">
${or.name!}
@@ -86,17 +89,20 @@
<input type="checkbox" value="false" <#if or.saveResult??&&or.saveResult==true>checked </#if> id="jk_${or.id}"
</td>
<td align="center">
${or.description!}
<input type="checkbox" value="false" <#if or.pubStatus??&&or.pubStatus==1>checked </#if> id="pub_${or.id}"
</td>
<td align="center">
<#if or.hasSubResource>
有
<#else>
无
</#if>
${or.description!}
</td>
<#-- <td align="center">-->
<#-- <#if or.hasSubResource>-->
<#-- 有-->
<#-- <#else>-->
<#-- 无-->
<#-- </#if>-->
<#-- </td>-->
<td>
<a onclick="return confirm('您确定要删除这条信息吗?');" href="../openResource/doDelete?id=${or.id}">删除</a>&nbsp;&nbsp;
<a onclick="return confirm('您确定要删除这条信息吗?');" href="../openResource/doDelete?id=${or.id}">删除</a>
<a href="../openResource/doUpdate?id=${or.id}">编辑</a>
<a href="#" onclick="saveSingle(this)" value="${or.id}">保存</a>
</td>
@@ -118,18 +124,27 @@
var a = $(e);
var id = a.attr("value");
var eck = $('#jk_'+id).attr("checked");
var eck2 = $('#pub_'+id).attr("checked");
var flag = false;
var flag2 = false;
if (eck == "checked") {
flag = true;
}
else{
flag= false;
}
if (eck2 == "checked") {
flag2 = true;
}
else{
flag2 = false;
}
$.ajax({
type: "post",
url: "../openResource/doChange",
data: "id="+id+"&save_result="+flag,
data: "id="+id+"&save_result="+flag+"&pubStatus="+flag2,
dataType: "json",
success: function (data)
{
@@ -137,7 +137,6 @@
}
}
var file = new FormData($("#file")[0]);
debugger
$.ajax({
url: '../villageIdentify/upload',
type: 'POST',
@@ -1,265 +1,330 @@
package com.fangjia.core.util;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class GeoUtils {
public static final String LAT ="lat";
public static final String LNG ="lng";
public enum GaussSphere {
Beijing54, Xian80, WGS84,
}
private static double rad(double d) {
return d * Math.PI / 180.0;
}
public static final String LAT = "lat";
public static double calculateDistance(double lng1, double lat1, double lng2, double lat2) {
return calculateDistance(lng1, lat1, lng2, lat2, GaussSphere.Beijing54);
}
public static final String LNG = "lng";
public static double calculateDistance(double lng1, double lat1, double lng2, double lat2, GaussSphere gs) {
double radLat1 = rad(lat1);
double radLat2 = rad(lat2);
double a = radLat1 - radLat2;
double b = rad(lng1) - rad(lng2);
double s = 2 * Math.asin(Math.sqrt(
Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * (gs == GaussSphere.WGS84 ? 6378137.0 : (gs == GaussSphere.Xian80 ? 6378140.0 : 6378245.0));
s = Math.round(s * 10000) / 10000;
return s;
}
public enum GaussSphere {
Beijing54, Xian80, WGS84,
}
/**
* @param raidus
* 单位米
*
* @return minLat,maxLat, minLng,maxLng
*/
public static double[] getAround(double lat, double lng, double radius) {
Double latitude = lat;
Double longitude = lng;
Double degree = (24901 * 1609) / 360.0;
double raidusMile = radius;
private static double rad(double d) {
return d * Math.PI / 180.0;
}
Double dpmLat = 1 / degree;
Double radiusLat = dpmLat * raidusMile;
Double minLat = latitude - radiusLat;
Double maxLat = latitude + radiusLat;
public static double calculateDistance(double lng1, double lat1, double lng2, double lat2) {
return calculateDistance(lng1, lat1, lng2, lat2, GaussSphere.Beijing54);
}
Double mpdLng = degree * Math.cos(latitude * (Math.PI / 180));
Double dpmLng = 1 / mpdLng;
Double radiusLng = dpmLng * raidusMile;
Double minLng = longitude - radiusLng;
Double maxLng = longitude + radiusLng;
return new double[] { minLat, maxLat, minLng, maxLng };
}
public static double calculateDistance(double lng1, double lat1, double lng2, double lat2, GaussSphere gs) {
double radLat1 = rad(lat1);
double radLat2 = rad(lat2);
double a = radLat1 - radLat2;
double b = rad(lng1) - rad(lng2);
double s = 2 * Math.asin(Math.sqrt(
Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * (gs == GaussSphere.WGS84 ? 6378137.0 : (gs == GaussSphere.Xian80 ? 6378140.0 : 6378245.0));
s = Math.round(s * 10000) / 10000;
return s;
}
/**
* 根据给定的经纬度、距离、角度,计算对应的经纬度
*
* @param Lat
* 原始纬度
* @param Lon
* 原始精度
* @param distance
* 距离(米)
* @param angle
* , 90: right, 180: down
* @return
*/
public static double[] getLatLon(double Lon, double Lat, int distance, double angle) {
double dx = distance * Math.sin(angle * Math.PI / 180);
double dy = distance * Math.cos(angle * Math.PI / 180);
/**
* @param raidus 单位米
* @return minLat, maxLat, minLng,maxLng
*/
public static double[] getAround(double lat, double lng, double radius) {
Double latitude = lat;
Double longitude = lng;
Double degree = (24901 * 1609) / 360.0;
double raidusMile = radius;
double lon1 = (dx / edd(Lat) + eadLon(Lon)) * 180 / Math.PI;
double lat1 = (dy / ecc(Lat) + radLat(Lat)) * 180 / Math.PI;
Double dpmLat = 1 / degree;
Double radiusLat = dpmLat * raidusMile;
Double minLat = latitude - radiusLat;
Double maxLat = latitude + radiusLat;
return new double[] { lon1, lat1 };
}
Double mpdLng = degree * Math.cos(latitude * (Math.PI / 180));
Double dpmLng = 1 / mpdLng;
Double radiusLng = dpmLng * raidusMile;
Double minLng = longitude - radiusLng;
Double maxLng = longitude + radiusLng;
return new double[]{minLat, maxLat, minLng, maxLng};
}
/**
* 纬度的弧度
*/
public static double radLat(double Lat) {
return Lat * Math.PI / 180;
}
/**
* 根据给定的经纬度、距离、角度,计算对应的经纬度
*
* @param Lat 原始纬度
* @param Lon 原始精度
* @param distance 距离(米)
* @param angle , 90: right, 180: down
* @return
*/
public static double[] getLatLon(double Lon, double Lat, int distance, double angle) {
double dx = distance * Math.sin(angle * Math.PI / 180);
double dy = distance * Math.cos(angle * Math.PI / 180);
/**
* 经度的弧度
*/
public static double eadLon(double Lon) {
return Lon * Math.PI / 180;
}
double lon1 = (dx / edd(Lat) + eadLon(Lon)) * 180 / Math.PI;
double lat1 = (dy / ecc(Lat) + radLat(Lat)) * 180 / Math.PI;
public static double edd(double Lat) {
double ec = ecc(Lat);
double radLat = radLat(Lat);
return ec * Math.cos(radLat);
}
return new double[]{lon1, lat1};
}
final static int EARTH_RADIUS = 6378137;// 赤道半径 earth radius
final static int POLAR_RADIUS = 6356725;// 极半径 polar radius
/**
* 纬度的弧度
*/
public static double radLat(double Lat) {
return Lat * Math.PI / 180;
}
public static double ecc(double Lat) {
return POLAR_RADIUS + (EARTH_RADIUS - POLAR_RADIUS) * (90 - Lat) / 90;
}
/**
* 经度的弧度
*/
public static double eadLon(double Lon) {
return Lon * Math.PI / 180;
}
// public static void main(String[] args) {
public static double edd(double Lat) {
double ec = ecc(Lat);
double radLat = radLat(Lat);
return ec * Math.cos(radLat);
}
final static int EARTH_RADIUS = 6378137;// 赤道半径 earth radius
final static int POLAR_RADIUS = 6356725;// 极半径 polar radius
public static double ecc(double Lat) {
return POLAR_RADIUS + (EARTH_RADIUS - POLAR_RADIUS) * (90 - Lat) / 90;
}
// public static void main(String[] args) {
// System.out.println(calculateDistance(121.35913,31.222278,
// 121.36441151585116,31.21939479450005));
// Map<String, Double> s = bd09ToGps84(121.37032165267994,31.226171036022064);
// System.out.println(s.get(LAT));
// System.out.println(s.get(LNG));
// }
public static double pi = 3.1415926535897932384626;
public static double a = 6378245.0;
public static double ee = 0.00669342162296594323;
/**
* 百度转 wgs84
* @param bd_lat
* @param bd_lng
* @return
*/
public static Map<String, Double> bd09ToGps84(double bd_lat, double bd_lng) {
Map<String, Double> gps = bd09ToGcj02(bd_lat,bd_lng);
return gcjToGps84(gps.get(LAT),gps.get(LNG));
}
/**
* wgs84 转百度
* @param bd_lat
* @param bd_lng
* @return
*/
public static Map<String, Double> Gps84Tobd09(double lat, double lng) {
Map<String, Double> gps = gps84ToGcj02(lat,lng);
return gcj02ToBd09(gps.get(LAT),gps.get(LNG));
}
public static double pi = 3.1415926535897932384626;
public static double a = 6378245.0;
public static double ee = 0.00669342162296594323;
/**
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 BD-09 坐标转换成GCJ-02 坐标
*/
public static Map<String, Double> bd09ToGcj02(double bd_lat, double bd_lng) {
double x = bd_lng - 0.0065, y = bd_lat - 0.006;
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
double gg_lng = z * Math.cos(theta);
double gg_lat = z * Math.sin(theta);
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, gg_lat);
gps.put(LNG, gg_lng);
return gps;
}
/**
* 百度转 wgs84
*
* @param bd_lat
* @param bd_lng
* @return
*/
public static Map<String, Double> bd09ToGps84(double bd_lat, double bd_lng) {
Map<String, Double> gps = bd09ToGcj02(bd_lat, bd_lng);
return gcjToGps84(gps.get(LAT), gps.get(LNG));
}
/**
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
*/
public static Map<String, Double> gcj02ToBd09(double gg_lat, double gg_lng) {
double x = gg_lng, y = gg_lat;
double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
double bd_lng = z * Math.cos(theta) + 0.0065;
double bd_lat = z * Math.sin(theta) + 0.006;
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, bd_lat);
gps.put(LNG, bd_lng);
return gps;
}
/**
* wgs84 转百度
*
* @param bd_lat
* @param bd_lng
* @return
*/
public static Map<String, Double> Gps84Tobd09(double lat, double lng) {
Map<String, Double> gps = gps84ToGcj02(lat, lng);
return gcj02ToBd09(gps.get(LAT), gps.get(LNG));
}
/**
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 WGS84 坐标转换成 GCJ-02 坐标
*/
public static Map<String, Double> gps84ToGcj02(double lat, double lng) {
if (outOfChina(lat, lng)) {
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, lat);
gps.put(LNG, lng);
return gps;
}
double dLat = transformLat(lng - 105.0, lat - 35.0);
double dlng = transformlng(lng - 105.0, lat - 35.0);
double radLat = lat / 180.0 * pi;
double magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
double sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dlng = (dlng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
double mgLat = lat + dLat;
double mglng = lng + dlng;
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, mgLat);
gps.put(LNG, mglng);
return gps;
}
/**
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 BD-09 坐标转换成GCJ-02 坐标
*/
public static Map<String, Double> bd09ToGcj02(double bd_lat, double bd_lng) {
double x = bd_lng - 0.0065, y = bd_lat - 0.006;
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
double gg_lng = z * Math.cos(theta);
double gg_lat = z * Math.sin(theta);
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, gg_lat);
gps.put(LNG, gg_lng);
return gps;
}
/**
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 GCJ-02 坐标转换成 WGS84 坐标
*/
public static Map<String, Double> gcjToGps84(double lat, double lng) {
Map<String, Double> gps = transform(lat, lng);
double lngtitude = lng * 2 - gps.get(LNG);
double latitude = lat * 2 - gps.get(LAT);
Map<String, Double> gps2 = new HashMap<String, Double>();
gps2.put(LAT, latitude);
gps2.put(LNG, lngtitude);
return gps2;
}
/**
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
*/
public static Map<String, Double> gcj02ToBd09(double gg_lat, double gg_lng) {
double x = gg_lng, y = gg_lat;
double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
double bd_lng = z * Math.cos(theta) + 0.0065;
double bd_lat = z * Math.sin(theta) + 0.006;
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, bd_lat);
gps.put(LNG, bd_lng);
return gps;
}
public static boolean outOfChina(double lat, double lng) {
if (lng < 72.004 || lng > 137.8347)
return true;
if (lat < 0.8293 || lat > 55.8271)
return true;
return false;
}
/**
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 WGS84 坐标转换成 GCJ-02 坐标
*/
public static Map<String, Double> gps84ToGcj02(double lat, double lng) {
if (outOfChina(lat, lng)) {
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, lat);
gps.put(LNG, lng);
return gps;
}
double dLat = transformLat(lng - 105.0, lat - 35.0);
double dlng = transformlng(lng - 105.0, lat - 35.0);
double radLat = lat / 180.0 * pi;
double magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
double sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dlng = (dlng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
double mgLat = lat + dLat;
double mglng = lng + dlng;
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, mgLat);
gps.put(LNG, mglng);
return gps;
}
private static Map<String, Double> transform(double lat, double lng) {
if (outOfChina(lat, lng)) {
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, lat);
gps.put(LNG, lng);
return gps;
}
double dLat = transformLat(lng - 105.0, lat - 35.0);
double dlng = transformlng(lng - 105.0, lat - 35.0);
double radLat = lat / 180.0 * pi;
double magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
double sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dlng = (dlng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
double mgLat = lat + dLat;
double mglng = lng + dlng;
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, mgLat);
gps.put(LNG, mglng);
return gps;
}
/**
* 地球坐标系 (WGS84) 与火星坐标系 (GCJ-02) 的转换算法 将 GCJ-02 坐标转换成 WGS84 坐标
*/
public static Map<String, Double> gcjToGps84(double lat, double lng) {
Map<String, Double> gps = transform(lat, lng);
double lngtitude = lng * 2 - gps.get(LNG);
double latitude = lat * 2 - gps.get(LAT);
Map<String, Double> gps2 = new HashMap<String, Double>();
gps2.put(LAT, latitude);
gps2.put(LNG, lngtitude);
return gps2;
}
private static double transformLat(double x, double y) {
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
return ret;
}
public static boolean outOfChina(double lat, double lng) {
if (lng < 72.004 || lng > 137.8347)
return true;
if (lat < 0.8293 || lat > 55.8271)
return true;
return false;
}
private static double transformlng(double x, double y) {
double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0;
return ret;
}
private static Map<String, Double> transform(double lat, double lng) {
if (outOfChina(lat, lng)) {
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, lat);
gps.put(LNG, lng);
return gps;
}
double dLat = transformLat(lng - 105.0, lat - 35.0);
double dlng = transformlng(lng - 105.0, lat - 35.0);
double radLat = lat / 180.0 * pi;
double magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
double sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dlng = (dlng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
double mgLat = lat + dLat;
double mglng = lng + dlng;
Map<String, Double> gps = new HashMap<String, Double>();
gps.put(LAT, mgLat);
gps.put(LNG, mglng);
return gps;
}
public static void main(String[] args){
Map<String, Double> location = gps84ToGcj02(31.218024629574998,121.36562884455);
System.out.println(location.toString());
}
private static double transformLat(double x, double y) {
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
return ret;
}
private static double transformlng(double x, double y) {
double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0;
return ret;
}
public static Map<String, String> parserByGaode(String city, String address) {
Map<String, String> params = new HashMap<String, String>();
params.put("city", city);
params.put("address", address);
String content;
try {
params.put("key", getGaodeKey("v3/geocode/geo"));
content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8");
} catch (Exception e) {
params.put("key", getGaodeKey("v3/geocode/geo"));
try {
content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8");
} catch (HttpRequestException ex) {
throw new RuntimeException(ex);
}
}
JSONObject json = new JSONObject(content);
if (json != null && "OK".equals(json.optString("info"))) {
JSONArray ret = json.getJSONArray("geocodes");
if (ret.length() > 0) {
JSONObject firstResult = ret.getJSONObject(0);
String str = firstResult.getString("location");
String cityA = firstResult.getString("city");
String district = firstResult.getString("district");
JSONArray township = firstResult.getJSONArray("township");
String level = firstResult.getString("level");
String[] arrs = str.split(",");
Map<String, String> result = new HashMap<String, String>();
result.put("lng", arrs[0]);
result.put("lat", arrs[1]);
result.put("level", level);
result.put("city", cityA);
result.put("district", district);
if (township.length() > 0) {
result.put("town", township.toString());
}
return result;
}
} else if (json != null && "10044".equals(json.optString("infocode"))) {
System.exit(1);
} else if (json != null && "10004".equals(json.optString("infocode"))) {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
try {
Thread.sleep(60000);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
} else if (json != null && "10017".equals(json.optString("infocode"))) {
// 所请求的资源不可用
System.exit(1);
}
return null; // 如果没有返回值,可以根据需要处理
}
private static String getGaodeKey(String endpoint) {
// 实现获取高德 API key 的逻辑
return "8796b9dfb3889b57c38e2fff1b7e51bd";
}
public static void main(String[] args) {
// Map<String, Double> location = gps84ToGcj02(31.218024629574998,121.36562884455);
// System.out.println(location.toString());
Map<String, String> result = parserByGaode("上海", "新泾三村");
System.out.println(result.toString());
}
}
@@ -325,7 +325,85 @@ public class DistrictController {
return model.redirectPermanently(model.getCityUrl() + "/ershoufang/" + URLEncoder.encode(model.getKeyword(), "UTF-8") + "--");
}
/*if (sensitiveWordService.isSensitiveWord(model.getKeyword())) {
// if (sensitiveWordService.isSensitiveWord(model.getKeyword())) {
// return model.redirectPermanently("http://www.fangjia.com");
// }
// Pager pager = model.getPager(20);
// pager.setMaxPage(FangjiaConfig.getConfig().getSearchListMaxPageNo());
//
// // 小区列表支持新盘搜索
// model.setCategory("district");
// Object obj = FangjiaRudder.listMan(model.getKeyword());
// if (obj != null) {
// return obj;
// }
//
// String city = ((ServerArea) FangjiaServerAreaContextHolder.getServerAreaDefault()).getDisplay();
// Menu menu = menuService.menuMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(), MenuCategoryEnum.xiaoqu,
// getCurrentParams(), 1);
// model.setMenu(menu);
//
// FacetQueryResult<District> result;
// DistrictQueryBean queryBean = modelToBean(model);
// queryBean.setCity(city);
//
// // 老网站的URL中区域是带“区”的
// if (StringUtils.isNotBlank(queryBean.getRegion())) {
// List<Group> gList = menu.getGroupList();
// for (Group g : gList) {
// if (!"region".equals(g.getName())) {
// continue;
// }
//
// List<Item> iList = g.getItemList();
// for (Item i : iList) {
// if (i.isSelected()) {
// queryBean.setRegion(i.getName());
// break;
// }
// }
// break;
// }
// }
//
// if (StringUtils.isBlank(model.getKeyword())) {
// result = districtService.findByQueryBeanWithFacet(menu, pager, queryBean, "bscore", false, false);
// } else {
// result = districtService.findByQueryBeanWithFacet(menu, pager, queryBean, null, false, false);
// if (result.getNumberFound() <= 0) {
// result = districtService.findByQueryBeanWithFacet(menu, pager, queryBean, null, false, false, true);
// }
// }
//
// List<DistrictInfo> districtList = districtService.processDistrictInfo(result.getEntityResults(), model.getKeyword());
// model.setDistrictList(districtList);
// if (StringUtils.isNotBlank(model.getKeyword()) && districtList.size() <= 3) {
// Map<String, Object> parseMap = knowbaseService.parseKeyword(model.getKeyword());
// if (parseMap.get("district_name") != null) {
// List<DistrictInfo> otherDistrictList = otherCitiesDistrict(model.getKeyword(), model.getKeyword());
// model.setOtherDistrictList(otherDistrictList);
// }
// }
//
// pager.setTotalRows(result.getNumberFound());
// model.setPager(pager);
//
// model.setConditions(menuService.getConditions(((ServerArea) FangjiaServerAreaContextHolder.getServerAreaDefault()),
// MenuCategoryEnum.xiaoqu, getCurrentParams()));
// model.setConditionItems(menuService.getConditionItems(FangjiaServerAreaContextHolder.getServerAreaDefault(),
// MenuCategoryEnum.xiaoqu, getCurrentParams()));
//
//// */
//// * gasm统计
//// */
// model.addGaMap(Gakey.rc, pager.getTotalRows());
//
// feedFooter(model);
// return model;
}
public Object hidelistAction(HttpServletRequest request,DistrictModel model) throws Exception {
if (sensitiveWordService.isSensitiveWord(model.getKeyword())) {
return model.redirectPermanently("http://www.fangjia.com");
}
@@ -394,26 +472,12 @@ public class DistrictController {
model.setConditionItems(menuService.getConditionItems(FangjiaServerAreaContextHolder.getServerAreaDefault(),
MenuCategoryEnum.xiaoqu, getCurrentParams()));
*//**
* gasmͳ¼Æ
*//*
model.addGaMap(Gakey.rc, pager.getTotalRows());
feedFooter(model);
return model;*/
}
public Object hidelistAction(HttpServletRequest request,DistrictModel model) throws Exception {
if(StringUtils.isNotBlank(model.getCityName())){
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("visible", 0));
params.add(new QueryParam("city", model.getCityName()));
params.add(new QueryParam("category", "district"));
List<District> districts = districtService.findAllByParams(params, 0, 0,new String[]{"city", "region", "name"});
model.setDistricts(districts);
CacheUtils.putValue(CacheUtils.CachePolicyEnum.NEXT_MONTH, this.getClass(), "district-hide-list-crawl-"+model.getCityName(), (Serializable) districts);
}
return model;
}
/**
@@ -1764,6 +1828,47 @@ public class DistrictController {
// return model;
}
/**
* 小区信息
*
* @param model
* @return
*/
@SuppressWarnings("unchecked")
public Object seoInfoAction(DistrictModel model) {
District district = districtService.findDistrictById(model.getId());
if (district == null)
return model;
model.setCityName(district.getCity());
model.setDistrictName(district.getName());
model.setDistrictAddress(district.getAddress());
model.setRegion(district.getRegion());
model.setId(district.getId());
model.setType(String.valueOf(model.getType()));
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district.getRegion(), district.getName()));
if (null == districtStatBo || null == districtStatBo.getDefaultDistrictStat()) {
return model;
}
int districtAvgPrice = 0;
int villaAvgPrice = 0;
if (null != districtStatBo.getDistrictStat()) {
districtAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
}
if (null != districtStatBo.getVillaDistrictStat()) {
villaAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
}
model.setDistrictAvgPrice((Integer) (districtAvgPrice / 100) * 100);
model.setVillaAvgPrice((Integer) (villaAvgPrice / 100) * 100);
model.setDistrictStatBo(districtStatBo);
return model;
}
private List<String> getSubList(List<String> fullList, int start, int pageSize, int total) {
if (start >= total) {
return Collections.emptyList();
@@ -196,7 +196,7 @@ public class HouseReportController {
model.setEvaluation(evaluation);
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(evaluation.getCity(), evaluation.getRegion(), evaluation.getDistrictName(), "district");
if(null != sqmetreRent){
int rentPrice = (int) (sqmetreRent.getAvgPrice() * evaluation.getArea());
int rentPrice = (int) (sqmetreRent.getAvgPrice().intValue() * evaluation.getArea());
model.setRentPrice(rentPrice);
}
}else{
@@ -61,7 +61,7 @@ public class RentHouseReportController {
model.setEvaluation(evaluation);
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(evaluation.getCity(), evaluation.getRegion(), evaluation.getDistrictName(), "district");
if(null != sqmetreRent){
int rentPrice = (int) (sqmetreRent.getAvgPrice() * evaluation.getArea());
int rentPrice = (int) (sqmetreRent.getAvgPrice().intValue() * evaluation.getArea());
model.setRentPrice(rentPrice);
}
@@ -107,13 +107,13 @@ public class RentHouseReportController {
double lastMonthPrice = 0;
if(null != sqmetreRent1){
lastMonthPrice = sqmetreRent1.getAvgPrice();
lastMonthPrice = sqmetreRent1.getAvgPrice().intValue();
retMap.put("lastMonthPrice", sqmetreRent1.getAvgPrice());
}
if(null != sqmetreRent2){
retMap.put("lastYearMonthPrice", sqmetreRent2.getAvgPrice());
double markup = (lastMonthPrice-sqmetreRent2.getAvgPrice())*100.0/sqmetreRent2.getAvgPrice();
double markup = (lastMonthPrice-sqmetreRent2.getAvgPrice().intValue())*100.0/sqmetreRent2.getAvgPrice().intValue();
retMap.put("markup", DataUtil.getDoubleRound(2,markup));
}
jsonRet.setJsonModel(retMap);
@@ -105,7 +105,7 @@ public class SellHouseReportController {
model.setEvaluation(eval);
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(eval.getCity(), eval.getRegion(), eval.getDistrictName(), "district");
if(null != sqmetreRent){
int rentPrice = (int) (sqmetreRent.getAvgPrice() * eval.getArea());
int rentPrice = (int) (sqmetreRent.getAvgPrice().intValue() * eval.getArea());
model.setRentPrice(rentPrice);
}
List<LoanProduct> creditProductList = loanProductService.findProductByType("ÐÅÓôû",LoanProductPositionEnum.SIMPLE_REPORT.getId());
@@ -140,6 +140,8 @@ public class DistrictModel extends BaseModel {
private int allPicCount;
private List<District> districts;
private String type;
public boolean isHousePriceInfo() {
return housePriceInfo;
}
@@ -787,4 +789,12 @@ public class DistrictModel extends BaseModel {
public void setDistricts(List<District> districts) {
this.districts = districts;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
@@ -36,18 +36,22 @@
com.fangjia.coresite.filters.AccessLogFilter
</filter-class>
</filter>
<filter>
<filter-name>AntiSpiderFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>antiSpiderFilter</param-value>
</init-param>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<!--爬虫拦截-->
<!-- <filter>-->
<!-- <filter-name>AntiSpiderFilter</filter-name>-->
<!-- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>-->
<!-- <init-param>-->
<!-- <param-name>targetBeanName</param-name>-->
<!-- <param-value>antiSpiderFilter</param-value>-->
<!-- </init-param>-->
<!-- <init-param>-->
<!-- <param-name>targetFilterLifecycle</param-name>-->
<!-- <param-value>true</param-value>-->
<!-- </init-param>-->
<!-- </filter>-->
<filter>
<filter-name>AnalyticsFilter</filter-name>
<filter-class>
@@ -90,11 +94,11 @@
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>AntiSpiderFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<!-- <filter-mapping>-->
<!-- <filter-name>AntiSpiderFilter</filter-name>-->
<!-- <url-pattern>/*</url-pattern>-->
<!-- <dispatcher>REQUEST</dispatcher>-->
<!-- </filter-mapping>-->
<filter-mapping>
<filter-name>AnalyticsFilter</filter-name>
@@ -1,21 +1,130 @@
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
<#compress>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "../jsconstants.ftl" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/fj_district_list.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/base.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/fj_friend_link.css?v=${version}" />
</head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
<div>
<#list districts! as dist>
<a href="${cityUrl}/zoushi?cityName=${dist.city}&districtName=${dist.name!''}&region=${dist.region!''}">${dist.name!}</a>
</#list>
</div><!--end mainwrap-->
<#include "/analytics.ftl" />
</body>
</html>
<#assign fangjiaShareContent = "房价网: 提供${cityName!}小区房价及在售房源,还有小区周边配套及新闻评论!" />
<#assign title="${cityName}">
<#assign keywords="${cityName}">
<#assign descr="${cityName}房价网为您提供热门小区搜索服务">
<#assign addedKeywords="false">
<#if region?exists && region != ''>
<#assign keywords="${keywords}${region}">
<#assign descr="${descr!''}${region!''}">
<#assign title="${title!''}${region!''}">
<#assign addedKeywords="true">
</#if>
<#if keyword?exists && keyword != ''>
<#assign keywords="${keywords}${keyword}">
<#assign descr="${descr!''}${keyword!''}">
<#assign title="${title!''}${keyword!''}">
<#assign addedKeywords="true">
</#if>
<#assign title="${title}">
<#assign keywords="${keywords}小区,热门小区搜索">
<#assign descr="${descr}二手房">
<#if block?exists && block != ''>
<#assign title="${title!''}${block!''}板块">
<#assign keywords="${keywords!''}${block!''}板块">
<#assign descr="${descr!''}${block!''}板块">
<#assign addedKeywords="true">
</#if>
<#assign title2="${cityName}小区信息">
<#if (conditions?? && conditions?size gt 0)>
<#list conditions as c>
<#assign title2="${title2}${c}">
<#if c_has_next>
<#assign title2="${title2}_">
<#else>
<#assign title2="${title2}附近小区房价">
</#if>
</#list>
<#else>
<#assign title2="${cityName}小区信息">
</#if>
<#assign PAGE_TITLE>【${title2}】</#assign>
<#assign PAGE_DESCRIPTION>${title2!''}小区搜索, 房价网同时提供${cityName!''}小区房价,小区在售二手房房源,新房房源,租房房源.以及小区配套设施,小区相关新闻等内容.</#assign>
<#assign PAGE_KEYWORDS>${keywords!''},房价网</#assign>
<#assign GA_PAGEVIEW_PATH = "/district/list/${fullQueryString}" />
<#include "/header/head.ftl" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/fj_district_list.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/base.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/fj_friend_link.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/fj_global.css?v=${version}" />
<link rel="stylesheet" type="text/css" href="${staticUrl}/style/fangjia/fj_pager.css?v=${version}" />
<link href="${staticUrl}/style/fangjia/v6/common.css?v=${version}" rel="stylesheet">
<link href="${staticUrl}/style/fangjia/v6/_city_select.css?v=${version}" rel="stylesheet">
<link href="${staticUrl}/style/fangjia/v6/trend.css?v=${version}" rel="stylesheet">
<script src="${staticUrl}/js/fangjia/v5/jquery-1.7.2.min.js?v=${version}"></script>
<link href="${staticUrl}/style/fangjia/v6/seoInfo.css?v=${version}" rel="stylesheet">
<#include "../jsconstants.ftl" />
<style type="text/css">
.header .logo {
background: none;
}
.pageleft2 {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-end;
margin-top: 80px;
}
.hover_list ul li {
height: 54px;
}
.pagination-page, .pageNumber {
border: solid 0px #dadada;
}
</style>
</head>
<body>
<#include "/header/v6/_header.ftl"/>
<div class="main">
<div class="pageleft2">
<#if pager.totalRows gt 0>
<div class="c0 pt5 search_result" id="pagelist">
<@d_pager action="hidelist" currentPage=pager.currentPage controller="district" totalPages=pager.totalPages theme="topSearch" anchor="pagelist"/>
</div>
<div class="hover_list">
<ul>
<#list districtList as district>
<li name="__page_click_area" id="detail_${district_index}" class="hover_m">
<b>
<a href="<@d_url uri="/zoushi"><@d_param name="keyword" value="${district.districtNameText!}"/><@d_param name="cityName" value="${cityName!}"/></@d_url>">
<h2>${district.districtNameText}</h2>
</a>
</b>
</li>
</#list>
</ul>
</div>
<div class="c0 mb20 page" style="height: 60px;">
<#if pager.totalRows gt pager.pageSize>
<div class="fr h30">
<@d_pager action="hidelist" currentPage=pager.currentPage controller="district" totalPages=pager.totalPages anchor="pagelist"/>
</div>
</#if>
</div>
</#if>
</div><!--end pageleft2-->
</div><!--end main-->
<script type="text/javascript" src="${staticUrl}/js/fangjia/fangjia.list.js?v=${version}"></script>
</body>
</html>
</#compress>
@@ -0,0 +1,111 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<#compress>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "../jsconstants.ftl" />
<link href="${staticUrl}/style/fangjia/v6/common.css?v=${version}" rel="stylesheet">
<link href="${staticUrl}/style/fangjia/v6/_city_select.css?v=${version}" rel="stylesheet">
<link href="${staticUrl}/style/fangjia/v6/trend.css?v=${version}" rel="stylesheet">
<script src="${staticUrl}/js/fangjia/v5/jquery-1.7.2.min.js?v=${version}"></script>
<link href="${staticUrl}/style/fangjia/v6/seoInfo.css?v=${version}" rel="stylesheet">
<script>
if((navigator.userAgent.match(/(iPad|iPhone|iPod|Android|ios)/i))){
document.write("<link href='${staticUrl}/style/fangjia/v5/city-m.css?v=${version}' rel='stylesheet'>");
document.write("<link href='${staticUrl}/style/fangjia/v6/mobile.css?v=${version}' rel='stylesheet'>");
}
</script>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=0a7eM0lkIvpKGPiq1bMCfeH7"></script>
<script type="text/javascript" src="//api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js"></script>
<script>
var cityStr = "${city!}";
var regionStr = "${region!}";
var districtStr = "${districtName!}";
</script>
</head>
<body>
<#include "/header/v6/_header.ftl"/>
<div class="main">
<div class="main_left">
<div class="overview overview01" style="border-bottom:none;padding-bottom:0;">
<div class="overview_left">
<div>
<p><label>${districtName!}</label></p>
<p><i></i> <span style="color:#878682;">${city!} ${region!} ${districtAddress!}</span></p>
</div>
<div class="price_div">
<ul><li>小区均价</li><li><span class="unit_price">56565</span><span class="dw">元/㎡</span></li></ul>
<ul><li>环比</li><li><span class="hb_tb">3.6</span><i></i></li></ul>
<ul><li>同比</li><li><apan class="hb_tb">12.3</apan><i></i></li></ul>
</div>
</div>
<!--价格走势 -->
<#include "../houseReport/district_price.ftl"/>
<!-- 周边配套 -->
<#include "../houseReport/district_around_map2.ftl"/>
</div>
</div>
</div>
<#include "/header/v6/_footer.ftl"/>
<script src="${staticUrl}/js/fangjia/v5/main.js?v=${version}"></script>
<script src="${staticUrl}/js/fangjia/v5/index.js?v=${version}"></script>
<#--<script src="${staticUrl}/js/fangjia/v5/highcharts5.0.6.js?v=${version}"></script>-->
<#--<script src="${staticUrl}/js/highcharts/highstock-1.1.4.js?v=${version}"></script>-->
<script src="${staticUrl}/js/highcharts/exporting.js?v=${version}"></script>
<script type="text/javascript" src="${staticUrl}/js/fangjiaNew.js?v=${version}"></script>
<script src="${staticUrl}/js/fangjia/v5/echarts-all.js?v=${version}"></script>
<script src="${staticUrl}/js/fangjia/v5/city.js?v=${version}"></script>
<script type="text/javascript" src="//g.alicdn.com/sj/lib/zepto/zepto.js" charset="utf-8"></script>
<script type="text/javascript">
var chart ;
var down_pic_temp = 0;
//走势图
<#if districtStatBo?? || regionStatBo??>
<#if type??>
<#if type == '4' || type == 'quarter'>
var url = Constants.cityUrl + '/trend/quarterData?defaultCityName=${cityName}&districtName=${districtName!}&region=${region!}&block=${block!}&keyword=${keyword!}';
<#elseif type == '3' || type == 'half'>
var url = Constants.cityUrl + '/trend/halfData?defaultCityName=${cityName}&districtName=${districtName!}&region=${region!}&block=${block!}&keyword=${keyword!}';
<#elseif type == '1' || type == 'year2'>
var url = Constants.cityUrl + '/trend/year2Data?defaultCityName=${cityName}&districtName=${districtName!}&region=${region!}&block=${block!}&keyword=${keyword!}';
<#else>
var url = Constants.cityUrl + '/trend/yearData?defaultCityName=${cityName}&districtName=${districtName!}&region=${region!}&block=${block!}&keyword=${keyword!}';
</#if>
<#else>
var url = Constants.cityUrl + '/trend/quarterData?defaultCityName=${cityName}&districtName=${districtName!}&region=${region!}&block=${block!}&keyword=${keyword!}';
</#if>
$.getJSON(encodeURI(url), function (data) {
createChart('container', data, false);
});
</#if>
//下载 打印
exportButton();
$("#exportButton").click(function () {
chart.exportChart()
});
$("#printButton").click(function () {
chart.print()
});
</script>
</body>
</html>
</#compress>
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${cityName}房产在线评估 - 房价网 fangjia.com</title>
<meta name="keywords" content="${cityName}房产评估,${cityName}房产估价,${cityName}房产数据,${cityName}房价">
<meta name="keywords" content="${cityName}房产评估,${cityName}房产估价,${cityName}房产数据,${cityName}房价,${cityName}房产网">
<meta name="description" content="房价网免费提供${cityName}房产在线评估服务,通过二手房挂牌价、房屋面积、楼层、装修等因素和科学的算法评估二手房房价,同时提供${cityName}二手房房价涨跌走势。">
<#include "../jsconstants.ftl" />
@@ -36,6 +36,7 @@
.adBoxLoan{width:100%;height:auto;background:none;border:solid 1px #f3f3f3;}
.swiper-container{margin:0 1rem;margin-top:2rem;padding-bottom:1.5rem;top:0;}
.swiper-container-horizontal > .swiper-pagination{bottom:0;}
.evaluation_content1 .error {top: 380px;}
}
@media (min-width:450px) and (max-width:600px) {
.evaluation_inputInfo .cityChoice,.evaluation_inputInfo > div > div span{width:82%;}
@@ -72,18 +73,18 @@
<#include "/header/v6/_header.ftl"/>
<#include "/evaluation/checkUserNewRedirct.ftl"/>
<div class="bannerIndex mobile01">
<div class="imgBoxIndex">
<div class="bannerIndex01">
<div style="text-align: left;margin-left: 50%;margin-right: 10%">
<p><label>全国房产在线估值</label></p>
<div class="btnGroup" align="left" style="float: left">
<center><a id="a1" class="link_btn1 link01_btn text20" data_id="1040" cat="solution">申请试用</a></center>
</div>
</div>
</div>
</div>
</div>
<#-- <div class="bannerIndex mobile01">-->
<#-- <div class="imgBoxIndex">-->
<#-- <div class="bannerIndex01">-->
<#-- <div style="text-align: left;margin-left: 50%;margin-right: 10%">-->
<#-- <p><label>全国房产在线估值</label></p>-->
<#-- <div class="btnGroup" align="left" style="float: left">-->
<#-- <center><a id="a1" class="link_btn1 link01_btn text20" data_id="1040" cat="solution">申请试用</a></center>-->
<#-- </div>-->
<#-- </div>-->
<#-- </div>-->
<#-- </div>-->
<#-- </div>-->
<div class="bannerIndex mobile02">
@@ -80,11 +80,11 @@
<li class="<#if (controllerName == 'evaluation' || controllerName == 'report' || actionName == 'trend') || (controllerName=='industry' && actionName=='consulting') || (controllerName=='saleLeads' && actionName=='dataAbility') || (controllerName=='solution' && actionName=='paimai')>current</#if>">
<a>房产大数据</a>
<a>在线估值</a>
<div class="dn" style="width:130px;padding-left: 10px;">
<ul>
<li><a href="${cityUrl}/zoushi">全国房价查询</a></li>
<li><a href="${cityUrl}/gujia">在线房产估值</a></li>
<li><a href="${cityUrl}/zoushi">房价查询</a></li>
<li><a href="${cityUrl}/gujia">房产估值</a></li>
<#-- <li><a href="${cityUrl}/data/power">数据能力</a></li>-->
<#-- <li><a href="${cityUrl}/solution/paimai">法拍房</a></li>-->
<#-- <li><a href="${cityUrl}/industry/consulting">咨询研究</a></li>-->
@@ -0,0 +1,128 @@
<input type="hidden" id="city_map">
<input type="hidden" id="lat_map">
<input type="hidden" id="lng_map">
<input type="hidden" id="address_map">
<input type="hidden" id="avgPrice_map">
<div class="topic" id="mapDiv">
<div class="topic_top"><i></i>小区周边配套<a class="panorama">
<#-- <label id="qj">全景</label>-->
</a></div>
<div class="topic_bottom" style="position:relative;">
<div class="districtMap" id="districtMap"></div>
<div class="districtBox">
</div>
</div>
</div>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=0a7eM0lkIvpKGPiq1bMCfeH7"></script>
<script type="text/javascript" src="//api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js"></script>
<script src="${staticUrl}/js/fangjia/v5/district-map.js"></script>
<script>
$("#city_map").val(cityStr);
$(".topic_top span").text(districtStr);
$(".topic_top span").css({"font-size": "18px"});
var lat = 0;
var lng = 0;
$(document).ready(function(){
loadLatAndLng(cityStr, regionStr, districtStr);
})
/* 配套内容切换 */
$(".aroundMenu li").click(function(){
var a=$(".aroundMenu li");
var x;
for(var i=0;i<a.length;i++){
if(a[i]==this){
x=i;
break;
}
}
$(".aroundMenu li").removeClass("current");
$(".aroundMenu li").eq(x).addClass("current");
$(".aroundBox .around").hide();
$(".aroundBox .around").eq(x).show();
})
function loadLatAndLng(cityStr, regionStr, districtStr){
if (typeof lat2 != "undefined" && lat2) {
$("#address_map").val(address2);
$("#lat_map").val(lat2);
lat = lat2;
$("#lng_map").val(lng2);
lng = lng2;
initMapConfig();
mapConfig.init();
}else{
$.ajax({
type: "GET",
url:"${cityUrl}/houseReport/loadDistrictLocation",
dataType:'json',
async: false,
data:{
cityName: cityStr,
region: regionStr,
districtName: districtStr
},
success: function(data) {
if(data.address){
$("#address_map").val(data.address);
}
if(data.avg_price){
$("#avgPrice_map").val(data.avg_price);
}
if(data.lat){
$("#lat_map").val(data.lat);
lat = data.lat;
}
if(data.lng){
$("#lng_map").val(data.lng);
lng = data.lng;
}
if(lat!=0){
initMapConfig();
mapConfig.init();
}else{
$("#mapDiv").hide();
}
}
});
}
}
$(".panorama").click(function(e){
var s = $("#qj").text();
$("#qj").text("退出全景");
if(s == "退出全景"){
window.location.reload();
}else{
var panorama = new BMap.Panorama('districtMap');
panorama.setPosition(new BMap.Point(lng, lat));
panorama.addEventListener('position_changed', function(e){ // 全景位置改变事件
panoramaCallBack(e);
});
panorama.addEventListener('pov_changed', function(e){ // 全景视角改变事件
panoramaCallBack(e);
});
function panoramaCallBack(e){ // 事件回调函数
if (e.type == 'onpov_changed') {
document.getElementById('svInfoText').innerHTML="全景视角为:<br/>"+"水平视角:"+panorama.getPov().heading+"<br/>垂直视角:"+panorama.getPov().pitch;
}
else if (e.type=='onposition_changed') {
document.getElementById('svInfoText').innerHTML="全景位置点为:"+panorama.getPosition().lng+","+panorama.getPosition().lat;
}
}
}
})
</script>
@@ -3,7 +3,8 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<meta name="baidu-site-verification" content="codeva-tQ1XnRBEAd" />
<meta name="baidu-site-verification" content="codeva-ps90FaNiSm" />
<#-- <meta name="baidu-site-verification" content="codeva-tQ1XnRBEAd" />-->
<title>选择房价网-为金融机构解决地址标准化难题_治理率高达90% - 房价网 fangjia.com</title>
<meta name="keywords" content="房价网,上海估家网络,估家科技,房产评估,房产估价,房产大数据">
<meta name="description" content="房价网自有地址数据库丰富,涵盖全国367个城市地区90万个楼盘,8000万POI数据">
@@ -47,14 +48,7 @@
<#-- </div>-->
<#--</div>-->
<<<<<<< HEAD
<#--fixedNav01-->
=======
<#--<div class="advert mobile01">-->
<#-- <a id="close">关闭</a>-->
<#-- <div class="left-ad"></div>-->
<#--</div>-->
>>>>>>> c7c2bae298951f01848f2b654c4c5e7fdba454c0
<div class="bannerIndex mobile01">
<div class="imgBoxIndex">
@@ -971,7 +965,7 @@
</div>
</div>
<a href="${cityUrl}/district/hidelist" style="display: none;"></a>
<#include "/header/v6/_footer.ftl"/>
@@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>银行洞察客户、网点布局、业务营销_选房价网 - 房价网 fangjia.com</title>
<meta name="keywords" content="信用卡拓客,银行高净值客户,银行网点布局,银行网点选址,银行业务营销,社区银行">
<meta name="keywords" content="信用卡拓客,银行高净值客户,银行网点布局,银行网点选址,银行业务营销,在线估值,智能评估">
<meta name="description" content="房价网_国有大行的选择,客户地址标准化,洞察高净值客户,银行网点选址,业务营销解决方案">
<#include "../jsconstants.ftl" />
@@ -21,4 +21,5 @@ var Constants = {
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
</#if>
<#include "baidu_analysis.ftl" />
@@ -72,7 +72,7 @@
<div class="p1_icon_base p1_01">
<div class="p1_div_v1"><span class="p1_txt">结合业务定制</span>
<span class="p2_txt">解决方案</span></div>
<div class="p2_div_v1">赋能不通场景与业务,个性化定制行业解决方案,为企业地址应用场景助力</div>
<div class="p2_div_v1">赋能不同场景与业务,个性化定制行业解决方案,为企业地址应用场景助力</div>
</div>
</div>
</div>
@@ -18,8 +18,8 @@
<#assign _currentCityDisplay>${cityName}</#assign>
</#if>
<#assign PAGE_TITLE>${affectValue}房价走势 - 房价网 fangjia.com</#assign>
<#assign PAGE_KEYWORDS>${affectValue}房价走势,${affectValue}房产数据,${affectValue}房价</#assign>
<#assign PAGE_TITLE>${affectValue}房价走势 - ${cityName}房产网 fangjia.com</#assign>
<#assign PAGE_KEYWORDS>${affectValue}房价走势,${affectValue}房产数据,${affectValue}房价,二手房均价查询,楼盘估值,在线评估</#assign>
<#assign headDesc>房价网提供${affectValue}及时、权威的房价走势图,免费查询最新季度房价、最近半年房价走势、去年同期房价走势、以及${affectValue}房价历史走势等信息。</#assign>
<#assign PAGE_DESCRIPTION>${headDesc}</#assign>
@@ -52,18 +52,18 @@
<div id="title" class="dn">${affectValue}</div>
<div class="bannerIndex mobile01">
<div class="imgBoxIndex">
<div class="bannerIndex01">
<div style="text-align: left;margin-left: 50%;margin-right: 10%">
<p><label>全国房价在线查询</label></p>
<div class="btnGroup" align="left" style="float: left">
<center><a id="a1" class="link_btn1 link01_btn text20" data_id="1039" cat="solution">申请试用</a></center>
</div>
</div>
</div>
</div>
</div>
<#--<div class="bannerIndex mobile01">-->
<#-- <div class="imgBoxIndex">-->
<#-- <div class="bannerIndex01">-->
<#-- <div style="text-align: left;margin-left: 50%;margin-right: 10%">-->
<#-- <p><label>全国房价在线查询</label></p>-->
<#-- <div class="btnGroup" align="left" style="float: left">-->
<#-- <center><a id="a1" class="link_btn1 link01_btn text20" data_id="1039" cat="solution">申请试用</a></center>-->
<#-- </div>-->
<#-- </div>-->
<#-- </div>-->
<#-- </div>-->
<#--</div>-->
<div class="bannerIndex mobile02">
<div class="imgBoxIndex">
@@ -80,7 +80,7 @@
<div class="index_bg01 mobile01">
<div class="index-box01"><p>房价网自2006年起累计在线估值次数</p></div>
<div class="index-box01"><div class="evalCount_div"><p><label id="evalCount">262,000,000</label><i style="font-style: normal;">&nbsp;&nbsp;次</i></p></div><div class="icon_01 dn"></div></div>
<div class="index-box01"><div class="evalCount_div"><p><label id="evalCount"></label><i style="font-style: normal;">&nbsp;&nbsp;次</i></p></div><div class="icon_01 dn"></div></div>
<div class="index-box01"><p>房产数据覆盖全国367个城市地区、80万楼盘、8000万房号库、70万楼盘字段、5000万POI数据。</p></div>
</div>
@@ -362,7 +362,7 @@
let animateFrame; // 清除 requestAnimationFrame 请求动画帧
// 数字动画
function digitalAnimation() {
startNum += 6658; // 速度的计算可以为小数 。数字越大,滚动越快
startNum += 68; // 速度的计算可以为小数 。数字越大,滚动越快
if(maxNum > 0){
if (startNum >= maxNum) {
startNum = maxNum;
@@ -389,10 +389,12 @@
timeout: 100000,
success: function(model) {
// $("#evalCount").text(toThousands(model.evalCount));
var startNum = document.getElementById("evalCount").innerHTML;
// var startNum = document.getElementById("evalCount").innerHTML;
var startNum = toThousands(model.evalCount - 10000)
if (startNum == ''){
$("#evalCount").text(toThousands(model.evalCount));
}else{
$("#evalCount").text(startNum);
numScroll(startNum,model.evalCount);
}
},
@@ -406,10 +408,10 @@
const month = now.getMonth() + 1; // 月
let divElement = document.getElementById("date");
divElement.innerHTML = "<span>"+year+"年"+month+"月"+"</span>";
$("#date").html("<span>"+year+"年"+month+"月"+"</span>")
let divElement2 = document.getElementById("date2");
divElement2.innerHTML = "<span>"+year+"年"+month+"月"+"</span>";
$("#date2").html("<span>"+year+"年"+month+"月"+"</span>")
$(function(){
$('.td04').each(function(i){
@@ -28,7 +28,7 @@
.main{width:768px;padding-top:0;}
.main_left{width:768px;height: 650px;}
.main_left div{padding-top: 140px;margin-left:30px;}
.main_left div p{text-align: left;}
.main_left div p{text-align: left; margin-top: 20px;}
.main_left div p label{font-size: 42px;letter-spacing: 0px;}
.main_left div p span{font-size: 30px;}
.main_left div p small{display: none;}
@@ -38,10 +38,10 @@
@media(max-device-width:414px){
.main_left{background:url(${staticUrl}/images/fangjia/v6/login-1.jpg);background-size: 100% 100%;background-repeat: no-repeat;background-position: center;}
.main{width:414px;}
.main_left{width:414px;height: 450px;}
.main_left{width:414px;height: 200px;}
.main_right{width:414px;height: 560px;}
.main_left div {margin-left: 10px;margin-right: 70px;padding-top: 20px;}
.main_left div p label{font-size: 42px;letter-spacing: 0px;}
.main_left div p label{font-size: 22px;letter-spacing: 0px;}
.main_left div p span {font-size: 27px;}
.user00{width: 350px;height: 400px;margin-top: 30px;}
.inputInfo {margin-bottom: 20px;}
@@ -74,6 +74,7 @@
}
.error {top: -20px;left: 106px;}
.main_left div {margin-top: 50px;}
</style>
</head>
@@ -62,12 +62,12 @@
<script src="${staticUrl}/js/fangjia/v5/main.js?v=${version}"></script>
<script>
var backUrl = "${backUrl!}";
if(backUrl==""){
setTimeout("location.href='${wwwUrl}';", 2000);
}else{
setTimeout("location.href='${backUrl!}';", 2000);
}
<#--var backUrl = "${backUrl!}";-->
<#--if(backUrl==""){-->
<#-- setTimeout("location.href='${wwwUrl}';", 2000);-->
<#--}else{-->
<#-- setTimeout("location.href='${backUrl!}';", 2000);-->
<#--}-->
</script>
</body>
@@ -12,11 +12,11 @@
<link href="${staticUrl}/style/fangjia/v6/login.css?v=${version}" rel="stylesheet">
<script src="${staticUrl}/js/fangjia/v5/jquery-1.7.2.min.js?v=${version}"></script>
<script>
if((navigator.userAgent.match(/(iPad|iPhone|iPod|Android|ios)/i))){
document.write("<link href='${staticUrl}/style/fangjia/v5/mobile.css?v=${version}' rel='stylesheet'>");
}
</script>
<script>
if((navigator.userAgent.match(/(iPad|iPhone|iPod|Android|ios)/i))){
document.write("<link href='${staticUrl}/style/fangjia/v6/mobile.css?v=${version}' rel='stylesheet'>");
}
</script>
<style>
@media(max-device-width:768px){
@@ -32,24 +32,54 @@
.user_btn,.line{width:100%;}
.footerM{display:none;}
}
@media(max-device-width:414px){
.inpu{width:78%;}
.inpu01{width:45%;}
.main{width:414px;}
.main_left{width:414px;height: 450px;}
.main_right{width:414px;height: 560px;}
.main_left div {margin-left: 10px;margin-right: 70px;padding-top: 20px;}
.main_left div p label{font-size: 42px;letter-spacing: 0px;}
.main_left div p span {font-size: 27px;}
.user00{width: 350px;height: 400px;margin-top: 65px;}
.inputInfo {margin-bottom: 20px;}
.inpu {width: 250px;}
.inpu01 {width: 120px;}
.login_user_btn {width: 350px;}
.line {width: 350px;}
.user00 .tab li {font-size: 20px;}
.login_ls2_01 {font-size: 16px;letter-spacing: 20px;}
.login_ls2_02, .login_ls3_02 {font-size: 16px;}
.login_ls3_01 {font-size: 16px;letter-spacing: 2px;}
.codeImg {width: 70px;margin-left: 10px;}
.mb_pwd_inp{width: 245px;}
}
@media(max-device-width:390px) {
.main{width:390px;}
.main_left{width:390px;}
.main_right{width:390px;}
}
@media(max-device-width:375px){
.inpu{width:78%;}
.inpu01{width:40%;}
.main{width:375px;}
.main_left{width:375px;}
.main_right{width:375px;}
.main_left div {margin-right: 60px;}
}
@media(max-device-width:360px){
.inpu{width:76%;}
.inpu01{width:40%;}
.main{width:360px;}
.main_left{width:360px;}
.main_right{width:360px;}
.main_left div {margin-right: 40px;}
}
@media(max-device-width:320px){
.inpu{width:73%;}
.inpu01{width:30%;}
.inputInfo label {
line-height: 40px;
float: left;
margin-right: 20px;
}
.mb_tab{margin: 0 80px; }
.error {top: -15px; }
</style>
</head>
@@ -69,7 +99,7 @@
<div class="main_right">
<div class="user00">
<ul class="tab">
<li class="tab03" style="width: 586px;">欢迎注册房价网</li>
<li class="tab03 mb_tab">欢迎注册房价网</li>
</ul>
<div class="content">
<div class="inputInfoBox">
@@ -99,7 +129,7 @@
</div>
<div class="inputInfo">
<label><a class="login_ls2_02">确认密码</a></label>
<input class="inpu input_password_repeat" type="password" autocomplete="off" placeholder="请输入密码" style="margin-left: -10px;">
<input class="inpu input_password_repeat mb_pwd_inp" type="password" autocomplete="off" placeholder="请输入密码" style="margin-left: -10px;">
<div class="error dn reppass_err"><i></i>两次密码不一致</div>
</div>
</div>
@@ -110,11 +140,13 @@
<span>我已阅读并接受<a href="${wwwUrl}/terms/agreement" target="_blank">《用户协议》</a></span>
</div>
</div>
<a class="login_user_btn confirm_btn">注册</a>
<div class="line" style="width: 586px;"><span>或</span></div>
<p class="link">已有账户?请直接<a href="${wwwUrl}/user/login">登录</a></p>
<p class="note">若有任何问题,请致电客服:400-188-3787</p>
</div>
<a class="login_user_btn confirm_btn">注册</a>
<div class="line" style="width: 586px;"><span>或</span></div>
<p class="link">已有账户?请直接<a href="${wwwUrl}/user/login">登录</a></p>
<p class="note">若有任何问题,请致电客服:400-188-3787</p>
</div>
</div>
</div>
@@ -32,6 +32,12 @@ public class SeawaterQuery {
private Pager pager;
private String editEstateType;
private Double lat;
private Double lng;
private Integer radius;
public String getId() {
return id;
}
@@ -239,4 +245,28 @@ public class SeawaterQuery {
public void setEditEstateType(String editEstateType) {
this.editEstateType = editEstateType;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = lng;
}
public Integer getRadius() {
return radius;
}
public void setRadius(Integer radius) {
this.radius = radius;
}
}
@@ -38,6 +38,8 @@ public class RentHouse extends BaseHouse implements DatastoreEntity {
private String block;
private Integer totalPrice;
private Integer totalPriceRange;
private Integer avgPrice;
/**
* 出租类型
*/
@@ -760,4 +762,14 @@ public class RentHouse extends BaseHouse implements DatastoreEntity {
this.houseRequire = houseRequire;
}
@Transient
@Column(name = "avg_price")
public Integer getAvgPrice() {
return avgPrice;
}
public void setAvgPrice(Integer avgPrice) {
this.avgPrice = avgPrice;
}
}
@@ -0,0 +1,9 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.model.ApiCountLog;
import com.fangjia.dal.mongo.model.DevelopmentZone;
public interface ApiCountLogDao extends MongoDao<ApiCountLog> {
}
@@ -0,0 +1,9 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.model.ApiCountLog;
import com.fangjia.dal.mongo.model.DevelopmentZone;
public class ApiCountLogDaoImpl extends MongoDaoImpl<ApiCountLog> implements ApiCountLogDao {
}
@@ -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<PropertyStatsIndex> {
}
@@ -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<PropertyStatsIndex> implements PropertyStatsIndexDao {
}
@@ -0,0 +1,9 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.model.DevelopmentZone;
import com.fangjia.dal.mongo.model.SeaweedImages;
public interface SeaweedImagesDao extends MongoDao<SeaweedImages> {
}
@@ -0,0 +1,7 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.model.SeaweedImages;
public class SeaweedImagesDaoImpl extends MongoDaoImpl<SeaweedImages> implements SeaweedImagesDao{
}
@@ -0,0 +1,127 @@
package com.fangjia.dal.mongo.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Entity
@Table(name = "business.api_count_log")
public class ApiCountLog implements MongoEntity {
private String id;
private Long userId;
private String userName;
private String uri;
private String uriName;
private String operate;
private String operator;
private Date operateTime;
// 修改次数前总次数
private Integer oldCount;
// 修改次数后的次数
private Integer newCount;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "_id")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Column(name = "user_id")
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@Column(name = "uri")
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
@Column(name = "uri_name")
public String getUriName() {
return uriName;
}
public void setUriName(String uriName) {
this.uriName = uriName;
}
@Column(name = "operate")
public String getOperate() {
return operate;
}
public void setOperate(String operate) {
this.operate = operate;
}
@Column(name = "operator")
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
@Column(name = "operate_time")
public Date getOperateTime() {
return operateTime;
}
public void setOperateTime(Date operateTime) {
this.operateTime = operateTime;
}
@Column(name = "old_count")
public Integer getOldCount() {
return oldCount;
}
public void setOldCount(Integer oldCount) {
this.oldCount = oldCount;
}
@Column(name = "new_count")
public Integer getNewCount() {
return newCount;
}
public void setNewCount(Integer newCount) {
this.newCount = newCount;
}
@Column(name = "user_name")
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
@@ -38,6 +38,10 @@ public class DevelopmentZone implements MongoEntity {
//Ôö¼Ó±ðÃû×ÖÎ
private List<String> alias;
private String imgUrl;
private String operateResult;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "_id")
@@ -216,4 +220,22 @@ public class DevelopmentZone implements MongoEntity {
public void setAlias(List<String> alias) {
this.alias = alias;
}
@Column(name = "img_url")
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
@Column(name = "operate_result")
public String getOperateResult() {
return operateResult;
}
public void setOperateResult(String operateResult) {
this.operateResult = operateResult;
}
}
@@ -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 Integer 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 Integer getYearmonth() {
return yearmonth;
}
public void setYearmonth(Integer 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;
}
}
@@ -0,0 +1,90 @@
package com.fangjia.dal.mongo.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Entity
@Table(name = "fangjia_base.seaweed_images")
public class SeaweedImages implements MongoEntity {
private static final long serialVersionUID = 4356189537384834754L;
private String id;
private String city;
private String district;
private Map<String, List<String>> floorplanPics;
private Date mDate;
private String name;
private List<String> outPics;
@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 = "floorplan_pics")
public Map<String, List<String>> getFloorplanPics() {
return floorplanPics;
}
public void setFloorplanPics(Map<String, List<String>> floorplanPics) {
this.floorplanPics = floorplanPics;
}
@Column(name = "m_date")
public Date getmDate() {
return mDate;
}
public void setmDate(Date mDate) {
this.mDate = mDate;
}
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "out_pics")
public List<String> getOutPics() {
return outPics;
}
public void setOutPics(List<String> outPics) {
this.outPics = outPics;
}
}
@@ -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,19 +24,24 @@ public class StatsIndex implements MongoEntity{
private String id;
private String city;
private String district;
private String yearmonth;
private Integer yearmonth;
private Integer source;
private String remark;
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() {
@@ -91,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;
}
@@ -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,67 @@ 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;
}
@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;
}
}
@@ -36,6 +36,10 @@ public class OpenResource implements MongoEntity {
private Boolean saveResult;
private int pubStatus;
private int apiCode;
@Id
@GeneratedValue
@Column(name = "_id")
@@ -115,4 +119,22 @@ public class OpenResource implements MongoEntity {
public void setSaveResult(Boolean saveResult) {
this.saveResult = saveResult;
}
@Column(name = "pub_status")
public int getPubStatus() {
return pubStatus;
}
public void setPubStatus(int pubStatus) {
this.pubStatus = pubStatus;
}
@Column(name = "api_code")
public int getApiCode() {
return apiCode;
}
public void setApiCode(int apiCode) {
this.apiCode = apiCode;
}
}
File diff suppressed because it is too large Load Diff
@@ -6,6 +6,7 @@ import javax.persistence.*;
import com.fangjia.dal.DatastoreCategory;
import com.fangjia.dal.SeawaterEntity;
import com.fasterxml.jackson.annotation.JsonInclude;
@Entity
@Table(name = "fangjia.seawater")
@@ -35,9 +36,11 @@ public class Seawater implements SeawaterEntity {
private String id;
private String category;
private int status;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private Integer status;
private String city;
private String region;
private String district;
private String districtName;
private String address;
private Date modificationDate;
@@ -46,8 +49,10 @@ public class Seawater implements SeawaterEntity {
private String block;
private Integer totalPrice;
private Double area;
private Double size;
private Integer height;
private Integer floor;
private Integer maxFloor;
private String floorInfo;
private String fitment;
private Integer room;
@@ -55,10 +60,13 @@ public class Seawater implements SeawaterEntity {
private Integer toilet;
private String mobile;
private Integer pDate;
private String publishDate;
private Integer userId;
private String url;
private String root;
private Integer avgPrice;
private Integer unitPrice;
private String purpose;
private String estateType;
private String buildType;
@@ -70,6 +78,26 @@ public class Seawater implements SeawaterEntity {
private String housingAge; //房屋年限 满二年
private String elevator; //配备电梯 有/无
private String decoration;
private Integer distance;
private String location;
private String title;
// ÉÌÆÌ¾­Óª·Î§
private String businessScope;
private String businessRange;
//ÉÌÆÌÀàÐÍ
private String shopType;
// д×ÖÂ¥µÈ¼
private String level;
@Id
@Column(name = "_id")
public String getId() {
@@ -90,11 +118,11 @@ public class Seawater implements SeawaterEntity {
}
@Column(name = "status")
public int getStatus() {
public Integer getStatus() {
return status;
}
public void setStatus(int status) {
public void setStatus(Integer status) {
this.status = status;
}
@@ -206,7 +234,7 @@ public class Seawater implements SeawaterEntity {
this.floor = floor;
}
@Column(name = "floorInfo")
@Column(name = "floor_info")
public String getFloorInfo() {
return floorInfo;
}
@@ -395,4 +423,110 @@ public class Seawater implements SeawaterEntity {
public void setElevator(String elevator) {
this.elevator = elevator;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public Double getSize() {
return size;
}
public void setSize(Double size) {
this.size = size;
}
public Integer getMaxFloor() {
return maxFloor;
}
public void setMaxFloor(Integer maxFloor) {
this.maxFloor = maxFloor;
}
public Integer getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Integer unitPrice) {
this.unitPrice = unitPrice;
}
public String getPublishDate() {
return publishDate;
}
public void setPublishDate(String publishDate) {
this.publishDate = publishDate;
}
public String getDecoration() {
return decoration;
}
public void setDecoration(String decoration) {
this.decoration = decoration;
}
public Integer getDistance() {
return distance;
}
public void setDistance(Integer distance) {
this.distance = distance;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBusinessScope() {
return businessScope;
}
public void setBusinessScope(String businessScope) {
this.businessScope = businessScope;
}
public String getShopType() {
return shopType;
}
public void setShopType(String shopType) {
this.shopType = shopType;
}
@Column(name = "level")
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
@Column(name = "business_range")
public String getBusinessRange() {
return businessRange;
}
public void setBusinessRange(String businessRange) {
this.businessRange = businessRange;
}
}
@@ -24,6 +24,8 @@ public class Seaweed implements SeaweedEntity {
private List<String> alias;
private List<String> addrAlias;
private double score;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "_id")
@@ -134,4 +136,13 @@ public class Seaweed implements SeaweedEntity {
public void setEstateType2(String estateType2) {
this.estateType2 = estateType2;
}
@Transient
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
}
@@ -28,6 +28,10 @@ public class ApiUser implements SqlEntity {
private String company;
private int isTest; //0-正式客戶 1-测试用户 2-内部测试用户
private Date deadTime;
private String contact; //ÁªÏµÈË
private String phone; //ÁªÏµÈËÊÖ»úºÅ
/**
* 账户用途
* 1:Open APi
@@ -41,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() {
@@ -185,4 +195,49 @@ public class ApiUser implements SqlEntity {
public void setIsMonitor(Integer isMonitor) {
this.isMonitor = isMonitor;
}
@Column(name = "CUSTOMER_CONTACT")
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
@Column(name = "CUSTOMER_CONTACT_MOBILE")
public String getPhone() {
return phone;
}
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;
}
}
@@ -92,6 +92,8 @@ public class FjtEvaluation implements SqlEntity{
private String contact;
private String reportNum;
private Double carSiteArea;
private Integer carSitePrice; // 车位价
private String source;
private String accountChecker;
private String floorDesc; //±ðÊûÂ¥²ãÃèÊö
@@ -783,6 +785,15 @@ public class FjtEvaluation implements SqlEntity{
this.loan = loan;
}
@Column(name = "car_site_price")
public Integer getCarSitePrice() {
return carSitePrice;
}
public void setCarSitePrice(Integer carSitePrice) {
this.carSitePrice = carSitePrice;
}
@Override
public String toString() {
return "FjtEvaluation{" +
@@ -8,7 +8,8 @@ public enum HttpStatusCodeEnum {
BAD_REQUEST_DECRYPT_ERROR(4002,"加密参数解密失败"),
UN_AUTHORIZED(401,"请求未被授权"),
SERVER_ERROR(500,"服务器内部错误"),
SERVER_FORBID(403,"ÇëÇ󯵷±");
SERVER_FORBID(403,"请求频繁"),
UPGRADE(503,"服务升级中");
private final int code;
private final String msg;
@@ -1,10 +1,13 @@
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.APIConstant;
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 +15,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;
@@ -20,6 +23,7 @@ import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
@@ -38,13 +42,9 @@ 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.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 地址治理
@@ -78,14 +78,17 @@ public class AddrSvcController {
Map<String, String> params = new HashMap<String, String>();
params.put("city", model.getCity());
params.put("address", model.getAddress());
params.put("addressAssessment", "true");
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure/v2", params, "UTF-8");
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/formatNinelevel", params, "UTF-8");
if (json != null) {
int code = json.getInt("status");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
BasicModel basicModel = new BasicModel(code == 0 ? 200 : 0, msg);
if (json.containsKey("result")) {
basicModel.setResult(CommonDtoUtils.transformV(StructureDto.class, json.get("result")));
JSONObject result = json.getJSONObject("result");
result.remove("formatAddress");
basicModel.setResult(result);
}
mav.setModel(basicModel);
} else {
@@ -118,13 +121,27 @@ public class AddrSvcController {
params.put("city", model.getCity());
params.put("address", model.getAddress());
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure/v2", params, "UTF-8");
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/villageIdentify", params, "UTF-8");
if (json != null) {
int code = json.getInt("status");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
BasicModel basicModel = new BasicModel(code == 0 ? 200 : 0, msg);
if (json.containsKey("result")) {
basicModel.setResult(CommonDtoUtils.transformV(DistrictIdentifyDto.class, json.get("result")));
DistrictIdentifyDto districtIdentifyDto = CommonDtoUtils.transformV(DistrictIdentifyDto.class, json.get("result"));
JSONObject result = json.getJSONObject("result");
if (result.containsKey("town")) {
districtIdentifyDto.setTownship(result.getString("town"));
}
if (result.containsKey("townCode")) {
districtIdentifyDto.setTownshipCode(result.getString("townCode"));
}
if (result.containsKey("committee")) {
districtIdentifyDto.setCommunity(result.getString("committee"));
}
if (result.containsKey("committeeCode")) {
districtIdentifyDto.setCommunityCode(result.getString("committeeCode"));
}
basicModel.setResult(districtIdentifyDto);
}
mav.setModel(basicModel);
} else {
@@ -158,7 +175,7 @@ public class AddrSvcController {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", params, "UTF-8");
if (json != null) {
int code = json.getInt("status");
int code = json.getInt("status") == 0 ? 200 : 0;
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
@@ -234,6 +251,10 @@ 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) {
// 非超级用户不返回置信度
if (json.containsKey("credit") && !APIConstant.SUPER_USER_TOKEN.equals(model.getToken())) {
json.remove("credit");
}
basicModel.setResult(CommonDtoUtils.transformV(MatchedBuildingDto.class, json));
}
mav.setModel(basicModel);
@@ -252,10 +273,11 @@ public class AddrSvcController {
public Object suggestionAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getCity())) {
mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
return mav;
}
// 城市改为非必填
// if (StringUtils.isBlank(model.getCity())) {
// mav.setModel(BasicModel.buildBadRequestModel("城市不能为空"));
// return mav;
// }
if (StringUtils.isBlank(model.getKeywords())) {
mav.setModel(BasicModel.buildBadRequestModel("关键字不能为空"));
return mav;
@@ -265,20 +287,60 @@ public class AddrSvcController {
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", model.getCity());
params.put("region", model.getRegion());
params.put("district", model.getDistrict());
params.put("keywords", model.getKeywords());
params.put("page", "0");
params.put("size", String.valueOf(model.getMax() == 0 ? 20 : (model.getMax() > 100 ? 100 : model.getMax())));
params.put("offset", String.valueOf(model.getMax() == 0 ? 10 : (model.getMax() > 100 ? 100 : model.getMax())));
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/addressAssociation2", params, "UTF-8");
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/v2/addressAssociation", params, "UTF-8");
if (json != null) {
int code = json.getInt("status");
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
JSONObject result = (JSONObject.fromObject(json.get("result")));
if (result.getInt("totalElements") > 0) {
basicModel.setResult(CommonDtoUtils.transformListV(DistrictDto.class, result.getJSONArray("content")));
JSONArray jsonArray = json.getJSONArray("result");
if (jsonArray.size() > 0) {
basicModel.setResult(CommonDtoUtils.transformListV(DistrictDto.class, jsonArray));
}
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
} catch (Exception e) {
e.printStackTrace();
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* 地址联想
*/
public Object tipsAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getKeywords())) {
mav.setModel(BasicModel.buildBadRequestModel("搜索关键字不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("keywords", model.getKeywords());
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : "");
params.put("max", model.getMax() != 0 ? String.valueOf(model.getMax()) : "");
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/tips", params, "UTF-8");
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
JSONArray jsonArray = json.getJSONArray("result");
if (jsonArray.size() > 0) {
basicModel.setResult(jsonArray);
}
}
mav.setModel(basicModel);
@@ -312,18 +374,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);
@@ -446,7 +516,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 对共
@@ -513,7 +583,7 @@ public class AddrSvcController {
if (map.get("city").endsWith("区")) {
return "否";
}
if (map.get("city").equals("东莞市") || map.get("city").equals("嘉峪关市") || map.get("city").equals("中山市") || map.get("city").equals("儋州市") ) {
if (map.get("city").equals("东莞市") || map.get("city").equals("嘉峪关市") || map.get("city").equals("中山市") || map.get("city").equals("儋州市")) {
return "否";
}
return "是";
@@ -526,7 +596,7 @@ public class AddrSvcController {
* @return
*/
public String addrArea(Map<String, String> map, String type) {
if (map.get("verifyFlag") == null ) {
if (map.get("verifyFlag") == null) {
return "";
}
if (map.get("verifyFlag").equals("非农")) {
@@ -645,6 +715,362 @@ public class AddrSvcController {
return mav;
}
/**
* 对公涉农识别-新规则-上海银行
*
* @param model
* @return
*/
public Object boscEnterpriseVillageIdentifyAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress())) {
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
String address = model.getAddress();
params.put("address", address);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/boscEnterpriseVillageIdentify", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/boscEnterpriseVillageIdentify", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
if (json.containsKey("result")) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
HashMap<String, String> map = new LinkedHashMap<String, String>();
//我们的结果
// "province": "江苏省",
// "city": "苏州市",
// "district": "昆山市",
// "town": "玉山镇",
// "committee": "南星渎村委会",
// "provinceCode": "320000000000",
// "cityCode": "320500000000",
// "districtCode": "320583000000",
// "townCode": "320583100000",
// "committeeCode": "320583100222",
// "typeCode": "220",
// "typeName": "村庄",
// "verifyFlag": "非农",
// "addrVerify": "地址有效",
// "countyLevelCity": "是",
// "administrativeTowns": "否",
// "countyGov": "否",
// "devDistrict": "是",
// "devDistrictName": "昆山高新技术产业开发区",
// "devLevel": "国家级",
// "addrArea": "开发区",
// "countyGovTown": "昆山开发区"
JSONObject result = json.getJSONObject("result");
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("city")) {
map.put("city", result.getString("city"));
}
if (result.containsKey("district")) {
map.put("district", result.getString("district"));
}
if (result.containsKey("town")) {
map.put("town", result.getString("town"));
}
if (result.containsKey("committee")) {
map.put("committee", result.getString("committee"));
}
if (result.containsKey("provinceCode")) {
map.put("provinceCode", result.getString("provinceCode"));
}
if (result.containsKey("cityCode")) {
map.put("cityCode", result.getString("cityCode"));
}
if (result.containsKey("districtCode")) {
map.put("districtCode", result.getString("districtCode"));
}
if (result.containsKey("townCode")) {
map.put("townCode", result.getString("townCode"));
}
if (result.containsKey("committeeCode")) {
map.put("committeeCode", result.getString("committeeCode"));
}
if (result.containsKey("typeCode")) {
map.put("typeCode", result.getString("typeCode"));
}
if (result.containsKey("typeName")) {
map.put("typeName", result.getString("typeName"));
}
if (result.containsKey("verifyFlag")) {
map.put("verifyFlag", result.getString("verifyFlag"));
}
if (result.containsKey("addrVerify")) {
map.put("addrVerify", result.getString("addrVerify"));
}
if (result.containsKey("countyLevelCity")) {
map.put("countyLevelCity", result.getString("countyLevelCity"));
}
if (result.containsKey("administrativeTowns")) {
map.put("administrativeTowns", result.getString("administrativeTowns"));
}
if (result.containsKey("countyGov")) {
map.put("countyGov", result.getString("countyGov"));
}
if (result.containsKey("devDistrict")) {
map.put("devDistrict", result.getString("devDistrict"));
}
if (result.containsKey("devLevel")) {
map.put("devLevel", result.getString("devLevel"));
}
if (result.containsKey("addrArea")) {
map.put("addrArea", result.getString("addrArea"));
}
if (result.containsKey("devDistrictName")) {
map.put("devDistrictName", result.getString("devDistrictName"));
}
if (result.containsKey("countyGovTown")) {
map.put("countyGovTown", result.getString("countyGovTown"));
}
basicModel.setResult(map);
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
}
return mav;
}
/**
* 对私涉农识别
*/
public Object residentialVillageIdentifyAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress())) {
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
String address = model.getAddress();
params.put("address", address);
String type = StringUtils.isNotBlank(model.getType()) ? model.getType() : null;
// 对公
model.setType("1");
String villageType = "2".equals(model.getType()) ? "对公" : "对私";
params.put("type", type);
params.put("showFullValue", "2");
Pager pager = new Pager(1, 1);
List<VillageIdentify> villageIdentifyList = villageIdentifyService.findByCityAndAddress(villageType, model.getCity(), model.getAddress(), pager);
VillageIdentify villageResult = CollectionUtils.isNotEmpty(villageIdentifyList) ? villageIdentifyList.get(0) : null;
if (villageResult != null && StringUtils.isNotBlank(villageResult.getVerifyFlag())) {
Map<String, String> resultMap = new HashMap<String, String>();
resultMap.put("province", villageResult.getProvince());
resultMap.put("city", villageResult.getCity1());
resultMap.put("district", villageResult.getDistrict());
resultMap.put("town", villageResult.getTown());
resultMap.put("committee", villageResult.getCommittee());
resultMap.put("provinceCode", villageResult.getCityCode());
resultMap.put("cityCode", villageResult.getCityCode());
resultMap.put("districtCode", villageResult.getDistrictCode());
resultMap.put("townCode", villageResult.getTownCode());
resultMap.put("committeeCode", villageResult.getCommitteeCode());
resultMap.put("typeCode", villageResult.getTypeCode());
resultMap.put("typeName", villageResult.getTypeName());
resultMap.put("verifyFlag", villageResult.getVerifyFlag());
resultMap.put("addrVerify", villageResult.getAddrVerify());
resultMap.put("countyLevelCity", villageResult.getCountyLevelCity());
resultMap.put("administrativeTowns", villageResult.getAdministrativeTowns());
resultMap.put("countyGov", villageResult.getCountyGov());
resultMap.put("devDistrict", villageResult.getDevDistrict());
resultMap.put("devDistrictName", villageResult.getDevDistrictName());
resultMap.put("devLevel", villageResult.getDevLevel());
resultMap.put("addrArea", villageResult.getAddrArea());
BasicModel basicModel = new BasicModel(200, "OK");
basicModel.setResult(resultMap);
mav.setModel(basicModel);
} else {
// params.put("showTestValue", "2");
Integer radius = model.getRadius();
params.put("radius", (radius != null && radius != 0) ? radius.toString() : null);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/residentialVillageIdentify", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/residentialVillageIdentify", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
//我们的结果
JSONObject result = json.getJSONObject("result");
basicModel.setResult(result);
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
}
return mav;
}
/**
* 对公涉农识别
*/
public Object enterpriseVillageIdentifyAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress())) {
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
String address = model.getAddress();
params.put("address", address);
String type = StringUtils.isNotBlank(model.getType()) ? model.getType() : null;
// 对公
model.setType("2");
String villageType = "2".equals(model.getType()) ? "对公" : "对私";
params.put("type", type);
params.put("showFullValue", "2");
Pager pager = new Pager(1, 1);
List<VillageIdentify> villageIdentifyList = villageIdentifyService.findByCityAndAddress(villageType, model.getCity(), model.getAddress(), pager);
VillageIdentify villageResult = CollectionUtils.isNotEmpty(villageIdentifyList) ? villageIdentifyList.get(0) : null;
if (villageResult != null && StringUtils.isNotBlank(villageResult.getVerifyFlag())) {
Map<String, String> resultMap = new HashMap<String, String>();
resultMap.put("province", villageResult.getProvince());
resultMap.put("city", villageResult.getCity1());
resultMap.put("district", villageResult.getDistrict());
resultMap.put("town", villageResult.getTown());
resultMap.put("committee", villageResult.getCommittee());
resultMap.put("provinceCode", villageResult.getCityCode());
resultMap.put("cityCode", villageResult.getCityCode());
resultMap.put("districtCode", villageResult.getDistrictCode());
resultMap.put("townCode", villageResult.getTownCode());
resultMap.put("committeeCode", villageResult.getCommitteeCode());
resultMap.put("typeCode", villageResult.getTypeCode());
resultMap.put("typeName", villageResult.getTypeName());
resultMap.put("verifyFlag", villageResult.getVerifyFlag());
resultMap.put("addrVerify", villageResult.getAddrVerify());
resultMap.put("countyLevelCity", villageResult.getCountyLevelCity());
resultMap.put("administrativeTowns", villageResult.getAdministrativeTowns());
resultMap.put("countyGov", villageResult.getCountyGov());
resultMap.put("devDistrict", villageResult.getDevDistrict());
resultMap.put("devDistrictName", villageResult.getDevDistrictName());
resultMap.put("devLevel", villageResult.getDevLevel());
resultMap.put("addrArea", villageResult.getAddrArea());
BasicModel basicModel = new BasicModel(200, "OK");
basicModel.setResult(resultMap);
mav.setModel(basicModel);
} else {
// params.put("showTestValue", "2");
Integer radius = model.getRadius();
params.put("radius", (radius != null && radius != 0) ? radius.toString() : null);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/enterpriseVillageIdentify", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/enterpriseVillageIdentify", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
//我们的结果
JSONObject result = json.getJSONObject("result");
//我们省级及以上有开发区,直接用我们的结果
if (result.containsKey("devDistrictName")) {
basicModel.setResult(result);
} else if (!"2".equals(type)) { // 对私的不用齐梁
basicModel.setResult(result);
} else {
try {
//如果是江苏省或者浙江省 调用齐梁的结果
if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) {
//结果比较,如果涉农结果不一致
//调用齐梁 type :1 对公 0 对私
//我们 type :1 对私 2 对共
String qltype = "2".equals(type) ? "1" : "0";
Map<String, String> map = senRequest(address, qltype);
// 涉农结果不一样
if (!map.get("verifyFlag").equals(result.get("verifyFlag"))) {
// 齐梁县政府但是涉农为农,取我们的结果 扬中市三茅街道中华村永固河路1号
if ("是".equals(map.get("countyGov")) && "农".equals(map.get("verifyFlag"))) {
basicModel.setResult(result);
mav.setModel(basicModel);
return mav;
}
//有市辖建制镇, 或者城市不一样 用我们
if (result.containsKey("city")) {
if ("是".equals(result.get("administrativeTowns")) || (!result.get("city").equals(map.get("city")) && StringUtils.isNotBlank(result.getString("city")))) {
basicModel.setResult(result);
} else {
map.put("addrVerify", "地址有效");
map.put("addrArea", addrArea(map, type));
map.put("countyLevelCity", countyLevelCity(map));
map.put("typeName", areaMap.get(map.get("typeCode")));
basicModel.setResult(map);
}
} else {
map.put("addrVerify", "地址有效");
map.put("addrArea", addrArea(map, type));
map.put("countyLevelCity", countyLevelCity(map));
map.put("typeName", areaMap.get(map.get("typeCode")));
basicModel.setResult(map);
}
} else {
basicModel.setResult(result);
}
} else {
basicModel.setResult(result);
}
} catch (Exception e) {
e.printStackTrace();
basicModel.setResult(result);
}
}
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
}
return mav;
}
/**
* 涉农识别-新规则-基础版本
@@ -675,27 +1101,27 @@ public class AddrSvcController {
VillageIdentify villageResult = CollectionUtils.isNotEmpty(villageIdentifyList) ? villageIdentifyList.get(0) : null;
if (villageResult != null && StringUtils.isNotBlank(villageResult.getVerifyFlag())) {
Map<String, String> resultMap = new HashMap<String, String>();
resultMap.put("province",villageResult.getProvince());
resultMap.put("city",villageResult.getCity1());
resultMap.put("district",villageResult.getDistrict());
resultMap.put("town",villageResult.getTown());
resultMap.put("committee",villageResult.getCommittee());
resultMap.put("provinceCode",villageResult.getCityCode());
resultMap.put("cityCode",villageResult.getCityCode());
resultMap.put("districtCode",villageResult.getDistrictCode());
resultMap.put("townCode",villageResult.getTownCode());
resultMap.put("committeeCode",villageResult.getCommitteeCode());
resultMap.put("typeCode",villageResult.getTypeCode());
resultMap.put("typeName",villageResult.getTypeName());
resultMap.put("verifyFlag",villageResult.getVerifyFlag());
resultMap.put("province", villageResult.getProvince());
resultMap.put("city", villageResult.getCity1());
resultMap.put("district", villageResult.getDistrict());
resultMap.put("town", villageResult.getTown());
resultMap.put("committee", villageResult.getCommittee());
resultMap.put("provinceCode", villageResult.getCityCode());
resultMap.put("cityCode", villageResult.getCityCode());
resultMap.put("districtCode", villageResult.getDistrictCode());
resultMap.put("townCode", villageResult.getTownCode());
resultMap.put("committeeCode", villageResult.getCommitteeCode());
resultMap.put("typeCode", villageResult.getTypeCode());
resultMap.put("typeName", villageResult.getTypeName());
resultMap.put("verifyFlag", villageResult.getVerifyFlag());
resultMap.put("addrVerify", villageResult.getAddrVerify());
resultMap.put("countyLevelCity",villageResult.getCountyLevelCity());
resultMap.put("administrativeTowns",villageResult.getAdministrativeTowns());
resultMap.put("countyGov",villageResult.getCountyGov());
resultMap.put("devDistrict",villageResult.getDevDistrict());
resultMap.put("devDistrictName",villageResult.getDevDistrictName());
resultMap.put("devLevel",villageResult.getDevLevel());
resultMap.put("addrArea",villageResult.getAddrArea());
resultMap.put("countyLevelCity", villageResult.getCountyLevelCity());
resultMap.put("administrativeTowns", villageResult.getAdministrativeTowns());
resultMap.put("countyGov", villageResult.getCountyGov());
resultMap.put("devDistrict", villageResult.getDevDistrict());
resultMap.put("devDistrictName", villageResult.getDevDistrictName());
resultMap.put("devLevel", villageResult.getDevLevel());
resultMap.put("addrArea", villageResult.getAddrArea());
BasicModel basicModel = new BasicModel(200, "OK");
basicModel.setResult(resultMap);
mav.setModel(basicModel);
@@ -950,6 +1376,7 @@ public class AddrSvcController {
* @param model
* @return
*/
@Deprecated
public Object addressAssociationAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
@@ -994,6 +1421,286 @@ public class AddrSvcController {
return mav;
}
/**
* 市级行政区划查询接口
*
* @param model
* @return
*/
public Object listCityAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("province", StringUtils.isNotBlank(model.getProvince()) ? model.getProvince() : null);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listCity", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listCity", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
if (json.containsKey("result")) {
JSONArray jsonArray = json.getJSONArray("result");
if (jsonArray != null) {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("tjjProvinceCode")) {
map.put("provinceCode", result.getString("tjjProvinceCode"));
}
if (result.containsKey("city")) {
map.put("city", result.getString("city"));
}
if (result.containsKey("tjjCityCode")) {
map.put("cityCode", result.getString("tjjCityCode"));
}
list.add(map);
}
}
}
basicModel.setResult(list);
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* 省级行政区划查询接口
*
* @param model
* @return
*/
public Object listProvinceAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
HttpRequest request = new HttpRequest();
JSONObject json = null;
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listProvince", null, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listProvince", null, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
if (json.containsKey("result")) {
JSONArray jsonArray = json.getJSONArray("result");
if (jsonArray != null) {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("tjjProvinceCode")) {
map.put("provinceCode", result.getString("tjjProvinceCode"));
}
list.add(map);
}
}
}
basicModel.setResult(list);
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* 区域级行政区划查询接口
*
* @param model
* @return
*/
public Object listDistrictAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("province", StringUtils.isNotBlank(model.getProvince()) ? model.getProvince() : null);
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listDistrict", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listDistrict", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
if (json.containsKey("result")) {
JSONArray jsonArray = json.getJSONArray("result");
if (jsonArray != null) {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("tjjProvinceCode")) {
map.put("provinceCode", result.getString("tjjProvinceCode"));
}
if (result.containsKey("city")) {
map.put("city", result.getString("city"));
}
if (result.containsKey("tjjCityCode")) {
map.put("cityCode", result.getString("tjjCityCode"));
}
if (result.containsKey("district")) {
map.put("district", result.getString("district"));
}
if (result.containsKey("tjjDistrictCode")) {
map.put("districtCode", result.getString("tjjDistrictCode"));
}
list.add(map);
}
}
}
basicModel.setResult(list);
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public Object listTownshipAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("province", StringUtils.isNotBlank(model.getProvince()) ? model.getProvince() : null);
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
params.put("district", StringUtils.isNotBlank(model.getDistrict()) ? model.getDistrict() : null);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listTownship", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/listTownship", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
if (json.containsKey("result")) {
JSONArray jsonArray = json.getJSONArray("result");
if (jsonArray != null) {
for (Object o : jsonArray) {
JSONObject result = (JSONObject) o;
HashMap<String, String> map = new HashMap<String, String>();
if (result.containsKey("id")) {
map.put("id", result.getString("id"));
}
if (result.containsKey("province")) {
map.put("province", result.getString("province"));
}
if (result.containsKey("tjjProvinceCode")) {
map.put("provinceCode", result.getString("tjjProvinceCode"));
}
if (result.containsKey("city")) {
map.put("city", result.getString("city"));
}
if (result.containsKey("tjjCityCode")) {
map.put("cityCode", result.getString("tjjCityCode"));
}
if (result.containsKey("district")) {
map.put("district", result.getString("district"));
}
if (result.containsKey("tjjDistrictCode")) {
map.put("districtCode", result.getString("tjjDistrictCode"));
}
if (result.containsKey("street")) {
map.put("street", result.getString("street"));
}
if (result.containsKey("tjjStreetCode")) {
map.put("streetCode", result.getString("tjjStreetCode"));
}
list.add(map);
}
}
}
basicModel.setResult(list);
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public Object levelAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("province", StringUtils.isNotBlank(model.getProvince()) ? model.getProvince() : null);
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
params.put("address", StringUtils.isNotBlank(model.getAddress()) ? model.getAddress() : null);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/addrLevel", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/addrLevel", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("msgCode");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
JSONObject result = json.getJSONObject("result");
basicModel.setResult(result);
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public void setDistrictStatService(DistrictStatService districtStatService) {
this.districtStatService = districtStatService;
}
@@ -619,6 +619,7 @@ public class AddressController {
params.setProvince(model.getProvince());
params.setUseMap(model.isUseMap());
params.setDebugName(model.getDebugName());
params.setPropertyType(model.getPropertyType());
long start = System.currentTimeMillis();
Building building = addressParserService.parser(params);
long end = System.currentTimeMillis();
@@ -2134,6 +2135,56 @@ public class AddressController {
return mav;
}
/**
* 楼盘评级
*
* @param model
* @return
*/
public Object propertyRatingAction(CommunitySummaryRequestDto model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress()) && StringUtils.isBlank(model.getId())) {
mav.setModel(BasicModel.buildBadRequestModel("小区ID或地址不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
JSONObject reqBody = new JSONObject();
reqBody.put("city", model.getCity());
reqBody.put("address", model.getAddress());
reqBody.put("id", model.getId());
String result = request.postWithBody("http://192.168.0.100:32080/FangJiaAddressService/propertyRating", reqBody, headers, "UTF-8");
if (result != null) {
try {
json = JSONObject.fromObject(result);
} catch (Exception e) {
json = null;
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (json != null) {
int code = json.getInt("status");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
basicModel.setResult(json.get("result"));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* Â¥ÅÌÆÀ¼
*
@@ -2196,8 +2247,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;
}
@@ -2209,11 +2260,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 {
@@ -2227,7 +2280,7 @@ public class AddressController {
}
if (json != null) {
int code = json.getInt("status");
int code = json.getInt("status") == 0 ? 200 : 0;
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
@@ -42,6 +42,7 @@ import org.slf4j.Logger;
import org.sothis.web.mvc.ActionContext;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.*;
@@ -78,6 +79,9 @@ public class ComprehensiveQueryController {
private static final int DEFAULT_PAGE_SIZE = 20;
private static final String[] PROPERTY_SEARCH_API_FIELDS = {"address", "city", "region", "name", "lat2", "lng2", "lat", "lng", "block", "estateType2", "addrAlias"};
private static final List<String> GAODE_LEVEL = Arrays.asList("兴趣点", "门牌号", "单元号", "楼层", "房间", "门址", "住宅区");
static final int BAI_DU_GEO = 1;// 百度系坐标
static final int GAO_DE_GEO = 2;// 高德系坐标
@@ -215,10 +219,19 @@ public class ComprehensiveQueryController {
mav.setModel(BasicModel.buildBadRequestModel("地址(address),面积(size)为必填字段"));
return mav;
}
// 不支持车位等估价
if (model.getAddress().contains("车位")) {
mav.setModel(BasicModel.buildBadRequestModel("非住宅无法估值"));
return mav;
}
String cityStr = model.getCity();
if (StringUtils.isNotBlank(cityStr) && cityStr.matches("\\d+")) {
AdministrativeDivision administrativeDivision = administrativeDivisionService.findcityByCode(cityStr);
if(administrativeDivision == null){
mav.setModel(BasicModel.buildBadRequestModel("城市代码错误"));
return mav;
}
String city = administrativeDivision.getCityShort();
if (StringUtils.isBlank(city)) {
mav.setModel(BasicModel.buildBadRequestModel("城市代码错误"));
@@ -232,10 +245,11 @@ public class ComprehensiveQueryController {
Map<String, String> communityAvgPriceParams = new HashMap<String, String>();
communityAvgPriceParams.put("city", model.getCity());
communityAvgPriceParams.put("address", model.getAddress());
communityAvgPriceParams.put("category", model.getCategory());
// communityAvgPriceParams.put("useMap", String.valueOf(model.isUseMap()));
communityAvgPriceParams.put("category", "district");
communityAvgPriceParams.put("useMap", "true");
communityAvgPriceParams.put("suggestName", String.valueOf(model.getName()));
communityAvgPriceParams.put("preciseLevel", "strict");
communityAvgPriceParams.put("propertyType", model.getPropertyType());
communityAvgPriceParams.put("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB");
JSONObject matchResponse = null;
try {
@@ -244,17 +258,47 @@ public class ComprehensiveQueryController {
} catch (HttpRequestException e) {
}
if (matchResponse == null || !matchResponse.containsKey("result") || !matchResponse.getJSONObject("result").containsKey("id")) {
// 去掉经纬度解析
// if (matchResponse == null || !matchResponse.containsKey("result") || !matchResponse.getJSONObject("result").containsKey("id")) {
// //加上高德获取经纬度 和 根据经纬度估值
// Map<String, String> map = GeoUtils.parserByGaode(model.getCity(), model.getAddress());
// if (map.containsKey("level") && GAODE_LEVEL.contains(map.get("level"))
// && map.containsKey("lng") && map.containsKey("lat")) {
// String location = map.get("lng") + "," + map.get("lat");
// JSONObject jsonResult = null;
// Map<String, String> param = new HashMap<String, String>();
// param.put("location", location);
// param.put("area", String.valueOf(model.getSize()));
// try {
// jsonResult = httpRequest.getJsonContent("http://192.168.0.100:30020/avmWeb/avmAnn", param, "UTF-8");
// if (jsonResult.containsKey("msg") && "成功".equals(jsonResult.getString("msg"))) {
// HashMap<String, Object> resultMap = new HashMap<String, Object>();
// resultMap.put("avgPrice", jsonResult.getString("unitPrice"));
// resultMap.put("totalPrice", jsonResult.getString("totalPrice"));
// houseValueInformation.setAddressValue(resultMap);
// mav.setModel(BasicModel.buildOKModel().setResult(houseValueInformation));
// } else {
// mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
// }
// } catch (HttpRequestException e) {
// throw new RuntimeException(e);
// }
// } else {
// mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
// }
// return mav;
// }
JSONObject result = matchResponse.getJSONObject("result");
if(!result.containsKey("id")){
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
return mav;
}
String id = matchResponse.getJSONObject("result").getString("id");
String id = matchResponse.getJSONObject("result") .getString("id");
District district = districtService.findById(id);
if (district == null) {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
return mav;
}
MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, matchResponse.getJSONObject("result"));
DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(district));
if (null != statBo) {
@@ -277,7 +321,15 @@ public class ComprehensiveQueryController {
}
}
// 价格下调10%
// if (dto.getAvgPrice() != null) {
// int avgPrice = new BigDecimal(dto.getAvgPrice()).multiply(new BigDecimal(0.9)).intValue();
// dto.setAvgPrice(avgPrice);
// }
// 非住宅无法估值
// 保存小区均价的返回结果
dto.setCredit(null);
houseValueInformation.setCommunityAvgPrice(dto);
//原房屋价值评估
@@ -285,12 +337,13 @@ public class ComprehensiveQueryController {
PropertyEvaluationModel propertyEvaluationModel = createPropertyEvaluationModelFromHouseInfomationModel(model);
boolean villaFlag = DataUtil.isVilla(propertyEvaluationModel.getSize(), propertyEvaluationModel.getName(), propertyEvaluationModel.getHeight(), propertyEvaluationModel.getRoom());
String propertyType = district.getEstateType2();
if (villaFlag && StringUtils.isNotBlank(propertyType) && !propertyType.equals("别墅")) {
District bieShuDistrict = districtService.findByNameAndAlias(district.getCity(), district.getRegion(), district.getName() + "别墅", "district");
if (bieShuDistrict != null) {
district = bieShuDistrict;
}
}
// 已添加物业类型,先注释
// if (villaFlag && StringUtils.isNotBlank(propertyType) && !propertyType.equals("别墅")) {
// District bieShuDistrict = districtService.findByNameAndAlias(district.getCity(), district.getRegion(), district.getName() + "别墅", "district");
// if (bieShuDistrict != null) {
// district = bieShuDistrict;
// }
// }
//添加城市
propertyEvaluationModel.setCity(district.getCity());
propertyEvaluationModel.setDistrict(district.getRegion());
@@ -300,6 +353,13 @@ public class ComprehensiveQueryController {
} catch (IllegalAccessException e) {
}
// 价格下调10%
// Map<String, Object> addressValue = houseValueInformation.getAddressValue();
// if (addressValue != null && addressValue.get("totalPrice") != null && addressValue.get("avgPrice") != null) {
// int evaluatePrice = new BigDecimal((Integer) addressValue.get("avgPrice")).multiply(new BigDecimal(0.9)).intValue();
// addressValue.put("avgPrice", evaluatePrice);
// addressValue.put("totalPrice", new BigDecimal(evaluatePrice * model.getSize()).intValue());
// }
// houseValueInformation.setAddressValue(modelAndView);
//房源样本
@@ -323,7 +383,7 @@ public class ComprehensiveQueryController {
}
// 此处慢
long start = System.currentTimeMillis();
List<Collateral> collaterals = czbankSampleService.findSample2(querys, sampleQuery.getMax());
List<Collateral> collaterals = czbankSampleService.findSampleForBse(querys, sampleQuery.getMax());
long end = System.currentTimeMillis();
System.out.println("用时:" + (end - start));
Collateral collateral = collaterals.get(0);
@@ -356,6 +416,18 @@ public class ComprehensiveQueryController {
// 原周边POI
DistrictFacilitys facilitys = districtFacilitysService.findByDistrict(district);
if (facilitys != null) {
List<String> hospitalList = facilitys.getHospital();
List<String> hospitals = new ArrayList<String>();
for (String hospital : hospitalList) {
if (hospital.endsWith("医院")) {
hospitals.add(hospital);
}
}
facilitys.setHospital(hospitals);
} else {
facilitys = new DistrictFacilitys();
}
// 将周边POI数据放到结果集
houseValueInformation.setSurroundingPoi(facilitys);
mav.setModel(BasicModel.buildOKModel().setResult(houseValueInformation));
@@ -679,54 +751,10 @@ public class ComprehensiveQueryController {
districtPriceMap.put("city", district.getCity());
districtPriceMap.put("district", district.getRegion());
districtPriceMap.put("name", district.getName());
districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice());
if (evaluation.getAvgPrice2b() != null && evaluation.getAvgPrice2b() != 0) {
districtPriceMap.put("avgPrice", evaluation.getAvgPrice2b());
} else {
districtPriceMap.put("avgPrice", evaluation.getAvgPrice());
}
// 根据城市等 级设置D级可信度
ApiUserAuthority apiUserAuthority = apiUserAuthorityService
.findByUserId(Long.valueOf(evaluation.getFromUserId()));
if (apiUserAuthority != null && null != apiUserAuthority.getCreditLevelStatus()
&& apiUserAuthority.getCreditLevelStatus() == 1) {
double dCredit = 0.61;
if (null != apiUserAuthority.getPriceRatingMap()) {
ServerArea serverArea = serverAreaService.findByDisplay(evaluation.getCity());
Map<String, Double> rateMap = apiUserAuthority.getPriceRatingMap();
if (null != rateMap) {
dCredit = rateMap.get(CITYLEVEL_MAP.get(serverArea.getNewCityGrade().toString()));
}
}
Map<String, Object> rMap = getLastEvaluationPrice(district, evaluation, dCredit);
if (model.getScope() == EVALUATE_SHOW_DETAIL) {
if (null != rMap) {
if (rMap.containsKey("level")) {
districtPriceMap.put("level", rMap.get("level"));
}
if (rMap.containsKey("other_price")) {
districtPriceMap.put("other_price", rMap.get("other_price"));
}
}
}
Long lastPrice = (Long) rMap.get("lastPrice");
if (null != lastPrice) {
districtPriceMap.put("totalPrice", lastPrice);
if (lastPrice > 0 && lastPrice != evaluation.getBigTotalPrice()) {
districtPriceMap.put("avgPrice", (int) (lastPrice / evaluation.getArea()));
}
} else {
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
return mav;
}
} else {
districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice());
}
// 估值中已经取过评估2B价格,且经过系数调整,不能在覆盖
districtPriceMap.put("avgPrice", evaluation.getAvgPrice());
Long totalPrice = new BigDecimal((Integer)districtPriceMap.get("avgPrice")).multiply(new BigDecimal(evaluation.getArea())).longValue();
districtPriceMap.put("totalPrice", totalPrice);
if (model.getScope() == EVALUATE_SHOW_DETAIL) {
districtPriceMap.put("evaluateWay", evaluation.getEvaluateWay());
@@ -744,7 +772,10 @@ public class ComprehensiveQueryController {
} catch (Exception e) {
e.printStackTrace();
}
// 根据单价重新计算总价
Integer avgPrice = (Integer) districtPriceMap.get("avgPrice");
totalPrice = new BigDecimal(avgPrice).multiply(new BigDecimal(evaluation.getArea())).longValue();
districtPriceMap.put("totalPrice", totalPrice);
return mav;
} else {
evaluationService.remove(evaluation.getId());
@@ -909,9 +940,9 @@ public class ComprehensiveQueryController {
otherPriceRets = new HashMap();
}
if (evaluation.getAvgPrice2b()!=null&&evaluation.getAvgPrice2b() > 0){
if (evaluation.getAvgPrice2b() != null && evaluation.getAvgPrice2b() > 0) {
otherPriceRets.put("fjw_price", evaluation.getAvgPrice2b());
}else {
} else {
otherPriceRets.put("fjw_price", evaluation.getAvgPrice());
}
Map<String, Object> levelMap = getPriceLevel(otherPriceRets, evaluation.getCredit());
File diff suppressed because it is too large Load Diff
@@ -1925,8 +1925,12 @@ public class FshController {
evaluation.setFitmentCharge(model.getDecorationCost());
}
evaluation.setGardenArea(model.getGardenArea());
if (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());
@@ -1951,7 +1955,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())) {
@@ -51,7 +51,45 @@ public class GdBankController {
};
/**
* 涉农识别-新规则-光大银行
* 判断所属区域
*
* @param map
* @return
*/
public String addrArea(Map<String, String> map, String type) {
if (map.get("verifyFlag") == null) {
return "";
}
if (map.get("verifyFlag").equals("非农")) {
return "城市区域";
}
if (map.get("verifyFlag").equals("农")) {
return "农村区域";
}
if ("2".equals(type) && "是".equals(map.get("countyGov"))) {
return "县城城区";
}
return "";
}
/**
* 判断县级市
*/
public String countyLevelCity(Map<String, String> map) {
if (map.get("city") == null) {
return "";
}
if (map.get("city").endsWith("区")) {
return "否";
}
if (map.get("city").equals("东莞市") || map.get("city").equals("嘉峪关市") || map.get("city").equals("中山市") || map.get("city").equals("儋州市")) {
return "否";
}
return "是";
}
/**
* 涉农识别-新规则-光大银行对公识别接口
*
* @param model
* @return
@@ -70,15 +108,15 @@ public class GdBankController {
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : null);
params.put("type", type);
params.put("redis", (model.getRadius() != null && model.getRadius() != 0) ? model.getRadius().toString() : null);
//params.put("type", type);
//params.put("redis", (model.getRadius() != null && model.getRadius() != 0) ? model.getRadius().toString() : null);
params.put("address", model.getAddress());
params.put("showFullValue", "2");
//params.put("showFullValue", "2");
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/villageIdentify", params, "UTF-8");
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify", params, "UTF-8");
} catch (Exception e) {
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/villageIdentify", params, "UTF-8");
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/cebEnterpriseVillageIdentify", params, "UTF-8");
} catch (Exception ex) {
ex.printStackTrace();
}
@@ -90,61 +128,67 @@ public class GdBankController {
if (json.containsKey("result")) {
//ÎÒÃǵĽá¹û
JSONObject result = json.getJSONObject("result");
if (("是").equals(result.get("countyLevelCity"))) {
result.put("prefectureLevelCity", "否");
} else if (("否").equals(result.get("countyLevelCity"))) {
result.put("prefectureLevelCity", "是");
}
// 如果是无效信息或者没有行政区划,则用我们的
if (result.containsKey("addrVerify") && ("无效".equals(result.getString("addrVerify")) || "没有行政区划".equals(result.getString("addrVerify")))) {
basicModel.setResult(result);
//我们省级及以上有开发区,直接用我们的结果
} else if (result.containsKey("devDistrictName")) {
basicModel.setResult(result);
} else {
try {
//如果是江苏省或者浙江省 调用齐梁的结果
if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) {
//我们省级及以上有开发区,直接用我们的结果
basicModel.setResult(result);
// if (result.containsKey("devDistrictName")) {
// } else {
// try {
// // 我们是县政府,且涉农结果为农,取我们结果,因为光大部分逻辑调整
// if ("是".equals(result.get("countyGov")) && "农".equals(result.get("verifyFlag"))) {
// basicModel.setResult(result);
// mav.setModel(basicModel);
// return mav;
// }
// //如果是江苏省或者浙江省 调用齐梁的结果
// if ("江苏省".equals(result.getString("province")) || "浙江省".equals(result.getString("province"))) {
// //结果比较,如果涉农结果不一致
// //调用齐梁 type :1 对公 0 对私
// //我们 type :1 对私 2 对共
// String qltype = "2".equals(type) ? "1" : "0";
// Map<String, String> map = senRequest(address, qltype);
// // 涉农结果不一样
// if (!map.get("verifyFlag").equals(result.get("verifyFlag"))) {
// // 齐梁县政府但是涉农为农,取我们的结果 扬中市三茅街道中华村永固河路1号
// if ("是".equals(map.get("countyGov")) && "农".equals(map.get("verifyFlag"))) {
// basicModel.setResult(result);
// mav.setModel(basicModel);
// return mav;
// }
// //城市不一样 用我们
// if (result.containsKey("city")) {
// if ((!result.get("city").equals(map.get("city")) && StringUtils.isNotBlank(result.getString("city")))) {
// basicModel.setResult(result);
// } else {
// map.put("addrVerify", "地址有效");
// map.put("typeName", areaMap.get(map.get("typeCode")));
// map.put("addrArea", addrArea(map, type));
// map.put("countyLevelCity", countyLevelCity(map));
// basicModel.setResult(map);
// }
// } else {
// map.put("addrVerify", "地址有效");
// map.put("typeName", areaMap.get(map.get("typeCode")));
// map.put("addrArea", addrArea(map, type));
// map.put("countyLevelCity", countyLevelCity(map));
// basicModel.setResult(map);
// }
//
// } else {
// basicModel.setResult(result);
// }
//
// } else {
// basicModel.setResult(result);
//
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// basicModel.setResult(result);
// }
//
// }
//结果比较,如果涉农结果不一致
//调用齐梁 type :1 对公 0 对私
//我们 type :1 对私 2 对共
String qltype = "2".equals(type) ? "1" : "0";
Map<String, String> map = senRequest(address, qltype);
// 涉农结果不一样
if (!map.get("verifyFlag").equals(result.get("verifyFlag"))) {
//有市辖建制镇, 或者城市不一样 用我们
if (result.containsKey("city") && ("是".equals(result.get("administrativeTowns")) || (!result.get("city").equals(map.get("city"))
&& StringUtils.isNotBlank(result.getString("city"))))) {
basicModel.setResult(result);
} else {
if (("是").equals(result.get("countyLevelCity"))) {
map.put("prefectureLevelCity", "否");
} else if (("否").equals(result.get("countyLevelCity"))) {
map.put("prefectureLevelCity", "是");
}
map.put("addrVerify", "地址有效");
if (result.containsKey("countyLevelCity")) {
map.put("countyLevelCity", result.getString("countyLevelCity"));
}
map.put("typeName", areaMap.get(map.get("typeCode")));
basicModel.setResult(map);
}
} else {
basicModel.setResult(result);
}
} else {
basicModel.setResult(result);
}
} catch (Exception e) {
e.printStackTrace();
basicModel.setResult(result);
}
}
}
mav.setModel(basicModel);
} else {
File diff suppressed because it is too large Load Diff
@@ -6,6 +6,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.text.ParseException;
@@ -178,7 +179,10 @@ 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"};
private static final List<String> GAODE_LEVEL = Arrays.asList("兴趣点", "门牌号", "单元号", "楼层", "房间", "门址", "住宅区");
static final int BAI_DU_GEO = 1;// 百度系坐标
static final int GAO_DE_GEO = 2;// 高德系坐标
@@ -748,7 +752,9 @@ public class PropertyController {
districtInfoDto.setDistrict(district.getRegion());
districtInfoDto.setName(district.getName());
districtInfoDto.setAddress(district.getAddress());
int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null);
//int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null);
// 返回2B价格,小程序用,其他也改为2B
int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null);
if (avgPrice != 0) {
districtInfoDto.setAvgPrice(avgPrice);
}
@@ -1051,7 +1057,8 @@ public class PropertyController {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0 || model.getCity().contains("全国")
|| model.getDistrict().contains("全国")) {
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
return mav;
}
@@ -1602,6 +1609,7 @@ public class PropertyController {
params.put("suggestName", model.getName());
}
params.put("category", "district");
params.put("propertyType", model.getPropertyType());
String result = addressMatchProxyService.parser(params);
if (result != null) {
JSONObject json = JSONObject.fromObject(result);
@@ -1609,6 +1617,11 @@ public class PropertyController {
Map<String, Object> map = (Map<String, Object>) json.get("result");
if ((Integer) map.get("precise") >= 0) {
String propertyType = (String) map.get("propertyType");
// 优先使用客户的物业类型,即使面积很大也不进行别墅推断 20241111
String userPropertyTypeParam = model.getPropertyType();
if (StringUtils.isNotBlank(userPropertyTypeParam) && ("0,2".contains(userPropertyTypeParam))) {
villaFlag = false;
}
if (villaFlag && StringUtils.isNotBlank(propertyType) && !propertyType.equals("别墅")) {
district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name") + "别墅", "district");
}
@@ -1621,7 +1634,32 @@ public class PropertyController {
}
if (district == null) {
mav.setModel(BasicModel.buildBadRequestModel("¸ÃµØÖ·²»Ö§³Ö¹À¼Û£¡"));
//加上高德获取经纬度 和 根据经纬度估值
Map<String, String> map = GeoUtils.parserByGaode(model.getCity(), model.getAddress());
if (map.containsKey("level") && GAODE_LEVEL.contains(map.get("level"))
&& map.containsKey("lng") && map.containsKey("lat")) {
String location = map.get("lng") + "," + map.get("lat");
HttpRequest httpRequest = new HttpRequest();
JSONObject json = null;
Map<String, String> param = new HashMap<String, String>();
param.put("location", location);
param.put("area", String.valueOf(model.getSize()));
try {
json = httpRequest.getJsonContent("http://192.168.0.100:30020/avmWeb/avmAnn", param, "UTF-8");
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
HashMap<String, String> resultMap = new HashMap<String, String>();
resultMap.put("avgPrice",json.getString("unitPrice"));
resultMap.put("totalPrice",json.getString("totalPrice"));
mav.setModel(BasicModel.buildOKModel().setResult(resultMap));
} else {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
}
} catch (HttpRequestException e) {
throw new RuntimeException(e);
}
} else {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
}
return mav;
}
model.setDistrict(district.getRegion());
@@ -2391,7 +2429,7 @@ public class PropertyController {
item.put("city", districtStat.getCity());
item.put("district", districtStat.getRegion());
item.put("name", districtStat.getDistrictName());
item.put("avgPrice", districtStat.getAvgPrice());
item.put("avgPrice", districtStat.getAvg_price_2b());
if ("monthly".equals(model.getPeriodType())) {
item.put("date", DateUtil.formatByPattern(districtStat.getWeekend(), "yyyy-MM"));
} else {
@@ -2507,7 +2545,7 @@ public class PropertyController {
}
Date startDate = DateUtil.add(new Date(), Calendar.MONTH, -model.getPeriodCount());
List<SqmetreRent> sqmetreRents = sqmetreRentService.findSqmetreRents(RegionData.formatCity(model.getCity()), RegionData.formatRegion(model.getCity(),model.getDistrict()), model.getName(), model.getCat(), startDate, null);
List<SqmetreRent> sqmetreRents = sqmetreRentService.findSqmetreRents(RegionData.formatCity(model.getCity()), RegionData.formatRegion(model.getCity(), model.getDistrict()), model.getName(), model.getCat(), startDate, null);
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(model.getPeriodCount());
for (SqmetreRent sqmetreRent : sqmetreRents) {
@@ -2780,7 +2818,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);
}
@@ -5844,7 +5882,8 @@ public class PropertyController {
districtPriceMap.put("name", district.getName());
districtPriceMap.put("address", district.getAddress());
districtPriceMap.put("totalPrice", evaluation.getTotalPrice());
districtPriceMap.put("cal_date", model.getCalDate());
//districtPriceMap.put("cal_date", model.getCalDate());
districtPriceMap.put("unitPrice", new BigDecimal(evaluation.getTotalPrice() / evaluation.getArea()).setScale(0, BigDecimal.ROUND_HALF_UP).intValue());
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
return mav;
} else {
@@ -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<String, Object> resMap = new HashMap<String, Object>();
List<StatsIndex> statsIndexs=statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true,model.getCat());
List<StatsIndex> statsIndexList=new ArrayList<StatsIndex>();
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<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
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<String, Object> resMap = new HashMap<String, Object>();
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<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
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<String, Object> resMap = new HashMap<String, Object>();
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<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "商铺");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
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<String, Object> resMap = new HashMap<String, Object>();
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<StatsIndex> statsIndexs=statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "写字楼");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
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<String, Object> resMap = new HashMap<String, Object>();
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<LandPriceIndex> landPriceIndexList = new ArrayList<LandPriceIndex>();
if(StringUtils.isNotBlank(model.getCity())) {
landPriceIndexList = landPriceIndexService.findByCityAndYear(model.getCity(), model.getYear());
} else {
landPriceIndexList = landPriceIndexService.findAllByYear(model.getYear());
}
List<LandPriceIndexBo> landPriceIndexBoList = new ArrayList<LandPriceIndexBo>();
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<String, Object> resMap = new HashMap<String, Object>();
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 (null == model.getYearmonth()) {
mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月"));
return mav;
}
String cityName = DistrictCodeUtils.getCityName(model.getCity());
if (cityName == null) {
mav.setModel(BasicModel.buildBadRequestModel("无法匹配到该城市编码"));
return mav;
}
Map<String, Object> resMap = new HashMap<String, Object>();
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 (null == model.getYearmonth()) {
mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月"));
return mav;
}
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(model.getDistrict());
if (fangjiaOfficialAreaMap == null) {
mav.setModel(BasicModel.buildBadRequestModel("无法匹配到该区域编码"));
return mav;
}
Map<String, Object> resMap = new HashMap<String, Object>();
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 (null == model.getYearmonth()) {
mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月"));
return mav;
}
District district = districtService.findById(model.getId());
if (district == null) {
mav.setModel(BasicModel.buildBadRequestModel("无法匹配到小区"));
return mav;
}
Map<String, Object> resMap = new HashMap<String, Object>();
PropertyStatsIndex statsIndex = propertyStatsIndexService.findStatsIndex(district.getCity(), district.getRegion(), district.getName(), model.getYearmonth());
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 (null == model.getYearmonth()) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
return mav;
}
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
if (statsIndexs != null && statsIndexs.size() > 0) {
for (StatsIndex statsIndex : statsIndexs) {
IndexBo newStatsIndex = new IndexBo();
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
newStatsIndex.setYearmonth(statsIndex.getYearmonth().toString());
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<String, Object> resMap = new HashMap<String, Object>();
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 (null == model.getYearmonth()) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
return mav;
}
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
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().toString());
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<String, Object> resMap = new HashMap<String, Object>();
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 (null == model.getYearmonth()) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
return mav;
}
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "商铺");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
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().toString());
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<String, Object> resMap = new HashMap<String, Object>();
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 (null == model.getYearmonth()) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
return mav;
}
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "写字楼");
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
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().toString());
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<String, Object> resMap = new HashMap<String, Object>();
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<LandPriceIndex> landPriceIndexList = new ArrayList<LandPriceIndex>();
if (StringUtils.isNotBlank(model.getCity())) {
landPriceIndexList = landPriceIndexService.findByCityAndYear(model.getCity(), model.getYear());
} else {
landPriceIndexList = landPriceIndexService.findAllByYear(model.getYear());
}
List<LandPriceIndexBo> landPriceIndexBoList = new ArrayList<LandPriceIndexBo>();
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<String, Object> resMap = new HashMap<String, Object>();
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;
}
}
File diff suppressed because it is too large Load Diff
@@ -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;
/**
@@ -125,58 +134,305 @@ 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<OpenResource> openResourceList = openResourceService.findAll();
List<ApiMonitorInfo> list = new ArrayList<ApiMonitorInfo>();
long id = user.getId();
ApiUserAuthority authority = apiUserAuthorityService.findByUserId(id);
if (null != authority) {
// 用户有的uri
List<OpenResource> userResources = new ArrayList<OpenResource>();
for (OpenResource openResource : openResourceList) {
if (authority.getOpenResourseUris().contains(openResource.getUri())) {
userResources.add(openResource);
}
user = instance.user;
}
if (null == instance && user == null) {
mav.setModel(new BasicModel(HttpStatusCodeEnum.BAD_REQUEST_ERROR_KEY));
return mav;
}
List<OpenResource> openResourceList = openResourceService.findAll();
List<ApiMonitorInfo> list = new ArrayList<ApiMonitorInfo>();
long id = user.getId();
ApiUserAuthority authority = apiUserAuthorityService.findByUserId(id);
if (null != authority) {
// 用户有的uri
List<OpenResource> userResources = new ArrayList<OpenResource>();
for (OpenResource openResource : openResourceList) {
if (authority.getOpenResourseUris().contains(openResource.getUri())) {
userResources.add(openResource);
}
Map<String, Integer> 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);
}
Map<String, Integer> 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);
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<OpenUriAnaly> analys = openUriAnalyService.findOpenUriAnalyLogs(model.getUserId(), model.getUri(), startDate, endDate);
List<StatAnalyBo> bos = null;
model.setQuery("uri");
Long userId = model.getUserId();
ApiUserAuthority authority = apiUserAuthorityService.findByUserId(userId);
Map<String, Integer> 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<ApiInvokeStatistical> apiInvokeStatisticalList = apiInvokeStatisticalService.findApiInvokeStatisticalList(model.getUserId(), startDate, endDate);
if (bos != null && apiInvokeStatisticalList.size() > 0) {
Map<String, Map<String, Integer>> 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)));
}
}
}
BasicModel basicModel = new BasicModel(200, "ok");
basicModel.setResult(list);
mav.setModel(basicModel);
} else {
mav.setModel(new BasicModel(HttpStatusCodeEnum.BAD_REQUEST_ERROR_KEY));
}
List<OpenResource> resources = openResourceService.findOpenResource(null);
Map<String, String> urlMap = converMapData(resources);
for (StatAnalyBo boTemp : bos) {
List<ApiVisitCount> 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<StatAnalyBo> createAnalyBosByLink(List<OpenUriAnaly> analys) {
Map<String, Integer> ret = new HashMap<String, Integer>();
Map<String, Map<String, Integer>> urlCodeMap = new HashMap<String, Map<String, Integer>>();
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<String, Integer> codeMap = urlCodeMap.get(openUriAnaly.getUrl());
if (codeMap == null) {
codeMap = new HashMap<String, Integer>();
urlCodeMap.put(openUriAnaly.getUrl(), codeMap);
}
Map<String, Object> 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<StatAnalyBo> bos = new ArrayList<StatAnalyBo>();
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<String, Integer> 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<StatAnalyBo> sortStatAnaly(List<StatAnalyBo> bos) {
Collections.sort(bos, new Comparator<StatAnalyBo>() {
@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<String, String> converMapData(List<OpenResource> resources) {
Map<String, String> map = new HashMap<String, String>();
for (OpenResource resource : resources) {
map.put(resource.getUri(), resource.getName());
}
return map;
}
private Map<String, Map<String, Integer>> getCountByUri(List<ApiInvokeStatistical> apiInvokeStatisticalList) {
Map<String, Map<String, Integer>> resultMap = new HashMap<String, Map<String, Integer>>();
for (ApiInvokeStatistical apiInvokeStatistical : apiInvokeStatisticalList) {
Map<String, Integer> detailMap = resultMap.get(apiInvokeStatistical.getRequestURI());
if (detailMap == null) {
detailMap = new HashMap<String, Integer>();
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<StatAnalyBo> 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 +456,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;
}
}
@@ -6,6 +6,7 @@ import com.fangjia.dal.QueryParam;
import com.fangjia.dal.SdQuery;
import com.fangjia.dal.SrQuery;
import com.fangjia.dal.common.DistrictKey;
import com.fangjia.dal.mongo.model.SeaweedImages;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.dal.sql.model.FjtUsers;
import com.fangjia.open.compatible.model.JsonModel;
@@ -18,6 +19,7 @@ import com.fangjia.service.bo.DistrictStatRentBo;
import com.fangjia.service.datastore.DistrictService;
import com.fangjia.service.district.DistrictStatRentService;
import com.fangjia.service.district.DistrictStatService;
import com.fangjia.service.mongo.fangjia.SeaweedImagesService;
import com.fangjia.service.sql.FjtUsersService;
import com.fangjia.service.sql.UserCityService;
import com.fangjia.service.user.UsersInfoService;
@@ -44,7 +46,9 @@ public class DistrictController {
private DistrictStatRentService districtStatRentService;
private DistrictStatService districtStatService;
private UserCityService userCityService;
private FjtUsersService fjtUsersService;
private FjtUsersService fjtUsersService;
private SeaweedImagesService seaweedImagesService;
/********************************************* new start *****************************************************/
/**
@@ -55,14 +59,14 @@ public class DistrictController {
* @param keyword
* @return
*/
public Object suggestAction( @Param(name = "city") String city, @Param(name = "cat") String cat, @Param(name = "keyword") String keyword,
@Param(name = "limit") Integer limit,@Param(name="lat")Double lat, @Param(name="lng")Double lng) {
public Object suggestAction(@Param(name = "city") String city, @Param(name = "cat") String cat, @Param(name = "keyword") String keyword,
@Param(name = "limit") Integer limit, @Param(name = "lat") Double lat, @Param(name = "lng") Double lng) {
JsonModel model = new JsonModel();
if (limit == null || limit > 100 || limit <= 0) {
limit = 10;
}
System.out.println(cat + "#" + city + "#" + keyword + "#" + limit + "#" + lng + "#" + lat);
List<AutoCompleteBo> suggestList = getDistrictByKeyword(cat, city, keyword, limit, lng, lat);
List<AutoCompleteBo> suggestList = getDistrictByKeyword(cat, city, keyword, limit, lng, lat);
model.setJsonModel(suggestList);
return model;
}
@@ -75,25 +79,30 @@ public class DistrictController {
String login_user_type = CookieUtils.getCookieValue(request, "login_user_type");
//保存企业用户选择的城市,企业用户7天
String weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
String weiXinId = CookieUtils.getCookieValue(request, "we_chat_open_id");
// if(StringUtils.isBlank(login_user_type) || StringUtils.isBlank(weiXinId)){
// response.sendRedirect("/coming");
// return null;
// }
if("b".equals(login_user_type) || "gb".equals(login_user_type)){
CacheUtils.putValue(CachePolicyEnum.LONG, UsersInfoService.class, weiXinId + "_city_"+ login_user_type , model.getCityName());
}
Long userId = Long.parseLong(CookieUtils.getCookieValue(request,"login_user_id"));
if(userId != null){
FjtUsers users = fjtUsersService.findById(userId);
if(users != null){
model.setRole(users.getRole());
}
}
if ("b".equals(login_user_type) || "gb".equals(login_user_type)) {
CacheUtils.putValue(CachePolicyEnum.LONG, UsersInfoService.class, weiXinId + "_city_" + login_user_type, model.getCityName());
}
try {
Long userId = Long.parseLong(CookieUtils.getCookieValue(request, "login_user_id"));
if (userId != null) {
FjtUsers users = fjtUsersService.findById(userId);
if (users != null) {
model.setRole(users.getRole());
}
}
} catch (Exception ex) {
}
model.setType(login_user_type);
return model;
}
private List<AutoCompleteBo> getDistrictByKeyword(String cat, String city, String keyword, int limit, final Double lng, final Double lat) {
keyword = DataUtil.escapeSolr(keyword);
@@ -109,14 +118,14 @@ public class DistrictController {
BooleanQuery srQuery1 = new BooleanQuery();
BooleanQuery nameQuery = new BooleanQuery();
// nameQuery.add(new TermQuery(new Term("district_name", keyword)), BooleanClause.Occur.SHOULD);
// nameQuery.add(new TermQuery(new Term("alias_std", keyword)), BooleanClause.Occur.SHOULD);
// nameQuery.add(new TermQuery(new Term("address", keyword)), BooleanClause.Occur.SHOULD);
// nameQuery.add(new TermQuery(new Term("addr_alias_std", keyword)), BooleanClause.Occur.SHOULD);
// nameQuery.add(new TermQuery(new Term("district_name", keyword)), BooleanClause.Occur.SHOULD);
// nameQuery.add(new TermQuery(new Term("alias_std", keyword)), BooleanClause.Occur.SHOULD);
// nameQuery.add(new TermQuery(new Term("address", keyword)), BooleanClause.Occur.SHOULD);
// nameQuery.add(new TermQuery(new Term("addr_alias_std", keyword)), BooleanClause.Occur.SHOULD);
nameQuery.add(new TermQuery(new Term("keyword", keyword)), BooleanClause.Occur.SHOULD);
//nameQuery.add(new TermQuery(new Term("keyword_cjk", keyword)), BooleanClause.Occur.SHOULD);//这个重要,因seaweed不支持模糊搜索,当输入"中远两"需用此进行搜索
srQuery1.add(nameQuery, BooleanClause.Occur.SHOULD);
if(lat != null && lng != null && lat != 0 && lng != 0){
if (lat != null && lng != null && lat != 0 && lng != 0) {
Map<String, Double> geo = GeocodeUtils.geoconvBaiduToGoogle(lng, lat);
SdQuery sdQuery = new SdQuery();
sdQuery.setPoint(geo.get("lat") + "," + geo.get("lng"));
@@ -125,7 +134,7 @@ public class DistrictController {
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
}
params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[]{"region", "name", "address", "addrAlias","id"});
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[]{"region", "name", "address", "addrAlias", "id", "alias"});
List<AutoCompleteBo> ret = new ArrayList<AutoCompleteBo>(districts.size());
for (District district : districts) {
AutoCompleteBo bo = new AutoCompleteBo();
@@ -134,24 +143,34 @@ public class DistrictController {
bo.setDesc(district.getAddress());
bo.setRegion(district.getRegion());
bo.setId(district.getId());
if (!district.getName().contains(keyword)) {
if (district.getAlias() != null && !district.getAlias().isEmpty()) {
for (String alias : district.getAlias()) {
if (alias.contains(keyword)){
bo.setAlias(alias);
break;
}
}
}
}
ret.add(bo);
}
return ret;
}
public Object districtDetailAction(DistrictModel districtModel,HttpServletRequest request,HttpServletResponse response) {
public Object districtDetailAction(DistrictModel districtModel, HttpServletRequest request, HttpServletResponse response) {
//id和name不能同时为空
if(StringUtils.isBlank(districtModel.getId()) && (StringUtils.isBlank(districtModel.getCityName()) || StringUtils.isBlank(districtModel.getName()))) {
if (StringUtils.isBlank(districtModel.getId()) && (StringUtils.isBlank(districtModel.getCityName()) || StringUtils.isBlank(districtModel.getName()))) {
districtModel.setMsg("参数错误");
return districtModel;
}
District district = null;
if(StringUtils.isNotBlank(districtModel.getId())) {
if (StringUtils.isNotBlank(districtModel.getId())) {
district = districtService.findById(districtModel.getId());
if(district != null) {
if (district != null) {
districtModel.setCityName(district.getCity());
districtModel.setRegion(district.getRegion());
districtModel.setName(district.getName());
@@ -167,24 +186,26 @@ public class DistrictController {
String userId = CookieUtils.getCookieValue(request, "login_user_id");
//小区租金
List<DistrictStatRentBo> districtStatRentBos = districtStatRentService.findAllHouseTypeByDistrictStatRent(new DistrictKey(district));
//处理图片链接
List<String> outPics = Lists.newArrayList();
if(district.getOutPics() != null) {
for (String outPic : district.getOutPics()) {
// outPics.add(districtModel.getPicUrl() + DataUtil.encodePicUrl(outPic, "s", "district"));
outPics.add("http://static.fangjia.com/stc/fs/" + DataUtil.encodePicUrl(outPic, "s", "district"));
}
// List<String> outPics = Lists.newArrayList();
// if(district.getOutPics() != null) {
// for (String outPic : district.getOutPics()) {
//// outPics.add(districtModel.getPicUrl() + DataUtil.encodePicUrl(outPic, "s", "district"));
// outPics.add("http://static.fangjia.com/stc/fs/" + DataUtil.encodePicUrl(outPic, "s", "district"));
// }
// }
SeaweedImages seaweedImages = seaweedImagesService.findById(district.getId());
if (seaweedImages != null) {
district.setOutPics(seaweedImages.getOutPics());
}
district.setOutPics(outPics);
districtModel.setDistrict(district);
districtModel.setDistrictStatBo(districtStatBo);
districtModel.setDistrictStatRentBos(districtStatRentBos);
String city=request.getParameter("city");
boolean is=true;
String city = request.getParameter("city");
boolean is = true;
if (null != districtStatBo && null != districtStatBo.getDefaultDistrictStat()) {
double credit = districtStatBo.getDefaultDistrictStat().getCredit();
@@ -203,7 +224,7 @@ public class DistrictController {
} else {
is = true;
}
if(!is){
if (!is) {
try {
response.sendRedirect("wrongPrice");
} catch (Exception e) {
@@ -213,7 +234,6 @@ public class DistrictController {
}
private DistrictStatBo getDistrictStat(DistrictKey districtKey) {
District district = districtService.findDistrict(districtKey, true);
DistrictStatBo statBo = null;
@@ -227,8 +247,8 @@ public class DistrictController {
// 同比数据
if (statBo != null) {
Date date = DateUtil.getThisWeekInLastYear();
Date[] dateList = { DateUtil.getBeforeDay(date, 14), DateUtil.getBeforeDay(date, 7), DateUtil.getAfterDay(date, 7),
DateUtil.getAfterDay(date, 14), date };
Date[] dateList = {DateUtil.getBeforeDay(date, 14), DateUtil.getBeforeDay(date, 7), DateUtil.getAfterDay(date, 7),
DateUtil.getAfterDay(date, 14), date};
DistrictStatBo yearPeriodStatBo = null;
Integer markup = Integer.MAX_VALUE;
@@ -318,9 +338,11 @@ public class DistrictController {
this.userCityService = userCityService;
}
public void setFjtUsersService(FjtUsersService fjtUsersService) {
this.fjtUsersService = fjtUsersService;
}
public void setFjtUsersService(FjtUsersService fjtUsersService) {
this.fjtUsersService = fjtUsersService;
}
public void setSeaweedImagesService(SeaweedImagesService seaweedImagesService) {
this.seaweedImagesService = seaweedImagesService;
}
}
@@ -559,7 +559,7 @@ public class DistrictTrendController {
DistrictStat ds = districtStatMap.get(key);
JSONArray ja = new JSONArray();
ja.put(DateUtil.getBeforeDay(ds.getWeekend(), -1).getTime());
ja.put(ds.getAvgPrice());
ja.put(ds.getAvg_price_2b());
districtJa.put(ja);
}
@@ -567,7 +567,7 @@ public class DistrictTrendController {
DistrictStat ds = villaDistrictStatMap.get(key);
JSONArray ja = new JSONArray();
ja.put(DateUtil.getBeforeDay(ds.getWeekend(), -1).getTime());
ja.put(ds.getAvgPrice());
ja.put(ds.getAvg_price_2b());
villaJa.put(ja);
}
@@ -65,6 +65,10 @@ public class UserController {
return model;
}
public Object aiLoginPageAction(UserModel model) {
return model;
}
//渤海银行登录
public Object bhydLoginPageAction(UserModel model, HttpServletResponse response, HttpServletRequest request) {
String type = StringUtils.trimToNull(model.getType());
@@ -263,11 +267,22 @@ public class UserController {
try {
FjtUsers user = usersInfoService.getUser(mobile);
if(user == null) {
long userId = usersInfoService.addUser(mobile, "", weiXinId);
if(userId == 0){
return resultModel;
String cookieUserId = CookieUtils.getCookieValue(request, "login_user_id");
if(StringUtils.isNotBlank(cookieUserId)){
long userId = Long.valueOf(cookieUserId);
user = fjtUsersService.findById(Long.valueOf(userId));
}
CookieUtils.setCookie("login_user_id", userId + "", "/", 60 * 60 * 24 *7, response);
if(user!=null){
usersInfoService.bindWeiXin(weiXinId, user.getId());
CookieUtils.setCookie("login_user_id", user.getId() + "", "/", 60 * 60 * 24 *7, response);
}else{
long userId = usersInfoService.addUser(mobile, "", weiXinId);
if(userId == 0){
return resultModel;
}
CookieUtils.setCookie("login_user_id", userId + "", "/", 60 * 60 * 24 *7, response);
}
} else {
usersInfoService.bindWeiXin(weiXinId, user.getId());
CookieUtils.setCookie("login_user_id", user.getId() + "", "/", 60 * 60 * 24 *7, response);
@@ -296,6 +311,14 @@ public class UserController {
String pass = StringUtils.trimToNull(model.getPass());
String weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
String source = model.getSource();
// AI¹À¼ÛС³ÌÐò
if ("ai-price-mp".equals(source)) {
model.setAppId("wx30979dc8c24a82b6");
model.setAppSecret("ec013ae42882368bf3b157545042249a");
}
if(StringUtils.isBlank(weiXinId) && StringUtils.isNotBlank(model.getCode())){
System.out.println("小程序code:"+model.getCode());
System.out.println("小程序AppId:"+model.getAppId());
@@ -763,6 +763,27 @@ public class WeiXinEvaluationController {
}
return model;
}
// 均价对比接口(房价通小程序用)
public Object otherSourcePlusAction(EvaluationModel model){
JsonModel jsonMmodel = new JsonModel();
Map<String, Integer> dataMap = new HashMap<String, Integer>();
if(StringUtils.isNotBlank(model.getCityName()) && StringUtils.isNotBlank(model.getRegion()) && StringUtils.isNotBlank(model.getName()) && model.getBuildType() != null){
String category = getEnCategory(model.getBuildType());
AverageStatistics averageStatistics = averageStatisticsService.findOneAverageStatictics(model.getCityName(), model.getName(), category);
Integer tradeAvgPrice = dealPriceService.findDealPrices(model.getCityName(), model.getRegion(), model.getName(), DateUtil.getFirstDayOfMonth(new Date(), -6), DateUtil.getFirstDayOfMonth(new Date(), 0));
//columnX = "['成交均价(近半年)','房价网挂牌均价','搜房挂牌均价','安居客挂牌均价']";
dataMap.put("dealPrice", tradeAvgPrice);
dataMap.put("fjw", averageStatistics.getFangjiaPrice());
dataMap.put("soufang", averageStatistics.getSoufangEsfPrice());
dataMap.put("anjuke", averageStatistics.getAnjukeEsfPrice());
}
jsonMmodel.setJsonModel(dataMap);
return jsonMmodel;
}
//均价对比
public Object otherSourceAction(EvaluationModel model){
@@ -7,6 +7,7 @@ public class DistrictDto {
private String region;
private String name;
private String address;
private String district;
public String getProvince() {
return province;
@@ -47,4 +48,12 @@ public class DistrictDto {
public void setAddress(String address) {
this.address = address;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
}
@@ -1,14 +1,21 @@
package com.fangjia.open.exceptionhander;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import com.fangjia.core.util.DingDingMessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sothis.web.mvc.ActionContext;
import org.sothis.web.mvc.ExceptionHandler;
import java.net.Inet4Address;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
public class FangjiaOpenExceptionHandler implements ExceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(FangjiaOpenExceptionHandler.class);
@@ -17,9 +24,42 @@ public class FangjiaOpenExceptionHandler implements ExceptionHandler {
LOGGER.error("", e);
}
ActionContext context = ActionContext.getContext();
String ip = getLocalHostIP();
String token = "2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c";
try {
DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"服务器内部错误,请及时关注!");
} catch (Exception e1) {
e1.printStackTrace();
}
context.getResponse().setStatus(500);
context.getResponse().setCharacterEncoding("UTF-8");
context.getResponse().setContentType("application/json;charset=UTF-8");
context.getResponse().getWriter().println("{\"code\":500, \"msg\":\"·þÎñÆ÷ÄÚ²¿´íÎó\"}");
}
public static String getLocalHostIP() {
/*k8s系统上运行时,使用hostname区分*/
if ("true".equalsIgnoreCase(System.getenv("ON_K8S"))) {
return System.getenv("HOSTNAME");
}
String result = null;
try {
Enumeration<?> enumeration = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
while (enumeration.hasMoreElements()) {
NetworkInterface netInterface = (NetworkInterface) enumeration.nextElement();
Enumeration<?> addresses = netInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
ip = (InetAddress) addresses.nextElement();
if (ip != null && ip instanceof Inet4Address && (ip.getHostAddress().contains("192.168.0") || ip.getHostAddress().contains("192.168.10"))) {
result = ip.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return result == null ? "192.168.20.6" : result;
}
}
@@ -3,6 +3,7 @@ package com.fangjia.open.interceptors;
import com.fangjia.core.RegionData;
import com.fangjia.core.util.AnalyticsUtil;
import com.fangjia.core.util.DateUtil;
import com.fangjia.core.util.DingDingMessageUtil;
import com.fangjia.dal.common.ServerAreaData;
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
import com.fangjia.dal.mongo.open.model.ApiUserAuthority;
@@ -14,6 +15,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;
@@ -24,428 +26,508 @@ import org.sothis.web.mvc.Interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
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<String> HAS_SUB_SERVICE_URIS = new ArrayList<String>();
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<String> HAS_SUB_SERVICE_URIS = new ArrayList<String>();
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<String> 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<String> 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) {
String ip = getLocalHostIP();
String token = "2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c";
try {
DingDingMessageUtil.sendTextMessage(token, "[OpenApi] "+ip+"Authentication error!");
} catch (Exception e1) {
e1.printStackTrace();
}
LOGGER.error("Authentication error : ", e);
ret.setModel(BasicModel.buildServerErrorModel());
ret.setViewParam("code", HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return ret;
}
}
private static String getLocalHostIP() {
/*k8s系统上运行时,使用hostname区分*/
if ("true".equalsIgnoreCase(System.getenv("ON_K8S"))) {
return System.getenv("HOSTNAME");
}
String result = null;
try {
Enumeration<?> enumeration = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
while (enumeration.hasMoreElements()) {
NetworkInterface netInterface = (NetworkInterface) enumeration.nextElement();
Enumeration<?> addresses = netInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
ip = (InetAddress) addresses.nextElement();
if (ip != null && ip instanceof Inet4Address && (ip.getHostAddress().contains("192.168.0") || ip.getHostAddress().contains("192.168.10"))) {
result = ip.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return result == null ? "192.168.20.6" : result;
}
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<String> 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<String> getServiceCode(HttpServletRequest request) {
Map<String, String> 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<String, String> 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;
}
}
@@ -22,6 +22,7 @@ public class AddesssMatchModel extends FangjiaApiModel {
private boolean useMap;
private String address_1;
private String address_2;
private String propertyType;
private String showCode;
@@ -153,4 +154,12 @@ public class AddesssMatchModel extends FangjiaApiModel {
public void setShowCode(String showCode) {
this.showCode = showCode;
}
public String getPropertyType() {
return propertyType;
}
public void setPropertyType(String propertyType) {
this.propertyType = propertyType;
}
}
@@ -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<ApiUserBo> apiUserBoList;
private List<EachCityBo> eachCityBoList;
private String limitCountMap;
private String totalCountMap;
private Integer creditLevelStatus;
private String priceType;
private Map<String,Double> 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<EachCityBo> getEachCityBoList() {
return eachCityBoList;
}
public void setEachCityBoList(List<EachCityBo> eachCityBoList) {
this.eachCityBoList = eachCityBoList;
}
private Integer sum;
private Integer limit;
/*** 权限控制相关 **/
private ApiUserBo apiUserBo;
private List<ApiUserAuthority> authorityList;
private ApiUserAuthority authority;
private List<AuthorityBo> authorityBoList;
//private List<ServerArea> serverAreaList;
private List<Map<String,Object>> serverAreaList;
private String openCitys;// 汉字说明
private List<String> 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<OpenUriAnalyBo> OpenUriAnalyBoList;
private List<StatAnalyBo> statAnalyBoList;
private Integer way;
private Map<String, String> 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<ApiUserBo> getApiUserBoList() {
return apiUserBoList;
}
public void setApiUserBoList(List<ApiUserBo> 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<ApiUserAuthority> getAuthorityList() {
return authorityList;
}
public void setAuthorityList(List<ApiUserAuthority> 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<AuthorityBo> getAuthorityBoList() {
return authorityBoList;
}
public void setAuthorityBoList(List<AuthorityBo> authorityBoList) {
this.authorityBoList = authorityBoList;
}
public List<String> getCityFirstLetters() {
return cityFirstLetters;
}
public void setCityFirstLetters(List<String> cityFirstLetters) {
this.cityFirstLetters = cityFirstLetters;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
/*public List<ServerArea> getServerAreaList() {
return serverAreaList;
}
public void setServerAreaList(List<ServerArea> serverAreaList) {
this.serverAreaList = serverAreaList;
}*/
public List<Map<String, Object>> getServerAreaList() {
return serverAreaList;
}
public void setServerAreaList(List<Map<String,Object>> 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<OpenUriAnalyBo> getOpenUriAnalyBoList() {
return OpenUriAnalyBoList;
}
public void setOpenUriAnalyBoList(List<OpenUriAnalyBo> 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<String, String> getResourceMap() {
return resourceMap;
}
public void setResourceMap(Map<String, String> resourceMap) {
this.resourceMap = resourceMap;
}
public List<StatAnalyBo> getStatAnalyBoList() {
return statAnalyBoList;
}
public void setStatAnalyBoList(List<StatAnalyBo> 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<String, Double> getPriceRatingMap() {
return priceRatingMap;
}
public void setPriceRatingMap(Map<String, Double> 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;
}
@@ -0,0 +1,115 @@
package com.fangjia.open.model;
import com.fangjia.open.APIConstant;
import com.fangjia.open.HttpStatusCodeEnum;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import org.sothis.web.mvc.ActionContext;
@XStreamAlias("xml")
public class BasicPageModel {
private int code;
private String msg;
private Object result;
private String tid;
private int total;
public BasicPageModel(int code, String msg) {
super();
this.code = code;
this.msg = msg;
}
public BasicPageModel(HttpStatusCodeEnum status){
this.code = status.getCode();
this.msg = status.getMsg();
}
public static BasicPageModel buildOKModel() {
BasicPageModel model = new BasicPageModel(HttpStatusCodeEnum.OK);
return model;
}
public static BasicPageModel buildModel(int code, String msg){
return new BasicPageModel( code, msg);
}
public static BasicPageModel buildUnAuthorizedModel() {
BasicPageModel model = new BasicPageModel(HttpStatusCodeEnum.UN_AUTHORIZED);
return model;
}
public static BasicPageModel buildBadRequestModel(String msg){
BasicPageModel model = new BasicPageModel(HttpStatusCodeEnum.BAD_REQUEST);
model.setMsg(msg);
return model;
}
public static BasicPageModel buildForbidModel(String msg){
BasicPageModel model = new BasicPageModel(HttpStatusCodeEnum.SERVER_FORBID);
model.setMsg(msg);
return model;
}
public static BasicPageModel buildServerErrorModel(){
BasicPageModel model = new BasicPageModel(HttpStatusCodeEnum.SERVER_ERROR);
return model;
}
public static void markNoDataRequest(){
ActionContext.getContext().set(APIConstant.IS_RETURN_DATA, Boolean.FALSE);
}
public BasicPageModel markNoData(){
markNoDataRequest();
return this;
}
public int getCode() {
return code;
}
public BasicPageModel setCode(int code) {
this.code = code;
return this;
}
public String getMsg() {
return msg;
}
public BasicPageModel setMsg(String msg) {
this.msg = msg;
return this;
}
public Object getResult() {
return result;
}
public BasicPageModel setResult(Object result) {
this.result = result;
return this;
}
public void setTid(String tid) {
this.tid = tid;
}
public String getTid() {
return tid;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
}
@@ -9,6 +9,11 @@ package com.fangjia.open.model;
*/
public class CommunitySummaryRequestDto extends FangjiaApiModel {
/**
* Ð¡ÇøID
*/
private String id;
/**
* ³ÇÊÐ
*/
@@ -86,4 +91,12 @@ public class CommunitySummaryRequestDto extends FangjiaApiModel {
public void setMemo(String memo) {
this.memo = memo;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
@@ -0,0 +1,344 @@
package com.fangjia.open.model;
import java.util.Date;
import java.util.List;
/**
* 小区周边配套
*/
public class DistrictFacilitysModel {
private static final long serialVersionUID = -9200383212669643823L;
private String id;
private String city;
private String region;
private String districtName;
private List<String> kindergarten;
private List<String> primarySchool;
private List<String> middleSchool;
private List<String> university;
private List<String> hospital;
private List<String> shop;
private List<String> supermarket;
private List<String> foodShop;
private List<String> bus;
private List<String> metro;
private List<String> bank;
private List<String> atm;
private String innerFacilities;
private String carSite;
private String carSiteDes;
private Double trafficScore;
private Double hospitalScore;
private Double shopScore;
private Double schoolScore;
private Double bankScore;
private Date creationDate;
private List<String> positives; // 正面
private List<String> negatives; // 负面
private List<String> appraisalNegative; // 负面
private List<String> appraisalPositive; // 正面
/**
* 鏍囩�寰楀垎
*/
private Double traScore;
private Double virScore;
private Double aroScore;
private Double tradScore;
private String imgUrl3D;
private List<String> school;
private List<String> keySchool;
public String getCity() {
return city;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public void setCity(String city) {
this.city = city;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getDistrictName() {
return districtName;
}
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
public List<String> getKindergarten() {
return kindergarten;
}
public void setKindergarten(List<String> kindergarten) {
this.kindergarten = kindergarten;
}
public List<String> getPrimarySchool() {
return primarySchool;
}
public void setPrimarySchool(List<String> primarySchool) {
this.primarySchool = primarySchool;
}
public List<String> getMiddleSchool() {
return middleSchool;
}
public void setMiddleSchool(List<String> middleSchool) {
this.middleSchool = middleSchool;
}
public List<String> getUniversity() {
return university;
}
public void setUniversity(List<String> university) {
this.university = university;
}
public List<String> getHospital() {
return hospital;
}
public void setHospital(List<String> hospital) {
this.hospital = hospital;
}
public List<String> getShop() {
return shop;
}
public void setShop(List<String> shop) {
this.shop = shop;
}
public List<String> getSupermarket() {
return supermarket;
}
public void setSupermarket(List<String> supermarket) {
this.supermarket = supermarket;
}
public List<String> getFoodShop() {
return foodShop;
}
public void setFoodShop(List<String> foodShop) {
this.foodShop = foodShop;
}
public List<String> getBus() {
return bus;
}
public void setBus(List<String> bus) {
this.bus = bus;
}
public List<String> getMetro() {
return metro;
}
public void setMetro(List<String> metro) {
this.metro = metro;
}
public List<String> getBank() {
return bank;
}
public void setBank(List<String> bank) {
this.bank = bank;
}
public List<String> getAtm() {
return atm;
}
public void setAtm(List<String> atm) {
this.atm = atm;
}
public String getInnerFacilities() {
return innerFacilities;
}
public void setInnerFacilities(String innerFacilities) {
this.innerFacilities = innerFacilities;
}
public String getCarSite() {
return carSite;
}
public void setCarSite(String carSite) {
this.carSite = carSite;
}
public String getCarSiteDes() {
return carSiteDes;
}
public void setCarSiteDes(String carSiteDes) {
this.carSiteDes = carSiteDes;
}
public Double getTrafficScore() {
return trafficScore;
}
public void setTrafficScore(Double trafficScore) {
this.trafficScore = trafficScore;
}
public Double getHospitalScore() {
return hospitalScore;
}
public void setHospitalScore(Double hospitalScore) {
this.hospitalScore = hospitalScore;
}
public Double getShopScore() {
return shopScore;
}
public void setShopScore(Double shopScore) {
this.shopScore = shopScore;
}
public Double getSchoolScore() {
return schoolScore;
}
public void setSchoolScore(Double schoolScore) {
this.schoolScore = schoolScore;
}
public Double getBankScore() {
return bankScore;
}
public void setBankScore(Double bankScore) {
this.bankScore = bankScore;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public List<String> getPositives() {
return positives;
}
public void setPositives(List<String> positives) {
this.positives = positives;
}
public List<String> getNegatives() {
return negatives;
}
public void setNegatives(List<String> negatives) {
this.negatives = negatives;
}
public List<String> getAppraisalNegative() {
return appraisalNegative;
}
public void setAppraisalNegative(List<String> appraisalNegative) {
this.appraisalNegative = appraisalNegative;
}
public List<String> getAppraisalPositive() {
return appraisalPositive;
}
public void setAppraisalPositive(List<String> appraisalPositive) {
this.appraisalPositive = appraisalPositive;
}
public Double getTraScore() {
return traScore;
}
public void setTraScore(Double traScore) {
this.traScore = traScore;
}
public Double getVirScore() {
return virScore;
}
public void setVirScore(Double virScore) {
this.virScore = virScore;
}
public Double getAroScore() {
return aroScore;
}
public void setAroScore(Double aroScore) {
this.aroScore = aroScore;
}
public Double getTradScore() {
return tradScore;
}
public void setTradScore(Double tradScore) {
this.tradScore = tradScore;
}
public String getImgUrl3D() {
return imgUrl3D;
}
public void setImgUrl3D(String imgUrl3D) {
this.imgUrl3D = imgUrl3D;
}
public List<String> getSchool() {
return school;
}
public void setSchool(List<String> school) {
this.school = school;
}
public List<String> getKeySchool() {
return keySchool;
}
public void setKeySchool(List<String> keySchool) {
this.keySchool = keySchool;
}
}
@@ -13,6 +13,22 @@ public class HouseSearchModel extends SearchModel {
private String unitNo;
private Double size;
private Boolean showDetail;
private String city;
private String location;
private String locationType;
private String propertyType;
private String houseType;
private String district;
private String cat;
private Integer pageSize;
@Override
public QueryBean getQueryBean() {
HouseQueryBean queryBean = new HouseQueryBean();
@@ -125,4 +141,72 @@ public class HouseSearchModel extends SearchModel {
public void setId(String id) {
this.id = id;
}
@Override
public String getCity() {
return city;
}
@Override
public void setCity(String city) {
this.city = city;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getLocationType() {
return locationType;
}
public void setLocationType(String locationType) {
this.locationType = locationType;
}
public String getPropertyType() {
return propertyType;
}
public void setPropertyType(String propertyType) {
this.propertyType = propertyType;
}
public String getHouseType() {
return houseType;
}
public void setHouseType(String houseType) {
this.houseType = houseType;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getCat() {
return cat;
}
public void setCat(String cat) {
this.cat = cat;
}
@Override
public Integer getPageSize() {
return pageSize;
}
@Override
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

Some files were not shown because too many files have changed in this diff Show More