Merge remote-tracking branch 'hsayi/dev/feat/partner1.3_20230828' into dev/feat/partner1.3_20230828

This commit is contained in:
苏竹红
2023-08-24 17:02:07 +08:00
16 changed files with 123 additions and 30 deletions

View File

@@ -7,6 +7,8 @@ public class ExcelErrorConstants {
public static final String NAME_LOSE = "姓名缺失";
public static final String NAME_OVER_LENGTH = "姓名过长";
public static final String MOBILE_LOSE= "手机号缺失";
public static final String MOBILE_ERROR= "手机号有误";

View File

@@ -12,6 +12,8 @@ public enum FollowTaskStatusEnum {
FINISHED(1, "已完成"),
OVERDUE(2, "已逾期"),
CANCELLED(3, "作废"),
OVERDUE_FINISH(4, "逾期完成"),
OVERDUE_CANCELLED(5, "逾期作废"),
;
//任务状态:0:待完成、1:已完成、2:已逾期、3:作废

View File

@@ -86,10 +86,10 @@ public class HyFollowTaskDAO {
* @param followTaskId
* @return
*/
public Integer finishFollowTask(Long followTaskId){
public Integer finishFollowTask(Long followTaskId, FollowTaskStatusEnum followTaskStatus){
HyFollowTaskDO update = new HyFollowTaskDO();
update.setId(followTaskId);
update.setTaskStatus(FollowTaskStatusEnum.FINISHED.getCode());
update.setTaskStatus(followTaskStatus.getCode());
update.setFinishTime(new Date());
return updateFollowTask(update);
}
@@ -99,10 +99,10 @@ public class HyFollowTaskDAO {
* @param followTaskId
* @return
*/
public Integer cancelFollowTask(Long followTaskId){
public Integer cancelFollowTask(Long followTaskId, FollowTaskStatusEnum followTaskStatus){
HyFollowTaskDO update = new HyFollowTaskDO();
update.setId(followTaskId);
update.setTaskStatus(FollowTaskStatusEnum.CANCELLED.getCode());
update.setTaskStatus(followTaskStatus.getCode());
return updateFollowTask(update);
}
@@ -207,6 +207,18 @@ public class HyFollowTaskDAO {
return hyFollowTaskMapper.updateUndoTaskStatusToOverdue();
}
/**
* 更改线索id
* @param oldLineId
* @param newLineId
*/
public Integer changeLineId(Long oldLineId, Long newLineId){
if(Objects.isNull(oldLineId) || Objects.isNull(newLineId)){
return CommonConstants.ZERO;
}
return hyFollowTaskMapper.changeLineId(oldLineId, newLineId);
}
}

View File

@@ -100,4 +100,12 @@ public interface HyFollowTaskMapper {
* @return
*/
List<HyFollowTaskDO> getFollowTaskList(@Param("followTaskIds") List<Long> followTaskIds);
/**
* 更改线索id
* @param oldLineId
* @param newLineId
* @return
*/
Integer changeLineId(@Param("oldLineId") Long oldLineId, @Param("newLineId") Long newLineId);
}

View File

@@ -157,7 +157,7 @@
a.update_time
from
hy_follow_task a
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0'
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0' and b.line_status in ('1', '2')
where
a.deleted = '0' and a.follow_user_id = #{followUserId}
<if test="taskStatus != null">
@@ -169,7 +169,7 @@
<if test="deadlineEndTime != null">
<![CDATA[ and a.deadline <= #{deadlineEndTime}]]>
</if>
order by a.deadline desc
order by a.deadline desc, a.id desc
</select>
<select id="getFollowTask" resultMap="BaseResultMap">
@@ -194,7 +194,7 @@
a.follow_user_id
from
hy_follow_task a
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0'
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0' and b.line_status in ('1', '2')
where
a.deleted = '0' and (a.task_status in ('2') or (a.task_status in ('0') and a.deadline >= #{startTime} and #{endTime} >= a.deadline))
</select>
@@ -206,7 +206,7 @@
sum(if(a.task_status=0 and #{endTime} > a.deadline, 1, 0)) as todoNum
from
hy_follow_task a
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0'
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0' and b.line_status in ('1', '2')
where
a.follow_user_id in <foreach collection="followUserIds" item="followUserId" separator="," open="(" close=")">#{followUserId}</foreach>
group by a.follow_user_id
@@ -228,7 +228,7 @@
a.update_time
from
hy_follow_task a
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0'
inner join hy_partner_line_info b on a.partner_line_id = b.id and b.deleted = '0' and b.line_status in ('1', '2')
where
a.deleted = '0' and a.task_status in ('0') and a.deadline > #{startTime} and #{endTime} > a.deadline
</select>
@@ -245,5 +245,9 @@
where
deleted = '0' and id in <foreach collection="followTaskIds" item="followTaskId" separator="," open="(" close=")">#{followTaskId}</foreach>
</select>
<update id="changeLineId">
update hy_follow_task set partner_line_id = #{newLineId} where partner_line_id = #{oldLineId}
</update>
</mapper>

View File

@@ -20,12 +20,16 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="close_time" jdbcType="TIMESTAMP" property="closeTime" />
<result column="close_user_id" jdbcType="VARCHAR" property="closeUserId" />
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
<result column="create_user_mobile" jdbcType="VARCHAR" property="createUserMobile" />
<result column="operator_type" jdbcType="VARCHAR" property="operatorType" />
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
</resultMap>
<sql id="Base_Column_List">
id, partner_id, workflow_stage, workflow_status, line_status, investment_manager,
development_director, development_manager, deadline, pass_reason, reject_public_reason,
reject_real_reason, certify_file, deleted, create_time, update_time, close_time,
close_user_id
close_user_id,create_user_id,create_user_mobile,operator_type,update_user_id
</sql>
<select id="selectByPrimaryKeySelective" resultMap="BaseResultMap">
@@ -124,6 +128,18 @@
<if test="record.closeUserId != null">
close_user_id,
</if>
<if test="record.createUserId != null">
create_user_id,
</if>
<if test="record.createUserMobile != null">
create_user_mobile,
</if>
<if test="record.operatorType != null">
operator_type,
</if>
<if test="record.updateUserId != null">
update_user_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.partnerId != null">
@@ -177,6 +193,18 @@
<if test="record.closeUserId != null">
#{record.closeUserId},
</if>
<if test="record.createUserId != null">
#{record.createUserId},
</if>
<if test="record.createUserMobile != null">
#{record.createUserMobile},
</if>
<if test="record.operatorType != null">
#{record.operatorType},
</if>
<if test="record.updateUserId != null">
#{record.updateUserId},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">

View File

@@ -40,7 +40,7 @@ public class HyFollowTaskDO implements Serializable {
@ApiModelProperty("计划沟通内容")
private String communicationContent;
@ApiModelProperty("任务状态:0:待完成、1:已完成、2:已逾期、3:作废")
@ApiModelProperty("任务状态:0:待完成、1:已完成、2:已逾期、3:作废、4逾期完成、5逾期作废")
private Integer taskStatus;
@ApiModelProperty("任务截止时间")

View File

@@ -6,9 +6,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
;
import java.util.Date;
/**
* @author Fun Li
@@ -41,8 +39,8 @@ public class HyOutboundMobileDO {
private Boolean deleted;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
private Date createTime;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
private Date updateTime;
}

View File

@@ -82,4 +82,16 @@ public class HyPartnerLineInfoDO implements Serializable {
@ApiModelProperty("hy_partner_user_channel.channel_id")
private Integer userChannelId;
@ApiModelProperty("创建人")
private String createUserId;
@ApiModelProperty("创建人手机号")
private String createUserMobile;
@ApiModelProperty("操作类型")
private String operatorType;
@ApiModelProperty("更新人")
private String updateUserId;
}

View File

@@ -6,10 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.*;
import java.util.List;
/**
@@ -25,6 +22,7 @@ public class AddLineRequest {
@NotBlank(message = "姓名不能为空")
@ApiModelProperty("姓名")
@Size(max = 10,message = "姓名过长")
private String partnerName;
@Pattern(regexp = "(?:0|86|\\+86)?1[3-9]\\d{9}",message = "手机号码不正确,请检查后重试")

View File

@@ -53,6 +53,11 @@ public class UpdateFollowTaskRequest {
result.setCommunicationType(request.getCommunicationType());
result.setDeadline(request.getDeadline());
result.setCommunicationContent(request.getCommunicationContent());
if(request.getDeadline().getTime() > System.currentTimeMillis()){
result.setTaskStatus(FollowTaskStatusEnum.TODO.getCode());
}else{
result.setTaskStatus(FollowTaskStatusEnum.OVERDUE.getCode());
}
return result;
}

View File

@@ -1,7 +1,6 @@
package com.cool.store.vo.follow;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.log.LogFieldDTO;
import com.cool.store.entity.CallRecordDO;
import com.cool.store.entity.HyFollowTaskDO;
import com.cool.store.entity.HyPartnerTaskInfoLogDO;

View File

@@ -149,7 +149,7 @@ public class FollowTaskServiceImpl implements FollowTaskService {
@Override
public Integer updateFollowTask(UpdateFollowTaskRequest request, String userId) {
HyFollowTaskDO followTask = hyFollowTaskDAO.getFollowTask(request.getFollowTaskId());
if(!FollowTaskStatusEnum.TODO.getCode().equals(followTask.getTaskStatus())){
if(FollowTaskStatusEnum.FINISHED.getCode().equals(followTask.getTaskStatus()) || FollowTaskStatusEnum.CANCELLED.getCode().equals(followTask.getTaskStatus())|| FollowTaskStatusEnum.OVERDUE_CANCELLED.getCode().equals(followTask.getTaskStatus())){
throw new ServiceException(ErrorCodeEnum.TASK_STATUS_NOT_ALLOW_OPERATE);
}
if(Objects.nonNull(request.getDeadline()) && request.getDeadline().getTime() < System.currentTimeMillis()){
@@ -171,17 +171,25 @@ public class FollowTaskServiceImpl implements FollowTaskService {
throw new ServiceException(ErrorCodeEnum.TASK_STATUS_NOT_ALLOW_OPERATE);
}
checkLine(followTask.getPartnerLineId());
return hyFollowTaskDAO.finishFollowTask(request.getFollowTaskId());
FollowTaskStatusEnum followTaskStatus = FollowTaskStatusEnum.FINISHED;
if(followTask.getDeadline().getTime() < System.currentTimeMillis()){
followTaskStatus = FollowTaskStatusEnum.OVERDUE_FINISH;
}
return hyFollowTaskDAO.finishFollowTask(request.getFollowTaskId(), followTaskStatus);
}
@Override
public Integer cancelFollowTask(FollowTaskIdRequest request, String userId) {
HyFollowTaskDO followTask = hyFollowTaskDAO.getFollowTask(request.getFollowTaskId());
if(FollowTaskStatusEnum.FINISHED.getCode().equals(followTask.getTaskStatus())){
if(FollowTaskStatusEnum.FINISHED.getCode().equals(followTask.getTaskStatus()) || FollowTaskStatusEnum.OVERDUE_FINISH.getCode().equals(followTask.getTaskStatus())){
throw new ServiceException(ErrorCodeEnum.TASK_STATUS_NOT_ALLOW_OPERATE);
}
checkLine(followTask.getPartnerLineId());
return hyFollowTaskDAO.cancelFollowTask(request.getFollowTaskId());
FollowTaskStatusEnum followTaskStatus = FollowTaskStatusEnum.CANCELLED;
if(followTask.getDeadline().getTime() < System.currentTimeMillis()){
followTaskStatus = FollowTaskStatusEnum.OVERDUE_CANCELLED;
}
return hyFollowTaskDAO.cancelFollowTask(request.getFollowTaskId(), followTaskStatus);
}
@Override

View File

@@ -15,6 +15,7 @@ import com.cool.store.vo.HyOutboundVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@@ -69,6 +70,7 @@ public class HyOutboundServiceImpl implements HyOutboundService {
String userId = CurrentUserHolder.getUserId();
hyOutboundMobile.setEditUserId(userId);
hyOutboundMobile.setUpdateUserId(userId);
hyOutboundMobile.setUpdateTime(new Date());
outboundMobileMapper.updateByPrimaryKeySelective(hyOutboundMobile);
}

View File

@@ -80,6 +80,8 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
private LogService logService;
@Resource
private LabelService labelService;
@Resource
private HyFollowTaskDAO hyFollowTaskDAO;
@Override
@@ -109,6 +111,9 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
List<String> removeLabels = new ArrayList<>(oldLabels);
addLabels.removeAll(oldLabels);
removeLabels.removeAll(newLabels);
if(CollectionUtils.isEmpty(addLabels) && CollectionUtils.isEmpty(removeLabels)){
return Boolean.TRUE;
}
LineLogInfo lineLogInfo = new LineLogInfo(line.getPartnerId(), line.getId(), user.getUserId(),
user.getName(), OperateTypeEnum.ADD_TAGS,
WorkflowStageEnum.getWorkflowStageByCode(line.getWorkflowStage()),
@@ -264,6 +269,7 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
hyInterviewDAO.updateLineId(newPartnerId,newLindId,oldLineInfo.getId());
hyPartnerCertificationInfoMapper.updateLineId(newPartnerId,newLindId,oldLineInfo.getId());
hyPartnerTaskInfoLogDAO.updateLineId(newPartnerId,newLindId,oldLineInfo.getId());
hyFollowTaskDAO.changeLineId(oldLineInfo.getId(), newLindId);
String cacheKeyBaseInfo = MessageFormat.format(RedisConstant.PARTNER_BASEINFO_CACHE_KEY, newPartnerId, newLindId);
String cacheKeyClerkInfo = MessageFormat.format(RedisConstant.PARTNER_CLERKINFO_CACHE_KEY,newPartnerId, newLindId);
String cacheKeyIntentInfo = MessageFormat.format(RedisConstant.PARTNER_INTENTINFO_CACHE_KEY, newPartnerId, newLindId);

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.cool.store.constants.ExcelErrorConstants;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
@@ -77,7 +78,7 @@ public class LineHighSeasServiceImpl implements LineHighSeasService {
if (ObjectUtil.isNotNull(hyPartnerUserInfoDO)) {
throw new ServiceException(ErrorCodeEnum.PARTNER_MOBILE_EXIST);
}
return add(request);
return add(request,"add");
}
@@ -86,7 +87,7 @@ public class LineHighSeasServiceImpl implements LineHighSeasService {
*
* @param request
*/
public boolean add(AddLineRequest request) {
public boolean add(AddLineRequest request,String type) {
Boolean flag =false;
String partnerId = UUIDUtils.get32UUID();
HyPartnerUserInfoDO resultUser = new HyPartnerUserInfoDO();
@@ -95,7 +96,9 @@ public class LineHighSeasServiceImpl implements LineHighSeasService {
hyPartnerUserInfoDAO.insertSelective(resultUser);
HyPartnerLineInfoDO resultLine = new HyPartnerLineInfoDO();
resultLine.setPartnerId(partnerId).setCreateTime(new Date()).setWorkflowStage(WorkflowStageEnum.INTENT.getCode());
resultLine.setPartnerId(partnerId).setCreateTime(new Date()).setWorkflowStage(WorkflowStageEnum.INTENT.getCode())
.setCreateUserId(CurrentUserHolder.getUserId()).setCreateUserMobile(CurrentUserHolder.getUser().getMobile())
.setOperatorType(type);
//判断招商经理是否为空
if (StringUtil.isNotEmpty(request.getInvestmentManager())) {
@@ -143,9 +146,15 @@ public class LineHighSeasServiceImpl implements LineHighSeasService {
}
for (int i = 0; i < lineDOList.size(); i++) {
HyPartnerLineDO hyPartnerLineDO = lineDOList.get(i);
if (StringUtil.isEmpty(hyPartnerLineDO.getPartnerName())) {
String partnerName = hyPartnerLineDO.getPartnerName();
if (StringUtil.isEmpty(partnerName)) {
hyPartnerLineDO.setErrorInfo(StringUtil.isEmpty(hyPartnerLineDO.getErrorInfo()) ? ExcelErrorConstants.NAME_LOSE : hyPartnerLineDO.getErrorInfo().concat(Constants.SEMICOLON).concat(ExcelErrorConstants.NAME_LOSE));
ExcelUtil.setStyleMap(styleCells, i, 0, new String[]{ExcelUtil.FONT_RED});
}else {
if (partnerName.length()>10) {
hyPartnerLineDO.setErrorInfo(StringUtil.isEmpty(hyPartnerLineDO.getErrorInfo()) ? ExcelErrorConstants.NAME_OVER_LENGTH : hyPartnerLineDO.getErrorInfo().concat(Constants.SEMICOLON).concat(ExcelErrorConstants.NAME_OVER_LENGTH));
ExcelUtil.setStyleMap(styleCells, i, 0, new String[]{ExcelUtil.FONT_RED});
}
}
String mobile = hyPartnerLineDO.getMobile().trim();
//手机号为空
@@ -231,7 +240,7 @@ public class LineHighSeasServiceImpl implements LineHighSeasService {
AddLineRequest addLineRequest = new AddLineRequest();
BeanUtil.copyProperties(hyPartnerLineDO, addLineRequest);
addLineRequest.setWantShopArea(hyPartnerLineDO.getWantShopArea().toString());
add(addLineRequest);
add(addLineRequest,"import");
}
return new ResponseResult(ResponseCodeEnum.SUCCESS.getCode(), "共上传" + lineDOList.size() + "条线索", new ErrorExcelResponse(lineDOList.size(), styleCells.size(), fileStr));
}