15个文件已修改
7个文件已添加
2 文件已重命名
2个文件已删除
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private ZfAncestorService zfAncestorService; |
| | | |
| | | @Resource |
| | | private SysUserRoleMapper sysUserRoleMapper; |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | |
| | | |
| | | // 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()); |
| | |
| | | infoUser.setSex(Integer.valueOf(user.getSex())); |
| | | // infoUser.setFamilyId(user.getFamilyId()); |
| | | infoUser.setSysId(user.getSysId()); |
| | | |
| | | |
| | | if(user.getSpouseId()!=null) { |
| | | infoUser.setSpouseId(user.getSpouseId()); |
| | | } |
| | |
| | | zu.setUserId(user.getSpouseId()); |
| | | zu.setSpouseId(infoUser.getUserId()); |
| | | zInfoUserService.updateById(zu); |
| | | } |
| | | }} |
| | | |
| | | // zInfoUserService.update(infoUser); |
| | | // .saveOrUpdate(infoUser); |
| | |
| | | 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()); |
| | |
| | | // infoUser.setRoleName(user.g); |
| | | |
| | | // if(userAll.getFamilyId()!=-1) { |
| | | |
| | | if(userAll.getRoleId()==102) { |
| | | infoUser.setRoleId(3L); |
| | | zInfoUserService.save(infoUser); |
| | |
| | | zu.setSpouseId(infoUser.getUserId()); |
| | | zInfoUserService.updateById(zu); |
| | | } |
| | | } |
| | | }} |
| | | |
| | | // zInfoUserService.saveOrUpdate(infoUser); |
| | | // LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>(); |
| | |
| | | @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(); |
| | | } |
| | |
| | | Long sysId = zfAncestorService.addData(zfAncestor); |
| | | zfAncestor.setSpouseId(sysId.intValue()); |
| | | zfAncestor.setSysId(addAncestor(zfAncestor)); |
| | | |
| | | zfAncestorService.updateById(zfAncestor); |
| | | |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | 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.*; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/share") |
| | | public AjaxResult share(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2019L); |
| | | return zfDoctorShareService.saveZa(zfDoctor); |
| | | } |
| | | |
| | |
| | | */ |
| | | @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) ; |
| | |
| | | */ |
| | | @PostMapping("/deleteInfoByUserId") |
| | | public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2019L); |
| | | return zfDoctorShareService.deleteZa(zfDoctor); |
| | | } |
| | | |
| | |
| | | * 下载分享的数据 |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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查看已经授权给那些人那些数据 |
| | | */ |
| | | @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和shareId收回已经授权给那些人 |
| | | */ |
| | | @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); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public int deleteUserRoleByUserId(Long userId); |
| | | |
| | | public SysUserRole selectUserById(Long userId); |
| | | |
| | | /** |
| | | * 批量删除用户和角色关联 |
| | | * |
| | |
| | | @Override |
| | | public boolean registerUser(SysUser user) |
| | | { |
| | | System.out.println(user); |
| | | return userMapper.insertUser(user) > 0; |
| | | } |
| | | |
| | |
| | | { |
| | | Long userId = user.getUserId(); |
| | | // 删除用户与角色关联 |
| | | userRoleMapper.deleteUserRoleByUserId(userId); |
| | | // 新增用户与角色管理 |
| | | insertUserRole(user); |
| | | // userRoleMapper.deleteUserRoleByUserId(userId); |
| | | // // 新增用户与角色管理 |
| | | // insertUserRole(user); |
| | | // 删除用户与岗位关联 |
| | | userPostMapper.deleteUserPostByUserId(userId); |
| | | // 新增用户与岗位管理 |
| | |
| | | <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> |
| | |
| | | * 分享的内容 |
| | | */ |
| | | private Long[] shareContents; |
| | | |
| | | /** |
| | | * 分享的模块 |
| | | */ |
| | | private Long sysMenuId; |
| | | } |
| | |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否本家 |
| | | */ |
| | | private Integer isMyFamily; |
| | | |
| | | // /** |
| | | // * 是否本家 |
| | | // */ |
| | | // private Integer isMyFamily; |
| | | // |
| | | /** |
| | | *配偶id |
| | | */ |
File was renamed from zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorDownload.java |
| | |
| | | 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; |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private Date happenTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | } |
File was renamed from zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorShare.java |
| | |
| | | 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) |
| | |
| | | */ |
| | | private Long shareContent; |
| | | |
| | | /** |
| | | * 分享的内容 |
| | | */ |
| | | private Long sysMenuId; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | |
| | | public interface ZfDownloadMapper extends BaseMapper<ZfDownload> { |
| | | } |
New file |
| | |
| | | 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> { |
| | | } |
| | |
| | | |
| | | AjaxResult deleteData(Integer clanId, Integer id); |
| | | |
| | | void update(ZfAncestor zfAncestor); |
| | | ZfAncestor update(ZfAncestor zfAncestor); |
| | | |
| | | } |
| | |
| | | |
| | | 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); |
| | | |
| | | |
| | | } |
| | |
| | | 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); |
| | | |
| | |
| | | |
| | | AjaxResult listUserId(Integer pageNo ,Integer pageSize); |
| | | |
| | | Long getShareId(ZfDoctorDownload zfDoctorDownload); |
| | | Long getShareId(ZfDownload zfDownload); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | |
| | | @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; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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()); |
| | |
| | | |
| | | |
| | | @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(); |
| | |
| | | } |
| | | @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) { |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @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); |
| | | } |
| | |
| | | @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("请勿分享重复数据"); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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())); |
| | | } |
| | | } |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | |
| | | |
| | | } |
| | | @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(); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |