4 文件已复制
1个文件已修改
11个文件已添加
2 文件已重命名
5个文件已删除
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.*; |
| | | import com.ruoyi.service.impl.TravelCountDownServiceImpl; |
| | | 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("/travelCountShare") |
| | | public class TravelCountShareController extends BaseController { |
| | | @Resource |
| | | TravelCountSharService travelCountSharService; |
| | | |
| | | @Resource |
| | | TravelCountDownlService travelCountDownlService; |
| | | |
| | | @PostMapping("/share") |
| | | public AjaxResult share(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2056L); |
| | | return travelCountSharService.saveZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 根据UserId和分享人shareId查看已经授权给那些人那些数据 |
| | | */ |
| | | @PostMapping("/getInfoByUserId") |
| | | public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2056L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return travelCountSharService.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 travelCountSharService.listUserId(pageNo ,pageSize); |
| | | } |
| | | /** |
| | | * 根据userId和shareId收回已经授权给那些人 |
| | | */ |
| | | @PostMapping("/deleteInfoByUserId") |
| | | public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2056L); |
| | | return travelCountSharService.deleteZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 下载分享的数据 |
| | | */ |
| | | @PostMapping("/downloadDate") |
| | | public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2056L); |
| | | return travelCountDownlService.addData(zfDownload); |
| | | } |
| | | |
| | | /** |
| | | * 展示下载分享的数据 |
| | | */ |
| | | @GetMapping("/all") |
| | | public AjaxResult data(ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2056L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return travelCountDownlService.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.TravelDetailDownlService; |
| | | import com.ruoyi.service.TravelDetailSharService; |
| | | import com.ruoyi.service.ZfPetDownlService; |
| | | import com.ruoyi.service.ZfPetSharService; |
| | | 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("/travelDetailShare") |
| | | public class TravelDetailShareController extends BaseController { |
| | | @Resource |
| | | TravelDetailSharService travelDetailSharService; |
| | | |
| | | @Resource |
| | | TravelDetailDownlService travelDetailDownlService; |
| | | |
| | | @PostMapping("/share") |
| | | public AjaxResult share(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2055L); |
| | | return travelDetailSharService.saveZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 根据UserId和分享人shareId查看已经授权给那些人那些数据 |
| | | */ |
| | | @PostMapping("/getInfoByUserId") |
| | | public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2055L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return travelDetailSharService.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 travelDetailSharService.listUserId(pageNo ,pageSize); |
| | | } |
| | | /** |
| | | * 根据userId和shareId收回已经授权给那些人 |
| | | */ |
| | | @PostMapping("/deleteInfoByUserId") |
| | | public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2055L); |
| | | return travelDetailSharService.deleteZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 下载分享的数据 |
| | | */ |
| | | @PostMapping("/downloadDate") |
| | | public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2055L); |
| | | return travelDetailDownlService.addData(zfDownload); |
| | | } |
| | | |
| | | /** |
| | | * 展示下载分享的数据 |
| | | */ |
| | | @GetMapping("/all") |
| | | public AjaxResult data(ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2055L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return travelDetailDownlService.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.ZfPetNoteDownlService; |
| | | import com.ruoyi.service.ZfPetNoteSharService; |
| | | import com.ruoyi.service.impl.IZfPropertyDownloadServiceImpl; |
| | | import com.ruoyi.service.impl.IZfPropertyShareServiceImpl; |
| | | import com.ruoyi.service.impl.ZfPetDownServiceImpl; |
| | | 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("/family/zfPetNoteShare") |
| | | public class ZfPetNoteShareController extends BaseController { |
| | | @Resource |
| | | ZfPetNoteSharService zfPetNoteSharService; |
| | | |
| | | @Resource |
| | | ZfPetNoteDownlService zfPetNoteDownlService; |
| | | |
| | | @PostMapping("/share") |
| | | public AjaxResult share(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2061L); |
| | | return zfPetNoteSharService.saveZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 根据UserId和分享人shareId查看已经授权给那些人那些数据 |
| | | */ |
| | | @PostMapping("/getInfoByUserId") |
| | | public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2061L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return zfPetNoteSharService.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 zfPetNoteSharService.listUserId(pageNo ,pageSize); |
| | | } |
| | | /** |
| | | * 根据userId和shareId收回已经授权给那些人 |
| | | */ |
| | | @PostMapping("/deleteInfoByUserId") |
| | | public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2061L); |
| | | return zfPetNoteSharService.deleteZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 下载分享的数据 |
| | | */ |
| | | @PostMapping("/downloadDate") |
| | | public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2061L); |
| | | return zfPetNoteDownlService.addData(zfDownload); |
| | | } |
| | | |
| | | /** |
| | | * 展示下载分享的数据 |
| | | */ |
| | | @GetMapping("/all") |
| | | public AjaxResult data(ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2061L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return zfPetNoteDownlService.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.ZfPetDownlService; |
| | | import com.ruoyi.service.ZfPetNoteSharService; |
| | | import com.ruoyi.service.ZfPetSharService; |
| | | import com.ruoyi.service.impl.IZfPropertyDownloadServiceImpl; |
| | | import com.ruoyi.service.impl.IZfPropertyShareServiceImpl; |
| | | import com.ruoyi.service.impl.ZfPetDownServiceImpl; |
| | | 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("/family/zfPetShare") |
| | | public class ZfpetShareController extends BaseController { |
| | | @Resource |
| | | ZfPetSharService zfPetSharService; |
| | | |
| | | @Resource |
| | | ZfPetDownlService zfPetDownlService; |
| | | |
| | | @PostMapping("/share") |
| | | public AjaxResult share(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2022L); |
| | | return zfPetSharService.saveZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 根据UserId和分享人shareId查看已经授权给那些人那些数据 |
| | | */ |
| | | @PostMapping("/getInfoByUserId") |
| | | public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2022L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return zfPetSharService.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 zfPetSharService.listUserId(pageNo ,pageSize); |
| | | } |
| | | /** |
| | | * 根据userId和shareId收回已经授权给那些人 |
| | | */ |
| | | @PostMapping("/deleteInfoByUserId") |
| | | public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ |
| | | zfDoctor.setSysMenuId(2022L); |
| | | return zfPetSharService.deleteZa(zfDoctor); |
| | | } |
| | | |
| | | /** |
| | | * 下载分享的数据 |
| | | */ |
| | | @PostMapping("/downloadDate") |
| | | public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2022L); |
| | | return zfPetDownlService.addData(zfDownload); |
| | | } |
| | | |
| | | /** |
| | | * 展示下载分享的数据 |
| | | */ |
| | | @GetMapping("/all") |
| | | public AjaxResult data(ZfDownload zfDownload){ |
| | | zfDownload.setSysMenuId(2022L); |
| | | Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); |
| | | Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); |
| | | return zfPetDownlService.selectDoctorList(zfDownload,pageNo ,pageSize); |
| | | } |
| | | } |
File was renamed from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java |
| | |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfShare; |
| | | |
| | | public interface TravelDownlService extends IService<ZfDownload> { |
| | | public interface TravelCountDownlService extends IService<ZfDownload> { |
| | | AjaxResult addData(ZfDownload zfDownload); |
| | | |
| | | AjaxResult deleteData(Long[] ids); |
File was renamed from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface TravelSharService extends IService<ZfShare> { |
| | | public interface TravelCountSharService extends IService<ZfShare> { |
| | | List<ZfShare> getAuthority(); |
| | | |
| | | AjaxResult saveZa(ShareMore shareMore); |
copy from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java
copy to zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java
File was copied from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfShare; |
| | | |
| | | public interface TravelDownlService extends IService<ZfDownload> { |
| | | public interface TravelDetailDownlService extends IService<ZfDownload> { |
| | | AjaxResult addData(ZfDownload zfDownload); |
| | | |
| | | AjaxResult deleteData(Long[] ids); |
copy from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java
copy to zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java
File was copied from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java |
| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.domain.ShareMore; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface TravelSharService extends IService<ZfShare> { |
| | | public interface TravelDetailSharService extends IService<ZfShare> { |
| | | List<ZfShare> getAuthority(); |
| | | |
| | | AjaxResult saveZa(ShareMore shareMore); |
copy from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java
copy to zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteDownlService.java
File was copied from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfShare; |
| | | |
| | | public interface TravelDownlService extends IService<ZfDownload> { |
| | | public interface ZfPetNoteDownlService extends IService<ZfDownload> { |
| | | AjaxResult addData(ZfDownload zfDownload); |
| | | |
| | | AjaxResult deleteData(Long[] ids); |
copy from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java
copy to zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteSharService.java
File was copied from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java |
| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.domain.ShareMore; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface TravelSharService extends IService<ZfShare> { |
| | | public interface ZfPetNoteSharService extends IService<ZfShare> { |
| | | List<ZfShare> getAuthority(); |
| | | |
| | | AjaxResult saveZa(ShareMore shareMore); |
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.TravelCount; |
| | | import com.ruoyi.domain.TravelDetail; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.mapper.ZfDownloadMapper; |
| | | import com.ruoyi.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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 |
| | | @Slf4j |
| | | public class TravelCountDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements TravelCountDownlService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | TravelCountSharService travelCountSharService; |
| | | |
| | | @Resource |
| | | TravelCountService travelCountService; |
| | | |
| | | |
| | | @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(travelCountSharService.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 (travelCountService.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<TravelCount> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (travelCountService.getById(a.getDownloadContent()) != null) { |
| | | TravelCount ds = travelCountService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<TravelCount> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<TravelCount> travelCountPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(travelCountPage, 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.*; |
| | | 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 TravelCountSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements TravelCountSharService { |
| | | |
| | | |
| | | @Resource |
| | | TravelCountService travelCountService; |
| | | |
| | | @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 { |
| | | 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(2056L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<TravelCount> 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(travelCountService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<TravelCount> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<TravelCount> travelCountPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(travelCountPage, 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()); |
| | | |
| | | remove(lqw); |
| | | // addData(za); |
| | | } |
| | | return AjaxResult.success("数据收回成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByUserId() { |
| | | HashMap<Long,List<TravelCount>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2056L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<TravelCount> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(travelCountService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<TravelCount> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2056L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | TravelCount bs2 = travelCountService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<TravelCount> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<TravelCount> travelCountPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(travelCountPage, 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; |
| | | } |
| | | } |
| | | } |
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.*; |
| | | import com.ruoyi.mapper.ZfDownloadMapper; |
| | | import com.ruoyi.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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 |
| | | @Slf4j |
| | | public class TravelDetailDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements TravelDetailDownlService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | TravelDetailSharService travelDetailSharService; |
| | | |
| | | @Resource |
| | | TravelDetailService travelDetailService; |
| | | |
| | | |
| | | @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(travelDetailSharService.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); |
| | | |
| | | System.out.println(" vhuwtjghb/"+zfDownload.getDownloadId()); |
| | | TravelDetail travelDetail =travelDetailService.getById(zfDownload.getDownloadContent()); |
| | | if (travelDetail != null){ |
| | | Long id = travelDetail.getCid(); |
| | | if (id != null){ |
| | | zfDownload.setId(zfDownload.getId()+1); |
| | | zfDownload.setSysMenuId(2056L); |
| | | zfDownload.setDownloadContent(id); |
| | | List<ZfDownload> travelCount = list(uniqueCondition(zfDownload)); |
| | | System.out.println("nmfiwwugn419526/"+zfDownload); |
| | | System.out.println(travelCount); |
| | | if (travelCount.size() == 0){ |
| | | addData(zfDownload); |
| | | }}} |
| | | return AjaxResult.success(); |
| | | } else { |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public AjaxResult deleteData(Long[] ids) { |
| | | List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); |
| | | |
| | | if (travelDetailService.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<TravelDetail> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (travelDetailService.getById(a.getDownloadContent()) != null) { |
| | | TravelDetail ds = travelDetailService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<TravelDetail> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<TravelDetail> travelDetailPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(travelDetailPage, 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.*; |
| | | 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 TravelDetailSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements TravelDetailSharService { |
| | | @Resource |
| | | TravelDetailService travelDetailService; |
| | | |
| | | @Resource |
| | | private ZInfoUserService zInfoUserService; |
| | | |
| | | @Resource |
| | | TravelCountSharService travelCountSharService; |
| | | |
| | | |
| | | 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 { |
| | | 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(2055L); |
| | | addData(za); |
| | | TravelDetail travelDetail =travelDetailService.getById(za.getShareContent()); |
| | | Long id = travelDetail.getCid(); |
| | | if (id != null){ |
| | | za.setId(za.getId()+1); |
| | | za.setSysMenuId(2056L); |
| | | za.setShareContent(id); |
| | | List<ZfShare> travelCount = list(uniqueCondition(za)); |
| | | System.out.println("nmfiwwugn419526/"+za); |
| | | System.out.println(travelCount); |
| | | if (travelCount.size() == 0){ |
| | | addData(za); |
| | | }} |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<TravelDetail> 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(travelDetailService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<TravelDetail> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<TravelDetail> travelDetailPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(travelDetailPage, 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()); |
| | | |
| | | remove(lqw); |
| | | // addData(za); |
| | | } |
| | | return AjaxResult.success("数据收回成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByUserId() { |
| | | HashMap<Long,List<TravelDetail>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2055L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<TravelDetail> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(travelDetailService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<TravelDetail> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2055L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | TravelDetail bs2 = travelDetailService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<TravelDetail> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<TravelDetail> travelDetailPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(travelDetailPage, 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; |
| | | } |
| | | } |
| | | } |
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.ZfDownload; |
| | | import com.ruoyi.domain.ZfPet; |
| | | import com.ruoyi.domain.ZfPetNote; |
| | | import com.ruoyi.mapper.ZfDownloadMapper; |
| | | import com.ruoyi.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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 |
| | | @Slf4j |
| | | public class ZfPetDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZfPetDownlService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | ZfPetSharService zfPetSharService; |
| | | |
| | | @Resource |
| | | ZfPetService zfPetService; |
| | | |
| | | |
| | | @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(zfPetSharService.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 (zfPetService.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<ZfPet> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (zfPetService.getById(a.getDownloadContent()) != null) { |
| | | ZfPet ds = zfPetService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<ZfPet> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfPet> zfPetPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfPetPage, 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.EsModel; |
| | | import com.ruoyi.common.utils.MapUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZfContact; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfPetNote; |
| | | import com.ruoyi.mapper.ZfDownloadMapper; |
| | | import com.ruoyi.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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 |
| | | @Slf4j |
| | | public class ZfPetNoteDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZfPetNoteDownlService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | ZfPetNoteSharService zfPetNoteSharService; |
| | | |
| | | @Resource |
| | | ZfPetNoteService zfPetNoteService; |
| | | |
| | | |
| | | @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(zfPetNoteSharService.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 (zfPetNoteService.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<ZfPetNote> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (zfPetNoteService.getById(a.getDownloadContent()) != null) { |
| | | ZfPetNote ds = zfPetNoteService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<ZfPetNote> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfPetNote> zfPetNotePage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfPetNotePage, 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.*; |
| | | 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 ZfPetNoteSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZfPetNoteSharService { |
| | | @Resource |
| | | ZfPetNoteService zfPetNoteService; |
| | | |
| | | @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 { |
| | | 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(2061L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<ZfPetNote> 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(zfPetNoteService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<ZfPetNote> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfPetNote> zfPetNotePage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfPetNotePage, 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()); |
| | | |
| | | remove(lqw); |
| | | // addData(za); |
| | | } |
| | | return AjaxResult.success("数据收回成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByUserId() { |
| | | HashMap<Long,List<ZfPetNote>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2061L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<ZfPetNote> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(zfPetNoteService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<ZfPetNote> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2061L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | ZfPetNote bs2 = zfPetNoteService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<ZfPetNote> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfPetNote> zfPetNotePage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfPetNotePage, 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | package com.ruoyi.service.impl; |
| | | |
| | | public class ZfPetSharServiceImpl { |
| | | 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.TravelDetailService; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import com.ruoyi.service.ZfPetService; |
| | | import com.ruoyi.service.ZfPetSharService; |
| | | 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 ZfPetSharServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfPetSharService { |
| | | |
| | | @Resource |
| | | ZfPetService zfPetService; |
| | | |
| | | @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 { |
| | | 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(2022L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<ZfPet> 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(zfPetService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<ZfPet> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfPet> zfPetPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfPetPage, 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()); |
| | | |
| | | remove(lqw); |
| | | // addData(za); |
| | | } |
| | | return AjaxResult.success("数据收回成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByUserId() { |
| | | HashMap<Long,List<ZfPet>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2022L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<ZfPet> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(zfPetService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<ZfPet> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2022L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | ZfPet bs2 = zfPetService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<ZfPet> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfPet> zfPetPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfPetPage, 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; |
| | | } |
| | | } |
| | | } |