From b44435a0b9b65b225eb092bde9bdc458fe9308cd Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 11 Nov 2024 18:57:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=B0=8F=E5=8C=BA?= =?UTF-8?q?=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gj/data_handle/DistrictRepeatBatch.groovy | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DistrictRepeatBatch.groovy diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DistrictRepeatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DistrictRepeatBatch.groovy new file mode 100644 index 000000000..3fb5a0d48 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/DistrictRepeatBatch.groovy @@ -0,0 +1,68 @@ +package com.fangjia.script.gj.data_handle + +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.util.CosineSimilarAlgorithm +import com.fangjia.script.util.ExcelUtils + +/** + * 查找重复小区 + */ +class DistrictRepeatBatch { + + static main(args) { + def task = new DistrictRepeatBatch() + task.run() + } + + def run(){ + def rets = [] + rets << ["id","城市","区域", "名称", "物业类型", "地址", "备注", "id(重复)","城市(重复)","区域(重复)", "名称(重复)", "物业类型(重复)", "地址(重复)", "相似度"] + def citys = CommonDatautils.findAllCity() + def index = 0 + for(def city : citys){ + index++ + def districts = CommonDatautils.findAllDistricts(city, "district", ["city", "region", "name", "address","estate_type2","lat", "lng"]) + def rows = findRepeatByEstateType(districts) + rets.addAll(rows) + println "【${index}】 "+city +" 完成比对" + } + + ExcelUtils.write("D:\\数据\\小区重复数据处理.xlsx", rets, "小区") + } + + def findRepeatByEstateType(districts){ + def rows = [] + def ids = [] + for(def d1 : districts){ + if(ids.contains(d1._id.toString())){ + continue + } + for(def d2 : districts){ + if(d1._id.toString() == d2._id.toString()){ + continue + } + if(d1.estate_type2!=d2.estate_type2){ + continue + } + def d1_name = d1.name.replace("别墅", "").replace("商住楼", "").replace("商住", "").replace("小区", "") + def d2_name = d2.name.replace("别墅", "").replace("商住楼", "").replace("商住", "").replace("小区", "") + if(d1_name != d2_name){ + continue + } + + + def key1 = d1.region+"-"+d1_name+"-"+d1.address + def key2 = d2.region+"-"+d2_name+"-"+d2.address + def score = CosineSimilarAlgorithm.getSimilarityRatio(key1, key2); + if(score>0.9){ + ids << d1._id.toString() + ids << d2._id.toString() + rows << [d1._id.toString(), d1.city, d1.region, d1.name, d1.estate_type2, d1.address, "物业类型", d2._id.toString(), d2.city, d2.region, d2.name, d2.estate_type2, d2.address, score] + println d1.region +" "+d1.name +" "+d1.address +" 重复数据("+d2.region+" "+d2.name+" "+d2.address+") score:"+score + } + } + } + return rows; + } + +} From 3050a67d884ae5eee120e88782bb4ae45879508b Mon Sep 17 00:00:00 2001 From: majintao Date: Tue, 12 Nov 2024 18:08:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9EAPICode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bkoff/controllers/ApiUserController.java | 3 +- .../controllers/OpenResourceController.java | 22 +++++++-- .../bkoff/model/OpenResourceModel.java | 19 ++++++++ .../src/main/webapp/apiUser/auth.ftl | 46 ++++++++++++------- .../src/main/webapp/openResource/doAdd.ftl | 7 +++ .../src/main/webapp/openResource/doUpdate.ftl | 5 ++ .../src/main/webapp/openResource/list.ftl | 45 ++++++++++++------ .../com/fangjia/service/open/AuthorityBo.java | 22 +++++++-- 8 files changed, 128 insertions(+), 41 deletions(-) diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java index 6e85874c7..01093e983 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/ApiUserController.java @@ -623,7 +623,8 @@ public class ApiUserController { * @param AuthorityBo * :用户的appKey username、等资料 */ - List openResourceList = openResourceService.findAll(); + List queryParams = Arrays.asList(new QueryParam("pubStatus", 1)); + List openResourceList = openResourceService.findOpenResource(queryParams); List authorityBoList = new ArrayList(); ApiUserAuthority authority = apiUserAuthorityService.findByUserId(model.getUserId()); if (authority == null) { diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/OpenResourceController.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/OpenResourceController.java index 65eff39c5..ce5fc7904 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/OpenResourceController.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/OpenResourceController.java @@ -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 = this.openResourceService.findOpenResource(null); + HashSet apiCodeSet = new HashSet(); + 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 data = new HashMap(); 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 params = new ArrayList(); params.add(new QueryParam("uri", uri)); params.add(new QueryParam("name", name)); @@ -141,7 +153,7 @@ public class OpenResourceController { /** * 格式化URI - * + * * @param uri * @return */ diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/OpenResourceModel.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/OpenResourceModel.java index 2f867b209..321e3f0ac 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/OpenResourceModel.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/model/OpenResourceModel.java @@ -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; + } } diff --git a/projects/fangjia-bkoff/src/main/webapp/apiUser/auth.ftl b/projects/fangjia-bkoff/src/main/webapp/apiUser/auth.ftl index 100afe5b8..23d09901d 100644 --- a/projects/fangjia-bkoff/src/main/webapp/apiUser/auth.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/apiUser/auth.ftl @@ -35,6 +35,11 @@ top: 0; background-color: #f2f2f2; } + .resizable-td { + resize: horizontal; /* 鍏佽姘村钩璋冩暣澶у皬 */ + overflow: auto; /* 鏄剧ず婊氬姩鏉′互渚挎煡鐪嬭秴鍑洪儴鍒� */ + min-width: 50px; /* 璁剧疆鏈�灏忓搴︼紝闃叉杩囦簬缂╁皬 */ + } @@ -58,28 +63,33 @@ API鏁伴噺锛� ${authorityBoList?size}涓� - + + APICode + + uri - + API鍚嶇О - - 鏄惁鏈夋潈闄�鍏ㄩ�� + + 鏄惁鏈夋潈闄�
+ 鍏ㄩ�� - + 璁块棶鏈�澶ф鏁�(姣忓ぉ)/(鎬绘暟) - + 璁块棶娆℃暟淇敼 - - 鏄惁鎸夋煡寰楄璐�鍏ㄩ�� + + 鏄惁鎸夋煡寰楄璐�
+ 鍏ㄩ�� - + 璁¤垂娆℃暟(褰撳ぉ)/(鍘嗗彶) - + 鎿嶄綔 @@ -88,10 +98,13 @@ <#list authorityBoList as bo> + ${bo.apiCode!} + + ${bo.uri!} - + ${bo.name!} @@ -99,16 +112,15 @@ <#if bo.limitCountMap?? && bo.limitCountMap[bo.uri!]??> - + <#else> - + - -   / + / <#if bo.totalCountMap?? && bo.totalCountMap[bo.uri!]??> - + <#else> - + diff --git a/projects/fangjia-bkoff/src/main/webapp/openResource/doAdd.ftl b/projects/fangjia-bkoff/src/main/webapp/openResource/doAdd.ftl index 548a17f9d..482cfcfeb 100644 --- a/projects/fangjia-bkoff/src/main/webapp/openResource/doAdd.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/openResource/doAdd.ftl @@ -23,6 +23,7 @@ table{text-align: left;}
+ @@ -32,6 +33,12 @@ table{text-align: left;} + + +
APICode
鍚嶇О
URI
璇存槑
鏄惁瀵瑰 + + +
diff --git a/projects/fangjia-bkoff/src/main/webapp/openResource/doUpdate.ftl b/projects/fangjia-bkoff/src/main/webapp/openResource/doUpdate.ftl index c578a2214..5464ae225 100644 --- a/projects/fangjia-bkoff/src/main/webapp/openResource/doUpdate.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/openResource/doUpdate.ftl @@ -24,6 +24,11 @@ table{text-align: left;} + diff --git a/projects/fangjia-bkoff/src/main/webapp/openResource/list.ftl b/projects/fangjia-bkoff/src/main/webapp/openResource/list.ftl index 629c14ec4..72424c8fb 100644 --- a/projects/fangjia-bkoff/src/main/webapp/openResource/list.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/openResource/list.ftl @@ -47,8 +47,8 @@
APICode<#if apiCode != 0> + + <#else> + +
鍚嶇О
URI
璇存槑
- - + - +<#-- --> @@ -74,7 +77,7 @@ <#list ors as or> +<#-- --> @@ -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) { diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/open/AuthorityBo.java b/projects/fangjia-service/src/main/java/com/fangjia/service/open/AuthorityBo.java index 7b29385d9..4b58254a6 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/open/AuthorityBo.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/open/AuthorityBo.java @@ -32,6 +32,10 @@ public class AuthorityBo implements Serializable { private long curVisitedCount; private long totalVisitedCount; private Integer isCheckCount;//是否按查得计费 1:是 ,0:否 + + private int pubStatus; + + private int apiCode; public Map getResourceAuthorityMap() { return resourceAuthorityMap; @@ -158,7 +162,19 @@ public class AuthorityBo implements Serializable { this.totalVisitedCount = totalVisitedCount; } - - - + public int getPubStatus() { + return pubStatus; + } + + public void setPubStatus(int pubStatus) { + this.pubStatus = pubStatus; + } + + public int getApiCode() { + return apiCode; + } + + public void setApiCode(int apiCode) { + this.apiCode = apiCode; + } } From f3585f66c43f097b04675923cc35d5005f1f3c0c Mon Sep 17 00:00:00 2001 From: majintao Date: Tue, 12 Nov 2024 18:40:02 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=B0=E5=A2=9EAPICode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/mongo/open/model/OpenResource.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/OpenResource.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/OpenResource.java index fff320ac5..e0f519223 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/OpenResource.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/open/model/OpenResource.java @@ -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; + } }
- ID + + APICode 鍚嶇О @@ -56,15 +56,18 @@ URI + 鐩戞帶杩斿洖缁撴灉 + 鏄惁瀵瑰 + 璇存槑 - 鏄惁鏈夊瓧鏉冮檺 - --> +<#-- 鏄惁鏈夊瓧鏉冮檺--> +<#-- 鎿嶄綔
- ${or.id} + ${or.apiCode!} ${or.name!} @@ -86,17 +89,20 @@ checked id="jk_${or.id}" - ${or.description!} + checked id="pub_${or.id}" - <#if or.hasSubResource> - 鏈� - <#else> - 鏃� - + ${or.description!} --> +<#-- <#if or.hasSubResource>--> +<#-- 鏈�--> +<#-- <#else>--> +<#-- 鏃�--> +<#-- --> +<#-- - 鍒犻櫎   + 鍒犻櫎 缂栬緫 淇濆瓨