lyhzzz 9 mēneši atpakaļ
vecāks
revīzija
fcf1794bc7
25 mainītis faili ar 873 papildinājumiem un 4 dzēšanām
  1. 37 0
      doc/update-1.5.0.sql
  2. 1 1
      src/main/java/com/fdkankan/manage/common/ResultCode.java
  3. 33 0
      src/main/java/com/fdkankan/manage/controller/IndexController.java
  4. 63 0
      src/main/java/com/fdkankan/manage/controller/JyPlatformController.java
  5. 64 0
      src/main/java/com/fdkankan/manage/controller/JyUserPlatformController.java
  6. 55 0
      src/main/java/com/fdkankan/manage/entity/JyPlatform.java
  7. 76 0
      src/main/java/com/fdkankan/manage/entity/JyUserPlatform.java
  8. 1 1
      src/main/java/com/fdkankan/manage/generate/AutoGenerate.java
  9. 23 0
      src/main/java/com/fdkankan/manage/mapper/IJyPlatformMapper.java
  10. 27 0
      src/main/java/com/fdkankan/manage/mapper/IJyUserPlatformMapper.java
  11. 29 0
      src/main/java/com/fdkankan/manage/service/IJyPlatformService.java
  12. 40 0
      src/main/java/com/fdkankan/manage/service/IJyUserPlatformService.java
  13. 100 0
      src/main/java/com/fdkankan/manage/service/impl/JyPlatformServiceImpl.java
  14. 128 0
      src/main/java/com/fdkankan/manage/service/impl/JyUserPlatformServiceImpl.java
  15. 15 1
      src/main/java/com/fdkankan/manage/service/impl/ManageService.java
  16. 0 1
      src/main/java/com/fdkankan/manage/service/impl/SysRoleMenuServiceImpl.java
  17. 13 0
      src/main/java/com/fdkankan/manage/service/impl/UserServiceImpl.java
  18. 23 0
      src/main/java/com/fdkankan/manage/vo/request/JyPlatformParam.java
  19. 44 0
      src/main/java/com/fdkankan/manage/vo/request/JyPlatformVo.java
  20. 10 0
      src/main/java/com/fdkankan/manage/vo/request/JyUserPlatformAddParam.java
  21. 20 0
      src/main/java/com/fdkankan/manage/vo/request/JyUserPlatformParam.java
  22. 13 0
      src/main/java/com/fdkankan/manage/vo/request/JyUserPlatformVo.java
  23. 20 0
      src/main/resources/mapper/manage/JyPlatformMapper.xml
  24. 33 0
      src/main/resources/mapper/manage/JyUserPlatformMapper.xml
  25. 5 0
      src/main/resources/mapper/manage/JyUserPlatformUserMapper.xml

+ 37 - 0
doc/update-1.5.0.sql

@@ -0,0 +1,37 @@
+
+CREATE TABLE `4dkankan_v4`.`jy_platform`  (
+                                           `id` int NOT NULL AUTO_INCREMENT,
+                                           `platform_name` varchar(255) NULL COMMENT '平台名称',
+                                           `platform_address` varchar(255) NULL COMMENT '平台地址',
+                                           `rec_status` varchar(255) NULL DEFAULT 'A',
+                                           `status` int NULL DEFAULT 0 COMMENT '是否禁用,0否,1是' ,
+                                           `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+                                           `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+                                           PRIMARY KEY (`id`)
+);
+
+
+CREATE TABLE `4dkankan_v4`.`jy_user_platform`  (
+                                           `id` int NOT NULL AUTO_INCREMENT,
+                                           `platform_id` int NULL,
+                                           `jy_user_id` int NULL,
+                                           `name` varchar(255)  DEFAULT NULL COMMENT '平台管理员姓名',
+                                           `phone` varchar(255) DEFAULT NULL COMMENT '平台管理手机号码',
+                                           `id_card` varchar(255)  DEFAULT NULL COMMENT '身份证号码',
+                                           `status` int DEFAULT '0' COMMENT '是否禁用,0否,1是',
+                                           `role_type` int DEFAULT '0' COMMENT '0平台管理员,1平台用户',
+                                           `rec_status` varchar(255) NULL DEFAULT 'A',
+                                           `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+                                           `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+                                           PRIMARY KEY (`id`)
+);
+
+
+CREATE TABLE `4dkankan_v4`.`jy_user_platform_user`  (
+                                           `id` int NOT NULL AUTO_INCREMENT,
+                                           `jy_user_id` int NULL,
+                                           `jy_user_platform_id` int NULL,
+                                           `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+                                           `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+                                           PRIMARY KEY (`id`)
+);

+ 1 - 1
src/main/java/com/fdkankan/manage/common/ResultCode.java

@@ -9,7 +9,7 @@ public enum ResultCode  {
 
     NOT_ROLE(4001, "无此角色"),
     NOT_PERMISSION(4002, "无此权限"),
-    USER_NOT_EXIST(4003, "用户不存在"),
+    USER_NOT_EXIST(4003, "系统暂无此用户,若您已注册,请先通过手机 App 上传场景成功后再试"),
     USER_EXIST(4004, "用户已存在"),
     PASSWORD_ERROR(4005, "账号密码错误,请重新登录!"),
     USERNAME_ERROR(4006, "该账号已停止使用"),

+ 33 - 0
src/main/java/com/fdkankan/manage/controller/IndexController.java

@@ -0,0 +1,33 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.JyPlatform;
+import com.fdkankan.manage.service.IJyPlatformService;
+import com.fdkankan.manage.vo.request.JyPlatformParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-14
+ */
+@RestController
+@RequestMapping("/manage/index")
+public class IndexController {
+
+    @Autowired
+    IJyPlatformService jyPlatformService;
+
+    @GetMapping("/addressKey/{address}")
+    public ResultData getByAddress(@PathVariable String address){
+        return ResultData.ok(jyPlatformService.getByAddress(address));
+    }
+
+
+}
+

+ 63 - 0
src/main/java/com/fdkankan/manage/controller/JyPlatformController.java

@@ -0,0 +1,63 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.JyPlatform;
+import com.fdkankan.manage.entity.JySceneUserAuth;
+import com.fdkankan.manage.service.IJyPlatformService;
+import com.fdkankan.manage.vo.request.JyPlatformParam;
+import com.fdkankan.manage.vo.request.JyPlatformVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-14
+ */
+@RestController
+@RequestMapping("/manage/jyPlatform")
+public class JyPlatformController {
+
+    @Autowired
+    IJyPlatformService jyPlatformService;
+
+    @GetMapping("/allList")
+    public ResultData allList(){
+        return ResultData.ok(jyPlatformService.list());
+    }
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody JyPlatformParam param){
+        return ResultData.ok(jyPlatformService.pageList(param));
+    }
+
+
+    @PostMapping("/addOrUpdate")
+    public ResultData addOrUpdate(@RequestBody JyPlatformVo param){
+        jyPlatformService.addOrUpdate(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/del")
+    public ResultData del(@RequestBody JyPlatform param){
+        jyPlatformService.del(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/enable")
+    public ResultData enable(@RequestBody JyPlatformVo param){
+        jyPlatformService.enable(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/disable")
+    public ResultData disable(@RequestBody JyPlatformVo param){
+        jyPlatformService.disable(param);
+        return ResultData.ok();
+    }
+}
+

+ 64 - 0
src/main/java/com/fdkankan/manage/controller/JyUserPlatformController.java

@@ -0,0 +1,64 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.JyPlatform;
+import com.fdkankan.manage.service.IJyPlatformService;
+import com.fdkankan.manage.service.IJyUserPlatformService;
+import com.fdkankan.manage.vo.request.JyPlatformParam;
+import com.fdkankan.manage.vo.request.JyPlatformVo;
+import com.fdkankan.manage.vo.request.JyUserPlatformAddParam;
+import com.fdkankan.manage.vo.request.JyUserPlatformParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-15
+ */
+@RestController
+@RequestMapping("/manage/jyUserPlatform")
+public class JyUserPlatformController {
+
+    @Autowired
+    IJyUserPlatformService jyUserPlatformService;
+
+    @PostMapping("/queryByKey")
+    public ResultData queryByKey(@RequestBody JyUserPlatformParam param){
+        return ResultData.ok(jyUserPlatformService.queryByKey(param));
+    }
+
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody JyUserPlatformParam param){
+        return ResultData.ok(jyUserPlatformService.pageList(param));
+    }
+
+
+    @PostMapping("/add")
+    public ResultData add(@RequestBody JyUserPlatformAddParam param){
+        jyUserPlatformService.addByParam(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/update")
+    public ResultData update(@RequestBody JyUserPlatformAddParam param){
+        jyUserPlatformService.updateByParam(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/del")
+    public ResultData del(@RequestBody JyUserPlatformAddParam param){
+        jyUserPlatformService.del(param);
+        return ResultData.ok();
+    }
+}
+

+ 55 - 0
src/main/java/com/fdkankan/manage/entity/JyPlatform.java

@@ -0,0 +1,55 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-14
+ */
+@Getter
+@Setter
+@TableName("jy_platform")
+public class JyPlatform implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 平台名称
+     */
+    @TableField("platform_name")
+    private String platformName;
+
+    /**
+     * 平台地址
+     */
+    @TableField("platform_address")
+    private String platformAddress;
+
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 76 - 0
src/main/java/com/fdkankan/manage/entity/JyUserPlatform.java

@@ -0,0 +1,76 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-15
+ */
+@Getter
+@Setter
+@TableName("jy_user_platform")
+public class JyUserPlatform implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("platform_id")
+    private Integer platformId;
+
+    @TableField("jy_user_id")
+    private Integer jyUserId;
+
+    /**
+     * 平台管理员姓名
+     */
+    @TableField("name")
+    private String name;
+
+    /**
+     * 平台管理手机号码
+     */
+    @TableField("phone")
+    private String phone;
+    /**
+     * 平台管理身份证号码
+     */
+    @TableField("id_card")
+    private String idCard;
+    /**
+     * 是否禁用,0否,1是
+     */
+    @TableField("status")
+    private Integer status;
+
+    /**
+     * 0平台管理员,1平台用户
+     */
+    @TableField("role_type")
+    private Integer roleType;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/manage/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"manage", getTables(new String[]{
-                "jy_user_share"
+                "jy_user_platform_user"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 23 - 0
src/main/java/com/fdkankan/manage/mapper/IJyPlatformMapper.java

@@ -0,0 +1,23 @@
+package com.fdkankan.manage.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.entity.JyPlatform;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.manage.vo.request.JyPlatformParam;
+import com.fdkankan.manage.vo.request.JyPlatformVo;
+import com.fdkankan.manage.vo.response.DownOrderVo;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-14
+ */
+@Mapper
+public interface IJyPlatformMapper extends BaseMapper<JyPlatform> {
+
+    Page<JyPlatformVo> pageList(Page<JyPlatformVo> page, JyPlatformParam param);
+}

+ 27 - 0
src/main/java/com/fdkankan/manage/mapper/IJyUserPlatformMapper.java

@@ -0,0 +1,27 @@
+package com.fdkankan.manage.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.entity.JyUserPlatform;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.manage.vo.request.JyUserPlatformParam;
+import com.fdkankan.manage.vo.request.JyUserPlatformVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-15
+ */
+@Mapper
+public interface IJyUserPlatformMapper extends BaseMapper<JyUserPlatform> {
+
+    Page<JyUserPlatformVo> pageList(Page<Object> objectPage, JyUserPlatformParam param);
+
+    List<JyUserPlatform> queryByKey(@Param("queryKey") String queryKey);
+}

+ 29 - 0
src/main/java/com/fdkankan/manage/service/IJyPlatformService.java

@@ -0,0 +1,29 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.JyPlatform;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.vo.request.JyPlatformParam;
+import com.fdkankan.manage.vo.request.JyPlatformVo;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-14
+ */
+public interface IJyPlatformService extends IService<JyPlatform> {
+
+    Object pageList(JyPlatformParam param);
+
+    void addOrUpdate(JyPlatformVo param);
+
+    void del(JyPlatform param);
+
+    Object getByAddress(String address);
+
+    void enable(JyPlatformVo param);
+
+    void disable(JyPlatformVo param);
+}

+ 40 - 0
src/main/java/com/fdkankan/manage/service/IJyUserPlatformService.java

@@ -0,0 +1,40 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.JyPlatform;
+import com.fdkankan.manage.entity.JyUserPlatform;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.vo.request.JyPlatformVo;
+import com.fdkankan.manage.vo.request.JyUserPlatformAddParam;
+import com.fdkankan.manage.vo.request.JyUserPlatformParam;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-15
+ */
+public interface IJyUserPlatformService extends IService<JyUserPlatform> {
+
+    JyUserPlatform getByIdCard(String idCard);
+
+    void bindJyUserId(Integer id, Integer jyUserId);
+
+    JyUserPlatform getByPlatformAdmin(Integer platformId);
+
+
+    void del(JyUserPlatformAddParam param);
+
+    Object pageList(JyUserPlatformParam param);
+
+    Object queryByKey(JyUserPlatformParam param);
+
+    void addByParam(JyUserPlatformAddParam param);
+
+    void updateByParam(JyUserPlatformAddParam param);
+
+    void bindPlatform(Integer id, Integer platformId);
+
+    JyUserPlatform getByJyUserId(Integer jyUserId);
+}

+ 100 - 0
src/main/java/com/fdkankan/manage/service/impl/JyPlatformServiceImpl.java

@@ -0,0 +1,100 @@
+package com.fdkankan.manage.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.PageInfo;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.entity.JyPlatform;
+import com.fdkankan.manage.entity.JyUserPlatform;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.mapper.IJyPlatformMapper;
+import com.fdkankan.manage.service.IJyPlatformService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.service.IJyUserPlatformService;
+import com.fdkankan.manage.vo.request.JyPlatformParam;
+import com.fdkankan.manage.vo.request.JyPlatformVo;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.UUID;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-14
+ */
+@Service
+public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlatform> implements IJyPlatformService {
+
+
+    @Autowired
+    IJyUserPlatformService jyUserPlatformService;
+
+    @Override
+    public Object pageList(JyPlatformParam param) {
+        Page<JyPlatformVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
+
+        return PageInfo.PageInfo(page);
+    }
+
+    @Override
+    public void addOrUpdate(JyPlatformVo param) {
+        if(StringUtils.isNotBlank(param.getPlatformName()) || StringUtils.isBlank(param.getName())
+                || StringUtils.isBlank(param.getPhone()) || StringUtils.isBlank(param.getIdCard())){
+
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        JyPlatform jyPlatform ;
+        JyUserPlatform jyUserPlatform ;
+        if(param.getId() == null){  //创建平台自动生成平台访问地址
+            String uuid = UUID.randomUUID().toString().substring(0, 18).replace("-", "");
+            param.setPlatformAddress(uuid);
+            jyPlatform = new JyPlatform();
+            jyUserPlatform = new JyUserPlatform();
+        }else {
+            jyPlatform = this.getById(param.getId());
+            if(jyPlatform == null){
+                throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+            }
+            jyUserPlatform = jyUserPlatformService.getByPlatformAdmin(jyPlatform.getId());
+        }
+        BeanUtils.copyProperties(param,jyPlatform);
+        BeanUtils.copyProperties(param,jyUserPlatform);
+        this.saveOrUpdate(jyPlatform);
+        jyUserPlatform.setPlatformId(jyPlatform.getId());
+        jyUserPlatformService.saveOrUpdate(jyUserPlatform);
+
+
+    }
+
+    @Override
+    public void del(JyPlatform param) {
+        if(param.getId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        this.removeById(param.getId());
+    }
+
+    @Override
+    public Object getByAddress(String address) {
+        LambdaQueryWrapper<JyPlatform> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyPlatform::getPlatformAddress,address);
+        JyPlatform one = this.getOne(wrapper);
+        return one;
+    }
+
+    @Override
+    public void enable(JyPlatformVo param) {
+
+    }
+
+    @Override
+    public void disable(JyPlatformVo param) {
+
+    }
+}

+ 128 - 0
src/main/java/com/fdkankan/manage/service/impl/JyUserPlatformServiceImpl.java

@@ -0,0 +1,128 @@
+package com.fdkankan.manage.service.impl;
+
+import cn.dev33.satoken.stp.StpUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.PageInfo;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.entity.JyPlatform;
+import com.fdkankan.manage.entity.JyUserPlatform;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.mapper.IJyUserPlatformMapper;
+import com.fdkankan.manage.service.IJyUserPlatformService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.vo.request.JyPlatformVo;
+import com.fdkankan.manage.vo.request.JyUserPlatformAddParam;
+import com.fdkankan.manage.vo.request.JyUserPlatformParam;
+import com.fdkankan.manage.vo.request.JyUserPlatformVo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-15
+ */
+@Service
+@Slf4j
+public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper, JyUserPlatform> implements IJyUserPlatformService {
+
+    @Override
+    public JyUserPlatform getByIdCard(String idCard) {
+        LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyUserPlatform::getIdCard,idCard);
+        return this.getOne(wrapper);
+    }
+
+    @Override
+    public void bindJyUserId(Integer id, Integer jyUserId) {
+        LambdaUpdateWrapper<JyUserPlatform> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(JyUserPlatform::getId,id);
+        wrapper.set(JyUserPlatform::getJyUserId,jyUserId);
+        this.update(wrapper);
+    }
+
+    @Override
+    public void bindPlatform(Integer id, Integer platformId) {
+        LambdaUpdateWrapper<JyUserPlatform> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(JyUserPlatform::getId,id);
+        wrapper.set(JyUserPlatform::getPlatformId,platformId);
+        this.update(wrapper);
+    }
+
+    @Override
+    public JyUserPlatform getByPlatformAdmin(Integer platformId) {
+        LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyUserPlatform::getPlatformId,platformId);
+        wrapper.eq(JyUserPlatform::getRoleType,0);
+        return this.getOne(wrapper);
+    }
+
+    @Override
+    public void addByParam(JyUserPlatformAddParam param) {
+        if(param.getId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        Integer loginPlatformId = this.getLoginPlatformId();
+        if(loginPlatformId == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        this.bindPlatform(param.getId(),loginPlatformId);
+    }
+
+    @Override
+    public void updateByParam(JyUserPlatformAddParam param) {
+        if(param.getId() == null || param.getPlatformId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        this.bindPlatform(param.getId(),param.getPlatformId());
+
+    }
+
+    @Override
+    public void del(JyUserPlatformAddParam param) {
+        if(param.getId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyUserPlatform::getId,param.getId());
+        this.removeById(wrapper);
+
+    }
+
+    @Override
+    public Object pageList(JyUserPlatformParam param) {
+        param.setPlatformId(getLoginPlatformId());
+        Page<JyUserPlatformVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
+        return PageInfo.PageInfo(page);
+    }
+
+    @Override
+    public Object queryByKey(JyUserPlatformParam param) {
+        if(StringUtils.isBlank(param.getQueryKey())){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        return this.getBaseMapper().queryByKey(param.getQueryKey());
+    }
+
+    @Override
+    public JyUserPlatform getByJyUserId(Integer jyUserId) {
+        LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyUserPlatform::getJyUserId,jyUserId);
+        return this.getOne(wrapper);
+    }
+
+    private Integer getLoginPlatformId(){
+        try {
+            return   Integer.valueOf(StpUtil.getExtra("platformId").toString());
+        }catch (Exception e){
+            log.info("StpUtil.getExtra -- platformId-error:{}",e);
+        }
+        return null;
+    }
+}

+ 15 - 1
src/main/java/com/fdkankan/manage/service/impl/ManageService.java

@@ -9,8 +9,12 @@ import com.fdkankan.common.util.Base64Converter;
 import com.fdkankan.common.util.SecurityUtil;
 import com.fdkankan.manage.common.RedisKeyUtil;
 import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.entity.JyUser;
+import com.fdkankan.manage.entity.JyUserPlatform;
 import com.fdkankan.manage.entity.User;
 import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.service.IJyUserPlatformService;
+import com.fdkankan.manage.service.IJyUserService;
 import com.fdkankan.manage.service.ISysUserService;
 import com.fdkankan.manage.service.IUserService;
 import com.fdkankan.manage.vo.request.ManageLoginRequest;
@@ -32,6 +36,10 @@ public class ManageService {
     @Autowired
     IUserService userService;
     @Autowired
+    IJyUserService jyUserService;
+    @Autowired
+    IJyUserPlatformService jyUserPlatformService;
+    @Autowired
     RedisUtil redisUtil;
 
 
@@ -51,7 +59,7 @@ public class ManageService {
         ManageLoginResponse result = sysUserService.getUserByUserNameAndPassword(userName, passwordMd5);
         if(result == null){
             this.addLoginErrorNum(ip,userName);
-            throw new BusinessException(ResultCode.PASSWORD_ERROR);
+            throw new BusinessException(ResultCode.USER_NOT_EXIST);
         }
         if(result.getStatus() == 0){
             throw new BusinessException(ResultCode.USERNAME_ERROR);
@@ -61,12 +69,18 @@ public class ManageService {
             throw new BusinessException(ResultCode.USERNAME_ERROR);
         }
         User user = byUserName.get(0);
+
+        JyUser jyUser = jyUserService.getBySysId(result.getId());
+
+        JyUserPlatform jyUserPlatform = jyUserPlatformService.getByJyUserId(jyUser.getId());
         StpUtil.login(result.getId(), SaLoginConfig
                 .setExtra("id",result.getId())
                 .setExtra("userId",user.getId())
                 .setExtra("isAdmin",1)
+                .setExtra("platformId",jyUserPlatform != null ?jyUserPlatform.getPlatformId() :null)
                 .setExtra("userName",result.getUserName())
                 .setExtra("nickName",result.getNickName()));
+
         result.setToken(StpUtil.getTokenValue());
         result.setUserId(user.getId());
         redisUtil.set(String.format(RedisKeyUtil.loginToken ,result.getToken()), JSONObject.toJSONString(result), 2*60*60);

+ 0 - 1
src/main/java/com/fdkankan/manage/service/impl/SysRoleMenuServiceImpl.java

@@ -9,7 +9,6 @@ import com.fdkankan.manage.mapper.ISysRoleMenuMapper;
 import com.fdkankan.manage.service.ISysMenuService;
 import com.fdkankan.manage.service.ISysRoleMenuService;
 import com.fdkankan.manage.service.ISysRoleService;
-import org.opencv.ml.EM;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

+ 13 - 0
src/main/java/com/fdkankan/manage/service/impl/UserServiceImpl.java

@@ -66,6 +66,10 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
     private IJySceneUserAuthService jySceneUserAuthService;
     @Autowired
     ManageService manageService;
+    @Autowired
+    IJyPlatformService jyPlatformService;
+    @Autowired
+    IJyUserPlatformService jyUserPlatformService;
 
     @Override
     public PageInfo pageList(UserParam param) {
@@ -190,8 +194,10 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
         if(jyUser != null && jyUser2 != null && !jyUser2.getId().equals(jyUser.getId())){
             throw new BusinessException(ResultCode.RYNO_EXITS);
         }
+        boolean init = false;
         if(jyUser == null){
             jyUser = new JyUser();
+            init = true;
         }
 
         User user = this.addUser(jyUser.getUserId(),passwordMd5, param.getRyNo(), param.getNickName());
@@ -208,6 +214,13 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
         jyUser.setIdCard(param.getIdCard());
         jyUserService.saveOrUpdate(jyUser);
 
+        if(init && StringUtils.isNotBlank(param.getIdCard()) && param.getIsJm()!=null && param.getIsJm() != 1){
+            JyUserPlatform jyUserPlatform = jyUserPlatformService.getByIdCard(param.getIdCard());
+            JyPlatform jyPlatform = jyPlatformService.getById(jyUserPlatform.getPlatformId());
+            if(jyPlatform != null){
+                jyUserPlatformService.bindJyUserId(jyUserPlatform.getId(),jyUser.getId());
+            }
+        }
     }
 
 

+ 23 - 0
src/main/java/com/fdkankan/manage/vo/request/JyPlatformParam.java

@@ -0,0 +1,23 @@
+package com.fdkankan.manage.vo.request;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+@Data
+public class JyPlatformParam extends RequestBase{
+
+    /**
+     * 平台名称
+     */
+    private String platformName;
+
+    /**
+     * 平台管理员姓名
+     */
+    private String name;
+
+    /**
+     * 平台管理手机号码
+     */
+    private String phone;
+}

+ 44 - 0
src/main/java/com/fdkankan/manage/vo/request/JyPlatformVo.java

@@ -0,0 +1,44 @@
+package com.fdkankan.manage.vo.request;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fdkankan.manage.entity.JyPlatform;
+import lombok.Data;
+
+@Data
+public class JyPlatformVo{
+
+    private Integer id;
+
+    private String platformName;
+
+    private String platformAddress;
+
+    private Integer jyUserId;
+
+    /**
+     * 平台管理员姓名
+     */
+    private String name;
+
+    /**
+     * 平台管理手机号码
+     */
+    private String phone;
+    /**
+     * 平台管理身份证号码
+     */
+    private String idCard;
+    /**
+     * 是否禁用,0否,1是
+     */
+    private Integer status;
+
+    /**
+     * 0平台管理员,1平台用户
+     */
+    private Integer roleType;
+
+    private String createTime;
+}

+ 10 - 0
src/main/java/com/fdkankan/manage/vo/request/JyUserPlatformAddParam.java

@@ -0,0 +1,10 @@
+package com.fdkankan.manage.vo.request;
+
+import lombok.Data;
+
+@Data
+public class JyUserPlatformAddParam {
+
+    private Integer id;
+    private Integer platformId;
+}

+ 20 - 0
src/main/java/com/fdkankan/manage/vo/request/JyUserPlatformParam.java

@@ -0,0 +1,20 @@
+package com.fdkankan.manage.vo.request;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+@Data
+public class JyUserPlatformParam extends RequestBase{
+
+    private String queryKey;
+
+    private String name;
+
+    private String phone;
+
+    private String idCard;
+
+    private String ryNo;
+
+    private Integer platformId;
+}

+ 13 - 0
src/main/java/com/fdkankan/manage/vo/request/JyUserPlatformVo.java

@@ -0,0 +1,13 @@
+package com.fdkankan.manage.vo.request;
+
+import com.fdkankan.manage.entity.JyUserPlatform;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class JyUserPlatformVo extends JyUserPlatform {
+    private String ryId;
+    private String ryNo;
+    private String platformIdStr;
+}

+ 20 - 0
src/main/resources/mapper/manage/JyPlatformMapper.xml

@@ -0,0 +1,20 @@
+<?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.fdkankan.manage.mapper.IJyPlatformMapper">
+
+    <select id="pageList" resultType="com.fdkankan.manage.vo.request.JyPlatformVo">
+        select * from t_platform p left join  t_user_plaftform u on p.id = u.platform_id
+        where p.rec_status = 'A' and u.rec_status = 'A' and u.role_type = 0
+        <if test="param.platformAddress != null and param.platformAddress !=''">
+            and p.platform_address like concat ('%',#{param.platformAddress},'%')
+        </if>
+        <if test="param.name != null and param.name !=''">
+            and u.name like concat ('%',#{param.name},'%')
+        </if>
+        <if test="param.phone != null and param.phone !=''">
+            and u.phone like concat ('%',#{param.phone},'%')
+        </if>
+        order by  p.id desc
+
+    </select>
+</mapper>

+ 33 - 0
src/main/resources/mapper/manage/JyUserPlatformMapper.xml

@@ -0,0 +1,33 @@
+<?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.fdkankan.manage.mapper.IJyUserPlatformMapper">
+
+    <select id="pageList" resultType="com.fdkankan.manage.vo.request.JyUserPlatformVo">
+        select * from jy_user_platform up left join jy_user jy on up.jy_user_id = jy.id
+                                          left join jy_platform jp on up.platform_id = jp.id
+        where up.rec_status = 'A' and jy.rec_status = 'A' and jp.rec_status = 'A' and up.role_type = 1
+        <if test="param.name != null and param.name !=''">
+            and up.name like concat ('%',#{param.name},'%')
+        </if>
+        <if test="param.phone != null and param.phone !=''">
+            and up.phone like concat ('%',#{param.phone},'%')
+        </if>
+        <if test="param.idCard != null and param.idCard !=''">
+            and up.id_card like concat ('%',#{param.idCard},'%')
+        </if>
+        <if test="param.ryNo != null and param.ryNo !=''">
+            and jy.ry_no like concat ('%',#{param.ryNo},'%')
+        </if>
+        <if test="param.platformId != null ">
+            and up.platform_id  = #{param.platformId}
+        </if>
+        order by  up.id desc
+
+    </select>
+    <select id="queryByKey" resultType="com.fdkankan.manage.entity.JyUserPlatform">
+        select  * from  jy_user_platform where rec_status = 'A'
+        <if test="queryKey != null and queryKey !=''">
+            and ( name = #{queryKey} or phone = #{queryKey} or id_card = #{queryKey}  )
+        </if>
+    </select>
+</mapper>

+ 5 - 0
src/main/resources/mapper/manage/JyUserPlatformUserMapper.xml

@@ -0,0 +1,5 @@
+<?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.fdkankan.manage.mapper.IJyUserPlatformUserMapper">
+
+</mapper>