广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package cn.huge.module.kind.controller.wechat;
 
import cn.huge.base.common.constant.GzRegionBaseEnum;
import cn.huge.base.common.utils.*;
import cn.huge.module.kind.domain.po.SyRegion;
import cn.huge.module.kind.service.SyRegionService;
import cn.huge.module.utils.BaiduMapAddrDTO;
import cn.huge.module.utils.BaiduMapUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
 
/**
 * @title: 地域表接口api-小程序端
 * @description: 地域表接口api-小程序端
 * @company: hugeinfo
 * @author: wangwh
 * @time: 2024-09-04 16:48:57
 * @version: 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/api/wechat/syRegion")
public class SyregionWechatController {
 
    @Autowired(required = false)
    private HttpServletRequest request;
 
    @Autowired
    private SyRegionService service;
 
    /**
     * 根据百度地图经纬度获取街道
     * @url {ctx}/api/wechat/syRegion/checkRegisterArea
     * @param lng 经度
     * @param lat 维度
     * @return
     */
    @GetMapping("/checkRegisterArea")
    public Object checkRegisterArea(@RequestParam(value = "lng") String lng, @RequestParam(value = "lat") String lat) {
        try {
            //经纬度转换
            PointXY pointXY = MapUtils.gcj02tobd09(Double.valueOf(lng), Double.valueOf(lat));
            BaiduMapAddrDTO baiduMapAddrDTO = BaiduMapUtils.getAddrByLngLat(String.valueOf(pointXY.getLon()), String.valueOf(pointXY.getLat()), BaiduMapUtils.coordtype_bd09ll);
            QueryWrapper<SyRegion> syRegionQueryWrapper = new QueryWrapper<>();
            // 查询区
            syRegionQueryWrapper.clear();
            syRegionQueryWrapper.like("name", baiduMapAddrDTO.getDistrict());
            SyRegion district = service.getOne(syRegionQueryWrapper);
            if (ObjectUtils.isNotEmpty(district)) {
                if (GzRegionBaseEnum.AREA_7.getIndex().equals(district.getId())) {
                    return ReturnSucUtils.getRepInfo(true);
                } else {
                    return ReturnSucUtils.getRepInfo("反映诉求服务目前仅支持纠纷发生地为白云区内的申请。", false);
                }
            }else {
                return ReturnSucUtils.getRepInfo("反映诉求服务目前仅支持纠纷发生地为白云区内的申请。", false);
            }
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
}