提交 6e2dc04c authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 6e156ab5
package com.zrqx.geography.bg.service.geographysign;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
......@@ -51,8 +53,8 @@ public class GeographysignServiceImpl extends BaseServiceImpl<Geographysign, Str
for (Geographysign geographysign : list) {
String path = geographysign.getProductName();
String path1 = null;
System.out.println(path.indexOf("(")+1);
path1 = path.substring(0,path.indexOf("("));
System.out.println(path.indexOf("(") + 1);
path1 = path.substring(0, path.indexOf("("));
System.out.println(path1);
String http = "https://baike.baidu.com/item/" + path1;
// 每条数据进行爬数据
......@@ -141,45 +143,91 @@ public class GeographysignServiceImpl extends BaseServiceImpl<Geographysign, Str
@Override
public CountyVo queryPunct(GeographyForm form) {
List<CountyTwoVo> list = mapper.querycity(form);
// 最后的list
List<CountyTwoVo> haveList = new ArrayList<CountyTwoVo>();
// 拆分出来的list
List<CountyTwoVo> chaList = new ArrayList<CountyTwoVo>();
CountyTwoVo vo = null;
for (int i = list.size() - 1; i >= 0; i--) {
CountyTwoVo s = list.get(i);
if (StringUtils.isNotBlank(s.getName())) {
System.out.println(s.getName());
String[] countys = s.getName().split("、");
if (countys.length <= 1) {
haveList.add(list.get(i));
continue;
}
for (String county : countys) {
vo = new CountyTwoVo();
vo.setName(county);
vo.setValue(list.get(i).getValue());
chaList.add(vo);
}
}
}
// 重复数据合并
for (int i = 0; i < chaList.size() - 1; i++) {
for (int j = chaList.size() - 1; j > i; j--) {
if (chaList.get(j).getName().equals(chaList.get(i).getName())) {
chaList.get(i).setValue(chaList.get(i).getValue() + chaList.get(j).getValue());
chaList.remove(j);
}
}
}
//数据合并
for (int i = 0; i < haveList.size() - 1; i++) {
for (int j = chaList.size() - 1; j >= 0; j--) {
System.out.println(chaList.get(j).getName());
System.out.println(haveList.get(i).getName());
System.out.println(chaList.get(j).getName().equals(haveList.get(i).getName()));
if (chaList.get(j).getName().equals(haveList.get(i).getName())) {
System.out.println();
haveList.get(i).setValue(haveList.get(i).getValue() + chaList.get(j).getValue());
chaList.remove(j);
}
}
}
haveList.addAll(chaList);
CountyVo countyVo = new CountyVo();
countyVo.setTable(list);
countyVo.setTable(haveList);
countyVo.setCount(mapper.queryIcon(form, null).toString());
countyVo.setRegioncount(this.getRegionCount(form));
return countyVo;
}
/**
* 查询包含多少地区,多个地区重复的去掉
*
* @param form
* @return
*/
private String getRegionCount(GeographyForm form){
private String getRegionCount(GeographyForm form) {
String result = "";
List<String> haveList = new ArrayList<String>();
List<Geographysign> list = mapper.getAllSign(form);
for(int i=list.size()-1;i>=0;i--){
for (int i = list.size() - 1; i >= 0; i--) {
Geographysign s = list.get(i);
if(StringUtils.isNotBlank(s.getCounty())){
if (StringUtils.isNotBlank(s.getCounty())) {
System.out.println(s.getCounty());
String[] countys = s.getCounty().split("、");
if(countys.length<=1){
if(!haveList.contains(countys[0]) ) {
if (countys.length <= 1) {
if (!haveList.contains(countys[0])) {
haveList.add(countys[0]);
}
continue;
}
for(String county : countys){
if(!haveList.contains(county)){
for (String county : countys) {
if (!haveList.contains(county)) {
haveList.add(county);
}
}
}
}
result = haveList.size()+"";
result = haveList.size() + "";
return result;
}
......@@ -189,18 +237,19 @@ public class GeographysignServiceImpl extends BaseServiceImpl<Geographysign, Str
String province = form.getProvince();
String city = form.getCity();
// 处理直辖市传区的问题
if(province !=null) {
if (province.equals("天津") || province.equals("北京") || province.equals("上海") || province.equals("重庆")) {
if (city != null) {
if ((province.equals("天津") || province.equals("北京") || province.equals("上海") || province.equals("重庆"))
&& (city.equals("天津市") || city.equals("北京市") || city.equals("上海市") || city.equals("重庆市"))) {
} else {
form.setCounty(form.getCity());
form.setCity(null);
if (province != null) {
if (province.equals("天津") || province.equals("北京") || province.equals("上海") || province.equals("重庆")) {
if (city != null) {
if ((province.equals("天津") || province.equals("北京") || province.equals("上海")
|| province.equals("重庆"))
&& (city.equals("天津市") || city.equals("北京市") || city.equals("上海市") || city.equals("重庆市"))) {
} else {
form.setCounty(form.getCity());
form.setCity(null);
}
}
}
}
}
// 省明细数据
List<Geographysign> list = mapper.provinceQuery(form);
......@@ -253,37 +302,36 @@ public class GeographysignServiceImpl extends BaseServiceImpl<Geographysign, Str
@Override
public List<Geographysign> imgsj() {
return mapper.imgsj();
return mapper.imgsj();
}
@Override
public List<ProvinceVo> geographySign(GeographyForm form) {
// 图标总和数据
List<ProvinceVo> ProvinceVo = new ArrayList<>();
List<ProvinceVo> ProvinceVo = new ArrayList<>();
ProvinceVo.add(mapper.querysign(form, "农产品地理标志"));
ProvinceVo.add(mapper.querysign(form, "原产地地理标志"));
ProvinceVo.add(mapper.querysign(form, "地理标志商标"));
return ProvinceVo;
}
@Override
public ProvinceTZVo diagram(GeographyForm form) {
ProvinceTZVo vo =new ProvinceTZVo();
//标准企业
ProvinceTZVo vo = new ProvinceTZVo();
// 标准企业
vo.setCaregorylist(mapper.diagram(form));
//核准企业
// 核准企业
vo.setApprovallist(mapper.diagramhz(form));
//日期
// 日期
vo.setApprovaldate(mapper.diagramdate(form));
return vo;
}
@Override
......@@ -293,50 +341,49 @@ public class GeographysignServiceImpl extends BaseServiceImpl<Geographysign, Str
@Override
public List<ProvinceVo> provincecount(GeographyForm form) {
if(StringUtils.isNotBlank(form.getProvince())) {
return mapper.provincecounty(form);
}else {
return mapper.provincecount(form);
if (StringUtils.isNotBlank(form.getProvince())) {
return mapper.provincecounty(form);
} else {
return mapper.provincecount(form);
}
}
@Override
public CategoryDateVo querycategory(GeographyForm form) {
CategoryDateVo category = new CategoryDateVo();
//查询品类
List<String> categoryall =mapper.categoryall();
//注册数量
// 查询品类
List<String> categoryall = mapper.categoryall();
// 注册数量
List<Integer> list = new ArrayList<>();
//核准数量
// 核准数量
List<Integer> hzlist = new ArrayList<>();
for (String category2 : categoryall) {
form.setCategoryOne(category2);
//注册数量
List<Integer> count=mapper.registerNumber(form);
if(count.size()>0) {
// 注册数量
List<Integer> count = mapper.registerNumber(form);
if (count.size() > 0) {
list.add(count.get(0));
}else {
list.add(0);
}
//核准数量
List<Integer> hzcount=mapper.approvalNumber(form);
if(hzcount.size()>0) {
} else {
list.add(0);
}
// 核准数量
List<Integer> hzcount = mapper.approvalNumber(form);
if (hzcount.size() > 0) {
hzlist.add(hzcount.get(0));
}else {
hzlist.add(0);
}
} else {
hzlist.add(0);
}
}
//品类类型
// 品类类型
category.setCategory(categoryall);
//品类注册数量
// 品类注册数量
category.setRegisterNumber(list);
//品类核准企业数量
// 品类核准企业数量
category.setApprovalNumber(hzlist);
return category;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论