From be3fa53cb64f8a93cd413964a14ec7e8bd57db95 Mon Sep 17 00:00:00 2001 From: TS-QD1 Date: Sat, 26 Aug 2023 15:59:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E6=A0=BC=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/map/count/MapCountController.java | 31 ++ .../map/count/MapCountRouteController.java | 37 ++ .../remote/client/ICaseRemoteService.java | 19 + .../impl/RoleUserSaveAfterHandlerImpl.java | 11 +- .../service/map/count/MapCountService.java | 26 ++ .../templates/map/count/map-count.html | 328 ++++++++++++++++++ 6 files changed, 451 insertions(+), 1 deletion(-) create mode 100644 src/main/java/cn/com/tenlion/usercenter/controller/api/map/count/MapCountController.java create mode 100644 src/main/java/cn/com/tenlion/usercenter/controller/route/map/count/MapCountRouteController.java create mode 100644 src/main/java/cn/com/tenlion/usercenter/remote/client/ICaseRemoteService.java create mode 100644 src/main/java/cn/com/tenlion/usercenter/service/map/count/MapCountService.java create mode 100644 src/main/resources/templates/map/count/map-count.html diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/api/map/count/MapCountController.java b/src/main/java/cn/com/tenlion/usercenter/controller/api/map/count/MapCountController.java new file mode 100644 index 0000000..60fcafe --- /dev/null +++ b/src/main/java/cn/com/tenlion/usercenter/controller/api/map/count/MapCountController.java @@ -0,0 +1,31 @@ +package cn.com.tenlion.usercenter.controller.api.map.count; + +import cn.com.tenlion.usercenter.service.map.count.MapCountService; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import ink.wgink.common.manager.env.EnvManager; +import ink.wgink.interfaces.consts.ISystemConstant; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(ISystemConstant.API_PREFIX + "/map/count") +public class MapCountController { + + @Autowired + private MapCountService mapCountService; + + @GetMapping("get-grid-person/{gridCode}") + JSONObject getGridPerson(@PathVariable("gridCode") String gridCode) { + return mapCountService.getGridPerson(gridCode); + } + + @GetMapping("list-grid-info/{gridCode}") + JSONArray listGridInfo(@PathVariable("gridCode") String gridCode) { + return mapCountService.listGridInfo(gridCode); + } + +} diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/route/map/count/MapCountRouteController.java b/src/main/java/cn/com/tenlion/usercenter/controller/route/map/count/MapCountRouteController.java new file mode 100644 index 0000000..64d3496 --- /dev/null +++ b/src/main/java/cn/com/tenlion/usercenter/controller/route/map/count/MapCountRouteController.java @@ -0,0 +1,37 @@ +package cn.com.tenlion.usercenter.controller.route.map.count; + +import ink.wgink.common.manager.env.EnvManager; +import ink.wgink.interfaces.consts.IGisConstant; +import ink.wgink.interfaces.consts.ISystemConstant; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/map/count") +public class MapCountRouteController { + + @GetMapping("map-count") + public ModelAndView mapCount() { + ModelAndView mv = new ModelAndView("map/count/map-count"); + setConfig(mv); + return mv; + } + + private void setConfig(ModelAndView modelAndView) { + EnvManager envManager = EnvManager.getInstance(); + Map baiduMapProperties = new HashMap<>(5); + baiduMapProperties.put("centerLng", envManager.getValue(IGisConstant.GIS_MAP_CENTER_LNG)); + baiduMapProperties.put("centerLat", envManager.getValue(IGisConstant.GIS_MAP_CENTER_LAT)); + baiduMapProperties.put("zoom", envManager.getValue(IGisConstant.GIS_MAP_CENTER_ZOOM)); + baiduMapProperties.put("boundary", envManager.getValue(IGisConstant.GIS_MAP_BAIDU_BOUNDARY)); + baiduMapProperties.put("ak", envManager.getValue(IGisConstant.GIS_MAP_BAIDU_AK)); + modelAndView.addObject("baiduMapProperties", baiduMapProperties); + } + +} diff --git a/src/main/java/cn/com/tenlion/usercenter/remote/client/ICaseRemoteService.java b/src/main/java/cn/com/tenlion/usercenter/remote/client/ICaseRemoteService.java new file mode 100644 index 0000000..ea0a032 --- /dev/null +++ b/src/main/java/cn/com/tenlion/usercenter/remote/client/ICaseRemoteService.java @@ -0,0 +1,19 @@ +package cn.com.tenlion.usercenter.remote.client; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import ink.wgink.annotation.rpc.rest.RemoteService; +import ink.wgink.annotation.rpc.rest.method.RemoteGetMethod; +import ink.wgink.annotation.rpc.rest.params.RemotePathParams; +import ink.wgink.annotation.rpc.rest.params.RemoteServerParams; + +@RemoteService +public interface ICaseRemoteService { + + @RemoteGetMethod("/app/populationreport/get-bygridcode/{gridCode}/release") + JSONObject getGridPerson(@RemoteServerParams String server, @RemotePathParams("gridCode") String gridCode); + + @RemoteGetMethod("app/placereport/listgridplacetype/{gridCode}/release") + JSONArray listGridInfo(@RemoteServerParams String server, @RemotePathParams("gridCode") String gridCode); + +} diff --git a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java index 388ef73..a6ac387 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/kafka/impl/RoleUserSaveAfterHandlerImpl.java @@ -12,10 +12,14 @@ import ink.wgink.interfaces.role.IRoleUserSaveAfterHandler; import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.service.role.service.IRoleUserService; import org.apache.commons.lang3.StringUtils; +import org.joda.time.Years; +import org.joda.time.format.DateTimeFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -78,6 +82,9 @@ public class RoleUserSaveAfterHandlerImpl implements IRoleUserSaveAfterHandler { dataMap.put("user_avatar", userExpandDTO.getUserAvatar()); dataMap.put("area_name", userExpandDTO.getAreaName()); dataMap.put("area_code", userExpandDTO.getAreaCode()); + dataMap.put("user_sex", userExpandDTO.getUserSexName()); + dataMap.put("user_birth", userExpandDTO.getUserBirth()); + dataMap.put("user_education", userExpandDTO.getUserEducationName()); syncDataDTO.setData(dataMap); kafkaTemplate.send(ISmartCityUserCenterConsts.KAFKA_TOPIC_TABLE_SYNC, JSONObject.toJSONString(syncDataDTO)); } @@ -111,9 +118,11 @@ public class RoleUserSaveAfterHandlerImpl implements IRoleUserSaveAfterHandler { if (userExpandPO != null) { dataMap.put("area_name", userExpandPO.getAreaName()); dataMap.put("area_code", userExpandPO.getAreaCode()); + dataMap.put("user_sex", userExpandPO.getUserSexName()); + dataMap.put("user_birth", userExpandPO.getUserBirth()); + dataMap.put("user_education", userExpandPO.getUserEducationName()); } syncDataDTO.setData(dataMap); kafkaTemplate.send(ISmartCityUserCenterConsts.KAFKA_TOPIC_TABLE_SYNC, JSONObject.toJSONString(syncDataDTO)); } - } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/map/count/MapCountService.java b/src/main/java/cn/com/tenlion/usercenter/service/map/count/MapCountService.java new file mode 100644 index 0000000..76aaca3 --- /dev/null +++ b/src/main/java/cn/com/tenlion/usercenter/service/map/count/MapCountService.java @@ -0,0 +1,26 @@ +package cn.com.tenlion.usercenter.service.map.count; + +import cn.com.tenlion.usercenter.remote.client.ICaseRemoteService; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import ink.wgink.common.manager.env.EnvManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class MapCountService { + + @Autowired + private ICaseRemoteService caseRemoteService; + + public JSONObject getGridPerson(String gridCode) { + String server = EnvManager.getInstance().getValue("clientCaseServer"); + return caseRemoteService.getGridPerson(server, gridCode); + } + + public JSONArray listGridInfo(String gridCode) { + String server = EnvManager.getInstance().getValue("clientCaseServer"); + return caseRemoteService.listGridInfo(server, gridCode); + } + +} diff --git a/src/main/resources/templates/map/count/map-count.html b/src/main/resources/templates/map/count/map-count.html new file mode 100644 index 0000000..5a52c78 --- /dev/null +++ b/src/main/resources/templates/map/count/map-count.html @@ -0,0 +1,328 @@ + + + + 网格地图 + + + + + + + + + + + +
+
+
+
+
+ + +
+ + +
+
+
+ +
+ +
+
+
+
+
+
+
+ + + + + + \ No newline at end of file