通过行政区划下载excel新增
parent
923fec495f
commit
d1ec716131
|
|
@ -18,6 +18,7 @@ import com.whdc.utils.ExcelCommon;
|
||||||
import com.whdc.utils.ResultJson;
|
import com.whdc.utils.ResultJson;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
|
|
@ -429,11 +430,13 @@ public class AddressBookController {
|
||||||
|
|
||||||
@ApiOperation(value = "通过行政区划下载excel")
|
@ApiOperation(value = "通过行政区划下载excel")
|
||||||
@GetMapping(value = "getExcel/{adnm}")
|
@GetMapping(value = "getExcel/{adnm}")
|
||||||
public void getExcel(@PathVariable("adnm") String adnm, HttpServletResponse response) {
|
public void getExcel(@PathVariable("adnm")
|
||||||
|
@ApiParam(value = "名称,all: 查询全部")
|
||||||
|
String adnm, HttpServletResponse response) {
|
||||||
|
|
||||||
// 查询全部标识
|
// 查询全部标识
|
||||||
if ("all".equals(adnm)) {
|
if ("all".equals(adnm)) {
|
||||||
adnm = null;
|
adnm = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AdcdTree> tree = adinfoService.tree(null, null);
|
List<AdcdTree> tree = adinfoService.tree(null, null);
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,34 @@ public class AdinfoController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getCountys/{adnm}")
|
||||||
|
@ApiOperation(value = "通过市名获取县")
|
||||||
|
public ResultJson<List<Adinfo>> getCountys(@PathVariable("adnm")
|
||||||
|
@ApiParam(value = "名称,all: 查询全部")
|
||||||
|
String adnm) {
|
||||||
|
|
||||||
|
// 查询全部标识
|
||||||
|
if ("all".equals(adnm)) {
|
||||||
|
adnm = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Adinfo one = service.lambdaQuery()
|
||||||
|
.like(Adinfo::getAdnm, adnm)
|
||||||
|
.one();
|
||||||
|
if (Objects.isNull(one)){
|
||||||
|
return ResultJson.error("当前行政区划不存在");
|
||||||
|
}
|
||||||
|
String adcd = one.getAdcd();
|
||||||
|
|
||||||
|
// 确保查的是县
|
||||||
|
List<Adinfo> list = service.lambdaQuery()
|
||||||
|
.likeRight(Adinfo::getAdcd, adcd.replace("00000000000", ""))
|
||||||
|
.likeLeft(Adinfo::getAdcd, "000000000")
|
||||||
|
.list();
|
||||||
|
return ResultJson.ok(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "添加")
|
@ApiOperation(value = "添加")
|
||||||
@PostMapping(value = "save")
|
@PostMapping(value = "save")
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -326,10 +329,27 @@ public class WarningController {
|
||||||
.collect(Collectors
|
.collect(Collectors
|
||||||
.groupingBy(WarningHistoryListVo::getEffectArea, Collectors.toList()));
|
.groupingBy(WarningHistoryListVo::getEffectArea, Collectors.toList()));
|
||||||
|
|
||||||
return getAdcdByWhlVo(tree, areaMap);
|
return setAll(getAdcdByWhlVo(tree, areaMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
return voList;
|
return setAll(voList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<WarningHistoryListVo> setAll( List<WarningHistoryListVo> vos){
|
||||||
|
if (CollectionUtils.isNotEmpty(vos)){
|
||||||
|
WarningHistoryListVo vo = new WarningHistoryListVo();
|
||||||
|
int oraSum = vos.stream().mapToInt(WarningHistoryListVo::getOraCount).sum();
|
||||||
|
vo.setOraCount(oraSum);
|
||||||
|
int redSum = vos.stream().mapToInt(WarningHistoryListVo::getRedCount).sum();
|
||||||
|
vo.setRedCount(redSum);
|
||||||
|
int bluSum = vos.stream().mapToInt(WarningHistoryListVo::getBluCount).sum();
|
||||||
|
vo.setBluCount(bluSum);
|
||||||
|
int yelSum = vos.stream().mapToInt(WarningHistoryListVo::getYelCount).sum();
|
||||||
|
vo.setYelCount(yelSum);
|
||||||
|
vo.setSumCount(oraSum + redSum + bluSum + yelSum);
|
||||||
|
vos.add(0,vo);
|
||||||
|
}
|
||||||
|
return vos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<WarningHistoryListVo> getAdcdByWhlVo(List<AdcdTree> tree, Map<String, List<WarningHistoryListVo>> areaMap) {
|
private List<WarningHistoryListVo> getAdcdByWhlVo(List<AdcdTree> tree, Map<String, List<WarningHistoryListVo>> areaMap) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue