公共知识库。

This commit is contained in:
haown 2024-07-09 13:40:58 +08:00
parent 6e7ee5c546
commit 221051c3d4
10 changed files with 178 additions and 50 deletions

View File

@ -19,4 +19,8 @@ public class KnowledgeBaseConstants {
* 微信库
*/
public static final String WECHAT = "WECHAT";
/**
* 短信库
*/
public static final String MESSAGE = "MESSAGE";
}

View File

@ -1,13 +1,17 @@
package com.xinelu.manage.controller.knowledgebase;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.manage.dto.knowledgebase.KnowledgeBaseSaveDto;
import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto;
import com.xinelu.manage.service.knowlagebase.IKnowlageBaseService;
import com.xinelu.manage.service.knowledgebase.IKnowledgeBaseService;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -22,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
public class KnowledgeBaseController {
@Resource
private IKnowlageBaseService knowlageBaseService;
private IKnowledgeBaseService knowlageBaseService;
/**
* 知识库复制查询虚拟机构列表
@ -33,4 +37,15 @@ public class KnowledgeBaseController {
public TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto) {
return knowlageBaseService.getBaseInfoList(baseInfoQueryDto);
}
/**
* 新增知识库信息
*/
@ApiOperation("新增知识库信息")
@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:add')")
@PostMapping(value = "/copyBaseInfo")
public R<String> copyBaseInfo(@RequestBody KnowledgeBaseSaveDto knowledgeBaseSaveDto) {
knowlageBaseService.copyBaseInfo(knowledgeBaseSaveDto);
return R.ok();
}
}

View File

@ -4,14 +4,11 @@ import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
/**
* 手术信息对象 operation_info
@ -83,22 +80,8 @@ public class OperationInfo extends BaseEntity {
@Excel(name = "排序")
private Integer sort;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("departmentId", getDepartmentId())
.append("departmentName", getDepartmentName())
.append("operationName", getOperationName())
.append("operationCode", getOperationCode())
.append("operationInfo", getOperationInfo())
.append("operationRemark", getOperationRemark())
.append("sort", getSort())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
/**
* 公共库模板id
*/
private Long sourceTemplateId;
}

View File

@ -0,0 +1,36 @@
package com.xinelu.manage.dto.knowledgebase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description: 知识库保存传输对象
* @author: haown
* @create: 2024-07-09 09:34
**/
@Data
public class KnowledgeBaseSaveDto {
/**
* 模板id
*/
@ApiModelProperty(value = "公共库模板id")
private Long sourceTemplateId;
/**
* 知识库类型
*/
@ApiModelProperty(value = "知识库类型,OPERATOR:手术SCRIPT话术WECHAT微信")
private String type;
/**
* 所属科室id
*/
@ApiModelProperty(value = "所属科室id")
private Long departmentId;
/**
* 所属科室名称
*/
@ApiModelProperty(value = "所属科室名称")
private String departmentName;
}

View File

@ -32,4 +32,28 @@ public class BaseInfoQueryDto {
*/
@ApiModelProperty(value = "手术名称")
private String operationName;
/**
* 通用话术名称
*/
@ApiModelProperty(value = "通用话术名称")
private String commonScriptName;
/**
* 话术名称
*/
@ApiModelProperty(value = "话术名称")
private String scriptName;
/**
* 话术状态正常NORMAL下架OFF_SHELF暂停SUSPEND
*/
@ApiModelProperty(value = "话术状态正常NORMAL下架OFF_SHELF暂停SUSPEND")
private String scriptStatus;
/**
* 微信模板名称
*/
@ApiModelProperty(value = "微信模板名称")
private String wechatTemplateName;
}

View File

@ -50,4 +50,10 @@ public class OperationInfoDto extends BaseEntity {
*/
@ApiModelProperty(value = "术式信息")
private String operationInfo;
/**
* 公共库模板id
*/
@ApiModelProperty(value = "公共库模板id")
private Long sourceTemplateId;
}

View File

@ -1,15 +0,0 @@
package com.xinelu.manage.service.knowlagebase;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto;
/**
* 知识库公共Service接口
*
* @author haown
* @date 2024-07-08
*/
public interface IKnowlageBaseService {
TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto);
}

View File

@ -0,0 +1,22 @@
package com.xinelu.manage.service.knowledgebase;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.manage.dto.knowledgebase.KnowledgeBaseSaveDto;
import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto;
/**
* 知识库公共Service接口
*
* @author haown
* @date 2024-07-08
*/
public interface IKnowledgeBaseService {
TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto);
/**
* 知识库复制
* @param knowladgeBaseSaveDto 知识库保存传输对象
*/
void copyBaseInfo(KnowledgeBaseSaveDto knowladgeBaseSaveDto);
}

View File

@ -1,24 +1,32 @@
package com.xinelu.manage.service.knowlagebase.impl;
package com.xinelu.manage.service.knowledgebase.impl;
import com.github.pagehelper.PageInfo;
import com.xinelu.common.constant.HttpStatus;
import com.xinelu.common.constant.KnowledgeBaseConstants;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.PageUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.operationInfo.OperationInfo;
import com.xinelu.manage.domain.scriptInfo.ScriptInfo;
import com.xinelu.manage.dto.knowledgebase.KnowledgeBaseSaveDto;
import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto;
import com.xinelu.manage.dto.operationinfo.OperationInfoDto;
import com.xinelu.manage.dto.script.ScriptInfoDto;
import com.xinelu.manage.dto.textmessage.TextMessageDTO;
import com.xinelu.manage.dto.wechattemplate.WechatTemplateDTO;
import com.xinelu.manage.mapper.operationInfo.OperationInfoMapper;
import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper;
import com.xinelu.manage.mapper.textmessage.TextMessageMapper;
import com.xinelu.manage.mapper.wechattemplate.WechatTemplateMapper;
import com.xinelu.manage.service.knowlagebase.IKnowlageBaseService;
import com.xinelu.manage.service.knowledgebase.IKnowledgeBaseService;
import com.xinelu.manage.service.operationInfo.IOperationInfoService;
import com.xinelu.manage.vo.textmessage.TextMessageVO;
import com.xinelu.manage.vo.wechattemplate.WechatTemplateTaskVO;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
/**
@ -27,14 +35,18 @@ import org.springframework.stereotype.Service;
* @create: 2024-07-08 16:25
**/
@Service
public class KnowlageBaseServiceImpl implements IKnowlageBaseService {
public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService {
@Resource
private OperationInfoMapper operationInfoMapper;
@Resource
private IOperationInfoService operationInfoService;
@Resource
private ScriptInfoMapper scriptInfoMapper;
@Resource
private WechatTemplateMapper wechatTemplateMapper;
@Resource
private TextMessageMapper textMessageMapper;
@Override
public TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto) {
@ -76,7 +88,39 @@ public class KnowlageBaseServiceImpl implements IKnowlageBaseService {
rspData.setPageNum(new PageInfo(wechatTemplateList).getPageNum());
rspData.setTotal(new PageInfo(wechatTemplateList).getTotal());
break;
case KnowledgeBaseConstants.MESSAGE:
TextMessageDTO textMessageDTO = new TextMessageDTO();
BeanUtils.copyBeanProp(textMessageDTO, baseInfoQueryDto);
PageUtils.startPage();
List<TextMessageVO> messageList = textMessageMapper.selectTextMessageList(textMessageDTO);
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(messageList);
// 返回 页码
rspData.setPageNum(new PageInfo(messageList).getPageNum());
rspData.setTotal(new PageInfo(messageList).getTotal());
break;
}
return rspData;
}
@Override
public void copyBaseInfo(KnowledgeBaseSaveDto knowledgeBaseSaveDto) {
if (StringUtils.isBlank(knowledgeBaseSaveDto.getType())) {
throw new ServiceException("请输入知识库类型");
}
if (ObjectUtils.isEmpty(knowledgeBaseSaveDto.getDepartmentId())) {
throw new ServiceException("请选择科室");
}
switch(knowledgeBaseSaveDto.getType()) {
case KnowledgeBaseConstants.OPERATOR:
OperationInfo operationInfo = operationInfoMapper.selectOperationInfoById(knowledgeBaseSaveDto.getSourceTemplateId());
operationInfo.setId(null);
operationInfo.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId());
operationInfo.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName());
operationInfo.setSourceTemplateId(knowledgeBaseSaveDto.getSourceTemplateId());
operationInfoService.insertOperationInfo(operationInfo);
break;
}
}
}

View File

@ -13,6 +13,7 @@
<result property="operationInfo" column="operation_info"/>
<result property="operationRemark" column="operation_remark"/>
<result property="sort" column="sort"/>
<result property="sourceTemplateId" column="source_template_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
@ -28,6 +29,7 @@
operation_info,
operation_remark,
sort,
source_template_id,
create_by,
create_time,
update_by,
@ -43,16 +45,10 @@
#{departmentId}
</if>
<if test="departmentName != null and departmentName != ''">
and department_name like concat('%',
#{departmentName},
'%'
)
and department_name like concat('%',#{departmentName},'%')
</if>
<if test="operationName != null and operationName != ''">
and operation_name like concat('%',
#{operationName},
'%'
)
and operation_name like concat('%',#{operationName},'%')
</if>
<if test="operationCode != null and operationCode != ''">
and operation_code = #{operationCode}
@ -66,6 +62,9 @@
<if test="sort != null ">
and sort = #{sort}
</if>
<if test="sourceTemplateId != null ">
and source_template_id = #{sourceTemplateId}
</if>
</where>
order by create_time DESC
</select>
@ -104,6 +103,9 @@
<if test="operationInfo != null and operationInfo != ''">
and oi.operation_info = #{operationInfo}
</if>
<if test="sourceTemplateId != null ">
and source_template_id = #{sourceTemplateId}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
@ -150,6 +152,8 @@
</if>
<if test="sort != null">sort,
</if>
<if test="sourceTemplateId != null ">source_template_id,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
@ -174,6 +178,8 @@
</if>
<if test="sort != null">#{sort},
</if>
<if test="sourceTemplateId != null ">#{sourceTemplateId},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
@ -209,6 +215,9 @@
<if test="sort != null">sort =
#{sort},
</if>
<if test="sourceTemplateId != null ">
source_template_id = #{sourceTemplateId},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>