Merge remote-tracking branch 'origin/master'

This commit is contained in:
majintao
2024-09-03 10:20:15 +08:00
33 changed files with 1298 additions and 95 deletions
@@ -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,10 @@ 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;
@@ -22,6 +24,8 @@ 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;
@@ -73,6 +77,8 @@ public class ApiUserController {
private ApiInvokeStatisticalService apiInvokeStatisticalService;
private ApiVisitCountService apiVisitCountService;
private ApiCountCityService apiCountCityService;
private BkoffUsersService bkoffUsersService;
private ApiCountLogService apiCountLogService;
/**
* 所有api用户的信息展示
@@ -89,7 +95,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());
@@ -195,6 +215,8 @@ public class ApiUserController {
apiUser.setDeadTime(model.getDeadTime());
apiUser.setManager(model.getManager());
apiUser.setIsMonitor(model.getIsMonitor());
apiUser.setContact(model.getContact());
apiUser.setPhone(model.getPhone());
this.apiUserService.save(apiUser);
// 新增用户,默认挂牌价改为默认评估价
model.setPriceType("evaluate");
@@ -238,6 +260,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 +315,8 @@ 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());
this.apiUserService.update(dataApiUser, userId);
// 更改用户密码
// this.userService.updateById(user,userId);
@@ -677,6 +703,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 +719,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 +733,34 @@ 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);
authority.setTotalCountMap(totalCountMap);
}
if (model.getIsCheckCount() != null) {
@@ -1255,7 +1312,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 +1322,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++) {
@@ -2032,4 +2089,12 @@ public class ApiUserController {
model.setViewParam("location", "/apiUser/list");
return model;
}
public void setBkoffUsersService(BkoffUsersService bkoffUsersService) {
this.bkoffUsersService = bkoffUsersService;
}
public void setApiCountLogService(ApiCountLogService apiCountLogService) {
this.apiCountLogService = apiCountLogService;
}
}
@@ -33,9 +33,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());
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(), pager);
model.setDevelopmentZoneList(developmentZones);
model.setPager(pager);
return model;
@@ -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,10 @@ public class ApiUserModel extends BaseModel {
private Map<String,Double> priceRatingMap;
private Integer isMonitor;
private String contact;
private String phone;
public String getPriceType() {
return priceType;
}
@@ -70,7 +74,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;
@@ -378,15 +382,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 +619,20 @@ 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;
}
}
@@ -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>
@@ -75,15 +75,27 @@
</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 +104,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 +145,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();
}
@@ -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>
@@ -65,6 +70,9 @@
<th align="center" width="30%">
访问最大次数(每天)/(总数)
</th>
<th align="center" width="15%">
访问次数修改
</th>
<th align="center" width="10%">
是否按查得计费<input type="checkbox" id="isCheckCount" >全选</input>
</th>
@@ -98,12 +106,20 @@
&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:80px;" 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:80px;" 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 +127,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 +149,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>
@@ -97,15 +97,27 @@
</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>
@@ -128,7 +140,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 +176,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">API</option>
<option value="2">PDS</option>
<option value="4">房生活</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">正式账号</option>
<option value="1">测试账号</option>
<option value="2">内部账号</option>
</select>
</div>
<div class="form-group">
<label for="status" class="form-label">账号状态:</label>
<select name="status" class="form-select">
<option value="0">正常</option>
<option value="1">禁用</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>
@@ -21,6 +21,9 @@
<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>
@@ -71,7 +74,14 @@
</#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>
@@ -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' text="API次数日志" />
</ul>
</li>
@@ -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());
@@ -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>
@@ -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,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;
}
}
@@ -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
@@ -185,4 +189,22 @@ 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;
}
}
@@ -20,6 +20,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;
@@ -42,6 +43,7 @@ import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -78,14 +80,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 +123,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 {
@@ -265,20 +284,20 @@ 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);
@@ -513,7 +532,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 +545,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("非农")) {
@@ -675,27 +694,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 +969,7 @@ public class AddrSvcController {
* @param model
* @return
*/
@Deprecated
public Object addressAssociationAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
@@ -994,6 +1014,238 @@ 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>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("tjjProvinceCode"));
map.put("city", result.getString("city"));
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>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("mzbProvinceCode"));
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>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("tjjProvinceCode"));
map.put("city", result.getString("city"));
map.put("cityCode", result.getString("tjjCityCode"));
map.put("district", result.getString("district"));
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>();
map.put("id", result.getString("id"));
map.put("province", result.getString("province"));
map.put("provinceCode", result.getString("tjjProvinceCode"));
map.put("city", result.getString("city"));
map.put("cityCode", result.getString("tjjCityCode"));
map.put("district", result.getString("district"));
map.put("districtCode", result.getString("tjjDistrictCode"));
map.put("street", result.getString("street"));
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;
}
@@ -2134,6 +2134,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;
}
/**
* 楼盘评级
*
@@ -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;
}
}
@@ -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;
}
}
@@ -1,28 +1,16 @@
package com.fangjia.script.trade
import java.util.regex.Matcher
package com.fangjia.script.sync
import com.fangjia.core.Constants
import com.fangjia.script.BaseBatch;
import com.fangjia.script.BatchOwner
import com.fangjia.script.util.DateUtils;
import java.util.regex.Pattern
import org.apache.commons.lang.StringUtils;
import com.fangjia.core.util.StringUtil;
import com.fangjia.datastore.driver.DSCollection;
import com.fangjia.datastore.driver.DSCursor
import com.fangjia.datastore.driver.DataStore
import com.fangjia.script.util.DateUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection;
import com.mongodb.DBObject
import com.fangjia.script.util.MongoUtils;
import com.fangjia.core.util.MongoUtils;
import com.fangjia.script.Watcher;
import com.mongodb.Bytes
import org.apache.commons.io.FileUtils
/**
* ½«ÏßÉÏopen uriÊý¾Ýͬ²½µ½192.168.0.60ÉÏ
* @author gaojuan
@@ -31,7 +19,7 @@ import org.apache.commons.io.FileUtils
class CopyOpenUriLog extends BaseBatch{
static DBCollection DESC_OPEN = MongoUtils.getCollectionByName("business", "open_uri_log", "seawater.mongo.db.fangjia.com", 27020)
static DBCollection DESC_OPEN = MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log")
public static final DBCollection SOURCE_OPEN = MongoUtils.getCollectionByName("business", "open_uri_log", "log.mongo.db.fangjia.com", 52002)
static main(String[] args){
runBatch(new CopyOpenUriLog(), args)
@@ -0,0 +1,17 @@
package com.fangjia.service.mongo.fangjia;
import com.fangjia.dal.mongo.model.ApiCountLog;
import com.fangjia.dal.mongo.model.DevelopmentZone;
import org.sothis.core.util.Pager;
import java.util.List;
import java.util.Map;
/**
* Created by dxy on 2015/6/8.
*/
public interface ApiCountLogService {
void save(ApiCountLog apiCountLog);
List<ApiCountLog> findApiCountLog(Long userId,String uri,Pager pager);
}
@@ -0,0 +1,45 @@
package com.fangjia.service.mongo.fangjia;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.SortParam;
import com.fangjia.dal.mongo.dao.AdministrativeMappingDao;
import com.fangjia.dal.mongo.dao.ApiCountLogDao;
import com.fangjia.dal.mongo.dao.DevelopmentZoneDao;
import com.fangjia.dal.mongo.model.AdministrativeMapping;
import com.fangjia.dal.mongo.model.ApiCountLog;
import com.fangjia.dal.mongo.model.DevelopmentZone;
import org.apache.commons.lang.StringUtils;
import org.sothis.core.util.Pager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class ApiCountLogServiceImpl implements ApiCountLogService {
private ApiCountLogDao apiCountLogDao;
@Override
public void save(ApiCountLog apiCountLog) {
apiCountLogDao.save(apiCountLog);
}
@Override
public List<ApiCountLog> findApiCountLog(Long userId, String uri,Pager pager) {
List<QueryParam> params = new ArrayList<QueryParam>();
if (userId!= null) {
params.add(new QueryParam("userId", userId));
}
if (StringUtils.isNotBlank(uri)) {
Pattern pattern = Pattern.compile(".*" + uri + ".*");
params.add(new QueryParam("uri", pattern));
}
List<SortParam> sortParam = Arrays.asList(new SortParam("operateTime", false));
return apiCountLogDao.findAllByParams(params,sortParam, pager.getStartRow(), pager.getPageSize());
}
public void setApiCountLogDao(ApiCountLogDao apiCountLogDao) {
this.apiCountLogDao = apiCountLogDao;
}
}
@@ -51,9 +51,9 @@ public interface DevelopmentZoneService {
* @param pager
* @return
*/
public List<DevelopmentZone> findDevelopmentZone(String province,String name,String level, Pager pager);
public List<DevelopmentZone> findDevelopmentZone(String province,String city,String name,String level, Pager pager);
public long countDev(String province,String name,String level);
public long countDev(String province,String city ,String name,String level);
public List<String> findProvinces();
public List<String> findCities(String province);
@@ -41,12 +41,16 @@ public class DevelopmentZoneServiceImpl implements DevelopmentZoneService {
@Override
public List<DevelopmentZone> findDevelopmentZone(String province,String name,String level, Pager pager) {
public List<DevelopmentZone> findDevelopmentZone(String province,String city ,String name,String level, Pager pager) {
List<QueryParam> params = new ArrayList<QueryParam>();
if (StringUtils.isNotBlank(province)) {
Pattern pattern = Pattern.compile(".*" + province + ".*");
params.add(new QueryParam("province", pattern));
}
if (StringUtils.isNotBlank(city)) {
Pattern pattern = Pattern.compile(".*" + city + ".*");
params.add(new QueryParam("cityName1", pattern));
}
if (StringUtils.isNotBlank(name)) {
Pattern pattern = Pattern.compile(".*" + name + ".*");
@@ -61,12 +65,16 @@ public class DevelopmentZoneServiceImpl implements DevelopmentZoneService {
}
@Override
public long countDev(String province, String name,String level) {
public long countDev(String province,String city, String name,String level) {
List<QueryParam> params = new ArrayList<QueryParam>();
if (StringUtils.isNotBlank(province)) {
Pattern pattern = Pattern.compile(".*" + province + ".*");
params.add(new QueryParam("province", pattern));
}
if (StringUtils.isNotBlank(city)) {
Pattern pattern = Pattern.compile(".*" + city + ".*");
params.add(new QueryParam("cityName1", pattern));
}
if (StringUtils.isNotBlank(name)) {
Pattern pattern = Pattern.compile(".*" + name + ".*");
@@ -28,6 +28,10 @@ public class ApiUserBo implements Serializable {
private String priceType;
private Integer isMonitor;
private String contact; //联系人
private String phone; //联系人手机号
public String getPriceType() {
return priceType;
}
@@ -171,4 +175,20 @@ public class ApiUserBo implements Serializable {
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;
}
}
@@ -19,9 +19,13 @@ public class KafkaProducerUtils implements DisposableBean {
public KafkaProducerUtils() {
Properties properties = new Properties();
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "192.168.0.100:30092");
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "192.168.0.89:19092,192.168.0.90:19092,192.168.0.91:19092");
properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
properties.setProperty("session.timeout.ms", "15000");
properties.setProperty("sasl.mechanism", "PLAIN");
properties.setProperty("security.protocol", "SASL_PLAINTEXT");
properties.setProperty("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"admin\" password=\"Goojia123456\";");
this.producer = new KafkaProducer<String, String>(properties);
}