Commit ffa8f6bd by zhuyajie

关键词关联技能

parent 8ff1a004
...@@ -208,6 +208,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -208,6 +208,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private PcloudKeywordClassifyDao pcloudKeywordClassifyDao; private PcloudKeywordClassifyDao pcloudKeywordClassifyDao;
@Autowired @Autowired
private PcloudRobotDao pcloudRobotDao; private PcloudRobotDao pcloudRobotDao;
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
/** /**
* 字符串切割长度 * 字符串切割长度
*/ */
...@@ -682,6 +684,21 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -682,6 +684,21 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
for (PcloudKeywordReply reply:replies){ for (PcloudKeywordReply reply:replies){
sendPcloudKeywordReply(reply, robotId, userWxId, ip, code); sendPcloudKeywordReply(reply, robotId, userWxId, ip, code);
} }
//有关联技能,发送H5页面链接,取第一个技能
if (!StringUtil.isEmpty(pcloudKeyword.getSkillIds())){
List<Long> skillIds = pcloudKeyword.getSkillList(pcloudKeyword.getSkillIds());
String h5link = wechatGroupLinkPrefix +"/dialog?wxId=" + userWxId +"&robotWxId=" + robotId +"&skillId="+skillIds.get(0);
String linkUrl = UrlUtils.getShortUrl4Own(h5link);
linkUrl = "★" + linkUrl + "★";
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(linkUrl);
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip);
sendTextMessageVO.setCode(code);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
}else { }else {
//走非关键词 //走非关键词
List<PcloudNotKeyword> notKeywords = pcloudNotKeywordDao.getPcloudNotKeywordList(pcloudClassifyId); List<PcloudNotKeyword> notKeywords = pcloudNotKeywordDao.getPcloudNotKeywordList(pcloudClassifyId);
......
...@@ -17,6 +17,8 @@ import com.pcloud.book.pcloudkeyword.entity.PcloudKeywordName; ...@@ -17,6 +17,8 @@ import com.pcloud.book.pcloudkeyword.entity.PcloudKeywordName;
import com.pcloud.book.pcloudkeyword.entity.PcloudKeywordReply; import com.pcloud.book.pcloudkeyword.entity.PcloudKeywordReply;
import com.pcloud.book.pcloudkeyword.entity.PcloudNotKeyword; import com.pcloud.book.pcloudkeyword.entity.PcloudNotKeyword;
import com.pcloud.book.pcloudkeyword.enums.RelevanceTypeEnum; import com.pcloud.book.pcloudkeyword.enums.RelevanceTypeEnum;
import com.pcloud.book.skill.biz.PcloudSkillBiz;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
...@@ -52,6 +54,8 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz { ...@@ -52,6 +54,8 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz {
private ResourceConsr resourceConsr; private ResourceConsr resourceConsr;
@Autowired @Autowired
private PcloudNotKeywordDao pcloudNotKeywordDao; private PcloudNotKeywordDao pcloudNotKeywordDao;
@Autowired
private PcloudSkillBiz pcloudSkillBiz;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog("新增平台端关键词") @ParamLog("新增平台端关键词")
...@@ -59,6 +63,8 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz { ...@@ -59,6 +63,8 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz {
public void createPcloudKeyword(PcloudKeyword pcloudKeyword) { public void createPcloudKeyword(PcloudKeyword pcloudKeyword) {
pcloudKeywordCheck.createPcloudKeywordCheck(pcloudKeyword); pcloudKeywordCheck.createPcloudKeywordCheck(pcloudKeyword);
//新增 //新增
String skills = pcloudKeyword.getSkills(pcloudKeyword.getSkillIdList());
pcloudKeyword.setSkillIds(skills);
pcloudKeywordDao.insert(pcloudKeyword); pcloudKeywordDao.insert(pcloudKeyword);
//新增名称和回复 //新增名称和回复
createNameAndReply(pcloudKeyword); createNameAndReply(pcloudKeyword);
...@@ -69,6 +75,8 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz { ...@@ -69,6 +75,8 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz {
@Override @Override
public void updatePcloudKeyword(PcloudKeyword pcloudKeyword) { public void updatePcloudKeyword(PcloudKeyword pcloudKeyword) {
pcloudKeywordCheck.updatePcloudKeywordCheck(pcloudKeyword); pcloudKeywordCheck.updatePcloudKeywordCheck(pcloudKeyword);
String skills = pcloudKeyword.getSkills(pcloudKeyword.getSkillIdList());
pcloudKeyword.setSkillIds(skills);
pcloudKeywordDao.update(pcloudKeyword); pcloudKeywordDao.update(pcloudKeyword);
//删除名称 //删除名称
pcloudKeywordNameDao.deleteByPcloudKeywordId(pcloudKeyword.getId()); pcloudKeywordNameDao.deleteByPcloudKeywordId(pcloudKeyword.getId());
...@@ -95,6 +103,17 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz { ...@@ -95,6 +103,17 @@ public class PcloudKeywordBizImpl implements PcloudKeywordBiz {
fillReply(replies); fillReply(replies);
} }
pcloudKeyword.setPcloudKeywordReplies(replies); pcloudKeyword.setPcloudKeywordReplies(replies);
//技能配置
List<Long> skills = pcloudKeyword.getSkillList(pcloudKeyword.getSkillIds());
pcloudKeyword.setSkillIdList(skills);
if (!ListUtils.isEmpty(skills)){
List<PcloudSkill> pcloudSkillList =new ArrayList<>();
for (Long skillId : skills){
PcloudSkill pcloudSkill = pcloudSkillBiz.getPcloudSkill(skillId);
pcloudSkillList.add(pcloudSkill);
}
pcloudKeyword.setPcloudSkillList(pcloudSkillList);
}
return pcloudKeyword; return pcloudKeyword;
} }
......
package com.pcloud.book.pcloudkeyword.entity; package com.pcloud.book.pcloudkeyword.entity;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.pcloud.common.utils.string.StringUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
@ApiModel("全平台关键词") @ApiModel("全平台关键词")
public class PcloudKeyword extends BaseEntity { public class PcloudKeyword extends BaseEntity {
...@@ -27,4 +31,37 @@ public class PcloudKeyword extends BaseEntity { ...@@ -27,4 +31,37 @@ public class PcloudKeyword extends BaseEntity {
@ApiModelProperty("名称列表") @ApiModelProperty("名称列表")
private List<PcloudKeywordName> pcloudKeywordNames; private List<PcloudKeywordName> pcloudKeywordNames;
@ApiModelProperty("技能id")
private String skillIds;
@ApiModelProperty("技能id列表")
private List<Long> skillIdList;
@ApiModelProperty("技能列表")
private List<PcloudSkill> pcloudSkillList;
public String getSkills(List<Long> skillList){
String skills="";
for (int i=0;i<skillList.size() ;i++){
if (i==0){
skills = skillList.get(i).toString();
} else if (i>0){
skills = skills+"-"+skillList.get(i).toString();
}
}
return skills;
}
public List<Long> getSkillList(String skillIds){
List<Long> list = new ArrayList<>();
if (StringUtil.isEmpty(skillIds)){
return list;
}
String[] strings = skillIds.split("-");
for (String str: strings){
Long id = Long.valueOf(str);
list.add(id);
}
return list;
}
} }
...@@ -19,4 +19,8 @@ public interface PcloudSkillBiz { ...@@ -19,4 +19,8 @@ public interface PcloudSkillBiz {
void updateSeqNum(PcloudSkill pcloudSkill); void updateSeqNum(PcloudSkill pcloudSkill);
void sendResource(Integer id, String wxUserId, String robotId, Integer relSkillId); void sendResource(Integer id, String wxUserId, String robotId, Integer relSkillId);
PageBeanNew<PcloudSkill> getPcloudSkillList4Select(Integer skillType, Integer currentPage, Integer numPerPage, String name);
PcloudSkill getPcloudSkillBaseInfoById(Long id);
} }
...@@ -43,7 +43,7 @@ import java.util.*; ...@@ -43,7 +43,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component("pcloudSkillBiz") @Component("pcloudSkillBiz")
public class PcloudSkillBizImpl implements PcloudSkillBiz { public class PcloudSkillBizImpl implements PcloudSkillBiz {
@Autowired @Autowired
private PcloudSkillDao pcloudSkillDao; private PcloudSkillDao pcloudSkillDao;
...@@ -285,6 +285,30 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz { ...@@ -285,6 +285,30 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
}); });
} }
@Override
public PageBeanNew<PcloudSkill> getPcloudSkillList4Select(Integer skillType, Integer currentPage, Integer numPerPage, String name) {
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
Map<String ,Object> map=new HashMap<>();
map.put("skillType",skillType);
map.put("name", name);
PageBeanNew<PcloudSkill> page = pcloudSkillDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPcloudSkillList4Select");
if (ListUtils.isEmpty(page.getRecordList())){
return page;
}
fillTitleAndDetailList(page.getRecordList());
return page;
}
@Override
public PcloudSkill getPcloudSkillBaseInfoById(Long id) {
return pcloudSkillDao.getById(id);
}
@ParamLog("填充订阅回复") @ParamLog("填充订阅回复")
private void fillRelies(List<PcloudSubReply> replies) { private void fillRelies(List<PcloudSubReply> replies) {
if (ListUtils.isEmpty(replies)){ if (ListUtils.isEmpty(replies)){
......
...@@ -64,6 +64,19 @@ public class PcloudSkillFacade { ...@@ -64,6 +64,19 @@ public class PcloudSkillFacade {
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList(skillType,currentPage,numPerPage)); return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList(skillType,currentPage,numPerPage));
} }
@ApiOperation("获取技能列表-关联关键词选择")
@GetMapping("/getPcloudSkillList4Select")
public ResponseDto<?> getPcloudSkillList4Select(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "skillType", required = false) @ApiParam("技能类型:1时间管理,2共读活动,3配套资料,4教辅书单,5配套老师,6音乐") Integer skillType,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage,
@RequestParam(value = "name", required = false) @ApiParam("名称搜索")String name
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList4Select(skillType,currentPage,numPerPage,name));
}
@ApiOperation("删除技能") @ApiOperation("删除技能")
@GetMapping("/deletePcloudSkill") @GetMapping("/deletePcloudSkill")
public ResponseDto<?> deletePcloudSkill( public ResponseDto<?> deletePcloudSkill(
...@@ -95,5 +108,13 @@ public class PcloudSkillFacade { ...@@ -95,5 +108,13 @@ public class PcloudSkillFacade {
pcloudSkillBiz.updateSeqNum(pcloudSkill); pcloudSkillBiz.updateSeqNum(pcloudSkill);
return new ResponseDto<>(); return new ResponseDto<>();
} }
@ApiOperation("获取技能基本信息")
@GetMapping("/getPcloudSkillBaseInfoById")
public ResponseDto<?> getPcloudSkillBaseInfoById(
@RequestParam("id") @ApiParam("技能id") Long id
) throws BizException, PermissionException {
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillBaseInfoById(id));
}
} }
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
<result column="type" property="type" jdbcType="INTEGER"/> <result column="type" property="type" jdbcType="INTEGER"/>
<result column="method" property="method" jdbcType="INTEGER"/> <result column="method" property="method" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="skill_ids" property="skillIds" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, keyword_classify_id, type,method, create_time id, keyword_classify_id, type,method, create_time, skill_ids
</sql> </sql>
<delete id="deleteById" parameterType="long"> <delete id="deleteById" parameterType="long">
...@@ -25,13 +26,15 @@ ...@@ -25,13 +26,15 @@
keyword_classify_id, keyword_classify_id,
type, type,
method, method,
create_time create_time,
skill_ids
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{keywordClassifyId,jdbcType=BIGINT}, #{keywordClassifyId,jdbcType=BIGINT},
#{type,jdbcType=INTEGER}, #{type,jdbcType=INTEGER},
#{method,jdbcType=INTEGER}, #{method,jdbcType=INTEGER},
NOW() NOW(),
#{skillIds}
</trim> </trim>
</insert> </insert>
...@@ -47,6 +50,7 @@ ...@@ -47,6 +50,7 @@
<if test="method != null"> <if test="method != null">
method = #{method,jdbcType=INTEGER}, method = #{method,jdbcType=INTEGER},
</if> </if>
skill_ids = #{skillIds},
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -59,7 +63,7 @@ ...@@ -59,7 +63,7 @@
<select id="getPcloudKeywordList" parameterType="map" resultMap="BaseResultMap"> <select id="getPcloudKeywordList" parameterType="map" resultMap="BaseResultMap">
select select
t1.id, t1.keyword_classify_id, t1.type,t1.method, t1.create_time t1.id, t1.keyword_classify_id, t1.type,t1.method, t1.create_time, t1.skill_ids
from pcloud_keyword t1 from pcloud_keyword t1
inner join pcloud_keyword_name t2 on t1.id=t2.pcloud_keyword_id inner join pcloud_keyword_name t2 on t1.id=t2.pcloud_keyword_id
where t1.keyword_classify_id = #{keywordClassifyId,jdbcType=BIGINT} where t1.keyword_classify_id = #{keywordClassifyId,jdbcType=BIGINT}
...@@ -86,7 +90,7 @@ ...@@ -86,7 +90,7 @@
</delete> </delete>
<select id="getByClassifyIdAndName" parameterType="map" resultMap="BaseResultMap"> <select id="getByClassifyIdAndName" parameterType="map" resultMap="BaseResultMap">
select t1.id, t1.keyword_classify_id, t1.type,t1.method, t1.create_time select t1.id, t1.keyword_classify_id, t1.type,t1.method, t1.create_time, t1.skill_ids
from pcloud_keyword t1 from pcloud_keyword t1
inner join pcloud_keyword_name t2 on t1.id=t2.pcloud_keyword_id inner join pcloud_keyword_name t2 on t1.id=t2.pcloud_keyword_id
where t1.keyword_classify_id=#{pcloudClassifyId} where t1.keyword_classify_id=#{pcloudClassifyId}
......
...@@ -191,4 +191,37 @@ ...@@ -191,4 +191,37 @@
from pcloud_skill where rel_skill_id = #{relSkillId} and skill_type = #{type} from pcloud_skill where rel_skill_id = #{relSkillId} and skill_type = #{type}
limit 1 limit 1
</select> </select>
<select id="getPcloudSkillList4Select" parameterType="map" resultMap="BaseResultMap">
SELECT
s.id,
s.skill_type,
s.rel_skill_id,
s.skill_fuse_reply,
s.seq_num
FROM
pcloud_skill s
LEFT JOIN time_control_task t ON s.rel_skill_id = t.task_id
AND s.skill_type = 1
LEFT JOIN pcloud_group_activity a ON s.rel_skill_id = a.id
AND s.skill_type = 2
LEFT JOIN pcloud_resource r ON s.rel_skill_id = r.id
AND s.skill_type = 3
WHERE 1=1
<if test="skillType != null">
and s.skill_type=#{skillType}
</if>
<if test="name !=null">
and (
<!-- t.task_name like concat('%', #{name}, '%') or-->
t.task_introduce like concat('%', #{name}, '%') or
<!-- a.`name` like concat('%', #{name}, '%') or-->
a.description like concat('%', #{name}, '%') or
<!-- r.`name` like concat('%', #{name}, '%') or-->
r.description like concat('%', #{name}, '%')
)
</if>
ORDER BY
s.seq_num
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment