Просмотр исходного кода

Changes 修改站点绑定业务

cyan 1 день назад
Родитель
Сommit
f367ec67db
17 измененных файлов с 1456 добавлено и 306 удалено
  1. 261 160
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/controller/OkkiAccountController.java
  2. 34 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/dto/OkkiBindSiteDto.java
  3. 17 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/dto/OkkiUserInfoDto.java
  4. 4 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/entity/OkkiAccount.java
  5. 18 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/service/IOkkiAccountService.java
  6. 376 12
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/service/impl/OkkiAccountServiceImpl.java
  7. 195 129
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/controller/OkkiSiteController.java
  8. 62 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/entity/OkkiSite.java
  9. 13 1
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/IOkkiSiteService.java
  10. 3 1
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuSheetServiceImpl.java
  11. 158 3
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/OkkiSiteServiceImpl.java
  12. 162 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/controller/OkkiSiteUserController.java
  13. 51 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/entity/OkkiSiteUser.java
  14. 20 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/mapper/OkkiSiteUserMapper.java
  15. 15 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/mapper/xml/OkkiSiteUserMapper.xml
  16. 28 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/service/IOkkiSiteUserService.java
  17. 39 0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/service/impl/OkkiSiteUserServiceImpl.java

+ 261 - 160
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/controller/OkkiAccountController.java

@@ -11,136 +11,162 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.FastJsonUtil;
+import org.jeecg.modules.okki.account.dto.OkkiBindSiteDto;
 import org.jeecg.modules.okki.account.entity.OkkiAccount;
 import org.jeecg.modules.okki.account.param.OkkiAccountResetPwdParam;
 import org.jeecg.modules.okki.account.service.IOkkiAccountService;
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
+import org.jeecg.modules.okki.siteuser.service.IOkkiSiteUserService;
+import org.jeecg.modules.system.service.ISysDictService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
+import java.util.*;
+import java.util.stream.Collectors;
 
- /**
+/**
  * @Description: 小二账号
  * @Author: jeecg-boot
- * @Date:   2024-05-22
+ * @Date: 2024-05-22
  * @Version: V1.0
  */
-@Api(tags="小二账号")
+@Api(tags = "小二账号")
 @RestController
 @RequestMapping("/account/okkiAccount")
 @Slf4j
 public class OkkiAccountController extends JeecgController<OkkiAccount, IOkkiAccountService> {
-	@Autowired
-	private IOkkiAccountService okkiAccountService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param okkiAccount
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "小二账号-分页列表查询")
-	@ApiOperation(value="小二账号-分页列表查询", notes="小二账号-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<OkkiAccount>> queryPageList(OkkiAccount okkiAccount,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
-		QueryWrapper<OkkiAccount> queryWrapper = QueryGenerator.initQueryWrapper(okkiAccount, req.getParameterMap());
-		Page<OkkiAccount> page = new Page<OkkiAccount>(pageNo, pageSize);
-		IPage<OkkiAccount> pageList = okkiAccountService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param okkiAccount
-	 * @return
-	 */
-	@AutoLog(value = "小二账号-添加")
-	@ApiOperation(value="小二账号-添加", notes="小二账号-添加")
-	@RequiresPermissions("account:okki_account:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody OkkiAccount okkiAccount) {
-		okkiAccountService.insertAccount(okkiAccount);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param okkiAccount
-	 * @return
-	 */
-	@AutoLog(value = "小二账号-编辑")
-	@ApiOperation(value="小二账号-编辑", notes="小二账号-编辑")
-	@RequiresPermissions("account:okki_account:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody OkkiAccount okkiAccount) {
-		okkiAccountService.updateAccount(okkiAccount);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "小二账号-通过id删除")
-	@ApiOperation(value="小二账号-通过id删除", notes="小二账号-通过id删除")
-	@RequiresPermissions("account:okki_account:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		okkiAccountService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "小二账号-批量删除")
-	@ApiOperation(value="小二账号-批量删除", notes="小二账号-批量删除")
-	@RequiresPermissions("account:okki_account:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.okkiAccountService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "小二账号-通过id查询")
-	@ApiOperation(value="小二账号-通过id查询", notes="小二账号-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<OkkiAccount> queryById(@RequestParam(name="id",required=true) String id) {
-		OkkiAccount okkiAccount = okkiAccountService.getById(id);
-		if(okkiAccount==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(okkiAccount);
-	}
+    @Autowired
+    private IOkkiAccountService okkiAccountService;
+
+    @Autowired
+    private ISysDictService sysDictService;
+
+    @Autowired
+    private IOkkiSiteUserService okkiSiteUserService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param okkiAccount
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "小二账号-分页列表查询")
+    @ApiOperation(value = "小二账号-分页列表查询", notes = "小二账号-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<OkkiAccount>> queryPageList(OkkiAccount okkiAccount,
+                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                    HttpServletRequest req) {
+        QueryWrapper<OkkiAccount> queryWrapper = QueryGenerator.initQueryWrapper(okkiAccount, req.getParameterMap());
+        Page<OkkiAccount> page = new Page<OkkiAccount>(pageNo, pageSize);
+        IPage<OkkiAccount> pageList = okkiAccountService.page(page, queryWrapper);
+        List<OkkiAccount> okkiAccounts = pageList.getRecords();
+        if(!okkiAccounts.isEmpty()){
+            okkiAccounts.forEach(item -> {
+                List<OkkiSiteUser> okkiSiteUsers = okkiSiteUserService.getSiteUserInfoByUserId(item.getUserId());
+                List<Integer> siteIds = okkiSiteUsers.stream().map(OkkiSiteUser::getSiteId).collect(Collectors.toList());
+                String result = siteIds.stream()
+                        .map(String::valueOf)
+                        .collect(Collectors.joining(","));
+                item.setSiteIds(result);
+            });
+        }
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param okkiAccount
+     * @return
+     */
+    @AutoLog(value = "小二账号-添加")
+    @ApiOperation(value = "小二账号-添加", notes = "小二账号-添加")
+    @RequiresPermissions("account:okki_account:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody OkkiAccount okkiAccount) {
+//		okkiAccountService.insertAccount(okkiAccount);
+        // todo 接口增加3个新参数和参数类型修改
+        okkiAccountService.insertAccountV2(okkiAccount);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param okkiAccount
+     * @return
+     */
+    @AutoLog(value = "小二账号-编辑")
+    @ApiOperation(value = "小二账号-编辑", notes = "小二账号-编辑")
+    @RequiresPermissions("account:okki_account:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody OkkiAccount okkiAccount) {
+//		okkiAccountService.updateAccount(okkiAccount);
+        okkiAccountService.resetRoleV2(okkiAccount);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "小二账号-通过id删除")
+    @ApiOperation(value = "小二账号-通过id删除", notes = "小二账号-通过id删除")
+    @RequiresPermissions("account:okki_account:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        okkiAccountService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "小二账号-批量删除")
+    @ApiOperation(value = "小二账号-批量删除", notes = "小二账号-批量删除")
+    @RequiresPermissions("account:okki_account:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.okkiAccountService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "小二账号-通过id查询")
+    @ApiOperation(value = "小二账号-通过id查询", notes = "小二账号-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<OkkiAccount> queryById(@RequestParam(name = "id", required = true) String id) {
+        OkkiAccount okkiAccount = okkiAccountService.getById(id);
+        if (okkiAccount == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(okkiAccount);
+    }
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param okkiAccount
-    */
+     * 导出excel
+     *
+     * @param request
+     * @param okkiAccount
+     */
     @RequiresPermissions("account:okki_account:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, OkkiAccount okkiAccount) {
@@ -148,60 +174,135 @@ public class OkkiAccountController extends JeecgController<OkkiAccount, IOkkiAcc
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("account:okki_account:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         return super.importExcel(request, response, OkkiAccount.class);
     }
 
-	 /**
-	  *  授权
-	  *
-	  * @param okkiAccount
-	  * @return
-	  */
-	 @AutoLog(value = "小二账号-授权")
-	 @ApiOperation(value="小二账号-授权", notes="小二账号-授权")
-	 @RequiresPermissions("account:okki_account:edit")
-	 @RequestMapping(value = "/resetRole", method = {RequestMethod.PUT,RequestMethod.POST})
-	 public Result<String> resetRole(@RequestBody OkkiAccount okkiAccount) {
-		 okkiAccountService.resetRole(okkiAccount);
-		 return Result.OK("编辑成功!");
-	 }
-
-	 /**
-	  *  绑定站点
-	  *
-	  * @param okkiAccount
-	  * @return
-	  */
-	 @AutoLog(value = "小二账号-绑定站点")
-	 @ApiOperation(value="小二账号-绑定站点", notes="小二账号-绑定站点")
-	 @RequiresPermissions("account:okki_account:edit")
-	 @RequestMapping(value = "/bindSite", method = {RequestMethod.PUT,RequestMethod.POST})
-	 public Result<String> bindSite(@RequestBody OkkiAccount okkiAccount) {
-		 okkiAccountService.bindSites(okkiAccount);
-		 return Result.OK("编辑成功!");
-	 }
-
-	 /**
-	  *  重置密码
-	  *
-	  * @param okkiAccount
-	  * @return
-	  */
-	 @AutoLog(value = "小二账号-绑定站点")
-	 @ApiOperation(value="小二账号-重置密码", notes="小二账号-重置密码")
-	 @RequiresPermissions("account:okki_account:edit")
-	 @RequestMapping(value = "/resetPwd", method = {RequestMethod.PUT,RequestMethod.POST})
-	 public Result<String> resetPwd(@RequestBody OkkiAccountResetPwdParam okkiAccountResetPwdParam) {
-		 okkiAccountService.resetPwd(okkiAccountResetPwdParam);
-		 return Result.OK("编辑成功!");
-	 }
+    /**
+     * 授权
+     *
+     * @param okkiAccount
+     * @return
+     */
+    @AutoLog(value = "小二账号-授权")
+    @ApiOperation(value = "小二账号-授权", notes = "小二账号-授权")
+    @RequiresPermissions("account:okki_account:edit")
+    @RequestMapping(value = "/resetRole", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> resetRole(@RequestBody OkkiAccount okkiAccount) {
+//		 okkiAccountService.resetRole(okkiAccount);
+        okkiAccountService.resetRoleV2(okkiAccount);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 绑定站点
+     *
+     * @param okkiAccount
+     * @return
+     */
+    @AutoLog(value = "小二账号-绑定站点")
+    @ApiOperation(value = "小二账号-绑定站点", notes = "小二账号-绑定站点")
+    @RequiresPermissions("account:okki_account:edit")
+//    @RequestMapping(value = "/bindSite", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> bindSite(@RequestBody OkkiAccount okkiAccount) {
+//		 okkiAccountService.bindSites(okkiAccount);
+        // todo 接口升级更换
+//        okkiAccountService.bindSitesV2(okkiAccount);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 绑定站点
+     *
+     * @param okkiBindSiteDto
+     * @return
+     */
+    @AutoLog(value = "小二账号-绑定站点V2")
+    @ApiOperation(value = "小二账号-绑定站点V2", notes = "小二账号-绑定站点V2")
+    @RequiresPermissions("account:okki_account:edit")
+    @RequestMapping(value = "/bindSiteV2", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> bindSitesV2(@RequestBody OkkiBindSiteDto okkiBindSiteDto) {
+        log.info("okkiBindSiteDto:{}", FastJsonUtil.toJSONString(okkiBindSiteDto));
+        okkiAccountService.bindSitesV2(okkiBindSiteDto);
+        return Result.OK("操作成功!");
+    }
+
+
+    /**
+     * 重置密码
+     *
+     * @param okkiAccountResetPwdParam
+     * @return
+     */
+    @AutoLog(value = "小二账号-绑定站点")
+    @ApiOperation(value = "小二账号-重置密码", notes = "小二账号-重置密码")
+    @RequiresPermissions("account:okki_account:edit")
+    @RequestMapping(value = "/resetPwd", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> resetPwd(@RequestBody OkkiAccountResetPwdParam okkiAccountResetPwdParam) {
+        okkiAccountService.resetPwd(okkiAccountResetPwdParam);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 获取小二账号
+     *
+     * @param okkiAccount
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "小二账号-获取小二账号", notes = "小二账号-获取小二账号")
+    @GetMapping(value = "/user")
+    public Result<?> getOkkiUser(OkkiAccount okkiAccount,
+                                 HttpServletRequest req) {
+//        List<DictModel> dictModels = sysDictService.getDictItems("user_role");
+//            log.info("dictModels:{}",FastJsonUtil.toJSONString(dictModels));
+//        Map<Integer, Object> userRoleMap = new HashMap<>();
+//        dictModels.forEach(c -> {
+//            QueryWrapper<OkkiAccount> queryWrapper = new QueryWrapper<>();
+//            queryWrapper.eq("user_role", Integer.valueOf(c.getValue()));
+//            queryWrapper.eq("status", 0).select("name,user_id,user_role");
+//            List<OkkiAccount> accounts = okkiAccountService.list(queryWrapper);
+//
+//            List<Map<String, Object>> accountsMap = new ArrayList<>();
+//            accounts.forEach(a -> {
+//                Map<String, Object> accountMap = new HashMap<>();
+//                accountMap.put("id", a.getId());
+//                accountMap.put("name", a.getName());
+//                accountMap.put("userId", a.getUserId());
+//                accountMap.put("userRole", a.getUserRole());
+//                accountsMap.add(accountMap);
+//            });
+//            userRoleMap.put(Integer.valueOf(c.getValue()), accountsMap);
+//        });
+//        log.info("userRoleMap:{}", FastJsonUtil.toJSONString(userRoleMap));
+//        return Result.OK(userRoleMap);
+
+//        OkkiSite okkiSite = new OkkiSite();
+//        okkiSite.setSiteId(String.valueOf(2314));
+//        okkiAccountService.getSiteBindInfo(okkiSite);
+
+        QueryWrapper<OkkiAccount> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_role", okkiAccount.getUserRole());
+        queryWrapper.eq("status", 0).select("name,user_id,user_role");
+        List<OkkiAccount> accounts = okkiAccountService.list(queryWrapper);
+
+        List<Map<String, Object>> accountsMap = new ArrayList<>();
+        accounts.forEach(a -> {
+            Map<String, Object> accountMap = new HashMap<>();
+            accountMap.put("id", a.getId());
+            accountMap.put("name", a.getName());
+            accountMap.put("userId", a.getUserId());
+            accountMap.put("userRole", a.getUserRole());
+            accountsMap.add(accountMap);
+        });
+        return Result.OK(accountsMap);
+    }
 }

+ 34 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/dto/OkkiBindSiteDto.java

@@ -0,0 +1,34 @@
+package org.jeecg.modules.okki.account.dto;
+
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * @author 12453
+ */
+@Data
+public class OkkiBindSiteDto implements Serializable {
+    private String id;
+
+    private String siteId;
+
+    private String serviceManageUser;
+
+    private String dataUser;
+
+    private String kefuUser;
+
+    private String seoUser;
+
+    private String semManageUser;
+
+    private String semUser;
+
+    private String uiUser;
+
+    private String websiteUser;
+
+    private String socialUser;
+
+    private String rdUser;
+}

+ 17 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/dto/OkkiUserInfoDto.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.okki.account.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author 12453
+ */
+@Data
+public class OkkiUserInfoDto implements Serializable {
+    private String nickname;
+
+    private int userId;
+
+    private String account;
+}

+ 4 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/entity/OkkiAccount.java

@@ -62,6 +62,10 @@ public class OkkiAccount implements Serializable {
     @Excel(name = "密码", width = 15)
     @ApiModelProperty(value = "密码")
     private java.lang.String password;
+    /**手机号*/
+    @Excel(name = "手机号", width = 15)
+    @ApiModelProperty(value = "手机号")
+    private java.lang.String phone;
     /**小二账号id*/
     @Excel(name = "小二账号id", width = 15)
     @ApiModelProperty(value = "小二账号id")

+ 18 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/service/IOkkiAccountService.java

@@ -1,8 +1,12 @@
 package org.jeecg.modules.okki.account.service;
 
+import org.jeecg.modules.okki.account.dto.OkkiBindSiteDto;
 import org.jeecg.modules.okki.account.entity.OkkiAccount;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.okki.account.param.OkkiAccountResetPwdParam;
+import org.jeecg.modules.okki.site.entity.OkkiSite;
+
+import java.util.Map;
 
 /**
  * @Description: 小二账号
@@ -14,11 +18,25 @@ public interface IOkkiAccountService extends IService<OkkiAccount> {
 
     void insertAccount(OkkiAccount okkiAccount);
 
+    public void insertAccountV2(OkkiAccount okkiAccount);
+
     void updateAccount(OkkiAccount okkiAccount);
 
     void resetRole(OkkiAccount okkiAccount);
 
+    public void resetRoleV2(OkkiAccount okkiAccountParam);
+
     void bindSites(OkkiAccount okkiAccount);
 
+    public void bindSitesV2(OkkiAccount okkiAccountParam);
+
+    public void bindSitesV2(OkkiBindSiteDto okkiBindSiteDto);
+
     void resetPwd(OkkiAccountResetPwdParam okkiAccountResetPwdParam);
+
+    /**
+     * 获取站点绑定信息
+     * @param siteId
+     */
+    public Map<String, Object> getSiteBindInfo(Integer siteId);
 }

+ 376 - 12
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/account/service/impl/OkkiAccountServiceImpl.java

@@ -1,25 +1,37 @@
 package org.jeecg.modules.okki.account.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.common.system.vo.DictModel;
+import org.jeecg.common.util.FastJsonUtil;
+import org.jeecg.modules.okki.account.dto.OkkiBindSiteDto;
 import org.jeecg.modules.okki.account.entity.OkkiAccount;
 import org.jeecg.modules.okki.account.mapper.OkkiAccountMapper;
 import org.jeecg.modules.okki.account.param.OkkiAccountResetPwdParam;
 import org.jeecg.modules.okki.account.service.IOkkiAccountService;
+import org.jeecg.modules.okki.site.entity.OkkiSite;
+import org.jeecg.modules.okki.site.service.IOkkiSiteService;
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
+import org.jeecg.modules.okki.siteuser.service.IOkkiSiteUserService;
 import org.jeecg.modules.okki.utils.HttpClientUtils;
+import org.jeecg.modules.system.service.ISysDictService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.*;
 
 /**
  * @Description: 小二账号
  * @Author: jeecg-boot
- * @Date:   2024-05-22
+ * @Date: 2024-05-22
  * @Version: V1.0
  */
 @Slf4j
@@ -31,6 +43,13 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
 
     @Value("${OKKI.CLIENT_SECRET}")
     private String CLIENT_SECRET;
+
+    @Autowired
+    private ISysDictService sysDictService;
+
+    @Autowired
+    private IOkkiSiteUserService okkiSiteUserService;
+
     @Override
     public void insertAccount(OkkiAccount okkiAccount) {
         //查询账号是否已存在
@@ -60,7 +79,7 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
             String res = HttpClientUtils.doPost(okkiUrl, body);
             log.info(res);
             // {"code":0,"msg":"success","now":"2024-05-06 15:34:54","data":[]}
-            JSONObject jsonObject= JSONObject.parseObject(res);
+            JSONObject jsonObject = JSONObject.parseObject(res);
             if (jsonObject.get("code").equals(0)) {
                 Object data = jsonObject.get("data");
                 JSONObject jsonObject1 = JSONObject.parseObject(data.toString());
@@ -73,7 +92,62 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
                 if (!okkiAccount.getSiteIds().equals("")) {
                     bindSites(okkiAccount);
                 }
-            }else {
+            } else {
+                throw new RuntimeException(jsonObject.get("msg").toString());
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void insertAccountV2(OkkiAccount okkiAccount) {
+        //查询账号是否已存在
+        OkkiAccount one = this.getOne(new LambdaQueryWrapper<OkkiAccount>().eq(OkkiAccount::getAccount, okkiAccount.getAccount()));
+        if (one != null) {
+            throw new RuntimeException("账号已存在,请新增其他账号!");
+        }
+        //创建小二账号
+        // 请求okki平台接口
+        Map<String, String> query = new TreeMap<>();
+        query.put("sign_method", "hmac-md5");
+        query.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        query.put("site_id", "sp_weichi");
+        query.put("method", "dumpUser");
+        Map<String, Object> postData = new HashMap<>();
+        try {
+            String queryStr = HttpClientUtils.buildQueryString(query);
+            postData.put("email", okkiAccount.getAccount());
+            postData.put("pwd", okkiAccount.getPassword());
+            postData.put("user_role", okkiAccount.getUserRole());
+            postData.put("nickname", okkiAccount.getName());
+            postData.put("account", okkiAccount.getAccount());
+            postData.put("phone", okkiAccount.getPhone());
+            log.info("postData:{}", FastJsonUtil.toJSONString(postData));
+
+            String body = HttpClientUtils.toJsonString(postData);
+            String signStr = queryStr + body;
+            query.put("signature", HttpClientUtils.generateHmacMD5(signStr, CLIENT_SECRET));
+            String okkiUrl = URL + "?" + HttpClientUtils.buildQueryString(query);
+            log.info("url:" + okkiUrl + ",body:" + body);
+            String res = HttpClientUtils.doPost(okkiUrl, body);
+            log.info(res);
+            // {"code":0,"msg":"success","now":"2024-05-06 15:34:54","data":[]}
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("code").equals(0)) {
+                Object data = jsonObject.get("data");
+                JSONObject jsonObject1 = JSONObject.parseObject(data.toString());
+                Integer userId = (Integer) jsonObject1.get("user_id");
+                Integer userStatus = (Integer) jsonObject1.get("user_status");
+                okkiAccount.setUserId(userId);
+                okkiAccount.setStatus(userStatus);
+                this.save(okkiAccount);
+                //关联站点
+                if (!"".equals(okkiAccount.getSiteIds())) {
+//                    bindSites(okkiAccount);
+//                    bindSitesV2(okkiAccount);
+                }
+            } else {
                 throw new RuntimeException(jsonObject.get("msg").toString());
             }
         } catch (Exception e) {
@@ -113,11 +187,72 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
             String res = HttpClientUtils.doPost(okkiUrl, body);
             log.info(res);
             // {"code":0,"msg":"success","now":"2024-05-06 15:34:54","data":[]}
-            JSONObject jsonObject= JSONObject.parseObject(res);
+            JSONObject jsonObject = JSONObject.parseObject(res);
             if (jsonObject.get("code").equals(0)) {
                 okkiAccount.setUserRole(okkiAccountParam.getUserRole());
                 this.updateById(okkiAccount);
-            }else {
+            } else {
+                throw new RuntimeException(jsonObject.get("msg").toString());
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void resetRoleV2(OkkiAccount okkiAccountParam) {
+        // 请求okki平台接口
+        Map<String, String> query = new TreeMap<>();
+        query.put("sign_method", "hmac-md5");
+        query.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        query.put("site_id", "sp_weichi");
+        query.put("method", "resetUserInfo");
+        Map<String, Object> postData = new HashMap<>();
+        try {
+            String queryStr = HttpClientUtils.buildQueryString(query);
+            final OkkiAccount okkiAccount = this.getById(okkiAccountParam.getId());
+            postData.put("user_id", okkiAccount.getUserId());
+            if (okkiAccountParam.getUserRole() != null) {
+                postData.put("user_role", okkiAccountParam.getUserRole());
+            }
+
+            if (StringUtils.isNotEmpty(okkiAccountParam.getName())) {
+                postData.put("nickname", okkiAccountParam.getName());
+            }
+
+            if (StringUtils.isNotEmpty(okkiAccountParam.getAccount())) {
+                postData.put("email", okkiAccountParam.getAccount());
+            }
+
+            if (StringUtils.isNotEmpty(okkiAccountParam.getPhone())) {
+                postData.put("phone", okkiAccountParam.getPhone());
+            }
+            log.info("postData:{}", FastJsonUtil.toJSONString(postData));
+
+            String body = HttpClientUtils.toJsonString(postData);
+            String signStr = queryStr + body;
+            query.put("signature", HttpClientUtils.generateHmacMD5(signStr, CLIENT_SECRET));
+            String okkiUrl = URL + "?" + HttpClientUtils.buildQueryString(query);
+            log.info("url:" + okkiUrl + ",body:" + body);
+            String res = HttpClientUtils.doPost(okkiUrl, body);
+            log.info(res);
+            // {"code":0,"msg":"success","now":"2024-05-06 15:34:54","data":[]}
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("code").equals(0)) {
+                okkiAccount.setUserRole(okkiAccountParam.getUserRole());
+                if (StringUtils.isNotEmpty(okkiAccountParam.getName())) {
+                    okkiAccount.setName(okkiAccountParam.getName());
+                }
+
+                if (StringUtils.isNotEmpty(okkiAccountParam.getAccount())) {
+                    okkiAccount.setAccount(okkiAccountParam.getAccount());
+                }
+
+                if (StringUtils.isNotEmpty(okkiAccountParam.getPhone())) {
+                    okkiAccount.setPhone(okkiAccountParam.getPhone());
+                }
+                this.updateById(okkiAccount);
+            } else {
                 throw new RuntimeException(jsonObject.get("msg").toString());
             }
         } catch (Exception e) {
@@ -151,11 +286,73 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
             log.info("url:" + okkiUrl + ",body:" + body);
             String res = HttpClientUtils.doPost(okkiUrl, body);
             log.info(res);
-            JSONObject jsonObject= JSONObject.parseObject(res);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("code").equals(0)) {
+                okkiAccount.setSiteIds(siteIds);
+                this.updateById(okkiAccount);
+            } else {
+                throw new RuntimeException(jsonObject.get("msg").toString());
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void bindSitesV2(OkkiAccount okkiAccountParam) {
+        // 请求okki平台接口
+        Map<String, String> query = new TreeMap<>();
+        query.put("sign_method", "hmac-md5");
+        query.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        query.put("site_id", "sp_weichi");
+        query.put("method", "bindSiteWithRole");
+        Map<String, Object> postData = new HashMap<>();
+        try {
+            String queryStr = HttpClientUtils.buildQueryString(query);
+            final OkkiAccount okkiAccount = this.getById(okkiAccountParam.getId());
+//            postData.put("user_id", okkiAccount.getUserId());
+
+            // 字符串转数组
+            String siteIds = okkiAccountParam.getSiteIds();
+            String[] split = siteIds.split(",");
+            postData.put("site_ids", split);
+
+//            List<Integer> userIds = new ArrayList<>();
+//            userIds.add(okkiAccount.getUserId());
+//            Map<Integer,Object> map = new HashMap<>();
+//            map.put(okkiAccount.getUserRole(),userIds);
+
+//            List<Integer> userIds2 = new ArrayList<>();
+//            userIds2.add(okkiAccount.getUserId());
+//            map.put(2,userIds2);
+
+            List<DictModel> dictModels = sysDictService.getDictItems("user_role");
+//            log.info("dictModels:{}",FastJsonUtil.toJSONString(dictModels));
+            Map<Integer, Object> userRoleMap = new HashMap<>();
+            dictModels.forEach(c -> {
+                List<Integer> userIds = new ArrayList<>();
+                if (okkiAccount.getUserRole().equals(Integer.valueOf(c.getValue()))) {
+                    userIds.add(okkiAccount.getUserId());
+                }
+                userRoleMap.put(Integer.valueOf(c.getValue()), userIds);
+            });
+            log.info("userRoleMap:{}", FastJsonUtil.toJSONString(userRoleMap));
+
+            postData.put("user_sets", userRoleMap);
+            log.info("postData:{}", FastJsonUtil.toJSONString(postData));
+
+            String body = HttpClientUtils.toJsonString(postData);
+            String signStr = queryStr + body;
+            query.put("signature", HttpClientUtils.generateHmacMD5(signStr, CLIENT_SECRET));
+            String okkiUrl = URL + "?" + HttpClientUtils.buildQueryString(query);
+            log.info("url:" + okkiUrl + ",body:" + body);
+            String res = HttpClientUtils.doPost(okkiUrl, body);
+            log.info(res);
+            JSONObject jsonObject = JSONObject.parseObject(res);
             if (jsonObject.get("code").equals(0)) {
                 okkiAccount.setSiteIds(siteIds);
                 this.updateById(okkiAccount);
-            }else {
+            } else {
                 throw new RuntimeException(jsonObject.get("msg").toString());
             }
         } catch (Exception e) {
@@ -164,6 +361,129 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
     }
 
     @Override
+    public void bindSitesV2(OkkiBindSiteDto okkiBindSiteDto) {
+        // 请求okki平台接口
+        Map<String, String> query = new TreeMap<>();
+        query.put("sign_method", "hmac-md5");
+        query.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        query.put("site_id", "sp_weichi");
+        query.put("method", "bindSiteWithRole");
+        Map<String, Object> postData = new HashMap<>();
+        try {
+            String queryStr = HttpClientUtils.buildQueryString(query);
+
+            // 字符串转数组
+            String siteIds = okkiBindSiteDto.getSiteId();
+            String[] split = siteIds.split(",");
+            postData.put("site_ids", split);
+
+            Map<Integer, Object> userRoleMap = buildUserRoleMap(okkiBindSiteDto);
+            postData.put("user_sets", userRoleMap);
+            log.info("postData:{}", FastJsonUtil.toJSONString(postData));
+
+            String body = HttpClientUtils.toJsonString(postData);
+            String signStr = queryStr + body;
+            query.put("signature", HttpClientUtils.generateHmacMD5(signStr, CLIENT_SECRET));
+            String okkiUrl = URL + "?" + HttpClientUtils.buildQueryString(query);
+            log.info("url:" + okkiUrl + ",body:" + body);
+            String res = HttpClientUtils.doPost(okkiUrl, body);
+            log.info(res);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("code").equals(0)) {
+                // 保存站点数据
+                buildOkkiSiteUser(okkiBindSiteDto);
+            } else {
+                throw new RuntimeException(jsonObject.get("msg").toString());
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 构建用户角色映射
+     */
+    private Map<Integer, Object> buildUserRoleMap(OkkiBindSiteDto okkiBindSiteDto) {
+        Map<Integer, Object> userRoleMap = new HashMap<>();
+
+        addRoleToMap(userRoleMap, 1, okkiBindSiteDto.getServiceManageUser());
+        addRoleToMap(userRoleMap, 5, okkiBindSiteDto.getDataUser());
+        addRoleToMap(userRoleMap, 2, okkiBindSiteDto.getKefuUser());
+        addRoleToMap(userRoleMap, 7, okkiBindSiteDto.getSeoUser());
+        addRoleToMap(userRoleMap, 9, okkiBindSiteDto.getSemManageUser());
+        addRoleToMap(userRoleMap, 10, okkiBindSiteDto.getSemUser());
+        addRoleToMap(userRoleMap, 4, okkiBindSiteDto.getUiUser());
+        addRoleToMap(userRoleMap, 11, okkiBindSiteDto.getWebsiteUser());
+        addRoleToMap(userRoleMap, 8, okkiBindSiteDto.getSocialUser());
+        addRoleToMap(userRoleMap, 12, okkiBindSiteDto.getRdUser());
+
+        return userRoleMap;
+    }
+
+    /**
+     * 向用户角色映射中添加角色
+     */
+    private void addRoleToMap(Map<Integer, Object> userRoleMap, int roleType, String userId) {
+        if (StringUtils.isNotEmpty(userId)) {
+            String[] userIds = userId.split(",");
+            userRoleMap.put(roleType, userIds);
+        }
+    }
+
+    /**
+     * 构建OkkiSite对象
+     */
+    private void buildOkkiSiteUser(OkkiBindSiteDto okkiBindSiteDto) {
+        List<OkkiSiteUser> okkiSiteUsers = new ArrayList<>();
+
+        try {
+            // 删除已有的站点用户
+            QueryWrapper<OkkiSiteUser> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("site_id", Integer.valueOf(okkiBindSiteDto.getSiteId()));
+            boolean isRemoved = okkiSiteUserService.remove(queryWrapper);
+            log.info("Removed existing site users for siteId {}: {}", okkiBindSiteDto.getSiteId(), isRemoved);
+
+            // 用户类型映射
+            Map<String, String> userTypeMapping = new HashMap<>();
+            userTypeMapping.put("serviceManageUser", okkiBindSiteDto.getServiceManageUser());
+            userTypeMapping.put("dataUser", okkiBindSiteDto.getDataUser());
+            userTypeMapping.put("kefuUser", okkiBindSiteDto.getKefuUser());
+            userTypeMapping.put("seoUser", okkiBindSiteDto.getSeoUser());
+            userTypeMapping.put("semManageUser", okkiBindSiteDto.getSemManageUser());
+            userTypeMapping.put("semUser", okkiBindSiteDto.getSemUser());
+            userTypeMapping.put("uiUser", okkiBindSiteDto.getUiUser());
+            userTypeMapping.put("websiteUser", okkiBindSiteDto.getWebsiteUser());
+            userTypeMapping.put("socialUser", okkiBindSiteDto.getSocialUser());
+            userTypeMapping.put("rdUser", okkiBindSiteDto.getRdUser());
+
+            // 遍历映射关系,构建 OkkiSiteUser 对象
+            for (Map.Entry<String, String> entry : userTypeMapping.entrySet()) {
+                String userType = entry.getKey();
+                String userIds = entry.getValue();
+
+                if (userIds != null && !userIds.isEmpty()) {
+                    String[] userArr = userIds.split(",");
+                    for (String s : userArr) {
+                        OkkiSiteUser okkiSiteUser = new OkkiSiteUser();
+                        okkiSiteUser.setSiteId(Integer.valueOf(okkiBindSiteDto.getSiteId()));
+                        okkiSiteUser.setUserId(Integer.valueOf(s));
+                        okkiSiteUser.setType(userType);
+                        okkiSiteUsers.add(okkiSiteUser);
+                    }
+                }
+            }
+
+            // 批量保存站点用户数据
+            boolean isSaved = okkiSiteUserService.saveBatch(okkiSiteUsers);
+            log.info("Saved site users for siteId {}: {}", okkiBindSiteDto.getSiteId(), isSaved);
+
+        } catch (Exception e) {
+            log.error("Error building OkkiSiteUser for siteId {}", okkiBindSiteDto.getSiteId(), e);
+            throw new RuntimeException("Error building OkkiSiteUser", e);
+        }
+    }
+
+    @Override
     public void resetPwd(OkkiAccountResetPwdParam okkiAccountResetPwdParam) {
         // 请求okki平台接口
         Map<String, String> query = new TreeMap<>();
@@ -186,15 +506,59 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
             log.info("url:" + okkiUrl + ",body:" + body);
             String res = HttpClientUtils.doPost(okkiUrl, body);
             log.info(res);
-            JSONObject jsonObject= JSONObject.parseObject(res);
+            JSONObject jsonObject = JSONObject.parseObject(res);
             if (jsonObject.get("code").equals(0)) {
                 okkiAccount.setPassword(okkiAccountResetPwdParam.getNewPassword());
                 this.updateById(okkiAccount);
-            }else {
+            } else {
                 throw new RuntimeException(jsonObject.get("msg").toString());
             }
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
+
+    /**
+     * 获取站点绑定信息
+     *
+     * @param siteId
+     */
+    @Override
+    public Map<String, Object> getSiteBindInfo(Integer siteId) {
+        Map<String, Object> mergedList = new HashMap<>();
+        // 请求okki平台接口
+        Map<String, String> query = new TreeMap<>();
+        query.put("sign_method", "hmac-md5");
+        query.put("timestamp", String.valueOf(System.currentTimeMillis()));
+        query.put("site_id", "sp_weichi");
+        query.put("method", "siteBindInfo");
+        Map<String, Object> postData = new HashMap<>();
+        try {
+            String queryStr = HttpClientUtils.buildQueryString(query);
+            postData.put("site_id", siteId);
+
+            String body = HttpClientUtils.toJsonString(postData);
+            String signStr = queryStr + body;
+            query.put("signature", HttpClientUtils.generateHmacMD5(signStr, CLIENT_SECRET));
+            String okkiUrl = URL + "?" + HttpClientUtils.buildQueryString(query);
+            log.info("url:" + okkiUrl + ",body:" + body);
+            String res = HttpClientUtils.doPost(okkiUrl, body);
+            log.info(res);
+            // {"code":0,"msg":"success","now":"2024-05-06 15:34:54","data":[]}
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("code").equals(0)) {
+                JSONObject dataObject = jsonObject.getJSONObject("data");
+                Map<String, Object> check = FastJsonUtil.parseObject(dataObject.get("check").toString(), Map.class);
+                Map<String, Object> other = FastJsonUtil.parseObject(dataObject.get("other").toString(), Map.class);
+                mergedList.putAll(check);
+                mergedList.putAll(other);
+            }
+//            else {
+//                throw new RuntimeException(jsonObject.get("msg").toString());
+//            }
+        } catch (Exception e) {
+//            throw new RuntimeException(e);
+        }
+        return mergedList;
+    }
 }

+ 195 - 129
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/controller/OkkiSiteController.java

@@ -11,135 +11,200 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.okki.account.service.IOkkiAccountService;
 import org.jeecg.modules.okki.site.entity.OkkiSite;
 import org.jeecg.modules.okki.site.service.IOkkiSiteService;
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
+import org.jeecg.modules.okki.siteuser.service.IOkkiSiteUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
+import java.util.*;
 
 /**
  * @Description: 站点
  * @Author: jeecg-boot
- * @Date:   2024-04-29
+ * @Date: 2024-04-29
  * @Version: V1.0
  */
-@Api(tags="站点")
+@Api(tags = "站点")
 @RestController
 @RequestMapping("/site/okkiSite")
 @Slf4j
 public class OkkiSiteController extends JeecgController<OkkiSite, IOkkiSiteService> {
-	@Autowired
-	private IOkkiSiteService okkiSiteService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param okkiSite
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "站点-分页列表查询")
-	@ApiOperation(value="站点-分页列表查询", notes="站点-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<OkkiSite>> queryPageList(OkkiSite okkiSite,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
-		QueryWrapper<OkkiSite> queryWrapper = QueryGenerator.initQueryWrapper(okkiSite, req.getParameterMap());
-		Page<OkkiSite> page = new Page<OkkiSite>(pageNo, pageSize);
-		IPage<OkkiSite> pageList = okkiSiteService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param okkiSite
-	 * @return
-	 */
-	@AutoLog(value = "站点-添加")
-	@ApiOperation(value="站点-添加", notes="站点-添加")
-	@RequiresPermissions("site:okki_site:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody OkkiSite okkiSite) {
-		okkiSiteService.save(okkiSite);
-		return Result.OK("添加成功!");
-	}
-
-	/**
-	 *  编辑
-	 *
-	 * @param okkiSite
-	 * @return
-	 */
-	@AutoLog(value = "站点-编辑")
-	@ApiOperation(value="站点-编辑", notes="站点-编辑")
-	@RequiresPermissions("site:okki_site:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody OkkiSite okkiSite) {
-		okkiSiteService.updateById(okkiSite);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "站点-通过id删除")
-	@ApiOperation(value="站点-通过id删除", notes="站点-通过id删除")
-	@RequiresPermissions("site:okki_site:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		okkiSiteService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "站点-批量删除")
-	@ApiOperation(value="站点-批量删除", notes="站点-批量删除")
-	@RequiresPermissions("site:okki_site:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.okkiSiteService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "站点-通过id查询")
-	@ApiOperation(value="站点-通过id查询", notes="站点-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<OkkiSite> queryById(@RequestParam(name="id",required=true) String id) {
-		OkkiSite okkiSite = okkiSiteService.getById(id);
-		if(okkiSite==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(okkiSite);
-	}
+    @Autowired
+    private IOkkiSiteService okkiSiteService;
+
+    @Autowired
+    private IOkkiAccountService okkiAccountService;
+
+    @Autowired
+    private IOkkiSiteUserService okkiSiteUserService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param okkiSite
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "站点-分页列表查询")
+    @ApiOperation(value = "站点-分页列表查询", notes = "站点-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<OkkiSite>> queryPageList(OkkiSite okkiSite,
+                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                 HttpServletRequest req) {
+        // 初始化查询条件
+        QueryWrapper<OkkiSite> queryWrapper = QueryGenerator.initQueryWrapper(okkiSite, req.getParameterMap());
+        Page<OkkiSite> page = new Page<>(pageNo, pageSize);
+//        queryWrapper.eq("del_flag", 2);
+        IPage<OkkiSite> pageList = okkiSiteService.page(page, queryWrapper);
+
+        // 处理 OkkiSite 列表
+        List<OkkiSite> okkiSites = pageList.getRecords();
+        if (!okkiSites.isEmpty()) {
+            okkiSites.forEach(item -> {
+                Map<String, Object> siteBindInfoMap = okkiAccountService.getSiteBindInfo(Integer.valueOf(item.getSiteId()));
+//                log.info("siteBindInfoMap: {}", FastJsonUtil.toJSONString(siteBindInfoMap));
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "1");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "5");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "2");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "7");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "9");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "10");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "4");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "11");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "8");
+                okkiSiteService.setApiOkkiSiteUserStr(item, siteBindInfoMap, "12");
+
+//                QueryWrapper<OkkiSiteUser> queryWrapper1 = new QueryWrapper<>();
+//                queryWrapper1.eq("site_id",Integer.valueOf(item.getSiteId()));
+//                List<OkkiSiteUser> okkiSiteUsers = okkiSiteUserService.getSiteUserInfoBySiteId(Integer.valueOf(item.getSiteId()));
+//                log.info("okkiSiteUsers:{}",FastJsonUtil.toJSONString(okkiSiteUsers));
+//
+//                // 调用方法处理数据
+//                Map<String, List<OkkiSiteUser>> result = groupByType(okkiSiteUsers);
+//                log.info("result:{}",FastJsonUtil.toJSONString(result));
+//
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "serviceManageUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "kefuUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "seoUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "semManageUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "dataUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "semUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "websiteUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "uiUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "socialUser");
+//                okkiSiteService.setOkkiSiteUserStr(item, result, "rdUser");
+            });
+        }
+
+        return Result.OK(pageList);
+    }
+
+    public static Map<String, List<OkkiSiteUser>> groupByType(List<OkkiSiteUser> okkiSiteUsers) {
+        Map<String, List<OkkiSiteUser>> groupedData = new HashMap<>();
+
+        for (int i = 0; i < okkiSiteUsers.size(); i++) {
+            OkkiSiteUser okkiSiteUser = okkiSiteUsers.get(i);;
+            String type = okkiSiteUser.getType();
+            groupedData.putIfAbsent(type, new ArrayList<>());
+
+            groupedData.get(type).add(okkiSiteUser);
+        }
+        return groupedData;
+    }
+
+
+    /**
+     * 添加
+     *
+     * @param okkiSite
+     * @return
+     */
+    @AutoLog(value = "站点-添加")
+    @ApiOperation(value = "站点-添加", notes = "站点-添加")
+    @RequiresPermissions("site:okki_site:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody OkkiSite okkiSite) {
+        okkiSiteService.save(okkiSite);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param okkiSite
+     * @return
+     */
+    @AutoLog(value = "站点-编辑")
+    @ApiOperation(value = "站点-编辑", notes = "站点-编辑")
+    @RequiresPermissions("site:okki_site:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody OkkiSite okkiSite) {
+        okkiSiteService.updateById(okkiSite);
+        return Result.OK("编辑成功!");
+    }
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param okkiSite
-    */
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "站点-通过id删除")
+    @ApiOperation(value = "站点-通过id删除", notes = "站点-通过id删除")
+    @RequiresPermissions("site:okki_site:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        okkiSiteService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "站点-批量删除")
+    @ApiOperation(value = "站点-批量删除", notes = "站点-批量删除")
+    @RequiresPermissions("site:okki_site:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.okkiSiteService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "站点-通过id查询")
+    @ApiOperation(value = "站点-通过id查询", notes = "站点-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<OkkiSite> queryById(@RequestParam(name = "id", required = true) String id) {
+        OkkiSite okkiSite = okkiSiteService.getById(id);
+        if (okkiSite == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(okkiSite);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param okkiSite
+     */
     @RequiresPermissions("site:okki_site:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, OkkiSite okkiSite) {
@@ -147,30 +212,31 @@ public class OkkiSiteController extends JeecgController<OkkiSite, IOkkiSiteServi
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("site:okki_site:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         return super.importExcel(request, response, OkkiSite.class);
     }
 
-	/**
-	 * 变更状态
-	 * @param okkiSite
-	 * @return
-	 */
-	@PostMapping(value = "/status")
-	public Result<String> changeStatus(@RequestBody OkkiSite okkiSite) throws Exception {
-		boolean result = okkiSiteService.changeStatus(okkiSite);
-		if (result) {
-			return Result.OK("操作成功");
-		}else {
-			return Result.error("操作失败");
-		}
-	}
+    /**
+     * 变更状态
+     *
+     * @param okkiSite
+     * @return
+     */
+    @PostMapping(value = "/status")
+    public Result<String> changeStatus(@RequestBody OkkiSite okkiSite) throws Exception {
+        boolean result = okkiSiteService.changeStatus(okkiSite);
+        if (result) {
+            return Result.OK("操作成功");
+        } else {
+            return Result.error("操作失败");
+        }
+    }
 }

+ 62 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/entity/OkkiSite.java

@@ -13,6 +13,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @Description: 站点
@@ -115,6 +116,67 @@ public class OkkiSite implements Serializable {
     @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
     @ApiModelProperty(value = "所属人员")
     private java.lang.String sysUserCode;
+
+    @TableField(exist = false)
+    private String serviceManageUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> serviceManageUser;
+
+    @TableField(exist = false)
+    private String dataUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> dataUser;
+
+    @TableField(exist = false)
+    private String kefuUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> kefuUser;
+
+    @TableField(exist = false)
+    private String seoUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> seoUser;
+
+    @TableField(exist = false)
+    private String semManageUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> semManageUser;
+
+    @TableField(exist = false)
+    private String semUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> semUser;
+
+    @TableField(exist = false)
+    private String uiUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> uiUser;
+
+    @TableField(exist = false)
+    private String websiteUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> websiteUser;
+
+    @TableField(exist = false)
+    private String socialUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> socialUser;
+
+    @TableField(exist = false)
+    private String rdUserStr;
+
+    @TableField(exist = false)
+    private List<Integer> rdUser;
+
     /**
      * 删除状态(0,正常,1已删除)
      */

+ 13 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/IOkkiSiteService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.okki.site.entity.OkkiSite;
 import org.jeecg.modules.okki.site.param.ChangeSiteStatusParam;
 import org.jeecg.modules.okki.site.param.OkkiSiteParam;
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
 
 import java.util.List;
 import java.util.Map;
@@ -11,7 +12,7 @@ import java.util.Map;
 /**
  * @Description: 站点
  * @Author: jeecg-boot
- * @Date:   2024-04-29
+ * @Date: 2024-04-29
  * @Version: V1.0
  */
 public interface IOkkiSiteService extends IService<OkkiSite> {
@@ -23,4 +24,15 @@ public interface IOkkiSiteService extends IService<OkkiSite> {
     boolean okkiChangeStatus(ChangeSiteStatusParam param);
 
     boolean insertSite(OkkiSiteParam okkiSiteParam);
+
+    /**
+     * 设置服务管理用户
+     *
+     * @param item
+     * @param mergedList
+     * @param key
+     */
+    public void setApiOkkiSiteUserStr(OkkiSite item, Map<String, Object> mergedList, String key);
+
+    public void setOkkiSiteUserStr(OkkiSite item, Map<String, List<OkkiSiteUser>> okkiSiteUsers, String key);
 }

+ 3 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/FeiShuSheetServiceImpl.java

@@ -116,7 +116,9 @@ public class FeiShuSheetServiceImpl implements IFeiShuSheetService {
                 sb.append(",").append(recordSheetDto.getSiteId());
                 account.setSiteIds(sb.toString());
 
-                okkiAccountService.bindSites(account);
+//                okkiAccountService.bindSites(account);
+                // todo 接口升级
+//                okkiAccountService.bindSitesV2(account);
                 log.info("结束:第{}个 omsId:{} 的用户,绑定新站点", i + 1, omsId);
                 log.info("```````````````````");
             }

+ 158 - 3
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/site/service/impl/OkkiSiteServiceImpl.java

@@ -1,11 +1,14 @@
 package org.jeecg.modules.okki.site.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.FastJsonUtil;
 import org.jeecg.common.util.ThreadPoolUtil;
+import org.jeecg.modules.okki.account.dto.OkkiUserInfoDto;
 import org.jeecg.modules.okki.site.entity.OkkiSite;
 import org.jeecg.modules.okki.site.entity.OkkiSiteStatusChangeLog;
 import org.jeecg.modules.okki.site.mapper.OkkiSiteMapper;
@@ -14,15 +17,15 @@ import org.jeecg.modules.okki.site.param.OkkiSiteParam;
 import org.jeecg.modules.okki.site.service.IFeiShuCommonService;
 import org.jeecg.modules.okki.site.service.IOkkiSiteService;
 import org.jeecg.modules.okki.site.service.IOkkiSiteStatusChangeLogService;
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
 import org.jeecg.modules.okki.utils.HttpClientUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 站点
@@ -167,4 +170,156 @@ public class OkkiSiteServiceImpl extends ServiceImpl<OkkiSiteMapper, OkkiSite> i
             return result;
         }
     }
+
+    /**
+     * 根据 key 获取用户列表并拼接昵称
+     *
+     * @param item
+     * @param mergedList
+     * @param key
+     */
+    public void setApiOkkiSiteUserStr(OkkiSite item, Map<String, Object> mergedList, String key) {
+        Object object = mergedList.get(key);
+        if (object != null) {
+//            log.info("serviceManageUsers (key={}): {}", key, FastJsonUtil.toJSONString(object));
+
+            List<OkkiUserInfoDto> userInfoList = new ArrayList<>();
+            JSONArray jsonArray = JSONArray.parseArray(object.toString());
+
+            for (int i = 0; i < jsonArray.size(); i++) {
+                JSONObject jsonObject = jsonArray.getJSONObject(i);
+                OkkiUserInfoDto userInfo = jsonObject.toJavaObject(OkkiUserInfoDto.class);
+                userInfoList.add(userInfo);
+            }
+
+            // 拼接昵称
+            String nickNames = userInfoList.stream()
+                    .map(OkkiUserInfoDto::getNickname)
+                    .collect(Collectors.joining(","));
+
+            // 拼接userId
+            List<Integer> userIds = userInfoList.stream()
+                    .map(OkkiUserInfoDto::getUserId)
+                    .collect(Collectors.toList());
+
+            // 根据 key 设置不同的字段
+            switch (key) {
+                case "1":
+                    item.setServiceManageUserStr(nickNames);
+                    item.setServiceManageUser(userIds);
+                    break;
+                case "5":
+                    item.setDataUserStr(nickNames);
+                    item.setDataUser(userIds);
+                    break;
+                case "2":
+                    item.setKefuUserStr(nickNames);
+                    item.setKefuUser(userIds);
+                    break;
+                case "7":
+                    item.setSeoUserStr(nickNames);
+                    item.setSeoUser(userIds);
+                    break;
+                case "9":
+                    item.setSemManageUserStr(nickNames);
+                    item.setSemManageUser(userIds);
+                    break;
+                case "10":
+                    item.setSemUserStr(nickNames);
+                    item.setSemUser(userIds);
+                    break;
+                case "4":
+                    item.setUiUserStr(nickNames);
+                    item.setUiUser(userIds);
+                    break;
+                case "11":
+                    item.setWebsiteUserStr(nickNames);
+                    item.setWebsiteUser(userIds);
+                    break;
+                case "8":
+                    item.setSocialUserStr(nickNames);
+                    item.setSocialUser(userIds);
+                    break;
+                case "12":
+                    item.setRdUserStr(nickNames);
+                    item.setRdUser(userIds);
+                    break;
+            }
+        }
+    }
+
+    public void setOkkiSiteUserStr(OkkiSite item, Map<String, List<OkkiSiteUser>> okkiSiteUsers, String key) {
+        log.info("okkiSiteUsers:{}", FastJsonUtil.toJSONString(okkiSiteUsers));
+        if(!okkiSiteUsers.containsKey(key)){
+            return;
+        }
+        List<OkkiSiteUser> okkiSiteUsers1 = FastJsonUtil.parseList(FastJsonUtil.toJSONString(okkiSiteUsers.get(key)),OkkiSiteUser.class);
+        if (!okkiSiteUsers1.isEmpty()) {
+//            log.info("serviceManageUsers (key={}): {}", key, FastJsonUtil.toJSONString(okkiSiteUsers.get(key)));
+            List<OkkiUserInfoDto> userInfoList = new ArrayList<>();
+            for (int i = 0; i < okkiSiteUsers1.size(); i++) {
+                OkkiSiteUser okkiSiteUser = okkiSiteUsers1.get(i);
+
+                OkkiUserInfoDto userInfoDto = new OkkiUserInfoDto();
+                userInfoDto.setUserId(okkiSiteUser.getUserId());
+                userInfoDto.setNickname(okkiSiteUser.getNickname());
+                userInfoDto.setAccount(okkiSiteUser.getAccount());
+                userInfoList.add(userInfoDto);
+            }
+
+            // 拼接昵称
+            String nickNames = userInfoList.stream()
+                    .map(OkkiUserInfoDto::getNickname)
+                    .collect(Collectors.joining(","));
+
+            // 拼接userId
+            List<Integer> userIds = userInfoList.stream()
+                    .map(OkkiUserInfoDto::getUserId)
+                    .collect(Collectors.toList());
+
+            // 根据 key 设置不同的字段
+            switch (key) {
+                case "serviceManageUser":
+                    item.setServiceManageUserStr(nickNames);
+                    item.setServiceManageUser(userIds);
+                    break;
+                case "dataUser":
+                    item.setDataUserStr(nickNames);
+                    item.setDataUser(userIds);
+                    break;
+                case "kefuUser":
+                    item.setKefuUserStr(nickNames);
+                    item.setKefuUser(userIds);
+                    break;
+                case "seoUser":
+                    item.setSeoUserStr(nickNames);
+                    item.setSeoUser(userIds);
+                    break;
+                case "semManageUser":
+                    item.setSemManageUserStr(nickNames);
+                    item.setSemManageUser(userIds);
+                    break;
+                case "semUser":
+                    item.setSemUserStr(nickNames);
+                    item.setSemUser(userIds);
+                    break;
+                case "uiUser":
+                    item.setUiUserStr(nickNames);
+                    item.setUiUser(userIds);
+                    break;
+                case "websiteUser":
+                    item.setWebsiteUserStr(nickNames);
+                    item.setWebsiteUser(userIds);
+                    break;
+                case "socialUser":
+                    item.setSocialUserStr(nickNames);
+                    item.setSocialUser(userIds);
+                    break;
+                case "rdUser":
+                    item.setRdUserStr(nickNames);
+                    item.setRdUser(userIds);
+                    break;
+            }
+        }
+    }
 }

+ 162 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/controller/OkkiSiteUserController.java

@@ -0,0 +1,162 @@
+package org.jeecg.modules.okki.siteuser.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
+import org.jeecg.modules.okki.siteuser.service.IOkkiSiteUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+ /**
+ * @Description: okki_site_user
+ * @Author: jeecg-boot
+ * @Date:   2024-11-15
+ * @Version: V1.0
+ */
+@Api(tags="okki_site_user")
+@RestController
+@RequestMapping("/okki/okkiSiteUser")
+@Slf4j
+public class OkkiSiteUserController extends JeecgController<OkkiSiteUser, IOkkiSiteUserService> {
+	@Autowired
+	private IOkkiSiteUserService okkiSiteUserService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param okkiSiteUser
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "okki_site_user-分页列表查询")
+	@ApiOperation(value="okki_site_user-分页列表查询", notes="okki_site_user-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<OkkiSiteUser>> queryPageList(OkkiSiteUser okkiSiteUser,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<OkkiSiteUser> queryWrapper = QueryGenerator.initQueryWrapper(okkiSiteUser, req.getParameterMap());
+		Page<OkkiSiteUser> page = new Page<OkkiSiteUser>(pageNo, pageSize);
+		IPage<OkkiSiteUser> pageList = okkiSiteUserService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param okkiSiteUser
+	 * @return
+	 */
+	@AutoLog(value = "okki_site_user-添加")
+	@ApiOperation(value="okki_site_user-添加", notes="okki_site_user-添加")
+	@RequiresPermissions("okki:okki_site_user:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody OkkiSiteUser okkiSiteUser) {
+		okkiSiteUserService.save(okkiSiteUser);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param okkiSiteUser
+	 * @return
+	 */
+	@AutoLog(value = "okki_site_user-编辑")
+	@ApiOperation(value="okki_site_user-编辑", notes="okki_site_user-编辑")
+	@RequiresPermissions("okki:okki_site_user:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody OkkiSiteUser okkiSiteUser) {
+		okkiSiteUserService.updateById(okkiSiteUser);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "okki_site_user-通过id删除")
+	@ApiOperation(value="okki_site_user-通过id删除", notes="okki_site_user-通过id删除")
+	@RequiresPermissions("okki:okki_site_user:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		okkiSiteUserService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "okki_site_user-批量删除")
+	@ApiOperation(value="okki_site_user-批量删除", notes="okki_site_user-批量删除")
+	@RequiresPermissions("okki:okki_site_user:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.okkiSiteUserService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "okki_site_user-通过id查询")
+	@ApiOperation(value="okki_site_user-通过id查询", notes="okki_site_user-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<OkkiSiteUser> queryById(@RequestParam(name="id",required=true) String id) {
+		OkkiSiteUser okkiSiteUser = okkiSiteUserService.getById(id);
+		if(okkiSiteUser==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(okkiSiteUser);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param okkiSiteUser
+    */
+    @RequiresPermissions("okki:okki_site_user:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, OkkiSiteUser okkiSiteUser) {
+        return super.exportXls(request, okkiSiteUser, OkkiSiteUser.class, "okki_site_user");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    @RequiresPermissions("okki:okki_site_user:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, OkkiSiteUser.class);
+    }
+
+}

+ 51 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/entity/OkkiSiteUser.java

@@ -0,0 +1,51 @@
+package org.jeecg.modules.okki.siteuser.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: okki_site_user
+ * @Author: jeecg-boot
+ * @Date:   2024-11-15
+ * @Version: V1.0
+ */
+@Data
+@TableName("okki_site_user")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="okki_site_user对象", description="okki_site_user")
+public class OkkiSiteUser implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**siteId*/
+	@Excel(name = "siteId", width = 15)
+    @ApiModelProperty(value = "siteId")
+    private java.lang.Integer siteId;
+	/**类型*/
+	@Excel(name = "类型", width = 15)
+    @ApiModelProperty(value = "类型")
+    private java.lang.String type;
+	/**用户id*/
+	@Excel(name = "用户id", width = 15)
+    @ApiModelProperty(value = "用户id")
+    private java.lang.Integer userId;
+
+    @TableField(exist = false)
+    private String nickname;
+
+    @TableField(exist = false)
+    private String account;
+}

+ 20 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/mapper/OkkiSiteUserMapper.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.okki.siteuser.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: okki_site_user
+ * @Author: jeecg-boot
+ * @Date:   2024-11-15
+ * @Version: V1.0
+ */
+public interface OkkiSiteUserMapper extends BaseMapper<OkkiSiteUser> {
+
+    public List<OkkiSiteUser> getSiteUserInfoBySiteId(Integer siteId);
+
+    public List<OkkiSiteUser> getSiteUserInfoByUserId(Integer siteId);
+}

+ 15 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/mapper/xml/OkkiSiteUserMapper.xml

@@ -0,0 +1,15 @@
+<?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="org.jeecg.modules.okki.siteuser.mapper.OkkiSiteUserMapper">
+
+    <select id="getSiteUserInfoBySiteId" resultType="org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser">
+        SELECT t1.*,t2.name as nickname,t2.account FROM `okki_site_user` t1 LEFT JOIN okki_account t2 on t1.user_id = t2.user_id
+        where t1.site_id = #{siteId}
+    </select>
+
+    <select id="getSiteUserInfoByUserId" resultType="org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser">
+        SELECT t1.*,t2.name as nickname,t2.account FROM `okki_site_user` t1 LEFT JOIN okki_account t2 on t1.user_id = t2.user_id
+        where t1.user_id = #{userId}
+    </select>
+
+</mapper>

+ 28 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/service/IOkkiSiteUserService.java

@@ -0,0 +1,28 @@
+package org.jeecg.modules.okki.siteuser.service;
+
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * @Description: okki_site_user
+ * @Author: jeecg-boot
+ * @Date:   2024-11-15
+ * @Version: V1.0
+ */
+public interface IOkkiSiteUserService extends IService<OkkiSiteUser> {
+
+    /**
+     * 获取站点用户信息
+     * @return
+     */
+    public List<OkkiSiteUser> getSiteUserInfoBySiteId(Integer siteId);
+
+
+    /**
+     * 获取站点用户信息
+     * @return
+     */
+    public List<OkkiSiteUser> getSiteUserInfoByUserId(Integer userId);
+}

+ 39 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/okki/siteuser/service/impl/OkkiSiteUserServiceImpl.java

@@ -0,0 +1,39 @@
+package org.jeecg.modules.okki.siteuser.service.impl;
+
+import org.jeecg.modules.okki.siteuser.entity.OkkiSiteUser;
+import org.jeecg.modules.okki.siteuser.mapper.OkkiSiteUserMapper;
+import org.jeecg.modules.okki.siteuser.service.IOkkiSiteUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Description: okki_site_user
+ * @Author: jeecg-boot
+ * @Date:   2024-11-15
+ * @Version: V1.0
+ */
+@Service
+public class OkkiSiteUserServiceImpl extends ServiceImpl<OkkiSiteUserMapper, OkkiSiteUser> implements IOkkiSiteUserService {
+
+    @Resource
+    private OkkiSiteUserMapper okkiSiteUserMapper;
+
+    /**
+     * 获取站点用户信息
+     * @return
+     */
+    @Override
+    public List<OkkiSiteUser> getSiteUserInfoBySiteId(Integer siteId){
+        return okkiSiteUserMapper.getSiteUserInfoBySiteId(siteId);
+    }
+
+    @Override
+    public List<OkkiSiteUser> getSiteUserInfoByUserId(Integer userId){
+        return okkiSiteUserMapper.getSiteUserInfoByUserId(userId);
+    }
+}