zqy
5 天以前 b02beccf4567068cb47a3f1181a00039456c872d
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
@@ -10,6 +10,7 @@
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfDoctor;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import com.ruoyi.mapper.ZfDownloadMapper;
import com.ruoyi.service.*;
import org.elasticsearch.action.delete.DeleteRequest;
@@ -110,14 +111,29 @@
    }
}
    @Override
    public AjaxResult deleteData(Long[] ids) {
        List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids));
    public Boolean deleteData(Long[] ids) {
        List<Long> id = new ArrayList<>();
        if (zfDoctorShareService.removeByIds(Arrays.asList(ids))) {
        LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
        lqw.in(ids != null, ZfDownload::getDownloadContent,  ids)
                .eq(ZfDownload::getSysMenuId, 2019L);
        List<ZfDownload> zfDownloads = list(lqw);
        System.out.println(zfDownloads);
        if (zfDownloads.size() == 0){
            return true;
        }
        for (ZfDownload zfDownload: zfDownloads) {
            id.add(zfDownload.getId());
        }
        System.out.println(id);
        if (removeByIds(id)) {
            //删除es中的数据
            zfDownloads.stream().forEach(zfDoctorDownload -> {
                EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "家庭小医生下载");
                EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "家庭小医生下载删除");
                if (esModel != null) {
                    DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
@@ -128,9 +144,9 @@
                    }
                }
            });
            return AjaxResult.success();
            return true;
        } else {
            return AjaxResult.error();
            return false;
        }
    }
@@ -139,4 +155,11 @@
        ZInfoUser myself = zInfoUserService.getMyself();
        return myself.getUserId();
    }
    @Override
    public List<ZfDownload> getByUserId(Long userId) {
        LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfDownload::getDownloadId, userId);
        return list(lqw);
    }
}