Commit 7662d10f by 阮思源

Merge branch 'zyj-0205' into 'master'

正向模糊匹配

See merge request rays/pcloud-book!361
parents 2af6d539 b8f268e0
......@@ -625,9 +625,11 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if (bookGroupCipherUser == null || StringUtil.isEmpty(bookGroupCipherUser.getShortBookName())) {
return;
}
SelfRobotKeyword selfRobotKeyword = selfRobotKeywordDao.getByBookGroupIdAndKeyword(bookGroupCipherUser.getBookGroupId(), content);
if (selfRobotKeyword != null) {
sendSelfKeyword(selfRobotKeyword, sendTextDTO);
List<SelfRobotKeyword> keywordList = selfRobotKeywordDao.getListByBookGroupIdAndKeyword(bookGroupCipherUser.getBookGroupId(), content);
if (!ListUtils.isEmpty(keywordList)) {
for (SelfRobotKeyword selfRobotKeyword : keywordList){
sendSelfKeyword(selfRobotKeyword, sendTextDTO);
}
//临时,后面要删
String robotId = sendTextDTO.getWxId();
if ("一对一".equals(content)){
......
......@@ -33,4 +33,12 @@ public interface SelfRobotKeywordDao extends BaseDao<SelfRobotKeyword> {
SelfRobotKeyword getNextKeyWord(Long bookGroupId, String keyword);
List<SelfRobotKeyword> getListByBookGroupIds(List<Long> bookGroupIds);
/**
* 模糊匹配
* @param bookGroupId
* @param content
* @return
*/
List<SelfRobotKeyword> getListByBookGroupIdAndKeyword(Long bookGroupId, String content);
}
......@@ -92,4 +92,12 @@ public class SelfRobotKeywordDaoImpl extends BaseDaoImpl<SelfRobotKeyword> imple
map.put("bookGroupIds", bookGroupIds);
return this.getSqlSession().selectList(this.getStatement("getListByBookGroupIds"), map);
}
@Override
public List<SelfRobotKeyword> getListByBookGroupIdAndKeyword(Long bookGroupId, String keyword) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("keyword", keyword);
return getSessionTemplate().selectList(getStatement("getListByBookGroupIdAndKeyword"), map);
}
}
......@@ -474,7 +474,7 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
if (ListUtils.isEmpty(robotIdList) || robotIdList.size()<3){
log.info("小号数量小于3个,取其他号补充");
Integer need = 3 - robotIdList.size();//所需数量
if ("pro".equalsIgnoreCase(envStr)){
/*if ("pro".equalsIgnoreCase(envStr)){
List<String> altIds = wechatGroupConsr.getSelfRobotByRobotType(null);
altIds.removeAll(robotIdList);
if (need == 1) {
......@@ -483,7 +483,7 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
robotIdList.add(altIds.get(0));
robotIdList.add(altIds.get(1));
}
}else {
}else {*/
String alt1="wxid_lw4vjnxjg45d22";//zyj
String alt2="p867263500";//dawei
if (need == 1){
......@@ -492,7 +492,7 @@ public class ReadingActivityBizImpl implements ReadingActivityBiz{
robotIdList.add(alt1);
robotIdList.add(alt2);
}
}
// }
}
Integer groupCount = (userList.size()+robotIdList.size())/500 + 1;//每个群最多人数
for (int i=1; i<=groupCount; i++){
......
......@@ -114,10 +114,17 @@
select <include refid="Base_Column_List"/>
from self_robot_keyword
where book_group_id=#{bookGroupId}
and keyword=#{keyword}
and keyword = #{keyword}
limit 1
</select>
<select id="getListByBookGroupIdAndKeyword" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword
where book_group_id=#{bookGroupId}
and keyword like concat('%', #{keyword}, '%')
</select>
<!--根据社群码id获取数量-->
<select id="getCountByBookGroupId" parameterType="map" resultType="integer">
select count(1)
......
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