Commit 311eb75a by 阮思源

如果数据库微信群名称超过16,就截断,然后重新设置数据库的名称,因为wxgroup那边设置的时候截断了

parent 1d2176ac
...@@ -144,4 +144,10 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> { ...@@ -144,4 +144,10 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
* @return * @return
*/ */
List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds); List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds);
/**
* 修改群名称
* @param id
* @param groupName
*/
void updateGroupName(Long id, String groupName);
} }
...@@ -129,4 +129,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou ...@@ -129,4 +129,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
public List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds) { public List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds) {
return this.getSqlSession().selectList(this.getStatement("getWeixinGroupIdsByClassifyIdList"), classifyIds); return this.getSqlSession().selectList(this.getStatement("getWeixinGroupIdsByClassifyIdList"), classifyIds);
} }
@Override
public void updateGroupName(Long id, String groupName) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("id", id);
paramMap.put("groupName", groupName);
this.getSqlSession().update(this.getStatement("updateGroupName"), paramMap);
}
} }
...@@ -41,9 +41,15 @@ public class UpdateWXGroupNameListener { ...@@ -41,9 +41,15 @@ public class UpdateWXGroupNameListener {
LOGGER.info("没有找到该群" + wechatGroupId); LOGGER.info("没有找到该群" + wechatGroupId);
return; return;
} }
if (!groupNameDTO.getNewGroupName().equals(groupQrcode.getGroupName())) { String groupName = groupQrcode.getGroupName();
// 如果数据库微信群名称超过16,就截断,然后重新设置数据库的名称,因为wxgroup那边设置的时候截断了
if (groupName.length() > 16) {
groupName = groupName.substring(0, 16);
groupQrcodeDao.updateGroupName(groupQrcode.getId(), groupName);
}
if (!groupNameDTO.getNewGroupName().equals(groupName)) {
ChangeNameVO changeNameVO = new ChangeNameVO(); ChangeNameVO changeNameVO = new ChangeNameVO();
changeNameVO.setName(groupQrcode.getGroupName()); changeNameVO.setName(groupName);
changeNameVO.setWxGroupId(wechatGroupId); changeNameVO.setWxGroupId(wechatGroupId);
String altId = wechatGroupConsr.getRobotIdByGroupId(wechatGroupId); String altId = wechatGroupConsr.getRobotIdByGroupId(wechatGroupId);
changeNameVO.setAltId(altId); changeNameVO.setAltId(altId);
......
...@@ -298,4 +298,13 @@ ...@@ -298,4 +298,13 @@
${item} ${item}
</foreach> </foreach>
</select> </select>
<!--修改群名称-->
<update id="updateGroupName" parameterType="map">
update book_group_qrcode
<set>
group_name = #{groupName},
update_time = now()
</set>
WHERE id = #{id}
</update>
</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