From c35d9c6311b6f9ef75b49559a5c6db75e0a43ac6 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 30 七月 2024 20:06:50 +0800
Subject: [PATCH] 修改bug&分享
---
zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java | 10
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java | 5
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java | 196 ++++++++++++++
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java | 11
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java | 64 ++--
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java | 143 ++++++++++
zhang-content/src/main/java/com/ruoyi/mapper/ZfShareMapper.java | 9
zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 29 +
zhang-content/src/main/java/com/ruoyi/domain/ZfDownload.java | 18 +
zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java | 23 +
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java | 11
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java | 22
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java | 2
zhang-content/src/main/java/com/ruoyi/mapper/ZfDownloadMapper.java | 7
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml | 4
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java | 10
zhang-content/src/main/java/com/ruoyi/domain/ShareMore.java | 5
/dev/null | 9
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 7
zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java | 25 +
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java | 78 +++--
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java | 81 +++++
zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java | 13
zhang-content/src/main/java/com/ruoyi/domain/ZfShare.java | 10
25 files changed, 669 insertions(+), 125 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 bfd8dbb..c35bcf9 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
@@ -1,5 +1,6 @@
package com.ruoyi.web.controller.system;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -17,6 +18,9 @@
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfAncestorService;
import com.ruoyi.service.ZfFamilyService;
+import com.ruoyi.system.domain.SysUserRole;
+import com.ruoyi.system.mapper.SysRoleMapper;
+import com.ruoyi.system.mapper.SysUserRoleMapper;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -73,6 +77,9 @@
@Resource
private ZfAncestorService zfAncestorService;
+
+ @Resource
+ private SysUserRoleMapper sysUserRoleMapper;
/**
* 鑾峰彇鐢ㄦ埛鍒楄〃
*/
@@ -158,6 +165,9 @@
// System.out.println(user.getFamilyId());
// System.out.println("[[[[]]]]]]");
+ Long userId = user.getSysId();
+ SysUserRole sysUserRole=sysUserRoleMapper.selectUserById(userId);
+ if (sysUserRole.getRoleId() == 102){
ZInfoUser infoUser = new ZInfoUser();
infoUser.setUserId(user.getUserId());
infoUser.setOldName(user.getUserName());
@@ -168,6 +178,8 @@
infoUser.setSex(Integer.valueOf(user.getSex()));
// infoUser.setFamilyId(user.getFamilyId());
infoUser.setSysId(user.getSysId());
+
+
if(user.getSpouseId()!=null) {
infoUser.setSpouseId(user.getSpouseId());
}
@@ -207,7 +219,7 @@
zu.setUserId(user.getSpouseId());
zu.setSpouseId(infoUser.getUserId());
zInfoUserService.updateById(zu);
- }
+ }}
// zInfoUserService.update(infoUser);
// .saveOrUpdate(infoUser);
@@ -252,10 +264,18 @@
user.setCreateBy(getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
userService.insertUser(user);
+
+ //鍐欏埌鐢ㄦ埛涓庤鑹插搴旂殑琛�
+ SysUserRole sysUserRole = new SysUserRole();
+ sysUserRole.setUserId(user.getUserId());
+ sysUserRole.setRoleId(user.getRoleId());
+ List<SysUserRole> sysUserRoles = new ArrayList<>();
+ sysUserRoles.add(sysUserRole);
+ sysUserRoleMapper.batchUserRole(sysUserRoles);
+
//鍐欏叆鍒� 鏂板缓绔嬬殑淇℃伅琛ㄩ噷闈�
-
-
// ZfFamily zfFamily = zfFamilyService.getByFamId(userAll.getFamilyId());
+ if (userAll.getRoleId() == 102){
ZInfoUser infoUser = new ZInfoUser();
infoUser.setSysId(user.getUserId());
// infoUser.setUserId(user.getUserId());
@@ -312,6 +332,7 @@
// infoUser.setRoleName(user.g);
// if(userAll.getFamilyId()!=-1) {
+
if(userAll.getRoleId()==102) {
infoUser.setRoleId(3L);
zInfoUserService.save(infoUser);
@@ -322,7 +343,7 @@
zu.setSpouseId(infoUser.getUserId());
zInfoUserService.updateById(zu);
}
- }
+ }}
// zInfoUserService.saveOrUpdate(infoUser);
// LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>();
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java
index 578030a..7fadc32 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java
@@ -90,7 +90,7 @@
public void updateAncestor(ZfAncestor zfAncestor){
SysUser us = new SysUser();
- Long userId = zInfoUserService.getInfoBysysId(zfAncestor.getSysId()).getUserId();
+ Long userId = zInfoUserService.getInfoBysysId(zfAncestor.getSysId()).getUserId();
us.setUserId(zfAncestor.getSysId());
us.setUserName(zfAncestor.getName());
@@ -120,8 +120,10 @@
@PutMapping
public AjaxResult edit(@RequestBody ZfAncestor zfAncestor) {
- zfAncestorService.update(zfAncestor);
+ ZfAncestor spouseSex = zfAncestorService.update(zfAncestor);
updateAncestor(zfAncestor);
+ if (spouseSex.getId() != null)
+ updateAncestor(spouseSex);
return AjaxResult.success();
}
@@ -137,7 +139,10 @@
Long sysId = zfAncestorService.addData(zfAncestor);
zfAncestor.setSpouseId(sysId.intValue());
zfAncestor.setSysId(addAncestor(zfAncestor));
- zfAncestorService.updateById(zfAncestor);
+
+ zfAncestorService.updateById(zfAncestor);
+
+
return AjaxResult.success();
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
index 37f4325..604ee7f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
@@ -1,14 +1,11 @@
package com.ruoyi.web.controller.zhang;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
-import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.domain.ShareMore;
-import com.ruoyi.domain.ZfDoctor;
-import com.ruoyi.domain.ZfDoctorDownload;
+import com.ruoyi.domain.ZfDownload;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfDoctorDownloadService;
import com.ruoyi.service.ZfDoctorService;
@@ -16,10 +13,6 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.stream.Collectors;
import static com.ruoyi.common.core.page.TableSupport.*;
@@ -42,6 +35,7 @@
*/
@PostMapping("/share")
public AjaxResult share(@RequestBody ShareMore zfDoctor){
+ zfDoctor.setSysMenuId(2019L);
return zfDoctorShareService.saveZa(zfDoctor);
}
@@ -50,6 +44,7 @@
*/
@PostMapping("/getInfoByUserId")
public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
+ zfDoctor.setSysMenuId(2019L);
Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return zfDoctorShareService.listByFidAid(zfDoctor,pageNo,pageSize) ;
@@ -69,6 +64,7 @@
*/
@PostMapping("/deleteInfoByUserId")
public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
+ zfDoctor.setSysMenuId(2019L);
return zfDoctorShareService.deleteZa(zfDoctor);
}
@@ -76,18 +72,20 @@
* 涓嬭浇鍒嗕韩鐨勬暟鎹�
*/
@PostMapping("/downloadDate")
- public AjaxResult ifDownLoad(@RequestBody ZfDoctorDownload zfDoctorDownload){
- return zfDoctorDownloadService.addData(zfDoctorDownload);
+ public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
+ zfDownload.setSysMenuId(2019L);
+ return zfDoctorDownloadService.addData(zfDownload);
}
/**
* 灞曠ず涓嬭浇鍒嗕韩鐨勬暟鎹�
*/
@GetMapping("/all")
- public AjaxResult data(ZfDoctorDownload zfDoctorDownload){
+ public AjaxResult data(ZfDownload zfDownload){
+ zfDownload.setSysMenuId(2019L);
Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
- return zfDoctorDownloadService.selectDoctorList(zfDoctorDownload,pageNo ,pageSize);
+ return zfDoctorDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java
new file mode 100644
index 0000000..ae06b73
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java
@@ -0,0 +1,81 @@
+package com.ruoyi.web.controller.zhang;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.domain.ShareMore;
+import com.ruoyi.domain.ZfDownload;
+import com.ruoyi.service.ZfEventDownloadService;
+import com.ruoyi.service.ZfEventShareService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+import static com.ruoyi.common.core.page.TableSupport.PAGE_NO;
+import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
+
+@RestController
+@RequestMapping("/familyShare")
+public class ZfEventShareController extends BaseController {
+ @Resource
+ ZfEventShareService zfEventShareService;
+
+ @Resource
+ ZfEventDownloadService zfEventDownloadService;
+
+ @PostMapping("/share")
+ public AjaxResult share(@RequestBody ShareMore zfDoctor){
+ zfDoctor.setSysMenuId(2013L);
+ return zfEventShareService.saveZa(zfDoctor);
+ }
+
+ /**
+ * 鏍规嵁UserId鍜屽垎浜汉shareId鏌ョ湅宸茬粡鎺堟潈缁欓偅浜涗汉閭d簺鏁版嵁
+ */
+ @PostMapping("/getInfoByUserId")
+ public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
+ zfDoctor.setSysMenuId(2013L);
+ Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return zfEventShareService.listByFidAid(zfDoctor,pageNo,pageSize) ;
+ }
+
+ /**
+ * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜�
+ */
+ @GetMapping("/getInfoByShareId")
+ public AjaxResult empowerGetInfo2(){
+ Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return zfEventShareService.listUserId(pageNo ,pageSize);
+ }
+ /**
+ * 鏍规嵁userId鍜宻hareId鏀跺洖宸茬粡鎺堟潈缁欓偅浜涗汉
+ */
+ @PostMapping("/deleteInfoByUserId")
+ public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
+ zfDoctor.setSysMenuId(2013L);
+ return zfEventShareService.deleteZa(zfDoctor);
+ }
+
+ /**
+ * 涓嬭浇鍒嗕韩鐨勬暟鎹�
+ */
+ @PostMapping("/downloadDate")
+ public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
+ zfDownload.setSysMenuId(2013L);
+ return zfEventDownloadService.addData(zfDownload);
+ }
+
+ /**
+ * 灞曠ず涓嬭浇鍒嗕韩鐨勬暟鎹�
+ */
+ @GetMapping("/all")
+ public AjaxResult data(ZfDownload zfDownload){
+ zfDownload.setSysMenuId(2013L);
+ Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return zfEventDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
index 3143ec8..f5ec7bc 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
@@ -19,6 +19,8 @@
*/
public int deleteUserRoleByUserId(Long userId);
+ public SysUserRole selectUserById(Long userId);
+
/**
* 鎵归噺鍒犻櫎鐢ㄦ埛鍜岃鑹插叧鑱�
*
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 13318fe..4b35655 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -296,6 +296,7 @@
@Override
public boolean registerUser(SysUser user)
{
+ System.out.println(user);
return userMapper.insertUser(user) > 0;
}
@@ -311,9 +312,9 @@
{
Long userId = user.getUserId();
// 鍒犻櫎鐢ㄦ埛涓庤鑹插叧鑱�
- userRoleMapper.deleteUserRoleByUserId(userId);
- // 鏂板鐢ㄦ埛涓庤鑹茬鐞�
- insertUserRole(user);
+// userRoleMapper.deleteUserRoleByUserId(userId);
+// // 鏂板鐢ㄦ埛涓庤鑹茬鐞�
+// insertUserRole(user);
// 鍒犻櫎鐢ㄦ埛涓庡矖浣嶅叧鑱�
userPostMapper.deleteUserPostByUserId(userId);
// 鏂板鐢ㄦ埛涓庡矖浣嶇鐞�
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
index dd72689..46def22 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
@@ -9,6 +9,10 @@
<result property="roleId" column="role_id" />
</resultMap>
+ <select id="selectUserById" resultType="SysUserRole" >
+ select * from sys_user_role where user_id=#{userId}
+ </select>
+
<delete id="deleteUserRoleByUserId" parameterType="Long">
delete from sys_user_role where user_id=#{userId}
</delete>
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ShareMore.java b/zhang-content/src/main/java/com/ruoyi/domain/ShareMore.java
index 6869fef..02c59ef 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ShareMore.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ShareMore.java
@@ -24,4 +24,9 @@
* 鍒嗕韩鐨勫唴瀹�
*/
private Long[] shareContents;
+
+ /**
+ * 鍒嗕韩鐨勬ā鍧�
+ */
+ private Long sysMenuId;
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java
index a774553..c23c2dd 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java
@@ -45,11 +45,11 @@
*/
private Integer status;
- /**
- * 鏄惁鏈
- */
- private Integer isMyFamily;
-
+// /**
+// * 鏄惁鏈
+// */
+// private Integer isMyFamily;
+//
/**
*閰嶅伓id
*/
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorDownload.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfDownload.java
similarity index 66%
rename from zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorDownload.java
rename to zhang-content/src/main/java/com/ruoyi/domain/ZfDownload.java
index 3b5e3b2..e504ef0 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorDownload.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfDownload.java
@@ -7,17 +7,31 @@
import lombok.Data;
@Data
-@TableName("zf_doctor_download")
-public class ZfDoctorDownload {
+@TableName("zf_download")
+public class ZfDownload {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
+ /**
+ * 涓嬭浇浜�
+ */
private Long downloadId;
+ /**
+ * 涓嬭浇鍐呭
+ */
private Long downloadContent;
+ /**
+ * 鍒嗕韩浜�
+ */
private Long shareId;
+
+ /**
+ * 妯″潡id
+ */
+ private Long sysMenuId;
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
index f5ca816..7a52b97 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
@@ -92,4 +92,9 @@
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date happenTime;
+ /**
+ * 鍒嗕韩浜篿d
+ */
+ private Integer shareId;
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorShare.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfShare.java
similarity index 80%
rename from zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorShare.java
rename to zhang-content/src/main/java/com/ruoyi/domain/ZfShare.java
index 5c492b5..3d966bb 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorShare.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfShare.java
@@ -8,8 +8,8 @@
import java.io.Serializable;
@Data
-@TableName("zf_doctor_share")
-public class ZfDoctorShare implements Serializable {
+@TableName("zf_share")
+public class ZfShare implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
@@ -30,6 +30,12 @@
*/
private Long shareContent;
+ /**
+ * 鍒嗕韩鐨勫唴瀹�
+ */
+ private Long sysMenuId;
+
+
}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorDownloadMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorDownloadMapper.java
deleted file mode 100644
index 4d86eb0..0000000
--- a/zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorDownloadMapper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.ruoyi.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ruoyi.domain.ZfDoctorDownload;
-
-public interface ZfDoctorDownloadMapper extends BaseMapper<ZfDoctorDownload> {
-}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorShareMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorShareMapper.java
deleted file mode 100644
index 57f5a07..0000000
--- a/zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorShareMapper.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.ruoyi.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.ruoyi.domain.ZfDoctorShare;
-import org.apache.ibatis.annotations.Mapper;
-
-@Mapper
-public interface ZfDoctorShareMapper extends BaseMapper<ZfDoctorShare> {
-}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfDownloadMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfDownloadMapper.java
new file mode 100644
index 0000000..207b725
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZfDownloadMapper.java
@@ -0,0 +1,7 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.ZfDownload;
+
+public interface ZfDownloadMapper extends BaseMapper<ZfDownload> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfShareMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfShareMapper.java
new file mode 100644
index 0000000..896a001
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZfShareMapper.java
@@ -0,0 +1,9 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.domain.ZfShare;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ZfShareMapper extends BaseMapper<ZfShare> {
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java
index c3d4eef..8685cde 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java
@@ -16,6 +16,6 @@
AjaxResult deleteData(Integer clanId, Integer id);
- void update(ZfAncestor zfAncestor);
+ ZfAncestor update(ZfAncestor zfAncestor);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java
index c059924..05129a0 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java
@@ -2,17 +2,15 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.domain.ZfDoctorDownload;
-
-import java.util.List;
+import com.ruoyi.domain.ZfDownload;
-public interface ZfDoctorDownloadService extends IService<ZfDoctorDownload> {
- AjaxResult addData(ZfDoctorDownload zfDoctorDownload);
+public interface ZfDoctorDownloadService extends IService<ZfDownload> {
+ AjaxResult addData(ZfDownload zfDownload);
AjaxResult deleteData(Long[] ids);
- AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize);
+ AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
index 11e068f..e5a3de5 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
@@ -3,15 +3,14 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
-import com.ruoyi.domain.ZfDoctor;
-import com.ruoyi.domain.ZfDoctorDownload;
-import com.ruoyi.domain.ZfDoctorShare;
+import com.ruoyi.domain.ZfDownload;
+import com.ruoyi.domain.ZfShare;
import java.util.List;
-public interface ZfDoctorShareService extends IService<ZfDoctorShare> {
+public interface ZfDoctorShareService extends IService<ZfShare> {
- List<ZfDoctorShare> getAuthority();
+ List<ZfShare> getAuthority();
AjaxResult saveZa(ShareMore zfDoctor);
@@ -23,7 +22,7 @@
AjaxResult listUserId(Integer pageNo ,Integer pageSize);
- Long getShareId(ZfDoctorDownload zfDoctorDownload);
+ Long getShareId(ZfDownload zfDownload);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java
new file mode 100644
index 0000000..f0d130a
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.domain.ZfDownload;
+
+public interface ZfEventDownloadService extends IService<ZfDownload> {
+ AjaxResult addData(ZfDownload zfDownload);
+
+ AjaxResult deleteData(Long[] ids);
+
+ AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java
new file mode 100644
index 0000000..f3ab8d2
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java
@@ -0,0 +1,25 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.domain.ShareMore;
+import com.ruoyi.domain.ZfDownload;
+import com.ruoyi.domain.ZfShare;
+
+import java.util.List;
+
+public interface ZfEventShareService extends IService<ZfShare> {
+ List<ZfShare> getAuthority();
+
+ AjaxResult saveZa(ShareMore shareMore);
+
+ AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
+
+ AjaxResult deleteZa(ShareMore shareMore);
+
+ AjaxResult listByUserId();
+
+ AjaxResult listUserId(Integer pageNo ,Integer pageSize);
+
+ Long getShareId(ZfDownload zfDownload);
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java
index f0f1aa5..39214c0 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java
@@ -203,22 +203,35 @@
}
@Override
- public void update(ZfAncestor zfAncestor) {
+ public ZfAncestor update(ZfAncestor zfAncestor) {
LambdaQueryWrapper<ZfAncestor> lqw = uniqueCondition(zfAncestor);
List<ZfAncestor> list = list(lqw);
- System.out.println(list);
+// System.out.println(list);
ZInfoUser updateDate =zInfoUserService.getInfoBysysId(zfAncestor.getSysId());
ZfAncestor zfAncestor1 = new ZfAncestor();
+ ZfAncestor zfAncestor2 = new ZfAncestor();
zfAncestor1.setId(list.get(0).getId());
zfAncestor1.setName(zfAncestor.getName());
- if((updateDate.getSpouseId() != null || updateDate.getSpouseId() != 0) && zfAncestor.getSex() !=null){
+ System.out.println(updateDate);
+ if (zfAncestor.getSex() != null){
+ if(updateDate.getSpouseId() != null && updateDate.getSpouseId() != 0){
Long spouseId=updateDate.getSpouseId();
if (zInfoUserService.getById(spouseId).getSex().equals(zfAncestor.getSex())){
- throw new RuntimeException("绁栧厛涓や綅涓嶈兘涓哄悓鎬�");}
- zfAncestor.setSex(zfAncestor.getSex());}
+
+ Long spouseSysId = zInfoUserService.getById(spouseId).getSysId();
+ zfAncestor2.setSysId(spouseSysId);
+ Integer spId = list(uniqueCondition(zfAncestor2)).get(0).getId();
+ zfAncestor2.setId(spId);
+ zfAncestor2.setSex(zfAncestor.getSex() == 0? 1: 0);
+ System.out.println(zfAncestor2);
+ zfAncestorService.updateById(zfAncestor2);
+ }}
+ zfAncestor1.setSex(zfAncestor.getSex());}
+// System.out.println("1841vdndigrrr"+zfAncestor1);
zfAncestorService.updateById(zfAncestor1);
+ return zfAncestor2;
}
/**
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
index 71f8424..fe33a72 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
@@ -9,8 +9,8 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfDoctor;
-import com.ruoyi.domain.ZfDoctorDownload;
-import com.ruoyi.mapper.ZfDoctorDownloadMapper;
+import com.ruoyi.domain.ZfDownload;
+import com.ruoyi.mapper.ZfDownloadMapper;
import com.ruoyi.service.*;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.RequestOptions;
@@ -23,7 +23,7 @@
import java.util.stream.Collectors;
@Service
-public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDoctorDownloadMapper, ZfDoctorDownload> implements ZfDoctorDownloadService {
+public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfDoctorDownloadService {
@Resource
EsService esService;
@@ -41,27 +41,29 @@
@Resource
private RestHighLevelClient restHighLevelClient;
- private LambdaQueryWrapper<ZfDoctorDownload> buildCondition(ZfDoctorDownload zfDoctorDownload,Long userId) {
- LambdaQueryWrapper<ZfDoctorDownload> lqw = new LambdaQueryWrapper<>();
- lqw.in(ZfDoctorDownload::getDownloadId,userId);
- lqw.orderByDesc(ZfDoctorDownload::getDownloadId);
- lqw.like(zfDoctorDownload.getDownloadId() != null, ZfDoctorDownload::getDownloadId, zfDoctorDownload.getDownloadId())
- .like(zfDoctorDownload.getDownloadContent() != null, ZfDoctorDownload::getDownloadContent, zfDoctorDownload.getDownloadContent());
+ private LambdaQueryWrapper<ZfDownload> buildCondition(ZfDownload zfDownload, Long userId) {
+ LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
+ lqw.in(ZfDownload::getDownloadId,userId);
+ lqw.orderByDesc(ZfDownload::getDownloadId);
+ lqw.like(zfDownload.getDownloadId() != null, ZfDownload::getDownloadId, zfDownload.getDownloadId())
+ .like(zfDownload.getDownloadContent() != null, ZfDownload::getDownloadContent, zfDownload.getDownloadContent())
+ .eq( ZfDownload::getSysMenuId, zfDownload.getSysMenuId());
return lqw;
}
- private LambdaQueryWrapper<ZfDoctorDownload> uniqueCondition(ZfDoctorDownload zfDoctorDownload) {
- LambdaQueryWrapper<ZfDoctorDownload> lqw = new LambdaQueryWrapper<>();
- lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorDownload.getDownloadId())), ZfDoctorDownload::getDownloadId, zfDoctorDownload.getDownloadId())
- .eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorDownload.getDownloadContent())), ZfDoctorDownload::getDownloadContent, zfDoctorDownload.getDownloadContent());
+ private LambdaQueryWrapper<ZfDownload> uniqueCondition(ZfDownload zfDownload) {
+ LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadId())), ZfDownload::getDownloadId, zfDownload.getDownloadId())
+ .eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadContent())), ZfDownload::getDownloadContent, zfDownload.getDownloadContent())
+ .eq(ZfDownload::getSysMenuId, zfDownload.getSysMenuId());
return lqw;
}
@Override
- public AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize ) {
+ public AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize ) {
ZInfoUser myself = zInfoUserService.getMyself();
- LambdaQueryWrapper<ZfDoctorDownload> lqw = buildCondition(zfDoctorDownload,myself.getUserId());
- List<ZfDoctorDownload> beanRecords = list(lqw);
+ LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId());
+ List<ZfDownload> beanRecords = list(lqw);
List<ZfDoctor> bs = new ArrayList<>();
- for (ZfDoctorDownload a: beanRecords) {
+ for (ZfDownload a: beanRecords) {
if (zfDoctorService.getById(a.getDownloadContent()) != null) {
ZfDoctor ds = zfDoctorService.getById(a.getDownloadContent());
ds.setShareId(a.getShareId());
@@ -79,27 +81,27 @@
@Override
- public AjaxResult addData(ZfDoctorDownload zfDoctorDownload) {
- zfDoctorDownload.setDownloadId(getUserId());
- LambdaQueryWrapper<ZfDoctorDownload> lqw = uniqueCondition(zfDoctorDownload);
- List<ZfDoctorDownload> list = list(lqw);
+ public AjaxResult addData(ZfDownload zfDownload) {
+ zfDownload.setDownloadId(getUserId());
+ LambdaQueryWrapper<ZfDownload> lqw = uniqueCondition(zfDownload);
+ List<ZfDownload> list = list(lqw);
if (list.size() > 0) {
- throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+ throw new RuntimeException("璇峰嬁閲嶅涓嬭浇鏁版嵁");
}
- zfDoctorDownload.setDownloadId(getUserId());
- zfDoctorDownload.setShareId(zfDoctorShareService.getShareId(zfDoctorDownload));
- if (save(zfDoctorDownload)) {
+ zfDownload.setDownloadId(getUserId());
+ zfDownload.setShareId(zfDoctorShareService.getShareId(zfDownload));
+ if (save(zfDownload)) {
EsModel esModel = new EsModel();
- Integer inte = zfDoctorDownload.getId().intValue();
+ Integer inte = zfDownload.getId().intValue();
String uuid = UUID.randomUUID().toString().replace("-", "");
esModel.setId(uuid);
esModel.setCtId(Long.valueOf(inte));
esModel.setCtTableName("瀹跺涵灏忓尰鐢�");
- esModel.setBy1(String.valueOf(zfDoctorDownload.getDownloadId()));
- esModel.setBy2(String.valueOf(zfDoctorDownload.getDownloadContent()));
- esModel.setBy3(String.valueOf(zfDoctorDownload.getShareId()));
+ esModel.setBy1(String.valueOf(zfDownload.getDownloadId()));
+ esModel.setBy2(String.valueOf(zfDownload.getDownloadContent()));
+ esModel.setBy3(String.valueOf(zfDownload.getShareId()));
//杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰�
esService.insertTable(esModel);
return AjaxResult.success();
@@ -109,12 +111,12 @@
}
@Override
public AjaxResult deleteData(Long[] ids) {
- List<ZfDoctorDownload> zfDoctorDownloads = listByIds(Arrays.asList(ids));
+ List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids));
if (zfDoctorShareService.removeByIds(Arrays.asList(ids))) {
//鍒犻櫎es涓殑鏁版嵁
- zfDoctorDownloads.stream().forEach(zfDoctorDownload -> {
+ zfDownloads.stream().forEach(zfDoctorDownload -> {
EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵灏忓尰鐢熶笅杞�");
if (esModel != null) {
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
index 93fdac1..67321b1 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
@@ -1,6 +1,5 @@
package com.ruoyi.service.impl;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,7 +9,7 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*;
-import com.ruoyi.mapper.ZfDoctorShareMapper;
+import com.ruoyi.mapper.ZfShareMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfDoctorService;
import com.ruoyi.service.ZfDoctorShareService;
@@ -27,26 +26,27 @@
@Slf4j
@Service
-public class ZfDoctorShareServiceImpl extends ServiceImpl<ZfDoctorShareMapper, ZfDoctorShare> implements ZfDoctorShareService {
+public class ZfDoctorShareServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfDoctorShareService {
@Resource
private ZfDoctorService zfDoctorService;
@Resource
private ZInfoUserService zInfoUserService;
- private LambdaQueryWrapper<ZfDoctorShare> uniqueCondition(ZfDoctorShare zfDoctorShare) {
- LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
- lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorShare.getShareId())), ZfDoctorShare::getShareId, zfDoctorShare.getShareId());
- lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorShare.getShareContent())), ZfDoctorShare::getShareContent, zfDoctorShare.getShareContent());
+ private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) {
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId());
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareContent())), ZfShare::getShareContent, zfShare.getShareContent());
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getSysMenuId())), ZfShare::getSysMenuId, zfShare.getSysMenuId());
return lqw;
}
@Override
- public List<ZfDoctorShare> getAuthority() {
+ public List<ZfShare> getAuthority() {
SysUser user = SecurityUtils.getLoginUser().getUser();
Long userId = user.getUserId();
- LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
- lqw.eq(ZfDoctorShare::getShareId,userId);
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,userId);
return list(lqw);
}
@@ -54,10 +54,10 @@
@Resource
ZfDoctorShareService zfDoctorShareService;
- public void addData(ZfDoctorShare za)
+ public void addData(ZfShare za)
{
- LambdaQueryWrapper<ZfDoctorShare> lqw = uniqueCondition(za);
- List<ZfDoctorShare> list = list(lqw);
+ LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za);
+ List<ZfShare> list = list(lqw);
if(list.size()>0){
throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁");
@@ -76,10 +76,11 @@
Long [] shareContents = zfDoctor.getShareContents();
for (Long shareId : shareIds) {
for (Long shareContent : shareContents) {
- ZfDoctorShare za = new ZfDoctorShare();
+ ZfShare za = new ZfShare();
za.setUserId(getUserId());
za.setShareContent(shareContent);
za.setShareId(shareId);
+ za.setSysMenuId(2019L);
addData(za);
}
}
@@ -101,11 +102,12 @@
List<ZfDoctor> beanRecord3 = new ArrayList<>();
for (Long shareId : shareIds) {
{
- LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
- lqw.eq(ZfDoctorShare::getShareId,shareId)
- .eq(ZfDoctorShare::getUserId, getUserId());
- List<ZfDoctorShare> beanRecords = list(lqw);
- for (ZfDoctorShare beanRecord : beanRecords ) {
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,shareId)
+ .eq(ZfShare::getSysMenuId,zfDoctor.getSysMenuId())
+ .eq(ZfShare::getUserId, getUserId());
+ List<ZfShare> beanRecords = list(lqw);
+ for (ZfShare beanRecord : beanRecords ) {
beanRecord3.add(zfDoctorService.getById(beanRecord.getShareContent()));
}
}
@@ -127,10 +129,11 @@
for(Long shareId : shareIds)
for(Long shareContent: shareContents)
{
- LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
- lqw.eq(ZfDoctorShare::getShareId,shareId)
- .eq(ZfDoctorShare::getShareContent, shareContent)
- .eq(ZfDoctorShare::getUserId, getUserId());
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,shareId)
+ .eq(ZfShare::getShareContent, shareContent)
+ .eq(ZfShare::getSysMenuId, zfDoctor.getSysMenuId())
+ .eq(ZfShare::getUserId, getUserId());
zfDoctorShareService.remove(lqw);
// addData(za);
@@ -146,11 +149,12 @@
public AjaxResult listByUserId() {
//鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭
HashMap<Long,List<ZfDoctor>> bs = new HashMap<>();
- LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
- lqw.eq(ZfDoctorShare::getShareId,getUserId());
- List<ZfDoctorShare> beanRecords = list(lqw);
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,getUserId());
+ lqw.eq(ZfShare::getSysMenuId,2019L);
+ List<ZfShare> beanRecords = list(lqw);
List<ZfDoctor> b1 = new ArrayList<>();
- for (ZfDoctorShare beanRecord : beanRecords ) {
+ for (ZfShare beanRecord : beanRecords ) {
b1.add(zfDoctorService.getById(beanRecord.getShareContent()));
bs.put(beanRecord.getUserId(),b1);
}
@@ -165,10 +169,11 @@
public AjaxResult listUserId(Integer pageNo ,Integer pageSize) {
//鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭
List<ZfDoctor> bs = new ArrayList<>();
- LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
- lqw.eq(ZfDoctorShare::getShareId,getUserId());
- List<ZfDoctorShare> beanRecords = list(lqw);
- for (ZfDoctorShare beanRecord : beanRecords ) {
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,getUserId());
+ lqw.eq(ZfShare::getSysMenuId,2019L);
+ List<ZfShare> beanRecords = list(lqw);
+ for (ZfShare beanRecord : beanRecords ) {
ZfDoctor bs2 = zfDoctorService.getById(beanRecord.getShareContent());
bs2.setShareId(beanRecord.getUserId());
bs.add(bs2);
@@ -189,11 +194,12 @@
}
@Override
- public Long getShareId(ZfDoctorDownload zfDoctorDownload){
- LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
- lqw.eq(ZfDoctorShare::getShareId,zfDoctorDownload.getDownloadId())
- .eq(ZfDoctorShare::getShareContent,zfDoctorDownload.getDownloadContent());
- List<ZfDoctorShare> beanRecords = list(lqw);
+ public Long getShareId(ZfDownload zfDownload){
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId, zfDownload.getDownloadId())
+ .eq(ZfShare::getShareContent, zfDownload.getDownloadContent())
+ .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId());
+ List<ZfShare> beanRecords = list(lqw);
if (beanRecords.size() != 0){
return beanRecords.get(0).getUserId();
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java
new file mode 100644
index 0000000..22e1f7f
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java
@@ -0,0 +1,143 @@
+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.common.utils.StringUtils;
+import com.ruoyi.domain.ZInfoUser;
+import com.ruoyi.domain.ZfDoctor;
+import com.ruoyi.domain.ZfDownload;
+import com.ruoyi.domain.ZfEvent;
+import com.ruoyi.mapper.ZfDownloadMapper;
+import com.ruoyi.service.*;
+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.*;
+import java.util.stream.Collectors;
+
+@Service
+public class ZfEventDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfEventDownloadService {
+
+ @Resource
+ EsService esService;
+
+ @Resource
+ ZfEventShareService zfEventShareService;
+
+ @Resource
+ ZfEventService zfEventService;
+
+
+ @Resource
+ ZInfoUserService zInfoUserService;
+
+ @Resource
+ private RestHighLevelClient restHighLevelClient;
+
+ private LambdaQueryWrapper<ZfDownload> buildCondition(ZfDownload zfDownload, Long userId) {
+ LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
+ lqw.in(ZfDownload::getDownloadId,userId);
+ lqw.orderByDesc(ZfDownload::getDownloadId);
+ lqw.like(zfDownload.getDownloadId() != null, ZfDownload::getDownloadId, zfDownload.getDownloadId())
+ .like(zfDownload.getDownloadContent() != null, ZfDownload::getDownloadContent, zfDownload.getDownloadContent())
+ .eq( ZfDownload::getSysMenuId, zfDownload.getSysMenuId());
+ return lqw;
+ }
+ private LambdaQueryWrapper<ZfDownload> uniqueCondition(ZfDownload zfDownload) {
+ LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadId())), ZfDownload::getDownloadId, zfDownload.getDownloadId())
+ .eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadContent())), ZfDownload::getDownloadContent, zfDownload.getDownloadContent())
+ .eq(ZfDownload::getSysMenuId, zfDownload.getSysMenuId());
+ return lqw;
+ }
+
+ public Long getUserId() {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ return myself.getUserId();
+ }
+
+ @Override
+ public AjaxResult addData(ZfDownload zfDownload) {
+ zfDownload.setDownloadId(getUserId());
+ LambdaQueryWrapper<ZfDownload> lqw = uniqueCondition(zfDownload);
+ List<ZfDownload> list = list(lqw);
+ if (list.size() > 0) {
+ throw new RuntimeException("璇峰嬁閲嶅涓嬭浇鏁版嵁");
+ }
+
+ zfDownload.setDownloadId(getUserId());
+ zfDownload.setShareId(zfEventShareService.getShareId(zfDownload));
+ if (save(zfDownload)) {
+ EsModel esModel = new EsModel();
+ Integer inte = zfDownload.getId().intValue();
+ String uuid = UUID.randomUUID().toString().replace("-", "");
+ esModel.setId(uuid);
+ esModel.setCtId(Long.valueOf(inte));
+ esModel.setCtTableName("瀹跺涵灏忓尰鐢�");
+
+ esModel.setBy1(String.valueOf(zfDownload.getDownloadId()));
+ esModel.setBy2(String.valueOf(zfDownload.getDownloadContent()));
+ esModel.setBy3(String.valueOf(zfDownload.getShareId()));
+ //杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰�
+ esService.insertTable(esModel);
+ return AjaxResult.success();
+ } else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+ List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids));
+
+ if (zfEventShareService.removeByIds(Arrays.asList(ids))) {
+
+ //鍒犻櫎es涓殑鏁版嵁
+ zfDownloads.stream().forEach(zfDoctorDownload -> {
+ EsModel esModel = esService.findByCtId(zfDoctorDownload.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 selectDoctorList(ZfDownload zfDownload, Integer pageNo, Integer pageSize) {
+ ZInfoUser myself = zInfoUserService.getMyself();
+ LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId());
+ List<ZfDownload> beanRecords = list(lqw);
+ List<ZfEvent> bs = new ArrayList<>();
+ for (ZfDownload a: beanRecords) {
+ if (zfEventService.getById(a.getDownloadContent()) != null) {
+ ZfEvent ds = zfEventService.getById(a.getDownloadContent());
+ ds.setShareId(a.getShareId().intValue());
+ bs.add(ds);
+ }
+ }
+ List<ZfEvent> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
+
+ int totalPage = (bs.size() -1) / pageSize +1;
+
+ Page<ZfEvent> zfEventPage = new Page<>(pageNo, pageSize,totalPage);
+ HashMap<String, Object> data = MapUtils.getShareResult(zfEventPage, record,bs.size());
+ return AjaxResult.success(data);
+ }
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java
new file mode 100644
index 0000000..437c54f
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java
@@ -0,0 +1,196 @@
+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.SysUser;
+import com.ruoyi.common.utils.MapUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.domain.*;
+import com.ruoyi.mapper.ZfShareMapper;
+import com.ruoyi.service.ZInfoUserService;
+import com.ruoyi.service.ZfDoctorShareService;
+import com.ruoyi.service.ZfEventService;
+import com.ruoyi.service.ZfEventShareService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+public class ZfEventShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZfEventShareService {
+
+
+ @Resource
+ ZfEventShareService zfEventShareService;
+
+ @Resource
+ ZfEventService zfEventService;
+
+ @Resource
+ private ZInfoUserService zInfoUserService;
+
+
+ private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) {
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId());
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareContent())), ZfShare::getShareContent, zfShare.getShareContent());
+ lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getSysMenuId())), ZfShare::getSysMenuId, zfShare.getSysMenuId());
+ return lqw;
+ }
+
+ @Override
+ public List<ZfShare> getAuthority() {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,userId);
+
+ return list(lqw);
+ }
+
+ public Long getUserId(){
+ ZInfoUser myself = zInfoUserService.getMyself();
+ return myself.getUserId();
+
+ }
+
+ public void addData(ZfShare za)
+ {
+ LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za);
+ List<ZfShare> list = list(lqw);
+
+ if(list.size()>0){
+ throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁");
+ }
+ else {
+ zfEventShareService.save(za);
+ }
+
+ }
+
+ @Override
+ public AjaxResult saveZa(ShareMore shareMore) {
+ Long [] shareIds = shareMore.getShareIds();
+ Long [] shareContents = shareMore.getShareContents();
+ for (Long shareId : shareIds) {
+ for (Long shareContent : shareContents) {
+ ZfShare za = new ZfShare();
+ za.setUserId(getUserId());
+ za.setShareContent(shareContent);
+ za.setShareId(shareId);
+ za.setSysMenuId(2013L);
+ addData(za);
+ }
+ }
+ // Long []
+ // if(bl)
+ return AjaxResult.success("鍒嗕韩鎴愬姛!");
+ }
+
+ @Override
+ public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
+ Long [] shareIds = shareMore.getShareIds();
+ List<ZfEvent> beanRecord3 = new ArrayList<>();
+ for (Long shareId : shareIds) {
+ {
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,shareId)
+ .eq(ZfShare::getSysMenuId,shareMore.getSysMenuId())
+ .eq(ZfShare::getUserId, getUserId());
+ List<ZfShare> beanRecords = list(lqw);
+ for (ZfShare beanRecord : beanRecords ) {
+ beanRecord3.add(zfEventService.getById(beanRecord.getShareContent()));
+ }
+ }
+ }
+ List<ZfEvent> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
+
+ int totalPage = (beanRecord3.size() -1) / pageSize +1;
+
+ Page<ZfEvent> zfEventPage = new Page<>(pageNo, pageSize,totalPage);
+ HashMap<String, Object> data = MapUtils.getShareResult(zfEventPage, record,beanRecord3.size());
+
+ return AjaxResult.success(data);
+ }
+
+ @Override
+ public AjaxResult deleteZa(ShareMore shareMore) {
+ Long [] shareIds = shareMore.getShareIds();
+ Long [] shareContents = shareMore.getShareContents();
+ for(Long shareId : shareIds)
+ for(Long shareContent: shareContents)
+ {
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,shareId)
+ .eq(ZfShare::getShareContent, shareContent)
+ .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId())
+ .eq(ZfShare::getUserId, getUserId());
+
+ zfEventShareService.remove(lqw);
+ // addData(za);
+ }
+ return AjaxResult.success("鏁版嵁鏀跺洖鎴愬姛!");
+ }
+
+ @Override
+ public AjaxResult listByUserId() {
+ HashMap<Long,List<ZfEvent>> bs = new HashMap<>();
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,getUserId());
+ lqw.eq(ZfShare::getSysMenuId,2013L);
+ List<ZfShare> beanRecords = list(lqw);
+ List<ZfEvent> b1 = new ArrayList<>();
+ for (ZfShare beanRecord : beanRecords ) {
+ b1.add(zfEventService.getById(beanRecord.getShareContent()));
+ bs.put(beanRecord.getUserId(),b1);
+ }
+ log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs);
+ return AjaxResult.success(bs);
+ }
+
+ @Override
+ public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
+ List<ZfEvent> bs = new ArrayList<>();
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId,getUserId());
+ lqw.eq(ZfShare::getSysMenuId,2013L);
+ List<ZfShare> beanRecords = list(lqw);
+ for (ZfShare beanRecord : beanRecords ) {
+ ZfEvent bs2 = zfEventService.getById(beanRecord.getShareContent());
+ bs2.setShareId(beanRecord.getUserId().intValue());
+ bs.add(bs2);
+ }
+ log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs);
+ List<ZfEvent> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
+
+ int totalPage = (bs.size() -1) / pageSize +1;
+
+ Page<ZfEvent> zfEventPage = new Page<>(pageNo, pageSize,totalPage);
+ HashMap<String, Object> data = MapUtils.getShareResult(zfEventPage, record,bs.size());
+ return AjaxResult.success(data);
+ }
+
+ @Override
+ public Long getShareId(ZfDownload zfDownload) {
+ LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(ZfShare::getShareId, zfDownload.getDownloadId())
+ .eq(ZfShare::getShareContent, zfDownload.getDownloadContent())
+ .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId());
+ List<ZfShare> beanRecords = list(lqw);
+ if (beanRecords.size() != 0){
+ return beanRecords.get(0).getUserId();
+ }
+ else {
+ return null;
+ }
+ }
+}
--
Gitblit v1.9.1