fix: 修复社交登录回调解析问题及优化

- 修复 SocialClientServiceImpl 中社交登录回调的 userId 解析逻辑
- 新增 EvaluationTemplateFlattenedRespVO 扁平化响应VO
- 优化 EvaluationTemplateWithDimensionsRespVO 结构
- 更新 pom.xml 依赖版本
This commit is contained in:
tangweijie 2026-01-22 21:09:40 +08:00
parent 1eb543d803
commit f252c69dd2
6 changed files with 143 additions and 12 deletions

View File

@ -2,10 +2,11 @@ package cn.iocoder.yudao.framework.quartz.core.scheduler;
import cn.iocoder.yudao.framework.quartz.core.enums.JobDataKeyEnum;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import org.quartz.*;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/**
* {@link org.quartz.Scheduler} 的管理器负责创建任务
@ -142,7 +143,7 @@ public class SchedulerManager {
private void validateScheduler() {
if (scheduler == null) {
throw exception0(NOT_IMPLEMENTED.getCode(),
throw new ServiceException(NOT_IMPLEMENTED.getCode(),
"[定时任务 - 已禁用][参考 https://doc.iocoder.cn/job/ 开启]");
}
}

View File

@ -11,7 +11,8 @@ import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.io.IOException;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
@ -150,8 +151,36 @@ public class EvaluationReportController {
public void exportTemplateWithDimensions(@NotNull(message = "编号不能为空") @RequestParam("id") Long id,
HttpServletResponse response) throws IOException {
EvaluationTemplateWithDimensionsRespVO templateWithDimensions = evaluationReportService.getTemplateWithDimensions(id);
ExcelUtils.write(response, "评估模板详情.xlsx", "模板详情", EvaluationTemplateWithDimensionsRespVO.class,
Collections.singletonList(templateWithDimensions));
// 扁平化导出每个维度一行模板信息重复显示
List<EvaluationTemplateFlattenedRespVO> flattenedData = new ArrayList<>();
if (templateWithDimensions.getDimensions() != null) {
for (EvaluationDimensionRespVO dimension : templateWithDimensions.getDimensions()) {
EvaluationTemplateFlattenedRespVO vo = new EvaluationTemplateFlattenedRespVO();
vo.setTemplateId(templateWithDimensions.getId());
vo.setTemplateName(templateWithDimensions.getName());
vo.setTemplateCode(templateWithDimensions.getCode());
vo.setType(templateWithDimensions.getType());
vo.setDescription(templateWithDimensions.getDescription());
vo.setApplicableCrowd(templateWithDimensions.getApplicableCrowd());
vo.setEvaluationCycle(templateWithDimensions.getEvaluationCycle());
vo.setStatus(templateWithDimensions.getStatus());
vo.setAiEnabled(templateWithDimensions.getAiEnabled());
vo.setDimensionId(dimension.getId());
vo.setDimensionName(dimension.getName());
vo.setDimensionCode(dimension.getCode());
vo.setDimensionType(dimension.getDimensionType());
vo.setWeight(dimension.getWeight());
vo.setScoreRule(dimension.getScoreRule());
vo.setMaxScore(dimension.getMaxScore());
vo.setMinScore(dimension.getMinScore());
vo.setPassScore(dimension.getPassScore());
vo.setEvaluationMethod(dimension.getEvaluationMethod());
vo.setDimensionAiEnabled(dimension.getAiEnabled());
vo.setSort(dimension.getSort());
flattenedData.add(vo);
}
}
ExcelUtils.write(response, "评估模板详情.xlsx", "模板详情", EvaluationTemplateFlattenedRespVO.class, flattenedData);
}
// ========== 维度配置管理 ==========

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import cn.idev.excel.annotation.ExcelProperty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 评估模板详情导出 VO扁平化")
@Data
public class EvaluationTemplateFlattenedRespVO {
@Schema(description = "模板ID")
@ExcelProperty("模板ID")
private Long templateId;
@Schema(description = "模板名称")
@ExcelProperty("模板名称")
private String templateName;
@Schema(description = "模板编码")
@ExcelProperty("模板编码")
private String templateCode;
@Schema(description = "模板类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估")
@ExcelProperty("模板类型")
private Integer type;
@Schema(description = "描述")
@ExcelProperty("描述")
private String description;
@Schema(description = "适用人群")
@ExcelProperty("适用人群")
private String applicableCrowd;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估")
@ExcelProperty("评估周期")
private Integer evaluationCycle;
@Schema(description = "状态1-启用 2-禁用")
@ExcelProperty("状态")
private Integer status;
@Schema(description = "是否允许AI生成1-是 2-否")
@ExcelProperty("允许AI生成")
private Integer aiEnabled;
@Schema(description = "维度ID")
@ExcelProperty("维度ID")
private Long dimensionId;
@Schema(description = "维度名称")
@ExcelProperty("维度名称")
private String dimensionName;
@Schema(description = "维度编码")
@ExcelProperty("维度编码")
private String dimensionCode;
@Schema(description = "维度类型1-心理测评 2-行为表现 3-教育改造 4-劳动表现 5-人际交往 6-自评/他评")
@ExcelProperty("维度类型")
private Integer dimensionType;
@Schema(description = "权重(百分比)")
@ExcelProperty("权重")
private BigDecimal weight;
@Schema(description = "评分规则1-分值越高越好 2-分值越低越好 3-区间评分")
@ExcelProperty("评分规则")
private Integer scoreRule;
@Schema(description = "最大分值")
@ExcelProperty("最大分值")
private BigDecimal maxScore;
@Schema(description = "最小分值")
@ExcelProperty("最小分值")
private BigDecimal minScore;
@Schema(description = "及格分值")
@ExcelProperty("及格分值")
private BigDecimal passScore;
@Schema(description = "评估方式1-问卷测评 2-量表评分 3-行为观察 4-AI分析 5-综合评定")
@ExcelProperty("评估方式")
private Integer evaluationMethod;
@Schema(description = "是否启用AI0-否 1-是")
@ExcelProperty("维度启用AI")
private Integer dimensionAiEnabled;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
}

View File

@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import cn.idev.excel.annotation.*;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import java.util.List;
@Schema(description = "管理后台 - 评估模板详情导出 VO")
@ -66,7 +68,7 @@ public class EvaluationTemplateWithDimensionsRespVO {
@ExcelProperty("创建时间")
private String createTime;
@Schema(description = "维度列表")
@ExcelProperty("维度列表")
@Schema(description = "维度列表")
@ExcelIgnore
private List<EvaluationDimensionRespVO> dimensions;
}

View File

@ -95,14 +95,16 @@
<artifactId>justauth-spring-boot-starter</artifactId>
</dependency>
<!-- 注释掉微信登录依赖(监狱系统不需要)
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-mp-spring-boot-starter</artifactId> <!-- 微信登录(公众号) -->
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java-miniapp-spring-boot-starter</artifactId> <!-- 微信登录(小程序) -->
<artifactId>wx-java-miniapp-spring-boot-starter</artifactId>
</dependency>
-->
<dependency>
<groupId>com.anji-plus</groupId>

View File

@ -106,9 +106,9 @@ public class SocialClientServiceImpl implements SocialClientService {
@Autowired(required = false) // 由于 justauth.enable 配置项可以关闭 AuthRequestFactory 的功能所以这里只能不强制注入
private AuthRequestFactory authRequestFactory;
@Resource
@Autowired(required = false) // 微信功能可能不需要设置为非强制注入
private WxMpService wxMpService;
@Resource
@Autowired(required = false)
private WxMpProperties wxMpProperties;
@Resource
private StringRedisTemplate stringRedisTemplate; // WxMpService 需要使用到所以在 Service 注入了它