涉农结果导入
This commit is contained in:
@@ -178,6 +178,11 @@
|
||||
<version>1.0.0</version>
|
||||
<classifier>jdk18</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.fangjia.bkoff.controllers;
|
||||
|
||||
import com.fangjia.bkoff.model.AverageStatisticsModel;
|
||||
import com.fangjia.bkoff.model.JsonModel;
|
||||
import com.fangjia.bkoff.model.VillageIdentifyModel;
|
||||
import com.fangjia.bkoff.util.ExcelUtils;
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.mongo.model.VillageIdentify;
|
||||
import com.fangjia.service.mongo.fangjia.VillageIdentifyService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.core.util.Pager;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.interceptors.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
public class VillageIdentifyController {
|
||||
private VillageIdentifyService villageIdentifyService;
|
||||
|
||||
public Object importResultAction(VillageIdentifyModel model) {
|
||||
Pager pager = model.getPager(25);
|
||||
pager.setTotalRows(villageIdentifyService.count(model.getVillageType(), model.getCity1(), model.getAddress()));
|
||||
model.setVillageIdentifyList(villageIdentifyService.findAll(model.getVillageType(), model.getCity1(), model.getAddress(), pager));
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object uploadAction(HttpServletRequest request) throws IOException {
|
||||
Object fileInputStream = ActionContext.getContext().getParameters().get("fileInputStream")[0];
|
||||
JsonModel ret = new JsonModel();
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
Map<String, List> dataMap = ExcelUtils.read((InputStream) fileInputStream, 0, 0);
|
||||
List<List<String>> addressList = dataMap.get("data");
|
||||
List<List<String>> headers = dataMap.get("header");
|
||||
|
||||
if (!("涉农类型".equals(headers.get(0)) && "地址".equals(headers.get(2)))) {
|
||||
data.put("msg", "模板错误");
|
||||
} else if (addressList.size() > 100000) {
|
||||
data.put("msg", "该批次数据量超过100000条");
|
||||
} else {
|
||||
//模板正确,数据不超过100000,开始处理数据
|
||||
for (List<String> row : addressList) {
|
||||
|
||||
Map<String, Object> updata = new HashMap<String, Object>();
|
||||
// 创建一个包含所有key的list
|
||||
List<String> keys = Arrays.asList(
|
||||
"villageType", "cityParam", "address", "province", "provinceCode",
|
||||
"city1", "cityCode", "district", "districtCode", "town", "townCode",
|
||||
"committee", "committeeCode", "type", "typeCode", "verifyFlag", "addrVerify",
|
||||
"countyGov", "countyLevelCity", "administrativeTowns", "devDistrict",
|
||||
"devDistrictName", "devLevel", "addrArea"
|
||||
);
|
||||
|
||||
// 遍历keys list并从row中获取相应的值放入updata中
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
if (i < row.size() && StringUtils.isNotBlank(row.get(i))) {
|
||||
updata.put(keys.get(i), row.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
// 处理特定情况: cityParam
|
||||
String cityParam = "";
|
||||
if (StringUtils.isNotBlank(row.get(1))) {
|
||||
cityParam = row.get(1);
|
||||
updata.put("cityParam", cityParam);
|
||||
}
|
||||
|
||||
// 添加createTime
|
||||
updata.put("createTime", new Date());
|
||||
List<QueryParam> queryParams = new ArrayList<QueryParam>();
|
||||
queryParams.add(new QueryParam("address", updata.get("address")));
|
||||
if ("" != cityParam) {
|
||||
queryParams.add(new QueryParam("cityParam", cityParam));
|
||||
}
|
||||
queryParams.add(new QueryParam("villageType", updata.get("villageType")));
|
||||
// 保存/更新
|
||||
villageIdentifyService.updateByparams(updata, queryParams);
|
||||
}
|
||||
data.put("msg", "保存成功");
|
||||
}
|
||||
|
||||
|
||||
ret.setJsonModel(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setVillageIdentifyService(VillageIdentifyService villageIdentifyService) {
|
||||
this.villageIdentifyService = villageIdentifyService;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.fangjia.bkoff.interceptor;
|
||||
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||
import org.sothis.core.beans.Bean;
|
||||
import org.sothis.core.beans.Scope;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.ActionInvocation;
|
||||
import org.sothis.web.mvc.ActionInvocationException;
|
||||
import org.sothis.web.mvc.Interceptor;
|
||||
import org.sothis.web.mvc.interceptors.HttpMultipartException;
|
||||
import org.sothis.web.mvc.interceptors.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* ÎļþÉÏ´«À¹½ØÆ÷
|
||||
* @author wenyan
|
||||
*/
|
||||
@Bean(scope = Scope.SINGLETON)
|
||||
public class FileUploadInterceptor implements Interceptor {
|
||||
|
||||
public Object intercept(ActionInvocation invocation) throws ActionInvocationException {
|
||||
ActionContext context = invocation.getActionContext();
|
||||
HttpServletRequest request = context.getRequest();
|
||||
if (ServletFileUpload.isMultipartContent(request)) {
|
||||
try {
|
||||
context.setRequest(new MultipartHttpServletRequest(request));
|
||||
} catch (HttpMultipartException e) {
|
||||
throw new ActionInvocationException("error process multipart reqeust: ", e);
|
||||
}
|
||||
}
|
||||
return invocation.invoke();
|
||||
}
|
||||
|
||||
}
|
||||
+365
@@ -0,0 +1,365 @@
|
||||
package com.fangjia.bkoff.model;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fangjia.dal.mongo.model.Township;
|
||||
import com.fangjia.dal.mongo.model.VillageIdentify;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
public class VillageIdentifyModel extends BaseModel {
|
||||
private String province;
|
||||
private String city1;
|
||||
private String district;
|
||||
private String town;
|
||||
private String committee;
|
||||
private String type;
|
||||
private String provinceCode;
|
||||
private String cityCode;
|
||||
private String districtCode;
|
||||
private String townCode;
|
||||
private String committeeCode;
|
||||
private String typeCode;
|
||||
private String typeName;
|
||||
private String verifyFlag;//涉农标识
|
||||
private String addrVerify;//地址是否有效信息
|
||||
|
||||
private String countyLevelCity;//是否为县级市
|
||||
private String administrativeTowns;//是否市辖建制镇
|
||||
private String countyGov;//是否为县政府
|
||||
private String devDistrict;//是否为开发区
|
||||
private String devDistrictName;//开发区
|
||||
private String devLevel;//开发区等级
|
||||
|
||||
private Double lat;
|
||||
private Double lng;
|
||||
|
||||
private String addrArea;
|
||||
|
||||
|
||||
//测试时使用
|
||||
private String splitCommittee;
|
||||
private String splitStreet;
|
||||
private String poiName;
|
||||
private String splitStreetNum;
|
||||
private String dev;
|
||||
private String communitySource;//居委来源
|
||||
private String matchPoiName;//匹配poi的名称
|
||||
private String regionInfo;//围栏区域信息
|
||||
|
||||
private String tjjDistrictName;
|
||||
|
||||
private Date createTime;
|
||||
private String villageType;
|
||||
private MultipartFile file;
|
||||
private List<VillageIdentify> villageIdentifyList;
|
||||
private String address;
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity1() {
|
||||
return city1;
|
||||
}
|
||||
|
||||
public void setCity1(String city1) {
|
||||
this.city1 = city1;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getTown() {
|
||||
return town;
|
||||
}
|
||||
|
||||
public void setTown(String town) {
|
||||
this.town = town;
|
||||
}
|
||||
|
||||
public String getCommittee() {
|
||||
return committee;
|
||||
}
|
||||
|
||||
public void setCommittee(String committee) {
|
||||
this.committee = committee;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getProvinceCode() {
|
||||
return provinceCode;
|
||||
}
|
||||
|
||||
public void setProvinceCode(String provinceCode) {
|
||||
this.provinceCode = provinceCode;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getDistrictCode() {
|
||||
return districtCode;
|
||||
}
|
||||
|
||||
public void setDistrictCode(String districtCode) {
|
||||
this.districtCode = districtCode;
|
||||
}
|
||||
|
||||
public String getTownCode() {
|
||||
return townCode;
|
||||
}
|
||||
|
||||
public void setTownCode(String townCode) {
|
||||
this.townCode = townCode;
|
||||
}
|
||||
|
||||
public String getCommitteeCode() {
|
||||
return committeeCode;
|
||||
}
|
||||
|
||||
public void setCommitteeCode(String committeeCode) {
|
||||
this.committeeCode = committeeCode;
|
||||
}
|
||||
|
||||
public String getTypeCode() {
|
||||
return typeCode;
|
||||
}
|
||||
|
||||
public void setTypeCode(String typeCode) {
|
||||
this.typeCode = typeCode;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public String getVerifyFlag() {
|
||||
return verifyFlag;
|
||||
}
|
||||
|
||||
public void setVerifyFlag(String verifyFlag) {
|
||||
this.verifyFlag = verifyFlag;
|
||||
}
|
||||
|
||||
public String getAddrVerify() {
|
||||
return addrVerify;
|
||||
}
|
||||
|
||||
public void setAddrVerify(String addrVerify) {
|
||||
this.addrVerify = addrVerify;
|
||||
}
|
||||
|
||||
public String getCountyLevelCity() {
|
||||
return countyLevelCity;
|
||||
}
|
||||
|
||||
public void setCountyLevelCity(String countyLevelCity) {
|
||||
this.countyLevelCity = countyLevelCity;
|
||||
}
|
||||
|
||||
public String getAdministrativeTowns() {
|
||||
return administrativeTowns;
|
||||
}
|
||||
|
||||
public void setAdministrativeTowns(String administrativeTowns) {
|
||||
this.administrativeTowns = administrativeTowns;
|
||||
}
|
||||
|
||||
public String getCountyGov() {
|
||||
return countyGov;
|
||||
}
|
||||
|
||||
public void setCountyGov(String countyGov) {
|
||||
this.countyGov = countyGov;
|
||||
}
|
||||
|
||||
public String getDevDistrict() {
|
||||
return devDistrict;
|
||||
}
|
||||
|
||||
public void setDevDistrict(String devDistrict) {
|
||||
this.devDistrict = devDistrict;
|
||||
}
|
||||
|
||||
public String getDevDistrictName() {
|
||||
return devDistrictName;
|
||||
}
|
||||
|
||||
public void setDevDistrictName(String devDistrictName) {
|
||||
this.devDistrictName = devDistrictName;
|
||||
}
|
||||
|
||||
public String getDevLevel() {
|
||||
return devLevel;
|
||||
}
|
||||
|
||||
public void setDevLevel(String devLevel) {
|
||||
this.devLevel = devLevel;
|
||||
}
|
||||
|
||||
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 String getAddrArea() {
|
||||
return addrArea;
|
||||
}
|
||||
|
||||
public void setAddrArea(String addrArea) {
|
||||
this.addrArea = addrArea;
|
||||
}
|
||||
|
||||
public String getSplitCommittee() {
|
||||
return splitCommittee;
|
||||
}
|
||||
|
||||
public void setSplitCommittee(String splitCommittee) {
|
||||
this.splitCommittee = splitCommittee;
|
||||
}
|
||||
|
||||
public String getSplitStreet() {
|
||||
return splitStreet;
|
||||
}
|
||||
|
||||
public void setSplitStreet(String splitStreet) {
|
||||
this.splitStreet = splitStreet;
|
||||
}
|
||||
|
||||
public String getPoiName() {
|
||||
return poiName;
|
||||
}
|
||||
|
||||
public void setPoiName(String poiName) {
|
||||
this.poiName = poiName;
|
||||
}
|
||||
|
||||
public String getSplitStreetNum() {
|
||||
return splitStreetNum;
|
||||
}
|
||||
|
||||
public void setSplitStreetNum(String splitStreetNum) {
|
||||
this.splitStreetNum = splitStreetNum;
|
||||
}
|
||||
|
||||
public String getDev() {
|
||||
return dev;
|
||||
}
|
||||
|
||||
public void setDev(String dev) {
|
||||
this.dev = dev;
|
||||
}
|
||||
|
||||
public String getCommunitySource() {
|
||||
return communitySource;
|
||||
}
|
||||
|
||||
public void setCommunitySource(String communitySource) {
|
||||
this.communitySource = communitySource;
|
||||
}
|
||||
|
||||
public String getMatchPoiName() {
|
||||
return matchPoiName;
|
||||
}
|
||||
|
||||
public void setMatchPoiName(String matchPoiName) {
|
||||
this.matchPoiName = matchPoiName;
|
||||
}
|
||||
|
||||
public String getRegionInfo() {
|
||||
return regionInfo;
|
||||
}
|
||||
|
||||
public void setRegionInfo(String regionInfo) {
|
||||
this.regionInfo = regionInfo;
|
||||
}
|
||||
|
||||
public String getTjjDistrictName() {
|
||||
return tjjDistrictName;
|
||||
}
|
||||
|
||||
public void setTjjDistrictName(String tjjDistrictName) {
|
||||
this.tjjDistrictName = tjjDistrictName;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getVillageType() {
|
||||
return villageType;
|
||||
}
|
||||
|
||||
public void setVillageType(String villageType) {
|
||||
this.villageType = villageType;
|
||||
}
|
||||
|
||||
public MultipartFile getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(MultipartFile file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public List<VillageIdentify> getVillageIdentifyList() {
|
||||
return villageIdentifyList;
|
||||
}
|
||||
|
||||
public void setVillageIdentifyList(List<VillageIdentify> villageIdentifyList) {
|
||||
this.villageIdentifyList = villageIdentifyList;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.fangjia.bkoff.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcelFactory;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.eval.ErrorEval;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* excel读写工具类
|
||||
*
|
||||
* @author shenjian
|
||||
* @since 2021/07/12
|
||||
*/
|
||||
public class ExcelUtils {
|
||||
public static Map<String, List> read(InputStream inputStream, int sheetIndex, int skipRow) {
|
||||
// sheetIndex sheet下标
|
||||
// skipRow 跳过的表头行数
|
||||
Map<String, List> map = new HashMap<String, List>();
|
||||
List<List<String>> ret = new ArrayList<List<String>>();
|
||||
InputStream inp = null;
|
||||
try {
|
||||
inp = inputStream;
|
||||
BufferedInputStream bufferedInputStream = new BufferedInputStream(inp, 1024 * 200);
|
||||
Workbook workbook = WorkbookFactory.create(bufferedInputStream);
|
||||
workbook.setForceFormulaRecalculation(true);
|
||||
Sheet sheet = workbook.getSheetAt(sheetIndex);
|
||||
//行号
|
||||
int rowIndex = 0;
|
||||
for (Row row : sheet) {
|
||||
rowIndex++;
|
||||
if (rowIndex <= skipRow) {
|
||||
continue;
|
||||
}
|
||||
short minColIx = 0;
|
||||
short maxColIx = row.getLastCellNum();
|
||||
List<String> rowData = new ArrayList<String>();
|
||||
for (short colIx = minColIx; colIx < maxColIx; colIx++) {
|
||||
Cell cell = row.getCell(colIx);
|
||||
if (cell == null) {
|
||||
rowData.add(colIx, null);
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(cell.toString())) {
|
||||
rowData.add(getCellValue(cell).toString());
|
||||
}else {
|
||||
rowData.add("");
|
||||
}
|
||||
}
|
||||
}
|
||||
ret.add(rowData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inp != null) {
|
||||
try {
|
||||
inp.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("header", ret.subList(0, 1).get(0));
|
||||
map.put("data", ret.subList(1, ret.size()));
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Object getCellValue(Cell cell) {
|
||||
switch (cell.getCellType()) {
|
||||
case Cell.CELL_TYPE_BLANK:
|
||||
return null;
|
||||
case Cell.CELL_TYPE_BOOLEAN:
|
||||
return cell.getBooleanCellValue();
|
||||
case Cell.CELL_TYPE_ERROR:
|
||||
|
||||
return ErrorEval.getText(cell.getErrorCellValue());
|
||||
case Cell.CELL_TYPE_FORMULA:
|
||||
try {
|
||||
return cell.getNumericCellValue();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
return cell.getStringCellValue();
|
||||
} catch (Exception ex) {
|
||||
return cell.getRichStringCellValue().getString();
|
||||
}
|
||||
}
|
||||
case Cell.CELL_TYPE_NUMERIC:
|
||||
if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell)) {
|
||||
return cell.getDateCellValue();
|
||||
}
|
||||
return cell.getNumericCellValue();
|
||||
case Cell.CELL_TYPE_STRING:
|
||||
return cell.getStringCellValue();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SimpleExcelListener extends AnalysisEventListener {
|
||||
private List<List<String>> dataList = new ArrayList<List<String>>();
|
||||
private List<String> headers = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public void invoke(Object o, AnalysisContext analysisContext) {
|
||||
Map<String, String> map = (Map<String, String>) o;
|
||||
dataList.add(new ArrayList<String>(map.values()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invokeHeadMap(Map headMap, AnalysisContext context) {
|
||||
for (Object val : headMap.values()) {
|
||||
headers.add((String) val);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
|
||||
}
|
||||
|
||||
List<List<String>> getDataList() {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
void setDataList(List<List<String>> dataList) {
|
||||
this.dataList = dataList;
|
||||
}
|
||||
|
||||
public List<String> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public void setHeaders(List<String> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ sothis.viewResolver.class=org.sothis.web.mvc.DefaultModelAndViewResolver
|
||||
sothis.actionMapper.class=org.sothis.web.mvc.DefaultActionMapper
|
||||
|
||||
sothis.interceptors.params.class=org.sothis.web.mvc.interceptors.ParametersInterceptor
|
||||
sothis.interceptors.upload.class=org.sothis.web.mvc.interceptors.FileUploadInterceptor
|
||||
sothis.interceptors.upload.class=com.fangjia.bkoff.interceptor.FileUploadInterceptor
|
||||
sothis.interceptors.auth.class=com.fangjia.bkoff.interceptor.AuthInterceptor
|
||||
sothis.interceptors.stack.default=upload,params,auth
|
||||
|
||||
|
||||
@@ -294,6 +294,7 @@
|
||||
<@menuitem uri='/openUriLog/evaluateManages' text="估价可信度管理"/>
|
||||
<@menuitem uri='/creditRate/list' text="价格可信度与匹配率关系" />
|
||||
<@menuitem uri='/czBank/sampleLogs' text="浙商银行" />
|
||||
<@menuitem uri='/villageIdentify/importResult' text="涉农结果导入" />
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
<#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>涉农结果导入</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
<#include "/common_js.ftl"/>
|
||||
<style>
|
||||
thead tr th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.show {
|
||||
display: inner-block;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<#include "/layout/header.ftl"/>
|
||||
<div class="main-content">
|
||||
<div style="height:50px;background: #efefef;">
|
||||
<br/>
|
||||
<form name="file" id="file" method="post" enctype="multipart/form-data">
|
||||
<input id="files" type="file" name="file" accept="xls"/>
|
||||
<input id="batch" type="submit" value="批量导入"/>
|
||||
<a class="btn common_btn" href="expect">下载模板</a>
|
||||
</form>
|
||||
</div>
|
||||
<form action="../villageIdentify/importResult" id="_search_log_form">
|
||||
涉农类型:
|
||||
<select id="type" name="villageType" class="span4">
|
||||
<option value="对公">对公</option>
|
||||
<option value="对私">对私</option>
|
||||
</select>
|
||||
城市:
|
||||
<input style="width:80px;" name="city1" value="${city1!}" autocomplete="off"/>
|
||||
|
||||
地址:
|
||||
<input style="width:200px;" name="address" value="${address!}" autocomplete="off"/>
|
||||
<input id="queryBtn" type="submit" value="查询"/>
|
||||
</form>
|
||||
<div class="list">
|
||||
<#if villageIdentifyList??>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>涉农类型</th>
|
||||
<th>城市(参数)</th>
|
||||
<th>地址</th>
|
||||
<th>省份</th>
|
||||
<th>省份编码</th>
|
||||
<th>城市</th>
|
||||
<th>城市编码</th>
|
||||
<th>区县</th>
|
||||
<th>区县编码</th>
|
||||
<th>乡镇街道</th>
|
||||
<th>乡镇街道编码</th>
|
||||
<th>居委</th>
|
||||
<th>居委编码</th>
|
||||
<th>城乡属性</th>
|
||||
<th>城乡编码</th>
|
||||
<th>涉农标识</th>
|
||||
<th>地址验证</th>
|
||||
<th>是否县政府</th>
|
||||
<th>是否县级市</th>
|
||||
<th>是否市辖建制镇</th>
|
||||
<th>是否开发区</th>
|
||||
<th>开发区名称</th>
|
||||
<th>开发区级别</th>
|
||||
<th>所属区域</th>
|
||||
<th>时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if (villageIdentifyList??&&villageIdentifyList?size>0)>
|
||||
<#list villageIdentifyList as it>
|
||||
<tr>
|
||||
<td>${it.villageType!}</td>
|
||||
<td>${it.cityParam!}</td>
|
||||
<td>${it.address!}</td>
|
||||
<td>${it.province!}</td>
|
||||
<td>${it.provinceCode!}</td>
|
||||
<td>${it.city1!}</td>
|
||||
<td>${it.cityCode!}</td>
|
||||
<td>${it.district!}</td>
|
||||
<td>${it.districtCode!}</td>
|
||||
<td>${it.town!}</td>
|
||||
<td>${it.townCode!}</td>
|
||||
<td>${it.committee!}</td>
|
||||
<td>${it.committeeCode!}</td>
|
||||
<td>${it.type!}</td>
|
||||
<td>${it.typeCdoe!}</td>
|
||||
<td>${it.verifyFlag!}</td>
|
||||
<td>${it.addrVerify!}</td>
|
||||
<td>${it.countyGov!}</td>
|
||||
<td>${it.countyLevelCity!}</td>
|
||||
<td>${it.administrativeTowns!}</td>
|
||||
<td>${it.devDistrict!}</td>
|
||||
<td>${it.devDistrictName!}</td>
|
||||
<td>${it.devLevel!}</td>
|
||||
<td>${it.addrArea!}</td>
|
||||
<td>${it.createTime?string("yyyy-MM-dd")}</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</#if>
|
||||
<#if pager??>
|
||||
<@d_pager action = "base" currentPage = pager.currentPage controller = "villageIdentify" totalPages = pager.totalPages/>
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$('#batch').click(function () {
|
||||
var filename = $('#files').val();
|
||||
|
||||
if (filename == undefined || filename == "") {
|
||||
alert("未选择文件");
|
||||
return;
|
||||
} else {
|
||||
var x = filename.split(".");
|
||||
if (x[1] != "xlsx" && x[1] != "xls") {
|
||||
alert("文件名后缀非法");
|
||||
return;
|
||||
}
|
||||
}
|
||||
var file = new FormData($("#file")[0]);
|
||||
debugger
|
||||
$.ajax({
|
||||
url: '../villageIdentify/upload',
|
||||
type: 'POST',
|
||||
data: file,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
alert(JSON.parse(data).msg);
|
||||
// window.location.reload();
|
||||
},
|
||||
error: function (returndata) {
|
||||
alert("上传失败!");
|
||||
}
|
||||
});
|
||||
});
|
||||
var selectRegion = '${region!}'
|
||||
|
||||
function changeCity(display) {
|
||||
if (display) {
|
||||
$("#display").val(display);
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../district/getRegions',
|
||||
data: encodeURI("cityDisplay=" + display),
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function (model) {
|
||||
$("#region").empty();
|
||||
if (model.regionList.length > 0) {
|
||||
$("<option value=''>不限</option>").appendTo($("#region"));
|
||||
$.each(model.regionList, function (i, region) {
|
||||
var orgRegion = model.regionMap[region];
|
||||
if (selectRegion == region) {
|
||||
$("<option value='" + region + "' selected>" + orgRegion + "</option>").appendTo($("#region"));
|
||||
} else {
|
||||
$("<option value='" + region + "' >" + orgRegion + "</option>").appendTo($("#region"));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("th[order-field]").click(function () {
|
||||
$("#orderby").val($(this).attr("order-field"));
|
||||
var asc = $("#asc").val();
|
||||
if (asc === "true" || asc === "") {
|
||||
$("#asc").val(false)
|
||||
} else {
|
||||
$("#asc").val(true)
|
||||
}
|
||||
$("#queryBtn").trigger('click');
|
||||
});
|
||||
$("#_search_house_form").submit(function () {
|
||||
var colIds = []
|
||||
$("input[name='chkCol']").each(function () {
|
||||
if ($(this).prop("checked")) {
|
||||
colIds.push($(this).attr('id'));
|
||||
}
|
||||
});
|
||||
$("#columnIds").val(colIds.join("_"));
|
||||
});
|
||||
$("input[name='chkCol']").click(function () {
|
||||
if (!$(this).prop("checked")) {
|
||||
$("[name='" + $(this).attr('id') + "']").hide();
|
||||
} else {
|
||||
$("[name='" + $(this).attr('id') + "']").show();
|
||||
}
|
||||
|
||||
});
|
||||
changeCity('${cityDisplay!}');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.Township;
|
||||
import com.fangjia.dal.mongo.model.VillageIdentify;
|
||||
|
||||
public interface VillageIdentifyDao extends MongoDao<VillageIdentify> {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.model.Township;
|
||||
import com.fangjia.dal.mongo.model.VillageIdentify;
|
||||
|
||||
public class VillageIdentifyDaoImpl extends MongoDaoImpl<VillageIdentify> implements VillageIdentifyDao {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,442 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "fangjia.village_identify_result")
|
||||
public class VillageIdentify implements MongoEntity {
|
||||
@Id
|
||||
@JSONField(name = "_id")
|
||||
private String id;
|
||||
@JSONField(name = "address")
|
||||
private String address;
|
||||
@JSONField(name = "province")
|
||||
private String province;
|
||||
@JSONField(name = "city")
|
||||
private String city1;
|
||||
@JSONField(name = "city_param")
|
||||
private String cityParam;
|
||||
@JSONField(name = "district")
|
||||
private String district;
|
||||
@JSONField(name = "town")
|
||||
private String town;
|
||||
@JSONField(name = "committee")
|
||||
private String committee;
|
||||
@JSONField(name = "type")
|
||||
private String type;
|
||||
@JSONField(name = "province_code")
|
||||
private String provinceCode;
|
||||
@JSONField(name = "city_code")
|
||||
private String cityCode;
|
||||
@JSONField(name = "district_code")
|
||||
private String districtCode;
|
||||
@JSONField(name = "town_code")
|
||||
private String townCode;
|
||||
@JSONField(name = "committee_code")
|
||||
private String committeeCode;
|
||||
@JSONField(name = "type_code")
|
||||
private String typeCode;
|
||||
@JSONField(name = "type_name")
|
||||
private String typeName;
|
||||
@JSONField(name = "verify_flag")
|
||||
private String verifyFlag;//涉农标识
|
||||
@JSONField(name = "addr_verify")
|
||||
private String addrVerify;//地址是否有效信息
|
||||
|
||||
@JSONField(name = "county_level_city")
|
||||
private String countyLevelCity;//是否为县级市
|
||||
@JSONField(name = "administrative_towns")
|
||||
private String administrativeTowns;//是否市辖建制镇
|
||||
@JSONField(name = "county_gov")
|
||||
private String countyGov;//是否为县政府
|
||||
@JSONField(name = "dev_district")
|
||||
private String devDistrict;//是否为开发区
|
||||
@JSONField(name = "dev_district_name")
|
||||
private String devDistrictName;//开发区
|
||||
@JSONField(name = "dev_level")
|
||||
private String devLevel;//开发区等级
|
||||
|
||||
|
||||
@JSONField(name = "lat")
|
||||
private Double lat;
|
||||
@JSONField(name = "lng")
|
||||
private Double lng;
|
||||
|
||||
@JSONField(name = "addr_area")
|
||||
private String addrArea;
|
||||
|
||||
//测试时使用
|
||||
@JSONField(name = "split_committee")
|
||||
private String splitCommittee;
|
||||
@JSONField(name = "split_street")
|
||||
private String splitStreet;
|
||||
@JSONField(name = "poi_name")
|
||||
private String poiName;
|
||||
@JSONField(name = "split_street_num")
|
||||
private String splitStreetNum;
|
||||
@JSONField(name = "dev")
|
||||
private String dev;
|
||||
@JSONField(name = "community_source")
|
||||
private String communitySource;//居委来源
|
||||
@JSONField(name = "match_poi_name")
|
||||
private String matchPoiName;//匹配poi的名称
|
||||
@JSONField(name = "region_info")
|
||||
private String regionInfo;//围栏区域信息
|
||||
|
||||
@JSONField(name = "tjj_district_name")
|
||||
private String tjjDistrictName;
|
||||
@JSONField(name = "village_type")
|
||||
private String villageType;
|
||||
|
||||
@JSONField(name = "c_date")
|
||||
private Date createTime;
|
||||
|
||||
@Column(name = "address")
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Column(name = "province")
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
@Column(name = "city")
|
||||
public String getCity1() {
|
||||
return city1;
|
||||
}
|
||||
|
||||
public void setCity1(String city1) {
|
||||
this.city1 = city1;
|
||||
}
|
||||
|
||||
@Column(name = "district")
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
@Column(name = "town")
|
||||
public String getTown() {
|
||||
return town;
|
||||
}
|
||||
|
||||
public void setTown(String town) {
|
||||
this.town = town;
|
||||
}
|
||||
|
||||
@Column(name = "committee")
|
||||
public String getCommittee() {
|
||||
return committee;
|
||||
}
|
||||
|
||||
public void setCommittee(String committee) {
|
||||
this.committee = committee;
|
||||
}
|
||||
|
||||
@Column(name = "type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Column(name = "province_code")
|
||||
public String getProvinceCode() {
|
||||
return provinceCode;
|
||||
}
|
||||
|
||||
public void setProvinceCode(String provinceCode) {
|
||||
this.provinceCode = provinceCode;
|
||||
}
|
||||
|
||||
@Column(name = "city_code")
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
@Column(name = "district_code")
|
||||
public String getDistrictCode() {
|
||||
return districtCode;
|
||||
}
|
||||
|
||||
public void setDistrictCode(String districtCode) {
|
||||
this.districtCode = districtCode;
|
||||
}
|
||||
|
||||
@Column(name = "town_code")
|
||||
public String getTownCode() {
|
||||
return townCode;
|
||||
}
|
||||
|
||||
public void setTownCode(String townCode) {
|
||||
this.townCode = townCode;
|
||||
}
|
||||
|
||||
@Column(name = "committee_code")
|
||||
public String getCommitteeCode() {
|
||||
return committeeCode;
|
||||
}
|
||||
|
||||
public void setCommitteeCode(String committeeCode) {
|
||||
this.committeeCode = committeeCode;
|
||||
}
|
||||
|
||||
@Column(name = "type_code")
|
||||
public String getTypeCode() {
|
||||
return typeCode;
|
||||
}
|
||||
|
||||
public void setTypeCode(String typeCode) {
|
||||
this.typeCode = typeCode;
|
||||
}
|
||||
|
||||
@Column(name = "type_name")
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
@Column(name = "verify_flag")
|
||||
public String getVerifyFlag() {
|
||||
return verifyFlag;
|
||||
}
|
||||
|
||||
public void setVerifyFlag(String verifyFlag) {
|
||||
this.verifyFlag = verifyFlag;
|
||||
}
|
||||
|
||||
@Column(name = "addr_verify")
|
||||
public String getAddrVerify() {
|
||||
return addrVerify;
|
||||
}
|
||||
|
||||
public void setAddrVerify(String addrVerify) {
|
||||
this.addrVerify = addrVerify;
|
||||
}
|
||||
|
||||
@Column(name = "county_level_city")
|
||||
public String getCountyLevelCity() {
|
||||
return countyLevelCity;
|
||||
}
|
||||
|
||||
public void setCountyLevelCity(String countyLevelCity) {
|
||||
this.countyLevelCity = countyLevelCity;
|
||||
}
|
||||
|
||||
@Column(name = "administrative_town")
|
||||
public String getAdministrativeTowns() {
|
||||
return administrativeTowns;
|
||||
}
|
||||
|
||||
public void setAdministrativeTowns(String administrativeTowns) {
|
||||
this.administrativeTowns = administrativeTowns;
|
||||
}
|
||||
|
||||
@Column(name = "county_gov")
|
||||
public String getCountyGov() {
|
||||
return countyGov;
|
||||
}
|
||||
|
||||
public void setCountyGov(String countyGov) {
|
||||
this.countyGov = countyGov;
|
||||
}
|
||||
|
||||
@Column(name = "dev_district")
|
||||
public String getDevDistrict() {
|
||||
return devDistrict;
|
||||
}
|
||||
|
||||
public void setDevDistrict(String devDistrict) {
|
||||
this.devDistrict = devDistrict;
|
||||
}
|
||||
|
||||
@Column(name = "dev_district_name")
|
||||
public String getDevDistrictName() {
|
||||
return devDistrictName;
|
||||
}
|
||||
|
||||
public void setDevDistrictName(String devDistrictName) {
|
||||
this.devDistrictName = devDistrictName;
|
||||
}
|
||||
|
||||
@Column(name = "dev_level")
|
||||
public String getDevLevel() {
|
||||
return devLevel;
|
||||
}
|
||||
|
||||
public void setDevLevel(String devLevel) {
|
||||
this.devLevel = devLevel;
|
||||
}
|
||||
|
||||
@Column(name = "lat")
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
@Column(name = "lng")
|
||||
public Double getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public void setLng(Double lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
@Column(name = "addr_area")
|
||||
public String getAddrArea() {
|
||||
return addrArea;
|
||||
}
|
||||
|
||||
public void setAddrArea(String addrArea) {
|
||||
this.addrArea = addrArea;
|
||||
}
|
||||
|
||||
@Column(name = "split_committee")
|
||||
public String getSplitCommittee() {
|
||||
return splitCommittee;
|
||||
}
|
||||
|
||||
public void setSplitCommittee(String splitCommittee) {
|
||||
this.splitCommittee = splitCommittee;
|
||||
}
|
||||
|
||||
@Column(name = "split_street")
|
||||
public String getSplitStreet() {
|
||||
return splitStreet;
|
||||
}
|
||||
|
||||
public void setSplitStreet(String splitStreet) {
|
||||
this.splitStreet = splitStreet;
|
||||
}
|
||||
|
||||
@Column(name = "poi_name")
|
||||
public String getPoiName() {
|
||||
return poiName;
|
||||
}
|
||||
|
||||
public void setPoiName(String poiName) {
|
||||
this.poiName = poiName;
|
||||
}
|
||||
|
||||
@Column(name = "split_street_num")
|
||||
public String getSplitStreetNum() {
|
||||
return splitStreetNum;
|
||||
}
|
||||
|
||||
public void setSplitStreetNum(String splitStreetNum) {
|
||||
this.splitStreetNum = splitStreetNum;
|
||||
}
|
||||
|
||||
@Column(name = "dev")
|
||||
public String getDev() {
|
||||
return dev;
|
||||
}
|
||||
|
||||
public void setDev(String dev) {
|
||||
this.dev = dev;
|
||||
}
|
||||
|
||||
@Column(name = "community_source")
|
||||
public String getCommunitySource() {
|
||||
return communitySource;
|
||||
}
|
||||
|
||||
public void setCommunitySource(String communitySource) {
|
||||
this.communitySource = communitySource;
|
||||
}
|
||||
|
||||
@Column(name = "match_poi_name")
|
||||
public String getMatchPoiName() {
|
||||
return matchPoiName;
|
||||
}
|
||||
|
||||
public void setMatchPoiName(String matchPoiName) {
|
||||
this.matchPoiName = matchPoiName;
|
||||
}
|
||||
|
||||
@Column(name = "region_info")
|
||||
public String getRegionInfo() {
|
||||
return regionInfo;
|
||||
}
|
||||
|
||||
public void setRegionInfo(String regionInfo) {
|
||||
this.regionInfo = regionInfo;
|
||||
}
|
||||
|
||||
@Column(name = "tjj_district_name")
|
||||
public String getTjjDistrictName() {
|
||||
return tjjDistrictName;
|
||||
}
|
||||
|
||||
public void setTjjDistrictName(String tjjDistrictName) {
|
||||
this.tjjDistrictName = tjjDistrictName;
|
||||
}
|
||||
|
||||
@Column(name = "c_date")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Column(name = "_id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "village_type")
|
||||
public String getVillageType() {
|
||||
return villageType;
|
||||
}
|
||||
|
||||
public void setVillageType(String villageType) {
|
||||
this.villageType = villageType;
|
||||
}
|
||||
|
||||
@Column(name = "city_param")
|
||||
public String getCityParam() {
|
||||
return cityParam;
|
||||
}
|
||||
|
||||
public void setCityParam(String cityParam) {
|
||||
this.cityParam = cityParam;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.fangjia.service.mongo.fangjia;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.mongo.model.Township;
|
||||
import com.fangjia.dal.mongo.model.VillageIdentify;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by dxy on 2015/6/8.
|
||||
*/
|
||||
public interface VillageIdentifyService {
|
||||
void updateByparams(Map<String, Object> data, List<QueryParam> params);
|
||||
|
||||
int count(String villageType,String city1,String address);
|
||||
|
||||
List<VillageIdentify> findAll(String villageType,String city1,String address,Pager pager);
|
||||
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.fangjia.service.mongo.fangjia;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.mongo.dao.TownshipDao;
|
||||
import com.fangjia.dal.mongo.dao.VillageIdentifyDao;
|
||||
import com.fangjia.dal.mongo.model.Township;
|
||||
import com.fangjia.dal.mongo.model.VillageIdentify;
|
||||
import com.mongodb.BasicDBList;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class VillageIdentifyServiceImpl implements VillageIdentifyService {
|
||||
private VillageIdentifyDao villageIdentifyDao;
|
||||
|
||||
|
||||
@Override
|
||||
public void updateByparams(Map<String, Object> data, List<QueryParam> params) {
|
||||
villageIdentifyDao.updateByParams(data, params, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(String villageType, String city1, String address) {
|
||||
List<QueryParam> queryParams = new ArrayList<QueryParam>();
|
||||
if (StringUtils.isNotBlank(villageType)) {
|
||||
queryParams.add(new QueryParam("villageType", villageType));
|
||||
}else {
|
||||
queryParams.add(new QueryParam("villageType", "¶Ô¹«"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(city1)) {
|
||||
Pattern pattern = Pattern.compile(".*" + city1 + ".*");
|
||||
queryParams.add(new QueryParam("city1", pattern));
|
||||
}
|
||||
if (StringUtils.isNotBlank(address)) {
|
||||
Pattern pattern = Pattern.compile(".*" + address + ".*");
|
||||
queryParams.add(new QueryParam("address", pattern));
|
||||
}
|
||||
return (int) villageIdentifyDao.findCountByParams(queryParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VillageIdentify> findAll(String villageType, String city1, String address, Pager pager) {
|
||||
List<QueryParam> queryParams = new ArrayList<QueryParam>();
|
||||
if (StringUtils.isNotBlank(villageType)) {
|
||||
queryParams.add(new QueryParam("villageType", villageType));
|
||||
}else {
|
||||
queryParams.add(new QueryParam("villageType", "¶Ô¹«"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(city1)) {
|
||||
Pattern pattern = Pattern.compile(".*" + city1 + ".*");
|
||||
queryParams.add(new QueryParam("city1", pattern));
|
||||
}
|
||||
if (StringUtils.isNotBlank(address)) {
|
||||
Pattern pattern = Pattern.compile(".*" + address + ".*");
|
||||
queryParams.add(new QueryParam("address", pattern));
|
||||
}
|
||||
return villageIdentifyDao.findAllByParams(queryParams, pager.getStartRow(), pager.getPageSize());
|
||||
}
|
||||
|
||||
public void setVillageIdentifyDao(VillageIdentifyDao villageIdentifyDao) {
|
||||
this.villageIdentifyDao = villageIdentifyDao;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user