Commit 8f140342 by 黄炜

feat: 事项优化

1 parent 8b16ba27
......@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
......@@ -16,8 +18,12 @@ public class SupervisorCoachCourseDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "课程ID")
@NotBlank(message = "课程ID不能为空")
@Size(max = 64, message = "课程ID不能超过64字符")
private String courseId;
@ApiModelProperty(notes = "课程名称")
@NotBlank(message = "课程名称不能为空")
@Size(max = 255, message = "课程名称不能超过255字符")
private String courseName;
}
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
......@@ -66,9 +67,7 @@ public class SupervisorCoachTaskSubmitDTO implements Serializable {
@NotEmpty(message = "请上传带教照片佐证")
private List<String> assigneeImages;
@Size(max = 64, message = "推送课程ID不能超过64字符")
private String pushCoursesId;
@Size(max = 255, message = "推送课程名称不能超过255字符")
private String pushCoursesName;
@Valid
@Size(max = 50, message = "推送课程不能超过50个")
private List<SupervisorCoachCourseDTO> courseList;
}
package cn.com.glsx.dj.staff.dto.taskcenter;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
......@@ -54,6 +55,18 @@ public class TaskInfoDTO implements Serializable {
@ApiModelProperty(notes = "归属业务名称(多个用/隔开)")
private String businessTypeName;
@ApiModelProperty(notes = "带教方式编码,仅督导带教事项返回")
private String teachingMethodCode;
@ApiModelProperty(notes = "带教方式名称,仅督导带教事项返回")
private String teachingMethodName;
@ApiModelProperty(notes = "带教目标,仅督导带教事项返回")
private String teachingTarget;
@ApiModelProperty(notes = "目标触客率")
private String targetCustomerContactRate;
@ApiModelProperty(notes = "创建人")
private String creator;
......@@ -66,6 +79,12 @@ public class TaskInfoDTO implements Serializable {
@ApiModelProperty(notes = "专项任务回复")
private String replyContent;
@ApiModelProperty(notes = "任务执行结果编码")
private String executionResultCode;
@ApiModelProperty(notes = "任务执行结果名称")
private String executionResultName;
@ApiModelProperty(notes = "回复时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
......
package cn.com.glsx.dj.staff.dto.taskcenter;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 事项列表数据。
*/
@Data
public class TaskInfoListDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long taskCenterId;
private String taskType;
private String taskTypeName;
private Integer status;
private Date dueTime;
private String storeName;
private String storeId;
private Integer businessType;
private String businessTypeName;
private String creator;
private String creatorPhone;
private String taskDescription;
private String replyContent;
private Date replyTime;
private String assignedToId;
private String assignedToName;
private Date createdDate;
private List<TaskStaffRelDTO> staffList;
private String teachingMethodCode;
private String teachingMethodName;
private String teachingTarget;
}
......@@ -3,8 +3,6 @@ package cn.com.glsx.dj.staff.dto.taskcenter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
......@@ -27,29 +25,35 @@ public class TaskInfoSubmitDTO implements Serializable {
@Size(max = 800, message = "专项任务回复不能超过800字符")
private String replyContent;
@ApiModelProperty(notes = "任务执行结果编码,多场景拓展、拓新店流量任务必填")
@ApiModelProperty(notes = "任务执行结果编码,人员更换评估、多场景拓展、拓新店流量任务必填")
private String executionResultCode;
@ApiModelProperty(notes = "修改人")
@Size(max = 64, message = "修改人不能超过64字符")
private String updatedBy;
@ApiModelProperty(notes = "是否更换:0-不更换,1-更换;人员更换评估任务必填")
@Min(value = 0, message = "是否更换参数不正确")
@Max(value = 1, message = "是否更换参数不正确")
private Integer replaceFlag;
@ApiModelProperty(notes = "更换方式:1-发起招聘需求,2-关联已有招聘需求,3-关联另一个驻店人员完成调换")
@Min(value = 1, message = "更换方式参数不正确")
@Max(value = 3, message = "更换方式参数不正确")
private Integer replaceMethod;
@ApiModelProperty(notes = "招聘需求id")
@Size(max = 64, message = "招聘需求id不能超过64字符")
private String recruitmentDemandId;
@ApiModelProperty(notes = "招聘需求名称")
@Size(max = 255, message = "招聘需求名称不能超过255字符")
private String recruitmentDemandName;
@ApiModelProperty(notes = "招聘负责人标识")
@Size(max = 64, message = "招聘负责人标识不能超过64字符")
private String recruitmentOwnerId;
@ApiModelProperty(notes = "招聘负责人姓名")
@Size(max = 100, message = "招聘负责人姓名不能超过100字符")
private String recruitmentOwnerName;
@ApiModelProperty(notes = "完成调换的驻店人员uuid")
@Size(max = 64, message = "调换驻店人员uuid不能超过64字符")
private String replacementStaffUuid;
@ApiModelProperty(notes = "完成调换的驻店人员姓名")
@Size(max = 100, message = "调换驻店人员姓名不能超过100字符")
private String replacementStaffName;
}
package cn.com.glsx.dj.staff.dto.taskcenter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -17,21 +16,6 @@ public class TaskStaffReplaceResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
@JsonIgnore
private String executionResultCode;
@ApiModelProperty(notes = "是否更换:0-不更换,1-更换")
private Integer replaceFlag;
@ApiModelProperty(notes = "任务执行结果名称")
private String replaceFlagName;
@ApiModelProperty(notes = "更换方式:1-发起招聘需求,2-关联已有招聘需求,3-关联另一个驻店人员完成调换")
private Integer replaceMethod;
@ApiModelProperty(notes = "更换方式名称")
private String replaceMethodName;
@ApiModelProperty(notes = "招聘需求id")
private String recruitmentDemandId;
......
package cn.com.glsx.dj.staff.enums.taskcenter;
import lombok.Getter;
/**
* 人员更换评估任务执行结果
*/
@Getter
public enum StaffReplaceExecutionResultEnum {
/** 不更换 */
NO_REPLACE("NO_REPLACE", "不更换", 0, null),
NO_REPLACE("NO_REPLACE", "不更换"),
/** 发起招聘需求 */
CREATE_RECRUITMENT_DEMAND("CREATE_RECRUITMENT_DEMAND", "发起招聘需求", 1, 1),
CREATE_RECRUITMENT_DEMAND("CREATE_RECRUITMENT_DEMAND", "发起招聘"),
/** 关联已有招聘需求 */
LINK_EXISTING_RECRUITMENT_DEMAND(
"LINK_EXISTING_RECRUITMENT_DEMAND", "关联已有招聘需求", 1, 2),
LINK_EXISTING_RECRUITMENT_DEMAND("LINK_EXISTING_RECRUITMENT_DEMAND", "关联已有招聘"),
/** 关联另一个驻店人员完成调换 */
LINK_REPLACEMENT_STAFF(
"LINK_REPLACEMENT_STAFF", "关联另一个驻店人员完成调换", 1, 3);
LINK_REPLACEMENT_STAFF("LINK_REPLACEMENT_STAFF", "关联另一个驻店");
private final String code;
private final String name;
private final Integer replaceFlag;
private final Integer replaceMethod;
StaffReplaceExecutionResultEnum(String code, String name,
Integer replaceFlag, Integer replaceMethod) {
StaffReplaceExecutionResultEnum(String code, String name) {
this.code = code;
this.name = name;
this.replaceFlag = replaceFlag;
this.replaceMethod = replaceMethod;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
public Integer getReplaceFlag() {
return replaceFlag;
}
public Integer getReplaceMethod() {
return replaceMethod;
}
/**
......@@ -65,19 +43,4 @@ public enum StaffReplaceExecutionResultEnum {
}
return null;
}
/**
* 根据是否更换和更换方式获取执行结果
*/
public static StaffReplaceExecutionResultEnum getByReplaceResult(
Integer replaceFlag, Integer replaceMethod) {
for (StaffReplaceExecutionResultEnum result : values()) {
if (result.replaceFlag.equals(replaceFlag)
&& (result.replaceMethod == null
|| result.replaceMethod.equals(replaceMethod))) {
return result;
}
}
return null;
}
}
......@@ -87,30 +87,6 @@ public class TaskInfo implements Serializable {
@Column(name = "execution_result_name")
private String executionResultName;
/** 关联招聘需求ID */
@Column(name = "recruitment_demand_id")
private String recruitmentDemandId;
/** 关联招聘需求名称 */
@Column(name = "recruitment_demand_name")
private String recruitmentDemandName;
/** 招聘负责人标识,当前招聘数据使用手机号 */
@Column(name = "recruitment_owner_id")
private String recruitmentOwnerId;
/** 招聘负责人姓名 */
@Column(name = "recruitment_owner_name")
private String recruitmentOwnerName;
/** 关联驻店人员UUID */
@Column(name = "replacement_staff_uuid")
private String replacementStaffUuid;
/** 关联驻店人员姓名 */
@Column(name = "replacement_staff_name")
private String replacementStaffName;
/** 回复时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "reply_time")
......
......@@ -2,7 +2,6 @@ package cn.com.glsx.dj.staff.remote;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskCountStatDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoListDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoQueryDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoSubmitDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.SupervisorCoachTaskDetailDTO;
......@@ -24,12 +23,6 @@ public interface TaskInfoRemote {
@ApiResponse("事项分页结果")
RpcResponse<RpcPagination<TaskInfoDTO>> pageTaskInfo(@NotNull RpcPagination<TaskInfoQueryDTO> pagination);
@ApiMethod("分页查询小程序事项列表")
@ApiParam(name = "pagination", notes = "分页查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("小程序事项列表分页结果")
RpcResponse<RpcPagination<TaskInfoListDTO>> pageTaskInfoList(
@NotNull RpcPagination<TaskInfoQueryDTO> pagination);
@ApiMethod("统计事项任务数量(待完成/已完成/全部)")
@ApiParam(name = "query", notes = "查询条件(assignedToId/keyword)", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("事项任务统计数量")
......
......@@ -94,6 +94,11 @@
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-supervisor-api</artifactId>
<version>5.8.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj.strategy</groupId>
<artifactId>rpc-dj-strategy-api</artifactId>
<version>5.8.3-SNAPSHOT</version>
......@@ -111,4 +116,4 @@
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
package cn.com.glsx.dj.staff.converter;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoSubmitDTO;
import cn.com.glsx.dj.staff.model.RecruitmentDemand;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskStaffReplaceResultDTO;
import cn.com.glsx.dj.smartcarlife.dto.StaffInfoDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
......@@ -16,10 +14,6 @@ public interface TaskStaffReplaceResultConvert {
/** 不更换 */
@Mappings({
@Mapping(source = "replaceFlag", target = "replaceFlag"),
@Mapping(target = "replaceFlagName", ignore = true),
@Mapping(target = "replaceMethod", ignore = true),
@Mapping(target = "replaceMethodName", ignore = true),
@Mapping(target = "recruitmentDemandId", ignore = true),
@Mapping(target = "recruitmentDemandName", ignore = true),
@Mapping(target = "recruitmentApplyTime", ignore = true),
......@@ -30,35 +24,27 @@ public interface TaskStaffReplaceResultConvert {
})
TaskStaffReplaceResultDTO toNoReplaceResult(TaskInfoSubmitDTO source);
/** 发起或关联招聘需求:关联信息以服务端查询结果为准 */
/** 发起或关联招聘需求 */
@Mappings({
@Mapping(source = "source.replaceFlag", target = "replaceFlag"),
@Mapping(target = "replaceFlagName", ignore = true),
@Mapping(source = "source.replaceMethod", target = "replaceMethod"),
@Mapping(target = "replaceMethodName", ignore = true),
@Mapping(source = "demand.id", target = "recruitmentDemandId"),
@Mapping(source = "demand.recruitmentTypeName", target = "recruitmentDemandName"),
@Mapping(source = "demand.createdDate", target = "recruitmentApplyTime"),
@Mapping(source = "demand.recruiterPhone", target = "recruitmentOwnerId"),
@Mapping(source = "demand.recruiterName", target = "recruitmentOwnerName"),
@Mapping(source = "source.recruitmentDemandId", target = "recruitmentDemandId"),
@Mapping(source = "source.recruitmentDemandName", target = "recruitmentDemandName"),
@Mapping(target = "recruitmentApplyTime", ignore = true),
@Mapping(source = "source.recruitmentOwnerId", target = "recruitmentOwnerId"),
@Mapping(source = "source.recruitmentOwnerName", target = "recruitmentOwnerName"),
@Mapping(target = "replacementStaffUuid", ignore = true),
@Mapping(target = "replacementStaffName", ignore = true)
})
TaskStaffReplaceResultDTO toRecruitmentResult(TaskInfoSubmitDTO source, RecruitmentDemand demand);
TaskStaffReplaceResultDTO toRecruitmentResult(TaskInfoSubmitDTO source);
/** 关联驻店人员完成调换:人员信息以服务端查询结果为准 */
/** 关联驻店人员完成调换 */
@Mappings({
@Mapping(source = "source.replaceFlag", target = "replaceFlag"),
@Mapping(target = "replaceFlagName", ignore = true),
@Mapping(source = "source.replaceMethod", target = "replaceMethod"),
@Mapping(target = "replaceMethodName", ignore = true),
@Mapping(source = "staff.staffUuid", target = "replacementStaffUuid"),
@Mapping(source = "staff.staffName", target = "replacementStaffName"),
@Mapping(source = "source.replacementStaffUuid", target = "replacementStaffUuid"),
@Mapping(source = "source.replacementStaffName", target = "replacementStaffName"),
@Mapping(target = "recruitmentDemandId", ignore = true),
@Mapping(target = "recruitmentDemandName", ignore = true),
@Mapping(target = "recruitmentApplyTime", ignore = true),
@Mapping(target = "recruitmentOwnerId", ignore = true),
@Mapping(target = "recruitmentOwnerName", ignore = true)
})
TaskStaffReplaceResultDTO toStaffReplacementResult(TaskInfoSubmitDTO source, StaffInfoDTO staff);
TaskStaffReplaceResultDTO toStaffReplacementResult(TaskInfoSubmitDTO source);
}
......@@ -90,7 +90,7 @@ public interface TaskSupervisorCoachConvert {
@Mappings({
@Mapping(source = "assigneeDetail", target = "assigneeDetail"),
@Mapping(source = "assigneeImages", target = "assigneeImages", qualifiedByName = "stringListToJson"),
@Mapping(target = "courseList", expression = "java(buildCourseList(source.getPushCoursesId(), source.getPushCoursesName()))"),
@Mapping(source = "courseList", target = "courseList", qualifiedByName = "courseListToJson"),
@Mapping(source = "teachingTime", target = "teachingTime", qualifiedByName = "stringToDate"),
@Mapping(target = "id", ignore = true),
@Mapping(target = "taskId", ignore = true),
......@@ -115,6 +115,11 @@ public interface TaskSupervisorCoachConvert {
return list == null ? null : JSONUtil.toJsonStr(list);
}
@Named("courseListToJson")
default String courseListToJson(List<SupervisorCoachCourseDTO> courseList) {
return courseList == null ? null : JSONUtil.toJsonStr(courseList);
}
/**
* 将扩展表保存的人员姓名JSON数组转换为详情接口的字符串列表。
*/
......@@ -225,33 +230,6 @@ public interface TaskSupervisorCoachConvert {
}
/**
* 从课程列表中读取第一条课程的指定属性,用于兼容原有详情返回字段。
*/
default String courseValue(String courseListJson, String propertyName) {
String normalized = normalizeCourseList(courseListJson);
if (normalized == null) {
return null;
}
JSONObject course = JSONUtil.parseArray(normalized).getJSONObject(0);
return course == null ? null : StringUtils.trimToNull(course.getStr(propertyName));
}
/**
* 将原有提交接口中的单个课程ID和名称转换为课程JSON数组。
*/
default String buildCourseList(String courseId, String courseName) {
if (StringUtils.isBlank(courseId) && StringUtils.isBlank(courseName)) {
return null;
}
JSONObject course = new JSONObject();
course.set("courseId", StringUtils.trimToNull(courseId));
course.set("courseName", StringUtils.trimToNull(courseName));
JSONArray courses = new JSONArray();
courses.add(course);
return courses.toString();
}
/**
* 提取参与人员姓名,转换为扩展表task_staff_list保存的JSON数组字符串。
*/
default String staffNameJson(List<TaskStaffRel> staffList) {
......
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoListDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoQueryDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskStaffRelDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskStaffReplaceResultDTO;
......@@ -23,11 +22,6 @@ public interface TaskInfoMapper {
List<TaskInfoDTO> pageTaskInfo(TaskInfoQueryDTO query);
/**
* 分页查询小程序事项列表展示数据。
*/
List<TaskInfoListDTO> pageTaskInfoList(TaskInfoQueryDTO query);
/**
* 按条件统计事项数量
* <p>当 query.status 为空时,统计该用户全部任务数;不为空则按状态统计。</p>
*/
......@@ -55,11 +49,9 @@ public interface TaskInfoMapper {
/**
* 更新人员更换评估执行结果
*/
int updateStaffReplaceResult(@Param("id") Long id,
int insertStaffReplaceResult(@Param("taskId") Long taskId,
@Param("result") TaskStaffReplaceResultDTO result,
@Param("executionResultCode") String executionResultCode,
@Param("executionResultName") String executionResultName,
@Param("updatedBy") String updatedBy);
@Param("createdBy") String createdBy);
/**
* 查询人员更换评估执行结果
......
......@@ -2,7 +2,6 @@ package cn.com.glsx.dj.staff.remote;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskCountStatDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoListDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoQueryDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoSubmitDTO;
import cn.com.glsx.dj.staff.dto.taskcenter.SupervisorCoachTaskDetailDTO;
......@@ -39,22 +38,6 @@ public class TaskInfoRemoteImpl implements TaskInfoRemote {
}
@Override
public RpcResponse<RpcPagination<TaskInfoListDTO>> pageTaskInfoList(
RpcPagination<TaskInfoQueryDTO> pagination) {
try {
Page<TaskInfoListDTO> page = taskInfoService.pageTaskInfoList(pagination);
RpcPagination<TaskInfoListDTO> result = RpcPagination.copyPage(page);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("TaskInfoRemoteImpl__pageTaskInfoList__bizException:{}", e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("TaskInfoRemoteImpl__pageTaskInfoList__exception", e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<TaskCountStatDTO> countTaskStat(TaskInfoQueryDTO query) {
try {
TaskCountStatDTO stat = taskInfoService.countTaskStat(query);
......
......@@ -5,6 +5,8 @@ import cn.com.glsx.dj.staff.mapper.TaskInfoMapper;
import cn.com.glsx.dj.staff.model.TaskInfo;
import cn.com.glsx.dj.staff.model.TaskStaffRel;
import cn.com.glsx.dj.staff.model.TaskSupervisorCoach;
import cn.com.glsx.dj.supervisor.dto.RegionOperatorDTO;
import cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemote;
import cn.com.glsx.dj.taskcenter.dto.taskcenter.TaskAssigneeDTO;
import cn.com.glsx.dj.taskcenter.dto.taskcenter.TaskDTO;
import cn.com.glsx.dj.taskcenter.dto.taskcenter.TaskQueryConditionDTO;
......@@ -59,13 +61,20 @@ public class TaskInfoSyncService {
@DubboReference(check = false)
private TaskCenterRemote taskCenterRemote;
@DubboReference(check = false)
private SupervisorTaskInfoRemote supervisorTaskInfoRemote;
/**
* 执行同步:从任务中心拉取新增任务写入本地
*/
public void syncTaskFromCenter() {
// 每轮同步只查询一次飞行督导名单,避免逐条任务调用远程接口
Set<String> flightSupervisorUuidSet = getFlightSupervisorUuidSet();
// 1. 查询本地最大创建时间作为增量起点
Date maxCreatedDate = taskInfoMapper.getMaxCreatedDate();
log.info("TaskInfoSync__start, localMaxCreatedDate={}", maxCreatedDate);
log.info("TaskInfoSync__start, localMaxCreatedDate={}, flightSupervisorCount={}",
maxCreatedDate, flightSupervisorUuidSet.size());
// 2. 构建分页查询条件
TaskQueryConditionDTO condition = new TaskQueryConditionDTO();
......@@ -98,6 +107,10 @@ public class TaskInfoSyncService {
// 4. 逐条处理
for (TaskDTO task : taskList) {
if (isFlightSupervisorTask(task, flightSupervisorUuidSet)) {
log.info("TaskInfoSync__skipFlightSupervisorTask, taskId={}", task.getTaskId());
continue;
}
try {
int synced = processSingleTask(task);
totalSynced += synced;
......@@ -120,6 +133,37 @@ public class TaskInfoSyncService {
}
/**
* 查询飞行督导UUID集合
*/
private Set<String> getFlightSupervisorUuidSet() {
RpcResponse<List<RegionOperatorDTO>> response = supervisorTaskInfoRemote.listAllFlightSupervisor();
if (response == null || !response.isSuccess() || response.getResult() == null) {
throw new IllegalStateException("查询飞行督导名单失败,停止本轮任务同步");
}
Set<String> uuidSet = new HashSet<>();
for (RegionOperatorDTO supervisor : response.getResult()) {
if (supervisor != null && StringUtils.isNotBlank(supervisor.getUuid())) {
uuidSet.add(supervisor.getUuid());
}
}
return uuidSet;
}
/**
* 判断任务是否包含飞行督导执行人
*/
private boolean isFlightSupervisorTask(TaskDTO task, Set<String> flightSupervisorUuidSet) {
if (task == null || CollectionUtils.isEmpty(task.getAssignees())
|| CollectionUtils.isEmpty(flightSupervisorUuidSet)) {
return false;
}
return task.getAssignees().stream()
.map(TaskAssigneeDTO::getAssigneeId)
.filter(StringUtils::isNotBlank)
.anyMatch(flightSupervisorUuidSet::contains);
}
/**
* 处理单条任务:判断是否已存在,不存在则插入
*
* @return 1-新增成功 0-已存在跳过
......
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.staff.mapper.TaskInfoMapper">
<resultMap id="TaskInfoDTOMap" type="cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoDTO">
<resultMap id="TaskInfoBaseMap" type="cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoDTO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="task_center_id" property="taskCenterId" jdbcType="BIGINT"/>
<result column="task_type" property="taskType" jdbcType="VARCHAR"/>
......@@ -23,9 +23,11 @@
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="TaskInfoListDTOMap"
type="cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoListDTO"
extends="TaskInfoDTOMap">
<resultMap id="TaskInfoDTOMap"
type="cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoDTO"
extends="TaskInfoBaseMap">
<result column="execution_result_code" property="executionResultCode" jdbcType="VARCHAR"/>
<result column="execution_result_name" property="executionResultName" jdbcType="VARCHAR"/>
<result column="teaching_method_code" property="teachingMethodCode" jdbcType="VARCHAR"/>
<result column="teaching_method_name" property="teachingMethodName" jdbcType="VARCHAR"/>
<result column="teaching_target" property="teachingTarget" jdbcType="VARCHAR"/>
......@@ -40,9 +42,9 @@
<resultMap id="TaskStaffReplaceResultDTOMap"
type="cn.com.glsx.dj.staff.dto.taskcenter.TaskStaffReplaceResultDTO">
<result column="execution_result_code" property="executionResultCode" jdbcType="VARCHAR"/>
<result column="recruitment_demand_id" property="recruitmentDemandId" jdbcType="VARCHAR"/>
<result column="recruitment_demand_name" property="recruitmentDemandName" jdbcType="VARCHAR"/>
<result column="recruitment_apply_time" property="recruitmentApplyTime" jdbcType="TIMESTAMP"/>
<result column="recruitment_owner_id" property="recruitmentOwnerId" jdbcType="VARCHAR"/>
<result column="recruitment_owner_name" property="recruitmentOwnerName" jdbcType="VARCHAR"/>
<result column="replacement_staff_uuid" property="replacementStaffUuid" jdbcType="VARCHAR"/>
......@@ -103,28 +105,12 @@
</if>
</sql>
<!-- 原事项分页查询,保持原TaskInfoDTO返回结构 -->
<select id="pageTaskInfo" parameterType="cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoQueryDTO"
resultMap="TaskInfoDTOMap">
SELECT
t.id, t.task_center_id, t.task_type, t.task_type_name, t.status, t.due_time,
t.store_name, t.store_id, t.business_type, t.business_type_name,
t.creator, t.creator_phone, t.task_description, t.reply_content,
t.reply_time, t.assigned_to_id, t.assigned_to_name, t.created_date
FROM dj_car_life_task_info t
<where>
<include refid="TaskInfoPageWhere"/>
</where>
ORDER BY t.created_date DESC
</select>
<!-- 分页查询小程序事项列表展示数据 -->
<select id="pageTaskInfoList" parameterType="cn.com.glsx.dj.staff.dto.taskcenter.TaskInfoQueryDTO"
resultMap="TaskInfoListDTOMap">
SELECT
t.id, t.task_center_id, t.task_type, t.task_type_name, t.status, t.due_time,
t.store_name, t.store_id, t.business_type, t.business_type_name,
t.creator, t.creator_phone, t.task_description, t.reply_content,
t.reply_time, t.assigned_to_id, t.assigned_to_name, t.created_date,
coach.teaching_method_code, coach.teaching_method_name,
coach.teaching_target
......@@ -172,6 +158,7 @@
t.id, t.task_center_id, t.task_type, t.task_type_name, t.status, t.due_time,
t.store_name, t.store_id, t.business_type, t.business_type_name,
t.creator, t.creator_phone, t.task_description, t.reply_content,
t.execution_result_code, t.execution_result_name,
t.reply_time, t.assigned_to_id, t.assigned_to_name, t.created_date
FROM dj_car_life_task_info t
WHERE t.id = #{id} AND t.deleted_flag = 'N'
......@@ -199,40 +186,36 @@
WHERE id = #{id} AND status = 0 AND deleted_flag = 'N'
</update>
<!-- 更新人员更换评估执行结果 -->
<update id="updateStaffReplaceResult">
UPDATE dj_car_life_task_info
SET execution_result_code = #{executionResultCode},
execution_result_name = #{executionResultName},
recruitment_demand_id = #{result.recruitmentDemandId},
recruitment_demand_name = #{result.recruitmentDemandName},
recruitment_owner_id = #{result.recruitmentOwnerId},
recruitment_owner_name = #{result.recruitmentOwnerName},
replacement_staff_uuid = #{result.replacementStaffUuid},
replacement_staff_name = #{result.replacementStaffName},
updated_by = #{updatedBy},
updated_date = NOW()
WHERE id = #{id} AND status = 0 AND deleted_flag = 'N'
</update>
<!-- 新增人员更换评估执行结果 -->
<insert id="insertStaffReplaceResult">
INSERT INTO dj_car_life_task_staff_replace_result
(task_id, recruitment_demand_id, recruitment_demand_name,
recruitment_owner_id, recruitment_owner_name,
replacement_staff_uuid, replacement_staff_name,
created_by, created_date, updated_by, updated_date, deleted_flag)
VALUES
(#{taskId}, #{result.recruitmentDemandId}, #{result.recruitmentDemandName},
#{result.recruitmentOwnerId}, #{result.recruitmentOwnerName},
#{result.replacementStaffUuid}, #{result.replacementStaffName},
#{createdBy}, NOW(), #{createdBy}, NOW(), 'N')
</insert>
<!-- 查询人员更换评估执行结果 -->
<select id="getStaffReplaceResultByTaskId" resultMap="TaskStaffReplaceResultDTOMap">
SELECT
execution_result_code,
recruitment_demand_id,
recruitment_demand_name,
result.recruitment_demand_id,
result.recruitment_demand_name,
demand.created_date AS recruitment_apply_time,
recruitment_owner_id,
recruitment_owner_name,
replacement_staff_uuid,
replacement_staff_name
FROM dj_car_life_task_info task
result.recruitment_owner_id,
result.recruitment_owner_name,
result.replacement_staff_uuid,
result.replacement_staff_name
FROM dj_car_life_task_staff_replace_result result
LEFT JOIN dj_car_life_recruitment_demand demand
ON CAST(demand.id AS CHAR) = task.recruitment_demand_id
WHERE task.id = #{taskId}
AND task.task_type = 'staff-replace-access'
AND task.execution_result_code IS NOT NULL
AND task.deleted_flag = 'N'
ON CAST(demand.id AS CHAR) = result.recruitment_demand_id
WHERE result.task_id = #{taskId}
AND result.deleted_flag = 'N'
LIMIT 1
</select>
<!-- 完成不使用reply_content的事项 -->
......@@ -263,18 +246,12 @@
(task_center_id, task_type, task_type_name, status, due_time, store_name, store_id,
business_type, business_type_name, creator, creator_phone,
task_description, execution_result_code, execution_result_name,
recruitment_demand_id, recruitment_demand_name,
recruitment_owner_id, recruitment_owner_name,
replacement_staff_uuid, replacement_staff_name,
assigned_to_id, assigned_to_name,
created_by, created_date, updated_by, updated_date, deleted_flag)
VALUES
(#{taskCenterId}, #{taskType}, #{taskTypeName}, #{status}, #{dueTime}, #{storeName}, #{storeId},
#{businessType}, #{businessTypeName}, #{creator}, #{creatorPhone},
#{taskDescription}, #{executionResultCode}, #{executionResultName},
#{recruitmentDemandId}, #{recruitmentDemandName},
#{recruitmentOwnerId}, #{recruitmentOwnerName},
#{replacementStaffUuid}, #{replacementStaffName},
#{assignedToId}, #{assignedToName},
#{createdBy}, #{createdDate}, #{updatedBy}, NOW(), 'N')
</insert>
......@@ -336,20 +313,18 @@
<update id="updateSupervisorCoachResult"
parameterType="cn.com.glsx.dj.staff.model.TaskSupervisorCoach">
UPDATE dj_car_life_task_supervisor_coach
<set>
<if test="teachingSceneCode != null">teaching_scene_code = #{teachingSceneCode},</if>
<if test="teachingSceneName != null">teaching_scene_name = #{teachingSceneName},</if>
<if test="teachingTime != null">teaching_time = #{teachingTime},</if>
<if test="teachingMethodCode != null">teaching_method_code = #{teachingMethodCode},</if>
<if test="teachingMethodName != null">teaching_method_name = #{teachingMethodName},</if>
<if test="teachingTopicCode != null">teaching_topic_code = #{teachingTopicCode},</if>
<if test="teachingTopicName != null">teaching_topic_name = #{teachingTopicName},</if>
<if test="courseList != null">course_list = #{courseList},</if>
<if test="assigneeDetail != null">assignee_detail = #{assigneeDetail},</if>
<if test="assigneeImages != null">assignee_images = #{assigneeImages},</if>
SET teaching_scene_code = #{teachingSceneCode},
teaching_scene_name = #{teachingSceneName},
teaching_time = #{teachingTime},
teaching_method_code = #{teachingMethodCode},
teaching_method_name = #{teachingMethodName},
teaching_topic_code = #{teachingTopicCode},
teaching_topic_name = #{teachingTopicName},
course_list = #{courseList},
assignee_detail = #{assigneeDetail},
assignee_images = #{assigneeImages},
updated_by = #{updatedBy},
updated_date = NOW()
</set>
WHERE task_id = #{taskId} AND deleted_flag = 'N'
</update>
......
  • @wangxw1
    commented
    Master

    这是一份针对您提交代码的专业审查报告。本次审查严格依据代码的正确性、安全性、最佳实践等维度进行,并重点关注了 Dubbo 接口的兼容性问题。

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

    1. Dubbo Remote 接口参数发生破坏性变更(极高风险 / 违反核心规则)

    • 问题描述:在 TaskInfoSubmitDTO 和 SupervisorCoachTaskSubmitDTO 这两个作为 Dubbo 接口 (TaskInfoRemote) 入参的 DTO 中,直接删除了多个已有字段(如 pushCoursesId, pushCoursesName, replaceFlag, replaceMethod 等)。此外,TaskInfoRemote 接口直接删除了 pageTaskInfoList 方法。
    • 影响分析:严重违反“dubbo服务提供者Remote接口中的已有请求参数变更视为危险实现”的规则。直接删除接口方法和请求参数是破坏性变更(Breaking Change)。如果服务消费者(Consumer)未能与提供者(Provider)强同步发布,旧版本客户端调用时将发生序列化异常或找不到方法的错误,直接导致线上核心业务阻断。
    • 优化建议: 保持 Dubbo 接口的向下兼容性。
      1. 对于废弃字段,请使用 @Deprecated 注解标记,而不是直接删除。
      2. 在服务端的业务逻辑中(如 Convert 或 Service),兼容解析旧字段的数据。
      3. 对于废弃的方法(pageTaskInfoList),应保留空实现或标记废弃,待所有消费者确认迁移后再在下个大版本移除;或者通过 Dubbo 的 version 机制发布新版本接口。

    2. 移除服务端校验导致的数据伪造与越权风险(高风险)

    • 问题描述:在 TaskInfoService.java 中,删除了原有的 getAndValidateRecruitmentDemand 和 getAndValidateReplacementStaff 方法。新逻辑不再通过服务端查询数据库或 RPC 验证数据的真实性和归属权,而是直接信任客户端传入的 recruitmentDemandName、recruitmentOwnerName 和 replacementStaffName。
    • 影响分析:存在严重的数据完整性风险和潜在的越权漏洞(IDOR)。恶意用户或前端 Bug 可以构造合法的 DemandId 但篡改 DemandName(例如张冠李戴),服务端将这些脏数据直接入库,会破坏底层业务数据的权威性,甚至导致后续基于这些名称的统计和展示出现严重偏差。
    • 优化建议: 恢复服务端的防篡改校验。客户端(前端)只应传递唯一标识(如 Id 或 Uuid),名称(Name)等关联信息必须由服务端通过查表或 RPC 接口实时获取并填充。 java // 建议恢复类似如下逻辑,禁止直接从 DTO 提取 Name RecruitmentDemand demand = recruitmentDemandMapper.selectByPrimaryKey(dto.getRecruitmentDemandId()); if (demand == null) { throw new RpcServiceException("招聘需求不存在"); } result.setRecruitmentDemandName(demand.getRecruitmentTypeName());

    3. 枚举类方法调用错误存在编译/运行失败隐患(中风险)

    • 问题描述:在 TaskInfoService.java 第 178 行,代码调用了 StaffReplaceExecutionResultEnum.getByCode(dto.getExecutionResultCode())。但是查看 StaffReplaceExecutionResultEnum.java 的变更内容,原有的 getByReplaceResult 被删除,且并未实现 getByCode 方法。
    • 影响分析:如果该枚举类在其父类或未展示的代码中没有 getByCode 方法,将直接导致项目编译失败;如果是通过反射等动态机制调用,也会在运行时抛出 NoSuchMethodError,导致任务提交功能 100% 报错。
    • 优化建议: 在 StaffReplaceExecutionResultEnum 类中显式补充该方法: java public static StaffReplaceExecutionResultEnum getByCode(String code) { for (StaffReplaceExecutionResultEnum enums : values()) { if (enums.getCode().equals(code)) { return enums; } } return null; }

    二、评分明细

    • 功能实现的正确性与健壮性(25/40分):扣分主要因为枚举类潜在的 getByCode 缺失会导致运行失败,且重构过程中删除了对核心业务对象是否存在的校验逻辑,降低了系统的健壮性。
    • 安全性与潜在风险(15/30分):扣分较多。将原本由服务端保障的数据一致性逻辑交给了客户端(直接接收 Name 等冗余字段),引入了明显的数据伪造和越权风险。
    • 最佳实践与可维护性(8/20分):严重违反了微服务(Dubbo)接口向下兼容的最佳实践。直接删除字段和方法会给跨团队协作和发布带来极大的耦合阻力。
    • 性能与资源利用(5/5分):虽然移除了 DB 和 RPC 调用客观上减少了耗时,但这是以牺牲安全性和正确性为代价的。单从性能维度暂不扣分。
    • 提交信息质量(2/5分):Commit Message 为 feat: 事项优化。过于宽泛,包含了大量的结构调整、字段增删,但未在提交信息中说明具体的业务目的和影响范围,可追溯性较差。

    总分:55分

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