From 2723e04976f006ace42c6c53627b87e1cc95ff07 Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期三, 31 七月 2024 12:27:48 +0800 Subject: [PATCH] 修改bug&分享 --- zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java | 51 ++++++++++++++++++++++++++++++++++----------------- 1 files changed, 34 insertions(+), 17 deletions(-) diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java index 6512ca9..3367b37 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java @@ -6,9 +6,7 @@ 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.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.common.utils.poi.ExcelUtil; import com.ruoyi.domain.*; @@ -20,7 +18,6 @@ import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; -import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -89,11 +86,7 @@ //鍔犱笂鑷繁瀹跺涵鐨刬d idList.add(familyId); // String familyIds = listFamilyIds(); -// String secondFamilyAuthority = listSecondFamilyIds(); - - //鏌ョ湅鍒汉鍒嗕韩 - List<ZfDoctor> bs = zfDoctorShareService.listUserId(myself.getUserId()); - +// String secondFamilyAuthority = listSecondFamilyIds() LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor, idList); Page<ZfDoctor> zfDoctorPage = new Page<>(pageNum, pageSize); @@ -102,7 +95,6 @@ List<ZfDoctor> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹� List<ZfDoctor> dtoResult = markOwnData(familyId, beanRecords); - dtoResult.addAll(bs); HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult); return AjaxResult.success(data); } @@ -124,12 +116,9 @@ //鍔犱笂鑷繁瀹跺涵鐨刬d idList.add(familyId); - //鏌ョ湅鍒汉鍒嗕韩 - List<ZfDoctor> bs = zfDoctorShareService.listUserId(myself.getUserId()); LambdaQueryWrapper<ZfDoctor> lambdaQueryWrapper = buildCondition(zfDoctor, idList); List<ZfDoctor> beanRecords = list(lambdaQueryWrapper); - beanRecords.addAll(bs); log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords); return markOwnData(familyId, beanRecords); } @@ -169,10 +158,13 @@ for (ZfDoctor zfDoctor : dataList) { - if (zfDoctor.getSymptom().length() == 0 || zfDoctor.getSymptom() == null) { - throw new RuntimeException("鐥囩姸涓虹┖锛屽鍏ユ暟鎹け璐�"); - } else { - zfDoctorService.addData(zfDoctor); + if (zfDoctor.getSuitable().length() != 0 || zfDoctor.getType().length() != 0 || zfDoctor.getEffect().length() != 0 ) { + if(zfDoctor.getSymptom().length() == 0 || zfDoctor.getSymptom() == null){ + throw new RuntimeException("鐥囩姸涓虹┖锛屽鍏ユ暟鎹け璐�"); + } + else { + zfDoctorService.addData(zfDoctor); + } } } return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛"); @@ -194,7 +186,7 @@ // List<ZfDoctorShare> authority1 = zfDoctorShareService.getAuthority(); // List<Long> idList1 = authority1.stream().filter(auth -> auth.getShareContent().toString().equals(DOCTOR_LIST)).map(ZfDoctorShare::getShareId).collect(Collectors.toList()); - zfDoctorService.addData(zfDoctor); +// zfDoctorService.addData(zfDoctor); if (zfDoctor.getFamilyId() != null && !familyIdList.contains(zfDoctor.getFamilyId())) { throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�"); @@ -447,6 +439,31 @@ return lqw; } +// public LambdaQueryWrapper<ZfDoctor> buildCondition2(List<Long> ids) { +// LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>(); +// lqw.eq(ZfDoctor::getId, ids); +// +// return lqw; +// } +// @Override +// public AjaxResult selectListById(List<Long> ids, Integer pageNum, Integer pageSize) { +// List<ZfDoctor> lqw2 = new ArrayList<>(); +// +// LambdaQueryWrapper<ZfDoctor> lqw = buildCondition2(ids); +// List<ZfDoctor> bb = list(lqw); +// System.out.println("15052222254"+bb); +// +// Page<ZfDoctor> zfDoctorPage = new Page<>(pageNum, pageSize); +// Page<ZfDoctor> pageResult = page(zfDoctorPage, lqw); +// List<ZfDoctor> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹� +// System.out.println(beanRecords); +// +// HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords); +// +// +// return AjaxResult.success(data); +//// } + // private List<Long> buildCondition1(){ // List<ZfDoctorShare> authority1 = zfDoctorShareService.getAuthority(); // List<Long> idList1 = authority1.stream().filter(auth -> auth.getShareContent().toString().equals(DOCTOR_LIST)).map(ZfDoctorShare::getShareId).collect(Collectors.toList()); -- Gitblit v1.9.1