Commit b695613e by 谢海旭

Merge remote-tracking branch 'origin/main'

2 parents 8f2ab43a d4b8758c
...@@ -21,6 +21,7 @@ import cn.com.glsx.dj.supervisor.utils.DateUtils; ...@@ -21,6 +21,7 @@ import cn.com.glsx.dj.supervisor.utils.DateUtils;
import cn.com.glsx.framework.core.beans.BaseModel; import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse; import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import com.alibaba.fastjson.JSON;
import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob; import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -92,6 +93,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -92,6 +93,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
dto.setDirectorUserId(supervisor.getUuid()); dto.setDirectorUserId(supervisor.getUuid());
dto.setDirectorTypes(Arrays.asList(DirectorTypeEnum.FLIGHT_SUPERVISION.getValue())); dto.setDirectorTypes(Arrays.asList(DirectorTypeEnum.FLIGHT_SUPERVISION.getValue()));
RpcResponse<List<ShopMerchantDirectorConfigDTO>> merchantResponse = shopMerchantDirectorConfigRemote.list(dto); RpcResponse<List<ShopMerchantDirectorConfigDTO>> merchantResponse = shopMerchantDirectorConfigRemote.list(dto);
log.info("请求参数:directorUserId:{},directorTypes:{},返回参数:{}", dto.getDirectorUserId(), dto.getDirectorTypes(), merchantResponse);
List<Integer> merchantIdList = new ArrayList<>(); List<Integer> merchantIdList = new ArrayList<>();
if (merchantResponse.isSuccess() && merchantResponse.getResult() != null) { if (merchantResponse.isSuccess() && merchantResponse.getResult() != null) {
List<ShopMerchantDirectorConfigDTO> merchantList = merchantResponse.getResult(); List<ShopMerchantDirectorConfigDTO> merchantList = merchantResponse.getResult();
...@@ -109,6 +111,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -109,6 +111,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
StaffBaseInfoDTO staffParam = new StaffBaseInfoDTO(); StaffBaseInfoDTO staffParam = new StaffBaseInfoDTO();
staffParam.setMerchantIdList(merchantIdList); staffParam.setMerchantIdList(merchantIdList);
RpcResponse<List<StaffBaseInfoDTO>> staffResponse = staffBaseInfoRemote.listShopStaffInfoGroupByUUid(staffParam); RpcResponse<List<StaffBaseInfoDTO>> staffResponse = staffBaseInfoRemote.listShopStaffInfoGroupByUUid(staffParam);
log.info("请求参数:merchantIdList:{},返回参数:{}", merchantIdList, staffResponse);
if (!staffResponse.isSuccess() || staffResponse.getResult() == null || staffResponse.getResult().isEmpty()) { if (!staffResponse.isSuccess() || staffResponse.getResult() == null || staffResponse.getResult().isEmpty()) {
log.info("督导 {} 无管理员工", supervisor.getStaffName()); log.info("督导 {} 无管理员工", supervisor.getStaffName());
continue; continue;
...@@ -217,6 +220,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -217,6 +220,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
query.setStartDate(date); query.setStartDate(date);
query.setEndDate(date); query.setEndDate(date);
query.setReceptionStatus(0); query.setReceptionStatus(0);
log.info("查询录音列表参数:{}", JSON.toJSONString(query));
return supervisorAudioReviewInfoService.listAudionByEmployeeInfo(query); return supervisorAudioReviewInfoService.listAudionByEmployeeInfo(query);
} }
......
package cn.com.glsx.dj.supervisor.service; package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.EmployeeRanking; import cn.com.glsx.dj.supervisor.dto.EmployeeRanking;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -19,6 +21,7 @@ import java.util.Map; ...@@ -19,6 +21,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Service @Service
@Slf4j
public class AiAnalysisService { public class AiAnalysisService {
private static final String DIFY_API_URL = "https://aiassistant.glsx.com.cn/v1/workflows/run"; private static final String DIFY_API_URL = "https://aiassistant.glsx.com.cn/v1/workflows/run";
...@@ -85,9 +88,14 @@ public class AiAnalysisService { ...@@ -85,9 +88,14 @@ public class AiAnalysisService {
employeeData.put("employee", employees); employeeData.put("employee", employees);
employeeData.put("summary", summary); employeeData.put("summary", summary);
log.info("业绩ai分析请求参数{}", JSONObject.toJSONString(employeeData));
// 调用 Dify API // 调用 Dify API
String result = callDifyApi(employeeData, PERFORMANCE_API_KEY); String result = callDifyApi(employeeData, PERFORMANCE_API_KEY);
log.info("业绩ai分析返回参数{}", result);
// 存入缓存 // 存入缓存
try { try {
redisTemplate.opsForValue().set(cacheKey, result, CACHE_EXPIRE_TIME, TimeUnit.HOURS); redisTemplate.opsForValue().set(cacheKey, result, CACHE_EXPIRE_TIME, TimeUnit.HOURS);
...@@ -163,8 +171,10 @@ public class AiAnalysisService { ...@@ -163,8 +171,10 @@ public class AiAnalysisService {
employeeData.put("employee", employees); employeeData.put("employee", employees);
employeeData.put("summary", summary); employeeData.put("summary", summary);
log.info("行为ai分析请求参数{}", JSONObject.toJSONString(employeeData));
// 调用 Dify API // 调用 Dify API
String result = callDifyApi(employeeData, BEHAVIOR_API_KEY); String result = callDifyApi(employeeData, BEHAVIOR_API_KEY);
log.info("行为ai分析返回参数{}", result);
// 存入缓存 // 存入缓存
try { try {
......
...@@ -612,7 +612,7 @@ public class SupervisorDashboardService { ...@@ -612,7 +612,7 @@ public class SupervisorDashboardService {
.filter(conversion -> conversion != null) .filter(conversion -> conversion != null)
.count(); .count();
if (conversionCount > 0) { if (conversionCount > 0) {
m.setAvgConversion(totalConversion.divide(new BigDecimal(conversionCount), 4, BigDecimal.ROUND_HALF_UP)); m.setAvgConversion(totalConversion.divide(new BigDecimal(conversionCount), 2, BigDecimal.ROUND_HALF_UP));
} else { } else {
m.setAvgConversion(BigDecimal.ZERO); m.setAvgConversion(BigDecimal.ZERO);
} }
...@@ -1688,7 +1688,7 @@ public class SupervisorDashboardService { ...@@ -1688,7 +1688,7 @@ public class SupervisorDashboardService {
private Integer matchWarningLevelByIndicator(BigDecimal value, private Integer matchWarningLevelByIndicator(BigDecimal value,
List<SupervisorWarningBaselineConfig> configs) { List<SupervisorWarningBaselineConfig> configs) {
if (value == null || configs == null || configs.isEmpty()) { if (value == null || configs == null || configs.isEmpty()) {
return 2; // 默认绿色 return 0; // 默认绿色
} }
for (SupervisorWarningBaselineConfig config : configs) { for (SupervisorWarningBaselineConfig config : configs) {
...@@ -1697,7 +1697,7 @@ public class SupervisorDashboardService { ...@@ -1697,7 +1697,7 @@ public class SupervisorDashboardService {
} }
} }
return 2; // 默认绿色 return 0; // 默认绿色
} }
/** /**
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
AND gi.deleted_flag = 'N' AND gi.deleted_flag = 'N' and si.deleted_flag ='N'
<if test="bizs != null"> <if test="bizs != null">
AND ( AND (
(#{bizs} = 1 AND gi.scene_type = 0 AND gi.business_type = 2) (#{bizs} = 1 AND gi.scene_type = 0 AND gi.business_type = 2)
......
...@@ -35,7 +35,7 @@ public class SupervisorDashboardRemoteImplTest extends BaseServiceTest { ...@@ -35,7 +35,7 @@ public class SupervisorDashboardRemoteImplTest extends BaseServiceTest {
DashboardQueryReq req = new DashboardQueryReq(); DashboardQueryReq req = new DashboardQueryReq();
req.setSupervisorId("63c121922cba4956b2aac3f21dacd92f"); req.setSupervisorId("63c121922cba4956b2aac3f21dacd92f");
req.setStartDate("2026-03-01"); req.setStartDate("2026-03-01");
req.setEndDate("2026-03-20"); req.setEndDate("2026-03-21");
req.setDateType(0); req.setDateType(0);
req.setNeedAiAnalysis(true); req.setNeedAiAnalysis(true);
req.setSortField(1); req.setSortField(1);
......
  • @wangxw1
    commented
    Master

    你好!我是资深的 Java 开发工程师。针对你提供的 MyBatis XML 变更代码及提交记录,我进行了详细的审查。

    以下是审查结果:

    一、关键问题与优化建议(仅限 Top 3)

    1. SQL 完整性与执行风险 (功能正确性 - 高危)

      • 问题描述:代码将字段来源从 t2/t1 修改为了 t (t.bc_course_id, t.bc_course_name)。但在提供的 Diff 片段中,无法确认 SQL 的 FROM 或 JOIN 子句中是否确实定义了表别名 t。
      • 风险:如果 FROM 子句中没有对应的 AS t 定义,该 SQL 将直接抛出 SQLSyntaxErrorException,导致线上功能不可用。此外,t1 和 t2 看起来像是原来的主表或关联表,贸然修改字段来源可能导致与 WHERE 条件或其他逻辑不匹配。
      • 建议:请务必检查并确认 SQL 下方的 FROM/JOIN 部分已正确包含表别名 t 的定义。
    2. 数据一致性与冗余字段使用 (功能正确性/设计)

      • 问题描述:将课程名称的获取源从 t1.title(推测为课程主表)修改为 t.bc_course_name(推测为推荐记录表或中间表)。
      • 风险:这通常涉及“数据快照”与“最新数据”的选择问题。如果课程在主表中改名了,而中间表 t 中的 bc_course_name 没有同步更新,用户看到的将是脏数据(旧名称)。通常建议直接关联课程主表获取名称,除非有明确业务需求要展示“推荐生成时的快照名称”。
      • 建议:确认业务需求。如果需要展示最新课程名,应继续使用 t1.title;如果确需使用中间表字段,需确保上游写入逻辑中有数据同步机制。
    3. 提交信息(Commit Message)严重缺失上下文 (可维护性)

      • 问题描述:提交信息仅为 "v5.7.0版本 飞行督导" 和 "Merge...",完全没有说明本次修改的具体原因。
      • 风险:Code Reviewer 和后续维护者无法理解为什么要从 t2 切换到 t。是修复 Bug?还是表结构变更?缺乏 Context 会极大增加排查问题的难度。
      • 建议:遵循 Git 提交规范(如 Angular 规范)。建议修改为:fix(rpc-dj): 修复推荐列表课程名称取值错误,改为读取 bc_course_name 以匹配...。

    二、评分明细

    维度 评分 扣分/得分理由
    1. 功能正确性 30/40 -10分:修改了字段的数据来源表别名(从t1/t2改为t),存在极高的数据不一致风险或SQL语法错误风险(取决于隐藏的JOIN逻辑),且未见相关逻辑说明。
    2. 安全性 30/30 0分:未见明显的 SQL 注入风险(假设 MyBatis 框架配置正常)。
    3. 可维护性 15/20 -5分:SQL 中使用了 t, t1, t2 这种无意义的别名,违反《阿里巴巴Java开发手册》关于SQL语句中表别名应见名知义的建议(如使用 course, rec 等)。
    4. 性能 5/5 0分:字段选择的变更对性能影响微乎其微。
    5. 提交信息 0/5 -5分:提交信息完全未描述代码变更的内容和意图,属于无效日志。

    总分:80分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!