提交 4df9a8e1 authored 作者: malei's avatar malei

feat(DataLog): DistrictAnalysis

1.省份接口 References: N/A
上级 f74856e5
......@@ -2,12 +2,14 @@ package com.zrqx.statistics.bg.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zrqx.core.enums.statistics.ProvinceEnums;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.statistics.bg.service.DataLogService;
import com.zrqx.statistics.commons.form.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -89,4 +91,10 @@ public class DataLogController {
public CallBack<JSONObject> getLoyalty(QueryVisitorLoyaltyForm form) {
return CallBack.success(service.loadLoyaltyPolymerization(form));
}
@ApiOperation("省份列表")
@GetMapping("/province")
public CallBack<JSONObject> getProvince() {
return CallBack.success(new JSONObject(ProvinceEnums.getAllElementAsMap()));
}
}
package com.zrqx.core.enums.statistics;
import java.util.*;
import java.util.stream.Collectors;
public enum ProvinceEnums {
ALL("all", "全部",0),
CHINA("china", "全国",0),
OTHER("other", "其他",999),
PROVINCE_1("province,1", "北京", 1),
PROVINCE_2("province,2", "上海", 2),
PROVINCE_3("province,3", "天津", 3),
PROVINCE_4("province,4", "广东", 4),
PROVINCE_5("province,5", "福建", 5),
PROVINCE_8("province,8", "海南", 8),
PROVINCE_9("province,9", "安徽", 9),
PROVINCE_10("province,10", "贵州", 10),
PROVINCE_11("province,11", "甘肃", 11),
PROVINCE_12("province,12", "广西", 12),
PROVINCE_13("province,13", "河北", 13),
PROVINCE_14("province,14", "河南", 14),
PROVINCE_15("province,15", "黑龙江", 15),
PROVINCE_16("province,16", "湖北", 16),
PROVINCE_17("province,17", "湖南", 17),
PROVINCE_18("province,18", "吉林", 18),
PROVINCE_19("province,19", "江苏", 19),
PROVINCE_20("province,20", "江西", 20),
PROVINCE_21("province,21", "辽宁", 21),
PROVINCE_22("province,22", "内蒙古", 22),
PROVINCE_23("province,23", "宁夏", 23),
PROVINCE_24("province,24", "青海", 24),
PROVINCE_25("province,25", "山东", 25),
PROVINCE_26("province,26", "山西", 26),
PROVINCE_27("province,27", "陕西", 27),
PROVINCE_28("province,28", "四川", 28),
PROVINCE_29("province,29", "西藏", 29),
PROVINCE_30("province,30", "新疆", 30),
PROVINCE_31("province,31", "云南", 31),
PROVINCE_32("province,32", "浙江", 32),
PROVINCE_33("province,33", "重庆", 33),
PROVINCE_34("province,34", "香港", 34),
PROVINCE_35("province,35", "台湾", 35),
PROVINCE_36("province,36", "澳门", 36);
private String code;
private String name;
private Integer order;
ProvinceEnums(String code, String name, Integer order) {
this.code = code;
this.name = name;
this.order = order;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
public Integer getOrder() {
return order;
}
public static Map<String, Object> getAllElementAsMap() {
Map<String, Object> resultMap = new LinkedHashMap<>();
List<ProvinceEnums> enums = Arrays.asList(values()).stream()
.sorted(Comparator.comparing(ProvinceEnums::getOrder))
.collect(Collectors.toList());
enums.forEach(e -> {
resultMap.put(e.getCode(), e.getName());
});
return resultMap;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论