7 Ревизии 0da9dfe471 ... 14002442c1

Автор SHA1 Съобщение Дата
  limingming 14002442c1 api 百度地图AK改为用户提供的 преди 1 година
  limingming 912f75baee api 调整模板编辑商户可以为空,调整h5查询模板列表会同时查出该商户绑定的和未绑定任何商户的 преди 1 година
  limingming c9bf20b8c1 api 根据商户标识查询模板列表 преди 1 година
  limingming 58773b14e2 api 上报用户地址信息添加经纬度转换 后台 添加省份用户数量分布,修改根据省份查询用户列表 преди 1 година
  limingming b52bd405ca 后台 模板信息添加商户id преди 1 година
  limingming f345e7e888 后台 商户添加与列表查看 преди 1 година
  limingming a366d6d8a5 添加商户相关页面 преди 1 година
променени са 23 файла, в които са добавени 490 реда и са изтрити 15 реда
  1. 12 2
      rouyi-api/src/main/java/com/info666/infraredRemote/controller/GetDeviceInfoController.java
  2. 26 1
      rouyi-api/src/main/java/com/info666/infraredRemote/controller/UserLoginController.java
  3. 3 1
      rouyi-api/src/main/resources/application.yml
  4. 53 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/MerchantUserController.java
  5. 22 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/UserInfoController.java
  6. 18 0
      ruoyi-common/src/main/java/com/ruoyi/common/config/BaiduProperties.java
  7. 89 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/baiduMap/SearchHttpAK.java
  8. 58 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/MerchantUser.java
  9. 8 3
      ruoyi-system/src/main/java/com/ruoyi/system/domain/TemplateLibrary.java
  10. 20 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/UserAddress.java
  11. 12 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/UserInfo.java
  12. 16 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/DistributedVo.java
  13. 28 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/baiduMap/AddressComponent.java
  14. 19 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/baiduMap/Result.java
  15. 14 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/MerchantUserMapper.java
  16. 5 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserAddressMapper.java
  17. 14 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/MerchantUserService.java
  18. 10 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/UserAddressService.java
  19. 19 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MerchantUserServiceImpl.java
  20. 8 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserAddressServiceImpl.java
  21. 24 0
      ruoyi-system/src/main/resources/mapper/system/platform/MerchantUserMapper.xml
  22. 8 0
      ruoyi-system/src/main/resources/mapper/system/platform/UserAddressMapper.xml
  23. 4 3
      ruoyi-system/src/main/resources/mapper/system/platform/UserInfoMapper.xml

+ 12 - 2
rouyi-api/src/main/java/com/info666/infraredRemote/controller/GetDeviceInfoController.java

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.system.domain.BaseParam;
 import com.ruoyi.system.domain.BasicLibrary;
+import com.ruoyi.system.domain.MerchantUser;
 import com.ruoyi.system.domain.TemplateLibrary;
 import com.ruoyi.system.domain.vo.GetDeviceInfoVo;
 import com.ruoyi.system.service.BasicLibraryService;
+import com.ruoyi.system.service.MerchantUserService;
 import com.ruoyi.system.service.TemplateLibraryService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +34,9 @@ public class GetDeviceInfoController {
     @Autowired
     private TemplateLibraryService templateLibraryService;
 
+    @Autowired
+    private MerchantUserService merchantUserService;
+
     @ApiOperation("获取遥控设备信息")
     @PostMapping("/getDeviceInfo")
     public R<List<GetDeviceInfoVo>> getDeviceInfo(@RequestBody BaseParam param) {
@@ -63,10 +68,15 @@ public class GetDeviceInfoController {
      * 查询已启的模板库列表
      */
     @PostMapping("/getEnableTemplateList")
-    public R<List<TemplateLibrary>> getEnableTemplateList() {
+    public R<List<TemplateLibrary>> getEnableTemplateList(@RequestBody BaseParam param) {
+        MerchantUser one = merchantUserService.getOne(new LambdaQueryWrapper<MerchantUser>().eq(MerchantUser::getMerchantCode, param.getName()), false);
         List<TemplateLibrary> templateIPage = templateLibraryService.list(new LambdaQueryWrapper<TemplateLibrary>()
                 .eq(TemplateLibrary::getStatus, 0)
-                .eq(TemplateLibrary::getDelFlag, 0));
+                .eq(TemplateLibrary::getDelFlag, 0)
+                .isNull(TemplateLibrary::getMerchantId)
+                .or()
+                .eq(TemplateLibrary::getMerchantId, one.getId()));
+
         return R.ok(templateIPage);
     }
 

+ 26 - 1
rouyi-api/src/main/java/com/info666/infraredRemote/controller/UserLoginController.java

@@ -1,6 +1,9 @@
 package com.info666.infraredRemote.controller;
 
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.common.core.baiduMap.SearchHttpAK;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
@@ -8,8 +11,10 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.UserAddress;
 import com.ruoyi.system.domain.UserInfo;
 import com.ruoyi.system.domain.vo.SmsResponseVo;
+import com.ruoyi.system.domain.vo.baiduMap.Result;
 import com.ruoyi.system.service.UserAddressService;
 import com.ruoyi.system.service.UserInfoService;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -36,6 +41,9 @@ public class UserLoginController {
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private SearchHttpAK searchHttpAK;
+
     /**
      * 登录接口
      */
@@ -62,8 +70,25 @@ public class UserLoginController {
      * 上传用户地址
      */
     @PostMapping("/uploadAddress")
-    public R<SmsResponseVo> sendSms(@RequestBody UserAddress param) {
+    public R<T> uploadAddress(@RequestBody UserAddress param) throws Exception {
         UserInfo one = userInfoService.getOne(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserPhone, param.getUserPhone()),false);
+        if ( StringUtils.isEmpty(param.getLongitude()) || StringUtils.isEmpty(param.getLatitude())){
+            return R.fail("经纬度信息不能为空");
+        }
+        String data = searchHttpAK.convertIp(param.getLatitude()+","+param.getLongitude());
+        JSONObject json = JSON.parseObject(data);
+            Integer status = json.getInteger("status");
+        if (status != 0){
+            return R.fail("经纬度转换失败 状态码:{}"+status);
+        }
+        String result = json.getString("result");
+        Result detail = JSONObject.parseObject(result, Result.class);
+        param.setFormattedAddress(detail.getFormatted_address());
+        param.setProvince(detail.getAddressComponent().getProvince());
+        param.setCity(detail.getAddressComponent().getCity());
+        param.setDistrict(detail.getAddressComponent().getDistrict());
+        param.setTown(detail.getAddressComponent().getTown());
+        param.setStreet(detail.getAddressComponent().getStreet());
         param.setUserId(one.getId());
         param.setCreateTime(DateUtils.getNowDate());
         userAddressService.save(param);

+ 3 - 1
rouyi-api/src/main/resources/application.yml

@@ -159,4 +159,6 @@ aliyun:
     #短信模板
     templateCode: SMS_283430418
 
-
+#百度逆地理转换
+baidu:
+  AK: ItMxrFXSvbyKKbAsxPCfO2jwqvfWyaBh

+ 53 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/MerchantUserController.java

@@ -0,0 +1,53 @@
+package com.ruoyi.web.controller.platform;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.MerchantUser;
+import com.ruoyi.system.service.MerchantUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * 商户信息Controller
+ * 
+ * @author liming
+ * @date 2023-08-16
+ */
+@RestController
+@RequestMapping("/platform/v1/merchantUser")
+public class MerchantUserController extends BaseController {
+    @Autowired
+    private MerchantUserService merchantUserService;
+
+    /**
+     * 查询商户信息列表
+     */
+    @PostMapping("/allList")
+    public R<List<MerchantUser>> list() {
+        List<MerchantUser> list = merchantUserService.list();
+        return R.ok(list);
+    }
+
+
+    /**
+     * 新增商户信息
+     */
+    @PostMapping("/add")
+    public R<Boolean> add(@RequestBody MerchantUser param) {
+        if (param.getId() != null) {
+            param.setUpdateTime(DateUtils.getNowDate());
+        }else {
+            param.setCreateTime(DateUtils.getNowDate());
+            //随机生成6位商户标识
+            String uuid = UUID.randomUUID().toString().replace("-", "").substring(0, 6);
+            param.setMerchantCode(uuid);
+        }
+        return R.ok(merchantUserService.saveOrUpdate(param));
+
+    }
+
+}

+ 22 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/UserInfoController.java

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.BaseParam;
 import com.ruoyi.system.domain.UserAddress;
 import com.ruoyi.system.domain.UserInfo;
+import com.ruoyi.system.domain.vo.DistributedVo;
 import com.ruoyi.system.service.UserAddressService;
 import com.ruoyi.system.service.UserInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,9 +17,12 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * 用户信息Controller
- * 
+ *
  * @author liming
  * @date 2023-08-01
  */
@@ -35,9 +40,9 @@ public class UserInfoController extends BaseController {
      */
 //    @PreAuthorize("@ss.hasPermi('system:info:list')")
     @PostMapping("/list")
-    public R<IPage<UserInfo>> list(@RequestBody  BaseParam param) {
+    public R<IPage<UserInfo>> list(@RequestBody BaseParam param) {
         Page<UserInfo> page = new Page<>(param.getCurrent(), param.getSize());
-        IPage<UserInfo> userInfoIPage = userInfoService.getUserInfoList(page,null);
+        IPage<UserInfo> userInfoIPage = userInfoService.getUserInfoList(page, param.getName());
 //        IPage<UserInfo> userInfoIPage = userInfoService.page(new Page<UserInfo>().setCurrent(param.getCurrent()).setSize(param.getSize()),
 //                new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getDelFlag,0));
 
@@ -56,5 +61,19 @@ public class UserInfoController extends BaseController {
         return R.ok(userAddress);
     }
 
+    /**
+     * 获取用户省份人数统计信息
+     */
+    @PostMapping(value = "/distributed")
+    public R<HashMap<String, Integer>> distributed() {
+        HashMap<String, Integer> map = new HashMap<>();
+        List<DistributedVo> distributed = userAddressService.getProvince();
+        for (DistributedVo distributedVo : distributed) {
+            if (StringUtils.isNotEmpty(distributedVo.getProvince())){
+                map.put(distributedVo.getProvince(),distributedVo.getNumber());
+            }
+        }
+        return R.ok(map);
+    }
 
 }

+ 18 - 0
ruoyi-common/src/main/java/com/ruoyi/common/config/BaiduProperties.java

@@ -0,0 +1,18 @@
+package com.ruoyi.common.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author liming
+ * @date 2023/08/02
+ */
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "baidu")
+public class BaiduProperties {
+
+    private String AK;
+
+}

+ 89 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/baiduMap/SearchHttpAK.java

@@ -0,0 +1,89 @@
+
+package com.ruoyi.common.core.baiduMap;
+
+import com.ruoyi.common.config.BaiduProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+/**
+ * 选择了ak或使用IP白名单校验:
+ */
+@Component
+public class SearchHttpAK {
+    @Autowired
+    private BaiduProperties baiduProperties;
+
+    public static String URL = "https://api.map.baidu.com/reverse_geocoding/v3?";
+
+//    public static String AK = "bkclPNKHhZfdCXNoNVpvrFkYVVdvrzBG";
+
+
+    public String convertIp (String latitudeAndLongitude) throws Exception {
+
+        SearchHttpAK snCal = new SearchHttpAK();
+
+        String AK = baiduProperties.getAK();
+        Map<String, String> params = new LinkedHashMap<>();
+        params.put("ak", AK);
+        params.put("output", "json");
+        params.put("coordtype", "wgs84ll");
+        params.put("extensions_poi", "0");
+//        params.put("location", "3.90098,1.02223");
+        params.put("location", latitudeAndLongitude);
+
+
+        return snCal.requestGetAK(URL, params);
+    }
+
+    /**
+     * 默认ak
+     * 选择了ak,使用IP白名单校验:
+     * 根据您选择的AK已为您生成调用代码
+     * 检测到您当前的ak设置了IP白名单校验
+     * 您的IP白名单中的IP非公网IP,请设置为公网IP,否则将请求失败
+     * 请在IP地址为的计算发起请求,否则将请求失败
+     */
+    public String requestGetAK(String strUrl, Map<String, String> param) throws Exception {
+        if (strUrl == null || strUrl.length() <= 0 || param == null || param.size() <= 0) {
+            return "入参信息有误";
+        }
+
+        StringBuilder queryString = new StringBuilder();
+        queryString.append(strUrl);
+        for (Map.Entry<?, ?> pair : param.entrySet()) {
+            queryString.append(pair.getKey()).append("=");
+            //    第一种方式使用的 jdk 自带的转码方式  第二种方式使用的 spring 的转码方法 两种均可
+            //    queryString.append(URLEncoder.encode((String) pair.getValue(), "UTF-8").replace("+", "%20") + "&");
+            queryString.append(UriUtils.encode((String) pair.getValue(), "UTF-8")).append("&");
+        }
+
+        if (queryString.length() > 0) {
+            queryString.deleteCharAt(queryString.length() - 1);
+        }
+
+        java.net.URL url = new URL(queryString.toString());
+//        System.out.println(queryString.toString());
+        URLConnection httpConnection = (HttpURLConnection) url.openConnection();
+        httpConnection.connect();
+
+        InputStreamReader isr = new InputStreamReader(httpConnection.getInputStream());
+        BufferedReader reader = new BufferedReader(isr);
+        StringBuilder buffer = new StringBuilder();
+        String line;
+        while ((line = reader.readLine()) != null) {
+            buffer.append(line);
+        }
+        reader.close();
+        isr.close();
+        System.out.println("AK: " + buffer.toString());
+        return buffer.toString();
+    }
+}

+ 58 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/MerchantUser.java

@@ -0,0 +1,58 @@
+package com.ruoyi.system.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 商户信息对象 t_merchant_user
+ * 
+ * @author liming
+ * @date 2023-08-16
+ */
+@Data
+@TableName("t_merchant_user")
+public class MerchantUser implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /** 商户id */
+    @TableId( value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /** 商户名称 */
+    @Excel(name = "商户名称")
+    private String name;
+
+    /** 商户标识码 */
+    @Excel(name = "商户标识码")
+    private String merchantCode;
+
+    /** 状态(0使用中 1未使用) */
+    @Excel(name = "状态", readConverterExp = "0=使用中,1=未使用")
+    private String status;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private String delFlag;
+
+
+    /** 创建者 */
+    private String createBy;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新者 */
+    private String updateBy;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+}

+ 8 - 3
ruoyi-system/src/main/java/com/ruoyi/system/domain/TemplateLibrary.java

@@ -1,11 +1,10 @@
 package com.ruoyi.system.domain;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import lombok.Data;
+import org.apache.ibatis.type.JdbcType;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -29,6 +28,12 @@ public class TemplateLibrary implements Serializable {
     @Excel(name = "基础库id")
     private Long baseId;
 
+
+    /** 商户id */
+    @Excel(name = "商户di")
+    @TableField(updateStrategy = FieldStrategy.IGNORED,jdbcType = JdbcType.VARCHAR)
+    private Long merchantId;
+
     /** 模板名称 */
     @Excel(name = "模板名称")
     private String name;

+ 20 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserAddress.java

@@ -35,6 +35,26 @@ public class UserAddress implements Serializable {
     @Excel(name = "纬度")
     private String latitude;
 
+    /** 地址信息 */
+    @Excel(name = "地址信息")
+    private String formattedAddress;
+
+    /** 省 */
+    private String province;
+
+    /** 市 */
+    private String city;
+
+    /** 区 */
+    private String district;
+
+    /** 镇 */
+    private String town;
+
+    /** 街道 */
+    private String street;
+
+
     /** 删除标志(0代表存在 2代表删除) */
     private String delFlag;
 

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserInfo.java

@@ -70,5 +70,17 @@ public class UserInfo implements Serializable {
     @TableField(exist = false)
     private String positionTime;
 
+    /** 省 */
+    @TableField(exist = false)
+    private String province;
+
+    /** 市 */
+    @TableField(exist = false)
+    private String city;
+
+    /** 区 */
+    @TableField(exist = false)
+    private String district;
+
 
 }

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/DistributedVo.java

@@ -0,0 +1,16 @@
+package com.ruoyi.system.domain.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author: LiMingMing
+ * @Date: 2023/8/16 17:45
+ * @Description: TODO
+ **/
+@Data
+public class DistributedVo implements Serializable {
+    private String province;
+    private Integer number;
+}

+ 28 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/baiduMap/AddressComponent.java

@@ -0,0 +1,28 @@
+package com.ruoyi.system.domain.vo.baiduMap;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author: LiMingMing
+ * @Date: 2023/8/16 16:59
+ * @Description: TODO
+ **/
+@Data
+public class AddressComponent implements Serializable {
+    //省
+    private String province;
+
+    //市
+    private String city;
+
+    //区
+    private String district;
+
+    //镇
+    private String town;
+
+    //街道
+    private String street;
+}

+ 19 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/baiduMap/Result.java

@@ -0,0 +1,19 @@
+package com.ruoyi.system.domain.vo.baiduMap;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author: LiMingMing
+ * @Date: 2023/8/16 16:55
+ * @Description: TODO
+ **/
+@Data
+public class Result implements Serializable {
+    //整体地址信息
+    private String formatted_address;
+    //详细信息
+    private AddressComponent addressComponent;
+
+}

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/MerchantUserMapper.java

@@ -0,0 +1,14 @@
+package com.ruoyi.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.system.domain.MerchantUser;
+
+/**
+ * 商户信息Mapper接口
+ * 
+ * @author liming
+ * @date 2023-08-16
+ */
+public interface MerchantUserMapper extends BaseMapper<MerchantUser> {
+
+}

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserAddressMapper.java

@@ -2,8 +2,11 @@ package com.ruoyi.system.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.system.domain.UserAddress;
+import com.ruoyi.system.domain.vo.DistributedVo;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * 用户地址信息Mapper接口
  * 
@@ -13,4 +16,6 @@ import org.apache.ibatis.annotations.Param;
 public interface UserAddressMapper extends BaseMapper<UserAddress> {
 
     UserAddress getAddress(@Param("userId") Long userId);
+
+    List<DistributedVo> getProvince();
 }

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/MerchantUserService.java

@@ -0,0 +1,14 @@
+package com.ruoyi.system.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.system.domain.MerchantUser;
+
+/**
+ * 商户信息Service接口
+ * 
+ * @author limng
+ * @date 2023-08-16
+ */
+public interface MerchantUserService extends IService<MerchantUser> {
+
+}

+ 10 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/UserAddressService.java

@@ -2,6 +2,9 @@ package com.ruoyi.system.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.system.domain.UserAddress;
+import com.ruoyi.system.domain.vo.DistributedVo;
+
+import java.util.List;
 
 /**
  * 用户地址信息Service接口
@@ -10,10 +13,15 @@ import com.ruoyi.system.domain.UserAddress;
  * @date 2023-08-01
  */
 public interface UserAddressService extends IService<UserAddress> {
+
     /**
      * 根据用户id查询最新一条用户的地址信息
-     * @param id
-     * @return
      */
     UserAddress getAddress(Long userId);
+
+    /**
+     * 获取用户省份人数统计信息
+     */
+    List<DistributedVo> getProvince();
+
 }

+ 19 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MerchantUserServiceImpl.java

@@ -0,0 +1,19 @@
+package com.ruoyi.system.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.system.domain.MerchantUser;
+import com.ruoyi.system.mapper.MerchantUserMapper;
+import com.ruoyi.system.service.MerchantUserService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 商户信息Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-08-16
+ */
+@Service
+public class MerchantUserServiceImpl extends ServiceImpl<MerchantUserMapper, MerchantUser> implements MerchantUserService {
+
+
+}

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserAddressServiceImpl.java

@@ -2,11 +2,14 @@ package com.ruoyi.system.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.system.domain.UserAddress;
+import com.ruoyi.system.domain.vo.DistributedVo;
 import com.ruoyi.system.mapper.UserAddressMapper;
 import com.ruoyi.system.service.UserAddressService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 用户地址信息Service业务层处理
  * 
@@ -22,4 +25,9 @@ public class UserAddressServiceImpl  extends ServiceImpl<UserAddressMapper, User
     public UserAddress getAddress(Long userId) {
         return userAddressMapper.getAddress(userId);
     }
+
+    @Override
+    public List<DistributedVo> getProvince() {
+        return baseMapper.getProvince();
+    }
 }

+ 24 - 0
ruoyi-system/src/main/resources/mapper/system/platform/MerchantUserMapper.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.system.mapper.MerchantUserMapper">
+    
+    <resultMap type="MerchantUser" id="MerchantUserResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="merchantCode"    column="merchant_code"    />
+        <result property="status"    column="status"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectTMerchantUserVo">
+        select id, name, merchant_code, status, del_flag, create_by, create_time, update_by, update_time from t_merchant_user
+    </sql>
+
+
+</mapper>

+ 8 - 0
ruoyi-system/src/main/resources/mapper/system/platform/UserAddressMapper.xml

@@ -28,6 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY create_time DESC
             LIMIT 1
     </select>
+    <select id="getProvince" resultType="com.ruoyi.system.domain.vo.DistributedVo">
+        SELECT
+            province,
+            COUNT(DISTINCT user_id) AS number
+        FROM
+            `t_user_address`
+        GROUP BY province
+    </select>
 
 
 </mapper>

+ 4 - 3
ruoyi-system/src/main/resources/mapper/system/platform/UserInfoMapper.xml

@@ -18,11 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select id, user_phone, del_flag, create_by, create_time, update_by, update_time from t_user_info
     </sql>
     <select id="getUserInfoList" resultType="com.ruoyi.system.domain.UserInfo">
-        SELECT a.*, c.latitude, c.longitude, c.max_create_time AS positionTime
+        SELECT a.*, c.latitude, c.longitude, c.max_create_time AS positionTime,c.province,c.city,c.district
         FROM t_user_info a
-                 LEFT JOIN (
-            SELECT b.user_id, MAX(b.create_time) AS max_create_time, b.latitude, b.longitude
+                 RIGHT JOIN (
+            SELECT b.user_id, MAX(b.create_time) AS max_create_time, b.latitude, b.longitude,b.province,b.city,b.district
             FROM t_user_address b
+            WHERE b.province = #{param}
             GROUP BY b.user_id
         ) c ON a.id = c.user_id
         WHERE a.del_flag = 0