跟进日志

This commit is contained in:
zhangchenbiao
2024-03-27 15:52:24 +08:00
parent 0da056d9d3
commit 9ae3d8b44b
12 changed files with 428 additions and 7 deletions

View File

@@ -0,0 +1,37 @@
package com.cool.store.enums;
/**
* @author zhangchenbiao
* @FileName: SmsCodeTypeEnum
* @Description: 短信验证码类型
* @date 2021-07-20 9:47
*/
public enum SmsCodeTypeEnum {
LOGIN("SMS_220325070","验证码登录", 10 * 60),
;
private String templateCode;
private String message;
private int cacheSeconds;
SmsCodeTypeEnum(String templateCode, String message, int cacheSeconds) {
this.templateCode = templateCode;
this.message = message;
this.cacheSeconds = cacheSeconds;
}
public String getTemplateCode() {
return templateCode;
}
public String getMessage() {
return message;
}
public int getCacheSeconds() {
return cacheSeconds;
}
}

View File

@@ -0,0 +1,49 @@
package com.cool.store.dao;
import com.cool.store.entity.LineFollowLogDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.mapper.LineFollowLogMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: LineFollowLogDAO
* @Description:跟进日志
* @date 2024-03-27 14:33
*/
@Slf4j
@Repository
public class LineFollowLogDAO {
@Resource
private LineFollowLogMapper lineFollowLogMapper;
public Page<LineFollowLogDO> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
return lineFollowLogMapper.getFollowLogPage(lineId);
}
/**
* 新增跟进线索
* @param lineInfo
* @param operateUserId
* @param operateUsername
* @param message
* @return
*/
public Long addFollowLog(LineInfoDO lineInfo, String operateUserId, String operateUsername, String message){
if(Objects.isNull(lineInfo)){
return null;
}
LineFollowLogDO followLog = new LineFollowLogDO(lineInfo.getPartnerId(), lineInfo.getId(), operateUserId, operateUsername, lineInfo.getWorkflowStage(), lineInfo.getWorkflowSubStage(), lineInfo.getWorkflowSubStageStatus(), message);
lineFollowLogMapper.insertSelective(followLog);
return followLog.getId();
}
}

View File

@@ -0,0 +1,16 @@
package com.cool.store.mapper;
import com.cool.store.entity.LineFollowLogDO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
public interface LineFollowLogMapper extends Mapper<LineFollowLogDO> {
/**
*
* @param lineId
* @return
*/
Page<LineFollowLogDO> getFollowLogPage(@Param("lineId")Long lineId);
}

View File

@@ -0,0 +1,27 @@
<?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="com.cool.store.mapper.LineFollowLogMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.LineFollowLogDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
<result column="line_id" jdbcType="BIGINT" property="lineId" />
<result column="operate_user_id" jdbcType="VARCHAR" property="operateUserId" />
<result column="operate_username" jdbcType="VARCHAR" property="operateUsername" />
<result column="workflow_stage" jdbcType="TINYINT" property="workflowStage" />
<result column="workflow_sub_stage" jdbcType="TINYINT" property="workflowSubStage" />
<result column="workflow_sub_stage_status" jdbcType="TINYINT" property="workflowSubStageStatus" />
<result column="message" jdbcType="VARCHAR" property="message" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<select id="getFollowLogPage" resultMap="BaseResultMap">
select
id, partner_id, line_id, operate_user_id, operate_username, workflow_stage, workflow_sub_stage, workflow_sub_stage_status, message, create_time
from
xfsg_line_follow_log
where
line_id = #{lineId} and deleted = '0' order by create_time desc
</select>
</mapper>

View File

@@ -3,6 +3,6 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
jdbc.user= coolstore jdbc.user= coolstore
jdbc.password = CSCErYcXniNYm7bT jdbc.password = CSCErYcXniNYm7bT
table.name = xfsg_line_interview table.name = xfsg_line_follow_log
table.object.class = LineInterviewDO table.object.class = LineFollowLogDO
table.mapper = LineInterviewMapper table.mapper = LineFollowLogMapper

View File

@@ -0,0 +1,93 @@
package com.cool.store.entity;
import lombok.Data;
import java.util.Date;
import javax.persistence.*;
@Data
@Table(name = "xfsg_line_follow_log")
public class LineFollowLogDO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* hy_partner_user_info.partner_id
*/
@Column(name = "partner_id")
private String partnerId;
/**
* hy_partner_line_info.id
*/
@Column(name = "line_id")
private Long lineId;
/**
* 操作人id
*/
@Column(name = "operate_user_id")
private String operateUserId;
/**
* 操作人姓名
*/
@Column(name = "operate_username")
private String operateUsername;
/**
* 流程阶段:1意向加盟;2新店进展;
*/
@Column(name = "workflow_stage")
private Integer workflowStage;
/**
* 流程子阶段
*/
@Column(name = "workflow_sub_stage")
private Integer workflowSubStage;
/**
* 流程子阶段状态
*/
@Column(name = "workflow_sub_stage_status")
private Integer workflowSubStageStatus;
/**
* 备注
*/
private String message;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新时间
*/
@Column(name = "update_time")
private Date updateTime;
/**
* 删除标识
*/
private Boolean deleted;
public LineFollowLogDO() {
}
public LineFollowLogDO(String partnerId, Long lineId, String operateUserId, String operateUsername, Integer workflowStage, Integer workflowSubStage, Integer workflowSubStageStatus, String message) {
this.partnerId = partnerId;
this.lineId = lineId;
this.operateUserId = operateUserId;
this.operateUsername = operateUsername;
this.workflowStage = workflowStage;
this.workflowSubStage = workflowSubStage;
this.workflowSubStageStatus = workflowSubStageStatus;
this.message = message;
this.createTime= new Date();
}
}

View File

@@ -0,0 +1,21 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: LineFollowLogRequest
* @Description:
* @date 2024-03-27 14:59
*/
@Data
public class LineFollowLogRequest {
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("日志")
private String message;
}

View File

@@ -0,0 +1,42 @@
package com.cool.store.vo.log;
import com.cool.store.entity.LineFollowLogDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: LineFollowLogVO
* @Description:跟进日志
* @date 2024-03-27 14:50
*/
@Data
public class LineFollowLogVO {
@ApiModelProperty("日志")
private String message;
@ApiModelProperty("创建时间")
private Date createTime;
public LineFollowLogVO(String message, Date createTime) {
this.message = message;
this.createTime = createTime;
}
public static List<LineFollowLogVO> convertList(List<LineFollowLogDO> list){
if (CollectionUtils.isEmpty(list)) {
return null;
}
List<LineFollowLogVO> resultList = new ArrayList<>();
for (LineFollowLogDO followLog : list) {
resultList.add(new LineFollowLogVO(followLog.getMessage(), followLog.getCreateTime()));
}
return resultList;
}
}

View File

@@ -0,0 +1,32 @@
package com.cool.store.service;
import com.cool.store.request.LineFollowLogRequest;
import com.cool.store.vo.log.LineFollowLogVO;
import com.github.pagehelper.PageInfo;
/**
* @author zhangchenbiao
* @FileName: LineFollowService
* @Description:线索跟进
* @date 2024-03-27 14:49
*/
public interface LineFollowService {
/**
* 分页获取跟进日志
* @param lineId
* @param pageNum
* @param pageSize
* @return
*/
PageInfo<LineFollowLogVO> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize);
/**
* 新增跟进日志
* @param followLog
* @param operateUserId
* @param operateUsername
* @return
*/
Long addFollowLog(LineFollowLogRequest followLog, String operateUserId, String operateUsername);
}

View File

@@ -1,15 +1,23 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.cool.store.dao.EnterpriseUserDAO; import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dto.message.SendMessageDTO; import com.cool.store.dto.message.SendMessageDTO;
import com.cool.store.enums.MessageEnum; import com.cool.store.enums.*;
import com.cool.store.enums.RocketMqTagEnum; import com.cool.store.exception.ServiceException;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.mq.producer.SimpleMessageService; import com.cool.store.mq.producer.SimpleMessageService;
import com.cool.store.response.ResponseResult;
import com.cool.store.utils.UUIDUtils; import com.cool.store.utils.UUIDUtils;
import com.cool.store.utils.poi.constant.Constants; import com.cool.store.utils.poi.constant.Constants;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +39,7 @@ import java.util.stream.Collectors;
* @Description: * @Description:
* @date 2024-03-20 17:09 * @date 2024-03-20 17:09
*/ */
@Slf4j
@Service @Service
public class CommonService { public class CommonService {
@@ -95,4 +104,5 @@ public class CommonService {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

View File

@@ -0,0 +1,51 @@
package com.cool.store.service.impl;
import com.cool.store.dao.LineFollowLogDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.LineFollowLogDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.LineFollowLogRequest;
import com.cool.store.service.LineFollowService;
import com.cool.store.vo.log.LineFollowLogVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: LineFollowServiceImpl
* @Description:
* @date 2024-03-27 14:49
*/
@Service
public class LineFollowServiceImpl implements LineFollowService {
@Resource
private LineFollowLogDAO lineFollowLogDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Override
public PageInfo<LineFollowLogVO> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize) {
Page<LineFollowLogDO> followLogPage = lineFollowLogDAO.getFollowLogPage(lineId, pageNum, pageSize);
PageInfo resultPage = new PageInfo(followLogPage);
List<LineFollowLogVO> resultList = LineFollowLogVO.convertList(followLogPage);
resultPage.setList(resultList);
return resultPage;
}
@Override
public Long addFollowLog(LineFollowLogRequest followLog, String operateUserId, String operateUsername) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(followLog.getLineId());
if(Objects.isNull(lineInfo)){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
return lineFollowLogDAO.addFollowLog(lineInfo, operateUserId, operateUsername, followLog.getMessage());
}
}

View File

@@ -0,0 +1,43 @@
package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.LineFollowLogRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.LineFollowService;
import com.cool.store.vo.log.LineFollowLogVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author zhangchenbiao
* @FileName: LineFollowController
* @Description:
* @date 2024-03-27 15:02
*/
@Api(tags = "跟进日志")
@RestController
@RequestMapping({"pc/follow"})
public class LineFollowController {
@Resource
private LineFollowService lineFollowService;
@ApiOperation("跟进日志分页")
@GetMapping("/page")
public ResponseResult<PageInfo<LineFollowLogVO>> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize){
return ResponseResult.success(lineFollowService.getFollowLogPage(lineId, pageNum, pageSize));
}
@ApiOperation("新增跟进日志")
@PostMapping("/log/add")
public ResponseResult<Long> addFollowLog(@RequestBody LineFollowLogRequest request){
LoginUserInfo user = CurrentUserHolder.getUser();
return ResponseResult.success(lineFollowService.addFollowLog(request, user.getUserId(), user.getName()));
}
}