Commit 44b660e2 by 章家宝

feat:客户录音画像标签定时任务

1 parent f1154c72
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx</groupId> <groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId> <artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.6.1-SNAPSHOT</version> <version>5.8.3-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.oreframework</groupId> <groupId>org.oreframework</groupId>
......
package cn.com.glsx.dj.strategy.config; package cn.com.glsx.dj.strategy.config;
import cn.com.glsx.dj.mindworkplate.remote.InspectionCustomerTagRemote;
import cn.com.glsx.dj.mindworkplate.remote.MonitoringRemote; import cn.com.glsx.dj.mindworkplate.remote.MonitoringRemote;
import cn.com.glsx.dj.mindworkplate.remote.PadMessageBoxRemote; import cn.com.glsx.dj.mindworkplate.remote.PadMessageBoxRemote;
import cn.com.glsx.dj.peanalysis.remote.BusinessSceneAnalysisRemote; import cn.com.glsx.dj.peanalysis.remote.BusinessSceneAnalysisRemote;
...@@ -91,4 +92,9 @@ public class DubboConfig { ...@@ -91,4 +92,9 @@ public class DubboConfig {
return factory.builder(SceneRemote.class).check(check).version("1.0.0").timeout(timeout).build(); return factory.builder(SceneRemote.class).check(check).version("1.0.0").timeout(timeout).build();
} }
@Bean
public InspectionCustomerTagRemote inspectionCustomerTagRemote() {
return factory.builder(InspectionCustomerTagRemote.class).check(check).timeout(timeout).build();
}
} }
package cn.com.glsx.dj.strategy.job;
import cn.com.glsx.dj.strategy.service.InspectionCustomerTagSyncService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* AI客户标签同步定时任务
* 每天凌晨2点执行,从mindworkplate服务同步昨天的录音客户标签数据
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/06/18
*/
@Slf4j
@Component
@ElasticJobConf(name = "CustomerTagSyncJob", cron = "0 0 2 * * ?",
description = "AI客户标签同步定时任务", overwrite = false)
public class InspectionCustomerTagJob implements SimpleJob {
@Autowired
private InspectionCustomerTagSyncService inspectionCustomerTagSyncService;
@Override
public void execute(ShardingContext shardingContext) {
log.info("AI客户标签同步定时任务开始执行");
try {
inspectionCustomerTagSyncService.syncCustomerTagFromInspection();
} catch (Exception e) {
log.error("AI客户标签同步定时任务执行异常", e);
}
log.info("AI客户标签同步定时任务执行结束");
}
}
...@@ -33,4 +33,33 @@ public interface CustomerTagProfileMapper extends OreMapper<CustomerTagProfile> ...@@ -33,4 +33,33 @@ public interface CustomerTagProfileMapper extends OreMapper<CustomerTagProfile>
* @return 删除数量 * @return 删除数量
*/ */
int deleteByPhoneAndCategoryCode(@Param("phone") String phone, @Param("categoryCode") String categoryCode); int deleteByPhoneAndCategoryCode(@Param("phone") String phone, @Param("categoryCode") String categoryCode);
/**
* 根据手机号和来源类型物理删除记录
*
* @param phone 手机号
* @param sourceType 来源类型
* @return 删除数量
*/
int deleteByPhoneAndSourceType(@Param("phone") String phone, @Param("sourceType") String sourceType);
/**
* 根据手机号、来源类型和维度代码列表物理删除记录
*
* @param phone 手机号
* @param sourceType 来源类型
* @param dimensionCodes 维度代码列表
* @return 删除数量
*/
int deleteByPhoneAndSourceTypeAndDimensionCodes(@Param("phone") String phone,
@Param("sourceType") String sourceType,
@Param("dimensionCodes") List<String> dimensionCodes);
/**
* 批量插入标签画像
*
* @param list 标签画像列表
* @return 插入数量
*/
int batchInsert(@Param("list") List<CustomerTagProfile> list);
} }
...@@ -6,6 +6,7 @@ import cn.com.glsx.dj.strategy.enums.ArchiveTagEnum; ...@@ -6,6 +6,7 @@ import cn.com.glsx.dj.strategy.enums.ArchiveTagEnum;
import cn.com.glsx.dj.strategy.mapper.CustomerTagProfileMapper; import cn.com.glsx.dj.strategy.mapper.CustomerTagProfileMapper;
import cn.com.glsx.dj.strategy.model.CustomerTagProfile; import cn.com.glsx.dj.strategy.model.CustomerTagProfile;
import cn.com.glsx.dj.strategy.util.GopApiUtil; import cn.com.glsx.dj.strategy.util.GopApiUtil;
import cn.hutool.core.bean.BeanUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -173,15 +174,6 @@ public class CustomerTagProfileService { ...@@ -173,15 +174,6 @@ public class CustomerTagProfileService {
* @return DTO * @return DTO
*/ */
private CustomerProfileRespDTO convertToDTO(CustomerTagProfile profile) { private CustomerProfileRespDTO convertToDTO(CustomerTagProfile profile) {
CustomerProfileRespDTO dto = new CustomerProfileRespDTO(); return BeanUtil.copyProperties(profile, CustomerProfileRespDTO.class);
dto.setPhone(profile.getPhone());
dto.setCategoryCode(profile.getCategoryCode());
dto.setDimensionCode(profile.getDimensionCode());
dto.setEnumCode(profile.getEnumCode());
dto.setScoreBasis(profile.getScoreBasis());
dto.setScore(profile.getScore());
dto.setSourceType(profile.getSourceType());
dto.setCreateTime(profile.getCreateTime());
return dto;
} }
} }
...@@ -167,6 +167,7 @@ public class GopApiUtil { ...@@ -167,6 +167,7 @@ public class GopApiUtil {
/** /**
* MD5加密(32位) * MD5加密(32位)
* 注意:使用平台默认编码,与 GopUtil 保持一致
* *
* @param s 原字符串 * @param s 原字符串
* @return 加密后的字符串 * @return 加密后的字符串
...@@ -174,7 +175,7 @@ public class GopApiUtil { ...@@ -174,7 +175,7 @@ public class GopApiUtil {
private static String md5(String s) { private static String md5(String s) {
char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
try { try {
byte[] bytes = s.getBytes(StandardCharsets.UTF_8); byte[] bytes = s.getBytes();
MessageDigest md = MessageDigest.getInstance("MD5"); MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes); md.update(bytes);
bytes = md.digest(); bytes = md.digest();
......
...@@ -40,4 +40,34 @@ ...@@ -40,4 +40,34 @@
AND category_code = #{categoryCode} AND category_code = #{categoryCode}
</delete> </delete>
<!-- 根据手机号和来源类型物理删除记录 -->
<delete id="deleteByPhoneAndSourceType">
DELETE FROM dj_car_life_customer_tag_profile
WHERE phone = #{phone}
AND source_type = #{sourceType}
</delete>
<!-- 根据手机号、来源类型和维度代码列表物理删除记录 -->
<delete id="deleteByPhoneAndSourceTypeAndDimensionCodes">
DELETE FROM dj_car_life_customer_tag_profile
WHERE phone = #{phone}
AND source_type = #{sourceType}
AND dimension_code IN
<foreach collection="dimensionCodes" item="dimensionCode" open="(" separator="," close=")">
#{dimensionCode}
</foreach>
</delete>
<!-- 批量插入标签画像 -->
<insert id="batchInsert">
INSERT INTO dj_car_life_customer_tag_profile
(phone, category_code, dimension_code, enum_code, score_basis, score, source_type, source_ref_id, create_time, update_time, deleted_flag)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.phone}, #{item.categoryCode}, #{item.dimensionCode}, #{item.enumCode},
#{item.scoreBasis}, #{item.score}, #{item.sourceType}, #{item.sourceRefId},
NOW(), NOW(), 'N')
</foreach>
</insert>
</mapper> </mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!