富文本框视频上传接口,专病路径复制。

This commit is contained in:
haown 2024-07-17 16:14:08 +08:00
parent 395d2be780
commit 70b1dd0f05
6 changed files with 86 additions and 14 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -17,6 +17,11 @@ public class FileUploadPathConstants {
*/
public static final String PROPAGANDA_COVER_TYPE = "propagandaCoverUrl";
/**
* 富文本框视频上传路径
*/
public static final String COMMON_VIDEO_TYPE = "commonVideoUrl";
/**
* 素材封面上传路径
*/

View File

@ -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())) {

View File

@ -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<SpecialDiseaseRouteVO> childRouteList = specialDiseaseRouteService.selectSpecialDiseaseRouteList(specialDiseaseRoute);
childRouteList.forEach(childRoute -> {
Long childRouteId = saveRoute(childRoute.getId(), saveRouteId, knowledgeBaseSaveDto);
// 触发条件保存
SpecialDiseaseTriggerCondition specialDiseaseTriggerCondition = new SpecialDiseaseTriggerCondition();
specialDiseaseTriggerCondition.setRouteId(childRoute.getId());
List<SpecialDiseaseTriggerCondition> triggerConditionList = specialDiseaseTriggerConditionService.selectSpecialDiseaseTriggerConditionList(specialDiseaseTriggerCondition);
List<SpecialDiseaseTriggerCondition> 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<SpecialDiseaseNode> nodeList = specialDiseaseNodeService.selectSpecialDiseaseNodeList(specialDiseaseNode);
List<SpecialDiseaseNodeVO> 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();
}
}

View File

@ -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);