Commit 334decd1 by chenxi

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

2 parents 190ee943 d2889756
...@@ -44,4 +44,28 @@ public interface CustomerTagProfileRemote { ...@@ -44,4 +44,28 @@ public interface CustomerTagProfileRemote {
@ApiParam(name = "request", notes = "请求对象,包含手机号列表", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "request", notes = "请求对象,包含手机号列表", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("客户画像列表") @ApiResponse("客户画像列表")
RpcResponse<List<CustomerProfileRespDTO>> queryCustomerProfileByPhones(ProfileQueryReqDTO request); RpcResponse<List<CustomerProfileRespDTO>> queryCustomerProfileByPhones(ProfileQueryReqDTO request);
/**
* 查询昨天有变动的标签画像的手机号列表
* <p>
* 扫描 dj_car_life_customer_tag_profile 表,找出昨天(yyyy-MM-dd)有 update_time 记录的
* 去重手机号,用于定时任务触发客户分类重算
*
* @return 昨天有变动的手机号列表
*/
@ApiMethod("查询昨天变动的标签画像手机号")
@ApiResponse("昨天有变动的手机号列表")
RpcResponse<List<String>> queryYesterdayChangedPhones();
/**
* 查询昨天有变动的标签画像(合并手机号+画像查询)
* <p>
* 直接返回昨天有 update_time 的标签画像完整数据(含名称),一次 RPC 完成。
* 用于定时任务触发客户分类重算。
*
* @return 昨天有变动的客户画像列表
*/
@ApiMethod("查询昨天变动的标签画像(含名称)")
@ApiResponse("昨天有变动的客户画像列表")
RpcResponse<List<CustomerProfileRespDTO>> queryYesterdayChangedProfiles();
} }
...@@ -72,4 +72,9 @@ public interface CustomerTagProfileMapper extends OreMapper<CustomerTagProfile> ...@@ -72,4 +72,9 @@ public interface CustomerTagProfileMapper extends OreMapper<CustomerTagProfile>
* @return 插入数量 * @return 插入数量
*/ */
int batchInsert(@Param("list") List<CustomerTagProfile> list); int batchInsert(@Param("list") List<CustomerTagProfile> list);
/**
* 查询昨天有变动的去重手机号列表
*/
List<String> selectYesterdayChangedPhones();
} }
...@@ -83,4 +83,34 @@ public class CustomerTagProfileRemoteImpl implements CustomerTagProfileRemote { ...@@ -83,4 +83,34 @@ public class CustomerTagProfileRemoteImpl implements CustomerTagProfileRemote {
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@Override
public RpcResponse<List<String>> queryYesterdayChangedPhones() {
try {
log.info("查询昨天变动的标签画像手机号开始");
List<String> phones = customerTagProfileService.queryYesterdayChangedPhones();
log.info("查询昨天变动的标签画像手机号完成:size={}", phones != null ? phones.size() : 0);
return RpcResponse.success(phones);
} catch (RpcServiceException e) {
log.error("查询昨天变动手机号 occur RpcServiceException", e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("查询昨天变动手机号 occur Exception", e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<List<CustomerProfileRespDTO>> queryYesterdayChangedProfiles() {
try {
List<CustomerProfileRespDTO> profiles = customerTagProfileService.queryYesterdayChangedProfiles();
return RpcResponse.success(profiles);
} catch (RpcServiceException e) {
log.error("查询昨天变动画像 occur RpcServiceException", e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("查询昨天变动画像 occur Exception", e);
return RpcResponse.error(e);
}
}
} }
...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -102,6 +103,24 @@ public class CustomerTagProfileService { ...@@ -102,6 +103,24 @@ public class CustomerTagProfileService {
} }
/** /**
* 查询昨天有变动的去重手机号列表
*/
public List<String> queryYesterdayChangedPhones() {
return customerTagProfileMapper.selectYesterdayChangedPhones();
}
/**
* 查询昨天有变动的标签画像(含名称,合并查询)
*/
public List<CustomerProfileRespDTO> queryYesterdayChangedProfiles() {
List<String> phoneList = customerTagProfileMapper.selectYesterdayChangedPhones();
if(CollectionUtils.isEmpty(phoneList)){
return new ArrayList<>();
}
return customerTagProfileMapper.selectByPhoneList(phoneList);
}
/**
* 计算平均价格 * 计算平均价格
* *
* @param carSeriesDetail 车系详情 * @param carSeriesDetail 车系详情
......
...@@ -82,6 +82,12 @@ ...@@ -82,6 +82,12 @@
</foreach> </foreach>
</delete> </delete>
<!-- 查询昨天有变动的去重手机号列表 -->
<select id="selectYesterdayChangedPhones" resultType="java.lang.String">
SELECT DISTINCT phone
FROM dj_car_life_customer_tag_profile
WHERE DATE(update_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
</select>
<!-- 批量插入标签画像 --> <!-- 批量插入标签画像 -->
<insert id="batchInsert"> <insert id="batchInsert">
INSERT INTO dj_car_life_customer_tag_profile INSERT INTO dj_car_life_customer_tag_profile
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!