From 70b1dd0f05dee11be31a64c7ca89b1208a982508 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Wed, 17 Jul 2024 16:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E6=A1=86=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=B8=93?= =?UTF-8?q?=E7=97=85=E8=B7=AF=E5=BE=84=E5=A4=8D=E5=88=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 4 +- .../common/config/SystemBusinessConfig.java | 13 ++++ .../constant/FileUploadPathConstants.java | 5 ++ .../FileUploadController.java | 2 +- .../impl/KnowledgeBaseServiceImpl.java | 66 ++++++++++++++++--- .../impl/FileUplooadServiceImpl.java | 10 ++- 6 files changed, 86 insertions(+), 14 deletions(-) diff --git a/postdischarge-admin/src/main/resources/application.yml b/postdischarge-admin/src/main/resources/application.yml index 61984149..2bac0618 100644 --- a/postdischarge-admin/src/main/resources/application.yml +++ b/postdischarge-admin/src/main/resources/application.yml @@ -14,7 +14,9 @@ xinelu: sign-informed-file-url: /signInformed # 素材库封面上传 propaganda-cover-url: /propagandaCover - # 宣教库封面上传 + # 富文本框视频上传 + common-video-url: /commonVideo + # 素材库封面上传 materials-cover-url: /materialsCover # 素材库封面上传 materials-video-url: /materialsVideo diff --git a/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java b/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java index b9ae64c3..fcedd444 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java @@ -56,6 +56,11 @@ public class SystemBusinessConfig { */ private String propagandaCoverUrl; + /** + * 富文本框视频 + */ + private String commonVideoUrl; + /** * 素材库封面 */ @@ -188,6 +193,14 @@ public class SystemBusinessConfig { this.propagandaCoverUrl = propagandaCoverUrl; } + public String getCommonVideoUrl() { + return commonVideoUrl; + } + + public void setCommonVideoUrl(String commonVideoUrl) { + this.commonVideoUrl = commonVideoUrl; + } + public String getMaterialsCoverUrl() { return materialsCoverUrl; } diff --git a/postdischarge-common/src/main/java/com/xinelu/common/constant/FileUploadPathConstants.java b/postdischarge-common/src/main/java/com/xinelu/common/constant/FileUploadPathConstants.java index a44a283b..e61edf5c 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/constant/FileUploadPathConstants.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/constant/FileUploadPathConstants.java @@ -17,6 +17,11 @@ public class FileUploadPathConstants { */ public static final String PROPAGANDA_COVER_TYPE = "propagandaCoverUrl"; + /** + * 富文本框视频上传路径 + */ + public static final String COMMON_VIDEO_TYPE = "commonVideoUrl"; + /** * 素材封面上传路径 */ diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientinformed/FileUploadController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientinformed/FileUploadController.java index 4532de5d..ec89a6d3 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientinformed/FileUploadController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/signpatientinformed/FileUploadController.java @@ -30,7 +30,7 @@ public class FileUploadController { * 文件上传 */ @ApiOperation(value = "文件上传", notes = "type:signInformedFileUrl:签约知情书上传,propagandaCoverUrl:宣教库封面上传," - + "materialsCoverUrl:宣教库封面上传,materialsVideoUrl:宣教库视频上传") + + "materialsCoverUrl:素材库封面上传,materialsVideoUrl:素材库视频上传,commonVideoUrl:富文本框视频上传") @PostMapping("/uploadFile") public AjaxResult uploadFile(@RequestParam("file") MultipartFile multipartFile, @RequestParam(value = "type") String type) throws Exception { if (Objects.isNull(multipartFile) || StringUtils.isBlank(multipartFile.getOriginalFilename())) { diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java index 81ac7343..d4d3e813 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java @@ -21,6 +21,8 @@ import com.xinelu.manage.domain.questioninfo.QuestionInfo; import com.xinelu.manage.domain.scriptInfo.ScriptInfo; import com.xinelu.manage.domain.servicepackage.ServicePackage; import com.xinelu.manage.domain.servicepackagecontent.ServicePackageContent; +import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode; +import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition; import com.xinelu.manage.domain.textmessage.TextMessage; import com.xinelu.manage.domain.textmessagesuittask.TextMessageSuitTask; import com.xinelu.manage.domain.wechattemplate.WechatTemplate; @@ -48,6 +50,7 @@ import com.xinelu.manage.mapper.questionsubjectoption.QuestionSubjectOptionMappe import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper; import com.xinelu.manage.mapper.servicepackage.ServicePackageMapper; import com.xinelu.manage.mapper.servicepackagecontent.ServicePackageContentMapper; +import com.xinelu.manage.mapper.specialdiseasetriggercondition.SpecialDiseaseTriggerConditionMapper; import com.xinelu.manage.mapper.textmessage.TextMessageMapper; import com.xinelu.manage.mapper.wechattemplate.WechatTemplateMapper; import com.xinelu.manage.mapper.wechattemplatesuittask.WechatTemplateSuitTaskMapper; @@ -58,7 +61,9 @@ import com.xinelu.manage.service.propagandainfo.IPropagandaInfoService; import com.xinelu.manage.service.questioninfo.IQuestionInfoService; import com.xinelu.manage.service.scriptInfo.IScriptInfoService; import com.xinelu.manage.service.servicepackage.IServicePackageService; +import com.xinelu.manage.service.specialdiseasenode.ISpecialDiseaseNodeService; import com.xinelu.manage.service.specialdiseaseroute.ISpecialDiseaseRouteService; +import com.xinelu.manage.service.specialdiseasetriggercondition.ISpecialDiseaseTriggerConditionService; import com.xinelu.manage.service.textmessage.ITextMessageService; import com.xinelu.manage.service.wechattemplate.IWechatTemplateService; import com.xinelu.manage.vo.questionInfo.QuestionVO; @@ -66,6 +71,7 @@ import com.xinelu.manage.vo.questionsubject.QuestionSubjectVO; import com.xinelu.manage.vo.questionsubjectoption.QuestionSubjectOptionVO; import com.xinelu.manage.vo.servicepackage.ServicePackageVO; import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO; +import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO; import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO; import com.xinelu.manage.vo.textmessage.TextMessageVO; import com.xinelu.manage.vo.wechattemplate.WechatTemplateTaskVO; @@ -131,6 +137,12 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService { private QuestionSubjectOptionMapper questionSubjectOptionMapper; @Resource private ISpecialDiseaseRouteService specialDiseaseRouteService; + @Resource + private ISpecialDiseaseNodeService specialDiseaseNodeService; + @Resource + private ISpecialDiseaseTriggerConditionService specialDiseaseTriggerConditionService; + @Resource + private SpecialDiseaseTriggerConditionMapper specialDiseaseTriggerConditionMapper; @Override public TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto) { @@ -542,16 +554,52 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService { private void saveSpecialDiseaseRoute(KnowledgeBaseSaveDto knowledgeBaseSaveDto) { knowledgeBaseSaveDto.getSourceTemplateIds().forEach(sourceId -> { - SpecialDiseaseRouteVO specialDiseaseRouteVO = specialDiseaseRouteService.selectSpecialDiseaseRouteById(sourceId); - SpecialDiseaseRouteVO saveObj = new SpecialDiseaseRouteVO(); - BeanUtils.copyBeanProp(saveObj, specialDiseaseRouteVO); - saveObj.setId(null); - saveObj.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); - saveObj.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName()); - // 节点信息 - - specialDiseaseRouteService.insertSpecialDiseaseRoute(saveObj); + Long saveRouteId = saveRoute(sourceId, null, knowledgeBaseSaveDto); + // 查询子路径 + SpecialDiseaseRouteDTO specialDiseaseRoute = new SpecialDiseaseRouteDTO(); + specialDiseaseRoute.setParentRouteId(sourceId); + List childRouteList = specialDiseaseRouteService.selectSpecialDiseaseRouteList(specialDiseaseRoute); + childRouteList.forEach(childRoute -> { + Long childRouteId = saveRoute(childRoute.getId(), saveRouteId, knowledgeBaseSaveDto); + // 触发条件保存 + SpecialDiseaseTriggerCondition specialDiseaseTriggerCondition = new SpecialDiseaseTriggerCondition(); + specialDiseaseTriggerCondition.setRouteId(childRoute.getId()); + List triggerConditionList = specialDiseaseTriggerConditionService.selectSpecialDiseaseTriggerConditionList(specialDiseaseTriggerCondition); + List triggerConditionSaveList = new ArrayList<>(); + triggerConditionList.forEach(triggerCondition -> { + triggerCondition.setId(null); + triggerCondition.setRouteId(childRouteId); + triggerConditionSaveList.add(triggerCondition); + }); + specialDiseaseTriggerConditionMapper.insertTriggerConditionList(triggerConditionSaveList); + }); }); } + + private Long saveRoute(Long specialDiseaseRouteId, Long parentRouteId, KnowledgeBaseSaveDto knowledgeBaseSaveDto) { + SpecialDiseaseRouteVO specialDiseaseRouteVO = specialDiseaseRouteService.selectSpecialDiseaseRouteById(specialDiseaseRouteId); + SpecialDiseaseRouteVO saveObj = new SpecialDiseaseRouteVO(); + BeanUtils.copyBeanProp(saveObj, specialDiseaseRouteVO); + saveObj.setId(null); + saveObj.setParentRouteId(parentRouteId); + saveObj.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); + saveObj.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName()); + specialDiseaseRouteService.insertSpecialDiseaseRoute(saveObj); + // 节点信息 + SpecialDiseaseNode specialDiseaseNode = new SpecialDiseaseNode(); + specialDiseaseNode.setRouteId(specialDiseaseRouteId); + List nodeList = specialDiseaseNodeService.selectSpecialDiseaseNodeList(specialDiseaseNode); + List specialDiseaseNodeVOs = new ArrayList<>(); + nodeList.forEach(node -> { + SpecialDiseaseNodeVO specialDiseaseNodeVO = new SpecialDiseaseNodeVO(); + BeanUtils.copyBeanProp(specialDiseaseNodeVO, node); + specialDiseaseNodeVO.setId(null); + specialDiseaseNodeVO.setRouteId(saveObj.getId()); + specialDiseaseNodeVOs.add(specialDiseaseNodeVO); + }); + saveObj.setSpecialDiseaseNodeList(specialDiseaseNodeVOs); + specialDiseaseRouteService.insertSpecialDiseaseRoute(saveObj); + return saveObj.getId(); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientinformed/impl/FileUplooadServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientinformed/impl/FileUplooadServiceImpl.java index 6a8e3616..bc55d8df 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientinformed/impl/FileUplooadServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientinformed/impl/FileUplooadServiceImpl.java @@ -31,10 +31,14 @@ public class FileUplooadServiceImpl implements IFileUploadService { case FileUploadPathConstants.SIGN_INFORMED_TYPE: uploadPathUrl = SystemBusinessConfig.getProfile() + systemBusinessConfig.getSignInformedFileUrl(); break; - //护理宣教库封面路径上传 + //宣教库封面路径上传 case FileUploadPathConstants.PROPAGANDA_COVER_TYPE: uploadPathUrl = SystemBusinessConfig.getProfile() + systemBusinessConfig.getPropagandaCoverUrl(); break; + //宣教库视频路径上传 + case FileUploadPathConstants.COMMON_VIDEO_TYPE: + uploadPathUrl = SystemBusinessConfig.getProfile() + systemBusinessConfig.getCommonVideoUrl(); + break; //素材库封面图片路径上传 case FileUploadPathConstants.MATERIALS_COVER_TYPE: uploadPathUrl = SystemBusinessConfig.getProfile() + systemBusinessConfig.getMaterialsCoverUrl(); @@ -51,13 +55,13 @@ public class FileUplooadServiceImpl implements IFileUploadService { } //上传 String pictureName = ""; - if (StringUtils.equals(type, FileUploadPathConstants.MATERIALS_VIDEO_TYPE)) { + if (StringUtils.equals(type, FileUploadPathConstants.MATERIALS_VIDEO_TYPE) || StringUtils.equals(type, FileUploadPathConstants.COMMON_VIDEO_TYPE)) { pictureName = FileUploadUtils.upload(uploadPathUrl, multipartFile, MimeTypeUtils.VIDEO_EXTENSION); } else { pictureName = FileUploadUtils.upload(uploadPathUrl, multipartFile, MimeTypeUtils.IMAGE_EXTENSION); } if (StringUtils.isBlank(pictureName)) { - throw new ServiceException("图片上传失败,请联系管理员!"); + throw new ServiceException("文件上传失败,请联系管理员!"); } AjaxResult ajax = AjaxResult.success("上传成功!"); ajax.put("imgUrl", pictureName);