修改服务包复制。

This commit is contained in:
haown 2024-07-19 11:33:09 +08:00
parent a86c961b7f
commit 405f35f340

View File

@ -11,6 +11,7 @@ import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil; import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.common.utils.uuid.IdUtils;
import com.xinelu.manage.domain.agency.Agency; import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.domain.department.Department; import com.xinelu.manage.domain.department.Department;
import com.xinelu.manage.domain.departmentdiseasetype.DepartmentDiseaseType; import com.xinelu.manage.domain.departmentdiseasetype.DepartmentDiseaseType;
@ -19,8 +20,6 @@ import com.xinelu.manage.domain.propagandainfo.PropagandaInfo;
import com.xinelu.manage.domain.propagandamaterials.PropagandaMaterials; import com.xinelu.manage.domain.propagandamaterials.PropagandaMaterials;
import com.xinelu.manage.domain.questioninfo.QuestionInfo; import com.xinelu.manage.domain.questioninfo.QuestionInfo;
import com.xinelu.manage.domain.scriptInfo.ScriptInfo; 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.specialdiseasenode.SpecialDiseaseNode;
import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition; import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition;
import com.xinelu.manage.domain.textmessage.TextMessage; import com.xinelu.manage.domain.textmessage.TextMessage;
@ -69,6 +68,7 @@ import com.xinelu.manage.service.wechattemplate.IWechatTemplateService;
import com.xinelu.manage.vo.questionInfo.QuestionVO; import com.xinelu.manage.vo.questionInfo.QuestionVO;
import com.xinelu.manage.vo.questionsubject.QuestionSubjectVO; import com.xinelu.manage.vo.questionsubject.QuestionSubjectVO;
import com.xinelu.manage.vo.questionsubjectoption.QuestionSubjectOptionVO; import com.xinelu.manage.vo.questionsubjectoption.QuestionSubjectOptionVO;
import com.xinelu.manage.vo.servicepackage.ServicePackageDetailVO;
import com.xinelu.manage.vo.servicepackage.ServicePackageVO; import com.xinelu.manage.vo.servicepackage.ServicePackageVO;
import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO; import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO;
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO; import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO;
@ -326,7 +326,14 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService {
scriptInfo.setDiseaseTypeName(diseaseTypeList.get(0).getDiseaseTypeName()); scriptInfo.setDiseaseTypeName(diseaseTypeList.get(0).getDiseaseTypeName());
} }
} }
scriptInfoService.insertScriptInfo(scriptInfo); if (scriptInfoMapper.countByScriptInfo(scriptInfo) > 0) {
throw new ServiceException("通用话术名称已存在");
}
// 设置创建人与创建时间
scriptInfo.setCreateBy(SecurityUtils.getUsername());
scriptInfo.setCreateTime(LocalDateTime.now());
scriptInfo.setScriptId(IdUtils.fastUUID());
scriptInfoMapper.insertScriptInfo(scriptInfo);
}); });
} }
@ -459,23 +466,23 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService {
private void saveServicePackage(KnowledgeBaseSaveDto knowledgeBaseSaveDto) { private void saveServicePackage(KnowledgeBaseSaveDto knowledgeBaseSaveDto) {
knowledgeBaseSaveDto.getSourceTemplateIds().forEach(sourceId -> { knowledgeBaseSaveDto.getSourceTemplateIds().forEach(sourceId -> {
ServicePackageAddDTO servicePackageAddDTO = new ServicePackageAddDTO(); ServicePackageAddDTO servicePackageAddDTO = new ServicePackageAddDTO();
ServicePackage servicePackage = servicePackageMapper.selectServicePackageById(sourceId); ServicePackageDetailVO servicePackageDetail = servicePackageService.selectServicePackageById(sourceId);
BeanUtils.copyBeanProp(servicePackageAddDTO, servicePackage); BeanUtils.copyBeanProp(servicePackageAddDTO, servicePackageDetail);
servicePackageAddDTO.setId(null); servicePackageAddDTO.setId(null);
servicePackageAddDTO.setSourceTemplateId(sourceId); servicePackageAddDTO.setSourceTemplateId(sourceId);
servicePackageAddDTO.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); servicePackageAddDTO.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId());
servicePackageAddDTO.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName()); servicePackageAddDTO.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName());
if (servicePackage.getDiseaseTypeId() != null) { if (servicePackageDetail.getDiseaseTypeId() != null) {
DepartmentDiseaseTypeDto departmentDiseaseType = new DepartmentDiseaseTypeDto(); DepartmentDiseaseTypeDto departmentDiseaseType = new DepartmentDiseaseTypeDto();
departmentDiseaseType.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); departmentDiseaseType.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId());
departmentDiseaseType.setDiseaseTypeName(servicePackage.getDiseaseTypeName()); departmentDiseaseType.setDiseaseTypeName(servicePackageDetail.getDiseaseTypeName());
List<DepartmentDiseaseType> diseaseTypeList = departmentDiseaseTypeService.selectDepartmentDiseaseTypeList(departmentDiseaseType); List<DepartmentDiseaseType> diseaseTypeList = departmentDiseaseTypeService.selectDepartmentDiseaseTypeList(departmentDiseaseType);
if (CollectionUtils.isEmpty(diseaseTypeList)) { if (CollectionUtils.isEmpty(diseaseTypeList)) {
// 新增病种 // 新增病种
DepartmentDiseaseType diseaseTypeSaveObj = new DepartmentDiseaseType(); DepartmentDiseaseType diseaseTypeSaveObj = new DepartmentDiseaseType();
diseaseTypeSaveObj.setDiseaseTypeName(servicePackage.getDiseaseTypeName()); diseaseTypeSaveObj.setDiseaseTypeName(servicePackageDetail.getDiseaseTypeName());
diseaseTypeSaveObj.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); diseaseTypeSaveObj.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId());
diseaseTypeSaveObj.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName()); diseaseTypeSaveObj.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName());
departmentDiseaseTypeService.insertDepartmentDiseaseType(diseaseTypeSaveObj); departmentDiseaseTypeService.insertDepartmentDiseaseType(diseaseTypeSaveObj);
@ -487,15 +494,8 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService {
} }
} }
ServicePackageContent servicePackageContent = new ServicePackageContent(); List<ServicePackageContentVO> voList = servicePackageDetail.getVoList();
servicePackageContent.setServicePackageId(sourceId);
List<ServicePackageContent> servicePackageContentList = servicePackageContentMapper.selectServicePackageContentList(servicePackageContent);
List<ServicePackageContentVO> voList = new ArrayList<>();
servicePackageContentList.forEach(content -> {
ServicePackageContentVO servicePackageContentVO = new ServicePackageContentVO();
BeanUtils.copyBeanProp(servicePackageContentVO, content);
voList.add(servicePackageContentVO);
});
servicePackageAddDTO.setVoList(voList); servicePackageAddDTO.setVoList(voList);
servicePackageService.insertServicePackage(servicePackageAddDTO); servicePackageService.insertServicePackage(servicePackageAddDTO);
}); });