Commit 9a764d7e by 叶立庆

Merge branch 'v5.8.7.5' into 'master'

上线合并

See merge request !27
2 parents 406b38ae 27c36454
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</parent> </parent>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-staff-api</artifactId> <artifactId>rpc-dj-staff-api</artifactId>
<version>5.8.6-SNAPSHOT</version> <version>5.8.7.5-SNAPSHOT</version>
<name>rpc-dj-staff-api</name> <name>rpc-dj-staff-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.dj.staff.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.dj.staff.remote</deploy.scanPackage>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-staff-api</artifactId> <artifactId>rpc-dj-staff-api</artifactId>
<version>5.8.6-SNAPSHOT</version> <version>5.8.7.5-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
......
...@@ -55,6 +55,18 @@ public class RecruitmentProvinceHrbpRelation implements Serializable { ...@@ -55,6 +55,18 @@ public class RecruitmentProvinceHrbpRelation implements Serializable {
private String provinceCode; private String provinceCode;
/** /**
* 市级编码,NULL 表示省级/全省份
*/
@Column(name = "city_code")
private String cityCode;
/**
* 市级名称
*/
@Column(name = "city_name")
private String cityName;
/**
* HRBP姓名 * HRBP姓名
*/ */
@Column(name = "hrbp_name") @Column(name = "hrbp_name")
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</parent> </parent>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-staff</artifactId> <artifactId>rpc-dj-staff</artifactId>
<version>5.8.5-SNAPSHOT</version> <version>5.8.7.5-SNAPSHOT</version>
<name>rpc-dj-staff</name> <name>rpc-dj-staff</name>
<packaging>war</packaging> <packaging>war</packaging>
<dependencies> <dependencies>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-staff-api</artifactId> <artifactId>rpc-dj-staff-api</artifactId>
<version>5.8.6-SNAPSHOT</version> <version>5.8.7.5-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.oreframework.boot</groupId> <groupId>org.oreframework.boot</groupId>
......
...@@ -95,6 +95,12 @@ public class RecruitmentDemandService { ...@@ -95,6 +95,12 @@ public class RecruitmentDemandService {
/** 试岗结果通知-人力(招聘负责人)消息内容模板:你好,{区域运营姓名}发起的{试岗人员姓名}在{门店}{场景},试岗结果为:{通过/不通过} */ /** 试岗结果通知-人力(招聘负责人)消息内容模板:你好,{区域运营姓名}发起的{试岗人员姓名}在{门店}{场景},试岗结果为:{通过/不通过} */
private static final String TRIAL_PROCESSED_HR_MESSAGE_TEMPLATE = "你好,%s发起的%s在%s%s,试岗结果为:%s"; private static final String TRIAL_PROCESSED_HR_MESSAGE_TEMPLATE = "你好,%s发起的%s在%s%s,试岗结果为:%s";
/** HRBP 关系表中「负责全国」标识 */
private static final int HRBP_ALL_PROVINCE_YES = 1;
/** 省市编码分隔符 */
private static final String PROVINCE_CITY_CODE_SEPARATOR = "/";
@Autowired @Autowired
private RecruitmentDemandMapper recruitmentDemandMapper; private RecruitmentDemandMapper recruitmentDemandMapper;
...@@ -242,6 +248,7 @@ public class RecruitmentDemandService { ...@@ -242,6 +248,7 @@ public class RecruitmentDemandService {
String merchantId = dto.getMerchantId(); String merchantId = dto.getMerchantId();
String provinceName = null; String provinceName = null;
String provinceCode = null; String provinceCode = null;
String cityCode = null;
boolean bySystemMerchant = !Boolean.FALSE.equals(dto.getBySystemMerchant()); boolean bySystemMerchant = !Boolean.FALSE.equals(dto.getBySystemMerchant());
if (bySystemMerchant) { if (bySystemMerchant) {
// 通过系统门店创建:查询门店省市信息 // 通过系统门店创建:查询门店省市信息
...@@ -279,7 +286,13 @@ public class RecruitmentDemandService { ...@@ -279,7 +286,13 @@ public class RecruitmentDemandService {
if (StringUtils.isNotBlank(merchant.getMerchantAddress())) { if (StringUtils.isNotBlank(merchant.getMerchantAddress())) {
dto.setMerchantAddressDetail(merchant.getMerchantAddress()); dto.setMerchantAddressDetail(merchant.getMerchantAddress());
} }
// 省市编码用于 HRBP 三级匹配,省编码可能为空,需先判空
if (Objects.nonNull(merchant.getProvinceCode())) {
provinceCode = merchant.getProvinceCode().toString(); provinceCode = merchant.getProvinceCode().toString();
cityCode = Objects.nonNull(merchant.getCityCode()) ? merchant.getCityCode().toString() : null;
dto.setProvinceCityCode(provinceCode + PROVINCE_CITY_CODE_SEPARATOR
+ (Objects.nonNull(cityCode) ? cityCode : ""));
}
} }
} }
} }
...@@ -338,6 +351,7 @@ public class RecruitmentDemandService { ...@@ -338,6 +351,7 @@ public class RecruitmentDemandService {
// 省份信息用于查询技术督导和 HRBP // 省份信息用于查询技术督导和 HRBP
provinceName = pc.getProvinceName(); provinceName = pc.getProvinceName();
provinceCode = pc.getProvinceId() != null ? pc.getProvinceId().toString() : null; provinceCode = pc.getProvinceId() != null ? pc.getProvinceId().toString() : null;
cityCode = Objects.nonNull(pc.getCityId()) ? pc.getCityId().toString() : null;
} else { } else {
log.error("查询潜客门店详情失败,potentialCustomerId:{},msg:{}", dto.getPotentialCustomerId(), pcResp.getMessage()); log.error("查询潜客门店详情失败,potentialCustomerId:{},msg:{}", dto.getPotentialCustomerId(), pcResp.getMessage());
} }
...@@ -346,31 +360,11 @@ public class RecruitmentDemandService { ...@@ -346,31 +360,11 @@ public class RecruitmentDemandService {
} }
} }
//二手车、轻改、窗膜技师、三膜技师、车衣技师、精品技师、洗车工 // 匹配招聘负责人(HRBP):全国 → 市 → 省
Example hrbpRelation = new Example(RecruitmentProvinceHrbpRelation.class); RecruitmentProvinceHrbpRelation hrbpRelation = matchHrbpRelation(businessType, provinceCode, cityCode);
hrbpRelation.createCriteria() if (Objects.nonNull(hrbpRelation)) {
.andEqualTo("businessType", businessType) dto.setRecruiterName(hrbpRelation.getHrbpName());
.andEqualTo("isAllProvince", 1) dto.setRecruiterPhone(hrbpRelation.getHrbpPhone());
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
List<RecruitmentProvinceHrbpRelation> hrbpRelations = provinceHrbpRelationMapper.selectByExample(hrbpRelation);
if (CollectionUtils.isNotEmpty(hrbpRelations)) {
dto.setRecruiterName(hrbpRelations.get(0).getHrbpName());
dto.setRecruiterPhone(hrbpRelations.get(0).getHrbpPhone());
}
//根据业务、省份查询HRBP
else {
if (StringUtils.isNotBlank(provinceCode)) {
Example relation = new Example(RecruitmentProvinceHrbpRelation.class);
relation.createCriteria()
.andEqualTo("businessType", businessType)
.andEqualTo("provinceCode", provinceCode)
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
List<RecruitmentProvinceHrbpRelation> relations = provinceHrbpRelationMapper.selectByExample(relation);
if (CollectionUtils.isNotEmpty(relations)) {
dto.setRecruiterName(relations.get(0).getHrbpName());
dto.setRecruiterPhone(relations.get(0).getHrbpPhone());
}
}
} }
// 根据省份查询技术督导(仅针对特定业务类型:窗膜技师、三膜技师、车衣技师、精品技师) // 根据省份查询技术督导(仅针对特定业务类型:窗膜技师、三膜技师、车衣技师、精品技师)
...@@ -411,6 +405,80 @@ public class RecruitmentDemandService { ...@@ -411,6 +405,80 @@ public class RecruitmentDemandService {
return dto; return dto;
} }
/**
* 匹配招聘负责人(HRBP),按「全国 → 市 → 省」三级优先级依次匹配
*
* @param businessType 业务类型
* @param provinceCode 省份编码
* @param cityCode 城市编码,可为空
* @return cn.com.glsx.dj.staff.model.RecruitmentProvinceHrbpRelation 命中的 HRBP 关系,未命中返回 null
* @author yangwei_by_claude
* @since 2026/11/4 10:20
*/
private RecruitmentProvinceHrbpRelation matchHrbpRelation(String businessType, String provinceCode, String cityCode) {
// 1. 全国配置优先级最高,保持原有行为
Example allProvinceExample = new Example(RecruitmentProvinceHrbpRelation.class);
allProvinceExample.createCriteria()
.andEqualTo("businessType", businessType)
.andEqualTo("isAllProvince", HRBP_ALL_PROVINCE_YES)
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
allProvinceExample.orderBy("id").asc();
List<RecruitmentProvinceHrbpRelation> allProvinceRelations = provinceHrbpRelationMapper.selectByExample(allProvinceExample);
if (CollectionUtils.isNotEmpty(allProvinceRelations)) {
return allProvinceRelations.get(0);
}
if (StringUtils.isBlank(provinceCode)) {
log.warn("招聘负责人匹配未命中,省份编码为空。businessType:{},cityCode:{}", businessType, cityCode);
return null;
}
// 2. 市级配置
if (StringUtils.isNotBlank(cityCode)) {
RecruitmentProvinceHrbpRelation cityRelation = selectHrbpRelation(businessType, provinceCode, cityCode, false);
if (Objects.nonNull(cityRelation)) {
return cityRelation;
}
}
// 3. 省级兜底,city_code 必须为 NULL,避免捞到同省市级配置
RecruitmentProvinceHrbpRelation provinceRelation = selectHrbpRelation(businessType, provinceCode, null, true);
if (Objects.nonNull(provinceRelation)) {
return provinceRelation;
}
log.warn("招聘负责人匹配未命中。businessType:{},provinceCode:{},cityCode:{}", businessType, provinceCode, cityCode);
return null;
}
/**
* 按业务类型、省份、城市查询 HRBP 关系
*
* @param businessType 业务类型
* @param provinceCode 省份编码
* @param cityCode 城市编码,cityCodeIsNull 为 true 时忽略
* @param cityCodeIsNull 是否只查询 city_code 为 NULL 的省级配置
* @return cn.com.glsx.dj.staff.model.RecruitmentProvinceHrbpRelation 命中的 HRBP 关系,未命中返回 null
* @author yangwei_by_claude
* @since 2026/11/4 10:20
*/
private RecruitmentProvinceHrbpRelation selectHrbpRelation(String businessType, String provinceCode,
String cityCode, boolean cityCodeIsNull) {
Example relationExample = new Example(RecruitmentProvinceHrbpRelation.class);
Example.Criteria criteria = relationExample.createCriteria()
.andEqualTo("businessType", businessType)
.andEqualTo("provinceCode", provinceCode)
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
if (cityCodeIsNull) {
criteria.andIsNull("cityCode");
} else {
criteria.andEqualTo("cityCode", cityCode);
}
relationExample.orderBy("id").asc();
List<RecruitmentProvinceHrbpRelation> relations = provinceHrbpRelationMapper.selectByExample(relationExample);
return CollectionUtils.isNotEmpty(relations) ? relations.get(0) : null;
}
public Page<RecruitmentDemandPageRecordDTO> recruitmentDemandWebPage(RpcPagination<RecruitmentDemandPageRecordDTO> pagination) { public Page<RecruitmentDemandPageRecordDTO> recruitmentDemandWebPage(RpcPagination<RecruitmentDemandPageRecordDTO> pagination) {
Page<RecruitmentDemandPageRecordDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount()); Page<RecruitmentDemandPageRecordDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount());
recruitmentDemandMapper.recruitmentDemandWebPage(pagination.getCondition()); recruitmentDemandMapper.recruitmentDemandWebPage(pagination.getCondition());
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
<result column="is_all_province" property="isAllProvince" jdbcType="TINYINT" /> <result column="is_all_province" property="isAllProvince" jdbcType="TINYINT" />
<result column="province_name" property="provinceName" jdbcType="VARCHAR" /> <result column="province_name" property="provinceName" jdbcType="VARCHAR" />
<result column="province_code" property="provinceCode" jdbcType="VARCHAR" /> <result column="province_code" property="provinceCode" jdbcType="VARCHAR" />
<result column="city_code" property="cityCode" jdbcType="VARCHAR" />
<result column="city_name" property="cityName" jdbcType="VARCHAR" />
<result column="hrbp_name" property="hrbpName" jdbcType="VARCHAR" /> <result column="hrbp_name" property="hrbpName" jdbcType="VARCHAR" />
<result column="hrbp_phone" property="hrbpPhone" jdbcType="VARCHAR" /> <result column="hrbp_phone" property="hrbpPhone" jdbcType="VARCHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" /> <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
...@@ -24,7 +26,7 @@ ...@@ -24,7 +26,7 @@
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, business_type, business_type_name, is_all_province, province_name, id, business_type, business_type_name, is_all_province, province_name,
province_code, hrbp_name, hrbp_phone, created_by, created_date, province_code, city_code, city_name, hrbp_name, hrbp_phone, created_by, created_date,
updated_by, updated_date, deleted_flag updated_by, updated_date, deleted_flag
</sql> </sql>
......
...@@ -3,15 +3,12 @@ package cn.com.glsx.dj.staff.service.recruitment; ...@@ -3,15 +3,12 @@ package cn.com.glsx.dj.staff.service.recruitment;
import cn.com.glsx.dj.sale.service.BaseServiceTest; import cn.com.glsx.dj.sale.service.BaseServiceTest;
import cn.com.glsx.dj.staff.dto.recruitment.*; import cn.com.glsx.dj.staff.dto.recruitment.*;
import cn.com.glsx.dj.staff.model.RecruitmentProvinceHrbpRelation; import cn.com.glsx.dj.staff.model.RecruitmentProvinceHrbpRelation;
import cn.com.glsx.dj.staff.model.RecruitmentResume;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.google.common.collect.Lists;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -28,22 +25,22 @@ public class RecruitmentDemandServiceTest extends BaseServiceTest { ...@@ -28,22 +25,22 @@ public class RecruitmentDemandServiceTest extends BaseServiceTest {
@Test @Test
public void testRecruitmentDemandAdd() { public void testRecruitmentDemandAdd() {
String userName = "xiehx"; String userName = "yangwei";
RecruitmentDemandDTO dto = new RecruitmentDemandDTO(); RecruitmentDemandDTO dto = new RecruitmentDemandDTO();
dto.setMerchantId(""); dto.setMerchantId("44211545");
dto.setMerchantName("xiehx-自测HRBP取值"); dto.setMerchantName("cx园区店");
dto.setRegionOperationId("48494e7681b647ccb94d76ef4926c750"); dto.setRegionOperationId("cd87fd9b548a41768f8790d40eef6652");
dto.setRegionOperationName("谢先生"); dto.setRegionOperationName("杨卫");
dto.setBusinessType("1"); dto.setBusinessType("1");
dto.setBusinessTypeName("延保"); dto.setBusinessTypeName("延保");
dto.setRecruitmentQuantity(11); dto.setRecruitmentQuantity(2);
dto.setRecruitmentType("3"); dto.setRecruitmentType("1");
dto.setRecruitmentTypeName("新店新增"); dto.setRecruitmentTypeName("老店人员更换");
dto.setRequirementDescription("xiehx-自测HRBP取值"); dto.setRequirementDescription("我开始招聘了嗷");
dto.setUrgent((byte) 0); dto.setUrgent((byte) 0);
dto.setBySystemMerchant(false); dto.setBySystemMerchant(true);
dto.setPotentialCustomerId(1); dto.setPotentialCustomerId(null);
dto.setCreatedBy(userName); dto.setCreatedBy(userName);
dto.setCreatedDate(new Date()); dto.setCreatedDate(new Date());
dto.setUpdatedBy(userName); dto.setUpdatedBy(userName);
...@@ -102,16 +99,28 @@ public class RecruitmentDemandServiceTest extends BaseServiceTest { ...@@ -102,16 +99,28 @@ public class RecruitmentDemandServiceTest extends BaseServiceTest {
@Test @Test
public void testNewDemandQWMessage() { public void testNewDemandQWMessage() {
RecruitmentDemandDTO dto = new RecruitmentDemandDTO(); RecruitmentDemandDTO dto = new RecruitmentDemandDTO();
dto.setId(1); dto.setId(356);
dto.setRecruiterPhone("13603070903"); dto.setMerchantName("cx园区店");
dto.setRecruiterName("xiehx"); dto.setRecruiterPhone("17680252939");
dto.setRecruiterName("杨卫");
dto.setBusinessTypeName("延保");
recruitmentDemandService.sendRecruitmentQWTextMessage( recruitmentDemandService.sendRecruitmentQWTextMessage(
dto.getRecruiterPhone(), dto.getRecruiterPhone(),
"新增招聘需求提醒", "新增招聘需求提醒",
"您有新的招聘需求待跟进,请及时前往saas+增值业务运营平台查看处理。", dto.getMerchantName() + "门店,业务类型\"" + dto.getBusinessTypeName() + "\"。您有新的招聘需求待跟进,请及时前往saas+增值业务运营平台查看处理。",
dto.getId(), dto.getId(),
dto.getRecruiterName() dto.getRecruiterName()
); );
// recruitmentDemandService.sendRecruitmentQWTextMessage(
// dto.getRecruiterPhone(),
// "新增招聘需求提醒",
// "您有新的招聘需求待跟进,请及时前往saas+增值业务运营平台查看处理。",
// dto.getId(),
// dto.getRecruiterName()
// );
} }
@Test @Test
......
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议,如果必要,给出代码示例(仅限 Top 3)

    问题 1:新增数据库字段,但本次提交未包含配套迁移,存在上线兼容性风险

    • 问题描述: RecruitmentProvinceHrbpRelation 和 Mapper 已新增 city_code、city_name,查询列清单也直接引用这些字段,但提供的变更中未见数据库迁移脚本或迁移说明。此外,省级兜底查询现在严格要求 city_code IS NULL,需要确保历史省级配置满足这一约定。
    • 影响分析: 如果目标环境尚未添加字段,相关查询将因字段不存在而失败,包括优先执行的全国配置查询。若历史省级配置被迁移为其他表示方式(例如空字符串),则省级兜底无法命中,造成招聘负责人缺失。
    • 优化建议:
      1. 补充或关联可追溯的数据库迁移脚本,明确字段类型、可空性和默认值。
      2. 明确采用“先扩展数据库,再部署应用”的上线顺序。
      3. 将历史省级记录的 city_code 规范化为 NULL,并验证全国、省级配置在升级后仍可命中。

    说明: 这是基于当前提交材料识别的发布风险;若迁移已在其他提交完成,应提供关联记录及验证结果。

    问题 2:修改后的测试仍直接执行通知和创建操作,缺少隔离与匹配结果断言

    • 问题描述: RecruitmentDemandServiceTest 使用硬编码门店、人员和手机号调用创建需求及 sendRecruitmentQWTextMessage。所展示的变更未体现通知客户端 Mock、独立测试数据或副作用隔离,也未增加针对全国→市→省匹配逻辑的断言。
    • 影响分析: 若测试环境连接真实数据库或通知服务,执行测试可能产生业务数据、向实际人员发送消息。与此同时,依赖外部配置的调用成功并不能证明三级匹配正确,容易出现“测试通过,但负责人匹配错误”的情况。
    • 优化建议:
      • 将匹配逻辑测试改为可重复的单元测试,Mock Mapper 和外部服务,使用虚构数据并断言负责人结果。
      • 至少覆盖:全国配置优先、市级精确匹配、市级未命中后省级兜底、省级查询排除其他城市、省市编码为空、全部未命中。
      • 外部通知集成测试应默认不执行,通过独立 Profile 显式启用,并限定测试接收人;数据库测试使用隔离数据源,避免依赖固定业务 ID。

    二、评分明细

    评分维度 得分 理由
    功能实现的正确性与健壮性 30/40 全国→市→省的控制流程清晰,省级查询排除市级配置,增加判空与稳定排序;但数据库升级及历史数据兼容性未得到提交材料证明,新增逻辑缺少有效回归验证。
    安全性与潜在风险 26/30 所示查询未发现字符串拼接注入风险;测试直接调用通知及业务操作存在误发送、数据污染风险。
    最佳实践与可维护性 15/20 方法抽取和常量化合理;迁移可追溯性、测试隔离和自动化断言不足。
    性能与资源利用 4/5 最多执行三次顺序查询,开销基本可控;各次查询读取完整结果列表后仅取第一条,可考虑使用无子查询的限量查询。
    提交信息质量 5/5 提交说明清晰列出匹配优先级、实体和映射变更,合并记录包含 MR 编号,便于追溯。

    专项检查: 所示 MyBatis 变更及 Example 查询未使用子查询;未见 Dubbo 服务提供者 Remote 接口已有请求参数变更。新增实体字段不等同于 Remote 接口参数签名变更。

    总分:80分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!