From 6cc2e27994e273bb470eaa570e84596b4b0aec93 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 07 一月 2025 17:37:29 +0800
Subject: [PATCH] 数据共享,暂时只写了个人记事本
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java | 122 +++++++++++++
zhang-content/src/main/java/com/ruoyi/mapper/ZfShareDataMapper.java | 7
zhang-content/src/main/java/com/ruoyi/domain/ZfShareOther.java | 27 +++
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java | 1
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 5
zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java | 29 +++
zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java | 4
zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java | 3
/dev/null | 21 --
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java | 66 ++++++
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java | 25 +-
zhang-content/src/main/java/com/ruoyi/domain/ZfShareData.java | 35 +++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java | 11 +
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java | 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 10
zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java | 161 +++++++++++++++++
16 files changed, 480 insertions(+), 50 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index 6a4b3f0..c5739a7 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -193,7 +193,7 @@
//System.out.println(sysUserRole.getRoleId());
System.out.println("浣犲ソ鍛�");
System.out.println(user.getRoleId());
- if (user.getRoleId().equals(102L)){
+ if (user.getRoleId() != null && user.getRoleId().equals(102L)){
ZInfoUser infoUser = new ZInfoUser();
infoUser.setUserId(user.getUserId());
infoUser.setOldName(user.getUserName());
@@ -201,7 +201,7 @@
infoUser.setIsMyFamily(user.getIsMyFamily());
infoUser.setMomId(user.getMid());
infoUser.setFatherId(user.getFid());
- infoUser.setSex(Integer.valueOf(user.getSex()));
+ if (user.getSex() != null)infoUser.setSex(Integer.valueOf(user.getSex()));
// infoUser.setFamilyId(user.getFamilyId());
infoUser.setSysId(user.getSysId());
@@ -261,11 +261,11 @@
}
- if(infoUser.getFamilyId()!=null)
+ if(infoUser.getIsMyFamily() == 1)
zInfoUserService.saveOrUpdate(infoUser);
else {
System.out.println("瀹跺涵鎴愬憳涓嶈兘淇敼涓烘櫘閫氱敤鎴�");
- return AjaxResult.success("瀹跺涵鎴愬憳涓嶈兘淇敼涓烘櫘閫氱敤鎴�");
+ return AjaxResult.error("瀹跺涵鎴愬憳涓嶈兘淇敼涓烘櫘閫氱敤鎴�");
}
//鏇存柊閰嶅伓淇℃伅
if(user.getSpouseId()!=null) {
@@ -306,7 +306,7 @@
}
else {
System.out.println("daniuni");
- return AjaxResult.success("瀹跺涵鎴愬憳涓嶈兘淇敼涓烘櫘閫氱敤鎴�");
+ return AjaxResult.error("瀹跺涵鎴愬憳涓嶈兘淇敼涓烘櫘閫氱敤鎴�");
}
// zInfoUserService.update(infoUser);
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
index 57a304d..b46a287 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
@@ -421,9 +421,16 @@
* 鍒嗕韩缁欏叾浠栧鏃忔暟鎹紝閫氳繃杈撳叆鍚嶅瓧鏌ユ壘鎵�鏈夌殑鍚屽悕鐢ㄦ埛鍜屽鏃忓彿
*/
@PostMapping("/byName")
- public AjaxResult listByNickNameDate(@RequestBody ZInfoUser zInfoUser)
+ public AjaxResult listByUserNameDate(@RequestBody SysUser sysUser)
{
- return zInfoUserService.findInfoUserNameAClan(zInfoUser.getNickName());
+
+ List<SysUser> strings = sysUserMapper.getUserByUserName(sysUser.getUserName());
+ List<String> strings1= new ArrayList<>();
+ for (SysUser s:strings){
+ strings1.add(s.getNickName());
+ }
+
+ return zInfoUserService.findUserNameAClan(strings1);
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java
new file mode 100644
index 0000000..5a2abaa
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java
@@ -0,0 +1,122 @@
+package com.ruoyi.web.controller.zhang;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.domain.ZInfoUser;
+import com.ruoyi.domain.ZfShareOther;
+import com.ruoyi.domain.ZfShareData;
+import com.ruoyi.service.ZInfoUserService;
+import com.ruoyi.service.ZfClanService;
+import com.ruoyi.service.ZfShareDataService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+@RestController
+@RequestMapping("/zfShareData")
+public class ZfShareDataController extends BaseController {
+ @Resource
+ private ZfShareDataService zfShareDataService;
+
+ @Resource
+ private ZInfoUserService zInfoUserService;
+
+ @Resource
+ private ZfClanService zfClanService;
+
+ /**
+ * 鍏变韩缁欎簡璋�
+ * @param zfShareData
+ * @return
+ */
+ @GetMapping("/all")
+ public List<ZfShareOther> listAll(ZfShareData zfShareData) {
+ List<ZfShareData> zfShareData2 = zfShareDataService.selectList();
+ List<ZfShareOther> zfShareOtherList = new ArrayList<>();
+ for (ZfShareData zfShareData1 :zfShareData2){
+ System.out.println("1111111111111111111111");
+ ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getSharedId().longValue());
+ ZfShareOther zfShareOther = new ZfShareOther();
+ zfShareOther.setUserId(infoBysysId.getSysId().intValue());
+ zfShareOther.setUserName(infoBysysId.getNickName());
+ zfShareOther.setClanId(infoBysysId.getClanId());
+ zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
+ zfShareOtherList.add(zfShareOther);
+ }
+ return zfShareOtherList;
+ }
+ /**
+ * 閫氳繃id鏌ユ壘
+ */
+
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return success(zfShareDataService.getById(id));
+ }
+
+ /**
+ * 鏂板鍏变韩
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:add')")
+ @Log(title = "鍏变韩璁板綍", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ZfShareOther zfShareData) {
+ return zfShareDataService.addData(zfShareData.getIds());
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎瀹跺涵澶т簨浠惰褰�
+ */
+ @Log(title = "鍏变韩璁板綍", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
+ return zfShareDataService.deleteData(ids);
+ }
+
+ /**
+ * 鍏变韩鑰� 杈撳叆userid
+ * @param
+ * @return
+ */
+ @GetMapping("/come/{id}")
+ public List<ZfShareOther> list(@PathVariable Long id) {
+ List<ZfShareData> shareId = zfShareDataService.getShareId(id);
+ List<ZfShareOther> zfShareOtherList = new ArrayList<>();
+ for (ZfShareData zfShareData1 : shareId){
+ System.out.println("1111111111111111111111");
+ ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getUserId().longValue());
+ ZfShareOther zfShareOther = new ZfShareOther();
+ zfShareOther.setUserId(infoBysysId.getSysId().intValue());
+ zfShareOther.setUserName(infoBysysId.getNickName());
+ zfShareOther.setClanId(infoBysysId.getClanId());
+ zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
+ zfShareOtherList.add(zfShareOther);
+ }
+ return zfShareOtherList;
+ }
+ /**
+ * 璁剧疆涓昏处鎴� 淇敼MasterAccount鍊�
+ */
+ @Log(title = "鍏变韩璁板綍", businessType = BusinessType.UPDATE)
+ @PutMapping("/setAdminAccount")
+ public AjaxResult edit(@RequestBody ZfShareData zfShareData) {
+ return zfShareDataService.setAdmin(zfShareData.getMasterAccount().longValue());
+ }
+//
+
+ /**
+ * 璁剧疆涓烘墍鏈夌敤鎴峰彲浠ユ煡鐪� 浼犲叆userid
+ */
+ @Log(title = "鍏变韩璁板綍", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit2(@RequestBody ZfShareData zfShareData) {
+ return zfShareDataService.allUser(zfShareData.getUserId().longValue());
+ }
+//
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
index 4f2ecb4..402bcbd 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -53,6 +53,9 @@
*/
public SysUser selectUserByUserName(String userName);
+ public List<SysUser> getUserByUserName(String userName);
+
+
public SysUser selectUserByNickName(String nickName);
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 2443f1b..30699b6 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -167,6 +167,11 @@
where u.user_name = #{userName} and u.del_flag = '0'
</select>
+ <select id="getUserByUserName" parameterType="String" resultMap="SysUserResult">
+ <include refid="selectUserVo"/>
+ where u.user_name = #{userName} and u.del_flag = '0'
+ </select>
+
<select id="selectUserByNickName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ShareOtherClan.java b/zhang-content/src/main/java/com/ruoyi/domain/ShareOtherClan.java
deleted file mode 100644
index a52ccb7..0000000
--- a/zhang-content/src/main/java/com/ruoyi/domain/ShareOtherClan.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.ruoyi.domain;
-
-import lombok.Data;
-
-@Data
-public class ShareOtherClan {
- /**
- * 鍒嗕韩缁欑殑閭d釜浜虹殑id
- */
- private Integer userId;
-
- /**
- * 鍒嗕韩缁欑殑閭d釜浜虹殑鍚嶅瓧
- */
- private String nickName;
-
- /**
- * 鍒嗕韩缁欑殑閭d釜浜虹殑瀹舵棌id
- */
- private Integer clanId;
-}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java b/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
index 442efe1..bb8ab99 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
@@ -250,8 +250,4 @@
*/
@TableField(exist = false)
private List<ZInfoUser> childList;
-
-
-
-
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfShareData.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfShareData.java
new file mode 100644
index 0000000..3a13f19
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfShareData.java
@@ -0,0 +1,35 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("zf_share_data")
+public class ZfShareData {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鍒嗕韩鑰呯殑id
+ */
+ private Integer userId;
+
+ /**
+ * 琚垎浜�呯殑id
+ */
+ private Integer sharedId;
+
+ /**
+ * 涓昏处鎴�
+ */
+ private Integer masterAccount;
+
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfShareOther.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfShareOther.java
new file mode 100644
index 0000000..ab9e38e
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfShareOther.java
@@ -0,0 +1,27 @@
+package com.ruoyi.domain;
+
+import lombok.Data;
+
+@Data
+public class ZfShareOther {
+ /**
+ * 鍒嗕韩鑰呯殑id
+ */
+ private Integer userId;
+ /**
+ * 琚垎浜�呯殑鍚嶅瓧
+ */
+ private String userName;
+
+ /**
+ * 琚垎浜�呭鏃廼d
+ */
+ private Integer clanId;
+
+ /**
+ * 琚垎浜�呭鏃忓悕瀛�
+ */
+ private String clanName;
+
+ private Long[] ids;
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfShareDataMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfShareDataMapper.java
new file mode 100644
index 0000000..249618c
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZfShareDataMapper.java
@@ -0,0 +1,7 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.ZfShareData;
+
+public interface ZfShareDataMapper extends BaseMapper<ZfShareData> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java b/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
index 398efc6..f7c4872 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
@@ -1,6 +1,7 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfRelation;
@@ -26,7 +27,7 @@
List<ZInfoUser> selectByClanId(Integer clanId);
- AjaxResult findInfoUserNameAClan(String nickName);
+ AjaxResult findUserNameAClan(List<String> nickNames);
List<ZInfoUser> getDataBySex(Integer sex,Integer clanId);
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java
new file mode 100644
index 0000000..dfa51b6
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java
@@ -0,0 +1,29 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.domain.ZfDoctor;
+import com.ruoyi.domain.ZfShareData;
+import com.ruoyi.domain.ZfShareOther;
+import org.aspectj.weaver.loadtime.Aj;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+public interface ZfShareDataService extends IService<ZfShareData> {
+
+ List<ZfShareData> selectList();
+
+ List<ZfShareData> selectByIds(Long[] ids);
+
+ AjaxResult addData(Long[] userIds);
+
+ AjaxResult deleteData(Long[] ids);
+
+ AjaxResult setAdmin(Long id);
+
+ AjaxResult allUser(Long id);
+
+ List<ZfShareData> getShareId(Long id);
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
index 3d94165..35f8603 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
@@ -13,10 +13,7 @@
import com.ruoyi.domain.*;
import com.ruoyi.domain.dto.*;
import com.ruoyi.mapper.ZInfoUserMapper;
-import com.ruoyi.service.ZInfoUserService;
-import com.ruoyi.service.ZfFamilyService;
-import com.ruoyi.service.ZfRelationService;
-import com.ruoyi.service.ZfRoleService;
+import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +23,6 @@
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
-
/**
* <p>
* 鏈嶅姟瀹炵幇绫�
@@ -51,6 +47,10 @@
@Resource
private ZfRoleService zfRoleService;
+
+ @Resource
+ private ZfClanService zfClanService;
+
@Override
public AjaxResult selectInfoList(ZInfoUser zInfoUser, Integer pageNum, Integer pageSize) {
@@ -100,22 +100,25 @@
// }
@Override
- public AjaxResult findInfoUserNameAClan(String nickName)
+ public AjaxResult findUserNameAClan(List<String> nickNames)
{
+ List<ZfShareOther> shareOtherClans = new ArrayList<>();
+ for (String nickName:nickNames) {
ZInfoUser zInfoUser = new ZInfoUser();
zInfoUser.setNickName(nickName);
LambdaQueryWrapper<ZInfoUser> lqw = buildCondition(zInfoUser);
List<ZInfoUser> zInfoUsers = list(lqw);
- List<ShareOtherClan> shareOtherClans = new ArrayList<>();
+
for (ZInfoUser zInfoUser1: zInfoUsers) {
- ShareOtherClan shareOtherClan = new ShareOtherClan();
- shareOtherClan.setNickName(zInfoUser1.getNickName());
+ ZfShareOther shareOtherClan = new ZfShareOther();
+ shareOtherClan.setUserName(zInfoUser1.getNickName());
shareOtherClan.setUserId(zInfoUser1.getUserId().intValue());
shareOtherClan.setClanId(zInfoUser1.getClanId());
+ shareOtherClan.setClanName(zfClanService.getById(zInfoUser1.getClanId()).getClanName());
shareOtherClans.add(shareOtherClan);
- }
+ }}
return AjaxResult.success(shareOtherClans);
}
@@ -786,6 +789,8 @@
}
+
+
private void recursionFindUser(List<ZInfoUser> treeList) {
if (treeList == null || treeList.isEmpty()) {
return;
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java
index 102385f..5fd0d2e 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java
@@ -11,10 +11,9 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.domain.ZSelfNote;
+import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZSelfNoteMapper;
-import com.ruoyi.service.EsService;
-import com.ruoyi.service.ZSelfNoteService;
+import com.ruoyi.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -22,6 +21,7 @@
import javax.annotation.Resource;
import java.util.*;
+import java.util.stream.Collectors;
/**
* <p>
@@ -38,7 +38,16 @@
ZSelfNoteService zSelfNoteService;
@Resource
+ ZfShareDataService zfShareDataService;
+
+ @Resource
private EsService esSer;
+
+ @Resource
+ private ZInfoUserService zInfoUserService;
+
+ @Resource
+ private ZfClanService zfClanService;
private LambdaQueryWrapper<ZSelfNote> uniqueCondition(ZSelfNote zSelfNote) {
LambdaQueryWrapper<ZSelfNote> lqw = new LambdaQueryWrapper<>();
@@ -51,9 +60,9 @@
return lqw;
}
- private LambdaQueryWrapper<ZSelfNote> buildCondition(ZSelfNote zSelfNote, Long userId) {
+ private LambdaQueryWrapper<ZSelfNote> buildCondition(ZSelfNote zSelfNote) {
LambdaQueryWrapper<ZSelfNote> lqw = new LambdaQueryWrapper<>();
- lqw.eq(userId != null, ZSelfNote::getUid, userId)
+ lqw.in(ZSelfNote::getUid, getAll())
.like(StringUtils.isNotEmpty(zSelfNote.getPeople()), ZSelfNote::getPeople, zSelfNote.getPeople())
.like(StringUtils.isNotEmpty(zSelfNote.getTitle()), ZSelfNote::getTitle, zSelfNote.getTitle())
.like(StringUtils.isNotEmpty(zSelfNote.getAddress()),ZSelfNote::getAddress,zSelfNote.getAddress())
@@ -63,19 +72,62 @@
return lqw;
}
+ public List<Long> getAll(){
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+
+ List<ZfShareData> shareId = zfShareDataService.getShareId(userId);
+ List<ZfShareData> zfShareDataList = zfShareDataService.selectList();
+ List<Long> all = new ArrayList<>();
+ all.add(userId);
+ if(shareId.size() >0 ) {
+ if (shareId.get(0).getMasterAccount() == 0 || shareId.get(0).getMasterAccount() == userId.intValue()) {
+ all.add(shareId.get(0).getUserId().longValue());
+ }
+ else {
+ all.clear();
+ all.add(0L);
+ return all;
+ }
+ }
+ if (zfShareDataList.size()>0 && (zfShareDataList.get(0).getMasterAccount() == 0 || zfShareDataList.get(0).getMasterAccount() == userId.intValue())){
+ for (ZfShareData zfShareOther: zfShareDataList) {
+ all.add(zfShareOther.getSharedId().longValue());
+ }
+ }
+
+ return all;
+ }
+
/**
* 鍒嗛〉鏌ユ壘
*/
@Override
public AjaxResult selectDataList(ZSelfNote zSelfNote, Integer pageNum, Integer pageSize) {
+ LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote);
SysUser user = SecurityUtils.getLoginUser().getUser();
Long userId = user.getUserId();
- LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote, userId);
+ List<ZfShareData> zfShareOtherList = zfShareDataService.selectList();
+ List<ZfShareData> shareId = zfShareDataService.getShareId(userId);
+ if (list(lqw).size()==0) {
+ Integer masterAccount = 0;
+ if(zfShareOtherList.size()>0 ){
+ masterAccount = zfShareOtherList.get(0).getMasterAccount();}
+ if(shareId.size()>0){
+ masterAccount = shareId.get(0).getMasterAccount();
+ }
+ ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(masterAccount.longValue());
+ if (infoBysysId !=null)
+ { ZfClan byId = zfClanService.getById(infoBysysId.getClanId());
+ return AjaxResult.success("璇峰墠寰�瀹舵棌鍚嶇О涓�"+byId.getClanName()+",鐢ㄦ埛鍚嶄负"+infoBysysId.getNickName()+"鐨勭敤鎴疯处鍙蜂笅鏌ョ湅");
+ }
+ }
Page<ZSelfNote> pageBean = new Page<>(pageNum, pageSize);
Page<ZSelfNote> pageResult = page(pageBean, lqw);
List<ZSelfNote> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+
HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
return AjaxResult.success(data);
@@ -121,7 +173,7 @@
Long userId = user.getUserId();
ZSelfNote zSelfNote = new ZSelfNote();
- LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote, userId);
+ LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote);
return list(lqw);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
index afd4339..dd20954 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -230,6 +230,7 @@
List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
//鍔犱笂鑷繁瀹跺涵鐨刬d
idList.add(familyId);
+ System.out.println(authority);
//鍔犱笂鐖舵瘝瀹舵棌id
idList.add(fatherFaId);
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java
new file mode 100644
index 0000000..a093263
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java
@@ -0,0 +1,161 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.EsModel;
+import com.ruoyi.common.utils.MapUtils;
+import com.ruoyi.domain.*;
+import com.ruoyi.mapper.ZfShareDataMapper;
+import com.ruoyi.service.EsService;
+import com.ruoyi.service.ZInfoUserService;
+import com.ruoyi.service.ZfClanService;
+import com.ruoyi.service.ZfShareDataService;
+import org.elasticsearch.action.delete.DeleteRequest;
+import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+@Service
+public class ZfShareDataServiceImpl extends ServiceImpl<ZfShareDataMapper, ZfShareData> implements ZfShareDataService {
+
+ @Resource
+ private ZInfoUserService zInfoUserService;
+
+ @Resource
+ private RestHighLevelClient restHighLevelClient;
+
+ @Resource
+ private ZfClanService zfClanService;
+
+
+ @Resource
+ private EsService esSer;
+ private LambdaQueryWrapper<ZfShareData> buildCondition(Long userId) {
+ LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfShareData::getId);
+ lqw.eq(ZfShareData::getUserId,userId);
+ return lqw;
+ }
+
+ private LambdaQueryWrapper<ZfShareData> uniqueCondition(ZfShareData zfShareData) {
+ LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfShareData::getId);
+ lqw.eq(ZfShareData::getSharedId,zfShareData.getSharedId());
+ return lqw;
+ }
+
+ @Override
+ public List<ZfShareData> selectList() {
+ LambdaQueryWrapper<ZfShareData> lqw = buildCondition(getUserId());
+
+ return list(lqw);
+ }
+
+ @Override
+ public List<ZfShareData> selectByIds(Long[] ids) {
+ List<ZfShareData> list = new ArrayList<>();
+ if(ids.length!=0)
+ list = listByIds(Arrays.asList(ids));
+ else
+ list = list();
+ return list;
+ }
+
+ public Long getUserId(){
+ ZInfoUser myself = zInfoUserService.getMyself();
+ return myself.getUserId();
+
+ }
+
+// public Long getSource(Long userId){
+// LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
+// lqw.orderByDesc(ZfShareData::getId);
+// lqw.eq(ZfShareData::getSharedId,userId);
+// if (list(lqw).size() == 0){
+// return userId;
+// }
+// return getSource(userId);
+// }
+ @Override
+ public AjaxResult addData(Long[] userIds) {
+
+ for (Long userId : userIds) {
+ ZfShareData zfShareData = new ZfShareData();
+ zfShareData.setUserId(getUserId().intValue());
+ zfShareData.setSharedId(userId.intValue());
+ zfShareData.setMasterAccount(0);
+ for(ZfShareData zfShareData1:list(buildCondition(getUserId()))){
+ System.out.println(zfShareData1);
+ }
+ if (list(uniqueCondition(zfShareData)).size() == 0) save(zfShareData);
+ else return AjaxResult.error("璇峰嬁閲嶅鍏变韩");
+ }
+ return AjaxResult.success("鏁版嵁鍏变韩鎴愬姛");
+
+
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfShareData> meetings = listByIds(Arrays.asList(ids));
+
+ if (removeByIds(Arrays.asList(ids))) {
+
+ //鍒犻櫎es涓殑鏁版嵁
+ meetings.forEach(meeting -> {
+ EsModel esModel = esSer.findByCtId((meeting.getId().intValue()), "鏁版嵁鍏变韩");
+ if (esModel != null){
+ DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
+ try {
+ restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult setAdmin(Long id) {
+ List<ZfShareData> list = list(buildCondition(getUserId()));
+ list.addAll(getShareId(getUserId()));
+ for (ZfShareData zfShareData1:list){
+ zfShareData1.setMasterAccount(id.intValue());
+ updateById(zfShareData1);
+ }
+ return AjaxResult.success();
+ }
+
+ @Override
+ public AjaxResult allUser(Long id) {
+ List<ZfShareData> list = list(buildCondition(id));
+ list.addAll(getShareId(id));
+ for (ZfShareData zfShareData1:list){
+ zfShareData1.setMasterAccount(0);
+ updateById(zfShareData1);
+ }
+ return AjaxResult.success();
+ }
+
+ @Override
+ public List<ZfShareData> getShareId(Long id) {
+ LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
+ lqw.orderByDesc(ZfShareData::getId);
+ lqw.eq(ZfShareData::getSharedId,id);
+ return list(lqw);
+ }
+}
--
Gitblit v1.9.1