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

This commit is contained in:
zhangchenbiao
2024-04-07 17:21:21 +08:00
8 changed files with 89 additions and 22 deletions

View File

@@ -66,5 +66,4 @@ public interface EnterpriseUserMapper {
EnterpriseUserDO selectByMobile( @Param("mobile") String mobile);
EnterpriseUserDO selectByInvestmentManager( @Param("investmentManager") String investmentManager);
}

View File

@@ -97,4 +97,5 @@ public interface RegionMapper {
List<RegionDO> listByThirdRegionType(@Param("parentId")Long parentId, @Param("thirdRegionType")String thirdRegionType);
RegionDO getRegionByStoreId(@Param("storeId") String storeId);
}

View File

@@ -138,4 +138,5 @@ public interface SysRoleMapper {
List<SysRoleDO> getRolesByNamesAndSource(@Param("roleNames") List<String> roleNames, @Param("source") String source);
List<SysRoleDO> getXFStoreManager(@Param("roleNames") List<String> roleNames);
}

View File

@@ -320,11 +320,11 @@
<select id="listByInterview" resultMap="BaseResultMap">
select * from xfsg_line_info
where deleted = 0
<if test="interviewType != null and interviewType == '1'">
and first_interviewer = #{investmentManagerUserId}
<if test="interviewType != null and interviewType == 1">
and first_interviewer = #{interviewId}
</if>
<if test="interviewType != null and interviewType == '2'">
and second_interviewer = #{investmentManagerUserId}
<if test="interviewType != null and interviewType == 2">
and second_interviewer = #{interviewId}
</if>
<if test="codes !=null and codes.size>0">
<foreach collection="codes" item="code" open="and workflow_sub_stage_status in (" close=")" separator=",">
@@ -335,37 +335,38 @@
<select id="lineList" resultMap="BaseResultMap">
select * from xfsg_line_info
where deleted = 0 and line_status = 1 and join_status = 0
select * from xfsg_line_info a
left join xfsg_open_area_info b on a.want_shop_area_id = b.id
where a.deleted = 0 and a.line_status = 1 and a.join_status = 0
<if test="userId != null and userId != ''">
and investment_manager = #{userId}
and a.investment_manager = #{userId}
</if>
<if test="wantShopAreaName != null">
and b.area_path like concat('%',#{wantShopAreaName},'%')
</if>
<if test="request.userName != null and request.username!=''">
and username = #{request.userName}
and a.username = #{request.userName}
</if>
<if test="request.keyword != null and request.keyword!=''">
and (a.username like #{request.userName} or a.mobile like #{request.mobile})
and (a.username like concat('%',#{request.keyword},'%') or a.mobile like concat('%',#{request.keyword},'%'))
</if>
<if test="request.mobile != null and request.mobile!=''">
and mobile = #{request.mobile}
and a.mobile = #{request.mobile}
</if>
<if test="request.wantShopAreaId != null">
and want_shop_area_id = #{request.wantShopAreaId}
and a.want_shop_area_id = #{request.wantShopAreaId}
</if>
<if test="request.lineSource != null">
and line_source = #{request.lineSource}
and a.line_source = #{request.lineSource}
</if>
<if test="request.createTimeStart!=null and request.createTimeEnd!=null">
and create_time between #{request.createTimeStart} and #{request.createTimeEnd}
and a.create_time between #{request.createTimeStart} and #{request.createTimeEnd}
</if>
<if test="request.investmentManagerUserId != null and request.investmentManagerUserId != ''">
and investment_manager = #{request.investmentManagerUserId}
and a.investment_manager = #{request.investmentManagerUserId}
</if>
<if test="wantShopAreaIds !=null and wantShopAreaIds.size>0">
<foreach collection="wantShopAreaIds" item="wantShopAreaId" open="and want_shop_area_id in (" close=")" separator=",">
<foreach collection="wantShopAreaIds" item="wantShopAreaId" open="and a.want_shop_area_id in (" close=")" separator=",">
#{wantShopAreaId}
</foreach>
</if>
@@ -412,7 +413,7 @@
and mobile = #{request.mobile}
</if>
<if test="request.keyword != null and request.keyword!=''">
and (a.username like #{request.userName} or a.mobile like #{request.mobile})
and (username like #{request.keyword} or mobile like #{request.keyword})
</if>
<if test="request.lineSource != null">
and line_source = #{request.lineSource}

View File

@@ -345,6 +345,13 @@
and third_region_type = #{thirdRegionType}
</if>
</select>
<select id="getRegionByStoreId" resultType="com.cool.store.entity.RegionDO">
select <include refid="fields"/>
from region_${enterpriseId}
where deleted = 0
and store_id = #{storeId}
and region_type = 'store'
</select>
</mapper>

View File

@@ -358,5 +358,21 @@
#{roleName}
</foreach>
</select>
<select id="getXFStoreManager" resultType="com.cool.store.entity.SysRoleDO">
select
*
from sys_role_${enterpriseId}
where
(
source = 'sync'
or
source = 'sync_position'
)
and role_name in
<foreach collection="roleNames" item="roleName" open="(" close=")" separator=",">
#{roleName}
</foreach>
</select>
</mapper>

View File

@@ -31,5 +31,7 @@ public class LeaseBaseInfoDO {
private Integer deleted;
private String storeManager;
}

View File

@@ -1,16 +1,14 @@
package com.cool.store.service.impl;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.LeaseBaseInfoDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.ExperienceStatusEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.TrainingExperienceMapper;
import com.cool.store.mapper.*;
import com.cool.store.request.TrainingExperienceDistributionRequest;
import com.cool.store.service.TrainingExperienceService;
import lombok.extern.slf4j.Slf4j;
@@ -19,7 +17,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.annotation.Tainted;
import java.util.Objects;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import static com.cool.store.enums.ErrorCodeEnum.INTERVIEW_LINE_ID_IS_NULL;
@@ -35,6 +35,22 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
@Resource
LineInfoDAO lineInfoDAO;
@Resource
SysRoleMapper sysRoleMapper;
@Resource
EnterpriseUserMapper enterpriseUserMapper;
@Resource
RegionMapper regionMapper;
@Resource
UserAuthMappingMapper userAuthMappingMapper;
@Resource
EnterpriseUserRoleMapper enterpriseUserRoleMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public boolean distribution(TrainingExperienceDistributionRequest request) {
@@ -45,6 +61,17 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
throw new ServiceException(INTERVIEW_LINE_ID_IS_NULL);
}
LeaseBaseInfoDO leaseBaseInfoDO = request.toLeaseBaseInfoDO();
Date currentDate = new Date();
if (request.getExperienceStartTime().compareTo(request.getExperienceEndTime()) >= 0){
throw new ServiceException("结束时间不能早于开始时间");
}
if (currentDate.before(request.getExperienceStartTime())){
leaseBaseInfoDO.setExperienceStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_85.getCode());
}else if (currentDate.after(request.getExperienceStartTime()) || currentDate.before(request.getExperienceEndTime())){
leaseBaseInfoDO.setExperienceStatus(WorkflowSubStageStatusEnum.STORE_EXPERIENCE_90.getCode());
}else {
throw new ServiceException("时间");
}
trainingExperienceMapper.insert(leaseBaseInfoDO);
LineInfoDO lineInfoDO = new LineInfoDO();
lineInfoDO.setWorkflowSubStage(WorkflowSubStageEnum.STORE_EXPERIENCE.getCode());
@@ -71,7 +98,20 @@ public class TrainingExperienceServiceImpl extends LineFlowService implements Tr
@Override
public LeaseBaseInfoDO getTrainingExperience(Long lineId) {
String eid = "e17cd2dc350541df8a8b0af9bd27f77d";
List<String> roleNames = new ArrayList<>();
roleNames.add("加盟店店长");
roleNames.add("加盟店储备店长");
LeaseBaseInfoDO leaseBaseInfoDO = trainingExperienceMapper.selectByLineId(lineId);
String storeId = leaseBaseInfoDO.getStoreId();
RegionDO regionDO = regionMapper.getRegionByStoreId(storeId);
List<SysRoleDO> xfStoreManager = sysRoleMapper.getXFStoreManager(roleNames);
List<Long> roleIds = xfStoreManager.stream().map(SysRoleDO::getId).collect(Collectors.toList());
List<String> userIdsByRoleIdList = enterpriseUserRoleMapper.getUserIdsByRoleIdList(roleIds);
List<EnterpriseUserDO> userInfoByUserIds = enterpriseUserMapper.getUserInfoByUserIds(userIdsByRoleIdList);
String storeManagers = userInfoByUserIds.stream().map(EnterpriseUserDO::getName).collect(Collectors.toList()).toString();
leaseBaseInfoDO.setStoreManager(storeManagers);
return leaseBaseInfoDO;
}