From b3cea991599ce4acb0aeac706150526cc148830a Mon Sep 17 00:00:00 2001 From: zhangchenbiao Date: Mon, 25 Mar 2024 15:38:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=A2=E8=AF=95/=E9=9D=A2=E8=B0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cool/store/enums/ErrorCodeEnum.java | 30 +++--- .../cool/store/enums/InterviewTypeEnum.java | 13 +++ .../cool/store/enums/WorkflowStageEnum.java | 12 +-- .../java/com/cool/store/dao/LineInfoDAO.java | 17 ++++ .../store/service/LineInterviewService.java | 2 +- .../impl/LineInterviewServiceImpl.java | 96 +++++++++---------- 6 files changed, 100 insertions(+), 70 deletions(-) diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java index dfd1268ab..cfbc8a065 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java @@ -78,31 +78,31 @@ public enum ErrorCodeEnum { TIME_OCCUPIED(500018, "预约时间被占用", null), - INTERVIEW_ENTER_FAIL(1021101, "进入面试间失败", null), + INTERVIEW_ENTER_FAIL(1021101, "进入面审间失败", null), DINGDING_USER_NOT_EXIST(1021102, "用户钉钉信息不存在,无法发起资质审核!", null), - INTERVIEW_NOT_EXIST(1021103, "面试信息不存在!", null), - INTERVIEW_AND_PARTNER_ID_IS_NULL(1021104, "加盟商用户ID&线索ID和面试官ID不能同时为空!", null), - INTERVIEW_PLAN_IS_NULL(1021105, "未查询到相关面试安排!", null), + INTERVIEW_NOT_EXIST(1021103, "面审信息不存在!", null), + INTERVIEW_AND_PARTNER_ID_IS_NULL(1021104, "加盟商用户ID&线索ID和面审官ID不能同时为空!", null), + INTERVIEW_PLAN_IS_NULL(1021105, "未查询到相关面审安排!", null), DATE_PARAMS_IS_ERROR(1021106, "日期参数错误!", null), - INTERVIEW_PLAN_NOT_EXIST(1021107, "面试计划不存在!", null), - FEISHU_DELETE_SCHEDULE_ERROR(1021108, "删除原面试安排失败!", null), - CREATE_CALENDAR_EVENT_FAIL(1021109, "创建面试安排失败!", null), - FEISHU_UPDATE_SCHEDULE_ERROR(1021110, "修改面试安排失败!", null), - INTERVIEW_STATUS_ERROR(1021111, "当前面试状态不允许该操作!", null), - INTERVIEW_PLAN_ALREADY_EXIST(1021112, "面试计划已存在,请勿重复申请!", null), + INTERVIEW_PLAN_NOT_EXIST(1021107, "面审计划不存在!", null), + FEISHU_DELETE_SCHEDULE_ERROR(1021108, "删除原面审安排失败!", null), + CREATE_CALENDAR_EVENT_FAIL(1021109, "创建面审安排失败!", null), + FEISHU_UPDATE_SCHEDULE_ERROR(1021110, "修改面审安排失败!", null), + INTERVIEW_STATUS_ERROR(1021111, "当前面审状态不允许该操作!", null), + INTERVIEW_PLAN_ALREADY_EXIST(1021112, "面审计划已存在,请勿重复申请!", null), INTERVIEW_LINE_ID_IS_NULL(1021113, "线索id为空!", null), - INTERVIEW_INTERVIEW_TIME_IS_UNUSABLE(1021114, "当前预约时间不可用,请和线索用户协商其他时间后确定预约时间\n面试人:{0} 手机号:{1}", null), + INTERVIEW_INTERVIEW_TIME_IS_UNUSABLE(1021114, "当前预约时间不可用,请和线索用户协商其他时间后确定预约时间\n面审人:{0} 手机号:{1}", null), INTERVIEW_PARTNER_NOT_EXIST(1021115, "线索下的加盟商不存在!", null), - INTERVIEW_STATUS_NOT_TRANSFER(1021116, "当前面试状态不允许转让! 面试状态:{0}", null), + INTERVIEW_STATUS_NOT_TRANSFER(1021116, "当前面审状态不允许转让! 面审状态:{0}", null), MOBILE_WECHAT_EXIST(1021116, "此号码已绑定其他微信", null), - ROOM_STATUS_ERROR(10211156, "当前面试房间状态不允许进行该操作!", null), + ROOM_STATUS_ERROR(10211156, "当前面审房间状态不允许进行该操作!", null), MOBILE_APP_NOT_ONLINE_ERROR(10211157, "呼叫失败,请确认呼出号码正确并检查是否安装并打开呼叫插件", null), CALL_RECORD_NOT_EXIST_ERROR(10211158, "通话记录不存在!", null), CALL_UP_ERROR(10211159, "拨出电话异常!", null), CREATE_CALL_REQUEST_ERROR(10211160, "创建电话请求失败!", null), - CREATE_APPOINTMENT_TIME_ERROR(10211161, "当前时间不可预约面试,请选择其他时间", null), + CREATE_APPOINTMENT_TIME_ERROR(10211161, "当前时间不可预约面审,请选择其他时间", null), USER_CHANNEL_NOT_EXISTS(10211162, "当前用户渠道不存在", null), LINE_ALREADY_EXISTS(10211163, "该线索已存在,跟进人为{0}", null), @@ -129,7 +129,7 @@ public enum ErrorCodeEnum { EXHIBITION_NOT_EXIST(106003, "会销不存在或被删除", null), EXHIBITION_NOT_SIGNED(106004, "线索未进行会销签到", null), EXHIBITION_NOT_SUBMIT_INTENTION(106005, "线索未提交意向申请", null), - EXHIBITION_LINE_INTERVIEWED(106006, "线索已预约面试", null), + EXHIBITION_LINE_INTERVIEWED(106006, "线索已预约面审", null), ; diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java index 2fe72d9e1..c70522904 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java @@ -91,4 +91,17 @@ public enum InterviewTypeEnum { return result; } + public static WorkflowSubStageStatusEnum getWorkflowSubStageStatus(InterviewTypeEnum interviewType){ + if(MEET.equals(interviewType)){ + return WorkflowSubStageStatusEnum.INVITING_INTERVIEWS_15; + } + if(INTERVIEW.equals(interviewType)){ + return WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_30; + } + if(SECOND_INTERVIEW.equals(interviewType)){ + return WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_105; + } + return null; + } + } diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java index c48e5fa77..fb9595acd 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java @@ -13,20 +13,20 @@ import java.util.stream.Collectors; */ public enum WorkflowStageEnum { - INTENT("1","意向申请阶段"), - STORE("2","新店进展"), + INTENT(1,"意向申请阶段"), + STORE(2,"新店进展"), ; - private String code; + private Integer code; private String message; - WorkflowStageEnum(String code, String message) { + WorkflowStageEnum(Integer code, String message) { this.code = code; this.message = message; } - public String getCode() { + public Integer getCode() { return code; } @@ -34,7 +34,7 @@ public enum WorkflowStageEnum { return message; } - protected static final Map map = Arrays.stream(values()).collect( + protected static final Map map = Arrays.stream(values()).collect( Collectors.toMap(WorkflowStageEnum::getCode, Function.identity())); public static WorkflowStageEnum getWorkflowStageByCode(String code) { diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java b/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java index 9618c79c7..1baf251e3 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java @@ -1,6 +1,11 @@ package com.cool.store.dao; import com.cool.store.entity.LineInfoDO; +import com.cool.store.enums.ErrorCodeEnum; +import com.cool.store.enums.WorkflowStageEnum; +import com.cool.store.enums.WorkflowSubStageEnum; +import com.cool.store.enums.WorkflowSubStageStatusEnum; +import com.cool.store.exception.ServiceException; import com.cool.store.mapper.LineInfoMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Repository; @@ -38,6 +43,18 @@ public class LineInfoDAO { return lineInfoMapper.updateByPrimaryKeySelective(param); } + public Integer updateWorkflowStage(Long lineId, WorkflowSubStageEnum workflowSubStage, WorkflowSubStageStatusEnum workflowSubStageStatus) { + if(Objects.isNull(workflowSubStage) && Objects.isNull(workflowSubStageStatus)){ + log.info("更新线索阶段,子阶段 和 子阶段状态不能同时为空"); + throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED); + } + LineInfoDO lineInfo = new LineInfoDO(); + lineInfo.setId(lineId); + lineInfo.setWorkflowSubStage(workflowSubStage.getCode()); + lineInfo.setWorkflowSubStageStatus(workflowSubStageStatus.getCode()); + return lineInfoMapper.updateByPrimaryKeySelective(lineInfo); + } + public LineInfoDO getByPartnerId(String partnerId) { LineInfoDO lineInfo = lineInfoMapper.getByPartnerId(partnerId); if(Objects.nonNull(lineInfo) && !lineInfo.getDeleted()){ diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/LineInterviewService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/LineInterviewService.java index 6778690b9..a603873a2 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/LineInterviewService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/LineInterviewService.java @@ -89,7 +89,7 @@ public interface LineInterviewService { * @param videoUrlList * @return */ - Boolean uploadVideo(Long interviewId, List videoUrlList); + Integer uploadVideo(Long interviewId, List videoUrlList); /** * 重新预约面审 diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java index 9b77a5155..5a6ae7a36 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java @@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDate; @@ -84,6 +85,7 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } @Override + @Transactional(rollbackFor = Exception.class) public Boolean appointmentTime(AppointmentTimeRequest request) { //查询线索信息 //如果是面谈获取招商经理 如果是面试获取大区经理 @@ -106,8 +108,9 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt Date endTime = DateUtils.strToDate(request.getEndTime(), DateUtils.YYYY_MM_DD_HH_MM_SS); LineCalendarsEventDO calendarsEvent = LineCalendarsEventDO.convertDO(lineInfo, interviewType.getCode(), startTime, endTime, interviewer); Long eventId = lineCalendarsEventDAO.addCalendarsEvent(calendarsEvent); + WorkflowSubStageStatusEnum workflowSubStageStatus = InterviewTypeEnum.getWorkflowSubStageStatus(interviewType); //跟新线索状态为已预约 - lineInfoDAO.updateLineInfo(lineInfo); + lineInfoDAO.updateWorkflowStage(lineInfo.getId(), null, workflowSubStageStatus); LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfo(lineInfo.getId(), interviewType); if(Objects.nonNull(interviewInfo)){ if(!WorkflowSubStageStatusEnum.isReappointmentStatus(lineInfo.getWorkflowSubStageStatus())){ @@ -123,6 +126,7 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } @Override + @Transactional(rollbackFor = Exception.class) public Boolean modifyAppointmentTime(AppointmentTimeRequest request) { LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); if(Objects.isNull(lineInfo)){ @@ -227,6 +231,7 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } @Override + @Transactional(rollbackFor = Exception.class) public Integer finishInterview(Long interviewId, String userId) { LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfoById(interviewId); if(Objects.isNull(interviewInfo)){ @@ -236,20 +241,25 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt if (interviewInfo.getRoomStatus().equals(RoomStatus.CLOSED.getCode())) { throw new ServiceException(ErrorCodeEnum.ROOM_STATUS_ERROR); } - interviewInfo.setRoomStatus(RoomStatus.CLOSED.getCode()); - interviewInfo.setActualEndTime(new Date()); - interviewInfo.setInterviewStatus(InterviewStatusEnum.WAIT_AUDIT.getCode()); + LineInfoDO lineInfo = lineInfoDAO.getLineInfo(interviewInfo.getLineId()); + if(!WorkflowSubStageEnum.isReappointmentStage(lineInfo.getWorkflowSubStage())){ + throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE); + } + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewId); + updateInterviewInfo.setRoomStatus(RoomStatus.CLOSED.getCode()); + updateInterviewInfo.setActualEndTime(new Date()); + updateInterviewInfo.setInterviewStatus(InterviewStatusEnum.WAIT_AUDIT.getCode()); //更新线索状态 - LineInfoDO lineInfo = new LineInfoDO(); - lineInfo.setId(interviewInfo.getLineId()); + WorkflowSubStageStatusEnum workflowSubStageStatus = null; if(InterviewTypeEnum.INTERVIEW.getCode().equals(interviewInfo.getInterviewType())){ - lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_35.getCode()); + workflowSubStageStatus = WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_35; } if(InterviewTypeEnum.SECOND_INTERVIEW.getCode().equals(interviewInfo.getInterviewType())){ - lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_110.getCode()); + workflowSubStageStatus = WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_110; } - lineInfoDAO.updateLineInfo(lineInfo); - return lineInterviewDAO.updateInterviewInfo(interviewInfo); + lineInfoDAO.updateWorkflowStage(interviewInfo.getLineId(), null, workflowSubStageStatus); + return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo); } @Override @@ -271,7 +281,7 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } @Override - public Boolean uploadVideo(Long interviewId, List videoUrlList) { + public Integer uploadVideo(Long interviewId, List videoUrlList) { LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfoById(interviewId); if(Objects.isNull(interviewInfo)){ throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST); @@ -281,8 +291,10 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt videoList = new ArrayList<>(); } videoList.addAll(videoUrlList); - interviewInfo.setVideoUrl(JSONObject.toJSONString(videoList.stream().distinct().collect(Collectors.toList()))); - return lineInterviewDAO.updateInterviewInfo(interviewInfo) > 0; + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewId); + updateInterviewInfo.setVideoUrl(JSONObject.toJSONString(videoList.stream().distinct().collect(Collectors.toList()))); + return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo); } @Override @@ -295,15 +307,14 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt log.info("当前线索状态不允许重新预约"); throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE); } - Integer workflowSubStageStatus = null; + WorkflowSubStageStatusEnum workflowSubStageStatus = null; if(WorkflowSubStageEnum.FIRST_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - workflowSubStageStatus = WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_41.getCode(); + workflowSubStageStatus = WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_41; } if(WorkflowSubStageEnum.SECOND_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - workflowSubStageStatus = WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_120.getCode(); + workflowSubStageStatus = WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_120; } - lineInfo.setWorkflowSubStageStatus(workflowSubStageStatus); - return lineInfoDAO.updateLineInfo(lineInfo); + return lineInfoDAO.updateWorkflowStage(lineInfo.getId(), null, workflowSubStageStatus); } @@ -314,44 +325,33 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt @Override protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) { - InterviewTypeEnum interviewType = null; + InterviewTypeEnum interviewType = WorkflowSubStageEnum.getInterviewType(lineInfo.getWorkflowSubStage()); WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage()); WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage(); - Integer nextStageInitStatus = nextStage.getInitStatus().getCode(); - if(WorkflowSubStageEnum.INVITING_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.MEET; - } - if(WorkflowSubStageEnum.FIRST_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.INTERVIEW; - } - if(WorkflowSubStageEnum.SECOND_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.SECOND_INTERVIEW; - nextStageInitStatus = InterviewStatusEnum.PASS.getCode(); - } LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfo(lineInfo.getId(), interviewType); - interviewInfo.setAuditId(auditId); - interviewInfo.setInterviewStatus(InterviewStatusEnum.PASS.getCode()); - lineInfo.setWorkflowSubStage(nextStage.getCode()); - lineInfo.setWorkflowSubStageStatus(nextStageInitStatus); - lineInfoDAO.updateLineInfo(lineInfo); - return lineInterviewDAO.updateInterviewInfo(interviewInfo) > 0; + if(Objects.isNull(interviewInfo)){ + throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST); + } + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewInfo.getId()); + updateInterviewInfo.setAuditId(auditId); + updateInterviewInfo.setInterviewStatus(InterviewStatusEnum.PASS.getCode()); + //更新线索阶段 + lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus()); + return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo) > 0; } @Override protected Boolean auditReject(Long auditId, LineInfoDO lineInfo) { - InterviewTypeEnum interviewType = null; - if(WorkflowSubStageEnum.INVITING_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.MEET; - } - if(WorkflowSubStageEnum.FIRST_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.INTERVIEW; - } - if(WorkflowSubStageEnum.SECOND_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.SECOND_INTERVIEW; - } + InterviewTypeEnum interviewType = WorkflowSubStageEnum.getInterviewType(lineInfo.getWorkflowSubStage()); LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfo(lineInfo.getId(), interviewType); - interviewInfo.setAuditId(auditId); - interviewInfo.setInterviewStatus(InterviewStatusEnum.NOT_PASS.getCode()); + if(Objects.isNull(interviewInfo)){ + throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST); + } + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewInfo.getId()); + updateInterviewInfo.setAuditId(auditId); + updateInterviewInfo.setInterviewStatus(InterviewStatusEnum.NOT_PASS.getCode()); return lineInterviewDAO.updateInterviewInfo(interviewInfo) > 0; }