Commit 9c55f565 by 庞善天

轻改短课程需求

1 parent ac0b4d17
Showing 47 changed files with 2108 additions and 5 deletions
......@@ -7,7 +7,7 @@
</parent>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.7.1-SNAPSHOT</version>
<version>5.7.5-SNAPSHOT</version>
<name>rpc-dj-mindworkplate-api</name>
<properties>
<deploy.scanPackage>cn.com.glsx.remote</deploy.scanPackage>
......@@ -33,7 +33,7 @@
<dependency>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.7.1-SNAPSHOT</version>
<version>5.7.5-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
......
package cn.com.glsx.dj.mindworkplate.dto.sop;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@ToString
@NoArgsConstructor
public class SopShortCourseConfigDTO extends SopShortCourseConfig implements Serializable {
/**
* 明细人员列表(姓名+手机号)
*/
private List<SopShortCourseConfigDetailDTO> staffList;
}
package cn.com.glsx.dj.mindworkplate.dto.sop;
import lombok.Data;
import java.io.Serializable;
/**
* 短课程配置提交入参
*/
@Data
public class SopShortCourseConfigDetailDTO implements Serializable {
/**
* 驻店员工姓名
*/
private String staffName;
/**
* 驻店员工手机号
*/
private String staffPhone;
}
package cn.com.glsx.dj.mindworkplate.dto.sop;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 短课程配置提交入参
*/
@Data
public class SopShortCourseConfigSubmitDTO implements Serializable {
/**
* 前端必传:开关 0-关 1-开
*/
private Byte openFlag;
/**
* 前端必传:完成时间要求(单位小时)
*/
private Integer finishTime;
/**
* 前端必传:惩罚方式(0-无惩罚 1-限制录单)
*/
private Byte punishType;
/**
* 前端必传:生效时间(0-立即生效,1-隔日生效)
*/
private Byte effectiveType;
/**
* 明细人员列表(姓名+手机号)
*/
private List<SopShortCourseConfigDetailDTO> staffList;
/**
* 操作人(不传默认 system)
*/
private String createdBy;
}
package cn.com.glsx.dj.mindworkplate.dto.sop;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTaskDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.List;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class SopShortCourseDetailDTO extends SopShortCourseTask {
@ApiModelProperty(notes = "短课程任务明细列表")
private List<SopShortCourseTaskDetail> detailList;
@ApiModelProperty(notes = "岗位:默认为驻店人员(如驻店人员有多岗位分隔显示,如导师)")
private String position;
@ApiModelProperty(notes = "驻店时间标签+标签值")
private String residentTimeTag;
@ApiModelProperty(notes = "直属上级:上级区域运营经理")
private String superior;
@ApiModelProperty(notes = "战败复盘标签")
private List<String> defeatReviewTag;
@ApiModelProperty(notes = "战败复盘维度值")
private List<Integer> defeatReviewValue;
}
package cn.com.glsx.dj.mindworkplate.dto.sop;
import lombok.Data;
import java.io.Serializable;
/**
* 短课程任务生成时的录音数据
*/
@Data
public class SopShortCourseRecordingDTO implements Serializable {
/**
* 录音表id
*/
private Integer badgeRecordingsId;
/**
* 录音记录批次表id
*/
private Integer conversationBatchId;
/**
* 接待客户信息表id
*/
private Integer customerInfoId;
/**
* 接待客户手机号码
*/
private String customerPhone;
}
package cn.com.glsx.dj.mindworkplate.dto.sop;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@ToString
public class SopShortCourseTaskDTO implements Serializable {
@ApiModelProperty("分页页码")
private Integer pageNum = 1;
@ApiModelProperty("分页条数")
private Integer pageSize = 10;
@ApiModelProperty(notes = "主键id")
private Integer id;
@ApiModelProperty(notes = "员工姓名")
private String staffName;
@ApiModelProperty(notes = "员工手机号")
private String staffPhone;
@ApiModelProperty(notes = "门店名称")
private String merchantName;
@ApiModelProperty(notes = "完成状态,0-进行中,1-已结束")
private Integer taskStatus;
@ApiModelProperty(notes = "复盘开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date checkStartTime;
@ApiModelProperty(notes = "复盘结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date checkEndTime;
@ApiModelProperty(notes = "完成开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date finishStartTime;
@ApiModelProperty(notes = "完成结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date finishEndTime;
@ApiModelProperty(notes = "是否启用处罚 0-否 1-是")
private Integer punishFlag;
@ApiModelProperty(notes = "消息盒子id")
private Integer msgBoxId;
}
......@@ -30,7 +30,9 @@ public enum ModuleTypeEnums {
/** 优秀案例分享策略 */
EXCELLENT_CASE_POLICY(7, "优秀案例分享策略"),
/** 任务型策略 */
TASK_POLICY(8, "任务型策略")
TASK_POLICY(8, "任务型策略"),
/**轻改短课程*/
SHORT_COURSE(9, "轻改短课程")
;
private final Integer code;
......
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 业务类型(bussiness_type)
*/
@Getter
public enum SopBusinessTypeEnum {
EXTENDED_WARRANTY(1, "延保"),
LIGHT_MODIFICATION(2, "轻改"),
;
SopBusinessTypeEnum(Integer value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Integer value;
private final String displayName;
public static SopBusinessTypeEnum getByValue(Integer value) {
if (value != null) {
for (SopBusinessTypeEnum temp : SopBusinessTypeEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static SopBusinessTypeEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopBusinessTypeEnum temp : SopBusinessTypeEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 完成状态(complete_status)
*/
@Getter
public enum SopCompleteStatusEnum {
PROGRESS(0, "进行中"),
ENDED(1, "已结束"),
;
SopCompleteStatusEnum(Integer value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Integer value;
private final String displayName;
public static SopCompleteStatusEnum getByValue(Integer value) {
if (value != null) {
for (SopCompleteStatusEnum temp : SopCompleteStatusEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static String getNameByValue(Integer value) {
SopCompleteStatusEnum e = getByValue(value);
return e == null ? null : e.getDisplayName();
}
public static SopCompleteStatusEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopCompleteStatusEnum temp : SopCompleteStatusEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 生效时间类型(effective_type)
*/
@Getter
public enum SopEffectiveTypeEnum {
IMMEDIATE((byte) 0, "立即生效"),
NEXT_DAY((byte) 1, "隔日生效"),
;
SopEffectiveTypeEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Byte value;
private final String displayName;
public static SopEffectiveTypeEnum getByValue(Byte value) {
if (value != null) {
for (SopEffectiveTypeEnum temp : SopEffectiveTypeEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static SopEffectiveTypeEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopEffectiveTypeEnum temp : SopEffectiveTypeEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 开关(open_flag)
*/
@Getter
public enum SopOpenFlagEnum {
OFF((byte) 0, "关"),
ON((byte) 1, "开"),
;
SopOpenFlagEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Byte value;
private final String displayName;
public static SopOpenFlagEnum getByValue(Byte value) {
if (value != null) {
for (SopOpenFlagEnum temp : SopOpenFlagEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static SopOpenFlagEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopOpenFlagEnum temp : SopOpenFlagEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 是否启用处罚(punish_flag)
*/
@Getter
public enum SopPunishFlagEnum {
NO((byte) 0, "否"),
YES((byte) 1, "是"),
;
SopPunishFlagEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Byte value;
private final String displayName;
public static SopPunishFlagEnum getByValue(Byte value) {
if (value != null) {
for (SopPunishFlagEnum temp : SopPunishFlagEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static String getNameByValue(Byte value) {
SopPunishFlagEnum e = getByValue(value);
return e == null ? null : e.getDisplayName();
}
public static SopPunishFlagEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopPunishFlagEnum temp : SopPunishFlagEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 惩罚状态(punish_status)
*/
@Getter
public enum SopPunishStatusEnum {
NOT_TRIGGERED(1, "未触发"),
PENALIZING(2, "处罚中"),
FINISHED(3, "已结束"),
LIFTED(4, "已解除"),
;
SopPunishStatusEnum(Integer value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Integer value;
private final String displayName;
public static SopPunishStatusEnum getByValue(Integer value) {
if (value != null) {
for (SopPunishStatusEnum temp : SopPunishStatusEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static String getNameByValue(Integer value) {
SopPunishStatusEnum e = getByValue(value);
return e == null ? null : e.getDisplayName();
}
public static SopPunishStatusEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopPunishStatusEnum temp : SopPunishStatusEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 惩罚方式(punish_type)
*/
@Getter
public enum SopPunishTypeEnum {
NONE((byte) 0, "无惩罚"),
LIMIT_ORDER((byte) 1, "限制录单"),
;
SopPunishTypeEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Byte value;
private final String displayName;
public static SopPunishTypeEnum getByValue(Byte value) {
if (value != null) {
for (SopPunishTypeEnum temp : SopPunishTypeEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static String getNameByValue(Byte value) {
SopPunishTypeEnum e = getByValue(value);
return e == null ? null : e.getDisplayName();
}
public static SopPunishTypeEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopPunishTypeEnum temp : SopPunishTypeEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 推送大模型状态(push_status)
*/
@Getter
public enum SopPushStatusEnum {
FAILED(0, "失败"),
SUCCESS(1, "成功"),
;
SopPushStatusEnum(Integer value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Integer value;
private final String displayName;
public static SopPushStatusEnum getByValue(Integer value) {
if (value != null) {
for (SopPushStatusEnum temp : SopPushStatusEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static SopPushStatusEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopPushStatusEnum temp : SopPushStatusEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.enums.sop;
import lombok.Getter;
import org.springframework.util.StringUtils;
/**
* 复盘状态(review_status)
*/
@Getter
public enum SopReviewStatusEnum {
PENDING(0, "待复盘"),
CLOSED(1, "已结案"),
;
SopReviewStatusEnum(Integer value, String displayName) {
this.value = value;
this.displayName = displayName;
}
private final Integer value;
private final String displayName;
public static SopReviewStatusEnum getByValue(Integer value) {
if (value != null) {
for (SopReviewStatusEnum temp : SopReviewStatusEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
public static SopReviewStatusEnum getByDisplayName(String name) {
if (StringUtils.hasLength(name)) {
for (SopReviewStatusEnum temp : SopReviewStatusEnum.values()) {
if (name.equals(temp.getDisplayName())) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.dj.mindworkplate.model.sop;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Table(name = "sop_short_course_config")
@Data
@NoArgsConstructor
@ToString
@SuperBuilder
public class SopShortCourseConfig implements Serializable {
/**
* 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "open_flag")
@ApiModelProperty(notes = "开关 0-关 1-开")
private Byte openFlag;
/**
* 完成时间要求(单位小时)
*/
@Column(name = "finish_time")
@ApiModelProperty(notes = "完成时间要求(单位小时)")
private Integer finishTime;
/**
* 处罚方式(1禁止录单)
*/
@Column(name = "punish_type")
@ApiModelProperty(notes = "惩罚方式(0-无惩罚 1-限制录单)")
private Byte punishType;
/**
* 生效时间(0立即生效,1隔日生效)
*/
@Column(name = "effective_type")
@ApiModelProperty(notes = "生效时间(0-立即生效,1-隔日生效)")
private Byte effectiveType;
/**
* 生效时间
*/
@Column(name = "effective_time")
@ApiModelProperty(notes = "生效时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveTime;
/**
* 业务类型:2-轻改
*/
@Column(name = "bussiness_type")
@ApiModelProperty(notes = "业务类型:2-轻改")
private Integer bussinessType;
@Column(name = "created_by")
@ApiModelProperty(notes = "创建人")
private String createdBy;
@Column(name = "created_date")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "创建时间")
private Date createdDate;
@Column(name = "updated_by")
@ApiModelProperty(notes = "修改人")
private String updatedBy;
@Column(name = "updated_date")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(notes = "修改时间")
private Date updatedDate;
@Column(name = "deleted_flag")
@ApiModelProperty(notes = "删除标识(D:已删除;N:未删除)")
private String deletedFlag;
}
package cn.com.glsx.dj.mindworkplate.model.sop;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Table(name = "sop_short_course_config_detail")
@Data
@NoArgsConstructor
@ToString
@SuperBuilder
public class SopShortCourseConfigDetail implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "short_course_config_id")
@ApiModelProperty(notes = "短课程任务配置id")
private Integer shortCourseConfigId;
@Column(name = "staff_name")
@ApiModelProperty(notes = "驻店员工姓名")
private String staffName;
@Column(name = "staff_phone")
@ApiModelProperty(notes = "驻店员工手机号")
private String staffPhone;
@Column(name = "created_by")
@ApiModelProperty(notes = "创建人")
private String createdBy;
@Column(name = "created_date")
@ApiModelProperty(notes = "创建时间")
private Date createdDate;
@Column(name = "updated_by")
@ApiModelProperty(notes = "修改人")
private String updatedBy;
@Column(name = "updated_date")
@ApiModelProperty(notes = "修改时间")
private Date updatedDate;
@Column(name = "deleted_flag")
@ApiModelProperty(notes = "删除标识(D:已删除;N:未删除)")
private String deletedFlag;
}
package cn.com.glsx.dj.mindworkplate.model.sop;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Table(name = "sop_short_course_task")
@Data
@NoArgsConstructor
@ToString
@SuperBuilder
public class SopShortCourseTask implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "short_course_config_id")
@ApiModelProperty(notes = "短课程任务配置id")
private Integer shortCourseConfigId;
@Column(name = "staff_name")
@ApiModelProperty(notes = "驻店员工姓名")
private String staffName;
@Column(name = "staff_phone")
@ApiModelProperty(notes = "驻店员工手机号")
private String staffPhone;
@Column(name = "superiors")
@ApiModelProperty(notes = "上级姓名")
private String superiors;
@Column(name = "mentors")
@ApiModelProperty(notes = "导师姓名")
private String mentors;
@Column(name = "entry_date")
@ApiModelProperty(notes = "入职日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date entryDate;
@Column(name = "merchant_name")
@ApiModelProperty(notes = "门店名称(多个英文逗号分隔)")
private String merchantName;
@Column(name = "defeat_customer_names")
@ApiModelProperty(notes = "战败客户名称(多个英文逗号分隔)")
private String defeatCustomerNames;
@Column(name = "tag_names")
@ApiModelProperty(notes = "能力短板维度(多个英文逗号分隔)")
private String tagNames;
@Column(name = "check_date")
@ApiModelProperty(notes = "复盘日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date checkDate;
@Column(name = "task_status")
@ApiModelProperty(notes = "完成状态,0-进行中,1-已结束(已结束不代表已完成)")
private Integer taskStatus;
@Column(name = "progress")
@ApiModelProperty(notes = "完成进度(单位%)")
private BigDecimal progress;
@Column(name = "msg_bos_id")
@ApiModelProperty(notes = "pad消息盒子记录id")
private Integer msgBosId;
@Column(name = "complete_time")
@ApiModelProperty(notes = "完成时间(整体维度)")
private Date completeTime;
@Column(name = "deadline")
@ApiModelProperty(notes = "截止完成时间")
private Date deadline;
@Column(name = "punish_type")
@ApiModelProperty(notes = "惩罚方式 0-无惩罚 1-限制录单")
private Byte punishType;
@Column(name = "punish_status")
@ApiModelProperty(notes = "惩罚状态 1-未触发 2-处罚中 3-已结束 4-已解除")
private Byte punishStatus;
@Column(name = "punish_flag")
@ApiModelProperty(notes = "是否启用处罚 0-否 1-是")
private Byte punishFlag;
@Column(name = "bussiness_type")
@ApiModelProperty(notes = "业务类型:2-轻改")
private Integer bussinessType;
@Column(name = "created_by")
private String createdBy;
@Column(name = "created_date")
private Date createdDate;
@Column(name = "updated_by")
private String updatedBy;
@Column(name = "updated_date")
private Date updatedDate;
@Column(name = "deleted_flag")
private String deletedFlag;
}
package cn.com.glsx.dj.mindworkplate.model.sop;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Table(name = "sop_short_course_task_detail")
@Data
@NoArgsConstructor
@ToString
@SuperBuilder
public class SopShortCourseTaskDetail implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "short_course_task_id")
@ApiModelProperty(notes = "短课程任务id")
private Integer shortCourseTaskId;
@Column(name = "check_date")
@ApiModelProperty(notes = "复盘日期")
private Date checkDate;
@Column(name = "badge_recordings_id")
@ApiModelProperty(notes = "录音表id")
private Integer badgeRecordingsId;
@Column(name = "conversation_batch_id")
@ApiModelProperty(notes = "批次表id")
private Integer conversationBatchId;
@Column(name = "customer_info_id")
@ApiModelProperty(notes = "接待记录表id")
private Integer customerInfoId;
@Column(name = "customer_name")
private String customerName;
@Column(name = "customer_phone")
private String customerPhone;
@Column(name = "car_model")
private String carModel;
@Column(name = "merchant_id")
private String merchantId;
@Column(name = "merchant_name")
private String merchantName;
@Column(name = "tag_names")
private String tagNames;
@Column(name = "review_status")
@ApiModelProperty(notes = "复盘状态/考核结果,0-待复盘/待对练,1-已结案/已通过")
private Integer reviewStatus;
@Column(name = "complete_time")
private Date completeTime;
@Column(name = "bussiness_type")
private Integer bussinessType;
@Column(name = "created_by")
private String createdBy;
@Column(name = "created_date")
private Date createdDate;
@Column(name = "updated_by")
private String updatedBy;
@Column(name = "updated_date")
private Date updatedDate;
@Column(name = "deleted_flag")
private String deletedFlag;
}
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseConfigDTO;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseConfigSubmitDTO;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
@ApiService(value = "短课程配置", owner = "pst")
public interface SopShortCourseConfigRemote {
@ApiMethod("短课程配置提交")
@ApiParam(name = "request", notes = "条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("提交结果")
RpcResponse<Boolean> submitConfig(SopShortCourseConfigSubmitDTO request);
@ApiMethod("短课程配置详情(最新一条)")
@ApiResponse("最新配置详情(含人员列表)")
RpcResponse<SopShortCourseConfigDTO> getLatestConfig();
}
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
@ApiService(value = "短课程任务明细", owner = "pst")
public interface SopShortCourseTaskDetailRemote {
@ApiMethod("短课程任务明细完成复盘")
@ApiParam(name = "detailId", notes = "任务明细主键id", dataType = ApiParam.DataTypeEnum.INT, required = true)
@ApiResponse("处理结果")
RpcResponse<Boolean> finishReview(Integer detailId);
}
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseDetailDTO;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseTaskDTO;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
@ApiService(value = "短课程任务", owner = "pst")
public interface SopShortCourseTaskRemote {
@ApiMethod("分页查询短课程任务列表")
@ApiParam(name = "request", notes = "条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("短课程任务列表")
RpcResponse<RpcPagination<SopShortCourseTask>> listShortCourseTask(SopShortCourseTaskDTO request);
@ApiMethod("短课程任务处罚开关修改")
@ApiParam(name = "request", notes = "条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("修改结果")
RpcResponse<Boolean> updatePunishFlag(SopShortCourseTaskDTO request);
@ApiMethod("根据任务id查询短课程任务明细列表")
@ApiParam(name = "request", notes = "条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("短课程任务加明细")
RpcResponse<SopShortCourseDetailDTO> getShortCourseTaskDetail(SopShortCourseTaskDTO request);
@ApiMethod("根据消息盒子id查询短课程任务明细列表")
@ApiParam(name = "request", notes = "条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("轻改短课程任务加明细")
RpcResponse<SopShortCourseDetailDTO> getShortCourseDetailByMsgBoxId(SopShortCourseTaskDTO request);
}
......@@ -8,7 +8,7 @@
</parent>
<groupId>org.example</groupId>
<artifactId>rpc-dj-mindworkplate</artifactId>
<version>5.2.0-SNAPSHOT</version>
<version>5.7.5-SNAPSHOT</version>
<name>rpc-dj-mindworkplate</name>
<packaging>war</packaging>
......@@ -51,7 +51,7 @@
<dependency>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.7.1-SNAPSHOT</version>
<version>5.7.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
......
package cn.com.glsx.dj.mindworkplate.job.sop;
import cn.com.glsx.dj.mindworkplate.service.sop.SopShortCourseTaskService;
import cn.com.glsx.framework.core.util.DateUtils;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@ElasticJobConf(name = "SopShortCourseTaskJob", cron = "0 0 9 * * ?", description = "轻改短课程任务生成定时器", overwrite = true)
public class SopShortCourseTaskJob implements SimpleJob {
@Autowired
private SopShortCourseTaskService sopShortCourseTaskService;
@Override
public void execute(ShardingContext shardingContext) {
try {
String param = shardingContext.getJobParameter();
String checkDate = DateUtils.getYesterdayDate();
if (StringUtils.isNotBlank(param)) {
checkDate = param;
}
log.info("轻改短课程任务生成开始执行, checkDate: {}", checkDate);
sopShortCourseTaskService.generateTasks(checkDate);
log.info("轻改短课程任务生成结束执行, checkDate: {}", checkDate);
} catch (Exception e) {
log.error("轻改短课程任务生成执行异常", e);
}
}
}
package cn.com.glsx.dj.mindworkplate.job.sop;
import cn.com.glsx.dj.mindworkplate.service.sop.SopShortCourseTaskService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 轻改短课程任务超时状态检查
*/
@Slf4j
@ElasticJobConf(name = "SopShortCourseTaskStatusJob", cron = "0 0/10 * * * ?", description = "轻改短课程任务超时状态检查定时器", overwrite = true)
public class SopShortCourseTaskStatusJob implements SimpleJob {
@Autowired
private SopShortCourseTaskService sopShortCourseTaskService;
@Override
public void execute(ShardingContext shardingContext) {
try {
log.info("轻改短课程任务超时状态检查开始执行");
int affected = sopShortCourseTaskService.handleOverdueTaskStatus();
log.info("轻改短课程任务超时状态检查结束执行, affected: {}", affected);
} catch (Exception e) {
log.error("轻改短课程任务超时状态检查执行异常", e);
}
}
}
......@@ -85,4 +85,6 @@ public interface PadMessageBoxMapper extends OreMapper<PadMessageBox> {
* @return 按模块类型分组的未读消息数量列表
*/
List<ModuleUnreadCountDTO> listUnreadMessageCountByModuleType(ModuleUnreadQueryDTO moduleUnreadQueryDTO);
List<ScriptRecordPadPushDTO> listNewShortCourseBoxMessage(ScriptSearchDTO request);
}
\ No newline at end of file
package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseConfigDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface SopShortCourseConfigDetailMapper extends OreMapper<SopShortCourseConfigDetail> {
List<SopShortCourseConfigDetail> listByConfigId(@Param("configId") Integer configId);
}
package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface SopShortCourseConfigMapper extends OreMapper<SopShortCourseConfig> {
SopShortCourseConfig getLatestConfig(@Param("bussinessType") Integer bussinessType);
}
package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTaskDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface SopShortCourseTaskDetailMapper extends OreMapper<SopShortCourseTaskDetail> {
/**
* 统计任务下明细总数
*/
int countByTaskId(@Param("taskId") Integer taskId);
/**
* 统计任务下已完成复盘的明细数
*/
int countReviewedByTaskId(@Param("taskId") Integer taskId);
/**
* 根据短课程任务id查询明细列表
*/
List<SopShortCourseTaskDetail> listByTaskId(@Param("taskId") Integer taskId);
}
package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseRecordingDTO;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.Date;
import java.util.List;
@Mapper
public interface SopShortCourseTaskMapper extends OreMapper<SopShortCourseTask> {
/**
* 查询该手机号该复盘日期是否已生成了任务
*/
Integer countByPhoneAndDate(@Param("staffPhone") String staffPhone, @Param("checkDate") String checkDate, @Param("bussinessType") Integer bussinessType);
/**
* 根据手机号和复盘日期获取战败的客户录音明细(轻改短课程)
* @param staffPhone 手机号
* @param startTime 起始时间
* @param endTime 结束时间
* @return 战败客户录音明细
*/
List<SopShortCourseRecordingDTO> listRecordingsByPhoneAndDate(@Param("staffPhone") String staffPhone,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
/**
* 查询指定时间范围内成功下单的客户手机号集合
*/
List<String> listSuccessOrderCustomerPhones(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* 按商户号查询门店名称
*/
String selectMerchantNameByMerchantId(@Param("merchantId") String merchantId);
/**
* 将超时未完成任务置为已结束,并触发处罚状态
* @return 影响行数
*/
int updateOverdueTaskStatus(@Param("now") Date now, @Param("bussinessType") Integer bussinessType);
/**
* 根据消息盒子id查询短课程任务
*/
SopShortCourseTask getByMsgBosId(@Param("msgBosId") Integer msgBosId);
}
package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseTaskDTO;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SopShortCourseTaskQueryMapper {
List<SopShortCourseTask> listShortCourseTask(SopShortCourseTaskDTO request);
}
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseConfigDTO;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseConfigSubmitDTO;
import cn.com.glsx.dj.mindworkplate.service.sop.SopShortCourseConfigService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@DubboService(protocol = "dubbo")
public class SopShortCourseConfigRemoteImpl implements SopShortCourseConfigRemote {
@Autowired
private SopShortCourseConfigService sopShortCourseConfigService;
@Override
public RpcResponse<Boolean> submitConfig(SopShortCourseConfigSubmitDTO request) {
try {
return RpcResponse.success(sopShortCourseConfigService.submitConfig(request));
} catch (Exception e) {
log.error("接口异常", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<SopShortCourseConfigDTO> getLatestConfig() {
try {
return RpcResponse.success(sopShortCourseConfigService.getLatestConfig());
} catch (Exception e) {
log.error("接口异常", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
}
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.dj.mindworkplate.service.sop.SopShortCourseTaskDetailService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@DubboService(protocol = "dubbo")
public class SopShortCourseTaskDetailRemoteImpl implements SopShortCourseTaskDetailRemote {
@Autowired
private SopShortCourseTaskDetailService sopShortCourseTaskDetailService;
@Override
public RpcResponse<Boolean> finishReview(Integer detailId) {
try {
return RpcResponse.success(sopShortCourseTaskDetailService.finishReview(detailId));
} catch (Exception e) {
log.error("接口异常", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
}
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseDetailDTO;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseTaskDTO;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask;
import cn.com.glsx.dj.mindworkplate.service.script.PadMessageBoxService;
import cn.com.glsx.dj.mindworkplate.service.sop.SopShortCourseTaskQueryService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@DubboService(protocol = "dubbo")
public class SopShortCourseTaskRemoteImpl implements SopShortCourseTaskRemote {
@Autowired
private SopShortCourseTaskQueryService sopShortCourseTaskQueryService;
@Autowired
private PadMessageBoxService padMessageBoxService;
@Override
public RpcResponse<RpcPagination<SopShortCourseTask>> listShortCourseTask(SopShortCourseTaskDTO request) {
try {
Page<SopShortCourseTask> page = sopShortCourseTaskQueryService.listShortCourseTask(request);
return RpcResponse.success(RpcPagination.copyPage(page));
} catch (RpcServiceException e) {
log.error("查询短课程任务列表失败", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("查询短课程任务列表系统异常", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<Boolean> updatePunishFlag(SopShortCourseTaskDTO request) {
try {
return RpcResponse.success(sopShortCourseTaskQueryService.updatePunishFlag(request.getId(), request.getPunishFlag()));
} catch (RpcServiceException e) {
log.error("短课程任务处罚开关修改失败", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("短课程任务处罚开关修改系统异常", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<SopShortCourseDetailDTO> getShortCourseTaskDetail(SopShortCourseTaskDTO request) {
try {
return RpcResponse.success(sopShortCourseTaskQueryService.getShortCourseTaskDetail(request.getId()));
} catch (RpcServiceException e) {
log.error("查询短课程任务明细列表失败", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("查询短课程任务明细列表系统异常", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<SopShortCourseDetailDTO> getShortCourseDetailByMsgBoxId(SopShortCourseTaskDTO request) {
try {
padMessageBoxService.readMessageUpdateBox(request.getMsgBoxId());
return RpcResponse.success(sopShortCourseTaskQueryService.getShortCourseDetailByMsgBoxId(request.getMsgBoxId()));
} catch (RpcServiceException e) {
log.error("根据消息盒子id查询短课程任务明细列表失败", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("根据消息盒子id查询短课程任务明细列表系统异常", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
}
......@@ -436,6 +436,11 @@ public class PadMessageBoxService {
PadMessageSummaryDetail excellentCasePolicyMessage = findCourseMessage(request);
if (excellentCasePolicyMessage != null) list.add(excellentCasePolicyMessage);
//9.轻改短课程学习
request.setModuleType(ModuleTypeEnums.SHORT_COURSE.getCode());
PadMessageSummaryDetail shortCourseMessage = findCourseMessage(request);
if (shortCourseMessage != null) list.add(shortCourseMessage);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
} else {
......@@ -595,6 +600,9 @@ public class PadMessageBoxService {
} else if(Objects.equals(ModuleTypeEnums.EXCELLENT_CASE_POLICY.getCode(), request.getModuleType())) {
//优秀案例分享策略
padMessageBoxMapper.listExcellentCaseBoxMessage(request);
} else if(Objects.equals(ModuleTypeEnums.SHORT_COURSE.getCode(), request.getModuleType())) {
//轻改短课程学习
padMessageBoxMapper.listNewShortCourseBoxMessage(request);
} else {
throw new RpcServiceException("消息类型错误");
}
......
package cn.com.glsx.dj.mindworkplate.service.sop;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseConfigDTO;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseConfigDetailDTO;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseConfigSubmitDTO;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopBusinessTypeEnum;
import cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseConfigDetailMapper;
import cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseConfigMapper;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseConfig;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseConfigDetail;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.DateUtils;
import cn.com.glsx.framework.core.util.RpcAssert;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j
@Service
public class SopShortCourseConfigService {
@Autowired
private SopShortCourseConfigMapper sopShortCourseConfigMapper;
@Autowired
private SopShortCourseConfigDetailMapper sopShortCourseConfigDetailMapper;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public Boolean submitConfig(SopShortCourseConfigSubmitDTO request) {
try {
RpcAssert.assertNotNull(request, DefaultErrorEnum.PARAMETER_NULL, "request不能为空");
RpcAssert.assertNotNull(request.getOpenFlag(), DefaultErrorEnum.PARAMETER_NULL, "open_flag不能为空");
RpcAssert.assertNotNull(request.getFinishTime(), DefaultErrorEnum.PARAMETER_NULL, "finish_time不能为空");
RpcAssert.assertNotNull(request.getPunishType(), DefaultErrorEnum.PARAMETER_NULL, "punish_type不能为空");
RpcAssert.assertNotNull(request.getEffectiveType(), DefaultErrorEnum.PARAMETER_NULL, "effective_type不能为空");
RpcAssert.assertNotEmpty(request.getStaffList(), DefaultErrorEnum.PARAMETER_NULL, "staffList不能为空");
Date now = new Date();
String operator = StringUtils.isBlank(request.getCreatedBy()) ? "system" : request.getCreatedBy();
SopShortCourseConfig config = new SopShortCourseConfig();
config.setOpenFlag(request.getOpenFlag());
config.setFinishTime(request.getFinishTime());
config.setPunishType(request.getPunishType());
config.setEffectiveType(request.getEffectiveType());
config.setEffectiveTime(buildEffectiveTime(request.getEffectiveType(), now));
config.setBussinessType(2);
config.setCreatedBy(operator);
config.setCreatedDate(now);
config.setUpdatedBy(operator);
config.setUpdatedDate(now);
config.setDeletedFlag("N");
sopShortCourseConfigMapper.insert(config);
if (config.getId() == null) {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "插入配置失败,未返回id");
}
List<SopShortCourseConfigDetail> details = request.getStaffList().stream()
.filter(Objects::nonNull)
.filter(p -> StringUtils.isNotBlank(p.getStaffPhone()))
.map(p -> {
SopShortCourseConfigDetail d = new SopShortCourseConfigDetail();
d.setShortCourseConfigId(config.getId());
d.setStaffPhone(p.getStaffPhone());
d.setStaffName(p.getStaffName());
d.setCreatedBy(operator);
d.setCreatedDate(now);
d.setUpdatedBy(operator);
d.setUpdatedDate(now);
d.setDeletedFlag("N");
return d;
})
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(details)) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "staffList中员工手机号不能为空");
}
sopShortCourseConfigDetailMapper.insertList(details);
return true;
} catch (RpcServiceException e) {
log.error("提交轻改短课程配置异常", e);
throw e;
} catch (Exception e) {
log.error("提交轻改短课程配置系统异常", e);
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
public SopShortCourseConfigDTO getLatestConfig() {
Integer bussinessType = SopBusinessTypeEnum.LIGHT_MODIFICATION.getValue();
SopShortCourseConfig latest = sopShortCourseConfigMapper.getLatestConfig(bussinessType);
if (latest == null) {
return null;
}
List<SopShortCourseConfigDetail> details = sopShortCourseConfigDetailMapper.listByConfigId(latest.getId());
List<SopShortCourseConfigDetailDTO> staffList = CollectionUtils.isEmpty(details) ? null :
details.stream()
.map(p -> {
SopShortCourseConfigDetailDTO dto = new SopShortCourseConfigDetailDTO();
dto.setStaffName(p.getStaffName());
dto.setStaffPhone(p.getStaffPhone());
return dto;
})
.collect(Collectors.toList());
SopShortCourseConfigDTO dto = SopShortCourseConfigDTO.builder().build();
dto.setId(latest.getId());
dto.setOpenFlag(latest.getOpenFlag());
dto.setFinishTime(latest.getFinishTime());
dto.setPunishType(latest.getPunishType());
dto.setEffectiveType(latest.getEffectiveType());
dto.setEffectiveTime(latest.getEffectiveTime());
dto.setBussinessType(latest.getBussinessType());
dto.setCreatedBy(latest.getCreatedBy());
dto.setCreatedDate(latest.getCreatedDate());
dto.setUpdatedBy(latest.getUpdatedBy());
dto.setUpdatedDate(latest.getUpdatedDate());
dto.setDeletedFlag(latest.getDeletedFlag());
dto.setStaffList(staffList);
return dto;
}
private Date buildEffectiveTime(Byte effectiveType, Date now) {
if (Objects.isNull(effectiveType)) {
return now;
}
// 0: 立即生效;1:隔日生效
if (Objects.equals(effectiveType, (byte) 1)) {
return DateUtils.SomeDay_AfterDate(new Date(), 1);
}
return now;
}
}
package cn.com.glsx.dj.mindworkplate.service.sop;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopCompleteStatusEnum;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopPunishStatusEnum;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopReviewStatusEnum;
import cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskDetailMapper;
import cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskMapper;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTaskDetail;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
@Slf4j
@Service
public class SopShortCourseTaskDetailService {
@Autowired
private SopShortCourseTaskDetailMapper sopShortCourseTaskDetailMapper;
@Autowired
private SopShortCourseTaskMapper sopShortCourseTaskMapper;
/**
* 将指定明细置为已复盘,并同步更新主任务进度/状态。
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public boolean finishReview(Integer detailId) {
if (detailId == null) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "detailId不能为空");
}
Date now = new Date();
SopShortCourseTaskDetail detail = sopShortCourseTaskDetailMapper.selectByPrimaryKey(detailId);
if (detail == null) {
throw new RpcServiceException(DefaultErrorEnum.DATA_NULL, "任务明细不存在");
}
Integer taskId = detail.getShortCourseTaskId();
if (taskId == null) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "任务明细缺少taskId");
}
// 更新明细为已结案
SopShortCourseTaskDetail updDetail = new SopShortCourseTaskDetail();
updDetail.setId(detailId);
updDetail.setReviewStatus(SopReviewStatusEnum.CLOSED.getValue());
updDetail.setCompleteTime(now);
updDetail.setUpdatedDate(now);
int updCnt = sopShortCourseTaskDetailMapper.updateByPrimaryKeySelective(updDetail);
if (updCnt <= 0) {
log.warn("短课程明细完成复盘:更新明细失败 detailId: {}", detailId);
return false;
}
// 统计任务进度
int total = sopShortCourseTaskDetailMapper.countByTaskId(taskId);
int done = sopShortCourseTaskDetailMapper.countReviewedByTaskId(taskId);
BigDecimal progress = calcProgress(done, total);
// 更新主任务
SopShortCourseTask task = sopShortCourseTaskMapper.selectByPrimaryKey(taskId);
if (task == null) {
log.warn("短课程明细完成复盘:主任务不存在 taskId: {}, detailId: {}", taskId, detailId);
return true;
}
SopShortCourseTask updTask = new SopShortCourseTask();
updTask.setId(taskId);
updTask.setProgress(progress);
updTask.setUpdatedDate(now);
if (total > 0 && done >= total) {
updTask.setTaskStatus(SopCompleteStatusEnum.ENDED.getValue());
updTask.setCompleteTime(now);
updTask.setPunishStatus(SopPunishStatusEnum.FINISHED.getValue().byteValue());
}
sopShortCourseTaskMapper.updateByPrimaryKeySelective(updTask);
return true;
}
private BigDecimal calcProgress(int done, int total) {
if (total <= 0 || done <= 0) {
return BigDecimal.ZERO.setScale(2, RoundingMode.DOWN);
}
if (done >= total) {
return new BigDecimal("100.00");
}
BigDecimal ratio = new BigDecimal(done).divide(new BigDecimal(total), 4, RoundingMode.HALF_UP);
return ratio.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
}
}
package cn.com.glsx.dj.mindworkplate.service.sop;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseDetailDTO;
import cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseTaskDTO;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopCompleteStatusEnum;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopPunishFlagEnum;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopPunishStatusEnum;
import cn.com.glsx.dj.mindworkplate.enums.sop.SopPunishTypeEnum;
import cn.com.glsx.dj.mindworkplate.mapper.RecordingCheckResultMapper;
import cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskDetailMapper;
import cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskMapper;
import cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskQueryMapper;
import cn.com.glsx.dj.mindworkplate.model.RecordingCheckResult;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask;
import cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTaskDetail;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
@Slf4j
@Service
public class SopShortCourseTaskQueryService {
@Autowired
private SopShortCourseTaskQueryMapper sopShortCourseTaskQueryMapper;
@Autowired
private SopShortCourseTaskMapper sopShortCourseTaskMapper;
@Autowired
private SopShortCourseTaskDetailMapper sopShortCourseTaskDetailMapper;
@Autowired
private RecordingCheckResultMapper recordingCheckResultMapper;
public Page<SopShortCourseTask> listShortCourseTask(SopShortCourseTaskDTO request) {
Page<SopShortCourseTask> page = PageHelper.startPage(request.getPageNum(), request.getPageSize());
sopShortCourseTaskQueryMapper.listShortCourseTask(request);
return page;
}
/**
* 根据任务id查询任务+明细
*/
public SopShortCourseDetailDTO getShortCourseTaskDetail(Integer taskId) {
if (taskId == null) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "taskId不能为空");
}
SopShortCourseTask task = sopShortCourseTaskMapper.selectByPrimaryKey(taskId);
if (task == null) {
throw new RpcServiceException(DefaultErrorEnum.DATA_NULL, "短课程任务不存在");
}
List<SopShortCourseTaskDetail> detailList = sopShortCourseTaskDetailMapper.listByTaskId(taskId);
SopShortCourseDetailDTO dto = new SopShortCourseDetailDTO();
BeanUtils.copyProperties(task, dto);
dto.setDetailList(detailList);
return dto;
}
/**
* 根据消息盒子id查询任务+明细
*/
public SopShortCourseDetailDTO getShortCourseDetailByMsgBoxId(Integer msgBoxId) {
if (msgBoxId == null) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "msgBoxId不能为空");
}
SopShortCourseTask task = sopShortCourseTaskMapper.getByMsgBosId(msgBoxId);
if (task == null || task.getId() == null) {
throw new RpcServiceException(DefaultErrorEnum.DATA_NULL, "短课程任务不存在");
}
List<SopShortCourseTaskDetail> detailList = sopShortCourseTaskDetailMapper.listByTaskId(task.getId());
// 雷达图:取当前待复盘清单下所有客户在各维度的数学平均分
Map<String, BigDecimal> tagSumMap = new LinkedHashMap<>();
Map<String, Integer> tagCntMap = new LinkedHashMap<>();
if (CollectionUtils.isNotEmpty(detailList)) {
for (SopShortCourseTaskDetail taskDetail : detailList) {
Integer batchId = taskDetail.getConversationBatchId();
if (batchId == null) {
continue;
}
// 查询该批次质检结果
List<RecordingCheckResult> checkResultList = recordingCheckResultMapper.findByBatchId(batchId);
if (CollectionUtils.isEmpty(checkResultList)) {
continue;
}
for (RecordingCheckResult r : checkResultList) {
String tagGroupName = r.getTagGroupName();
BigDecimal score = r.getScore();
if (tagGroupName == null || score == null) {
continue;
}
tagSumMap.put(tagGroupName, tagSumMap.getOrDefault(tagGroupName, BigDecimal.ZERO).add(score));
tagCntMap.put(tagGroupName, tagCntMap.getOrDefault(tagGroupName, 0) + 1);
}
}
}
SopShortCourseDetailDTO dto = new SopShortCourseDetailDTO();
BeanUtils.copyProperties(task, dto);
dto.setDetailList(detailList);
// 按维度顺序赋值
List<String> defeatReviewTag = new ArrayList<>(tagSumMap.keySet());
List<Integer> defeatReviewValue = new ArrayList<>(defeatReviewTag.size());
for (String tag : defeatReviewTag) {
BigDecimal sum = tagSumMap.get(tag);
Integer cnt = tagCntMap.get(tag);
if (sum == null || cnt == null || cnt <= 0) {
defeatReviewValue.add(0);
continue;
}
int avg = sum.divide(new BigDecimal(cnt), 0, RoundingMode.HALF_UP).intValue();
defeatReviewValue.add(avg);
}
dto.setDefeatReviewTag(defeatReviewTag);
dto.setDefeatReviewValue(defeatReviewValue);
return dto;
}
/**
* 按条件允许修改任务处罚开关及处罚状态
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public boolean updatePunishFlag(Integer taskId, Integer punishFlag) {
if (taskId == null) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "taskId不能为空");
}
if (punishFlag == null) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "punishFlag不能为空");
}
SopShortCourseTask task = sopShortCourseTaskMapper.selectByPrimaryKey(taskId);
if (!Objects.equals(task.getTaskStatus(), SopCompleteStatusEnum.ENDED.getValue())
|| task.getCompleteTime() != null
|| !Objects.equals(task.getPunishType(), SopPunishTypeEnum.LIMIT_ORDER.getValue())) {
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "当前任务不允许修改处罚开关");
}
Date now = new Date();
SopShortCourseTask upd = new SopShortCourseTask();
upd.setId(taskId);
upd.setPunishFlag(punishFlag.byteValue());
upd.setUpdatedDate(now);
if (!Objects.equals(task.getPunishStatus(), SopPunishStatusEnum.FINISHED.getValue().byteValue())) {
if (Objects.equals(punishFlag.byteValue(), SopPunishFlagEnum.YES.getValue())) {
upd.setPunishStatus(SopPunishStatusEnum.PENALIZING.getValue().byteValue());
} else {
upd.setPunishStatus(SopPunishStatusEnum.LIFTED.getValue().byteValue());
}
}
return sopShortCourseTaskMapper.updateByPrimaryKeySelective(upd) > 0;
}
}
......@@ -445,4 +445,28 @@
</if>
GROUP BY module_type
</select>
<select id="listNewShortCourseBoxMessage" resultMap="ScriptRecordPadPushDTOMap">
select
pmb.id,
pmb.msg_title as title,
pmb.created_time as created_time,
pmb.status,
pmb.module_type
from pad_message_box pmb
<where>
pmb.del_flag = 'N'
and pmb.module_type = 9
<if test="phone != null and phone != ''">
and pmb.phone = #{phone}
</if>
<if test="businessType != null">
and pmb.business_type = #{businessType}
</if>
<if test="status != null">
and pmb.status = #{status}
</if>
</where>
order by pmb.status asc, pmb.created_time desc
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseConfigDetailMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseConfigDetail" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="short_course_config_id" property="shortCourseConfigId" jdbcType="INTEGER" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<select id="listByConfigId" resultMap="BaseResultMap">
select * from sop_short_course_config_detail
where deleted_flag = 'N' and short_course_config_id = #{configId}
order by id asc
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseConfigMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseConfig" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="open_flag" property="openFlag" jdbcType="TINYINT" />
<result column="finish_time" property="finishTime" jdbcType="INTEGER" />
<result column="punish_type" property="punishType" jdbcType="TINYINT" />
<result column="effective_type" property="effectiveType" jdbcType="TINYINT" />
<result column="effective_time" property="effectiveTime" jdbcType="TIMESTAMP" />
<result column="bussiness_type" property="bussinessType" jdbcType="INTEGER" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<select id="getLatestConfig" resultMap="BaseResultMap">
select * from sop_short_course_config
where bussiness_type = #{bussinessType} and deleted_flag = 'N'
order by created_date desc limit 1
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskDetailMapper" >
<select id="countByTaskId" resultType="int">
select count(1)
from sop_short_course_task_detail
where deleted_flag = 'N'
and short_course_task_id = #{taskId}
</select>
<select id="countReviewedByTaskId" resultType="int">
select count(1)
from sop_short_course_task_detail
where deleted_flag = 'N'
and short_course_task_id = #{taskId}
and review_status = 1
</select>
<select id="listByTaskId" resultType="cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTaskDetail">
select
id,
short_course_task_id as shortCourseTaskId,
check_date as checkDate,
badge_recordings_id as badgeRecordingsId,
conversation_batch_id as conversationBatchId,
customer_info_id as customerInfoId,
customer_name as customerName,
customer_phone as customerPhone,
car_model as carModel,
merchant_id as merchantId,
merchant_name as merchantName,
tag_names as tagNames,
review_status as reviewStatus,
complete_time as completeTime,
bussiness_type as bussinessType,
created_by as createdBy,
created_date as createdDate,
updated_by as updatedBy,
updated_date as updatedDate,
deleted_flag as deletedFlag
from sop_short_course_task_detail
where deleted_flag = 'N'
and short_course_task_id = #{taskId}
order by id desc
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskMapper" >
<select id="countByPhoneAndDate" resultType="java.lang.Integer">
select count(1)
from sop_short_course_task
where deleted_flag = 'N'
and bussiness_type = #{bussinessType}
and staff_phone = #{staffPhone}
and check_date = #{checkDate}
</select>
<resultMap id="RecordingMap" type="cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseRecordingDTO">
<result column="badgeRecordingsId" property="badgeRecordingsId" />
<result column="conversationBatchId" property="conversationBatchId" />
<result column="customerInfoId" property="customerInfoId" />
<result column="customerPhone" property="customerPhone" />
</resultMap>
<select id="listRecordingsByPhoneAndDate" resultMap="RecordingMap">
select
t2.id as badgeRecordingsId,
t3.id as conversationBatchId,
t1.id as customerInfoId,
t1.phone_number as customerPhone
from reception_customer_info t1
left join inspection_badge_recordings t2 on t2.reception_id = t1.id
left join inspection_conversation_batch t3 on t3.record_id = t2.id
left join inspection_employee_badge t4 on t2.badge_id =t4.badge_id
where t1.deleted_flag = 'N'
and t2.check_type = 2
and t4.phone_number = #{staffPhone}
and t1.reception_start_time between #{startTime} and #{endTime}
order by t1.reception_start_time desc, t3.id desc
</select>
<select id="listSuccessOrderCustomerPhones" resultType="java.lang.String">
select distinct dclgoc.customer_phone
from dj_car_life_goods_order dclgo
left join dj_car_life_goods_sub_order dclgso
on dclgo.order_code = dclgso.order_code and dclgso.deleted_flag = 'N'
left join dj_car_life_goods_order_customer dclgoc
on dclgoc.order_code = dclgo.order_code and dclgoc.deleted_flag = 'N'
left join dj_car_life_pay_order dclpo
on dclpo.order_code = dclgo.order_code and dclpo.deleted_flag = 'N'
where dclgo.deleted_flag = 'N'
and dclgo.scene_type = 1
and dclgo.status in (4, 6)
and dclgo.upgrade_flag = 'Y'
and dclpo.success_date between #{startTime} and #{endTime}
</select>
<select id="selectMerchantNameByMerchantId" resultType="java.lang.String">
select sm.merchant_name
from dj_car_life_service_merchant sm
where sm.deleted_flag = 'N'
and sm.merchant_id = #{merchantId}
limit 1
</select>
<update id="updateOverdueTaskStatus">
update sop_short_course_task
set task_status = 1,
punish_status = 2,
updated_date = #{now}
where task_status = 0
and punish_status = 1
and bussiness_type = #{bussinessType}
and deleted_flag = 'N'
and deadline is not null
and deadline &lt;= #{now}
</update>
<select id="getByMsgBosId" resultType="cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask">
select *
from sop_short_course_task
where deleted_flag = 'N'
and msg_bos_id = #{msgBosId}
limit 1
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.mindworkplate.mapper.SopShortCourseTaskQueryMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.sop.SopShortCourseTask" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="short_course_config_id" property="shortCourseConfigId" jdbcType="INTEGER" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="superiors" property="superiors" jdbcType="VARCHAR" />
<result column="mentors" property="mentors" jdbcType="VARCHAR" />
<result column="entry_date" property="entryDate" jdbcType="DATE" />
<result column="merchant_name" property="merchantName" jdbcType="LONGVARCHAR" />
<result column="defeat_customer_names" property="defeatCustomerNames" jdbcType="LONGVARCHAR" />
<result column="tag_names" property="tagNames" jdbcType="LONGVARCHAR" />
<result column="check_date" property="checkDate" jdbcType="DATE" />
<result column="task_status" property="taskStatus" jdbcType="INTEGER" />
<result column="progress" property="progress" jdbcType="DECIMAL" />
<result column="msg_bos_id" property="msgBosId" jdbcType="INTEGER" />
<result column="complete_time" property="completeTime" jdbcType="TIMESTAMP" />
<result column="deadline" property="deadline" jdbcType="TIMESTAMP" />
<result column="punish_type" property="punishType" jdbcType="TINYINT" />
<result column="punish_status" property="punishStatus" jdbcType="TINYINT" />
<result column="punish_flag" property="punishFlag" jdbcType="TINYINT" />
<result column="bussiness_type" property="bussinessType" jdbcType="INTEGER" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<select id="listShortCourseTask" parameterType="cn.com.glsx.dj.mindworkplate.dto.sop.SopShortCourseTaskDTO" resultMap="BaseResultMap">
select
id, short_course_config_id, staff_name, staff_phone, superiors, mentors, entry_date,
merchant_name, defeat_customer_names, tag_names, check_date,
task_status, progress, msg_bos_id, complete_time, deadline,
punish_type, punish_status, punish_flag, bussiness_type,
created_by, created_date, updated_by, updated_date, deleted_flag
from sop_short_course_task
<where>
deleted_flag = 'N'
<if test="staffName != null and staffName != ''">
and staff_name like concat('%', #{staffName}, '%')
</if>
<if test="staffPhone != null and staffPhone != ''">
and staff_phone = #{staffPhone}
</if>
<if test="merchantName != null and merchantName != ''">
and merchant_name like concat('%', #{merchantName}, '%')
</if>
<if test="taskStatus != null">
and task_status = #{taskStatus}
</if>
<if test="checkStartTime != null">
and check_date &gt;= #{checkStartTime}
</if>
<if test="checkEndTime != null">
and check_date &lt;= #{checkEndTime}
</if>
<if test="finishStartTime != null">
and complete_time &gt;= #{finishStartTime}
</if>
<if test="finishEndTime != null">
and complete_time &lt;= #{finishEndTime}
</if>
</where>
order by created_date desc
</select>
</mapper>
  • @wangxw1
    commented
    Master

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

    1. 循环中执行数据库查询(N+1 查询问题),存在严重性能瓶颈

    • 问题描述:在 SopShortCourseTaskQueryService.getShortCourseDetailByMsgBoxId 方法以及 SopShortCourseTaskService.generateTasks 方法(内部调用 buildTaskDetail)中,存在在 for 循环里高频调用 Mapper 进行单条记录查询(如 recordingCheckResultMapper.findByBatchId、badgeRecordingsMapper.selectByPrimaryKey 等)。
    • 影响分析:这是典型的 N+1 查询问题。随着数据量的增加,会导致大量的数据库网络 I/O 和连接开销,严重拖慢接口响应速度和定时任务的执行效率,高并发下极易耗尽数据库连接池。
    • 优化建议:将循环内的单条查询重构为批量查询。先遍历集合提取所有的 ID 列表,使用 MyBatis 的 <foreach> 标签通过 IN 语句一次性查询出所有数据,然后在内存中转化为 Map<Integer, Object> 进行匹配装配。

    2. 并发操作可能导致任务进度和状态更新丢失

    • 问题描述:在 SopShortCourseTaskDetailService.finishReview 方法中,处理复盘完成逻辑时,先通过 countReviewedByTaskId 统计已完成数量,然后计算进度并执行 updateByPrimaryKeySelective 更新主任务状态。
    • 影响分析:如果同一个短课程任务下的多个明细在同一时刻被并发复盘,会产生竞态条件(Race Condition)。多个线程可能读取到相同的已完成数量,导致最后更新到主表的进度被相互覆盖,最终可能出现所有明细都已复盘但主任务进度未达到 100% 且未变更为“已结束”状态的 Bug。
    • 优化建议:建议引入并发控制机制。可以使用基于 taskId 的分布式锁(如 Redis 分布式锁)来保证同一任务的复盘操作串行化;或者在 SopShortCourseTask 表中引入乐观锁(如 version 字段)并在更新时进行校验重试。

    3. 代码中存在较多魔法值(Magic Number),未使用已定义的枚举

    • 问题描述:虽然代码中定义了丰富的枚举类(如 SopBusinessTypeEnum、ModuleTypeEnums 等),但在业务逻辑实现中仍有部分地方直接使用了硬编码的魔法值。例如 SopShortCourseConfigService 中的 config.setBussinessType(2);,以及 PadMessageBoxMapper.xml 中的 pmb.module_type = 9。
    • 影响分析:降低了代码的可读性和可维护性。如果未来业务类型扩展或代码重构,极易遗漏这些硬编码的数字,导致潜在的逻辑错误。
    • 优化建议:将代码和 XML 中的魔法值替换为对应的枚举常量或常量引用。例如,将 2 替换为 SopBusinessTypeEnum.LIGHT_MODIFICATION.getValue()。

    二、评分明细

    • 功能实现的正确性与健壮性(35/40分):业务逻辑基本完整,未发现 MyBatis 子查询和 Dubbo 接口参数违规变更。但并发场景下主任务进度更新存在竞态风险,扣 5 分。
    • 安全性与潜在风险(30/30分):未发现 SQL 注入、越权、XSS 等明显安全漏洞。
    • 最佳实践与可维护性(15/20分):代码结构清晰,使用了 Lombok 简化代码。但部分代码未充分利用枚举,存在硬编码魔法值,影响可维护性,扣 5 分。
    • 性能与资源利用(0/5分):多处核心业务逻辑中存在在 for 循环中执行 SQL 查询的问题,属于严重的性能反模式,扣 5 分。
    • 提交信息质量(3/5分):Commit 信息“轻改短课程需求 (by pangst)”描述了需求背景,但缺乏对具体技术实现和变更模块的详细说明。

    总分:83分

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