Merge remote-tracking branch 'xfsg/cc_partner_init' into cc_partner_init

This commit is contained in:
苏竹红
2024-04-09 20:05:18 +08:00
19 changed files with 148 additions and 29 deletions

View File

@@ -149,5 +149,7 @@ public class CommonConstants {
public static final Long LONG_ONE = 1L;
public static final String DEAULT_INVESTMENT_JOBNUMBER = "020125244825417786";
}

View File

@@ -34,6 +34,13 @@ public class EnterpriseUserDAO {
return enterpriseUserMapper.getUserInfoById( userId);
}
public EnterpriseUserDO getUserInfoByJobnumber(String jobnumber){
if(StringUtils.isAnyBlank(jobnumber)){
return null;
}
return enterpriseUserMapper.getUserInfoByJobnumber(jobnumber);
}
public List<EnterpriseUserDO> getUserInfoByUserIds(List<String> userIdList){
if(CollectionUtils.isEmpty(userIdList)){
return Lists.newArrayList();

View File

@@ -3,6 +3,8 @@ package com.cool.store.dao;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.cool.store.entity.LineCalendarsEventDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineCalendarsEventMapper;
import com.cool.store.utils.StringUtil;
import lombok.extern.slf4j.Slf4j;
@@ -59,8 +61,9 @@ public class LineCalendarsEventDAO {
* @return
*/
public Long addCalendarsEvent(LineCalendarsEventDO param){
if(Objects.nonNull(param.getRegionId()) || Objects.nonNull(param.getLineId()) || Objects.nonNull(param.getPartnerId()) || Objects.nonNull(param.getStartTime()) || Objects.nonNull(param.getEndTime())){
if(Objects.isNull(param.getRegionId()) || Objects.isNull(param.getLineId()) || Objects.isNull(param.getPartnerId()) || Objects.isNull(param.getStartTime()) || Objects.isNull(param.getEndTime())){
log.error("新增日历事件失败:{}",JSONObject.toJSONString(param));
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
lineCalendarsEventMapper.insertSelective(param);
return param.getId();

View File

@@ -19,6 +19,9 @@ public interface EnterpriseUserMapper {
*/
EnterpriseUserDO getUserInfoById(@Param("userId") String userId);
EnterpriseUserDO getUserInfoByJobnumber(@Param("jobnumber") String jobnumber);
/**
* 批量获取用户信息
* @param userIdList

View File

@@ -41,6 +41,16 @@
user_id = #{userId}
</select>
<select id="getUserInfoByJobnumber" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,
<include refid="Blob_Column_List"/>
from
enterprise_user_${enterpriseId}
where
jobnumber = #{jobnumber}
</select>
<select id="getUserInfoByUserIds" resultMap="BaseResultMap">
select

View File

@@ -14,6 +14,7 @@ import javax.validation.constraints.NotNull;
@Data
public class AppointmentTimeRequest {
@NotNull
@ApiModelProperty("线索id")
private Long lineId;

View File

@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
* @date 2024-04-08 16:50
*/
@Data
public class RecommendPointRequest {
public class LineRecommendPointRequest {
@ApiModelProperty("线索id")
private Long lineId;

View File

@@ -0,0 +1,46 @@
package com.cool.store.request;
import com.cool.store.entity.PointRecommendDO;
import com.cool.store.enums.point.PointRecommendStatus;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
* @FileName: RecommendPointRequest
* @Description:
* @date 2024-04-08 16:50
*/
@Data
public class PointRecommendLineRequest {
@ApiModelProperty("线索ids")
private List<Long> lineIds;
@ApiModelProperty("铺位id")
private Long pointId;
@ApiModelProperty(value = "拓展经理", hidden = true)
private String developmentManager;
public List<PointRecommendDO> convertList(){
if(Objects.isNull(this.lineIds) || CollectionUtils.isEmpty(this.lineIds) || Objects.isNull(pointId)){
return Lists.newArrayList();
}
return this.lineIds.stream().map(lineId -> {
PointRecommendDO pointRecommendDO = new PointRecommendDO();
pointRecommendDO.setLineId(lineId);
pointRecommendDO.setDevelopmentManager(this.developmentManager);
pointRecommendDO.setPointId(pointId);
pointRecommendDO.setStatus(PointRecommendStatus.POINT_RECOMMEND_STATUS_1.getCode());
return pointRecommendDO;
}).collect(Collectors.toList());
}
}

View File

@@ -73,6 +73,7 @@ public class LineInterviewPageVO {
List<LineInterviewPageVO> resultList = new ArrayList<>();
for (LineInterviewPageDTO lineInterviewPage : list) {
LineInterviewPageVO result = new LineInterviewPageVO();
result.setInterviewId(lineInterviewPage.getInterviewId());
result.setLineId(lineInterviewPage.getLineId());
result.setUsername(lineInterviewPage.getUsername());
result.setMobile(lineInterviewPage.getMobile());

View File

@@ -159,11 +159,18 @@ public interface ShopPointService {
PageInfo<PointPageVO> getRecommendPointList(RecommendPointPageRequest request);
/**
* 推送铺位
* 加盟商推荐铺位
* @param request
* @return
*/
Integer recommendPoint(RecommendPointRequest request);
Integer lineRecommendPoint(LineRecommendPointRequest request);
/**
* 铺位推荐加盟商
* @param request
* @return
*/
Integer pointRecommendLine(PointRecommendLineRequest request);
/**
* 选址人员转让加盟商

View File

@@ -189,6 +189,8 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(request.getLineId());
initiatingDO.setKdzBusinessId(lineInfoDO.getId() + "_" + lineInfoDO.getWorkflowSubStageStatus());
InitiatingResponse initiatingResponse = httpRestTemplateService.postForObject(url, initiatingDO, InitiatingResponse.class);
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
return initiatingResponse;
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.HyOpenAreaInfoDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.RegionAreaConfigDao;
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.xml.bind.util.JAXBSource;
import java.util.Objects;
import static com.cool.store.enums.ErrorCodeEnum.LINE_ID_IS_NOT_EXIST;
@@ -55,6 +57,7 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(JoinIntentionRequest request) {
log.info("submit request {}", JSONObject.toJSONString(request));
if (Objects.isNull(request)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
@@ -66,8 +69,8 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
if (Objects.isNull(lineInfoParam)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
if (Objects.nonNull(request.getWantShopArea())){
EnterpriseUserDO userByRoleNameAndAreaId = userAuthMappingService.getUserByRoleEnumAndAreaId(UserRoleEnum.INVESTMENT_MANAGER, Long.valueOf(request.getWantShopArea()));
if (Objects.nonNull(request.getAreaCode())){
EnterpriseUserDO userByRoleNameAndAreaId = userAuthMappingService.getUserByRoleEnumAndAreaId(UserRoleEnum.INVESTMENT_MANAGER, Long.valueOf(request.getAreaCode()));
lineInfoParam.setInvestmentManager(userByRoleNameAndAreaId.getUserId());
}
//todo 目前写死为进入私海

View File

@@ -267,10 +267,10 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
Integer joinInterviewStatus = JoinInterviewStatusEnum.getJoinInterviewStatus(interviewInfo.getJoinInterviewStatus(), userType);
if(!joinInterviewStatus.equals(interviewInfo.getJoinInterviewStatus()) && JoinInterviewStatusEnum.JOIN.getCode().equals(joinInterviewStatus)){
if(Objects.isNull(interviewInfo.getActualStartTime())){
interviewInfo.setActualStartTime(new Date());
interviewInfo.setRoomStatus(RoomStatus.OPEN.getCode());
}
interviewInfo.setRoomStatus(RoomStatus.OPEN.getCode());
interviewInfo.setJoinInterviewStatus(joinInterviewStatus);
lineInterviewDAO.updateInterviewInfo(interviewInfo);
String userSig = TRTCUtils.genUserSig(sdkAppId, key, interviewUserId);
@@ -395,6 +395,8 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt
String developmentManager = Optional.ofNullable(enterpriseUser).map(EnterpriseUserDO::getUserId).orElse(null);
updateLine.setDevelopmentManager(developmentManager);
lineInfoDAO.updateLineInfo(updateLine);
//初始化店铺
}
return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo) > 0;
}

View File

@@ -3,7 +3,6 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.interview.LineInterviewPageDTO;
import com.cool.store.dto.point.AuditNodeDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.AuditStatusEnum;
@@ -306,8 +305,7 @@ public class ShopPointServiceImpl implements ShopPointService {
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_4.getCode());
}else{
//没有下一节点 审批通过
Integer pointStatus = SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus()) ? PointStatusEnum.POINT_STATUS_6.getCode() : PointStatusEnum.POINT_STATUS_5.getCode();
updatePoint.setPointStatus(pointStatus);
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_5.getCode());
}
return pointInfoDAO.updatePointInfo(updatePoint);
}
@@ -362,8 +360,7 @@ public class ShopPointServiceImpl implements ShopPointService {
}
PointInfoDO pointInfoUpdate = new PointInfoDO();
pointInfoUpdate.setId(pointId);
Integer pointStatus = SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus()) ? PointStatusEnum.POINT_STATUS_6.getCode() : PointStatusEnum.POINT_STATUS_5.getCode();
pointInfoUpdate.setPointStatus(pointStatus);
pointInfoUpdate.setPointStatus(PointStatusEnum.POINT_STATUS_5.getCode());
return pointInfoDAO.updatePointInfo(pointInfoUpdate);
}
@@ -462,7 +459,13 @@ public class ShopPointServiceImpl implements ShopPointService {
}
@Override
public Integer recommendPoint(RecommendPointRequest request) {
public Integer lineRecommendPoint(LineRecommendPointRequest request) {
List<PointRecommendDO> recommendList = request.convertList();
return pointRecommendDAO.addRecommendPoint(recommendList);
}
@Override
public Integer pointRecommendLine(PointRecommendLineRequest request) {
List<PointRecommendDO> recommendList = request.convertList();
return pointRecommendDAO.addRecommendPoint(recommendList);
}

View File

@@ -62,20 +62,21 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
}
LeaseBaseInfoDO leaseBaseInfoDO = request.toLeaseBaseInfoDO();
Date currentDate = new Date();
LineInfoDO lineInfoDO = new LineInfoDO();
if (request.getExperienceStartTime().compareTo(request.getExperienceEndTime()) >= 0){
throw new ServiceException("结束时间不能早于开始时间");
}
if (currentDate.before(request.getExperienceStartTime())){
leaseBaseInfoDO.setExperienceStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85.getCode());
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85.getCode());
}else if (currentDate.after(request.getExperienceStartTime()) || currentDate.before(request.getExperienceEndTime())){
leaseBaseInfoDO.setExperienceStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_90.getCode());
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_90.getCode());
}else {
throw new ServiceException("时间");
}
trainingExperienceMapper.insert(leaseBaseInfoDO);
LineInfoDO lineInfoDO = new LineInfoDO();
lineInfoDO.setWorkflowSubStage(WorkflowSubStageEnum.STORE_EXPERIENCE.getCode());
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85.getCode());
lineInfoDO.setId(request.getLineId());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
return true;
@@ -85,13 +86,18 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
@Transactional(rollbackFor = Exception.class)
public void experienceStatusChange(Long lineId, Integer status, String abandonCause) {
trainingExperienceMapper.updateStatus(lineId,status,abandonCause);
if (ExperienceStatusEnum.DONE.getExperienceStatus().equals(status)){
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(lineId);
if (ExperienceStatusEnum.DONE.getExperienceStatus().equals(status)){
if (Objects.isNull(lineInfoDO)){
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
lineInfoDO.setWorkflowSubStage(WorkflowSubStageEnum.SECOND_INTERVIEWS.getCode());
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_100.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
}else {
lineInfoDO.setWorkflowSubStage(WorkflowSubStageEnum.STORE_EXPERIENCE.getCode());
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_95.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
}
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.service.impl;
import cn.hutool.core.util.StrUtil;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dao.RegionAreaConfigDao;
import com.cool.store.entity.*;
@@ -86,21 +87,28 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
}
}
Long warRegionId = regionAreaConfigDao.getByWantShopAreaId(wantShopAreaId);
if(warRegionId == null){
return fillDefaultUser(userRoleEnum);
}
// 查找有战区权限的人
List<String> authWarRegionUserIdList = authWarRegionUser(warRegionId);
if(CollectionUtils.isEmpty(authWarRegionUserIdList)){
return null;
return fillDefaultUser(userRoleEnum);
}
Long roleId = userRoleEnum.getCode();
List<String> hasRoleUserIdList = sysRoleMapper.getPositionUserIds(Collections.singletonList(String.valueOf(roleId)));
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum) && CollectionUtils.isEmpty(hasRoleUserIdList)){
// 找大区经理 找不到找战区经理,再找不到找大区经理?
roleId = UserRoleEnum.REGION_MANAGER.getCode();
hasRoleUserIdList = sysRoleMapper.getPositionUserIds(Collections.singletonList(String.valueOf(roleId)));
if(CollectionUtils.isEmpty(hasRoleUserIdList)){
return fillDefaultUser(userRoleEnum);
}
authWarRegionUserIdList.retainAll(hasRoleUserIdList);
if(CollectionUtils.isEmpty(authWarRegionUserIdList)){
return fillDefaultUser(userRoleEnum);
}
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
// 按工号排序后放入redis
authWarRegionUserIdList = authWarRegionUserIdList.stream()
.sorted((a, b) -> a.compareTo(b))
.collect(Collectors.toList());
redisUtilPool.listPushTail(investmentManagerKey, authWarRegionUserIdList.toArray(new String[authWarRegionUserIdList.size()]));
suitableUserId = redisUtilPool.rpopStr(investmentManagerKey);
}else {
@@ -110,6 +118,14 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
return userDO;
}
private EnterpriseUserDO fillDefaultUser(UserRoleEnum userRoleEnum) {
if(UserRoleEnum.INVESTMENT_MANAGER.equals(userRoleEnum)){
EnterpriseUserDO defaultUser = enterpriseUserDAO.getUserInfoByJobnumber(CommonConstants.DEAULT_INVESTMENT_JOBNUMBER);
return defaultUser;
}
return null;
}
@Override
public Map<String, List<String>> getUserIdByRoleIdAndRegionId(List<String> roleIds, Long regionId) {
if(CollectionUtils.isEmpty(roleIds) || Objects.isNull(regionId)){
@@ -126,7 +142,7 @@ public class UserAuthMappingServiceImpl implements UserAuthMappingService {
}
List<Long> roleIdList = roleIds.stream().map(a -> Long.valueOf(a)).collect(Collectors.toList());
List<EnterpriseUserRole> enterpriseUserRoleList = sysRoleMapper.getUserIdListByRoleIdList(roleIdList);
enterpriseUserRoleList = enterpriseUserRoleList.stream().filter(o -> authRegionUserIdList.contains(o.getUserId())).collect(Collectors.toList());
enterpriseUserRoleList = ListUtils.emptyIfNull(enterpriseUserRoleList).stream().filter(o -> authRegionUserIdList.contains(o.getUserId())).collect(Collectors.toList());
Map<String, List<String>> enterpriseUserRoleMap = ListUtils.emptyIfNull(enterpriseUserRoleList).stream().collect(Collectors.groupingBy(EnterpriseUserRole::getRoleId, Collectors.mapping(k->k.getUserId(), Collectors.toList())));
return enterpriseUserRoleMap;
}

View File

@@ -152,11 +152,18 @@ public class ShopPointController {
return ResponseResult.success(shopPointService.getRecommendPointList(request));
}
@ApiOperation("铺位推送")
@PostMapping("/recommendPoint")
public ResponseResult<Integer> recommendPoint(@RequestBody @Validated RecommendPointRequest request) {
@ApiOperation("加盟商详情推送铺位")
@PostMapping("/lineRecommendPoint")
public ResponseResult<Integer> lineRecommendPoint(@RequestBody @Validated LineRecommendPointRequest request) {
request.setDevelopmentManager(CurrentUserHolder.getUserId());
return ResponseResult.success(shopPointService.recommendPoint(request));
return ResponseResult.success(shopPointService.lineRecommendPoint(request));
}
@ApiOperation("铺位详情推送加盟商")
@PostMapping("/pointRecommendLine")
public ResponseResult<Integer> pointRecommendLine(@RequestBody @Validated PointRecommendLineRequest request) {
request.setDevelopmentManager(CurrentUserHolder.getUserId());
return ResponseResult.success(shopPointService.pointRecommendLine(request));
}
@ApiOperation("选址人员转让加盟商")

View File

@@ -41,7 +41,7 @@ public class LineInterviewController {
@GetMapping("/appointment/time")
@ApiImplicitParams({
@ApiImplicitParam(name = "lineId", value = "线索id", required = true),
@ApiImplicitParam(name = "interviewType", value = "面试类型:0面谈;1面试", required = true),
@ApiImplicitParam(name = "interviewType", value = "面试类型:0面谈;1一审;2二审", required = true),
@ApiImplicitParam(name = "appointmentDate", value = "预约日期 yyyy-MM-dd", required = true)
})
public ResponseResult<List<AppointmentTimeVO>> getAppointmentTime(@RequestParam("lineId")Long lineId,