提交 f2209357 作者: 洪东保

debug: authedList接口模糊查询

会议类型正则匹配
父级 53c8bb27
......@@ -48,28 +48,31 @@ public class AgentAuthController {
if (CollUtil.isNotEmpty(deptIdList)) {
List<SysUserSyncCategory> deptList = iSysUserSyncCategoryService.list(new LambdaQueryWrapper<SysUserSyncCategory>()
.in(SysUserSyncCategory::getDeptId, deptIdList)
.like(StrUtil.isNotBlank(vo.getSearch()), SysUserSyncCategory::getName, vo.getSearch())
);
deptMap = deptList.stream().collect(Collectors.toMap(SysUserSyncCategory::getDeptId, SysUserSyncCategory::getName));
}
List<String> userIdList = records.stream().filter(e -> e.getType() == 1).map(CoreModulePermissions::getRelId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(userIdList)) {
List<SysUserSync> userList = sysUserSyncService.listByUserIds(userIdList);
List<SysUserSync> userList = sysUserSyncService.listByUserIds(userIdList, vo.getSearch());
userMap = userList.stream().collect(Collectors.toMap(SysUserSync::getUserId, e -> e));
}
for (CoreModulePermissions record : records) {
JSONObject object = JSONUtil.parseObj(record);
if (record.getType() == 0) {
JSONObject object = JSONUtil.parseObj(record);
if (deptMap.containsKey(record.getRelId())) {
object.putOpt("name", deptMap.get(record.getRelId()));
object.putOpt("deptName", deptMap.get(record.getRelId()));
ret.add(object);
}
} else if (record.getType() == 1) {
if (userMap.containsKey(record.getRelId())) {
JSONObject object = JSONUtil.parseObj(record);
object.putOpt("name", userMap.get(record.getRelId()).getName());
object.putOpt("deptName", userMap.get(record.getRelId()).getDepartment());
ret.add(object);
}
}
ret.add(object);
}
return R.ok(ret);
}
......
......@@ -28,6 +28,8 @@ public class MeetTypeDto {
private Long relId;
// 类型描述的内容
private String content;
// 匹配类型的正则
private String regex;
// 创建者
private String createUser;
// 创建时间
......
......@@ -10,6 +10,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
......@@ -59,6 +60,7 @@ import java.text.MessageFormat;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Data
......@@ -282,14 +284,14 @@ public class FileProcessTask {
if (finalRetry) {
meetingInfoMapper.update(null,
new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingId,meetingId)
.eq(subMeetingId != null,MeetingInfo::getSubMeetingId,subMeetingId)
.set(MeetingInfo::getGenerateRetry,Boolean.TRUE));
.eq(MeetingInfo::getMeetingId, meetingId)
.eq(subMeetingId != null, MeetingInfo::getSubMeetingId, subMeetingId)
.set(MeetingInfo::getGenerateRetry, Boolean.TRUE));
} else {
meetingInfoMapper.update(null,
new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingId,meetingId)
.eq(subMeetingId != null,MeetingInfo::getSubMeetingId,subMeetingId)
.eq(MeetingInfo::getMeetingId, meetingId)
.eq(subMeetingId != null, MeetingInfo::getSubMeetingId, subMeetingId)
.set(MeetingInfo::getStatus, status != null ? status : MeetingState.GENERATE_ERROR.getCode())
);
}
......@@ -368,7 +370,8 @@ public class FileProcessTask {
if (CollUtil.isNotEmpty(meetTypeList)) {
type = meetTypeList.get(0).getId();
for (MeetType meetType : meetTypeList) {
if (subject.contains(meetType.getName())) {
if ((StrUtil.isNotBlank(meetType.getRegex()) && checkRegex(meetType.getRegex(), subject))
|| subject.contains(meetType.getName())) {
type = meetType.getId();
break;
}
......@@ -377,6 +380,11 @@ public class FileProcessTask {
return type;
}
private boolean checkRegex(String regex, String subject) {
Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
return pattern.matcher(subject).find();
}
/**
* 大模型生成纪要xml
*
......@@ -433,7 +441,7 @@ public class FileProcessTask {
// 生成的xml临时存储路径
String recordXmlPath = String.format("%s/%s", today, meetingId + "-recordXmlPath-" + uuid + ".xml");
// 腾讯会议转录文件存储路径
String recordContentPath = String.format("%s/%s", today, meetingId + "-recordContent-" + uuid + ".txt") ;
String recordContentPath = String.format("%s/%s", today, meetingId + "-recordContent-" + uuid + ".txt");
//填充后的会议纪要名称
String meetingMinutesFileName;
//填充后的会议纪要word文件临时路径
......@@ -475,7 +483,7 @@ public class FileProcessTask {
//去除内容中除了xml内容以外其他的信息,格式化xml
String xml = extractXmlFromMarkdown(content);
String encryptedXml = AESUtils.encrypt(xml, aesKey);
minioUtils.upload(recordXmlPath,encryptedXml.getBytes(StandardCharsets.UTF_8));
minioUtils.upload(recordXmlPath, encryptedXml.getBytes(StandardCharsets.UTF_8));
//将xml格式的内容转换为map,用于填充模板
Map<String, Object> dataModel = convertXmlToMap(xml);
......@@ -512,7 +520,7 @@ public class FileProcessTask {
}
meetingMinutesPath = savePath + IdUtil.getSnowflake(1L, 1L).nextId() + ".docx";
template.writeAndClose(new FileOutputStream(meetingMinutesPath));
processLogService.log(meetingId,subMeetingId,"填充会议纪要成功");
processLogService.log(meetingId, subMeetingId, "填充会议纪要成功");
success = true;
} catch (Exception e) {
success = false;
......@@ -525,15 +533,15 @@ public class FileProcessTask {
} finally {
meetingInfoMapper.update(meetingInfo,
new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingId,meetingId)
.eq(subMeetingId != null,MeetingInfo::getSubMeetingId,subMeetingId)
.set(MeetingInfo::getRecordContent,recordContentPath)
.set(MeetingInfo::getRecordXml,recordXmlPath)
.set(MeetingInfo::getParticipantUsers,meetingInfo.getParticipantUsers())
.eq(MeetingInfo::getMeetingId, meetingId)
.eq(subMeetingId != null, MeetingInfo::getSubMeetingId, subMeetingId)
.set(MeetingInfo::getRecordContent, recordContentPath)
.set(MeetingInfo::getRecordXml, recordXmlPath)
.set(MeetingInfo::getParticipantUsers, meetingInfo.getParticipantUsers())
.set(MeetingInfo::getIsGenerated, success)
.set(MeetingInfo::getTemplateId,meetingRecordTemplate.getId())
.set(MeetingInfo::getTransDocId,meetingInfo.getTransDocId())
.set(MeetingInfo::getSubject,meetingInfo.getSubject())
.set(MeetingInfo::getTemplateId, meetingRecordTemplate.getId())
.set(MeetingInfo::getTransDocId, meetingInfo.getTransDocId())
.set(MeetingInfo::getSubject, meetingInfo.getSubject())
.set(MeetingInfo::getStatus, success ? MeetingState.NOTE_GENERATED.getCode() : MeetingState.GENERATE_ERROR.getCode())
);
}
......@@ -562,7 +570,7 @@ public class FileProcessTask {
meetingInfoMapper.update(null,
new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingId, meetingId)
.eq(subMeetingId != null,MeetingInfo::getSubMeetingId,subMeetingId)
.eq(subMeetingId != null, MeetingInfo::getSubMeetingId, subMeetingId)
.set(MeetingInfo::getIsPushed, isPushed)
.set(MeetingInfo::getStatus, isPushed ? MeetingState.PUSH_SUCCESS.getCode() : MeetingState.PUSH_ERROR.getCode())
);
......@@ -681,7 +689,7 @@ public class FileProcessTask {
this.aesKey = aesKey;
}
public String getId(){
public String getId() {
return this.meetingId + (this.subMeetingId == null ? "" : this.subMeetingId);
}
}
\ No newline at end of file
......@@ -53,5 +53,5 @@ public interface SysUserSyncMapper extends BaseMapper<SysUserSync> {
@Param("userIdList") List<String> userIdList);
List<SysUserSync> listByUserIds(@Param("ids") List<String> userIdList);
List<SysUserSync> listByUserIds(@Param("ids") List<String> userIdList, @Param("search") String search);
}
......@@ -48,6 +48,7 @@ public class MeetType {
* 类型描述(用于让大模型筛选会议类型的提示词)
*/
private String content;
private String regex;
/**
* 创建时间
......
......@@ -43,5 +43,5 @@ public interface SysUserSyncService extends IService<SysUserSync> {
Page<SysUserSyncDTO> selectPage(Integer current, Integer size, String categoryId, String search);
List<SysUserSync> listByUserIds(List<String> userIdList);
List<SysUserSync> listByUserIds(List<String> userIdList, String search);
}
......@@ -84,6 +84,7 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType>
meetType.setAuthType(meetingTypeVo.getAuthType());
meetType.setRelId(meetingTypeVo.getRelId());
meetType.setContent(meetingTypeVo.getContent());
meetType.setRegex(meetingTypeVo.getRegex());
meetType.setCreateTime(now);
meetType.setUpdateTime(now);
meetType.setCreateUser(String.format("%08d", loginUser.getUserId()));
......@@ -124,6 +125,7 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType>
meetType.setAuthType(meetingTypeVo.getAuthType());
meetType.setRelId(meetingTypeVo.getRelId());
meetType.setContent(meetingTypeVo.getContent());
meetType.setRegex(meetingTypeVo.getRegex());
meetType.setUpdateTime(now);
meetType.setUpdateUser(String.format("%08d", loginUser.getUserId()));
meetType.setUpdateUserName(loginUser.getUsername());
......
......@@ -247,8 +247,8 @@ public class SysUserSyncServiceImpl extends ServiceImpl<SysUserSyncMapper, SysUs
}
@Override
public List<SysUserSync> listByUserIds(List<String> userIdList) {
return baseMapper.listByUserIds(userIdList);
public List<SysUserSync> listByUserIds(List<String> userIdList, String search) {
return baseMapper.listByUserIds(userIdList, search);
}
private List<String> getChildren(Map<String, List<String>> collect, String deptId) {
......
......@@ -22,6 +22,10 @@ public class MeetingTypeVo {
// 类型名称
@NotEmpty(message = "name不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String name;
/**
* 正则匹配类型
*/
private String regex;
// 允许用户在此类型下自定义创建模板,0-不允许,1-允许(默认)
@Range(min = 0, max = 1, message = "personalPermission只能为0或1", groups = {AddGroup.class, UpdateGroup.class})
......
......@@ -255,6 +255,7 @@
<result property="authType" column="auth_type"/>
<result property="relId" column="rel_type_id"/>
<result property="content" column="type_content"/>
<result property="regex" column="regex"/>
<result property="createTime" column="type_create_time"/>
<result property="createUser" column="type_create_user"/>
<collection property="recordTemplateDTOList" ofType="com.cmeeting.dto.RecordTemplateDto" resultMap="recordTemplateMap"
......@@ -264,7 +265,7 @@
<select id="selectTemplate" resultMap="meetTypeWithRecordsMap">
select t1.id as type_id, t1.name as type_name, t1.personal_permission, t1.auth_type, t1.rel_id as rel_type_id,
t1.content as type_content,
t1.content as type_content, t1.regex,
t1.create_time as type_create_time, t1.create_user as type_create_user,
t2.id as temp_id, t2.name as template_name, t2.type, t2.type_detail, t2.prompt, t2.refer_template_id, t2.enable,
t2.create_user as template_create_user, t2.create_time as template_create_time
......@@ -282,6 +283,7 @@
t1.content as type_content,
t1.create_time as type_create_time,
t1.create_user as type_create_user,
t1.regex,
t2.id as temp_id,
t2.name as template_name,
t2.type,
......
......@@ -166,6 +166,9 @@
<foreach collection="ids" separator="," item="id" close=")" open="(">
#{id}
</foreach>
<if test="search != null and search != ''">
and t1.name like concat('%',#{search},'%');
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论