Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-05-08 13:52:49 +08:00
15 changed files with 216 additions and 17 deletions
@@ -38,6 +38,7 @@ public class SeawaterQuery {
private Integer radius;
private String level;
private List<String> tags;
public String getId() {
return id;
@@ -278,4 +279,12 @@ public class SeawaterQuery {
public void setLevel(String level) {
this.level = level;
}
public List<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
}
@@ -146,6 +146,14 @@ public class Evaluation implements MongoEntity {
* 楼层描述
*/
private String floorDesc;
/**
* 查询范围
*/
private Integer radius;
/**
* 商铺标签
*/
private String tags;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "_id")
@@ -1066,4 +1074,22 @@ public class Evaluation implements MongoEntity {
public void setFloorDesc(String floorDesc) {
this.floorDesc = floorDesc;
}
@Transient
public Integer getRadius() {
return radius;
}
public void setRadius(Integer radius) {
this.radius = radius;
}
@Transient
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
}
@@ -395,6 +395,24 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
if (source.containsKey("business_status")) {
seawater.setBusinessStatus(source.getString("business_status"));
}
if (source.containsKey("tags")) {
List<String> tagsList = new ArrayList<String>();
JSONArray jsonArray = source.getJSONArray("tags");
int size = jsonArray.size();
for (int n = 0; n < size; n++) {
tagsList.add(jsonArray.getString(n));
}
seawater.setTags(StringUtils.join(tagsList, ","));
}
if (source.containsKey("image_urls")) {
List<String> imageList = new ArrayList<String>();
JSONArray jsonArray = source.getJSONArray("image_urls");
int size = jsonArray.size();
for (int n = 0; n < size; n++) {
imageList.add(jsonArray.getString(n));
}
seawater.setImageUrls(StringUtils.join(imageList, ","));
}
try {
seawater.setDistance((int) jsonList.get(i).getJSONArray("sort").getDouble(0));
} catch (Exception e) {
@@ -780,6 +798,17 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
jsonList.add(temp);
}
if (query.getTags() != null && query.getTags().size() > 0) {
Set<String> tagsList = new LinkedHashSet<String>(query.getTags());
for (String tag : tagsList) {
JSONObject param = new JSONObject();
param.put("tags", tag);
JSONObject temp = new JSONObject();
temp.put("term", param);
jsonList.add(temp);
}
}
queryJson.put("must", jsonList);
ArrayList<JSONObject> filterList = new ArrayList<JSONObject>();
if (filter.size() > 0) {
@@ -104,6 +104,9 @@ public class Seawater implements SeawaterEntity {
private String businessStatus;
private String tags;
private String imageUrls;
@Id
@Column(name = "_id")
@@ -572,4 +575,22 @@ public class Seawater implements SeawaterEntity {
public void setBusinessStatus(String businessStatus) {
this.businessStatus = businessStatus;
}
@Column(name = "tags")
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
@Column(name = "image_urls")
public String getImageUrls() {
return imageUrls;
}
public void setImageUrls(String imageUrls) {
this.imageUrls = imageUrls;
}
}
@@ -18,6 +18,12 @@ public class SeawaterDto {
private String districtName;
private String tags;
private String imageUrls;
private String location;
public String getCity() {
return city;
}
@@ -113,4 +119,28 @@ public class SeawaterDto {
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getImageUrls() {
return imageUrls;
}
public void setImageUrls(String imageUrls) {
this.imageUrls = imageUrls;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
}
@@ -1653,7 +1653,7 @@ public class PropertyController {
if (district == null) {
//加上高德获取经纬度 和 根据经纬度估值
Map<String, String> map = GeoUtils.parserByGaode(model.getCity(), model.getAddress());
if (map.containsKey("level") && GAODE_LEVEL.contains(map.get("level"))
if (map != null && 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();
@@ -467,6 +467,15 @@ public class ShopController {
evaluation.setAge(model.getAge());
}
evaluation.setArea(model.getSize());
if (model.getRadius() != null) {
evaluation.setRadius(model.getRadius());
}
if (StringUtils.isNotBlank(model.getTags())) {
evaluation.setTags(model.getTags());
}
if (StringUtils.isNotBlank(model.getEstateType())) {
evaluation.setEstateType(model.getEstateType());
}
if (ArrayUtils.isNotEmpty(model.getBuildQuality())) {
evaluation.setBuildQuality(convertToString(model.getBuildQuality()));
}
@@ -467,6 +467,15 @@ public class ShopSellController {
evaluation.setAge(model.getAge());
}
evaluation.setArea(model.getSize());
if (model.getRadius() != null) {
evaluation.setRadius(model.getRadius());
}
if (StringUtils.isNotBlank(model.getTags())) {
evaluation.setTags(model.getTags());
}
if (StringUtils.isNotBlank(model.getEstateType())) {
evaluation.setEstateType(model.getEstateType());
}
if (ArrayUtils.isNotEmpty(model.getBuildQuality())) {
evaluation.setBuildQuality(convertToString(model.getBuildQuality()));
}
@@ -292,6 +292,8 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
private Integer level;
private Integer type;
private String tags;
public void setDecorationAge(int decorationAge) {
this.decorationAge = decorationAge;
}
@@ -942,4 +944,12 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
public void setType(Integer type) {
this.type = type;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
}
@@ -96,7 +96,7 @@ abstract class BaseBatch {
exception = true
e.printStackTrace()
__jms.monitor(batchName, '', extraData, e)
def msg = "脚本发生异常 BatchName:${batchName}\t"
def msg = "脚本发生异常错误 BatchName:${batchName}\t"
def batchOwner = getBatchOwner(batch)
if(batchOwner && batchOwner.size() > 0){
def owner = null
@@ -110,8 +110,9 @@ abstract class BaseBatch {
if(e){
msg += "\tException:" + e.getClass().name
}
def phoneNum = getBatchPhones(batch)
if(SystemUtils.IS_OS_LINUX){
sendDingDingMsg("2307d2fec8314b3e8b4b83dd1d42da2e2051638e3e668f21e77ca01258bf682c",msg)
sendDingDingMsg("ae14f50045e9375c354940a2afb86f14e453bd1f08f78da0ba6e788d35bccec4",msg, phoneNum)
try {
Map<String, String> params = new HashMap<String, String>();
@@ -174,6 +175,27 @@ abstract class BaseBatch {
return ret
}
static def getBatchPhones(BaseBatch bb) {
def phones = []
try {
BatchOwner annotation = AnnotationUtils.findAnnotation(bb.getClass(), BatchOwner.class)
if (annotation) {
annotation.value().each {
def map = it.toMap()
if (map?.mobile) {
phones << map.mobile
}
}
} else {
bb.logWarn('!!!请使用' + BatchOwner.class.getName() + '注解标明本Batch的拥有者!!!')
}
} catch (Exception e) {
bb.logWarn('!!!解析BatchOwner失败!!!', e)
}
return phones[0] ? phones[0] : ""
}
static def getBatchDescribe(BaseBatch bb){
try {
BatchOwner annotation = AnnotationUtils.findAnnotation(bb.getClass(), BatchOwner.class)
@@ -217,8 +239,8 @@ abstract class BaseBatch {
__jms.sendDingMsg(mobile, msg)
}
def static sendDingDingMsg(String token, String msg){
DingDingMessageUtil.sendTextMessage(token, msg);
def static sendDingDingMsg(String token, String msg, String phoneNum){
DingDingMessageUtil.sendTextMessageAndAt(token, msg, phoneNum);
}
// def static getProp(String key){
@@ -1,5 +1,6 @@
package com.fangjia.script.dataAna
import com.fangjia.core.util.DataUtil
import com.fangjia.core.util.DateUtil
import com.fangjia.datastore.driver.DSCursor
import com.fangjia.script.BaseBatch
@@ -225,7 +225,7 @@ class AutoAddOfficeBatch extends BaseBatch {
}
def repeatDist(){
def citys = CommonDatautils.findAllCity()
def citys = ["南京"]//CommonDatautils.findAllCity().reverse()
def allrets = []
allrets << [ "城市", "区域", "名称", "别名","计算方式","地址","名称相似度","地址相似度","总相似度"]
def index = 0
@@ -241,7 +241,7 @@ class AutoAddOfficeBatch extends BaseBatch {
println "${index}"+ c +" 运A行完成 "+rets.size()
if (CommonDatautils.isWindow()) {
ExcelUtils.write("D://数据//小区/重复可疑小区-${c}.xlsx", allrets, "数据")
ExcelUtils.write("D://数据//小区//重复可疑小区-${c}.xlsx", allrets, "数据")
}else{
ExcelUtils.write("/home/goojia/gj/重复可疑小区-${c}.xlsx", allrets, "数据")
}
@@ -289,7 +289,7 @@ class AutoAddOfficeBatch extends BaseBatch {
if(similar.alias){
ailas_str = similar.alias.join(",")
}
def newPriceMap = fjwPriceMap.get(o1._id.toString())
def newPriceMap = fjwPriceMap.get(similar._id.toString())
def new_price = null
if(newPriceMap){
new_price = newPriceMap.calc_type
@@ -147,8 +147,9 @@ class SeaweedDataSynch extends BaseBatch{
def run(){
fullCityMap = CommonDatautils.queryFullNameCity()
println "城市全称加载完成"
mcaDistMap = CommonDatautils.queryDistNameCityByMapping()
println "民政部加载完成"
priceMap = findAllDistrictSellPrice()
def citys = CommonDatautils.findAllCity()
def index = 0
@@ -342,6 +343,9 @@ class SeaweedDataSynch extends BaseBatch{
map.region = distData.district
area_code = distData.mca_district_code
}else{
if(["东莞市","中山市","济源市","仙桃市","潜江市","天门市","神农架林区","五指山市","琼海市","文昌市","万宁市","东方市","定安县","屯昌县","澄迈县","临高县","白沙黎族自治县","昌江黎族自治县","乐东黎族自治县","陵水黎族自治县","保亭黎族苗族自治县","琼中黎族苗族自治县","五指山市","琼海市","文昌市","万宁市","东方市","定安县","屯昌县","澄迈县","临高县","白沙黎族自治县","昌江黎族自治县","乐东黎族自治县","陵水黎族自治县","保亭黎族苗族自治县","琼中黎族苗族自治县","石河子市","阿拉尔市","图木舒克市","五家渠市","北屯市","铁门关市","双河市","可克达拉市","昆玉市","胡杨河市","新星市","白杨市","嘉峪关市"].contains(map.city)){
map.region = map.city
}
// map.region = dist.region
println dist.city +" "+dist.region+" 民政部中没有找到相应的区域全称"
}
@@ -43,8 +43,13 @@ class ApiInvokeStatistics extends BaseBatch{
def getYestodayLog(Date today,Date yestoday){
//Date today = getToday();
//Date yestoday = getNextDay(today)
def deleteQuery = new BasicDBObject("statistical_date", yestoday)
OPEN_URI_LOG_COUNT.remove(deleteQuery)
println "ÒÑɾ³ý ${yestoday.format('yyyy-MM-dd')} µÄ¾Éͳ¼ÆÊý¾Ý"
BasicDBObject query= new BasicDBObject("c_date", new BasicDBObject('$gte',yestoday).append('$lt', today))
DBCursor dbc=OPEN_URI_LOG.find(query).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
// DBCursor dbc=OPEN_URI_LOG.find(query).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
DBCursor dbc = OPEN_URI_LOG.find(query, new BasicDBObject("res_map", 0)).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
def results = [:]
int c = 0
dbc.each {BasicDBObject log->
@@ -103,11 +108,12 @@ class ApiInvokeStatistics extends BaseBatch{
obj.append("total_time",total_time)
obj.append("statistical_date",yestoday)
obj.append("user_name",companyName)
DBObject qu = new BasicDBObject();
qu.append("user_id", userIDStr);
qu.append("request_uri", uri);
qu.append("statistical_date", yestoday)
OPEN_URI_LOG_COUNT.update(qu, new BasicDBObject('$set', obj), true, true);
// DBObject qu = new BasicDBObject();
// qu.append("user_id", userIDStr);
// qu.append("request_uri", uri);
// qu.append("statistical_date", yestoday)
// OPEN_URI_LOG_COUNT.update(qu, new BasicDBObject('$set', obj), true, true);
OPEN_URI_LOG_COUNT.insert(obj)
}
@@ -223,6 +223,9 @@ public class AiShopServiceImpl implements AiShopService {
seawaterDto.setFloorInfo(seawater.getFloorInfo());
seawaterDto.setAddress(seawater.getAddress());
seawaterDto.setDistrictName(seawater.getDistrictName());
seawaterDto.setTags(seawater.getTags());
seawaterDto.setImageUrls(seawater.getImageUrls());
seawaterDto.setLocation(seawater.getLocation());
return seawaterDto;
}
@@ -318,7 +321,17 @@ public class AiShopServiceImpl implements AiShopService {
query.setLat(lat);
query.setLng(lng);
query.setCat("shop_rent");
query.setRadius(1000);
if (evaluation.getRadius() != null && evaluation.getRadius() > 0) {
query.setRadius(evaluation.getRadius());
} else {
query.setRadius(1000);
}
if (StringUtils.isNotBlank(evaluation.getEstateType())) {
query.setEstateType(evaluation.getEstateType());
}
if (StringUtils.isNotBlank(evaluation.getTags())) {
query.setTags(Arrays.asList(evaluation.getTags().split(",")));
}
// 查询近一年样本
query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")));
query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd")));
@@ -371,7 +384,17 @@ public class AiShopServiceImpl implements AiShopService {
query.setLat(lat);
query.setLng(lng);
query.setCat("shop_sell");
query.setRadius(1000);
if (evaluation.getRadius() != null && evaluation.getRadius() > 0) {
query.setRadius(evaluation.getRadius());
} else {
query.setRadius(1000);
}
if (StringUtils.isNotBlank(evaluation.getEstateType())) {
query.setEstateType(evaluation.getEstateType());
}
if (StringUtils.isNotBlank(evaluation.getTags())) {
query.setTags(Arrays.asList(evaluation.getTags().split(",")));
}
// 查询近一年样本
query.setStartDate(Integer.parseInt(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd")));
query.setEndDate(Integer.parseInt(DateUtil.formatByPattern(new Date(), "yyyyMMdd")));