提交 2fcfd142 作者: ZhangJingKun

初始化项目

上级
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.zzsn</groupId>
<artifactId>think-tank</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>think-tank</name>
<description>智库</description>
<properties>
<java.version>1.8</java.version>
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.21</version>
</dependency>
<!-- excel工具包 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.2.10</version>
</dependency>
<!-- AutoPoi Excel工具类-->
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>autopoi-web</artifactId>
<version>1.2.5</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- hutool工具类-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.8</version>
</dependency>
<!-- json-->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.25</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.3.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>3.2.6.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
package com.zzsn.thinktank;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication
@EnableAsync
@MapperScan(value = {"com.zzsn.thinktank.mapper*"})
public class ThinkTankApplication {
public static void main(String[] args) {
SpringApplication.run(ThinkTankApplication.class, args);
}
}
package com.zzsn.thinktank.controller;
import com.zzsn.thinktank.service.CityAddressService;
import com.zzsn.thinktank.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/9 15:54
* @Content: 地市信息查询
*/
@RestController
@RequestMapping("/api/cityAddress")
public class CityAddressController {
@Autowired
CityAddressService cityAddressService;
@GetMapping("/getCityList")
public Result<?> getCityList(){
return cityAddressService.getCityList();
}
/**
* 根据父pid查询所有子节点
* 要查询根节点下的子节点pid传 "0"
* 默认值为0
* @param pid
* @return
*/
@GetMapping("/getCityListByPid")
public Result<?> getCityListByPid(@RequestParam(name="pid",required=true) String pid){
//
if(pid == null || pid.length() == 0){
pid = "0";
}
return cityAddressService.getCityListByPid(pid);
}
}
package com.zzsn.thinktank.controller;
import com.zzsn.thinktank.service.EnterpriseService;
import com.zzsn.thinktank.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/26 14:16
* @Content:
*/
@Slf4j
@RestController
@RequestMapping("/api/enterprise")
public class EnterpriseController {
@Autowired
EnterpriseService enterpriseService;
/**
* 企业查询
* @param pageNo
* @param pageSize
* @param socialCreditCode
* @param name
* @return
*/
@GetMapping("/pageList")
public Result<?> pageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name="socialCreditCode", required=false) String socialCreditCode,
@RequestParam(name="name", required=false) String name) {
return enterpriseService.pageList(pageNo, pageSize,socialCreditCode,name);
}
}
package com.zzsn.thinktank.controller;
import com.zzsn.thinktank.entity.ThinktankCategoryStructure;
import com.zzsn.thinktank.service.LeaderCategoryService;
import com.zzsn.thinktank.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* <p>
* 分类树前端控制器
* </p>
*
* @author obcy
* @since 2024-02-27
*/
@Slf4j
@RestController
@RequestMapping("/api/category")
public class LeaderCategoryController {
@Autowired
LeaderCategoryService leaderCategoryService;
/**
* 根据id查询分类树
* */
@GetMapping
public Result<?> getById(@RequestParam(name="id",required=true) String id){
log.info("根据id查询分类树:{}",id);
return Result.OK(leaderCategoryService.getById(id));
}
/**
* 新增分类树
*/
@PostMapping("/add")
public Result<?> add(@RequestBody ThinktankCategoryStructure characterCategoryStructure){
log.info("新增分类树:{}",characterCategoryStructure);
return leaderCategoryService.add(characterCategoryStructure);
}
/**
* 编辑分类树
* */
@PostMapping("/edit")
public Result<?> edit(@RequestBody ThinktankCategoryStructure characterCategoryStructure){
log.info("编辑分类树:{}",characterCategoryStructure);
return leaderCategoryService.edit(characterCategoryStructure);
}
/**
* 删除分类树
* */
@GetMapping("/del")
public Result<?> del(@RequestParam(name="id",required=true) String id){
log.info("删除分类树:{}",id);
return leaderCategoryService.del(id);
}
/**
* 查询分类树列表
* @param sign
* @param category
* @param pid
* @param httpServletRequest
* @return
*/
@GetMapping("/list")
public Result<?> list(
@RequestParam(name="sign",defaultValue = "1") String sign,
@RequestParam(name="category",required = false) String category,
@RequestParam(name="pid",defaultValue = "0") String pid,
HttpServletRequest httpServletRequest){
log.info("查询分类树列表:{}---{}---{}",sign,category,pid);
if (!"1".equals(sign)){
if (StringUtils.isBlank(pid)){
return Result.error("查询非顶级节点列表时需要pid参数");
}
}
return leaderCategoryService.lists(sign,pid,category);
}
/**
* 根据名称模糊查询所有节点及父节点
* @param category
* @param typeName
* @return
*/
@GetMapping("/getByName")
public Result<?> getByName(
@RequestParam(name="category",required = false) String category,
@RequestParam(name="typeName",required=false) String typeName){
log.info("根据名称模糊查询所有节点及父节点:{}---{}",category,typeName);
if(typeName == null || "".equals(typeName)){
//查询全部数据封装成树
return leaderCategoryService.getAll(category);
} else {
//根据typeName模糊查询节点和父节点
return leaderCategoryService.getByName(category,typeName);
}
}
// @GetMapping("/type")
// public Result<?> type(){
// return Result.OK(KnowTypeEnum.getAllAsMap());
// }
}
package com.zzsn.thinktank.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/2/6 11:06
* @Content:
*/
@RestController
@RequestMapping("/api")
@Slf4j
public class ThinkTankController {
@GetMapping("/test")
public String test(){
log.info("hello!");
return "hello!";
}
}
package com.zzsn.thinktank.controller;
import com.zzsn.thinktank.entity.ThinktankBasicInfo;
import com.zzsn.thinktank.service.ThinktankBasicInfoService;
import com.zzsn.thinktank.vo.Result;
import com.zzsn.thinktank.vo.ThinktankBasicInfoListVo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Map;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/24 10:28
* @Content:
*/
@Slf4j
@RestController
@RequestMapping("/api/basicinfo")
public class ThinktankBasicInfoController {
@Autowired
ThinktankBasicInfoService thinktankBasicInfoService;
/**
* 新增
* @param thinktankBasicInfo
* @return
*/
@PostMapping("/add")
public Result<?> add(@RequestBody ThinktankBasicInfo thinktankBasicInfo){
log.info("新增信息:{}",thinktankBasicInfo);
return thinktankBasicInfoService.add(thinktankBasicInfo);
}
/**
* 根据id主键删除
* @param id
* @return
*/
@GetMapping("/del")
public Result<?> del(@RequestParam(name="id",required=true) String id){
log.info("根据id删除:{}", id);
return thinktankBasicInfoService.del(id);
}
/**
* 根据id修改信息
* @param thinktankBasicInfo
* @return
*/
@PostMapping("/edit")
public Result<?> edit(@RequestBody ThinktankBasicInfo thinktankBasicInfo){
log.info("根据id修改信息:{}",thinktankBasicInfo);
if(thinktankBasicInfo.getId() == null)
return Result.error(400, "id不能为空");
return thinktankBasicInfoService.edit(thinktankBasicInfo);
}
/**
* 根据id主键查询
* @param id
* @return
*/
@GetMapping("getById")
public Result<?> getById(@RequestParam(name="id",required=true) String id){
log.info("根据id主键查询:{}",id);
ThinktankBasicInfoVo thinktankBasicInfo = thinktankBasicInfoService.getInfoById(id);
return Result.OK(thinktankBasicInfo);
}
@PostMapping("/list")
public Result<?> getList(@RequestBody ThinktankBasicInfoListVo thinktankBasicInfoListVo){
log.info("智库信息条件分页查询:{}", thinktankBasicInfoListVo);
Integer pageNo = thinktankBasicInfoListVo.getPageNo();
Integer pageSize= thinktankBasicInfoListVo.getPageSize();
if(pageNo < 1)
pageNo = 1;
if(pageSize < 0)
pageSize = 10;
Integer office = pageSize * (pageNo - 1);
thinktankBasicInfoListVo.setOffset(office);
return thinktankBasicInfoService.getList(thinktankBasicInfoListVo);
}
/**
* 模板下载
* @param response
*/
@GetMapping("/downloadTemplate")
public void downloadTemplate(HttpServletResponse response) {
thinktankBasicInfoService.downloadTemplate(response);
}
/**
* 批量导入数据
* @param
* @return
*/
@Transactional
@PostMapping("/batchImport")
public Result<?> batchImport( HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
if (fileMap.size() < 1) {
return Result.error("请上传文件!");
}
MultipartFile multipartFile = fileMap.get(new ArrayList<>(fileMap.keySet()).get(0));
Result result = thinktankBasicInfoService.batchImport(multipartFile);
return result;
}
@PostMapping("/batchExport")
public byte[] batchExport(@RequestBody ThinktankBasicInfoListVo thinktankBasicInfoListVo,HttpServletRequest request, HttpServletResponse response){
log.info("导出:{}", thinktankBasicInfoListVo);
// Integer pageNo = thinktankBasicInfoListVo.getPageNo();
// Integer pageSize= thinktankBasicInfoListVo.getPageSize();
// if(pageNo < 1)
// pageNo = 1;
// if(pageSize < 0)
// pageSize = 10;
// Integer office = pageSize * (pageNo - 1);
// thinktankBasicInfoListVo.setOffset(office);
return thinktankBasicInfoService.batchExport(thinktankBasicInfoListVo,request,response);
}
}
package com.zzsn.thinktank.controller;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.thinktank.entity.InfoSource;
import com.zzsn.thinktank.service.InfoSourceGroupMapService;
import com.zzsn.thinktank.service.InfoSourceService;
import com.zzsn.thinktank.vo.InfoSourceGroupPage;
import com.zzsn.thinktank.vo.InfoSourceVo;
import com.zzsn.thinktank.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/25 9:34
* @Content: 信息源绑定
*/
@Slf4j
@RestController
@RequestMapping("/api/bind")
public class ThinktankBindController {
@Autowired
private InfoSourceService infoSourceService;
@Autowired
private InfoSourceGroupMapService infoSourceGroupMapService;
/**
* 查询信息源组的绑定列表
* @param infoSourceVo
* @param ynBind
* @param groupId
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping(value = "/bindList")
public Result<?> bindList(InfoSourceVo infoSourceVo,
@RequestParam(name="ynBind", required=true) Integer ynBind,
@RequestParam(name="groupId", required=true) String groupId,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
IPage<InfoSourceVo> pageList = infoSourceService.pageListByGroupId(infoSourceVo, ynBind, groupId, pageNo, pageSize);
return Result.OK(pageList);
}
/**
* 信息源分页列表查询
* @param infoSourceVo
* @param pageNo
* @param pageSize
* @param infoSourceTypeId
* @return
*/
@GetMapping(value = "/listByTypeId")
public Result<?> queryPageListByTypeId(InfoSourceVo infoSourceVo,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "infoSourceTypeId", defaultValue = "") String infoSourceTypeId) {
IPage<InfoSourceVo> pageList = infoSourceService.pageListByTypeId(null,null,infoSourceVo, pageNo, pageSize, infoSourceTypeId);
return Result.OK(pageList);
}
/**
* 绑定信息源
*/
@PostMapping(value = "/bind")
public Result<?> bind(@RequestBody InfoSourceGroupPage infoSourceGroupPage) {
String message = infoSourceGroupMapService.bind(infoSourceGroupPage.getId(), infoSourceGroupPage.getInfoSourceIds());
return Result.OK(message);
}
/**
* 解绑信息源
*/
@PostMapping(value = "/unBound")
public Result<?> unBound(@RequestBody InfoSourceGroupPage infoSourceGroupPage) {
infoSourceGroupMapService.unBind(infoSourceGroupPage.getId(), infoSourceGroupPage.getInfoSourceIds());
return Result.OK("解绑成功!");
}
/**
* 提升信息源优先等级
* 批量紧急
* @param groupId 信息源组id
* @author
* @date
*/
/**
* 提升信息源优先等级
* 批量紧急
* @param groupId 信息源组id
* @return
*/
@GetMapping("/upLevel")
public Result<?> upLevel(@RequestParam("groupId") String groupId){
List<String> sourceIdList = infoSourceService.listByGroupId(groupId);
LambdaUpdateWrapper<InfoSource> update = Wrappers.lambdaUpdate();
update.set(InfoSource::getSiteLevel,1).in(InfoSource::getId,sourceIdList);
infoSourceService.update(update);
return Result.OK();
}
}
package com.zzsn.thinktank.controller;
import com.zzsn.thinktank.service.ThinktankTagService;
import com.zzsn.thinktank.vo.Result;
import com.zzsn.thinktank.vo.SysBaseLabelTypeVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 标签查询相关接口
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/20 18:26
* @Content:
*/
@Slf4j
@RestController
@RequestMapping("/api/tag")
public class ThinktankTagController {
@Autowired
ThinktankTagService thinktankTagService;
/**
* 查询所有标签分类
* @return
*/
@GetMapping("/getTagTypeList")
public Result<?> getTagTypeList(){
log.info("查询所有标签分类");
SysBaseLabelTypeVo vo = thinktankTagService.getTagTypeList();
return Result.OK(vo);
}
/**
* 查询标签列表
* @param id
* @param name
* @return
*/
@GetMapping("/getTagList")
public Result<?> getTagList(@RequestParam(name="id",required=false) String id,
@RequestParam(name="name",required=false) String name){
log.info("查询标签列表:{}---{}",id,name);
return thinktankTagService.getTagList(id, name);
}
/**
* 根据标签分页
* @param tagId
* @return
*/
@GetMapping("/getCharacterListByTag")
public Result<?> getCharacterListByTag(@RequestParam(name="tagId",required=true) String tagId,
@RequestParam(name="pageNo",required=false) Integer pageNo,
@RequestParam(name="pageSize",required=false) Integer pageSize){
log.info("根据标签分页查询人物:{}---{}---{}",tagId,pageNo,pageSize);
if(pageNo == null || pageNo < 1)
pageNo = 1;
if(pageSize == null || pageSize < 0)
pageSize = 10;
return thinktankTagService.getCharacterListByTag(tagId,pageNo,pageSize);
}
//热门标签
@GetMapping("/getTopTag")
public Result<?> getTopTag(){
Result result = thinktankTagService.getTopTag();
log.info("热门标签:{}",result.getResult());
return result;
}
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("city_address")
public class CityAddress {
private String id;
private String name;
private String pid;
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 信息源组和信息源关联表
* @Author: jeecg-boot
* @Date: 2021-11-24
* @Version: V1.0
*/
@Data
@TableName("thinktank_info_source_group_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class InfoSourceGroupMap implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**信息源组id*/
@Excel(name = "信息源组id", width = 15)
private String groupId;
/**信息源id*/
@Excel(name = "信息源id", width = 15)
private String sourceId;
/**创建人*/
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**所属部门*/
private String sysOrgCode;
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("label_entity")
public class LabelEntity {
private String id;
private String name;
private String synonym;
private String explanation;
private long level;
private String topId;
private String pathIds;
private long status;
private long sort;
private String createBy;
private java.sql.Timestamp createTime;
private String updateBy;
private java.sql.Timestamp updateTime;
private String sysOrgCode;
private String pid;
private String hasChild;
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_base_domestic_region")
public class SysBaseDomesticRegion {
//主键id
private String id;
//名称
private String name;
//编码
private String code;
//节点id绝对路径
private String pathIds;
//层级
private Long level;
//父id
private String pid;
//是否有子节点
private String hasChild;
}
package com.zzsn.thinktank.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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @Description: 企业基本信息表-新企业表
*/
@Data
@TableName("sys_base_enterprise")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class SysBaseEnterprise implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 统一社会信用代码
*/
private String socialCreditCode;
/**
* 企业原文名称
*/
private String originalName;
/**
* 企业中文名称
*/
private String name;
/**
* 法定代表人
*/
private String legalPerson;
/**
* 电话
*/
private String officialPhone;
/**
* 官网
*/
private String officialUrl;
/**
* 邮箱
*/
private String officialEmail;
/**
* 地址
*/
private String address;
/**
* 简介
*/
private String briefInfo;
private String briefInfoTranlate;
/**
* 登记状态
*/
private String registerStatus;
/**
* 成立日期
*/
private String incorporationDate;
/**
* 注册资本
*/
private String capital;
/**
* 实缴资本
*/
private String paidCapital;
/**
* 核准日期
*/
private String approvalDate;
/**
* 组织机构代码
*/
private String organizationCode;
/**
* 工商注册号
*/
private String registerNo;
/**
* 纳税人识别号
*/
private String taxpayerNo;
/**
* 企业类型
*/
private String type;
/**
* 营业期限自
*/
private String businessStartDate;
/**
* 营业期限至
*/
private String businessEndDate;
/**
* 纳税人资质
*/
private String taxpayerQualification;
/**
* 所属行业
*/
private String industry;
/**
* 所属地区(来源与爬来的, 存储省市县)
*/
private String region;
/***/
private String regionName;
/**
* 所属省
*/
private String province;
/**
* 所属市
*/
private String city;
/**
* 所属县
*/
private String county;
/**
* 登记机关
*/
private String registerDepartment;
/**
* 人员规模
*/
private String scale;
/**
* 参保人数
*/
private String insured;
/**
* 曾用名
*/
private String beforeName;
/**
* 企业简称
*/
private String shortName;
/**
* 英文名
*/
private String englishName;
/**
* 进出口企业代码
*/
private String importExportEnterpriseCode;
/**
* 经营范围
*/
private String businessRange;
/**
* 企业logo地址
*/
private String logo;
/**
* 企查查企业Id
*/
private String qccId;
/**
* 状态: (0保留,1删除)
*/
private Integer status;
/**
* 创建人
*/
private String createBy;
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 所属部门
*/
private String sysOrgCode;
/**
* 是否国内(1-是;0-否)
*/
private Integer ynDomestic;
/**
* 所属国家/地区名称
*/
private String countryName;
/**
* 信息来源网站的更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date sourceUpdateTime;
/**
* 名称首字母
*/
private String initial;
@TableField(exist = false)
private Map<String, Object> labelOrder;
/**
* 世界500强排序
*/
@TableField(exist = false)
private Integer orderTop500;
/**
* 是否跳转:0-否 1-是
*/
@TableField(exist = false)
private String ifJump;
/**
* 股票代码
*/
@TableField(exist = false)
private String stockCode;
/**
* 标签
*/
// @TableField(exist = false)
// private List<Label> labels;
/**
* 是否有财务数据, 1-否,1-是 *
*/
@TableField(exist = false)
private Integer financeMark;
/**
* 股票代码
*/
@TableField(exist = false)
private String securitiesCode;
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 标签类别
* @Author: jeecg-boot
* @Date: 2022-05-12
* @Version: V1.0
*/
@Data
@TableName("sys_base_label_type")
public class SysBaseLabelType implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**标签编码*/
@Excel(name = "标签编码", width = 15)
private String labelCode;
/**标签名称*/
@Excel(name = "标签名称", width = 15)
private String labelName;
/**标签标识*/
@Excel(name = "标签标识", width = 15)
private String labelMark;
/**说明*/
@Excel(name = "说明", width = 15)
private String explanation;
/**创建人*/
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
/**所属部门*/
private String sysOrgCode;
/**父级节点*/
@Excel(name = "父级节点", width = 15)
private String pid;
/**是否有子节点*/
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
private String hasChild;
/**排序*/
private Integer orderNo;
/**顶层id*/
private String topId;
/**标签类别(如企业、自定义等)*/
private String labelType;
/**标签类型(0-非自定义;1-自定义)*/
private Integer category;
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("thinktank_basic_info")
public class ThinktankBasicInfo extends Model<ThinktankBasicInfo> {
//主键
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
//智库机构编码
private String codeId;
//中文全称
private String chineseWhole;
//中文简称
private String chineseSimple;
//英文全称
private String englishWhole;
//英文简称
private String englishSimple;
//原文全称
private String originalWhole;
//原文简称
private String originalSimple;
//官网
private String officialWebsite;
//标签id 多个标签使用逗号分隔
private String tagId;
//标签名称 多个标签使用逗号分隔
private String tagName;
//成立时间
private String establishTime;
//是否收费 1是 0否 默认为空值
private Integer charge;
//国内外
private String countryWithinExternal;
//所属国家/地区 ID
private String belongCountryId;
//所属国家/地区
private String belongCountry;
//所在地区
private String region;
//地址
private String address;
//创办单位/所属单位 企业信用代码
private String belongUnitCode;
//创办单位/所属单位
private String belongUnit;
//机构头像
private String headSculpture;
//简介
private String biographicalNotes;
//属性 区分智库机构、咨询公司、新闻媒体
private String attribute;
//启停状态 1启 0停
private Integer status;
//创建人
private String createBy;
//创建时间
@TableField(fill = FieldFill.INSERT)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//更新人
private String updateBy;
//更新时间
@TableField(fill = FieldFill.UPDATE)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* <p>
*5.1 人物分类体系表 character_category_structure
* </p>
*
* @since
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("thinktank_category_structure")
public class ThinktankCategoryStructure extends Model<ThinktankCategoryStructure>
{
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 类别名称 公安部 财政部
*/
@TableField("type_name")
private String typeName;
/**
*类别编码
*/
@TableField("type_code")
private String typeCode;
/**
* 创建人
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//@TableField("create_time")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新人
*/
@TableField("update_by")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
//@TableField("update_time")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 所属部门
*/
@TableField("sys_org_code")
private String sysOrgCode;
/**
* 父级节点id
*/
@TableField("pid")
private String pid;
/**
* 是否有子节点0,没有 1,有
*/
@TableField("has_child")
private String hasChild;
/**
* 分类类型: 领导人 专家 企业高管
*/
@TableField("category")
private String category;
/**
* 状态0启用,1禁用
*/
@TableField("status")
private Integer status;
/**
* 节点绝对路径
*/
@TableField("full_path")
private String fullPath;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 排序
*/
@TableField("sort")
private Long sort;
}
package com.zzsn.thinktank.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("thinktank_tag_top")
public class ThinktankTagTop {
private String id;
private String name;
private Integer countNum;
//创建时间
@TableField(fill = FieldFill.INSERT)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.CityAddress;
import com.zzsn.thinktank.entity.SysBaseDomesticRegion;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/9 16:00
* @Content:
*/
@Mapper
public interface CityAddressMapper extends BaseMapper<SysBaseDomesticRegion> {
@Select("select * from city_address where pid = #{pid}")
List<CityAddress> getCityList(String pid);
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.SysBaseEnterprise;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/26 14:27
* @Content:
*/
@Mapper
public interface EnterpriseMapper extends BaseMapper<SysBaseEnterprise> {
List<SysBaseEnterprise> pageList(Integer office, Integer pageSize, String socialCreditCode, String name);
Integer pageListCount(String socialCreditCode, String name);
List<SysBaseEnterprise> getListByName(String name);
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.InfoSourceGroupMap;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 信息源组和信息源关联表
* @Author: jeecg-boot
* @Date: 2021-11-24
* @Version: V1.0
*/
public interface InfoSourceGroupMapMapper extends BaseMapper<InfoSourceGroupMap> {
InfoSourceGroupMap query(@Param("sourceId") String sourceId, @Param("groupId") String groupId);
void deleteBySourceId(@Param("sourceId") String sourceId);
void deleteBySourceIds(@Param("groupId") String groupId, @Param("sourceIds") List<String> sourceIds);
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.InfoSource;
import com.zzsn.thinktank.vo.InfoSourceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/25 9:50
* @Content:
*/
@Mapper
public interface InfoSourceMapper extends BaseMapper<InfoSource> {
List<InfoSourceVo> pageListByGroupId(@Param("infoSourceVo") InfoSourceVo infoSourceVo, @Param("ynBind") Integer ynBind, @Param("groupId") String groupId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
Integer totalCountByGroupId(@Param("infoSourceVo") InfoSourceVo infoSourceVo, @Param("ynBind") Integer ynBind, @Param("groupId") String groupId);
List<InfoSourceVo> pageList(@Param("customerId") String customerId,@Param("userId") String userId,@Param("infoSourceVo") InfoSourceVo infoSourceVo, @Param("typeIds") List<String> typeIds, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
List<InfoSourceVo> listBySidList(@Param("customerId") String customerId,@Param("userId") String userId,List<String> collect);
Integer totalCount(@Param("customerId") String customerId,@Param("userId") String userId,@Param("infoSourceVo") InfoSourceVo infoSourceVo, @Param("typeIds") List<String> typeIds);
List<String> listByGroupId(@Param("groupId") String groupId);
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.ThinktankCategoryStructure;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author obcy
* @since 2024-01-04
*/
@Mapper
public interface LeaderCategoryMapper extends BaseMapper<ThinktankCategoryStructure> {
@Select("select * from character_category_structure limit 10")
List<ThinktankCategoryStructure> getListTop();
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.ThinktankBasicInfo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoExportVo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoListVo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/24 10:34
* @Content:
*/
@Mapper
public interface ThinktankBasicInfoMapper extends BaseMapper<ThinktankBasicInfo> {
List<ThinktankBasicInfoVo> getList(ThinktankBasicInfoListVo thinktankBasicInfoListVo);
Integer getCount(ThinktankBasicInfoListVo thinktankBasicInfoListVo);
List<ThinktankBasicInfoExportVo> getExportList(ThinktankBasicInfoListVo thinktankBasicInfoListVo);
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.LabelEntity;
import com.zzsn.thinktank.entity.SysBaseLabelType;
import com.zzsn.thinktank.vo.SysBaseLabelTypeVo;
import com.zzsn.thinktank.vo.SysLabelVo;
import com.zzsn.thinktank.entity.ThinktankTagTop;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/21 11:05
* @Content:
*/
@Mapper
public interface ThinktankTagMapper extends BaseMapper<LabelEntity> {
List<ThinktankTagTop> getTopTag();
SysBaseLabelType getSysBaseLabelTypeById(String id);
List<SysBaseLabelType> getgetSysBaseLabelTypeListByPid(String id);
List<SysLabelVo> queryCustomLabel(List<String> ids, String name);
List<SysBaseLabelTypeVo> getTagTypeListAll();
@Select("select * from thinktank_tag_top " +
"where 1=1 " +
"and id = #{tagId} " +
"limit 1")
ThinktankTagTop getById(String tagName);
}
package com.zzsn.thinktank.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.thinktank.entity.ThinktankTagTop;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/22 14:07
* @Content:
*/
@Mapper
public interface ThinktankTagTopMapper extends BaseMapper<ThinktankTagTop> {
@Select("select * from thinktank_tag_top " +
"where 1=1 " +
"and name = #{tagName} " +
"limit 1")
ThinktankTagTop getByName(String tagName);
}
package com.zzsn.thinktank.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.thinktank.entity.SysBaseDomesticRegion;
import com.zzsn.thinktank.vo.Result;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/9 15:56
* @Content:
*/
public interface CityAddressService extends IService<SysBaseDomesticRegion> {
Result<?> getCityList();
Result<?> getCityListByPid(String pid);
}
package com.zzsn.thinktank.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.thinktank.entity.SysBaseEnterprise;
import com.zzsn.thinktank.vo.Result;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/26 14:24
* @Content:
*/
public interface EnterpriseService extends IService<SysBaseEnterprise> {
Result<?> pageList(Integer pageNo, Integer pageSize, String socialCreditCode, String name);
List<SysBaseEnterprise> getListByName(String name);
}
package com.zzsn.thinktank.service;
public interface IGeneratorIdService {
// 通过队列拿id;
Long getId();
Long getOrderId();
// 通过加锁拿id, 不建议使用;
// Long nextId();
//通过redis生成
String getIdNo();
}
package com.zzsn.thinktank.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.thinktank.entity.InfoSourceGroupMap;
import java.util.List;
/**
* @Description: 信息源组和信息源关联表
* @Author:
* @Date:
* @Version:
*/
public interface InfoSourceGroupMapService extends IService<InfoSourceGroupMap> {
/**信息源与信息源组的绑定关联关系*/
String bind(String groupId, List<String> sourceIds);
/**根据信息源ids删除映射关系*/
void unBind(String groupId, List<String> sourceIds);
List<InfoSourceGroupMap> getSourceGroupMap(List groupIds);
}
package com.zzsn.thinktank.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.thinktank.entity.InfoSource;
import com.zzsn.thinktank.vo.InfoSourceVo;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/25 9:43
* @Content:
*/
public interface InfoSourceService extends IService<InfoSource> {
/**
* 根据分类id获取信息源列表(ynBind=0 :查询没有绑定该组的信息源列表 ynBind=1 :查询绑定该组的信息源列表 )
*/
IPage<InfoSourceVo> pageListByGroupId (InfoSourceVo infoSourceVo, Integer ynBind, String groupId, Integer pageNo, Integer pageSize);
/**
* 根据分类id获取信息源列表
*/
IPage<InfoSourceVo> pageListByTypeId (String customerId, String userId, InfoSourceVo infoSourceVo, Integer pageNo, Integer pageSize, String infoSourceTypeId);
/**
* 获取信息源组下的信息源id集合
*/
List<String> listByGroupId(String groupId);
}
package com.zzsn.thinktank.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.thinktank.entity.ThinktankCategoryStructure;
import com.zzsn.thinktank.vo.Result;
/**
* <p>
* 服务类
* </p>
*
* @author obcy
* @since 2024-01-04
*/
public interface LeaderCategoryService extends IService<ThinktankCategoryStructure> {
/**根节点父ID的值*/
public static final String ROOT_PID_VALUE = "0";
/**树节点有子节点状态值*/
public static final String HASCHILD = "1";
/**树节点无子节点状态值*/
public static final String NOCHILD = "0";
Result<?> add(ThinktankCategoryStructure characterCategoryStructure);
Result<?> edit(ThinktankCategoryStructure characterCategoryStructure);
Result<?> del(String id);
Result<?> lists(String sign, String pid, String category);
Result<?> getByName(String category, String typeName);
Result<?> getAll(String category);
/**
* 通过id获取子节点列表
* @param id id
* @return
*/
//List<CharacterCategoryStructure> getTreeListBy(String id);
/**
* 根据userId获取列表
* @param userId
* @return
*/
//List<String> getKnowledgeListByUserId(String userId, List<String> knowProjectIdList);
//List<KbAuthuserKnowledgeprojectMap> getKnowledgeProjectListByUserId(String userId);
}
package com.zzsn.thinktank.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.thinktank.entity.ThinktankBasicInfo;
import com.zzsn.thinktank.vo.Result;
import com.zzsn.thinktank.vo.ThinktankBasicInfoListVo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoVo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/24 10:31
* @Content:
*/
public interface ThinktankBasicInfoService extends IService<ThinktankBasicInfo> {
Result<?> add(ThinktankBasicInfo thinktankBasicInfo);
Result<?> del(String id);
Result<?> edit(ThinktankBasicInfo thinktankBasicInfo);
ThinktankBasicInfoVo getInfoById(String id);
Result<?> getList(ThinktankBasicInfoListVo thinktankBasicInfoListVo);
void downloadTemplate(HttpServletResponse response);
Result batchImport(MultipartFile multipartFile);
byte[] batchExport(ThinktankBasicInfoListVo thinktankBasicInfoListVo, HttpServletRequest request, HttpServletResponse response);
}
package com.zzsn.thinktank.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.thinktank.entity.LabelEntity;
import com.zzsn.thinktank.entity.ThinktankTagTop;
import com.zzsn.thinktank.vo.Result;
import com.zzsn.thinktank.vo.SysBaseLabelTypeVo;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/21 11:04
* @Content:
*/
public interface ThinktankTagService extends IService<LabelEntity> {
Result<?> getTagList(String id, String name);
Result<?> getCharacterListByTag(String tagId, Integer offset, Integer pageSize);
void addTagTop(ThinktankTagTop thinktankTagTop);
Result<?> getTopTag();
SysBaseLabelTypeVo getTagTypeList();
void addTagTop(String tagId);
List<LabelEntity> getListByIds(String[] ids);
}
package com.zzsn.thinktank.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.thinktank.entity.SysBaseDomesticRegion;
import com.zzsn.thinktank.mapper.CityAddressMapper;
import com.zzsn.thinktank.service.CityAddressService;
import com.zzsn.thinktank.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/9 15:59
* @Content:
*/
@Service
public class CityAddressServiceImpl extends ServiceImpl<CityAddressMapper, SysBaseDomesticRegion> implements CityAddressService {
@Autowired
CityAddressMapper cityAddressServiceMapper;
@Override
public Result<?> getCityList() {
//List<CityAddress> list = cityAddressServiceMapper.getCityList(pid);
List<SysBaseDomesticRegion> list = super.list();
return Result.OK(list);
}
@Override
public Result<?> getCityListByPid(String pid) {
LambdaQueryWrapper<SysBaseDomesticRegion> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.eq(SysBaseDomesticRegion::getPid, pid);
List<SysBaseDomesticRegion> list = cityAddressServiceMapper.selectList(lambdaQuery);
return Result.OK(list);
}
}
package com.zzsn.thinktank.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.thinktank.entity.SysBaseDomesticRegion;
import com.zzsn.thinktank.entity.SysBaseEnterprise;
import com.zzsn.thinktank.mapper.EnterpriseMapper;
import com.zzsn.thinktank.service.EnterpriseService;
import com.zzsn.thinktank.vo.Result;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/26 14:25
* @Content:
*/
@Service
public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, SysBaseEnterprise> implements EnterpriseService {
@Override
public Result<?> pageList(Integer pageNo, Integer pageSize, String socialCreditCode, String name) {
IPage page = new Page();
//查询列表
Integer office = pageSize * (pageNo - 1);
List<SysBaseEnterprise> list = baseMapper.pageList(office, pageSize, socialCreditCode, name);
page.setRecords(list);
//查询总数
Integer total = baseMapper.pageListCount(socialCreditCode, name);
page.setTotal(total);
page.setCurrent(pageNo);
page.setSize(pageSize);
return Result.OK(page);
}
@Override
public List<SysBaseEnterprise> getListByName(String name) {
return baseMapper.getListByName(name);
}
}
package com.zzsn.thinktank.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.thinktank.entity.InfoSourceGroupMap;
import com.zzsn.thinktank.entity.ThinktankBasicInfo;
import com.zzsn.thinktank.mapper.InfoSourceGroupMapMapper;
import com.zzsn.thinktank.service.InfoSourceGroupMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* @Description: 信息源组和信息源关联表
* @Author:
* @Date:
* @Version:
*/
@Service
public class InfoSourceGroupMapServiceImpl extends ServiceImpl<InfoSourceGroupMapMapper, InfoSourceGroupMap> implements InfoSourceGroupMapService {
@Autowired
private InfoSourceGroupMapMapper infoSourceGroupMapMapper;
@Override
@Transactional //抛出异常回滚
public String bind (String groupId, List<String> sourceIds){
String message = "绑定成功!";
if(!StringUtils.isEmpty(groupId) && sourceIds != null && sourceIds.size() > 0){
for(String sourceId : sourceIds){
//判断是否绑定过
QueryWrapper<InfoSourceGroupMap> queryWrapper = new QueryWrapper<InfoSourceGroupMap>();
queryWrapper.eq("group_id", groupId);
queryWrapper.eq("source_id", sourceId);
//todo:query in loop
List<InfoSourceGroupMap> list = infoSourceGroupMapMapper.selectList(queryWrapper);
if (list.size() <= 0) {
InfoSourceGroupMap infoSourceGroupMap = new InfoSourceGroupMap();
infoSourceGroupMap.setGroupId(groupId);
infoSourceGroupMap.setSourceId(sourceId);
infoSourceGroupMapMapper.insert(infoSourceGroupMap);
} else {
message = "部分已经绑定信息源成功过滤,未绑定的信息源已经绑定!";
}
}
}
return message;
}
@Override
public void unBind(String groupId, List<String> sourceIds){
if(!StringUtils.isEmpty(groupId) && sourceIds != null && sourceIds.size() > 0){
infoSourceGroupMapMapper.deleteBySourceIds(groupId, sourceIds);
}
}
@Override
public List<InfoSourceGroupMap> getSourceGroupMap(List groupIds) {
LambdaQueryWrapper<InfoSourceGroupMap> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.in(InfoSourceGroupMap::getGroupId,groupIds);
List<InfoSourceGroupMap> list = baseMapper.selectList(lambdaQuery);
return list;
}
}
package com.zzsn.thinktank.service.impl;
import com.zzsn.thinktank.service.IGeneratorIdService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.support.atomic.RedisAtomicLong;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* 雪花算法生成id
*/
@Component
@Slf4j
public class SnowFlakeGeneratorId implements IGeneratorIdService {
@Autowired
private StringRedisTemplate stringRedisTemplate;
private final static int MAX_QUEUE = 128;
private final static int DEFAULT_MACHINE_BIT_NUM = 6; //机器标识占用的位数
private final static int DEFAULT_PORT_BIT_NUM = 4; //端口占用的位数
private final static long START_STAMP = 1641286225129L; //起始时间
// 线程安全队列
private final ConcurrentLinkedQueue<Long> queue = new ConcurrentLinkedQueue<>();
private final ConcurrentLinkedQueue<Long> orderQueue = new ConcurrentLinkedQueue<>();
/**
* 可分配的位数
*/
private final static int REMAIN_BIT_NUM = 22;
private static final String FINANCE = "THINK_TANK_CODE:";
private final static int NUM = 8;
private static final String ZKG = "ZKG";
@Value("${server.port}")
private String port;
@PostConstruct
public void init() {
int portBitNum = DEFAULT_PORT_BIT_NUM;
int sequenceBitNum = REMAIN_BIT_NUM - portBitNum - machineBitNum;
this.maxSequenceValue = ~(-1 << sequenceBitNum);
machineBitLeftOffset = sequenceBitNum;
portBitLeftOffset = portBitNum + sequenceBitNum;
timestampBitLeftOffset = portBitNum + machineBitNum + sequenceBitNum;
this.portId = Integer.parseInt(port) & 15;
this.machineId = getMachineId() & 63;
productIdToQueue(queue, MAX_QUEUE);
productIdToQueue(orderQueue, MAX_QUEUE);
}
public Long getId() {
Long peek = queue.poll();
if (queue.size() <= MAX_QUEUE / 2) {
productIdToQueue(queue, MAX_QUEUE / 2);
}
return peek;
}
public Long getOrderId() {
Long peek = orderQueue.poll();
if (orderQueue.size() <= MAX_QUEUE / 2) {
productIdToQueue(orderQueue, MAX_QUEUE / 2);
}
return peek;
}
@Override
public String getIdNo() {
return getId(FINANCE, NUM);
}
//根据规则生成id(规则:格式化日期(截取后六位)+递增值(8位数))
private String getId(String prefix, int num){
String redisKey = getRedisKey(prefix);
Date expireDate = getExpireDate();
//返回当前redis中的key的最大值
long seq = generate(stringRedisTemplate, redisKey, expireDate);
//获取当天的日期,格式为yyyyMMdd
String date = new SimpleDateFormat("yyyyMMdd").format(expireDate);
//生成八位的序列号,如果seq不够四位,seq前面补0,
//如果seq位数超过了八位,那么无需补0直接返回当前的seq
String sequence = StringUtils.leftPad(Long.toString(seq), num, "0");
StringBuffer sb = new StringBuffer()
.append(ZKG)
.append("-")
.append(date)
.append("-")
.append(sequence);
return sb.toString();
}
//获取redis--key
@SneakyThrows
private String getRedisKey(String prefix){
if (StringUtils.isEmpty(prefix)){
throw new Exception("前缀不能为空!");
}
//用作存放redis中的key前缀
String PREFIX_KEY = "CodeGenerateUtil::";
return PREFIX_KEY + prefix;
}
//获取缓存过期时间点
private Date getExpireDate(){
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
//设置过期时间,这里设置为当天的23:59:59
return calendar.getTime();
}
//获取redis缓存
private long generate(StringRedisTemplate stringRedisTemplate, String key, Date expireTime) {
//RedisAtomicLong为原子类,根据传入的key和redis链接工厂创建原子类
RedisAtomicLong counter = new RedisAtomicLong(key,stringRedisTemplate.getConnectionFactory());
//设置过期时间
counter.expireAt(expireTime);
//返回redis中key的值
return counter.incrementAndGet();
}
/**
* 产生下一个ID
*/
public synchronized Long nextId() {
long currentStamp = getTimeMill();
if (currentStamp < lastStamp) {
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastStamp - currentStamp));
}
//新的毫秒,序列从0开始,否则序列自增
if (currentStamp == lastStamp) {
sequence = (sequence + 1) & this.maxSequenceValue;
if (sequence == 0L) {
//Twitter源代码中的逻辑是循环,直到下一个毫秒
lastStamp = tilNextMillis();
// throw new IllegalStateException("sequence over flow");
}
} else {
sequence = 0L;
}
lastStamp = currentStamp;
return (currentStamp - START_STAMP) << timestampBitLeftOffset | portId << portBitLeftOffset | machineId << machineBitLeftOffset | sequence;
}
private void productIdToQueue(ConcurrentLinkedQueue<Long> queue, Integer num) {
new Thread(() -> {
for (int i = 0; i < num; i++) {
queue.add(nextId());
}
}).start();
}
private Integer getMachineId() {
InetAddress addr = null;
try {
addr = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
/*获取本机IP*/
assert addr != null;
String ip = addr.getHostAddress();
log.info("本机IP : {} ", ip);
return Integer.parseInt(ip.split("\\.")[3]);
}
private final int machineBitNum = DEFAULT_MACHINE_BIT_NUM;
/**
* idc编号
*/
private long portId;
/**
* 机器编号
*/
private long machineId;
/**
* 当前序列号
*/
private long sequence = 0L;
/**
* 上次最新时间戳
*/
private long lastStamp = -1L;
/**
* idc偏移量:一次计算出,避免重复计算
*/
private int portBitLeftOffset;
/**
* 机器id偏移量:一次计算出,避免重复计算
*/
private int machineBitLeftOffset;
/**
* 时间戳偏移量:一次计算出,避免重复计算
*/
private int timestampBitLeftOffset;
/**
* 最大序列值:一次计算出,避免重复计算
*/
private int maxSequenceValue;
private long getTimeMill() {
return System.currentTimeMillis();
}
private long tilNextMillis() {
long timestamp = getTimeMill();
while (timestamp <= lastStamp) {
timestamp = getTimeMill();
}
return timestamp;
}
}
\ No newline at end of file
package com.zzsn.thinktank.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.thinktank.entity.LabelEntity;
import com.zzsn.thinktank.entity.SysBaseLabelType;
import com.zzsn.thinktank.entity.ThinktankTagTop;
import com.zzsn.thinktank.mapper.ThinktankTagMapper;
import com.zzsn.thinktank.mapper.ThinktankTagTopMapper;
import com.zzsn.thinktank.service.ThinktankBasicInfoService;
import com.zzsn.thinktank.service.ThinktankTagService;
import com.zzsn.thinktank.vo.Result;
import com.zzsn.thinktank.vo.SysBaseLabelTypeVo;
import com.zzsn.thinktank.vo.SysLabelVo;
import com.zzsn.thinktank.vo.ThinktankBasicInfoListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/3/21 11:04
* @Content:
*/
@Service
public class ThinktankTagServiceImpl extends ServiceImpl<ThinktankTagMapper, LabelEntity> implements ThinktankTagService {
@Autowired
ThinktankTagMapper thinktankTagMapper;
@Autowired
ThinktankTagTopMapper thinktankTagTopMapper;
@Autowired
ThinktankBasicInfoService thinktankBasicInfoService;
@Value("${sys_base_label_type_id}")
private String sys_base_label_type_id;
@Override
public Result<?> getTagList(String id, String name) {
if(id == null || id.length() == 0){
id = sys_base_label_type_id;
}
List<SysBaseLabelType> endNodes = getEndNodes(id);
List<String> ids = new ArrayList<>();
if (CollectionUtil.isEmpty(endNodes)){
ids.add(id);
}else {
endNodes.forEach(e->ids.add(e.getId()));
}
// List<SysLabelVo> pageList = null;
// pageList = baseMapper.queryCustomLabel(sysLabelVo, offset, pageSize);
List<SysLabelVo> pageList = thinktankTagMapper.queryCustomLabel(ids,name);
return Result.OK(pageList);
}
@Override
public Result<?> getCharacterListByTag(String tagId, Integer pageNo, Integer pageSize) {
ThinktankBasicInfoListVo thinktankBasicInfoListVo = new ThinktankBasicInfoListVo();
thinktankBasicInfoListVo.setPageNo(pageNo);
thinktankBasicInfoListVo.setPageSize(pageSize);
Integer office = pageSize * (pageNo - 1);
thinktankBasicInfoListVo.setOffset(office);
thinktankBasicInfoListVo.setTagId(tagId);
return thinktankBasicInfoService.getList(thinktankBasicInfoListVo);
}
@Override
public void addTagTop(ThinktankTagTop thinktankTagTop){
thinktankTagTopMapper.insert(thinktankTagTop);
}
@Override
public Result<?> getTopTag() {
List<ThinktankTagTop> list = thinktankTagMapper.getTopTag();
return Result.OK(list);
}
@Override
public SysBaseLabelTypeVo getTagTypeList() {
// List<SysBaseLabelTypeVo> allList = new ArrayList<>();
//SysBaseLabelTypeVo sysBaseLabelTypeVo = new SysBaseLabelTypeVo();
//sysBaseLabelTypeVo.setId("0");
// sysBaseLabelTypeVo.setLabelName("所有");
// sysBaseLabelTypeVo.setPid("0");
// sysBaseLabelTypeVo.setHasChild("1");
List<SysBaseLabelTypeVo> list = thinktankTagMapper.getTagTypeListAll();
//只获取人物服务相关的类别
List<SysBaseLabelTypeVo> treeList = getBaseLabelTreeList(list,sys_base_label_type_id);
// sysBaseLabelTypeVo.setChildren(treeList);
// allList.add(sysBaseLabelTypeVo);
// return allList;
if(treeList.size()==1)
return treeList.get(0);
return null;
}
@Override
public void addTagTop(String tagId){
ThinktankTagTop characterTagTop = thinktankTagMapper.getById(tagId);
if (characterTagTop == null){
LabelEntity labelEntity = this.getById(tagId);
ThinktankTagTop newTagTop = new ThinktankTagTop();
newTagTop.setId(tagId);
newTagTop.setName(labelEntity.getName());
newTagTop.setCountNum(1);
thinktankTagTopMapper.insert(newTagTop);
} else {
characterTagTop.setCountNum(characterTagTop.getCountNum() + 1);
thinktankTagTopMapper.updateById(characterTagTop);
}
}
@Override
public List<LabelEntity> getListByIds(String[] ids) {
LambdaQueryWrapper<LabelEntity> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.in(LabelEntity::getId, ids);
List<LabelEntity> list = thinktankTagMapper.selectList(lambdaQuery);
return list;
}
/**
* 根据标签类别id查询所有的末端节点
* @param id
* @return
*/
public List<SysBaseLabelType> getEndNodes(String id){
List<SysBaseLabelType> list = new ArrayList<>();
//SysBaseLabelType byId = super.getById(id);
SysBaseLabelType byId = thinktankTagMapper.getSysBaseLabelTypeById(id);
if (ObjectUtil.isEmpty(byId)){
return list;
}
if ("0".equals(byId.getHasChild())){
return list;
}
return getnodes(list,id);
}
/**
* 递归查询
* @param list
* @param id
* @return
*/
private List<SysBaseLabelType> getnodes(List<SysBaseLabelType> list,String id){
//List<SysBaseLabelType> child = super.list(Wrappers.<SysBaseLabelType>lambdaQuery().eq(SysBaseLabelType::getPid, id));
List<SysBaseLabelType> child = thinktankTagMapper.getgetSysBaseLabelTypeListByPid(id);
child.forEach(e -> {
if ("0".equals(e.getHasChild())){
list.add(e);
}else {
getnodes(list,e.getId());
}
});
return list;
}
//获取树状结构
private List<SysBaseLabelTypeVo> getBaseLabelTreeList(List<SysBaseLabelTypeVo> baseLabelTypeList, String id){
List<SysBaseLabelTypeVo> topList = new ArrayList<>();
baseLabelTypeList.forEach(e->{
if (id.equals(e.getId())) {
topList.add(e);
}
});
for (SysBaseLabelTypeVo sysLabelVo : topList) {
setBaseLabelChildren(sysLabelVo, baseLabelTypeList);
}
return topList;
}
//递归获取树形结构数据
private void setBaseLabelChildren(SysBaseLabelTypeVo parent, List<SysBaseLabelTypeVo> list) {
Set<SysBaseLabelTypeVo> children = getBaseLabelChildren(list, parent.getId());
parent.setChildren(new ArrayList<>(children));
for (SysBaseLabelTypeVo sysLabelVo : children) {
setBaseLabelChildren(sysLabelVo, list);
}
}
private Set<SysBaseLabelTypeVo> getBaseLabelChildren(List<SysBaseLabelTypeVo> list, String id) {
Set<SysBaseLabelTypeVo> children = new HashSet<>();
for (SysBaseLabelTypeVo sysLabelVo : list) {
if (sysLabelVo.getPid().equals(id)) {
children.add(sysLabelVo);
}
}
return children;
}
}
package com.zzsn.thinktank.util;
import org.apache.commons.lang3.time.DateUtils;
import java.text.ParseException;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/4/3 11:08
* @Content: 日期处理
*/
public class DateUtil {
/**
* 支持的日期格式
*/
private static final String[] froms = {"yyyy","yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss"};
/**
* 根据支持的日期格式校验字符串是否符合格式
* @param dateStr
* @return 通过校验返回true, 未通过校验返回false
*/
public static boolean isValidDate(String dateStr){
try {
DateUtils.parseDateStrictly(dateStr, froms);
return true;
} catch (ParseException e) {
return false;
}
}
/**
* 根据支持的日期格式校验字符串是否符合格式
* @param dateStr
* @return 通过校验返回true, 未通过校验返回false ,如果待校验字符串未空,则返回true
*/
public static boolean isDate(String dateStr){
if(dateStr != null && dateStr.length() > 0){
return isValidDate(dateStr);
} else {
return true;
}
}
}
package com.zzsn.thinktank.util;
import lombok.Data;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
@ConfigurationProperties(prefix = "es1")
@Configuration
@Data
public class Elasticsearch1Config {
private String endpoint1;
private Integer endpoint1port;
private String endpoint2;
private Integer endpoint2port;
private String endpoint3;
private Integer endpoint3port;
private String username;
private String password;
@Bean
@Primary
public RestHighLevelClient elasticsearch1Client() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
RestClientBuilder builder = RestClient.builder(
new HttpHost(endpoint1, endpoint1port, "http"),
new HttpHost(endpoint2, endpoint2port, "http"),
new HttpHost(endpoint3, endpoint3port, "http"))
.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
// 设置连接超时时间和套接字超时时间
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
requestConfigBuilder.setConnectTimeout(300000); // 连接超时时间为300秒
requestConfigBuilder.setSocketTimeout(300000); // 套接字超时时间为300秒
httpClientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
return httpClientBuilder;
});
return new RestHighLevelClient(builder);
}
// @Bean
// public RestHighLevelClient elasticsearch1Client() {
// final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
//
// credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
//
// RestClientBuilder builder = RestClient.builder(HttpHost.create(endpoints))
// .setHttpClientConfigCallback(httpClientBuilder -> {
// httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
// return httpClientBuilder;
// });
//
// return new RestHighLevelClient(builder);
// }
// @Bean
// public RestHighLevelClient elasticsearch1Client() {
// RestHighLevelClient client = new RestHighLevelClient(
// RestClient.builder(
// new HttpHost("",9200,"http"),
// new HttpHost("",9200,"http")
// )
// );
// return client;
//
// }
}
package com.zzsn.thinktank.util;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
public class PageBuilderParser {
public String parserStr(Object doc, String path)
throws XPathExpressionException {
String ret = "";
Object obj = parser(doc, path);
if (obj == null) {
return ret;
}
if (obj instanceof NodeList) {
StringBuffer buffer = new StringBuffer();
NodeList nodeList = (NodeList) obj;
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
String txt = getNodeText(node);
buffer.append(txt);
if (i != nodeList.getLength() - 1) {
buffer.append(" ");
}
}
ret = buffer.toString();
} else if (obj instanceof Node) {
String s = getNodeText((Node) obj);
ret = s;
} else if (obj instanceof String) {
ret = (String) obj;
} else if (obj instanceof Number) {
Number number = (Number) obj;
ret = number.toString();
} else if (obj instanceof Boolean) {
Boolean number = (Boolean) obj;
ret = number.toString();
}
ret = StringUtil.trimWhiteSpace(ret);
ret = StringUtil.normalizeHtmlTransf(ret);
return ret;
}
public Object parser(Object doc, String path) throws XPathExpressionException {
if (path == null || path.trim().length() == 0) {
return null;
}
XPathFactory factory = XPathFactory.newInstance();
XPath xPath = factory.newXPath();
XPathExpression expression = xPath.compile(path);
Object object = null;
try {
object = expression.evaluate(doc, XPathConstants.NODESET);
return (NodeList) object;
} catch (XPathExpressionException e) {
try {
object = expression.evaluate(doc, XPathConstants.NODE);
return (Node) object;
} catch (XPathExpressionException e1) {
try {
object = expression.evaluate(doc, XPathConstants.STRING);
return (String) object;
} catch (XPathExpressionException e2) {
try {
object = expression.evaluate(doc, XPathConstants.NUMBER);
return (Number) object;
} catch (XPathExpressionException e3) {
try {
object = expression.evaluate(doc, XPathConstants.BOOLEAN);
return (Boolean) object;
} catch (XPathExpressionException e4) {
// TODO Auto-generated catch block
e4.printStackTrace();
}
}
}
}
}
return object;
}
public String getNodeText(Node node) {
String s = "";
if (node.getNodeType() == Node.TEXT_NODE) {
s = node.getTextContent();
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
s = getNodeTextRec((Element) node);
} else if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
s = ((Attr) node).getValue();
} else if (node.getNodeType() == Node.CDATA_SECTION_NODE) {
s = node.getNodeValue();
}
s = StringUtil.trimWhiteSpace(s);
s = StringUtil.normalizeHtmlTransf(s);
return s;
}
private String getNodeTextRec(Element elem) {
StringBuffer buffer = new StringBuffer();
NodeList nodeList = elem.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node.getNodeType() == Node.TEXT_NODE) {
String txt = node.getTextContent();
buffer.append(StringUtil.trimWhiteSpace(txt));
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
buffer.append(getNodeTextRec((Element) node));
}
}
return buffer.toString();
}
public static Document xmlGetDocument(String pageBody)
throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputStream is = new ByteArrayInputStream(pageBody.getBytes());
Document document = builder.parse(is);
return document;
}
}
package com.zzsn.thinktank.vo;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
*5.1 人物分类体系表 分类树
* </p>
*
* @since
*/
@Data
public class CharacterCategoryStructureTreeVo extends Model<CharacterCategoryStructureTreeVo>
{
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 类别名称 公安部 财政部
*/
private String typeName;
/**
*类别编码
*/
private String typeCode;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 所属部门
*/
private String sysOrgCode;
/**
* 父级节点id
*/
private String pid;
/**
* 是否有子节点0,没有 1,有
*/
private String hasChild;
/**
* 分类类型: 领导人 专家 企业高管
*/
private String category;
/**
* 状态0启用,1禁用
*/
private Integer status;
/**
* 节点绝对路径
*/
private String fullPath;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Long sort;
/**
* 子节点
*/
private List<CharacterCategoryStructureTreeVo> children = new ArrayList<>();
}
package com.zzsn.thinktank.vo;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Description:
*
* @author: EDY
* @since: 2023/10/24
*/
@Data
@Accessors(chain = true)
public class GroupResult {
private String name;
private Long count;
}
package com.zzsn.thinktank.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 信息源组和信息源关联表
* @Author: jeecg-boot
* @Date: 2021-11-24
* @Version: V1.0
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class InfoSourceGroupCountVo implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
private String id;
/**信息源组id*/
private String groupId;
/**信息源id*/
private String sourceId;
/**信息源采集资讯数量**/
private Integer infoCount;
}
package com.zzsn.thinktank.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.List;
@Data
public class InfoSourceGroupPage {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 组编码
*/
@Excel(name = "组编码", width = 15)
private String groupCode;
/**
* 信息源组名称
*/
@Excel(name = "信息源组名称", width = 15)
private String groupName;
/**
* 绑定信息源组的信息源ids
*/
@Excel(name = "绑定信息源组的信息源ids", width = 15)
private List<String> infoSourceIds;
/**
* 组类别id
*/
@Excel(name = "组类别ids", width = 15)
private List<String> groupTypeIds;
private String typeIds;
private String typeId;
/**
* 组类别名称
*/
@Excel(name = "组类别名称", width = 15)
private String groupTypeNames;
/**
* 分组说明
*/
@Excel(name = "分组说明", width = 15)
private String groupRemark;
/**
* 状态
*/
@Excel(name = "状态", width = 15, dicCode = "use_status")
private Integer status;
/**
* 创建人
*/
private String createBy;
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
/**
* 所属部门
*/
private String sysOrgCode;
/**
* 信息源类别
*/
private Integer sourceType;
/**
* 信息源权重(以组设置)
*/
private Integer weight;
/**
* 专题绑定信息源的主键id
*/
private String subjectInfoSourceId;
private Integer infoSourceNum;
private String groupTypeId;
}
package com.zzsn.thinktank.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Data
public class InfoSourceVo {
/**主键*/
private String id;
/****************************基本信息********************************/
/**信息源编码*/
private String infoSourceCode;
/**信息源名称,微信公众号名称,微博名称*/
private String webSiteName;
/**栏目名称*/
private String siteName;
/**栏目URL,微信公众号URL,微博URL*/
private String siteUri;
/**微博认证方式(1:个人微博 2:官方微博)*/
private String authMode;
/**功能介绍,微博认证描述*/
private String remarks;
/**公众号BIZ*/
private String biz;
/**是否大V*/
private int ynBigV;
/**权威性*/
private String authority;
/**信息源类别ids*/
private String infoSourceTypeId;
private String infoSourceTypeName;
/**信息源性质ids*/
private List<String> infoSourceNatureIds;
private String natureIds;
private String infoSourceNatureNames;
/**信息源组名称*/
private String infoSourceGroupNames;
/**网站重要级别*/
private String siteLevel;
/**国家*/
private String country;
/**地区*/
private String area;
/**语种*/
private String language;
/**是否(境外、公共、翻墙)*/
private String checkedList;
/**历史数据URL*/
private String hisUriExp;
/**历史数据开始时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date hisDateStartTime;
/**历史数据结束时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date hisDateEndTime;
/**是否历史所有数据*/
private String ynHisDataAll;
/**状态*/
private String status;
/****************************列表页********************************/
/**列表页URL*/
private String listUrl;
/**表达式类型*/
private String listExpressionType;
/**匹配资讯的url*/
private String informationUrl;
/**匹配资讯标题*/
private String informationTitle;
/**匹配资讯发布时间*/
private String informationPublishDate;
/**匹配资讯来源*/
private String informationSource;
/**列表信息块位置*/
private String infoBlockPosition;
/**抽取链接定位*/
private String linkLocation;
/**自定义实体*/
private Object extractInfo;
/**爬取深度*/
private Integer crawlDepth;
/**页码url*/
private String pageUrl;
/**匹配页码*/
private String matchPage;
/**开始页码*/
private int pageStart;
/**结束页码*/
private int pageEnd;
/**是否所有页*/
private String ynPageAll;
/**预警标签*/
private List<Map<String,Object>> warningTag;
/****************************详情页********************************/
/**详情页表URL*/
private int detailUrl;
/**表达式类型*/
private String detailExpressionType;
/**匹配详情页标题*/
private String detailExpressionTitle;
private Integer titleExtractionMethodType;
private String titleExtractionMethod;
/**匹配详情页时间*/
private String detailExpressionPublishDate;
private Integer publishDateExtractionMethodType;
private String publishDateExtractionMethod;
/**匹配详情页来源*/
private String detailExpressionSource;
private Integer sourceExtractionMethodType;
private String sourceExtractionMethod;
/**匹配详情页作者*/
private String detailExpressionAuthor;
private Integer authorExtractionMethodType;
private String authorExtractionMethod;
/**匹配详情页摘要*/
private String detailExpressionSummary;
private Integer summaryExtractionMethodType;
private String summaryExtractionMethod;
/**匹配详情页正文*/
private String detailExpressionContent;
private Integer contentExtractionMethodType;
private String contentExtractionMethod;
/**自定义实体*/
private Object detailInfo;
/**是否下载附件*/
private String ynDownload;
/****************************数据页********************************/
/**数据表格页URL*/
private String formUrl;
/**数据表格标题*/
private String formTitle;
/**表达式类型*/
private String formType;
/**数据表格表达式*/
private String dataFormExpression;
/**自定义*/
private Object dataFormInfo;
/**页码URL*/
private String dataPageUrl;
/**页码规则*/
private String dataPageRule;
/**开始页码*/
private int dataPageStart;
/**结束页码*/
private int dataPageEnd;
/**是否所有页码*/
private String ynDataPageAll;
/****************************存储设置********************************/
/**数据类型*/
private int dataType;
/**数据格式*/
private int dataFormat;
/**数据存储方式*/
private int dataStorageMode;
/**数据存储信息*/
private Object dataStorageInfo;
/****************************爬取设置********************************/
/**是否动态爬取*/
private int ynDynamicCrawl;
/**是否需要登陆*/
private int ynLogin;
/**登陆域名*/
private String domainName;
/**登陆链接*/
private String link;
/**登陆账号*/
private String account;
/**登陆密码*/
private String passWord;
/**userAgent*/
private String userAgent;
/**Referer*/
private String referer;
/**cookies*/
private String cookies;
/**headers*/
private String headers;
/**其它参数*/
private String otherInfo;
/****************************爬虫设置********************************/
/**爬虫类别*/
private int crawlType;
/**爬虫名称*/
private String crawlName;
/**爬虫地址*/
private String crawlAddress;
/**参数*/
private Object parameter;
/****************************调度设置********************************/
/**设置方式(1:自由设置 2:cron表达式)*/
private Integer setMode;
/**定时方式(1:时间间隔 2:立即执行)*/
private String timerMode;
/**定时单位(1分;2小时;3日;4月)*/
private String unit;
/**定时数值*/
private Integer space;
/**cron表达式*/
private String cron;
/**说明*/
private String explaination;
/**是否下载*/
private Boolean downLoad;
/**是否立即执行*/
private Boolean execute;
/**验证结果*/
private String verification;
/**所属单位*/
private String company;
/**所属行业*/
private String industry;
/**可信度*/
private String reliability;
/**原创度*/
private String originality;
/**父网站*/
private String parentSite;
/**是否保存快照(1:保存 0:不保存)*/
private String ynSnapshot;
private String sourceId;
/**创建人*/
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
package com.zzsn.thinktank.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* 接口返回数据格式
* @author scott
* @email jeecgos@163.com
* @date 2019年1月19日
*/
@Data
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
private static final Integer SC_OK_200 = 200;
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
private static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
/**访问权限认证未通过 510*/
private static final Integer SC_JEECG_NO_AUTHZ = 510;
/**
* 成功标志
*/
private boolean success = true;
/**
* 返回处理消息
*/
private String message = "操作成功!";
/**
* 返回代码
*/
private Integer code = 0;
/**
* 返回数据对象 data
*/
private T result;
/**
* 时间戳
*/
private long timestamp = System.currentTimeMillis();
/**
* python接口返回
*/
private String handleMsg;
/**
* python接口返回状态
*/
private boolean isHandleSuccess;
/**
* python接口返回状态
*/
private String logs;
/**
* 返回数据对象 data
*/
private T resultData;
public Result() {
}
public Result<T> success(String message) {
this.message = message;
this.code = SC_OK_200;
this.success = true;
return this;
}
public static<T> Result<T> OK() {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(SC_OK_200);
r.setMessage("成功");
return r;
}
public static<T> Result<T> OK(T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(SC_OK_200);
r.setResult(data);
return r;
}
public static<T> Result<T> OK(String msg, T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(SC_OK_200);
r.setMessage(msg);
r.setResult(data);
return r;
}
public static Result<Object> error(String msg) {
return error(SC_INTERNAL_SERVER_ERROR_500, msg);
}
public static Result<Object> error(int code, String msg) {
Result<Object> r = new Result<Object>();
r.setCode(code);
r.setMessage(msg);
r.setSuccess(false);
return r;
}
public Result<T> error500(String message) {
this.message = message;
this.code = SC_INTERNAL_SERVER_ERROR_500;
this.success = false;
return this;
}
/**
* 无权限访问返回结果
*/
public static Result<Object> noauth(String msg) {
return error(SC_JEECG_NO_AUTHZ, msg);
}
@JsonIgnore
private String onlTable;
}
\ No newline at end of file
package com.zzsn.thinktank.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
@Data
public class SysBaseLabelTypeVo {
/**主键*/
private String id;
/**标签名称*/
private String labelName;
/**标签标识*/
private String labelMark;
/**说明*/
private String explanation;
/**创建人*/
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
/**所属部门*/
private String sysOrgCode;
/**父级节点*/
private String pid;
/**是否有子节点*/
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
private String hasChild;
/**排序*/
private Integer orderNo;
/**顶层id*/
private String topId;
/**标签类别(如企业、自定义等)*/
private String labelType;
/**下级节点*/
private java.util.List<SysBaseLabelTypeVo> children;
}
package com.zzsn.thinktank.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class SysLabelVo {
/**
* 主键
*/
private String id;
/**
* 名称
*/
private String name;
/**
* 近义词
*/
private String synonym;
/**
* 说明
*/
private String explanation;
/**
* 层级
*/
private Integer level;
/**
* 一级主键id
*/
private String topId;
/**
* 所有id
*/
private String pathIds;
/**
* 状态
*/
private Integer status;
/**
* 排序
*/
private Integer sort;
/**
* 创建人
*/
private String createBy;
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
/**
* 所属部门
*/
private String sysOrgCode;
/**
* 父级节点
*/
private String pid;
/**
* 是否有子节点
*/
private String hasChild;
/**
* 属于哪个标签(表sys_base_label_type的主键id)
*/
private String labelTypeId;
/**
* 标签类别(如企业、自定义等)
*/
private String labelType;
/**
* 标签标识
*/
private String labelMark;
/**
* 下级节点
*/
private List<SysLabelVo> children;
private Boolean isLeaf;
/**
* 具体标签的id集合
*/
private List<String> labelIdList;
private String queryParam;
private String dataType = "";
/**
* 专题字段
*/
private Integer category;
/**
* 词条名称
*/
private String itemText;
/**
* 词条代码
*/
private String itemValue;
/**
* 描述
*/
private String description;
/**
* 排序值
*/
private String sortOrder;
/**
* 字典id
*/
private String dictId;
/**唯一编码(前端回显)*/
private String code;
}
package com.zzsn.thinktank.vo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ThinktankBasicInfoExportVo extends Model<ThinktankBasicInfoExportVo> {
//主键
private String id;
//序号
//private Integer rn;
//智库机构编码
private String codeId;
//中文全称
private String chineseWhole;
//中文简称
private String chineseSimple;
//英文全称
private String englishWhole;
//英文简称
private String englishSimple;
//原文全称
private String originalWhole;
//原文简称
private String originalSimple;
//官网
private String officialWebsite;
//所属国家/地区 ID
// private String belongCountryId;
//所属国家/地区
private String belongCountry;
//标签id 多个标签使用逗号分隔
// private String tagId;
//标签名称 多个标签使用逗号分隔
private String tagName;
//简介
private String biographicalNotes;
//成立时间
private String establishTime;
//是否收费 1是 0否 默认为空值
private Integer charge;
//地址
private String address;
//创办单位/所属单位
private String belongUnit;
//采集信息总量
private Integer collectionCount;
//绑定信息源个数
private Integer infoSourceCount;
//关联信息源id
private String infoSourceId;
//关联信息源编码
private String infoSourceCode;
//关联信息源名称
private String webSiteName;
//栏目名称
private String siteName;
//网址
private String siteUri;
//信息源采集数量
private Integer count;
//国内外
// private String countryWithinExternal;
//所在地区
// private String region;
//创办单位/所属单位 企业信用代码
// private String belongUnitCode;
//机构头像
// private String headSculpture;
//属性 区分智库机构、咨询公司、新闻媒体
// private String attribute;
//启停状态 1启 0停
// private Integer status;
//创建人
// private String createBy;
//创建时间
// @TableField(fill = FieldFill.INSERT)
// @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// private Date createTime;
//更新人
// private String updateBy;
//更新时间
// @TableField(fill = FieldFill.INSERT)
// @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// private Date updateTime;
}
package com.zzsn.thinktank.vo;
import lombok.Data;
/**
* @Version 1.0
* @Author: ZhangJingKun
* @Date: 2024/2/29 17:54
* @Content:
*/
@Data
public class ThinktankBasicInfoListVo {
//当前页码,默认值为1
private Integer pageNo = 1;
//分页偏移量 根据 pageNo 和 pageSize 计算得到
private Integer offset;
//每页数量,默认值为10
private Integer pageSize = 10;
//排序字段,多个排序字段用逗号分隔
private String column = "id";
//降序DESC 升序 ASC 默认为DESC
private String order = "DESC";
//关键词
private String keyword;
//智库机构编码
private String codeId;
//智库机构名称
private String thinktankName;
//类别 根据左侧树id
private String typeId;
//标签
private String tagId;
}
package com.zzsn.thinktank.vo;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ThinktankBasicInfoVo extends Model<ThinktankBasicInfoVo> {
//主键
private String id;
//智库机构编码
private String codeId;
//中文全称
private String chineseWhole;
//中文简称
private String chineseSimple;
//英文全称
private String englishWhole;
//英文简称
private String englishSimple;
//原文全称
private String originalWhole;
//原文简称
private String originalSimple;
//官网
private String officialWebsite;
//标签id 多个标签使用逗号分隔
private String tagId;
//标签名称 多个标签使用逗号分隔
private String tagName;
//成立时间
private String establishTime;
//是否收费 1是 0否 默认为空值
private Integer charge;
//国内外
private String countryWithinExternal;
//所属国家/地区 ID
private String belongCountryId;
//所属国家/地区
private String belongCountry;
//所在地区
private String region;
//地址
private String address;
//创办单位/所属单位 企业信用代码
private String belongUnitCode;
//创办单位/所属单位
private String belongUnit;
//机构头像
private String headSculpture;
//简介
private String biographicalNotes;
//属性 区分智库机构、咨询公司、新闻媒体
private String attribute;
//启停状态 1启 0停
private Integer status;
//创建人
private String createBy;
//创建时间
@TableField(fill = FieldFill.INSERT)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//更新人
private String updateBy;
//更新时间
@TableField(fill = FieldFill.INSERT)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
//采集信息总量
private Integer collectionCount;
//绑定信息源个数
private Integer infoSourceCount;
}
server:
port: 9099
servlet:
context-path: /thinktank
spring:
servlet:
multipart:
#单个上传文件大小
max-file-size: 100MB
#总上传文件大小
max-request-size: 1000MB
datasource:
url: jdbc:mysql://114.116.44.11:3306/clb_project?useUnicode=true&characterEncoding=utf-8&AllowPublicKeyRetrieval=True&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true
username: ciglobal
password: qwer@9988&zzsn
redis:
database: 0
host: 114.116.90.53
password: clbzzsn
port: 6380
kafka:
bootstrap-servers: 114.115.159.144:9092
consumer:
group-id: groupName
auto-offset-reset: earliest
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
mybatis-plus:
mapper-locations: mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
#生产es集群
es1:
endpoint1: 114.115.215.250
endpoint1port: 9700
endpoint2: 114.116.19.92
endpoint2port: 9700
endpoint3: 114.116.54.108
endpoint3port: 9200
username: elastic
password: zzsn9988
sys_base_label_type_id: 1783029731298439170
files:
#storage: D:\\thinktank\\
storage: /zzsn/clb/thinktank/
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 -->
<property name="LOG_HOME" value="../clbLogs/thinktank" />
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/thinktank.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/thinktank-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>10</MaxHistory>
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
</encoder>
</appender>
<!--myibatis log configure -->
<logger name="com.apache.ibatis" level="TRACE" />
<logger name="java.sql.Connection" level="DEBUG" />
<logger name="java.sql.Statement" level="DEBUG" />
<logger name="java.sql.PreparedStatement" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
<?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.thinktank.mapper.ThinktankBasicInfoMapper">
<select id="getList" resultType="com.zzsn.thinktank.vo.ThinktankBasicInfoVo">
select
id,code_id,chinese_whole,chinese_simple,english_whole,english_simple,original_whole,original_simple,official_website,tag_id,tag_name,establish_time,charge,country_within_external,belong_country_id,belong_country,region,address,belong_unit_code,belong_unit,head_sculpture,biographical_notes,attribute,status,create_by,create_time,update_by,update_time
from thinktank_basic_info a
where 1 = 1
<if test="codeId != null and codeId != ''">
AND a.code_id = #{codeId}
</if>
<if test="typeId != null and typeId != ''">
AND a.belong_country_id = #{typeId}
</if>
<if test="thinktankName != null and thinktankName != ''">
AND a.chinese_whole like '%${thinktankName}%'
</if>
<if test="tagId != null and tagId != ''">
<foreach item="item" index="index" collection="tagId.split(',')">
AND a.tag_id like '%${item}%'
</foreach>
</if>
<if test="keyword != null and keyword != ''">
AND CONCAT_WS(',',code_id,chinese_whole,chinese_simple,english_whole,english_simple,original_whole,original_simple,official_website,tag_name,country_within_external,belong_country,region,address,belong_unit_code,belong_unit,biographical_notes,attribute)
like '%${keyword}%'
</if>
<if test="order != null and order != ''">
ORDER BY ${column} ${order}
</if>
limit #{offset}, #{pageSize}
</select>
<select id="getCount" resultType="int">
select
count(1)
from thinktank_basic_info a
where 1 = 1
<if test="codeId != null and codeId != ''">
AND a.code_id = #{codeId}
</if>
<if test="typeId != null and typeId != ''">
AND a.belong_country_id = #{typeId}
</if>
<if test="thinktankName != null and thinktankName != ''">
AND a.chinese_whole like '%${thinktankName}%'
</if>
<if test="tagId != null and tagId != ''">
<foreach item="item" index="index" collection="tagId.split(',')">
AND a.tag_id like '%${item}%'
</foreach>
</if>
<if test="keyword != null and keyword != ''">
AND CONCAT_WS(',',code_id,chinese_whole,chinese_simple,english_whole,english_simple,original_whole,original_simple,official_website,tag_name,country_within_external,belong_country,region,address,belong_unit_code,belong_unit,biographical_notes,attribute)
like '%${keyword}%'
</if>
</select>
<select id="getExportList" resultType="com.zzsn.thinktank.vo.ThinktankBasicInfoExportVo">
select
a.id, a.code_id, a.chinese_whole, a.chinese_simple, a.english_whole, a.english_simple, a.original_whole, a.original_simple, a.official_website, a.belong_country, a.tag_name, a.biographical_notes, a.establish_time, a.charge, a.address, a.belong_unit,
c.id as infoSourceId, c.info_source_code, c.web_site_name, c.site_name, c.site_uri
from thinktank_basic_info a
LEFT JOIN thinktank_info_source_group_map b
on a.id = b.group_id
LEFT JOIN info_source c
on b.source_id = c.id
where 1 = 1
<if test="codeId != null and codeId != ''">
AND a.code_id = #{codeId}
</if>
<if test="typeId != null and typeId != ''">
AND a.belong_country_id = #{typeId}
</if>
<if test="thinktankName != null and thinktankName != ''">
AND a.chinese_whole like '%${thinktankName}%'
</if>
<if test="tagId != null and tagId != ''">
<foreach item="item" index="index" collection="tagId.split(',')">
AND a.tag_id like '%${item}%'
</foreach>
</if>
<if test="keyword != null and keyword != ''">
AND CONCAT_WS(',',code_id,chinese_whole,chinese_simple,english_whole,english_simple,original_whole,original_simple,official_website,tag_name,country_within_external,belong_country,region,address,belong_unit_code,belong_unit,biographical_notes,attribute)
like '%${keyword}%'
</if>
<if test="order != null and order != ''">
ORDER BY ${column} ${order}
</if>
</select>
</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.thinktank.mapper.ThinktankTagMapper">
<select id="getTopTag" resultType="com.zzsn.thinktank.entity.ThinktankTagTop">
select *
from thinktank_tag_top
order by count_num desc
limit 10
</select>
<select id="getSysBaseLabelTypeById" resultType="com.zzsn.thinktank.entity.SysBaseLabelType">
select * from sys_base_label_type
where 1=1
and id = #{id}
</select>
<select id="getgetSysBaseLabelTypeListByPid" resultType="com.zzsn.thinktank.entity.SysBaseLabelType">
select * from sys_base_label_type
where 1=1
and pid = #{id}
</select>
<select id="queryCustomLabel" resultType="com.zzsn.thinktank.vo.SysLabelVo">
select b.*, a.label_id as labelTypeId, a.label_type as labelType, c.label_mark as labelMark from sys_base_label_type_map a
inner join label_entity b on a.relation_id = b.id and b.pid = 0
left join sys_base_label_type c on a.label_id = c.id
where 1=1
<if test="ids!=null and ids.size()>0">
and a.label_id in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="name!=null and name != ''">
and b.name like concat('%',#{name},'%')
</if>
order by b.create_time
</select>
<select id="getTagTypeListAll" resultType="com.zzsn.thinktank.vo.SysBaseLabelTypeVo">
select * from sys_base_label_type
where 1=1
and category = 1
</select>
</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.thinktank.mapper.EnterpriseMapper">
<select id="pageList" resultType="com.zzsn.thinktank.entity.SysBaseEnterprise">
select * from sys_base_enterprise
where 1=1
<if test="socialCreditCode != null and socialCreditCode != ''">
and social_credit_code = #{socialCreditCode}
</if>
<if test="name != null and name != ''">
and name like '%${name}%'
</if>
limit ${office},${pageSize}
</select>
<select id="pageListCount" resultType="Integer">
select count(1) from sys_base_enterprise
where 1=1
<if test="socialCreditCode != null and socialCreditCode != ''">
and social_credit_code = #{socialCreditCode}
</if>
<if test="name != null and name != ''">
and name like '%${name}%'
</if>
</select>
<select id="getListByName" resultType="com.zzsn.thinktank.entity.SysBaseEnterprise">
select * from sys_base_enterprise
where 1=1
and name = #{name}
</select>
</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.thinktank.mapper.InfoSourceGroupMapMapper">
<select id="query" resultType="com.zzsn.thinktank.entity.InfoSourceGroupMap">
select * from thinktank_info_source_group_map where source_id = #{sourceId} and group_id = #{groupId}
</select>
<delete id="deleteBySourceId" >
delete from thinktank_info_source_group_map
WHERE source_id = #{sourceId}
</delete>
<delete id="deleteBySourceIds" >
delete from thinktank_info_source_group_map
WHERE group_id = #{groupId}
<if test="sourceIds!=null and sourceIds.size()>0">
and source_id in
<foreach collection="sourceIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</delete>
</mapper>
\ No newline at end of file
package com.zzsn.thinktank;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ThinkTankApplicationTests {
@Test
void contextLoads() {
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论