| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | } |
| | |
| | | private Double otherCost; |
| | | |
| | | private String backInfo; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private Date happenTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private Date happenTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private Date happenTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private Date happenTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | private Date happenTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | |
| | | } |
| | |
| | | @Excel(name = "出生日期", dateFormat = "yyyy-MM-dd") |
| | | private Date birthEnd; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date remindEndTime; |
| | | |
| | | /** |
| | | * 分享人id |
| | | */ |
| | | private Integer shareId; |
| | | |
| | | |
| | | |
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; |
| | | import com.ruoyi.domain.ZfShare; |
| | | |
| | | public interface TravelDownlService 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.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface TravelSharService 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); |
| | | } |
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 ZfCleanDownloadService 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.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ZfCleanShareService 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); |
| | | } |
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 ZfCollectionDownloadService 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.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ZfCollectionShareService 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); |
| | | } |
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 ZfContactDownlService 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.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ZfContactShraService 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); |
| | | } |
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 ZfEconomyDownlService 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.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ZfEconomyShaService 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); |
| | | } |
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 ZfEquipDownloadService 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.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ZfEquipShareService 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); |
| | | } |
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 ZfPetDownlService 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.ZfProperty; |
| | | import com.ruoyi.domain.ZfShare; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ZfPetSharService 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); |
| | | } |
New file |
| | |
| | | package com.ruoyi.service.impl; |
| | | |
| | | public class TravelDownServiceImpl { |
| | | } |
New file |
| | |
| | | package com.ruoyi.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | 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 com.ruoyi.mapper.ZfShareMapper; |
| | | import com.ruoyi.service.TravelSharService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class TravelSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements TravelSharService { |
| | | @Override |
| | | public List<ZfShare> getAuthority() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveZa(ShareMore shareMore) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult deleteZa(ShareMore shareMore) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByUserId() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Long getShareId(ZfDownload zfDownload) { |
| | | 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.ZfClean; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfProperty; |
| | | 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; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class ZfCleanDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZfCleanDownloadService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | ZfCleanShareService zfCleanShareService; |
| | | |
| | | @Resource |
| | | ZfCleanService zfCleanService; |
| | | |
| | | |
| | | @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(zfCleanShareService.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 (zfCleanShareService.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<ZfClean> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (zfCleanService.getById(a.getDownloadContent()) != null) { |
| | | ZfClean ds = zfCleanService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<ZfClean> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfClean> 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.*; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class ZfCleanShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZfCleanShareService { |
| | | @Resource |
| | | ZfCleanShareService zfCleanShareService; |
| | | |
| | | @Resource |
| | | ZfCleanService zfCleanService; |
| | | |
| | | @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 { |
| | | zfCleanShareService.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(2020L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<ZfClean> 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(zfCleanService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<ZfClean> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfClean> zfCleanPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfCleanPage, 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()); |
| | | |
| | | zfCleanShareService.remove(lqw); |
| | | // addData(za); |
| | | } |
| | | return AjaxResult.success("数据收回成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByUserId() { |
| | | HashMap<Long,List<ZfClean>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2020L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<ZfClean> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(zfCleanService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | // log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<ZfClean> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2020L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | ZfClean bs2 = zfCleanService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | // log.info("从数据库中查到的为:{}", bs); |
| | | List<ZfClean> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfClean> zfCleanPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfCleanPage, 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.mapper.ZfShareMapper; |
| | | 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 ZfCollectionDownlServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfCollectionDownloadService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | ZfCollectionShareService zfCollectionShareService; |
| | | |
| | | @Resource |
| | | ZfCollectionService zfCollectionService; |
| | | |
| | | |
| | | @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(zfCollectionShareService.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 (zfCollectionShareService.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<ZfCollection> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (zfCollectionService.getById(a.getDownloadContent()) != null) { |
| | | ZfCollection ds = zfCollectionService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<ZfCollection> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfCollection> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, 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; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class ZfCollectionShaServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfCollectionShareService { |
| | | |
| | | |
| | | @Resource |
| | | ZfCollectionService zfCollectionService; |
| | | |
| | | @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(2018L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<ZfCollection> 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(zfCollectionService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<ZfCollection> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfCollection> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, 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<ZfCollection>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2018L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<ZfCollection> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(zfCollectionService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<ZfCollection> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2018L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | ZfCollection bs2 = zfCollectionService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<ZfCollection> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfCollection> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, 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.mapper.ZfShareMapper; |
| | | 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 ZfContactDownlServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfContactDownlService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | ZfContactShraServiceImpl zfContactShraService; |
| | | |
| | | @Resource |
| | | ZfContactService zfContactService; |
| | | |
| | | |
| | | @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(zfContactShraService.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 (zfContactShraService.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<ZfContact> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (zfContactService.getById(a.getDownloadContent()) != null) { |
| | | ZfContact ds = zfContactService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<ZfContact> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfContact> zfContactPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfContactPage, 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.ZfCollectionService; |
| | | import com.ruoyi.service.ZfContactService; |
| | | import com.ruoyi.service.ZfContactShraService; |
| | | 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; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class ZfContactShraServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfContactShraService { |
| | | @Resource |
| | | ZfContactService zfContactService; |
| | | |
| | | @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(2021L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<ZfContact> 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(zfContactService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<ZfContact> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfContact> zfContactPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfContactPage, 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<ZfContact>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2021L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<ZfContact> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(zfContactService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<ZfContact> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2021L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | ZfContact bs2 = zfContactService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<ZfContact> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfContact> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, 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.ZfContact; |
| | | import com.ruoyi.domain.ZfDownload; |
| | | import com.ruoyi.domain.ZfEconomy; |
| | | 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 ZfEconomyDownlServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfEconomyDownlService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | ZfEconomyService zfEconomyService; |
| | | |
| | | @Resource |
| | | ZfEconomyShaService zfEconomyShaService; |
| | | |
| | | |
| | | @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(zfEconomyShaService.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 (zfEconomyShaService.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<ZfEconomy> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (zfEconomyService.getById(a.getDownloadContent()) != null) { |
| | | ZfEconomy ds = zfEconomyService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<ZfEconomy> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfEconomy> zfEconomyPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfEconomyPage, 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; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class ZfEconomySharServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfEconomyShaService { |
| | | @Resource |
| | | ZfEconomyService zfEconomyService; |
| | | |
| | | @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(2023L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<ZfEconomy> 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(zfEconomyService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<ZfEconomy> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfEconomy> zfEconomyPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfEconomyPage, 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<ZfEconomy>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2023L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<ZfEconomy> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(zfEconomyService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<ZfEconomy> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2023L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | ZfEconomy bs2 = zfEconomyService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<ZfEconomy> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfEconomy> zfEconomyPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfEconomyPage, 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.ZfEconomy; |
| | | import com.ruoyi.domain.ZfEquipment; |
| | | 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; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class ZfEquipDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZfEquipDownloadService { |
| | | @Resource |
| | | EsService esService; |
| | | |
| | | @Resource |
| | | ZfEquipShareServiceImpl zfEquipShareService; |
| | | |
| | | @Resource |
| | | ZfEquipmentService zfEquipmentService; |
| | | |
| | | |
| | | @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(zfEquipShareService.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 (zfEquipShareService.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<ZfEquipment> bs = new ArrayList<>(); |
| | | for (ZfDownload a: beanRecords) { |
| | | if (zfEquipmentService.getById(a.getDownloadContent()) != null) { |
| | | ZfEquipment ds = zfEquipmentService.getById(a.getDownloadContent()); |
| | | ds.setShareId(a.getShareId().intValue()); |
| | | bs.add(ds); |
| | | } |
| | | } |
| | | List<ZfEquipment> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfEquipment> zfEquipmentPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfEquipmentPage, 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.ZfEconomyService; |
| | | import com.ruoyi.service.ZfEquipShareService; |
| | | import com.ruoyi.service.ZfEquipmentService; |
| | | 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 ZfEquipShareServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfEquipShareService { |
| | | @Resource |
| | | ZfEquipmentService zfEquipmentService; |
| | | |
| | | @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(2017L); |
| | | addData(za); |
| | | } |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("分享成功!"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { |
| | | Long [] shareIds = shareMore.getShareIds(); |
| | | List<ZfEquipment> 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(zfEquipmentService.getById(beanRecord.getShareContent())); |
| | | } |
| | | } |
| | | } |
| | | List<ZfEquipment> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (beanRecord3.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfEquipment> zfEquipmentPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfEquipmentPage, 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<ZfEquipment>> bs = new HashMap<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2017L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | List<ZfEquipment> b1 = new ArrayList<>(); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | b1.add(zfEquipmentService.getById(beanRecord.getShareContent())); |
| | | bs.put(beanRecord.getUserId(),b1); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | return AjaxResult.success(bs); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listUserId(Integer pageNo, Integer pageSize) { |
| | | List<ZfEquipment> bs = new ArrayList<>(); |
| | | LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfShare::getShareId,getUserId()); |
| | | lqw.eq(ZfShare::getSysMenuId,2017L); |
| | | List<ZfShare> beanRecords = list(lqw); |
| | | for (ZfShare beanRecord : beanRecords ) { |
| | | ZfEquipment bs2 = zfEquipmentService.getById(beanRecord.getShareContent()); |
| | | bs2.setShareId(beanRecord.getUserId().intValue()); |
| | | bs.add(bs2); |
| | | } |
| | | log.info("从数据库中查到的为:{}", bs); |
| | | List<ZfEquipment> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | |
| | | int totalPage = (bs.size() -1) / pageSize +1; |
| | | |
| | | Page<ZfEquipment> zfEquipmentPage = new Page<>(pageNo, pageSize,totalPage); |
| | | HashMap<String, Object> data = MapUtils.getShareResult(zfEquipmentPage, 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; |
| | | |
| | | public class ZfPetDownlServiceImpl { |
| | | } |
New file |
| | |
| | | package com.ruoyi.service.impl; |
| | | |
| | | public class ZfPetSharServiceImpl { |
| | | } |