Commit 96143a48 by 谢海旭

Merge remote-tracking branch 'origin/v5.7.1' into v5.7.1

2 parents a358eedd a9c92df1
package cn.com.glsx.dj.staff.dto.recruitment;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class RecruitmentDemandMerchantOverviewDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "需求总数(招聘数量累计)")
private Integer allOfDemand;
@ApiModelProperty(notes = "在招数量(需求总数 - 入职人数)")
private Integer recruitingCount;
@ApiModelProperty(notes = "入职人数")
private Integer allOfOnboarding;
@ApiModelProperty(notes = "离职人数")
private Integer resignedCount;
}
package cn.com.glsx.dj.staff.dto.recruitment;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class RecruitmentDemandMerchantOverviewQueryDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "门店商户号", required = true)
private Integer merchantId;
@ApiModelProperty(notes = "业务类型:1.延保 2.轻改 3.权益")
private Integer biz;
}
...@@ -54,6 +54,11 @@ public interface RecruitmentDemandRemote { ...@@ -54,6 +54,11 @@ public interface RecruitmentDemandRemote {
@ApiResponse("导出数据列表") @ApiResponse("导出数据列表")
RpcResponse<List<RecruitmentDemandExportDTO>> recruitmentDemandExportData(RpcPagination<RecruitmentDemandPageRecordDTO> pagination); RpcResponse<List<RecruitmentDemandExportDTO>> recruitmentDemandExportData(RpcPagination<RecruitmentDemandPageRecordDTO> pagination);
@ApiMethod("门店招聘概况")
@ApiParam(name = "dto", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("门店招聘概况")
RpcResponse<RecruitmentDemandMerchantOverviewDTO> recruitmentDemandMerchantOverview(@NotNull RecruitmentDemandMerchantOverviewQueryDTO dto);
@interface UpdateConfirmFlagToConfirmed{} @interface UpdateConfirmFlagToConfirmed{}
@ApiMethod("标记招聘需求已确认") @ApiMethod("标记招聘需求已确认")
@ApiParam(name = "dto", notes = "记录id 更新人等信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "dto", notes = "记录id 更新人等信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
......
...@@ -79,5 +79,10 @@ ...@@ -79,5 +79,10 @@
<artifactId>open-platform-sdk</artifactId> <artifactId>open-platform-sdk</artifactId>
<version>1.0.48</version> <version>1.0.48</version>
</dependency> </dependency>
<dependency>
<groupId>cn.com.glsx.merchants</groupId>
<artifactId>platform-merchants-api</artifactId>
<version>5.7.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.staff.config.dubbo;
import cn.com.glsx.dj.staff.config.DubboConfig;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author yangwei
* @version 1.0
* @since 2026/01/20 14:53
*/
@Configuration
@RequiredArgsConstructor
public class MerchantDubboConfig extends DubboConfig {
// @Bean
// public MerchantStaffRemote merchantStaffRemote() {
// return factory
// .builder(MerchantStaffRemote.class)
// .check(false)
// .timeout(30000)
// .build();
// }
@Bean
public MerchantStaffRemote merchantStaffRemote() {
return factory.builder(MerchantStaffRemote.class).version("2.0.0").check(check).timeout(timeout).build();
}
}
...@@ -5,9 +5,11 @@ import cn.com.glsx.dj.staff.dto.StaffPerformanceDailyReportQueryDTO; ...@@ -5,9 +5,11 @@ import cn.com.glsx.dj.staff.dto.StaffPerformanceDailyReportQueryDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceOrderQueryDTO; import cn.com.glsx.dj.staff.dto.StaffPerformanceOrderQueryDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO; import cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 员工绩效计算Mapper * 员工绩效计算Mapper
...@@ -30,4 +32,10 @@ public interface StaffPerformanceCalMapper extends OreMapper<StaffProductPerform ...@@ -30,4 +32,10 @@ public interface StaffPerformanceCalMapper extends OreMapper<StaffProductPerform
* @return 日报数据列表 * @return 日报数据列表
*/ */
Integer statPreSalesTouchCount(StaffPerformanceDailyReportQueryDTO query); Integer statPreSalesTouchCount(StaffPerformanceDailyReportQueryDTO query);
List<String> listStaffUuidByPhoneList(@Param("phones") List<String> phones);
Integer statMerchantResignedStaffCountByBusinessType(@Param("merchantId") Integer merchantId,
@Param("businessTypeList") List<Integer> businessTypeList,
@Param("staffUuids") List<String> staffUuids);
} }
...@@ -189,6 +189,17 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{ ...@@ -189,6 +189,17 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{
} }
@Override @Override
public RpcResponse<RecruitmentDemandMerchantOverviewDTO> recruitmentDemandMerchantOverview(RecruitmentDemandMerchantOverviewQueryDTO dto) {
try {
RecruitmentDemandMerchantOverviewDTO overview = recruitmentDemandService.recruitmentDemandMerchantOverview(dto);
return RpcResponse.success(overview);
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> updateConfirmFlagToConfirmed(RecruitmentDemandDTO dto) { public RpcResponse<Boolean> updateConfirmFlagToConfirmed(RecruitmentDemandDTO dto) {
try{ try{
return RpcResponse.success(recruitmentDemandService.updateConfirmFlagToConfirmed(dto)); return RpcResponse.success(recruitmentDemandService.updateConfirmFlagToConfirmed(dto));
......
...@@ -26,6 +26,9 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse; ...@@ -26,6 +26,9 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
import cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListRequestDTO;
import cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListResonseDTO;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.com.glsx.scrm.proxy.dto.merchant.ListMerchantRequest; import cn.com.glsx.scrm.proxy.dto.merchant.ListMerchantRequest;
import cn.com.glsx.scrm.proxy.enums.AccountTypeEnum; import cn.com.glsx.scrm.proxy.enums.AccountTypeEnum;
import cn.com.glsx.scrm.proxy.model.merchant.MerchantRopResponse; import cn.com.glsx.scrm.proxy.model.merchant.MerchantRopResponse;
...@@ -114,6 +117,12 @@ public class RecruitmentDemandService { ...@@ -114,6 +117,12 @@ public class RecruitmentDemandService {
@Autowired @Autowired
private TechnicalSupervisorMappingMapper technicalSupervisorMappingMapper; private TechnicalSupervisorMappingMapper technicalSupervisorMappingMapper;
@Autowired
private MerchantStaffRemote merchantStaffRemote;
@Autowired
private StaffPerformanceCalMapper staffPerformanceCalMapper;
/** /**
* 招聘需求统计 * 招聘需求统计
* *
...@@ -1190,6 +1199,124 @@ public class RecruitmentDemandService { ...@@ -1190,6 +1199,124 @@ public class RecruitmentDemandService {
return summary; return summary;
} }
public RecruitmentDemandMerchantOverviewDTO recruitmentDemandMerchantOverview(RecruitmentDemandMerchantOverviewQueryDTO dto) {
RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL, "dto not be null");
RpcAssert.assertNotNull(dto.getMerchantId(), DefaultErrorEnum.DATA_NULL, "merchantId not be empty");
RecruitmentDemandMerchantOverviewDTO overview = new RecruitmentDemandMerchantOverviewDTO();
overview.setAllOfDemand(0);
overview.setAllOfOnboarding(0);
overview.setRecruitingCount(0);
overview.setResignedCount(0);
Example demandExample = new Example(RecruitmentDemand.class);
demandExample.createCriteria()
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name())
.andEqualTo("merchantId", dto.getMerchantId())
.andIn("status", Arrays.asList(
RecruitmentDemandStatusEnum.WAIT_HUMAN_CONFIRM.getValue(),
RecruitmentDemandStatusEnum.RECRUITING.getValue(),
RecruitmentDemandStatusEnum.COMPLETED.getValue(),
RecruitmentDemandStatusEnum.WAIT_SUPERVISOR_CONFIRM.getValue()
))
.andIn("businessType", Arrays.asList(
RecruitmentDemandBusinessTypeEnum.EXTENDED_WARRANTY.getValue(),
RecruitmentDemandBusinessTypeEnum.RIGHTS_EXTENDED_WARRANTY.getValue()
));
List<RecruitmentDemand> demands = recruitmentDemandMapper.selectByExample(demandExample);
Integer allOfDemand = 0;
int allOfOnboarding = 0;
if (CollectionUtils.isNotEmpty(demands)) {
allOfDemand = demands.stream()
.map(RecruitmentDemand::getRecruitmentQuantity)
.filter(Objects::nonNull)
.reduce(Integer::sum)
.orElse(0);
overview.setAllOfDemand(allOfDemand);
List<Integer> demandIds = demands.stream().map(RecruitmentDemand::getId).filter(Objects::nonNull).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(demandIds)) {
Example planExample = new Example(RecruitmentOnboardingPlan.class);
planExample.createCriteria()
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name())
.andIn("demandId", demandIds);
allOfOnboarding = planMapper.selectCountByExample(planExample);
overview.setAllOfOnboarding(allOfOnboarding);
}
}
//在招数量: 需求总数-入职人数
int recruitingCount = allOfDemand - allOfOnboarding;
overview.setRecruitingCount(Math.max(recruitingCount, 0));
//计算离职人数
Integer merchantId = dto.getMerchantId();
if (merchantId != null) {
List<Integer> businessTypeList = mapBizToOrderBusinessTypeList(dto.getBiz());
int resignedCount = statMerchantResignedStaffCount(merchantId, businessTypeList);
overview.setResignedCount(Math.max(resignedCount, 0));
}
return overview;
}
private int statMerchantResignedStaffCount(Integer merchantId, List<Integer> businessTypeList) {
//查询北森离职人员手机号列表
List<String> resignedPhones = listResignedStaffPhonesFromBeisen();
if (CollectionUtils.isEmpty(resignedPhones)) {
return 0;
}
//根据手机号查询uuid列表
List<String> staffUuids = staffPerformanceCalMapper.listStaffUuidByPhoneList(resignedPhones);
if (CollectionUtils.isEmpty(staffUuids)) {
return 0;
}
//根据员工/4s店/场景 查询是否存在订单记录
Integer rows = staffPerformanceCalMapper.statMerchantResignedStaffCountByBusinessType(merchantId, businessTypeList, staffUuids);
if (Objects.isNull(rows)) {
return 0;
}
return rows;
}
private List<String> listResignedStaffPhonesFromBeisen() {
try {
RpcPagination<BeiSenEmployeeListRequestDTO> pagination = new RpcPagination<>();
BeiSenEmployeeListRequestDTO condition = new BeiSenEmployeeListRequestDTO();
pagination.setCondition(condition);
pagination.setPageNum(1);
pagination.setPageSize(10000);
condition.setStatus(0);
condition.setStdIsDeleted(0);
RpcResponse<RpcPagination<BeiSenEmployeeListResonseDTO>> rpcRes = merchantStaffRemote.getBeisenUserWithConditions(pagination);
if (!rpcRes.hasResult() || rpcRes.getResult() == null || CollectionUtils.isEmpty(rpcRes.getResult().getList())) {
return Collections.emptyList();
}
return rpcRes.getResult().getList().stream()
.map(BeiSenEmployeeListResonseDTO::getMobilePhone)
.filter(StringUtils::isNotBlank)
.distinct()
.collect(Collectors.toList());
} catch (Exception e) {
log.error("查询北森离职人员手机号失败", e);
return Collections.emptyList();
}
}
private List<Integer> mapBizToOrderBusinessTypeList(Integer biz) {
if (biz == null) {
return Arrays.asList(1, 2);
}
if (Objects.equals(biz, 1)) {
return Collections.singletonList(2);
}
if (Objects.equals(biz, 3)) {
return Collections.singletonList(1);
}
return Collections.emptyList();
}
public List<RecruitmentDemandExportDTO> recruitmentDemandExportData(RpcPagination<RecruitmentDemandPageRecordDTO> pagination) { public List<RecruitmentDemandExportDTO> recruitmentDemandExportData(RpcPagination<RecruitmentDemandPageRecordDTO> pagination) {
Page<RecruitmentDemandPageRecordDTO> page = this.recruitmentDemandWebPage(pagination); Page<RecruitmentDemandPageRecordDTO> page = this.recruitmentDemandWebPage(pagination);
List<RecruitmentDemandPageRecordDTO> demands = page.getResult(); List<RecruitmentDemandPageRecordDTO> demands = page.getResult();
......
...@@ -97,4 +97,40 @@ ...@@ -97,4 +97,40 @@
</if> </if>
</where> </where>
</select> </select>
<select id="listStaffUuidByPhoneList" resultType="java.lang.String">
select distinct dclsi.staff_uuid
from dj_car_life_staff_info dclsi
<where>
dclsi.deleted_flag = 'N'
<if test="phones != null and phones.size > 0">
and dclsi.phone_number in
<foreach item="item" index="index" collection="phones" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="statMerchantResignedStaffCountByBusinessType" resultType="java.lang.Integer">
select
ifnull(count(distinct dclgo.seller_user_id), 0)
from dj_car_life_goods_order dclgo
<where>
dclgo.deleted_flag = 'N'
and dclgo.merchant_id = #{merchantId}
<if test="businessTypeList != null and businessTypeList.size > 0">
and dclgo.business_type in
<foreach item="item" index="index" collection="businessTypeList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="staffUuids != null and staffUuids.size > 0">
and dclgo.seller_user_id in
<foreach item="item" index="index" collection="staffUuids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
...@@ -109,4 +109,16 @@ public class RecruitmentDemandServiceTest extends BaseServiceTest { ...@@ -109,4 +109,16 @@ public class RecruitmentDemandServiceTest extends BaseServiceTest {
dto.getRecruiterName() dto.getRecruiterName()
); );
} }
@Test
public void testRecruitmentDemandMerchantOverview() {
RecruitmentDemandMerchantOverviewQueryDTO dto = new RecruitmentDemandMerchantOverviewQueryDTO();
dto.setMerchantId(44211847);
dto.setBiz(1);
RecruitmentDemandMerchantOverviewDTO res = recruitmentDemandService.recruitmentDemandMerchantOverview(dto);
System.out.print(JSON.toJSON(res));
}
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!