提交 0adecbf9 作者: obcy

【企业配置信息通知采集逻辑】

上级 4ee8fa17
......@@ -411,6 +411,7 @@ public class SubjectManageController {
kafkaTemplate.send(SUBJECT_MODEL_KAFKA_CHANNEL, byId.getSubjectCode());
configurationMessageService.bindInfoSourceSend(subject.getId());
configurationMessageService.bindKeyWordsSend(subject.getId());
configurationMessageService.subjectEnterpriseSourceSync(subject.getId());
}
try {
String res = caiJiCenterHttpService.subjectStatusEdit(subject.getStatus(), subject.getId());
......
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 企业和标签关系表
* </p>
*
* @author obcy
* @since 2025-03-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("clb_label_enterprise_map")
public class ClbLabelEnterpriseMap extends Model<ClbLabelEnterpriseMap> {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 创建人
*/
@TableField("create_by")
private String createBy;
/**
* 创建日期
*/
@TableField("create_time")
private Date createTime;
/**
* 更新人
*/
@TableField("update_by")
private String updateBy;
/**
* 更新日期
*/
@TableField("update_time")
private Date updateTime;
/**
* 实体唯一编码
*/
@TableField("entity_code")
private String entityCode;
/**
* 标签值唯一编码
*/
@TableField("label_item_code")
private String labelItemCode;
/**
* 标签唯一编码
*/
@TableField("label_code")
private String labelCode;
/**
* 标签附加属性,例如榜单标签对应年份
*/
@TableField("extra_code")
private String extraCode;
/**
* 业务口径(1自定义,2实体数仓表引用,3字典引用)
*/
@TableField("business_caliber")
private Integer businessCaliber;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.zzsn.event.entity;
import com.zzsn.event.vo.LabelInfo;
import lombok.Data;
import java.util.List;
/**
* Description:
*
* @author: EDY
* @since: 2024/3/6
*/
@Data
public class LabelTypeInfo {
private String labelTypeName;
private String labelTypeId;
private List<LabelInfo> labels;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* @Description: 专题其他来源数据
* @Author: jeecg-boot
* @Date: 2023-10-26
* @Version: V1.0
*/
@Data
@TableName("subject_addition")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="subject_addition对象", description="专题其他来源数据")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SubjectAddition {
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**专题id*/
@Excel(name = "专题id", width = 15)
@ApiModelProperty(value = "专题id")
private String subjectId;
/**关联id*/
@Excel(name = "关联id", width = 15)
@ApiModelProperty(value = "关联id")
private String additionRelationId;
/**类型 1专题 2人物 3政策 4企业 5企业标签*/
@Excel(name = "类型", width = 15)
@ApiModelProperty(value = "类型")
private Integer additionType;
@Excel(name = "企业数据类型[0-研报;1-年报;2-动态;3-公告]", width = 15)
@ApiModelProperty(value = "企业数据类型[0-研报;1-年报;2-动态;3-公告]")
private String additionDataType;
@TableField(exist = false)
private Integer enterpriseCheck;
/**deleteFlag*/
@Excel(name = "deleteFlag", width = 15)
@ApiModelProperty(value = "deleteFlag")
private Integer deleteFlag;
/**创建人*/
@Excel(name = "创建人", width = 15)
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@Excel(name = "更新人", width = 15)
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
@ApiModelProperty(value = "专题绑定的标签信息")
// 来源专题的数据状态(0全部,1审核通过,2未审核,3暂定,4删除)
private String labelConfiguration;
@ApiModelProperty(value = "专题绑定的资讯状态")
private String additionDataStatus;
@ApiModelProperty(value = "扩充字段1")
private String extend1;
@TableField(exist = false)
private List<String > additionRelationIdList;
@TableField(exist = false)
private List<SubjectConfiguration> subjectConfiguration;
@ApiModelProperty(value = "专题绑定的划分专题库")
private String additionPartitionLibrary;
@TableField(exist = false)
private List<SubjectLabel> subjectLabelList;
}
package com.zzsn.event.entity;
import lombok.Data;
import java.util.List;
/**
* Description:
*
* @author: EDY
* @since: 2024/3/6
*/
@Data
public class SubjectConfiguration {
private String subjectId;
private String subjectName;
private String additionDataStatus;
private String additionPartitionLibrary;
private List<LabelTypeInfo> labelTypes;
}
package com.zzsn.event.entity;
import lombok.Data;
import java.util.Objects;
/**
* Description:
* 专题标签
* @author: EDY
* @since: 2024/3/6
*/
@Data
public class SubjectLabel {
private String additionId;
private String labelId;
private String labelName;
private String itemId;
private String itemName;
private String dictCode;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SubjectLabel that = (SubjectLabel) o;
return Objects.equals(labelId, that.labelId) && Objects.equals(itemId, that.itemId);
}
@Override
public int hashCode() {
int result = Objects.hashCode(labelId);
result = 31 * result + Objects.hashCode(itemId);
return result;
}
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.ClbLabelEnterpriseMap;
/**
* <p>
* 企业和标签关系表 Mapper 接口
* </p>
*
* @author obcy
* @since 2025-03-26
*/
public interface ClbLabelEnterpriseMapMapper extends BaseMapper<ClbLabelEnterpriseMap> {
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectAddition;
import com.zzsn.event.vo.EnterpriseCondition;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 专题其他来源数据
* @Author: jeecg-boot
* @Date: 2023-10-26
* @Version: V1.0
*/
public interface SubjectAdditionMapper extends BaseMapper<SubjectAddition> {
List<String> enterpriseListId(String name, Integer listType, Integer year);
List<String> pageList(@Param("enterpriseCondition") EnterpriseCondition enterpriseCondition);
List<String>pageListByOther(@Param("enterpriseCondition") EnterpriseCondition enterpriseCondition);
List<String> pageListByLabelIds(EnterpriseCondition enterpriseCondition);
List<SubjectAddition> pageListBySubjectIdAndType(String subjectId, int type, int offset, Integer pageSize);
int count(String subjectId, int type);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.ClbLabelEnterpriseMapMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.zzsn.event.entity.ClbLabelEnterpriseMap">
<id column="id" property="id" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="entity_code" property="entityCode" />
<result column="label_item_code" property="labelItemCode" />
<result column="label_code" property="labelCode" />
<result column="extra_code" property="extraCode" />
<result column="business_caliber" property="businessCaliber" />
</resultMap>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.SubjectAdditionMapper">
<select id="enterpriseListId" resultType="java.lang.String">
select le.social_credit_code from clb_list_enterprise le inner join sys_base_enterprise e
on le.social_credit_code = e.social_credit_code
where 1=1
<if test="name != null and name != ''">
and e.name like CONCAT('%',CONCAT(#{name},'%'))
</if>
<if test="listType != null">
and le.list_type = #{listType}
</if>
<if test="year != null">
and le.year = #{year}
</if>
</select>
<select id="pageList" resultType="java.lang.String">
SELECT
e.social_credit_code
from sys_base_enterprise e
<if test="enterpriseCondition.labelId != null and enterpriseCondition.labelId != ''">
INNER JOIN sys_base_label_type_map m ON m.relation_id = e.social_credit_code
</if>
<if test="enterpriseCondition.industryId != null and enterpriseCondition.industryId != ''">
INNER JOIN sys_base_enterprise_industry_map eim ON eim.enterprise_id = e.social_credit_code
</if>
<if test="enterpriseCondition.listed != null or enterpriseCondition.securitiesCode != null">
INNER JOIN sys_base_enterprise_ipo ei ON e.social_credit_code = ei.social_credit_code
</if>
where 1 = 1
<if test="enterpriseCondition.listed != null">
and ei.listed = #{enterpriseCondition.listed}
</if>
<if test="enterpriseCondition.socialCreditCode != null and enterpriseCondition.socialCreditCode != ''">
and e.social_credit_code = #{enterpriseCondition.socialCreditCode}
</if>
<if test="enterpriseCondition.securitiesCode != null and enterpriseCondition.securitiesCode != ''">
and ei.securities_code = #{enterpriseCondition.securitiesCode}
</if>
<if test="enterpriseCondition.name != null and enterpriseCondition.name != ''">
and e.name like CONCAT('%',CONCAT(#{enterpriseCondition.name},'%'))
</if>
<if test="enterpriseCondition.organizationCode != null and enterpriseCondition.organizationCode != ''">
and e.organization_code = #{enterpriseCondition.organizationCode}
</if>
<if test="enterpriseCondition.province != null and enterpriseCondition.province != ''">
and e.province like CONCAT('%',#{enterpriseCondition.province},'%')
</if>
<if test="enterpriseCondition.status != null">
and e.status = #{enterpriseCondition.status}
</if>
<if test="enterpriseCondition.labelId != null and enterpriseCondition.labelId != ''">
and m.label_id = #{enterpriseCondition.labelId}
</if>
<if test="enterpriseCondition.industryId != null and enterpriseCondition.industryId != ''">
and eim.industry_id = #{enterpriseCondition.industryId}
</if>
<choose>
<when test="enterpriseCondition.labelId != null and enterpriseCondition.labelId != ''">
ORDER BY m.order_no is null,m.order_no,e.create_time desc
</when>
<otherwise>
ORDER BY e.create_time desc
</otherwise>
</choose>
</select>
<select id="pageListByOther" resultType="java.lang.String">
SELECT e.social_credit_code FROM
(SELECT be.* FROM sys_base_enterprise be
INNER JOIN sys_base_label_type_map m ON m.relation_id = be.social_credit_code
WHERE m.label_id = #{enterpriseCondition.labelId}
ORDER BY m.order_no is null,m.order_no,be.create_time desc
) e
<if test="enterpriseCondition.industryId != null and enterpriseCondition.industryId != ''">
INNER JOIN sys_base_enterprise_industry_map eim ON eim.enterprise_id = e.social_credit_code
</if>
<if test="enterpriseCondition.securitiesCode != null and enterpriseCondition.securitiesCode != ''">
INNER JOIN sys_base_enterprise_ipo ei ON e.social_credit_code = ei.social_credit_code
</if>
<if test="enterpriseCondition.hasFinancialData != null">
LEFT JOIN (SELECT social_credit_code, CASE WHEN MAX(any_data) = 1 THEN 0 ELSE 1 END AS sign FROM sys_base_enterprise_ipo GROUP BY social_credit_code HAVING sign = 0) fina on e.social_credit_code = fina.social_credit_code
</if>
<if test="enterpriseCondition.hasMan != null">
LEFT JOIN (SELECT social_credit_code,0 as sign
FROM sys_base_enterprise_executive
GROUP BY social_credit_code
) gg on e.social_credit_code = gg.social_credit_code
</if>
<if test="enterpriseCondition.hasYb != null or enterpriseCondition.hasNb != null or enterpriseCondition.hasDt != null or enterpriseCondition.hasGg != null ">
LEFT JOIN clb_enterprise_report_analysis cera on e.social_credit_code = cera.social_credit_code
</if>
where 1 = 1
<if test="enterpriseCondition.socialCreditCode != null and enterpriseCondition.socialCreditCode != ''">
and e.social_credit_code = #{enterpriseCondition.socialCreditCode}
</if>
<if test="enterpriseCondition.securitiesCode != null and enterpriseCondition.securitiesCode != ''">
and ei.securities_code = #{enterpriseCondition.securitiesCode}
</if>
<if test="enterpriseCondition.name != null and enterpriseCondition.name != ''">
and e.name like CONCAT('%',CONCAT(#{enterpriseCondition.name},'%'))
</if>
<if test="enterpriseCondition.organizationCode != null and enterpriseCondition.organizationCode != ''">
and e.organization_code = #{enterpriseCondition.organizationCode}
</if>
<if test="enterpriseCondition.province != null and enterpriseCondition.province != ''">
and e.province like CONCAT('%',#{enterpriseCondition.province},'%')
</if>
<if test="enterpriseCondition.status != null">
and e.status = #{enterpriseCondition.status}
</if>
<if test="enterpriseCondition.industryId != null and enterpriseCondition.industryId != ''">
and eim.industry_id = #{enterpriseCondition.industryId}
</if>
<if test="enterpriseCondition.hasFinancialData != null and enterpriseCondition.hasFinancialData == 0">
and fina.sign = #{enterpriseCondition.hasFinancialData}
</if>
<if test="enterpriseCondition.hasFinancialData != null and enterpriseCondition.hasFinancialData != 0">
and fina.sign is null
</if>
<if test="enterpriseCondition.hasMan != null and enterpriseCondition.hasMan == 0">
and gg.sign = #{enterpriseCondition.hasMan}
</if>
<if test="enterpriseCondition.hasMan != null and enterpriseCondition.hasMan != 0">
and gg.sign is null
</if>
<if test="enterpriseCondition.hasBase != null and enterpriseCondition.hasBase == 0">
and ( (
e.yn_domestic = 1
AND e.`name` IS NOT NULL AND e.`name` != ''
AND e.social_credit_code IS NOT NULL AND e.social_credit_code != ''
AND e.address IS NOT NULL AND e.address != ''
AND e.industry IS NOT NULL AND e.industry != ''
AND e.legal_person IS NOT NULL AND e.legal_person != ''
) or (
e.yn_domestic = 0
AND e.`name` IS NOT NULL AND e.`name` != ''
AND e.social_credit_code IS NOT NULL AND e.social_credit_code != ''
AND e.english_name IS NOT NULL AND e.english_name != ''
) )
</if>
<if test="enterpriseCondition.hasBase != null and enterpriseCondition.hasBase != 0">
and ( (
e.yn_domestic = 1
AND (e.`name` IS NULL or e.`name` = ''
or e.social_credit_code IS NULL or e.social_credit_code = ''
or e.address IS NULL or e.address = ''
or e.industry IS NULL or e.industry = ''
or e.legal_person IS NULL or e.legal_person = '')
) or (
e.yn_domestic = 0
AND (e.`name` IS NULL or e.`name` = ''
or e.social_credit_code IS NULL or e.social_credit_code = ''
or e.english_name IS NULL or e.english_name = '')
) )
</if>
<if test="enterpriseCondition.hasYb != null and enterpriseCondition.hasYb == 0">
and cera.research_report_count>0
</if>
<if test="enterpriseCondition.hasYb != null and enterpriseCondition.hasYb != 0">
and cera.research_report_count is null
</if>
<if test="enterpriseCondition.hasNb != null and enterpriseCondition.hasNb == 0">
and cera.annual_report_count>0
</if>
<if test="enterpriseCondition.hasNb != null and enterpriseCondition.hasNb != 0">
and cera.annual_report_count is null
</if>
<if test="enterpriseCondition.hasDt != null and enterpriseCondition.hasDt == 0">
and cera.dynamic_state_count>0
</if>
<if test="enterpriseCondition.hasDt != null and enterpriseCondition.hasDt != 0">
and cera.dynamic_state_count is null
</if>
<if test="enterpriseCondition.hasGg != null and enterpriseCondition.hasGg == 0">
and cera.announcement_count>0
</if>
<if test="enterpriseCondition.hasGg != null and enterpriseCondition.hasGg != 0">
and cera.announcement_count is null
</if>
</select>
<select id="pageListByLabelIds" resultType="java.lang.String">
SELECT ee.social_credit_code FROM
(SELECT
e.social_credit_code,count(e.id) as num
from sys_base_enterprise e
INNER JOIN sys_base_label_type_map m ON m.relation_id = e.social_credit_code
WHERE 1=1
<if test="enterpriseCondition.labelIds!=null and enterpriseCondition.labelIds.size()>0">
and m.label_id in
<foreach collection="enterpriseCondition.labelIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
GROUP BY e.social_credit_code
HAVING num >= #{enterpriseCondition.labelIdsCount}
) res
LEFT JOIN sys_base_enterprise ee ON ee.social_credit_code = res.social_credit_code
<if test="enterpriseCondition.industryId != null and enterpriseCondition.industryId != ''">
INNER JOIN sys_base_enterprise_industry_map eim ON eim.enterprise_id = ee.social_credit_code
</if>
<if test="enterpriseCondition.listed != null or (enterpriseCondition.securitiesCode != null and enterpriseCondition.securitiesCode != '')">
INNER JOIN sys_base_enterprise_ipo ei ON ee.social_credit_code = ei.social_credit_code
</if>
where 1 = 1
<if test="enterpriseCondition.listed != null">
and ei.listed = #{enterpriseCondition.listed}
</if>
<if test="enterpriseCondition.socialCreditCode != null and enterpriseCondition.socialCreditCode != ''">
and ee.social_credit_code = #{enterpriseCondition.socialCreditCode}
</if>
<if test="enterpriseCondition.securitiesCode != null and enterpriseCondition.securitiesCode != ''">
and ei.securities_code = #{enterpriseCondition.securitiesCode}
</if>
<if test="enterpriseCondition.name != null and enterpriseCondition.name != ''">
and ee.name like CONCAT('%',CONCAT(#{enterpriseCondition.name},'%'))
</if>
<if test="enterpriseCondition.organizationCode != null and enterpriseCondition.organizationCode != ''">
and ee.organization_code = #{enterpriseCondition.organizationCode}
</if>
<if test="enterpriseCondition.province != null and enterpriseCondition.province != ''">
and ee.province like CONCAT('%',#{enterpriseCondition.province},'%')
</if>
<if test="enterpriseCondition.status != null">
and ee.status = #{enterpriseCondition.status}
</if>
<if test="enterpriseCondition.industryId != null and enterpriseCondition.industryId != ''">
and eim.industry_id = #{enterpriseCondition.industryId}
</if>
</select>
<select id="pageListBySubjectIdAndType"
resultType="com.zzsn.clb.serviceproject.subject.entity.SubjectAddition">
select * from subject_addition where subject_id=#{subjectId} and addition_type=#{type}
limit #{offset}, #{pageSize}
</select>
<select id="count" resultType="java.lang.Integer">
select count(1) from subject_addition where subject_id=#{subjectId} and addition_type=#{type}
</select>
</mapper>
\ No newline at end of file
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.ClbLabelEnterpriseMap;
/**
* <p>
* 企业和标签关系表 服务类
* </p>
*
* @author obcy
* @since 2025-03-26
*/
public interface ClbLabelEnterpriseMapService extends IService<ClbLabelEnterpriseMap> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SubjectAddition;
/**
* @Description: 专题其他来源数据
* @Author: jeecg-boot
* @Date: 2023-10-26
* @Version: V1.0
*/
public interface ISubjectAdditionService extends IService<SubjectAddition> {
}
......@@ -31,6 +31,8 @@ public class CaiJiCenterHttpService {
private String subjectStatusEditUrl;
@Value("${caiji.delSubjectUrl.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/delSubject}")
private String delSubjectUrl;
@Value("${caiji.subjectEnterpriseSource.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/saveCompanyData}")
private String subjectEnterpriseSourceUrl;
@Value("${caiji.projectCode:zzsn_test}")
......@@ -106,7 +108,12 @@ public class CaiJiCenterHttpService {
HttpRequest get = get(delSubjectUrl,map);
return get.execute().body();
}
/**专题企业来源数据配置通知采集*/
public String subjectEnterpriseSource(Map<String,Object> map) {
// log.info("专题企业来源数据配置通知采集{}-{}",subjectEnterpriseSourceUrl,JSONUtil.toJsonStr(map));
HttpRequest post = post(subjectEnterpriseSourceUrl,map);
return post.execute().body();
}
private HttpRequest get(String url,Map<String, Object> map) {
HttpRequest get = HttpUtil.createGet(url);
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.ClbLabelEnterpriseMap;
import com.zzsn.event.mapper.ClbLabelEnterpriseMapMapper;
import com.zzsn.event.service.ClbLabelEnterpriseMapService;
import org.springframework.stereotype.Service;
/**
* <p>
* 企业和标签关系表 服务实现类
* </p>
*
* @author obcy
* @since 2025-03-26
*/
@Service
public class ClbLabelEnterpriseMapServiceImpl extends ServiceImpl<ClbLabelEnterpriseMapMapper, ClbLabelEnterpriseMap> implements ClbLabelEnterpriseMapService {
}
......@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.*;
import com.zzsn.event.enums.BindTypeEnum;
import com.zzsn.event.feign.api.RemoteModelService;
import com.zzsn.event.mapper.SubjectAdditionMapper;
import com.zzsn.event.service.*;
import com.zzsn.event.vo.KeyWordsPage;
import lombok.extern.slf4j.Slf4j;
......@@ -117,7 +118,11 @@ public class ConfigurationMessageService {
@Autowired
ClbLabelInfoSourceMapService clbLabelInfoSourceMapService;
@Autowired
private SubjectAdditionMapper subjectAdditionMapper;
@Autowired
private ClbLabelEnterpriseMapService clbLabelEnterpriseMapService;
@Autowired(required = false)
private RemoteModelService remoteModelService;
......@@ -411,6 +416,71 @@ public class ConfigurationMessageService {
}
}
public void subjectEnterpriseSourceSync(String subjectId){
Subject subject = subjectService.getById(subjectId);
if (subject == null || subject.getStatus() == null || subject.getStatus() != 1) {
log.info("未查询到专题或专题未启用");
return;
}
try {
remoteModelService.delSubjectCache(subjectId);
} catch (Exception e) {
log.error("删除专题缓存失败{}",e.getMessage(),e);
}
List<SubjectAddition> resu = new ArrayList<>();
//获取专题配置的企业来源
List<SubjectAddition> subjectAdditionsEn = subjectAdditionMapper.selectList(Wrappers.<SubjectAddition>lambdaQuery()
.eq(SubjectAddition::getSubjectId, subject.getId())
.eq(SubjectAddition::getAdditionType, 4));
if (CollectionUtil.isNotEmpty(subjectAdditionsEn)) {
resu.addAll(subjectAdditionsEn);
}
List<SubjectAddition> subjectAdditionsEn5 = subjectAdditionMapper.selectList(Wrappers.<SubjectAddition>lambdaQuery()
.eq(SubjectAddition::getSubjectId, subject.getId())
.eq(SubjectAddition::getAdditionType, 5));
if (CollectionUtil.isNotEmpty(subjectAdditionsEn5)) {
List<String> itemCodes = subjectAdditionsEn5.stream().map(SubjectAddition::getAdditionRelationId).collect(Collectors.toList());
List<String> labelCodes = subjectAdditionsEn5.stream().map(SubjectAddition::getAdditionDataType).collect(Collectors.toList());
List<String> socCodes = clbLabelEnterpriseMapService.list(Wrappers.<ClbLabelEnterpriseMap>lambdaQuery()
.in(ClbLabelEnterpriseMap::getLabelItemCode, itemCodes)
.in(ClbLabelEnterpriseMap::getLabelCode, labelCodes))
.stream().map(ClbLabelEnterpriseMap::getEntityCode).distinct().collect(Collectors.toList());
List<SubjectAddition> subjectAdditionsEn5Res = new ArrayList<>();
if (CollectionUtil.isNotEmpty(socCodes)) {
socCodes.forEach(e -> {
SubjectAddition subjectAddition = new SubjectAddition();
subjectAddition.setAdditionRelationId(e);
subjectAddition.setAdditionType(4);
subjectAddition.setSubjectId(subject.getId());
subjectAdditionsEn5Res.add(subjectAddition);
});
}
resu.addAll(subjectAdditionsEn5Res);
}
List<String> enterprise = resu.stream().map(SubjectAddition::getAdditionRelationId).distinct().collect(Collectors.toList());
Map<String, Object> enterpriseParam = getEnterpriseParam(subject, enterprise);
String post = caiJiCenterHttpService.subjectEnterpriseSource(enterpriseParam);
JSONObject entries = JSONUtil.parseObj(post);
//获取code状态码
Integer code = entries.getInt("code");
if (ObjectUtil.isEmpty(code) || code != 200) {
log.error("专题企业来源配置通知采集失败{}",post);
throw new RuntimeException("专题企业来源配置通知采集失败");
}
log.info("{}专题企业来源配置通知采集结束",subject.getSubjectName());
}
//获取专题绑定的所有信息源id
public List<String> getAllInfoSourceIds(String subjectId) {
if (StrUtil.isBlank(subjectId)) {
......@@ -557,6 +627,25 @@ public class ConfigurationMessageService {
return JSONUtil.toJsonStr(param);
}
private Map<String,Object> getEnterpriseParam(Subject subject, List<String> enterprise) {
Map<String,Object> param = new HashMap<>();
param.put("subjectSign",subject.getId());
param.put("subjectName",subject.getSubjectName());
param.put("customerSign",caiJiCenterHttpService.getProjectCode());
param.put("customerName",caiJiCenterHttpService.getProjectName());
param.put("additionDataType",subject.getAdditionDataType());
param.put("attentions",enterprise);
if (ObjectUtil.isNotNull(subject.getTimeEnable())) {
param.put("startTime", DateUtil.format(subject.getTimeEnable(),"yyyy-MM-dd HH:mm:ss"));
}else {
param.put("startTime",DateUtil.format(getPreviousMonths(LocalDateTime.now(),6),"yyyy-MM-dd HH:mm:ss"));
}
if (ObjectUtil.isNotNull(subject.getTimeDisable())) {
param.put("endTime",DateUtil.format(subject.getTimeDisable(),"yyyy-MM-dd HH:mm:ss"));
}
return param;
}
private String getKeyWordsParam(Subject subject ,Integer option,List<KeyWords> keyWords) {
Map<String,Object> param = new HashMap<>();
List<Map<String,Object>> kw = new ArrayList<>();
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectAddition;
import com.zzsn.event.mapper.SubjectAdditionMapper;
import com.zzsn.event.service.ISubjectAdditionService;
import org.springframework.stereotype.Service;
/**
* @Description: 专题其他来源数据
* @Author: jeecg-boot
* @Date: 2023-10-26
* @Version: V1.0
*/
@Service
public class SubjectAdditionServiceImpl extends ServiceImpl<SubjectAdditionMapper, SubjectAddition> implements ISubjectAdditionService {
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* @author lkg
* @description: 企业查询条件封装类
* @date 2023/1/4
*/
@Data
public class EnterpriseCondition {
/**
* subjectId、additionType为用于专题绑定的参数
*/
private String subjectId;
private Integer additionType;
/**
* 统一社会信用代码
*/
private String socialCreditCode;
/**
* 股票代码代码
*/
private String securitiesCode;
/**
* 名称
*/
private String name;
/**
* 组织机构代码
*/
private String organizationCode;
/**
* 所属省份
*/
private String province;
/**
* 状态
*/
private Integer status;
/**
* 关联标签id
*/
private String labelId;
/**
* 关联标签id列表
*/
private List<String> labelIds;
/**
* 关联标签id列表长度
*/
private Integer labelIdsCount;
/**
* 所属行业id
*/
private String industryId;
/**
* 是否有财务数据,0是,1否
*/
private Integer hasFinancialData;
/**
* 是否有基本信息,0是,1否
*/
private Integer hasBase;
/**
* 是否有高管信息,0是,1否
*/
private Integer hasMan;
/**
* 是否有企业研报,0是,1否
*/
private Integer hasYb;
/**
* 是否有企业年报,0是,1否
*/
private Integer hasNb;
/**
* 是否有企业动态,0是,1否
*/
private Integer hasDt;
/**
* 是否有企业公告,0是,1否
*/
private Integer hasGg;
/**
* 是否上市--针对上市标签
*/
private Integer listed;
/**
* 关联标签id列表
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 标签信息集合
*/
private List<LabelVO> labelList;
private Integer pageNo = 1;
private Integer pageSize = 10;
/**
* 不分页标识:不为null时做不分页查询,用于产业链全选关联企业(此时需查询到条件下所有企业数据)
*/
private Integer noPage;
}
package com.zzsn.event.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
/**
*
*
* @author lkg
* @date 2024/12/11
*/
@Data
public class LabelVO {
/**
* 标签 唯一编码
*/
private String labelCode;
/**
* 数据字典编码
*/
private String dictCode;
/**
* 标签值/字典值/数仓值 唯一编码
*/
private String labelItemCode;
/**
* 标签值id(用于检索)
*/
@TableField(exist = false)
private String labelItemId;
/**
* 层级(用于检索)
*/
@TableField(exist = false)
private Integer level;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论