Merge branch 'develop_master' into develop_3
This commit is contained in:
@@ -36,3 +36,4 @@ target
|
||||
*logs/
|
||||
.metadata
|
||||
|
||||
adc-da-main/src/main/resources/application-zxy.properties
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@FeignClient(value = "bat-wkflow")
|
||||
@FeignClient(value = "bat-wkflow-zqazqazqa")
|
||||
public interface workFlowFeignClient {
|
||||
|
||||
@RequestMapping(value = "/bat-wkflow/activiti_define_start_user",method = RequestMethod.GET)
|
||||
|
||||
@@ -15,7 +15,8 @@ public class ActDefineStartMap {
|
||||
|
||||
Map<String,String> map = new TreeMap<>();
|
||||
map.put("1","standardLibraryWkflow");
|
||||
map.put("2","standardSurveyWorkFlow");
|
||||
|
||||
return map.get(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SpringContextHolder implements ApplicationContextAware {
|
||||
public class SpringContextHolder1 implements ApplicationContextAware {
|
||||
|
||||
|
||||
private static ApplicationContext applicationContext;
|
||||
@@ -37,7 +37,7 @@ import java.util.Map;
|
||||
@Validated
|
||||
@Controller
|
||||
@RequestMapping(value = "/api")
|
||||
@Api(description = "登录接口")
|
||||
@Api(tags = "登录接口")
|
||||
@Slf4j
|
||||
public class LoginRestController {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.adc.da.login.util;
|
||||
|
||||
import com.adc.da.util.SpringContextHolder;
|
||||
import com.adc.da.util.SpringContextHolder1;
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import net.sf.ehcache.Element;
|
||||
@@ -14,7 +14,7 @@ public class CacheUtils {
|
||||
super();
|
||||
}
|
||||
|
||||
private static CacheManager cacheManager = (CacheManager) SpringContextHolder.getBean("ehCacheManagerFactoryBean");
|
||||
private static CacheManager cacheManager = (CacheManager) SpringContextHolder1.getBean("ehCacheManagerFactoryBean");
|
||||
|
||||
private static final String SYS_CACHE = "sysCache";
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.IMenuEOService;
|
||||
import com.adc.da.sys.service.IRoleEOService;
|
||||
import com.adc.da.sys.service.IUserEOService;
|
||||
import com.adc.da.util.SpringContextHolder;
|
||||
import com.adc.da.util.SpringContextHolder1;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -53,17 +53,17 @@ public class UserUtils {
|
||||
/**
|
||||
* @see IUserEOService
|
||||
*/
|
||||
private static IUserEOService userService = SpringContextHolder.getBean(IUserEOService.class);
|
||||
private static IUserEOService userService = SpringContextHolder1.getBean(IUserEOService.class);
|
||||
|
||||
/**
|
||||
* @see IMenuEOService
|
||||
*/
|
||||
private static IMenuEOService menuService = SpringContextHolder.getBean(IMenuEOService.class);
|
||||
private static IMenuEOService menuService = SpringContextHolder1.getBean(IMenuEOService.class);
|
||||
|
||||
/**
|
||||
* @see IRoleEOService
|
||||
*/
|
||||
private static IRoleEOService roleEOService = SpringContextHolder.getBean(IRoleEOService.class);
|
||||
private static IRoleEOService roleEOService = SpringContextHolder1.getBean(IRoleEOService.class);
|
||||
|
||||
/**
|
||||
* 退出
|
||||
|
||||
+10
-6
@@ -60,12 +60,16 @@
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.adc</groupId>-->
|
||||
<!-- <artifactId>adc-da-search</artifactId>-->
|
||||
<!-- <version>3.0.0</version>-->
|
||||
<!-- <scope>compile</scope>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-search</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.adc</groupId>-->
|
||||
<!-- <artifactId>adc-da-gen</artifactId>-->
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.adc.da.main.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@@ -23,6 +25,7 @@ public class RestTemplateConfig {
|
||||
private static final Logger logger = LoggerFactory.getLogger(RestTemplateConfig.class);
|
||||
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
public RestTemplate restTemplate(ClientHttpRequestFactory factory){
|
||||
RestTemplate restTemplate = new RestTemplate(factory);
|
||||
// 使用 utf-8 编码集的 conver 替换默认的 conver(默认的 string conver 的编码集为"ISO-8859-1")
|
||||
|
||||
@@ -22,11 +22,12 @@ public class CodeGen {
|
||||
|
||||
// x.x.x.x:3306/xxxx --MYSQL
|
||||
// 192.168.10.140:1521:foton_slrs_test
|
||||
private static final String DB_IP="101.36.227.22:33050/foton_slrs_test";
|
||||
// foton_slrs_test@101.36.227.22
|
||||
private static final String DB_IP="192.168.10.47/foton_slrs_test";
|
||||
|
||||
private static final String DB_USER="root";
|
||||
|
||||
private static final String DB_PWD="1q2w3e4r";
|
||||
private static final String DB_PWD="root";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,10 +9,14 @@ spring.datasource.password = root
|
||||
|
||||
#==============================================
|
||||
# 应用设置
|
||||
spring.application.name=FotonLAWSSystem
|
||||
spring.application.name=FotonLAWSSystem-zqazqazqa
|
||||
application.code=20200101
|
||||
application.center=1
|
||||
#==============================================
|
||||
#Eruept
|
||||
eureka.client.allow-redirects=false
|
||||
eureka.client.register-with-eureka=false
|
||||
eureka.client.service-url.defaultZone=http://127.0.0.1:8671/eureka/
|
||||
|
||||
#==============================================
|
||||
# 邮箱配置1
|
||||
|
||||
@@ -30,14 +30,17 @@ restPath=/api
|
||||
#server.servlet.context-path=/api
|
||||
|
||||
#是否将自己注册到Eureka Server上,默认为true
|
||||
eureka.client.register-with-eureka=false
|
||||
eureka.client.register-with-eureka=true
|
||||
##是否从Eureka Server上获取注册信息,默认为true
|
||||
eureka.client.fetch-registry=false
|
||||
eureka.client.fetch-registry=true
|
||||
|
||||
|
||||
#eureka.client.service-url.defaultZone=http://10.5.116.172:8672/eureka/
|
||||
#eureka.client.service-url.defaultZone=http://127.0.0.1:8671/eureka/
|
||||
#eureka.client.service-url.defaultZone=http://10.5.116.172:8672/eureka/
|
||||
eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/
|
||||
|
||||
eureka.client.service-url.defaultZone=http://192.168.10.47:8761/eureka/
|
||||
|
||||
# 请求连接的超时时间 默认的时间为 1 秒
|
||||
ribbon.ConnectTimeout=500000
|
||||
# 请求处理的超时时间
|
||||
@@ -139,8 +142,8 @@ upload.file.white.lists = doc,docx,xls,xlsx,pdf,PDF,png,jpg
|
||||
# =============================================================================
|
||||
# elasticsearch 配置
|
||||
# =============================================================================
|
||||
elasticsearch.clustername=laws
|
||||
elasticsearch.ip=localhost
|
||||
elasticsearch.clustername=elasticsearch
|
||||
elasticsearch.ip=192.168.10.47
|
||||
elasticsearch.port=9300
|
||||
elasticsearch.poolSize=5
|
||||
elas.flag=true
|
||||
@@ -0,0 +1,218 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>foton-slrs-system-rest</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>adc-da-search</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<java_source_version>1.7</java_source_version>
|
||||
<java_target_version>1.8</java_target_version>
|
||||
<ehcache.version>2.6.6</ehcache.version>
|
||||
<shiro.version>1.4.0-RC2</shiro.version>
|
||||
<spring.version>4.3.9.RELEASE</spring.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>adc</id>
|
||||
<url>http://60.247.58.121:8182/nexus/content/groups/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>thirdparty</id>
|
||||
<name>Nexus Thirdparty Repository</name>
|
||||
<url>http://60.247.58.121:8182/nexus/content/repositories/thirdparty/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.adc</groupId>-->
|
||||
<!-- <artifactId>adc-da-activiti</artifactId>-->
|
||||
<!-- <version>2.2.02</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-base</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-slrs</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-sys</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-excel</artifactId>
|
||||
<version>2.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- rabbitMQ -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>transport</artifactId>
|
||||
<version>6.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>6.3.2</version>
|
||||
</dependency>
|
||||
<!-- 6.0版本es需添加此依赖,解决依赖冲突 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<!-- 如果要使用内嵌Jetty服务器,需排除tomcat依赖 -->
|
||||
<!--<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>-->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.javacsv</groupId>
|
||||
<artifactId>javacsv</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.opencsv</groupId>
|
||||
<artifactId>opencsv</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mashape.unirest</groupId>
|
||||
<artifactId>unirest-java</artifactId>
|
||||
<version>1.4.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.4</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<groupId>commons-collections</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- easypoi使用到 -->
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-base</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-web</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-annotation</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>commons-lang</groupId> -->
|
||||
<!-- <artifactId>commons-lang</artifactId> -->
|
||||
<!-- </dependency> -->
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<compilerVersion>${java.version}</compilerVersion>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.adc.da.search.config;
|
||||
|
||||
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.transport.client.PreBuiltTransportClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* gaoyan
|
||||
* 2018-08-23
|
||||
* elasticsearch配置config
|
||||
*/
|
||||
@Configuration
|
||||
public class ElasticsearchConfig {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ElasticsearchConfig.class);
|
||||
|
||||
@Autowired
|
||||
private ElasticsearchProperties elasticsearchProperties;
|
||||
|
||||
@Bean
|
||||
public TransportClient client() throws UnknownHostException {
|
||||
TransportClient client = null;
|
||||
try {
|
||||
Settings settings = Settings.builder()
|
||||
.put("client.transport.sniff", true)//增加嗅探机制,找到ES集群
|
||||
.put("thread_pool.search.size", elasticsearchProperties.getPoolSize())//增加线程池个数,暂时设为5
|
||||
.put("cluster.name",elasticsearchProperties.getClustername())
|
||||
.build();
|
||||
client = new PreBuiltTransportClient(settings)
|
||||
.addTransportAddress(new TransportAddress(InetAddress.getByName(elasticsearchProperties.getIp()),elasticsearchProperties.getPort()));
|
||||
} catch (java.net.UnknownHostException e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
/*@After
|
||||
public void tearDown() throws Exception {
|
||||
if (client != null) {
|
||||
client.close();
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.adc.da.search.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "elasticsearch")
|
||||
public class ElasticsearchProperties {
|
||||
private String clustername;
|
||||
private String ip;
|
||||
private Integer port;
|
||||
private Integer poolSize;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
package com.adc.da.search.controller;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.excel.poi.excel.ExcelExportUtil;
|
||||
import com.adc.da.excel.poi.excel.entity.ExportParams;
|
||||
import com.adc.da.excel.poi.excel.entity.enums.ExcelType;
|
||||
import com.adc.da.http.PageInfo;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.search.dto.*;
|
||||
import com.adc.da.search.entity.CommonSearchInfoEO;
|
||||
import com.adc.da.search.entity.SarAdvanceSearchVO;
|
||||
import com.adc.da.search.entity.SeniorSearchInfoEO;
|
||||
import com.adc.da.search.service.ElasticsearchService;
|
||||
import com.adc.da.search.service.SearchCenterService;
|
||||
import com.adc.da.exception.AdcDaBaseException;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.tsDictionaryType.entity.TsSearchMenu;
|
||||
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
|
||||
import com.adc.da.util.IOUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import static com.adc.da.sys.common.ReadExcelName.encodeFileName;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/search/searchCenter")
|
||||
@Api(tags = "|SearchCenter|")
|
||||
public class SearchCenterController extends BaseController<Map<String, Object>> {
|
||||
|
||||
@Autowired
|
||||
private TransportClient client;
|
||||
@Autowired
|
||||
private SearchCenterService searchCenterService;
|
||||
|
||||
@Autowired
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
@Autowired
|
||||
private ElasticsearchService elasticsearchService;
|
||||
|
||||
@Autowired
|
||||
private ITsDicTypeService iTsDictypeService;
|
||||
|
||||
@ApiOperation("获取筛选条件")
|
||||
@PostMapping("/getMenu")
|
||||
public ResponseMessage<List<TsSearchMenu>> getSearchMenu(){
|
||||
return Result.success(iTsDictypeService.getSearchMenu());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param searchInfoEO
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "|SearchCenter|查询")
|
||||
@PostMapping(value="/searchSarBykey")
|
||||
public ResponseMessage<PageInfo<Map<String, Object>>> searchSarBykey(SeniorSearchInfoEO searchInfoEO) throws Exception{
|
||||
List<Map<String, Object>> result;
|
||||
if (StringUtils.isAlphanumericSpace(searchInfoEO.getSelectIndex())) {
|
||||
if(elasticsearchService.isIndexExist(searchInfoEO.getSelectIndex())){
|
||||
if("fulltextserch".equals(searchInfoEO.getSelectIndex()) || "fulltextserch"== searchInfoEO.getSelectIndex()){
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z]+\\s[0-9a-zA-Z\\.\\(\\(\\)\\)\\-\\s]+$");
|
||||
if (null != searchInfoEO.getSelectValue() && StringUtils.isNotBlank(searchInfoEO.getSelectValue())) {
|
||||
if (pattern.matcher(searchInfoEO.getSelectValue()).matches()) {
|
||||
result = searchCenterService.searchSarBykeyAndHighLightNumber(searchInfoEO);
|
||||
}else {
|
||||
result = searchCenterService.searchSarBykeyAndHighLight(searchInfoEO);
|
||||
}
|
||||
} else {
|
||||
result = searchCenterService.searchSarBykeyAndHighLight(searchInfoEO);
|
||||
}
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(result.get(i).get("id").toString());
|
||||
result.get(i).put("collectId", collectId);
|
||||
}
|
||||
return Result.success(getPageInfo(searchInfoEO.getPager(), result));
|
||||
} else {
|
||||
result = searchCenterService.searchSarBykey(searchInfoEO);
|
||||
// 非动态消息的需要查询为我推荐
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(result.get(i).get("id").toString());
|
||||
result.get(i).put("collectId", collectId);
|
||||
result.get(i).put("content", "");
|
||||
result.get(i).put("baseSearchContent", "");
|
||||
}
|
||||
return Result.success(getPageInfo(searchInfoEO.getPager(), result));
|
||||
}
|
||||
} else {
|
||||
return Result.error("未查到相关数据");
|
||||
}
|
||||
} else {
|
||||
return Result.error("数据错误");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("根据多个key去查询")
|
||||
@PostMapping("/searchByKey")
|
||||
public void searchByKey(@RequestBody CommonSearchInfoEO commonSearchInfoEO){
|
||||
searchCenterService.searchByKey(commonSearchInfoEO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "|SearchCenter|查询用于导出数据")
|
||||
@PostMapping(value="/searchIdToImport")
|
||||
public ResponseMessage<String []> searchIdToImport(SeniorSearchInfoEO searchInfoEO){
|
||||
if (StringUtils.isAlphanumericSpace(searchInfoEO.getSelectIndex())) {
|
||||
if(elasticsearchService.isIndexExist(searchInfoEO.getSelectIndex())){
|
||||
String [] result = searchCenterService.searchIdToImport(searchInfoEO);
|
||||
return Result.success(result);
|
||||
}
|
||||
else {
|
||||
return Result.error("未查到相关数据");
|
||||
}
|
||||
} else {
|
||||
return Result.error("数据错误");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SearchCenter|查询")
|
||||
@PostMapping(value="/selectGroupdata")
|
||||
public ResponseMessage<Map<String, Object>> selectGroupdata(SeniorSearchInfoEO searchInfoEO){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = searchCenterService.selectGroupdata(searchInfoEO);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SarLawsInfoEO|导出搜索中心数据")
|
||||
@GetMapping("/exportSearchCenterDatas")
|
||||
public void exportSearchCenterDatas(String exportDatas,String searchType, HttpServletResponse response, HttpServletRequest request) throws Exception{
|
||||
OutputStream os = null;
|
||||
if ("bussstand".equals(searchType)){
|
||||
searchType = "stand";
|
||||
}else if ("enterprise".equals(searchType)){
|
||||
searchType = "bussstand";
|
||||
}
|
||||
Workbook workbook = null;
|
||||
try{
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=" + encodeFileName( "检索结果.xlsx", request));
|
||||
response.setContentType("application/force-download");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
//集合 sarAdvanceSearc 的字符串
|
||||
|
||||
String sarAdvanceSearcString = subString(exportDatas,"[{","}]");
|
||||
if (StringUtils.isNotBlank(sarAdvanceSearcString)){
|
||||
sarAdvanceSearcString = sarAdvanceSearcString.replace("\\\"","\"");
|
||||
}
|
||||
SeniorSearchInfoEO searchInfoEO = null;
|
||||
if (!"none".equals(sarAdvanceSearcString)) {
|
||||
exportDatas = exportDatas.replace("[{" + sarAdvanceSearcString + "}]", "");
|
||||
JSONObject jsonObject = JSONObject.parseObject(exportDatas);
|
||||
List<String> sarAdvanceSearchVO = new ArrayList<>(Arrays.asList(sarAdvanceSearcString.split("},")));
|
||||
List<SarAdvanceSearchVO> advanceSearchVOList = new ArrayList<>();
|
||||
int flag = 0;
|
||||
for (String sarAdvanceSearch : sarAdvanceSearchVO) {
|
||||
JSONObject jsonObjectSAS = null;
|
||||
if (flag == 0) {
|
||||
jsonObjectSAS = JSONObject.parseObject("{" + sarAdvanceSearch + "}");
|
||||
} else {
|
||||
jsonObjectSAS = JSONObject.parseObject(sarAdvanceSearch + "}");
|
||||
}
|
||||
SarAdvanceSearchVO sarAdvanceSearchEO = JSONObject.toJavaObject(jsonObjectSAS, SarAdvanceSearchVO.class);
|
||||
advanceSearchVOList.add(sarAdvanceSearchEO);
|
||||
flag++;
|
||||
}
|
||||
searchInfoEO = JSONObject.toJavaObject(jsonObject, SeniorSearchInfoEO.class);
|
||||
searchInfoEO.setAdvanceSearchVOList(advanceSearchVOList);
|
||||
}else {
|
||||
JSONObject jsonObject=JSONObject.parseObject(exportDatas);
|
||||
searchInfoEO = JSONObject.toJavaObject(jsonObject, SeniorSearchInfoEO.class);
|
||||
}
|
||||
if ("INLAND_STAND".equals(searchType)) {
|
||||
searchType = "stand"; //guonei
|
||||
}else if ("INLAND_LAWS".equals(searchType)) {
|
||||
searchType = "laws"; //zhengce
|
||||
}else if ("BUSINESS_STAND".equals(searchType)) {
|
||||
searchType = "bussstand"; //enterprise
|
||||
}else if ("DYNAMIC_INFORMATION".equals(searchType)) {
|
||||
searchType = "msgdyinfo";
|
||||
}else if ("items".equals(searchType)) {
|
||||
searchType = "items";
|
||||
}
|
||||
searchInfoEO.setSelectIndex(searchType);
|
||||
searchInfoEO.setSelectValue(searchInfoEO.getKeywords());
|
||||
//存放需要导出的数据
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
result = searchCenterService.searchSarBykey(searchInfoEO);
|
||||
if("stand".equals(searchType)){
|
||||
List<SearchStandExportDto> dtoDatas = new ArrayList<>();
|
||||
for(int i=0;i<result.size();i++){
|
||||
SearchStandExportDto exportDto = new SearchStandExportDto();
|
||||
String numbershow = String.valueOf(result.get(i).get("numbershow"));
|
||||
exportDto.setNumbershow(numbershow);
|
||||
String nameshow = String.valueOf( result.get(i).get("nameshow"));
|
||||
exportDto.setNameshow(nameshow);
|
||||
String issueTime = String.valueOf(result.get(i).get("issue_time"));
|
||||
exportDto.setIssueTime(issueTime);
|
||||
// String putTime = changeDate(result.get(i).get("put_time"));
|
||||
// exportDto.setPutTime(putTime);
|
||||
exportDto.setStandstateshow(String.valueOf(result.get(i).get("standstateshow")));
|
||||
dtoDatas.add(exportDto);
|
||||
}
|
||||
//导出数据到Excel
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, SearchStandExportDto.class, dtoDatas);
|
||||
} else if("laws".equals(searchType)){
|
||||
List<SearchLawsExportDto> dtoDatas = new ArrayList<>();
|
||||
for(int i=0;i<result.size();i++){
|
||||
SearchLawsExportDto exportDto = new SearchLawsExportDto();
|
||||
String numbershow = String.valueOf(result.get(i).get("numbershow"));
|
||||
exportDto.setNumbershow(numbershow);
|
||||
String nameshow = String.valueOf(result.get(i).get("nameshow"));
|
||||
exportDto.setNameshow(nameshow);
|
||||
String issueTime = String.valueOf(result.get(i).get("issue_time"));
|
||||
exportDto.setIssueTime(issueTime);
|
||||
// String putTime = changeDate(result.get(i).get("put_time"));
|
||||
// exportDto.setPutTime(putTime);
|
||||
exportDto.setStandstateshow(String.valueOf(result.get(i).get("standstateshow")));
|
||||
dtoDatas.add(exportDto);
|
||||
}
|
||||
//导出数据到Excel
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, SearchLawsExportDto.class, dtoDatas);
|
||||
} else if("bussstand".equals(searchType)){
|
||||
List<SearchBussExportDto> dtoDatas = new ArrayList<>();
|
||||
for(int i=0;i<result.size();i++){
|
||||
SearchBussExportDto exportDto = new SearchBussExportDto();
|
||||
String numbershow = String.valueOf(result.get(i).get("numbershow"));
|
||||
exportDto.setNumbershow(numbershow);
|
||||
String nameshow = String.valueOf(result.get(i).get("nameshow"));
|
||||
exportDto.setNameshow(nameshow);
|
||||
if (StringUtils.isNotBlank(String.valueOf(result.get(i).get("issue_time"))) && !"null".equals(String.valueOf(result.get(i).get("issue_time")))) {
|
||||
String issueTime = "";
|
||||
try {
|
||||
issueTime = changeDate(String.valueOf(result.get(i).get("issue_time")));
|
||||
}catch (Exception ignored){
|
||||
issueTime = "";
|
||||
}
|
||||
exportDto.setIssueTime(issueTime);
|
||||
}else {
|
||||
exportDto.setIssueTime("");
|
||||
}
|
||||
// String putTime = changeDate(result.get(i).get("put_time"));
|
||||
// exportDto.setPutTime(putTime);
|
||||
exportDto.setStandstateshow((String) result.get(i).get("standstateshow"));
|
||||
dtoDatas.add(exportDto);
|
||||
}
|
||||
//导出数据到Excel
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, SearchBussExportDto.class, dtoDatas);
|
||||
// } else if("items".equals(searchType)){
|
||||
// List<SearchItemsExportDto> dtoDatas = new ArrayList<>();
|
||||
// for(int i=0;i<result.size();i++){
|
||||
// SearchItemsExportDto exportDto = new SearchItemsExportDto();
|
||||
// String newcarPutTime = changeDate(String.valueOf(result.get(i).get("newcarPutTime")));
|
||||
// exportDto.setNewcarPutTime(newcarPutTime);
|
||||
// String productPutTime = changeDate(String.valueOf(result.get(i).get("productPutTime")));
|
||||
// exportDto.setProductPutTime(productPutTime);
|
||||
// exportDto.setApplyArcticShow(String.valueOf(result.get(i).get("applyArcticShow")));
|
||||
// exportDto.setItemsName(String.valueOf(result.get(i).get("itemsName")));
|
||||
// exportDto.setItemsNum(String.valueOf(result.get(i).get("itemsNum")));
|
||||
// exportDto.setParts(String.valueOf(result.get(i).get("parts")));
|
||||
// dtoDatas.add(exportDto);
|
||||
// }
|
||||
//导出数据到Excel
|
||||
// workbook = ExcelExportUtil.exportExcel(exportParams, SearchItemsExportDto.class, dtoDatas);
|
||||
} else {
|
||||
List<SearchMsgExportDto> dtoDatas = new ArrayList<>();
|
||||
for(int i=0;i<result.size();i++){
|
||||
SearchMsgExportDto exportDto = new SearchMsgExportDto();
|
||||
exportDto.setModuleName(String.valueOf(result.get(i).get("moduleName")));
|
||||
exportDto.setTitle((String) result.get(i).get("title"));
|
||||
String issueTime = changeDate(String.valueOf(result.get(i).get("issue_time")));
|
||||
exportDto.setIssueTime(issueTime);
|
||||
dtoDatas.add(exportDto);
|
||||
}
|
||||
//导出数据到Excel
|
||||
workbook = com.adc.da.excel.poi.excel.ExcelExportUtil.exportExcel(exportParams, SearchMsgExportDto.class, dtoDatas);
|
||||
}
|
||||
|
||||
os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
os.flush();
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
|
||||
throw new AdcDaBaseException("导出失败,请重试");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
if (workbook != null) {
|
||||
workbook.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String changeDate (Object obj) throws Exception {
|
||||
String dateStr = "";
|
||||
if (obj != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date issueDate = dateFormat.parse((String) obj);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(issueDate);
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
issueDate = calendar.getTime();
|
||||
if (issueDate != null) {
|
||||
dateStr = dateFormat.format(issueDate);
|
||||
}
|
||||
}
|
||||
return dateStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串str中指定字符 strStart、strEnd之间的字符串
|
||||
*
|
||||
* @param str
|
||||
* @param strStart
|
||||
* @param strEnd
|
||||
* @return
|
||||
*/
|
||||
public static String subString(String str, String strStart, String strEnd) {
|
||||
|
||||
/* 找出指定的2个字符在 该字符串里面的 位置 */
|
||||
int strStartIndex = str.indexOf(strStart);
|
||||
int strEndIndex = str.indexOf(strEnd);
|
||||
if (strStartIndex < 0 || strEndIndex < 0) {
|
||||
return "none";
|
||||
}
|
||||
/* 开始截取 */
|
||||
String result = str.substring(strStartIndex, strEndIndex).substring(strStart.length());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package com.adc.da.search.controller;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.search.service.ElasticsearchService;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/search/standLawsSearch")
|
||||
@Api(tags = "|StandLawsSearch|")
|
||||
public class StandLawsSearchController extends BaseController<Map<String, Object>> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StandLawsSearchController.class);
|
||||
|
||||
@Autowired
|
||||
private ElasticsearchService elasticsearchService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "|BussnessStand|创建索引")
|
||||
@PostMapping(value="/createBussstandIndex")
|
||||
public ResponseMessage createBussstandIndex(){
|
||||
XContentBuilder mapping = null;
|
||||
try {
|
||||
mapping = XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
.startObject("properties") //设置之定义字段
|
||||
.startObject("apply_arctic")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("applyarcticshow")
|
||||
.field("type","text")
|
||||
.endObject()
|
||||
.startObject("energy_kind")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("id")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("issue_time")
|
||||
.field("type","date") //设置Date类型
|
||||
// .field("format","yyyy-MM-dd HH:mm:ss") //设置Date的格式
|
||||
.endObject()
|
||||
.startObject("nameshow")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("numbershow")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("put_time")
|
||||
.field("type","date") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("replace_stand_num")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("replaced_stand_num")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("standstateshow")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("statecode")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("type")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("valid_flag")
|
||||
.field("type","long") //设置数据类型
|
||||
.endObject()
|
||||
.startObject("content")
|
||||
.field("type","text") //设置数据类型
|
||||
.endObject()
|
||||
.endObject()
|
||||
.endObject();
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
boolean restule = elasticsearchService.createIndex("newbussstand",mapping);
|
||||
if (restule) {
|
||||
return Result.success("创建成功");
|
||||
} else {
|
||||
return Result.error("数据错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.adc.da.search.controller;
|
||||
|
||||
import com.adc.da.search.entity.PartProductEO;
|
||||
import com.adc.da.search.service.ElasticsearchService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.SearchType;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.RangeQueryBuilder;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.adc.da.search.util.ElasticsearchConstant.SUCCESS_DELETED;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}")
|
||||
@Api(tags = "|testElasticsearch|")
|
||||
public class TestController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
|
||||
|
||||
@Autowired
|
||||
private TransportClient client;
|
||||
@Autowired
|
||||
private ElasticsearchService elasticsearchService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("add/book/novel")
|
||||
@ResponseBody
|
||||
public ResponseEntity add(@RequestParam(name ="title") String title,
|
||||
@RequestParam(name ="author") String author,
|
||||
@RequestParam(name ="word_count") String wordCount,
|
||||
@RequestParam(name ="publish_date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date publishDate){
|
||||
try {
|
||||
XContentBuilder content =XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
.field("title",title)
|
||||
.field("author",author)
|
||||
.field("word_count",wordCount)
|
||||
.field("publish_date",publishDate.getTime())
|
||||
.endObject();
|
||||
IndexResponse result = this.client.prepareIndex("book","novel").setSource(content).get();
|
||||
return new ResponseEntity(result.getId(),HttpStatus.OK);
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@DeleteMapping("deleteOneDucumentTest")
|
||||
@ResponseBody
|
||||
public ResponseEntity delete(@RequestParam(name="id") String id) {
|
||||
String response = elasticsearchService.deleteDataById("book","novel",id);
|
||||
if(response.equals(SUCCESS_DELETED)){
|
||||
return new ResponseEntity(response, HttpStatus.OK);
|
||||
}
|
||||
else {
|
||||
return new ResponseEntity(response, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("query/book/novel")
|
||||
@ResponseBody
|
||||
public ResponseEntity query(
|
||||
@RequestParam(name="title",required = false) String title,
|
||||
@RequestParam(name="author",required = false) String author,
|
||||
@RequestParam(name="gt_word_count",defaultValue = "0",required = false) int gtWordCount,
|
||||
@RequestParam(name="lt_word_count",required = false) Integer ltWordCount
|
||||
){
|
||||
BoolQueryBuilder boolQueryBuilder =QueryBuilders.boolQuery();
|
||||
if(author!=null){
|
||||
boolQueryBuilder.must(QueryBuilders.matchQuery("author",author));
|
||||
}
|
||||
if(title!=null){
|
||||
boolQueryBuilder.must(QueryBuilders.matchQuery("title",title));
|
||||
}
|
||||
RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery("word_count").from(gtWordCount);
|
||||
|
||||
if(ltWordCount!=null && ltWordCount>0 ){
|
||||
rangeQueryBuilder.to(ltWordCount);
|
||||
}
|
||||
boolQueryBuilder.filter(rangeQueryBuilder);
|
||||
SearchRequestBuilder searchRequestBuilder =this.client.prepareSearch("book")
|
||||
.setTypes("novel")
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.setQuery(boolQueryBuilder)
|
||||
.setFrom(0)
|
||||
.setSize(10);
|
||||
System.out.println(searchRequestBuilder);
|
||||
SearchResponse response =searchRequestBuilder.get();
|
||||
List<Map<String ,Object>> result = new ArrayList<Map<String ,Object>>();
|
||||
for (SearchHit hit:response.getHits()){
|
||||
result.add(hit.getSourceAsMap());
|
||||
}
|
||||
return new ResponseEntity(result,HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("addIndexSerTest")
|
||||
@ResponseBody
|
||||
public String searchIndexTest() {
|
||||
PartProductEO productEO= new PartProductEO();
|
||||
productEO.setCertNumber("er");
|
||||
productEO.setCorpId("cid");
|
||||
productEO.setCorpModel("cmodel");
|
||||
String indexstate = elasticsearchService.addData((JSONObject) JSON.toJSON(productEO),"testone","two");
|
||||
return indexstate;
|
||||
}
|
||||
|
||||
@PostMapping("bulktest")
|
||||
@ResponseBody
|
||||
public String bulkTest() throws IOException {
|
||||
List<JSONObject> list = new ArrayList<JSONObject>();
|
||||
for(int i=0;i<100000;i++){
|
||||
PartProductEO productEO= new PartProductEO();
|
||||
productEO.setCertNumber("er"+i);
|
||||
productEO.setCorpId("cid"+i);
|
||||
productEO.setCorpModel("cmodel"+i);
|
||||
list.add(JSONObject.parseObject(JSONObject.toJSON(productEO).toString()));
|
||||
}
|
||||
String indexstate = elasticsearchService.addBulkData("ymq_index","two",list);
|
||||
return indexstate;
|
||||
}
|
||||
|
||||
@PostMapping("justtest")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> justtest() throws IOException {
|
||||
String [] index={"bank","book"};
|
||||
String [] type={"_doc","_type"};
|
||||
String [] fields={"account_number", "balance"};
|
||||
List<Map<String, Object>> indexstate = elasticsearchService.searchListDataGroupComplex(index,type);
|
||||
return indexstate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.adc.da.search.dto;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
|
||||
public class SearchBussExportDto {
|
||||
|
||||
@Excel(name = "企业标准号", orderNum = "1",width = 12)
|
||||
private String numbershow;
|
||||
|
||||
@Excel(name = "企业标准名称", orderNum = "1",width = 14)
|
||||
private String nameshow;
|
||||
|
||||
@Excel(name = "发布日期", orderNum = "1",width = 10)
|
||||
private String issueTime;
|
||||
|
||||
// @Excel(name = "实施日期", orderNum = "1",width = 10)
|
||||
private String putTime;
|
||||
|
||||
@Excel(name = "企业标准状态", orderNum = "1",width = 14)
|
||||
private String standstateshow;
|
||||
|
||||
public String getNumbershow() {
|
||||
return numbershow;
|
||||
}
|
||||
|
||||
public void setNumbershow(String numbershow) {
|
||||
this.numbershow = numbershow;
|
||||
}
|
||||
|
||||
public String getNameshow() {
|
||||
return nameshow;
|
||||
}
|
||||
|
||||
public void setNameshow(String nameshow) {
|
||||
this.nameshow = nameshow;
|
||||
}
|
||||
|
||||
public String getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
public void setIssueTime(String issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
public String getPutTime() {
|
||||
return putTime;
|
||||
}
|
||||
|
||||
public void setPutTime(String putTime) {
|
||||
this.putTime = putTime;
|
||||
}
|
||||
|
||||
public String getStandstateshow() {
|
||||
return standstateshow;
|
||||
}
|
||||
|
||||
public void setStandstateshow(String standstateshow) {
|
||||
this.standstateshow = standstateshow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.adc.da.search.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
public class SearchItemsExportDto {
|
||||
|
||||
@Excel(name = "条款号",width = 16)
|
||||
private String itemsNum;
|
||||
|
||||
@Excel(name = "条款名称",width = 16)
|
||||
private String itemsName;
|
||||
|
||||
@Excel(name = "新车型实施日期",width = 16)
|
||||
private String newcarPutTime;
|
||||
|
||||
@Excel(name = "在产车实施日期",width = 16)
|
||||
private String productPutTime;
|
||||
|
||||
@Excel(name = "关联零部件",width = 16)
|
||||
private String parts;
|
||||
|
||||
@Excel(name = "适用车型",width = 16)
|
||||
private String applyArcticShow;
|
||||
|
||||
public String getItemsNum() {
|
||||
return itemsNum;
|
||||
}
|
||||
|
||||
public void setItemsNum(String itemsNum) {
|
||||
this.itemsNum = itemsNum;
|
||||
}
|
||||
|
||||
public String getItemsName() {
|
||||
return itemsName;
|
||||
}
|
||||
|
||||
public void setItemsName(String itemsName) {
|
||||
this.itemsName = itemsName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getParts() {
|
||||
return parts;
|
||||
}
|
||||
|
||||
public void setParts(String parts) {
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
public String getNewcarPutTime() {
|
||||
return newcarPutTime;
|
||||
}
|
||||
|
||||
public void setNewcarPutTime(String newcarPutTime) {
|
||||
this.newcarPutTime = newcarPutTime;
|
||||
}
|
||||
|
||||
public String getProductPutTime() {
|
||||
return productPutTime;
|
||||
}
|
||||
|
||||
public void setProductPutTime(String productPutTime) {
|
||||
this.productPutTime = productPutTime;
|
||||
}
|
||||
|
||||
public String getApplyArcticShow() {
|
||||
return applyArcticShow;
|
||||
}
|
||||
|
||||
public void setApplyArcticShow(String applyArcticShow) {
|
||||
this.applyArcticShow = applyArcticShow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.adc.da.search.dto;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
|
||||
public class SearchLawsExportDto {
|
||||
|
||||
@Excel(name = "文件号", orderNum = "1",width = 10)
|
||||
private String numbershow;
|
||||
|
||||
@Excel(name = "文件名称", orderNum = "1",width = 10)
|
||||
private String nameshow;
|
||||
|
||||
@Excel(name = "发布日期", orderNum = "1",width = 10)
|
||||
private String issueTime;
|
||||
|
||||
// @Excel(name = "实施日期", orderNum = "1",width = 10)
|
||||
// private String putTime;
|
||||
|
||||
@Excel(name = "文件状态", orderNum = "1",width = 10)
|
||||
private String standstateshow;
|
||||
|
||||
public String getNumbershow() {
|
||||
return numbershow;
|
||||
}
|
||||
|
||||
public void setNumbershow(String numbershow) {
|
||||
this.numbershow = numbershow;
|
||||
}
|
||||
|
||||
public String getNameshow() {
|
||||
return nameshow;
|
||||
}
|
||||
|
||||
public void setNameshow(String nameshow) {
|
||||
this.nameshow = nameshow;
|
||||
}
|
||||
|
||||
public String getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
public void setIssueTime(String issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
// public String getPutTime() {
|
||||
// return putTime;
|
||||
// }
|
||||
|
||||
// public void setPutTime(String putTime) {
|
||||
// this.putTime = putTime;
|
||||
// }
|
||||
//
|
||||
public String getStandstateshow() {
|
||||
return standstateshow;
|
||||
}
|
||||
|
||||
public void setStandstateshow(String standstateshow) {
|
||||
this.standstateshow = standstateshow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.adc.da.search.dto;
|
||||
|
||||
import com.adc.da.excel.annotation.Excel;
|
||||
|
||||
public class SearchMsgExportDto {
|
||||
|
||||
@Excel(name = "所属模块", orderNum = "1",width = 10)
|
||||
private String moduleName;
|
||||
|
||||
@Excel(name = "动态标题", orderNum = "1",width = 10)
|
||||
private String title;
|
||||
|
||||
@Excel(name = "发布日期", orderNum = "1",width = 10)
|
||||
private String issueTime;
|
||||
|
||||
public String getModuleName() {
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
public void setIssueTime(String issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.adc.da.search.dto;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
|
||||
public class SearchStandExportDto {
|
||||
|
||||
@Excel(name = "标准号", orderNum = "1",width = 10)
|
||||
private String numbershow;
|
||||
|
||||
@Excel(name = "标准名称", orderNum = "1",width = 10)
|
||||
private String nameshow;
|
||||
|
||||
@Excel(name = "发布日期", orderNum = "1",width = 10)
|
||||
private String issueTime;
|
||||
|
||||
// @Excel(name = "实施日期", orderNum = "1",width = 10)
|
||||
private String putTime;
|
||||
|
||||
@Excel(name = "标准状态", orderNum = "1",width = 10)
|
||||
private String standstateshow;
|
||||
|
||||
public String getNumbershow() {
|
||||
return numbershow;
|
||||
}
|
||||
|
||||
public void setNumbershow(String numbershow) {
|
||||
this.numbershow = numbershow;
|
||||
}
|
||||
|
||||
public String getNameshow() {
|
||||
return nameshow;
|
||||
}
|
||||
|
||||
public void setNameshow(String nameshow) {
|
||||
this.nameshow = nameshow;
|
||||
}
|
||||
|
||||
public String getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
public void setIssueTime(String issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
public String getPutTime() {
|
||||
return putTime;
|
||||
}
|
||||
|
||||
public void setPutTime(String putTime) {
|
||||
this.putTime = putTime;
|
||||
}
|
||||
|
||||
public String getStandstateshow() {
|
||||
return standstateshow;
|
||||
}
|
||||
|
||||
public void setStandstateshow(String standstateshow) {
|
||||
this.standstateshow = standstateshow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BasicSearchEntity {
|
||||
private String key;
|
||||
private String sign;
|
||||
private String value;
|
||||
private List<String> values;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CommonSearchInfoEO {
|
||||
|
||||
private List<BasicSearchEntity> searchEntities;
|
||||
|
||||
private String searchType;
|
||||
|
||||
private String searchIndex;
|
||||
|
||||
private String searchBox;
|
||||
|
||||
private Integer currents;
|
||||
|
||||
private Integer size;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class EsPage {
|
||||
// 指定的或是页面参数
|
||||
private int currentPage; // 当前页
|
||||
private int pageSize; // 每页显示多少条
|
||||
|
||||
// 查询es结果
|
||||
private int recordCount; // 总记录数
|
||||
private List<Map<String, Object>> recordList; // 本页的数据列表
|
||||
|
||||
// 计算
|
||||
private int pageCount; // 总页数
|
||||
private int beginPageIndex; // 页码列表的开始索引(包含)
|
||||
private int endPageIndex; // 页码列表的结束索引(包含)
|
||||
|
||||
/**
|
||||
* 只接受前4个必要的属性,会自动的计算出其他3个属性的值
|
||||
*
|
||||
* @param currentPage
|
||||
* @param pageSize
|
||||
* @param recordCount
|
||||
* @param recordList
|
||||
*/
|
||||
public EsPage(int currentPage, int pageSize, int recordCount, List<Map<String, Object>> recordList) {
|
||||
this.currentPage = currentPage;
|
||||
this.pageSize = pageSize;
|
||||
this.recordCount = recordCount;
|
||||
this.recordList = recordList;
|
||||
|
||||
// 计算总页码
|
||||
pageCount = (recordCount + pageSize - 1) / pageSize;
|
||||
|
||||
// 计算 beginPageIndex 和 endPageIndex
|
||||
// >> 总页数不多于10页,则全部显示
|
||||
if (pageCount <= 10) {
|
||||
beginPageIndex = 1;
|
||||
endPageIndex = pageCount;
|
||||
}
|
||||
// >> 总页数多于10页,则显示当前页附近的共10个页码
|
||||
else {
|
||||
// 当前页附近的共10个页码(前4个 + 当前页 + 后5个)
|
||||
beginPageIndex = currentPage - 4;
|
||||
endPageIndex = currentPage + 5;
|
||||
// 当前面的页码不足4个时,则显示前10个页码
|
||||
if (beginPageIndex < 1) {
|
||||
beginPageIndex = 1;
|
||||
endPageIndex = 10;
|
||||
}
|
||||
// 当后面的页码不足5个时,则显示后10个页码
|
||||
if (endPageIndex > pageCount) {
|
||||
endPageIndex = pageCount;
|
||||
beginPageIndex = pageCount - 10 + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getCurrentPage() {
|
||||
return currentPage;
|
||||
}
|
||||
|
||||
public void setCurrentPage(int currentPage) {
|
||||
this.currentPage = currentPage;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getRecordCount() {
|
||||
return recordCount;
|
||||
}
|
||||
|
||||
public void setRecordCount(int recordCount) {
|
||||
this.recordCount = recordCount;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getRecordList() {
|
||||
return recordList;
|
||||
}
|
||||
|
||||
public void setRecordList(List<Map<String, Object>> recordList) {
|
||||
this.recordList = recordList;
|
||||
}
|
||||
|
||||
public int getPageCount() {
|
||||
return pageCount;
|
||||
}
|
||||
|
||||
public void setPageCount(int pageCount) {
|
||||
this.pageCount = pageCount;
|
||||
}
|
||||
|
||||
public int getBeginPageIndex() {
|
||||
return beginPageIndex;
|
||||
}
|
||||
|
||||
public void setBeginPageIndex(int beginPageIndex) {
|
||||
this.beginPageIndex = beginPageIndex;
|
||||
}
|
||||
|
||||
public int getEndPageIndex() {
|
||||
return endPageIndex;
|
||||
}
|
||||
|
||||
public void setEndPageIndex(int endPageIndex) {
|
||||
this.endPageIndex = endPageIndex;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FullTextSearchEO extends BaseEntity {
|
||||
|
||||
private String id;
|
||||
private String indexType;
|
||||
private String title;
|
||||
private String textContent;
|
||||
private Date issue_time;
|
||||
private String issueTimeStr;
|
||||
private Date put_time;
|
||||
private String putTimeStr;
|
||||
|
||||
private String itemsType;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIndexType() {
|
||||
return indexType;
|
||||
}
|
||||
|
||||
public void setIndexType(String indexType) {
|
||||
this.indexType = indexType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTextContent() {
|
||||
return textContent;
|
||||
}
|
||||
|
||||
public void setTextContent(String textContent) {
|
||||
this.textContent = textContent;
|
||||
}
|
||||
|
||||
public Date getIssue_time() {
|
||||
return issue_time;
|
||||
}
|
||||
|
||||
public void setIssue_time(Date issue_time) {
|
||||
this.issue_time = issue_time;
|
||||
}
|
||||
|
||||
public String getIssueTimeStr() {
|
||||
return issueTimeStr;
|
||||
}
|
||||
|
||||
public void setIssueTimeStr(String issueTimeStr) {
|
||||
this.issueTimeStr = issueTimeStr;
|
||||
}
|
||||
|
||||
public Date getPut_time() {
|
||||
return put_time;
|
||||
}
|
||||
|
||||
public void setPut_time(Date put_time) {
|
||||
this.put_time = put_time;
|
||||
}
|
||||
|
||||
public String getPutTimeStr() {
|
||||
return putTimeStr;
|
||||
}
|
||||
|
||||
public void setPutTimeStr(String putTimeStr) {
|
||||
this.putTimeStr = putTimeStr;
|
||||
}
|
||||
|
||||
public String getItemsType() {
|
||||
return itemsType;
|
||||
}
|
||||
|
||||
public void setItemsType(String itemsType) {
|
||||
this.itemsType = itemsType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>PART_PRODUCT PartProductEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2018-08-22 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class PartProductEO extends BaseEntity {
|
||||
|
||||
private String corpId;
|
||||
private String certNumber;
|
||||
private String corpModel;
|
||||
public void setCorpId(String corpId) {
|
||||
this.corpId = corpId;
|
||||
}
|
||||
public void setCertNumber(String certNumber) {
|
||||
this.certNumber = certNumber;
|
||||
}
|
||||
public void setCorpModel(String corpModel) {
|
||||
this.corpModel = corpModel;
|
||||
}
|
||||
|
||||
public String getCorpId() {
|
||||
return corpId;
|
||||
}
|
||||
|
||||
public String getCertNumber() {
|
||||
return certNumber;
|
||||
}
|
||||
|
||||
public String getCorpModel() {
|
||||
return corpModel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
/**
|
||||
* @Description: 标准法规库高级查询
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/12/11 9:22
|
||||
*/
|
||||
public class SarAdvanceSearchVO {
|
||||
|
||||
private String field; //字段 如 标准类别
|
||||
|
||||
private String value; //值
|
||||
|
||||
private String type; //查询类型 如 = != like
|
||||
|
||||
private String connect; //连接符号 如 and or
|
||||
|
||||
private String timeSt;
|
||||
|
||||
private String timeEd;
|
||||
|
||||
public String getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(String field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getConnect() {
|
||||
return connect;
|
||||
}
|
||||
|
||||
public void setConnect(String connect) {
|
||||
this.connect = connect;
|
||||
}
|
||||
|
||||
public String getTimeSt() {
|
||||
return timeSt;
|
||||
}
|
||||
|
||||
public void setTimeSt(String timeSt) {
|
||||
this.timeSt = timeSt;
|
||||
}
|
||||
|
||||
public String getTimeEd() {
|
||||
return timeEd;
|
||||
}
|
||||
|
||||
public void setTimeEd(String timeEd) {
|
||||
this.timeEd = timeEd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,548 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import com.adc.da.att.vo.AttFileVo;
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_BUSSIONESS_STAND SarBussionessStandEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2018-09-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class SarBussionessStandEO extends BaseEntity {
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
private Integer validFlag;
|
||||
private String putUser;
|
||||
private String citationUser;
|
||||
private String responsibleUnit;
|
||||
private String standFile;
|
||||
private String tags;
|
||||
private String standStatus;
|
||||
private String replacedStandNum;
|
||||
private String replaceStandNum;
|
||||
private String quoteStand;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date firstPutTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date putYear;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date putTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date issueTime;
|
||||
private String energyKind;
|
||||
private String applyArctic;
|
||||
private String standEnName;
|
||||
private String standName;
|
||||
//标准编码
|
||||
private String standCode;
|
||||
//分类代号
|
||||
private String classifyCode;
|
||||
private String standSubclass;
|
||||
private String standGenera;
|
||||
private String id;
|
||||
|
||||
//目录ID 非标准信息表中的字段
|
||||
private String menuId;
|
||||
private String menuParentId;
|
||||
private String standStatusShow; // 标准状态下拉框 --单选
|
||||
private String applyArcticShow; // 适用车型下拉框 --多选
|
||||
private String energyKindShow; // 能源种类下拉框 --多选
|
||||
private String standGeneraShow;
|
||||
private String standSubclassShow;
|
||||
private String responsibleUnitShow;
|
||||
private List<AttFileVo> standFileList = new ArrayList<AttFileVo>();
|
||||
|
||||
private String collectId;
|
||||
|
||||
//文件的下载id
|
||||
private String attId;
|
||||
public String getAttId() {
|
||||
return attId;
|
||||
}
|
||||
|
||||
public void setAttId(String attId) {
|
||||
this.attId = attId;
|
||||
}
|
||||
|
||||
//记录是否修改了替代文件号
|
||||
private int upReplaceNumFlag;
|
||||
//记录是否修改了文件号
|
||||
private int upNumFlag;
|
||||
|
||||
/**
|
||||
* java字段名转换为原始数据库列名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>modifyTime -> modify_time</li>
|
||||
* <li>creationTime -> creation_time</li>
|
||||
* <li>validFlag -> valid_flag</li>
|
||||
* <li>putUser -> put_user</li>
|
||||
* <li>citationUser -> citation_user</li>
|
||||
* <li>responsibleUnit -> responsible_unit</li>
|
||||
* <li>standFile -> stand_file</li>
|
||||
* <li>tags -> tags</li>
|
||||
* <li>standStatus -> stand_status</li>
|
||||
* <li>replacedStandNum -> replaced_stand_num</li>
|
||||
* <li>replaceStandNum -> replace_stand_num</li>
|
||||
* <li>quoteStand -> quote_stand</li>
|
||||
* <li>firstPutTime -> first_put_time</li>
|
||||
* <li>putYear -> put_year</li>
|
||||
* <li>putTime -> put_time</li>
|
||||
* <li>issueTime -> issue_time</li>
|
||||
* <li>energyKind -> energy_kind</li>
|
||||
* <li>applyArctic -> apply_arctic</li>
|
||||
* <li>standEnName -> stand_en_name</li>
|
||||
* <li>standName -> stand_name</li>
|
||||
* <li>standCode -> stand_code</li>
|
||||
* <li>classifyCode -> classify_code</li>
|
||||
* <li>standSubclass -> stand_subclass</li>
|
||||
* <li>standGenera -> stand_genera</li>
|
||||
* <li>id -> id</li>
|
||||
*/
|
||||
public static String fieldToColumn(String fieldName) {
|
||||
if (fieldName == null){ return null;}
|
||||
switch (fieldName) {
|
||||
case "modifyTime": return "modify_time";
|
||||
case "creationTime": return "creation_time";
|
||||
case "validFlag": return "valid_flag";
|
||||
case "putUser": return "put_user";
|
||||
case "citationUser": return "citation_user";
|
||||
case "responsibleUnit": return "responsible_unit";
|
||||
case "standFile": return "stand_file";
|
||||
case "tags": return "tags";
|
||||
case "standStatus": return "stand_status";
|
||||
case "replacedStandNum": return "replaced_stand_num";
|
||||
case "replaceStandNum": return "replace_stand_num";
|
||||
case "quoteStand": return "quote_stand";
|
||||
case "firstPutTime": return "first_put_time";
|
||||
case "putYear": return "put_year";
|
||||
case "putTime": return "put_time";
|
||||
case "issueTime": return "issue_time";
|
||||
case "energyKind": return "energy_kind";
|
||||
case "applyArctic": return "apply_arctic";
|
||||
case "standEnName": return "stand_en_name";
|
||||
case "standName": return "stand_name";
|
||||
case "standCode": return "stand_code";
|
||||
case "classifyCode": return "classify_code";
|
||||
case "standSubclass": return "stand_subclass";
|
||||
case "standGenera": return "stand_genera";
|
||||
case "id": return "id";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 原始数据库列名转换为java字段名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
* <li>modify_time -> modifyTime</li>
|
||||
* <li>creation_time -> creationTime</li>
|
||||
* <li>valid_flag -> validFlag</li>
|
||||
* <li>put_user -> putUser</li>
|
||||
* <li>citation_user -> citationUser</li>
|
||||
* <li>responsible_unit -> responsibleUnit</li>
|
||||
* <li>stand_file -> standFile</li>
|
||||
* <li>tags -> tags</li>
|
||||
* <li>stand_status -> standStatus</li>
|
||||
* <li>replaced_stand_num -> replacedStandNum</li>
|
||||
* <li>replace_stand_num -> replaceStandNum</li>
|
||||
* <li>quote_stand -> quoteStand</li>
|
||||
* <li>first_put_time -> firstPutTime</li>
|
||||
* <li>put_year -> putYear</li>
|
||||
* <li>put_time -> putTime</li>
|
||||
* <li>issue_time -> issueTime</li>
|
||||
* <li>energy_kind -> energyKind</li>
|
||||
* <li>apply_arctic -> applyArctic</li>
|
||||
* <li>stand_en_name -> standEnName</li>
|
||||
* <li>stand_name -> standName</li>
|
||||
* <li>stand_code -> standCode</li>
|
||||
* <li>classify_code -> classifyCode</li>
|
||||
* <li>stand_subclass -> standSubclass</li>
|
||||
* <li>stand_genera -> standGenera</li>
|
||||
* <li>id -> id</li>
|
||||
*/
|
||||
public static String columnToField(String columnName) {
|
||||
if (columnName == null){ return null;}
|
||||
switch (columnName) {
|
||||
case "modify_time": return "modifyTime";
|
||||
case "creation_time": return "creationTime";
|
||||
case "valid_flag": return "validFlag";
|
||||
case "put_user": return "putUser";
|
||||
case "citation_user": return "citationUser";
|
||||
case "responsible_unit": return "responsibleUnit";
|
||||
case "stand_file": return "standFile";
|
||||
case "tags": return "tags";
|
||||
case "stand_status": return "standStatus";
|
||||
case "replaced_stand_num": return "replacedStandNum";
|
||||
case "replace_stand_num": return "replaceStandNum";
|
||||
case "quote_stand": return "quoteStand";
|
||||
case "first_put_time": return "firstPutTime";
|
||||
case "put_year": return "putYear";
|
||||
case "put_time": return "putTime";
|
||||
case "issue_time": return "issueTime";
|
||||
case "energy_kind": return "energyKind";
|
||||
case "apply_arctic": return "applyArctic";
|
||||
case "stand_en_name": return "standEnName";
|
||||
case "stand_name": return "standName";
|
||||
case "stand_code": return "standCode";
|
||||
case "classify_code": return "classifyCode";
|
||||
case "stand_subclass": return "standSubclass";
|
||||
case "stand_genera": return "standGenera";
|
||||
case "id": return "id";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getModifyTime() {
|
||||
return this.modifyTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getCreationTime() {
|
||||
return this.creationTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Integer getValidFlag() {
|
||||
return this.validFlag;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setValidFlag(Integer validFlag) {
|
||||
this.validFlag = validFlag;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getPutUser() {
|
||||
return this.putUser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setPutUser(String putUser) {
|
||||
this.putUser = putUser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getCitationUser() {
|
||||
return this.citationUser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setCitationUser(String citationUser) {
|
||||
this.citationUser = citationUser;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getResponsibleUnit() {
|
||||
return this.responsibleUnit;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setResponsibleUnit(String responsibleUnit) {
|
||||
this.responsibleUnit = responsibleUnit;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStandFile() {
|
||||
return this.standFile;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStandFile(String standFile) {
|
||||
this.standFile = standFile;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getTags() {
|
||||
return this.tags;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setTags(String tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStandStatus() {
|
||||
return this.standStatus;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStandStatus(String standStatus) {
|
||||
this.standStatus = standStatus;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getReplacedStandNum() {
|
||||
return this.replacedStandNum;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setReplacedStandNum(String replacedStandNum) {
|
||||
this.replacedStandNum = replacedStandNum;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getReplaceStandNum() {
|
||||
return this.replaceStandNum;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setReplaceStandNum(String replaceStandNum) {
|
||||
this.replaceStandNum = replaceStandNum;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getQuoteStand() {
|
||||
return this.quoteStand;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setQuoteStand(String quoteStand) {
|
||||
this.quoteStand = quoteStand;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getFirstPutTime() {
|
||||
return this.firstPutTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setFirstPutTime(Date firstPutTime) {
|
||||
this.firstPutTime = firstPutTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getPutYear() {
|
||||
return this.putYear;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setPutYear(Date putYear) {
|
||||
this.putYear = putYear;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getPutTime() {
|
||||
return this.putTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setPutTime(Date putTime) {
|
||||
this.putTime = putTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Date getIssueTime() {
|
||||
return this.issueTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setIssueTime(Date issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getEnergyKind() {
|
||||
return this.energyKind;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setEnergyKind(String energyKind) {
|
||||
this.energyKind = energyKind;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getApplyArctic() {
|
||||
return this.applyArctic;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setApplyArctic(String applyArctic) {
|
||||
this.applyArctic = applyArctic;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStandEnName() {
|
||||
return this.standEnName;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStandEnName(String standEnName) {
|
||||
this.standEnName = standEnName;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStandName() {
|
||||
return this.standName;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStandName(String standName) {
|
||||
this.standName = standName;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStandCode() {
|
||||
return this.standCode;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStandCode(String standCode) {
|
||||
this.standCode = standCode;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getClassifyCode() {
|
||||
return this.classifyCode;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setClassifyCode(String classifyCode) {
|
||||
this.classifyCode = classifyCode;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStandSubclass() {
|
||||
return this.standSubclass;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStandSubclass(String standSubclass) {
|
||||
this.standSubclass = standSubclass;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getStandGenera() {
|
||||
return this.standGenera;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setStandGenera(String standGenera) {
|
||||
this.standGenera = standGenera;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMenuId() {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
public String getStandStatusShow() {
|
||||
return standStatusShow;
|
||||
}
|
||||
|
||||
public void setStandStatusShow(String standStatusShow) {
|
||||
this.standStatusShow = standStatusShow;
|
||||
}
|
||||
|
||||
public String getApplyArcticShow() {
|
||||
return applyArcticShow;
|
||||
}
|
||||
|
||||
public void setApplyArcticShow(String applyArcticShow) {
|
||||
this.applyArcticShow = applyArcticShow;
|
||||
}
|
||||
|
||||
public String getEnergyKindShow() {
|
||||
return energyKindShow;
|
||||
}
|
||||
|
||||
public void setEnergyKindShow(String energyKindShow) {
|
||||
this.energyKindShow = energyKindShow;
|
||||
}
|
||||
|
||||
public String getStandGeneraShow() {
|
||||
return standGeneraShow;
|
||||
}
|
||||
|
||||
public void setStandGeneraShow(String standGeneraShow) {
|
||||
this.standGeneraShow = standGeneraShow;
|
||||
}
|
||||
|
||||
public String getStandSubclassShow() {
|
||||
return standSubclassShow;
|
||||
}
|
||||
|
||||
public void setStandSubclassShow(String standSubclassShow) {
|
||||
this.standSubclassShow = standSubclassShow;
|
||||
}
|
||||
|
||||
public List<AttFileVo> getStandFileList() {
|
||||
return standFileList;
|
||||
}
|
||||
|
||||
public void setStandFileList(List<AttFileVo> standFileList) {
|
||||
this.standFileList = standFileList;
|
||||
}
|
||||
|
||||
public String getCollectId() {
|
||||
return collectId;
|
||||
}
|
||||
|
||||
public void setCollectId(String collectId) {
|
||||
this.collectId = collectId;
|
||||
}
|
||||
|
||||
public String getResponsibleUnitShow() {
|
||||
return responsibleUnitShow;
|
||||
}
|
||||
|
||||
public void setResponsibleUnitShow(String responsibleUnitShow) {
|
||||
this.responsibleUnitShow = responsibleUnitShow;
|
||||
}
|
||||
|
||||
public String getMenuParentId() {
|
||||
return menuParentId;
|
||||
}
|
||||
|
||||
public void setMenuParentId(String menuParentId) {
|
||||
this.menuParentId = menuParentId;
|
||||
}
|
||||
|
||||
public int getUpReplaceNumFlag() {
|
||||
return upReplaceNumFlag;
|
||||
}
|
||||
|
||||
public void setUpReplaceNumFlag(int upReplaceNumFlag) {
|
||||
this.upReplaceNumFlag = upReplaceNumFlag;
|
||||
}
|
||||
|
||||
public int getUpNumFlag() {
|
||||
return upNumFlag;
|
||||
}
|
||||
|
||||
public void setUpNumFlag(int upNumFlag) {
|
||||
this.upNumFlag = upNumFlag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_STANDARDS_INFO SarStandardsInfoEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2018-09-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
|
||||
public class SearchInfoEO extends BasePage {
|
||||
|
||||
//标准编号 文件号laws_number 标准编号STAND_CODE
|
||||
private String standNumber;
|
||||
//标准名称 文件名称laws_name standNAME
|
||||
private String standName;
|
||||
//标准英文名称 无 standEnName
|
||||
private String standEnName;
|
||||
//标准状态 文件状态laws_status standStatus
|
||||
private String standState;
|
||||
//标准文本 支持PDF、doc、docx文件《此项需要按照标准正文内容修改》 无 标准文本文件standFile
|
||||
private String standFile;
|
||||
//适用车型 适用车型 适用车型
|
||||
private String applyArctic;
|
||||
//发布日期 发布日期 发布日期
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date issueTime;
|
||||
//实施日期 实施日期 实施日期
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date putTime;
|
||||
//起草人 无 有发布人和主要编织者putUser,citationUser
|
||||
private String draftUser;
|
||||
//起草单位 发布单位issueUnit 无,只有责任部门
|
||||
private String draftingUnit;
|
||||
//代替标准号 代替文件号replaceLawsNum 代替标准号
|
||||
private String replaceStandNum;
|
||||
//被代替标准号 无 被代替标准号
|
||||
private String replacedStandNum;
|
||||
|
||||
//需求文档中还有 《文件名称》laws 中有 laws_name 标准库,企业标准库没有相关字段
|
||||
private String lawsName;
|
||||
// 《动态标题》,标准库中找不到对应 都没有
|
||||
|
||||
//记录首页中的下拉选择的数据类别
|
||||
private String selectKey;
|
||||
//记录首页搜索框中对应的数据
|
||||
private String selectValue;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date selectStartTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date selectEndTime;
|
||||
|
||||
public String getStandNumber() {
|
||||
return standNumber;
|
||||
}
|
||||
|
||||
public void setStandNumber(String standNumber) {
|
||||
this.standNumber = standNumber;
|
||||
}
|
||||
|
||||
public String getStandName() {
|
||||
return standName;
|
||||
}
|
||||
|
||||
public void setStandName(String standName) {
|
||||
this.standName = standName;
|
||||
}
|
||||
|
||||
public String getStandEnName() {
|
||||
return standEnName;
|
||||
}
|
||||
|
||||
public void setStandEnName(String standEnName) {
|
||||
this.standEnName = standEnName;
|
||||
}
|
||||
|
||||
public String getStandState() {
|
||||
return standState;
|
||||
}
|
||||
|
||||
public void setStandState(String standState) {
|
||||
this.standState = standState;
|
||||
}
|
||||
|
||||
public String getStandFile() {
|
||||
return standFile;
|
||||
}
|
||||
|
||||
public void setStandFile(String standFile) {
|
||||
this.standFile = standFile;
|
||||
}
|
||||
|
||||
public String getApplyArctic() {
|
||||
return applyArctic;
|
||||
}
|
||||
|
||||
public void setApplyArctic(String applyArctic) {
|
||||
this.applyArctic = applyArctic;
|
||||
}
|
||||
|
||||
public Date getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
public void setIssueTime(Date issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
public Date getPutTime() {
|
||||
return putTime;
|
||||
}
|
||||
|
||||
public void setPutTime(Date putTime) {
|
||||
this.putTime = putTime;
|
||||
}
|
||||
|
||||
public String getDraftUser() {
|
||||
return draftUser;
|
||||
}
|
||||
|
||||
public void setDraftUser(String draftUser) {
|
||||
this.draftUser = draftUser;
|
||||
}
|
||||
|
||||
public String getDraftingUnit() {
|
||||
return draftingUnit;
|
||||
}
|
||||
|
||||
public void setDraftingUnit(String draftingUnit) {
|
||||
this.draftingUnit = draftingUnit;
|
||||
}
|
||||
|
||||
public String getReplaceStandNum() {
|
||||
return replaceStandNum;
|
||||
}
|
||||
|
||||
public void setReplaceStandNum(String replaceStandNum) {
|
||||
this.replaceStandNum = replaceStandNum;
|
||||
}
|
||||
|
||||
public String getReplacedStandNum() {
|
||||
return replacedStandNum;
|
||||
}
|
||||
|
||||
public void setReplacedStandNum(String replacedStandNum) {
|
||||
this.replacedStandNum = replacedStandNum;
|
||||
}
|
||||
|
||||
public String getLawsName() {
|
||||
return lawsName;
|
||||
}
|
||||
|
||||
public void setLawsName(String lawsName) {
|
||||
this.lawsName = lawsName;
|
||||
}
|
||||
|
||||
public String getSelectKey() {
|
||||
return selectKey;
|
||||
}
|
||||
|
||||
public void setSelectKey(String selectKey) {
|
||||
this.selectKey = selectKey;
|
||||
}
|
||||
|
||||
public String getSelectValue() {
|
||||
return selectValue;
|
||||
}
|
||||
|
||||
public void setSelectValue(String selectValue) {
|
||||
this.selectValue = selectValue;
|
||||
}
|
||||
|
||||
public Date getSelectStartTime() {
|
||||
return selectStartTime;
|
||||
}
|
||||
|
||||
public void setSelectStartTime(Date selectStartTime) {
|
||||
this.selectStartTime = selectStartTime;
|
||||
}
|
||||
|
||||
public Date getSelectEndTime() {
|
||||
return selectEndTime;
|
||||
}
|
||||
|
||||
public void setSelectEndTime(Date selectEndTime) {
|
||||
this.selectEndTime = selectEndTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
|
||||
public class SearchListDto {
|
||||
private BoolQueryBuilder boolQueryBuilder;
|
||||
private int must;
|
||||
private int should;
|
||||
private int mustnot;
|
||||
|
||||
public int getMustnot() {
|
||||
return mustnot;
|
||||
}
|
||||
|
||||
public void setMustnot(int mustnot) {
|
||||
this.mustnot = mustnot;
|
||||
}
|
||||
|
||||
public int getShould() {
|
||||
return should;
|
||||
}
|
||||
|
||||
public void setShould(int should) {
|
||||
this.should = should;
|
||||
}
|
||||
|
||||
public int getMust() {
|
||||
return must;
|
||||
}
|
||||
|
||||
public void setMust(int must) {
|
||||
this.must = must;
|
||||
}
|
||||
|
||||
public BoolQueryBuilder getBoolQueryBuilder() {
|
||||
return boolQueryBuilder;
|
||||
}
|
||||
|
||||
public void setBoolQueryBuilder(BoolQueryBuilder boolQueryBuilder) {
|
||||
this.boolQueryBuilder = boolQueryBuilder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_STANDARDS_INFO SarStandardsInfoEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2018-09-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class SeniorSearchInfoEO extends BasePage {
|
||||
private String standType;
|
||||
//标准性质
|
||||
private String nature;
|
||||
//国家地区
|
||||
private String country;
|
||||
//标准类别
|
||||
private String standSort;
|
||||
//标准,文件号
|
||||
private String numberShow;
|
||||
//标准,文件名称
|
||||
private String nameShow;
|
||||
//适用车型
|
||||
private String applyArctic;
|
||||
//适用认证
|
||||
private String applyAuth;
|
||||
//所属类别
|
||||
private String category;
|
||||
//能源种类
|
||||
private String energyKind;
|
||||
//采标程度
|
||||
private String adoptExtent;
|
||||
//标准状态
|
||||
private String standState;
|
||||
//发布日期
|
||||
private Date issueTime;
|
||||
//标准大类
|
||||
private String bussBigClass;
|
||||
//标准细类
|
||||
private String bussFineClass;
|
||||
|
||||
//记录首页中的下拉选择的数据类别
|
||||
private String selectKey;
|
||||
//记录首页搜索框中对应的数据
|
||||
private String selectValue;
|
||||
//记录从哪个索引表中查数据
|
||||
private String selectIndex;
|
||||
|
||||
//高级搜索
|
||||
//标准编号
|
||||
private String standNumber;
|
||||
//标准年份
|
||||
private String standYear;
|
||||
//标准英文名称
|
||||
private String standEnName;
|
||||
//代替标准号 手动输入可以多个,用","隔开
|
||||
private String replaceStandNum;
|
||||
//被代替标准号
|
||||
private String replacedStandNum;
|
||||
//采用国际标准号
|
||||
private String interStandNum;
|
||||
//实施日期
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date putTime;
|
||||
//新生产车实施日期
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date newproductPutTime;
|
||||
//在产车实施日期
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date productPutTime;
|
||||
//新定型车实施日期
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date newcarPutTime;
|
||||
//起草人
|
||||
private String draftUser;
|
||||
//起草单位
|
||||
private String draftingUnit;
|
||||
//关键词
|
||||
private String tags;
|
||||
//内容摘要
|
||||
private String synopsis;
|
||||
//责任部门
|
||||
private String responsibleUnit;
|
||||
//发布单位
|
||||
private String issueUnit;
|
||||
//分类代号
|
||||
private String classifyCode;
|
||||
//实施年份
|
||||
private String putYear;
|
||||
//首发日期
|
||||
private String firstPutTime;
|
||||
//引用标准
|
||||
private String quoteStand;
|
||||
//主要编制者
|
||||
private String citationUser;
|
||||
//动态标题
|
||||
private String title;
|
||||
//发布人
|
||||
private String pubUserName;
|
||||
//发布单位
|
||||
private String pubOrgName;
|
||||
//所属模块
|
||||
private String module;
|
||||
//注册车
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date registerPutTime;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date selectStartTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date selectEndTime;
|
||||
|
||||
private String keywords;
|
||||
private String resultKeyword;
|
||||
//发布开始日期
|
||||
private Date issueTimeSt;
|
||||
//发布结束日期
|
||||
private Date issueTimeEd;
|
||||
//实施开始日期
|
||||
private Date putTimeSt;
|
||||
//实施结束日期
|
||||
private Date putTimeEd;
|
||||
|
||||
|
||||
// 条目搜索条件
|
||||
private String itemsName;
|
||||
private String itemsNum;
|
||||
private String parts;
|
||||
|
||||
//新车型实施开始日期
|
||||
private Date newcarPutTimeSt;
|
||||
//新车型实施结束日期
|
||||
private Date newcarPutTimeEd;
|
||||
//在产实施开始日期
|
||||
private Date productPutTimeSt;
|
||||
//在产实施结束日期
|
||||
private Date productPutTimeEd;
|
||||
private List<SarAdvanceSearchVO> advanceSearchVOList;
|
||||
private String advanceSearchVOStr;
|
||||
private String CLLX;
|
||||
private String CYSD;
|
||||
private String CBCD;
|
||||
private String ZRLX;
|
||||
private String SYCLLX;
|
||||
private String WSSFCY;
|
||||
|
||||
private String ZQCBM;
|
||||
private String stand_status;
|
||||
private String isHigh;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,926 @@
|
||||
package com.adc.da.search.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>PART_PRODUCT PartProductEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2018-11-22 <br>
|
||||
* <b>版权所有:<br><br>
|
||||
*/
|
||||
public class StandLawsEO extends BaseEntity {
|
||||
private String id;
|
||||
private String stand_type;
|
||||
private String laws_type;
|
||||
private String numbershow;
|
||||
private String numbershowSplit;
|
||||
private String standNumber;
|
||||
private String nameshow;
|
||||
private String nameshowSplit;
|
||||
private String standEnName;
|
||||
private String nature;
|
||||
private String natureShow;
|
||||
private String country;
|
||||
private String countryShow;
|
||||
private String stand_sort;
|
||||
private String standSortShow;
|
||||
private String apply_arctic;
|
||||
private String applyArcticShow;
|
||||
private String standYear;
|
||||
private String apply_auth;
|
||||
private String applyAuthShow;
|
||||
private String category;
|
||||
private String categoryShow;
|
||||
private String energy_kind;
|
||||
private String energyKindShow;
|
||||
private String adopt_extent;
|
||||
private String adoptExtentShow;
|
||||
private String statecode;
|
||||
private String statecodeShow;
|
||||
private Date issue_time;
|
||||
private String issueTimeStr;
|
||||
private Date put_time;
|
||||
private String putTimeStr;
|
||||
private String draft_user;
|
||||
private String drafting_unit;
|
||||
private String replace_stand_num;
|
||||
private String replaced_stand_num;
|
||||
private Integer valid_flag;
|
||||
private String type;
|
||||
private String standstateshow;
|
||||
private String content;
|
||||
|
||||
private String lawsstateshow;
|
||||
private String replace_laws_num;
|
||||
|
||||
private String bussBigClass;
|
||||
private String bussBigClassShow;
|
||||
private String bussFineClassShow;
|
||||
private String bussFineClass;
|
||||
private String classifyCode;
|
||||
private String putYear;
|
||||
private String firstPutTime;
|
||||
private String quoteStand;
|
||||
private String citationUser;
|
||||
private String responsibleUnit;
|
||||
private String responsibleUnitShow;
|
||||
private String interStandNum;
|
||||
private Date newproductPutTime;
|
||||
//在产车实施日期
|
||||
private Date productPutTime;
|
||||
//新定型车实施日期
|
||||
private Date newcarPutTime;
|
||||
private Date registerPutTime;
|
||||
private String standTag;
|
||||
private String synopsis;
|
||||
//发布单位
|
||||
private String issueUnit;
|
||||
//动态信息
|
||||
private String module;
|
||||
private String moduleName;
|
||||
private String title;
|
||||
private String pubUser;
|
||||
private String pubUserShow;
|
||||
private String pubOrg;
|
||||
private String pubOrgShow;
|
||||
private String msgContent;
|
||||
|
||||
//去掉编号中空格
|
||||
private String numberExpNull;
|
||||
|
||||
// 条目信息
|
||||
private String itemsName;
|
||||
private String itemsNum;
|
||||
private String standId;
|
||||
private String termsConditions; //条款要求
|
||||
private String mainPointImplementation; //实施要点
|
||||
private String parts;
|
||||
private Date tackTime;
|
||||
private String remarks;
|
||||
private String itemsType;
|
||||
// 新加属性字段
|
||||
private String issueUnitShow;//发布单位
|
||||
private String citeStand;
|
||||
private String citedStand;
|
||||
private String gkglbm;
|
||||
private String gkglbmShow;
|
||||
private String gzzxx;
|
||||
private String cysd;
|
||||
private String zrlx;
|
||||
private String zrlxShow;
|
||||
private String yqlx;
|
||||
private String yqlxShow;
|
||||
private String gxhbq;
|
||||
private String gxhbqShow;
|
||||
private String xgbm;
|
||||
private String xgbmShow;
|
||||
private String svpps;
|
||||
private String fo;
|
||||
private String foShow;
|
||||
private String xmpgry;
|
||||
private String xmpgryShow;
|
||||
private String fgwhr;
|
||||
|
||||
public String getApply_arctic() {
|
||||
return apply_arctic;
|
||||
}
|
||||
|
||||
public void setApply_arctic(String apply_arctic) {
|
||||
this.apply_arctic = apply_arctic;
|
||||
}
|
||||
|
||||
public String getEnergy_kind() {
|
||||
return energy_kind;
|
||||
}
|
||||
|
||||
public void setEnergy_kind(String energy_kind) {
|
||||
this.energy_kind = energy_kind;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getIssue_time() {
|
||||
return issue_time;
|
||||
}
|
||||
|
||||
public void setIssue_time(Date issue_time) {
|
||||
this.issue_time = issue_time;
|
||||
}
|
||||
|
||||
public String getNameshow() {
|
||||
return nameshow;
|
||||
}
|
||||
|
||||
public void setNameshow(String nameshow) {
|
||||
this.nameshow = nameshow;
|
||||
}
|
||||
|
||||
public String getNumbershow() {
|
||||
return numbershow;
|
||||
}
|
||||
|
||||
public void setNumbershow(String numbershow) {
|
||||
this.numbershow = numbershow;
|
||||
}
|
||||
|
||||
public Date getPut_time() {
|
||||
return put_time;
|
||||
}
|
||||
|
||||
public void setPut_time(Date put_time) {
|
||||
this.put_time = put_time;
|
||||
}
|
||||
|
||||
public String getReplace_stand_num() {
|
||||
return replace_stand_num;
|
||||
}
|
||||
|
||||
public void setReplace_stand_num(String replace_stand_num) {
|
||||
this.replace_stand_num = replace_stand_num;
|
||||
}
|
||||
|
||||
public String getReplaced_stand_num() {
|
||||
return replaced_stand_num;
|
||||
}
|
||||
|
||||
public void setReplaced_stand_num(String replaced_stand_num) {
|
||||
this.replaced_stand_num = replaced_stand_num;
|
||||
}
|
||||
|
||||
public String getStandstateshow() {
|
||||
return standstateshow;
|
||||
}
|
||||
|
||||
public void setStandstateshow(String standstateshow) {
|
||||
this.standstateshow = standstateshow;
|
||||
}
|
||||
|
||||
public String getStatecode() {
|
||||
return statecode;
|
||||
}
|
||||
|
||||
public void setStatecode(String statecode) {
|
||||
this.statecode = statecode;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getValid_flag() {
|
||||
return valid_flag;
|
||||
}
|
||||
|
||||
public void setValid_flag(Integer valid_flag) {
|
||||
this.valid_flag = valid_flag;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getStand_type() {
|
||||
return stand_type;
|
||||
}
|
||||
|
||||
public void setStand_type(String stand_type) {
|
||||
this.stand_type = stand_type;
|
||||
}
|
||||
|
||||
public String getLaws_type() {
|
||||
return laws_type;
|
||||
}
|
||||
|
||||
public void setLaws_type(String laws_type) {
|
||||
this.laws_type = laws_type;
|
||||
}
|
||||
|
||||
public String getNature() {
|
||||
return nature;
|
||||
}
|
||||
|
||||
public void setNature(String nature) {
|
||||
this.nature = nature;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getStand_sort() {
|
||||
return stand_sort;
|
||||
}
|
||||
|
||||
public void setStand_sort(String stand_sort) {
|
||||
this.stand_sort = stand_sort;
|
||||
}
|
||||
|
||||
public String getApply_auth() {
|
||||
return apply_auth;
|
||||
}
|
||||
|
||||
public void setApply_auth(String apply_auth) {
|
||||
this.apply_auth = apply_auth;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getAdopt_extent() {
|
||||
return adopt_extent;
|
||||
}
|
||||
|
||||
public void setAdopt_extent(String adopt_extent) {
|
||||
this.adopt_extent = adopt_extent;
|
||||
}
|
||||
|
||||
public String getDraft_user() {
|
||||
return draft_user;
|
||||
}
|
||||
|
||||
public void setDraft_user(String draft_user) {
|
||||
this.draft_user = draft_user;
|
||||
}
|
||||
|
||||
public String getDrafting_unit() {
|
||||
return drafting_unit;
|
||||
}
|
||||
|
||||
public void setDrafting_unit(String drafting_unit) {
|
||||
this.drafting_unit = drafting_unit;
|
||||
}
|
||||
|
||||
public String getLawsstateshow() {
|
||||
return lawsstateshow;
|
||||
}
|
||||
|
||||
public void setLawsstateshow(String lawsstateshow) {
|
||||
this.lawsstateshow = lawsstateshow;
|
||||
}
|
||||
|
||||
public String getReplace_laws_num() {
|
||||
return replace_laws_num;
|
||||
}
|
||||
|
||||
public void setReplace_laws_num(String replace_laws_num) {
|
||||
this.replace_laws_num = replace_laws_num;
|
||||
}
|
||||
|
||||
public String getBussBigClass() {
|
||||
return bussBigClass;
|
||||
}
|
||||
|
||||
public void setBussBigClass(String bussBigClass) {
|
||||
this.bussBigClass = bussBigClass;
|
||||
}
|
||||
|
||||
public String getBussFineClass() {
|
||||
return bussFineClass;
|
||||
}
|
||||
|
||||
public void setBussFineClass(String bussFineClass) {
|
||||
this.bussFineClass = bussFineClass;
|
||||
}
|
||||
|
||||
public String getClassifyCode() {
|
||||
return classifyCode;
|
||||
}
|
||||
|
||||
public void setClassifyCode(String classifyCode) {
|
||||
this.classifyCode = classifyCode;
|
||||
}
|
||||
|
||||
public String getPutYear() {
|
||||
return putYear;
|
||||
}
|
||||
|
||||
public void setPutYear(String putYear) {
|
||||
this.putYear = putYear;
|
||||
}
|
||||
|
||||
public String getFirstPutTime() {
|
||||
return firstPutTime;
|
||||
}
|
||||
|
||||
public void setFirstPutTime(String firstPutTime) {
|
||||
this.firstPutTime = firstPutTime;
|
||||
}
|
||||
|
||||
public String getQuoteStand() {
|
||||
return quoteStand;
|
||||
}
|
||||
|
||||
public void setQuoteStand(String quoteStand) {
|
||||
this.quoteStand = quoteStand;
|
||||
}
|
||||
|
||||
public String getCitationUser() {
|
||||
return citationUser;
|
||||
}
|
||||
|
||||
public void setCitationUser(String citationUser) {
|
||||
this.citationUser = citationUser;
|
||||
}
|
||||
|
||||
public String getStandEnName() {
|
||||
return standEnName;
|
||||
}
|
||||
|
||||
public void setStandEnName(String standEnName) {
|
||||
this.standEnName = standEnName;
|
||||
}
|
||||
|
||||
public String getResponsibleUnit() {
|
||||
return responsibleUnit;
|
||||
}
|
||||
|
||||
public void setResponsibleUnit(String responsibleUnit) {
|
||||
this.responsibleUnit = responsibleUnit;
|
||||
}
|
||||
|
||||
public String getInterStandNum() {
|
||||
return interStandNum;
|
||||
}
|
||||
|
||||
public void setInterStandNum(String interStandNum) {
|
||||
this.interStandNum = interStandNum;
|
||||
}
|
||||
|
||||
public Date getNewproductPutTime() {
|
||||
return newproductPutTime;
|
||||
}
|
||||
|
||||
public void setNewproductPutTime(Date newproductPutTime) {
|
||||
this.newproductPutTime = newproductPutTime;
|
||||
}
|
||||
|
||||
public Date getProductPutTime() {
|
||||
return productPutTime;
|
||||
}
|
||||
|
||||
public void setProductPutTime(Date productPutTime) {
|
||||
this.productPutTime = productPutTime;
|
||||
}
|
||||
|
||||
public Date getNewcarPutTime() {
|
||||
return newcarPutTime;
|
||||
}
|
||||
|
||||
public void setNewcarPutTime(Date newcarPutTime) {
|
||||
this.newcarPutTime = newcarPutTime;
|
||||
}
|
||||
|
||||
public String getSynopsis() {
|
||||
return synopsis;
|
||||
}
|
||||
|
||||
public void setSynopsis(String synopsis) {
|
||||
this.synopsis = synopsis;
|
||||
}
|
||||
|
||||
public String getIssueUnit() {
|
||||
return issueUnit;
|
||||
}
|
||||
|
||||
public void setIssueUnit(String issueUnit) {
|
||||
this.issueUnit = issueUnit;
|
||||
}
|
||||
|
||||
public String getNatureShow() {
|
||||
return natureShow;
|
||||
}
|
||||
|
||||
public void setNatureShow(String natureShow) {
|
||||
this.natureShow = natureShow;
|
||||
}
|
||||
|
||||
public String getCountryShow() {
|
||||
return countryShow;
|
||||
}
|
||||
|
||||
public void setCountryShow(String countryShow) {
|
||||
this.countryShow = countryShow;
|
||||
}
|
||||
|
||||
public String getStandSortShow() {
|
||||
return standSortShow;
|
||||
}
|
||||
|
||||
public void setStandSortShow(String standSortShow) {
|
||||
this.standSortShow = standSortShow;
|
||||
}
|
||||
|
||||
public String getApplyArcticShow() {
|
||||
return applyArcticShow;
|
||||
}
|
||||
|
||||
public void setApplyArcticShow(String applyArcticShow) {
|
||||
this.applyArcticShow = applyArcticShow;
|
||||
}
|
||||
|
||||
public String getApplyAuthShow() {
|
||||
return applyAuthShow;
|
||||
}
|
||||
|
||||
public void setApplyAuthShow(String applyAuthShow) {
|
||||
this.applyAuthShow = applyAuthShow;
|
||||
}
|
||||
|
||||
public String getCategoryShow() {
|
||||
return categoryShow;
|
||||
}
|
||||
|
||||
public void setCategoryShow(String categoryShow) {
|
||||
this.categoryShow = categoryShow;
|
||||
}
|
||||
|
||||
public String getEnergyKindShow() {
|
||||
return energyKindShow;
|
||||
}
|
||||
|
||||
public void setEnergyKindShow(String energyKindShow) {
|
||||
this.energyKindShow = energyKindShow;
|
||||
}
|
||||
|
||||
public String getAdoptExtentShow() {
|
||||
return adoptExtentShow;
|
||||
}
|
||||
|
||||
public void setAdoptExtentShow(String adoptExtentShow) {
|
||||
this.adoptExtentShow = adoptExtentShow;
|
||||
}
|
||||
|
||||
public String getStatecodeShow() {
|
||||
return statecodeShow;
|
||||
}
|
||||
|
||||
public void setStatecodeShow(String statecodeShow) {
|
||||
this.statecodeShow = statecodeShow;
|
||||
}
|
||||
|
||||
public String getIssueTimeStr() {
|
||||
return issueTimeStr;
|
||||
}
|
||||
|
||||
public void setIssueTimeStr(String issueTimeStr) {
|
||||
this.issueTimeStr = issueTimeStr;
|
||||
}
|
||||
|
||||
public String getPutTimeStr() {
|
||||
return putTimeStr;
|
||||
}
|
||||
|
||||
public void setPutTimeStr(String putTimeStr) {
|
||||
this.putTimeStr = putTimeStr;
|
||||
}
|
||||
|
||||
public String getBussBigClassShow() {
|
||||
return bussBigClassShow;
|
||||
}
|
||||
|
||||
public void setBussBigClassShow(String bussBigClassShow) {
|
||||
this.bussBigClassShow = bussBigClassShow;
|
||||
}
|
||||
|
||||
public String getBussFineClassShow() {
|
||||
return bussFineClassShow;
|
||||
}
|
||||
|
||||
public void setBussFineClassShow(String bussFineClassShow) {
|
||||
this.bussFineClassShow = bussFineClassShow;
|
||||
}
|
||||
|
||||
public String getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
public void setModule(String module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getPubUser() {
|
||||
return pubUser;
|
||||
}
|
||||
|
||||
public void setPubUser(String pubUser) {
|
||||
this.pubUser = pubUser;
|
||||
}
|
||||
|
||||
public String getPubUserShow() {
|
||||
return pubUserShow;
|
||||
}
|
||||
|
||||
public void setPubUserShow(String pubUserShow) {
|
||||
this.pubUserShow = pubUserShow;
|
||||
}
|
||||
|
||||
public String getPubOrg() {
|
||||
return pubOrg;
|
||||
}
|
||||
|
||||
public void setPubOrg(String pubOrg) {
|
||||
this.pubOrg = pubOrg;
|
||||
}
|
||||
|
||||
public String getPubOrgShow() {
|
||||
return pubOrgShow;
|
||||
}
|
||||
|
||||
public void setPubOrgShow(String pubOrgShow) {
|
||||
this.pubOrgShow = pubOrgShow;
|
||||
}
|
||||
|
||||
|
||||
public String getModuleName() {
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
public String getStandYear() {
|
||||
return standYear;
|
||||
}
|
||||
|
||||
public void setStandYear(String standYear) {
|
||||
this.standYear = standYear;
|
||||
}
|
||||
|
||||
public String getResponsibleUnitShow() {
|
||||
return responsibleUnitShow;
|
||||
}
|
||||
|
||||
public void setResponsibleUnitShow(String responsibleUnitShow) {
|
||||
this.responsibleUnitShow = responsibleUnitShow;
|
||||
}
|
||||
|
||||
public String getStandNumber() {
|
||||
return standNumber;
|
||||
}
|
||||
|
||||
public void setStandNumber(String standNumber) {
|
||||
this.standNumber = standNumber;
|
||||
}
|
||||
|
||||
public Date getRegisterPutTime() {
|
||||
return registerPutTime;
|
||||
}
|
||||
|
||||
public void setRegisterPutTime(Date registerPutTime) {
|
||||
this.registerPutTime = registerPutTime;
|
||||
}
|
||||
|
||||
public String getNumberExpNull() {
|
||||
return numberExpNull;
|
||||
}
|
||||
|
||||
public void setNumberExpNull(String numberExpNull) {
|
||||
this.numberExpNull = numberExpNull;
|
||||
}
|
||||
|
||||
public String getItemsName() {
|
||||
return itemsName;
|
||||
}
|
||||
|
||||
public void setItemsName(String itemsName) {
|
||||
this.itemsName = itemsName;
|
||||
}
|
||||
|
||||
public String getItemsNum() {
|
||||
return itemsNum;
|
||||
}
|
||||
|
||||
public void setItemsNum(String itemsNum) {
|
||||
this.itemsNum = itemsNum;
|
||||
}
|
||||
|
||||
public String getStandId() {
|
||||
return standId;
|
||||
}
|
||||
|
||||
public void setStandId(String standId) {
|
||||
this.standId = standId;
|
||||
}
|
||||
|
||||
public String getTermsConditions() {
|
||||
return termsConditions;
|
||||
}
|
||||
|
||||
public void setTermsConditions(String termsConditions) {
|
||||
this.termsConditions = termsConditions;
|
||||
}
|
||||
|
||||
public String getMainPointImplementation() {
|
||||
return mainPointImplementation;
|
||||
}
|
||||
|
||||
public void setMainPointImplementation(String mainPointImplementation) {
|
||||
this.mainPointImplementation = mainPointImplementation;
|
||||
}
|
||||
|
||||
public String getParts() {
|
||||
return parts;
|
||||
}
|
||||
|
||||
public void setParts(String parts) {
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
public Date getTackTime() {
|
||||
return tackTime;
|
||||
}
|
||||
|
||||
public void setTackTime(Date tackTime) {
|
||||
this.tackTime = tackTime;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getItemsType() {
|
||||
return itemsType;
|
||||
}
|
||||
|
||||
public void setItemsType(String itemsType) {
|
||||
this.itemsType = itemsType;
|
||||
}
|
||||
|
||||
public String getNameshowSplit() {
|
||||
return nameshowSplit;
|
||||
}
|
||||
|
||||
public void setNameshowSplit(String nameshowSplit) {
|
||||
this.nameshowSplit = nameshowSplit;
|
||||
}
|
||||
|
||||
public String getNumbershowSplit() {
|
||||
return numbershowSplit;
|
||||
}
|
||||
|
||||
public void setNumbershowSplit(String numbershowSplit) {
|
||||
this.numbershowSplit = numbershowSplit;
|
||||
}
|
||||
|
||||
public String getMsgContent() {
|
||||
return msgContent;
|
||||
}
|
||||
|
||||
public void setMsgContent(String msgContent) {
|
||||
this.msgContent = msgContent;
|
||||
}
|
||||
|
||||
public String getStandTag() {
|
||||
return standTag;
|
||||
}
|
||||
|
||||
public void setStandTag(String standTag) {
|
||||
this.standTag = standTag;
|
||||
}
|
||||
|
||||
public String getIssueUnitShow() {
|
||||
return issueUnitShow;
|
||||
}
|
||||
|
||||
public void setIssueUnitShow(String issueUnitShow) {
|
||||
this.issueUnitShow = issueUnitShow;
|
||||
}
|
||||
|
||||
public String getCiteStand() {
|
||||
return citeStand;
|
||||
}
|
||||
|
||||
public void setCiteStand(String citeStand) {
|
||||
this.citeStand = citeStand;
|
||||
}
|
||||
|
||||
public String getCitedStand() {
|
||||
return citedStand;
|
||||
}
|
||||
|
||||
public void setCitedStand(String citedStand) {
|
||||
this.citedStand = citedStand;
|
||||
}
|
||||
|
||||
public String getGkglbm() {
|
||||
return gkglbm;
|
||||
}
|
||||
|
||||
public void setGkglbm(String gkglbm) {
|
||||
this.gkglbm = gkglbm;
|
||||
}
|
||||
|
||||
public String getGkglbmShow() {
|
||||
return gkglbmShow;
|
||||
}
|
||||
|
||||
public void setGkglbmShow(String gkglbmShow) {
|
||||
this.gkglbmShow = gkglbmShow;
|
||||
}
|
||||
|
||||
public String getGzzxx() {
|
||||
return gzzxx;
|
||||
}
|
||||
|
||||
public void setGzzxx(String gzzxx) {
|
||||
this.gzzxx = gzzxx;
|
||||
}
|
||||
|
||||
public String getCysd() {
|
||||
return cysd;
|
||||
}
|
||||
|
||||
public void setCysd(String cysd) {
|
||||
this.cysd = cysd;
|
||||
}
|
||||
|
||||
public String getZrlx() {
|
||||
return zrlx;
|
||||
}
|
||||
|
||||
public void setZrlx(String zrlx) {
|
||||
this.zrlx = zrlx;
|
||||
}
|
||||
|
||||
public String getZrlxShow() {
|
||||
return zrlxShow;
|
||||
}
|
||||
|
||||
public void setZrlxShow(String zrlxShow) {
|
||||
this.zrlxShow = zrlxShow;
|
||||
}
|
||||
|
||||
public String getYqlx() {
|
||||
return yqlx;
|
||||
}
|
||||
|
||||
public void setYqlx(String yqlx) {
|
||||
this.yqlx = yqlx;
|
||||
}
|
||||
|
||||
public String getYqlxShow() {
|
||||
return yqlxShow;
|
||||
}
|
||||
|
||||
public void setYqlxShow(String yqlxShow) {
|
||||
this.yqlxShow = yqlxShow;
|
||||
}
|
||||
|
||||
public String getGxhbq() {
|
||||
return gxhbq;
|
||||
}
|
||||
|
||||
public void setGxhbq(String gxhbq) {
|
||||
this.gxhbq = gxhbq;
|
||||
}
|
||||
|
||||
public String getGxhbqShow() {
|
||||
return gxhbqShow;
|
||||
}
|
||||
|
||||
public void setGxhbqShow(String gxhbqShow) {
|
||||
this.gxhbqShow = gxhbqShow;
|
||||
}
|
||||
|
||||
public String getXgbm() {
|
||||
return xgbm;
|
||||
}
|
||||
|
||||
public void setXgbm(String xgbm) {
|
||||
this.xgbm = xgbm;
|
||||
}
|
||||
|
||||
public String getXgbmShow() {
|
||||
return xgbmShow;
|
||||
}
|
||||
|
||||
public void setXgbmShow(String xgbmShow) {
|
||||
this.xgbmShow = xgbmShow;
|
||||
}
|
||||
|
||||
public String getSvpps() {
|
||||
return svpps;
|
||||
}
|
||||
|
||||
public void setSvpps(String svpps) {
|
||||
this.svpps = svpps;
|
||||
}
|
||||
|
||||
public String getFo() {
|
||||
return fo;
|
||||
}
|
||||
|
||||
public void setFo(String fo) {
|
||||
this.fo = fo;
|
||||
}
|
||||
|
||||
public String getFoShow() {
|
||||
return foShow;
|
||||
}
|
||||
|
||||
public void setFoShow(String foShow) {
|
||||
this.foShow = foShow;
|
||||
}
|
||||
|
||||
public String getXmpgry() {
|
||||
return xmpgry;
|
||||
}
|
||||
|
||||
public void setXmpgry(String xmpgry) {
|
||||
this.xmpgry = xmpgry;
|
||||
}
|
||||
|
||||
public String getXmpgryShow() {
|
||||
return xmpgryShow;
|
||||
}
|
||||
|
||||
public void setXmpgryShow(String xmpgryShow) {
|
||||
this.xmpgryShow = xmpgryShow;
|
||||
}
|
||||
|
||||
public String getFgwhr() {
|
||||
return fgwhr;
|
||||
}
|
||||
|
||||
public void setFgwhr(String fgwhr) {
|
||||
this.fgwhr = fgwhr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
package com.adc.da.search.page;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>PART_PRODUCT PartProductEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2018-08-22 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class PartProductEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
private String idOperator = "=";
|
||||
private String corpId;
|
||||
private String corpIdOperator = "=";
|
||||
private String partType;
|
||||
private String partTypeOperator = "=";
|
||||
private String partName;
|
||||
private String partNameOperator = "=";
|
||||
private String partNummber;
|
||||
private String partNummberOperator = "=";
|
||||
private String riskGrade;
|
||||
private String riskGradeOperator = "=";
|
||||
private String suitModel;
|
||||
private String suitModelOperator = "=";
|
||||
private String motoModel;
|
||||
private String motoModelOperator = "=";
|
||||
private String motoType;
|
||||
private String motoTypeOperator = "=";
|
||||
private String oemCode;
|
||||
private String oemCodeOperator = "=";
|
||||
private String certNumber;
|
||||
private String certNumberOperator = "=";
|
||||
private String delFlag;
|
||||
private String delFlagOperator = "=";
|
||||
private String insertTime;
|
||||
private String insertTime1;
|
||||
private String insertTime2;
|
||||
private String insertTimeOperator = "=";
|
||||
private String updateTime;
|
||||
private String updateTime1;
|
||||
private String updateTime2;
|
||||
private String updateTimeOperator = "=";
|
||||
private String corpModel;
|
||||
private String corpModelOperator = "=";
|
||||
private String partSup;
|
||||
private String partSupOperator = "=";
|
||||
private String qrCodeStatus;
|
||||
private String qrCodeStatusOperator = "=";
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdOperator() {
|
||||
return this.idOperator;
|
||||
}
|
||||
|
||||
public void setIdOperator(String idOperator) {
|
||||
this.idOperator = idOperator;
|
||||
}
|
||||
|
||||
public String getCorpId() {
|
||||
return this.corpId;
|
||||
}
|
||||
|
||||
public void setCorpId(String corpId) {
|
||||
this.corpId = corpId;
|
||||
}
|
||||
|
||||
public String getCorpIdOperator() {
|
||||
return this.corpIdOperator;
|
||||
}
|
||||
|
||||
public void setCorpIdOperator(String corpIdOperator) {
|
||||
this.corpIdOperator = corpIdOperator;
|
||||
}
|
||||
|
||||
public String getPartType() {
|
||||
return this.partType;
|
||||
}
|
||||
|
||||
public void setPartType(String partType) {
|
||||
this.partType = partType;
|
||||
}
|
||||
|
||||
public String getPartTypeOperator() {
|
||||
return this.partTypeOperator;
|
||||
}
|
||||
|
||||
public void setPartTypeOperator(String partTypeOperator) {
|
||||
this.partTypeOperator = partTypeOperator;
|
||||
}
|
||||
|
||||
public String getPartName() {
|
||||
return this.partName;
|
||||
}
|
||||
|
||||
public void setPartName(String partName) {
|
||||
this.partName = partName;
|
||||
}
|
||||
|
||||
public String getPartNameOperator() {
|
||||
return this.partNameOperator;
|
||||
}
|
||||
|
||||
public void setPartNameOperator(String partNameOperator) {
|
||||
this.partNameOperator = partNameOperator;
|
||||
}
|
||||
|
||||
public String getPartNummber() {
|
||||
return this.partNummber;
|
||||
}
|
||||
|
||||
public void setPartNummber(String partNummber) {
|
||||
this.partNummber = partNummber;
|
||||
}
|
||||
|
||||
public String getPartNummberOperator() {
|
||||
return this.partNummberOperator;
|
||||
}
|
||||
|
||||
public void setPartNummberOperator(String partNummberOperator) {
|
||||
this.partNummberOperator = partNummberOperator;
|
||||
}
|
||||
|
||||
public String getRiskGrade() {
|
||||
return this.riskGrade;
|
||||
}
|
||||
|
||||
public void setRiskGrade(String riskGrade) {
|
||||
this.riskGrade = riskGrade;
|
||||
}
|
||||
|
||||
public String getRiskGradeOperator() {
|
||||
return this.riskGradeOperator;
|
||||
}
|
||||
|
||||
public void setRiskGradeOperator(String riskGradeOperator) {
|
||||
this.riskGradeOperator = riskGradeOperator;
|
||||
}
|
||||
|
||||
public String getSuitModel() {
|
||||
return this.suitModel;
|
||||
}
|
||||
|
||||
public void setSuitModel(String suitModel) {
|
||||
this.suitModel = suitModel;
|
||||
}
|
||||
|
||||
public String getSuitModelOperator() {
|
||||
return this.suitModelOperator;
|
||||
}
|
||||
|
||||
public void setSuitModelOperator(String suitModelOperator) {
|
||||
this.suitModelOperator = suitModelOperator;
|
||||
}
|
||||
|
||||
public String getMotoModel() {
|
||||
return this.motoModel;
|
||||
}
|
||||
|
||||
public void setMotoModel(String motoModel) {
|
||||
this.motoModel = motoModel;
|
||||
}
|
||||
|
||||
public String getMotoModelOperator() {
|
||||
return this.motoModelOperator;
|
||||
}
|
||||
|
||||
public void setMotoModelOperator(String motoModelOperator) {
|
||||
this.motoModelOperator = motoModelOperator;
|
||||
}
|
||||
|
||||
public String getMotoType() {
|
||||
return this.motoType;
|
||||
}
|
||||
|
||||
public void setMotoType(String motoType) {
|
||||
this.motoType = motoType;
|
||||
}
|
||||
|
||||
public String getMotoTypeOperator() {
|
||||
return this.motoTypeOperator;
|
||||
}
|
||||
|
||||
public void setMotoTypeOperator(String motoTypeOperator) {
|
||||
this.motoTypeOperator = motoTypeOperator;
|
||||
}
|
||||
|
||||
public String getOemCode() {
|
||||
return this.oemCode;
|
||||
}
|
||||
|
||||
public void setOemCode(String oemCode) {
|
||||
this.oemCode = oemCode;
|
||||
}
|
||||
|
||||
public String getOemCodeOperator() {
|
||||
return this.oemCodeOperator;
|
||||
}
|
||||
|
||||
public void setOemCodeOperator(String oemCodeOperator) {
|
||||
this.oemCodeOperator = oemCodeOperator;
|
||||
}
|
||||
|
||||
public String getCertNumber() {
|
||||
return this.certNumber;
|
||||
}
|
||||
|
||||
public void setCertNumber(String certNumber) {
|
||||
this.certNumber = certNumber;
|
||||
}
|
||||
|
||||
public String getCertNumberOperator() {
|
||||
return this.certNumberOperator;
|
||||
}
|
||||
|
||||
public void setCertNumberOperator(String certNumberOperator) {
|
||||
this.certNumberOperator = certNumberOperator;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return this.delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlagOperator() {
|
||||
return this.delFlagOperator;
|
||||
}
|
||||
|
||||
public void setDelFlagOperator(String delFlagOperator) {
|
||||
this.delFlagOperator = delFlagOperator;
|
||||
}
|
||||
|
||||
public String getInsertTime() {
|
||||
return this.insertTime;
|
||||
}
|
||||
|
||||
public void setInsertTime(String insertTime) {
|
||||
this.insertTime = insertTime;
|
||||
}
|
||||
|
||||
public String getInsertTime1() {
|
||||
return this.insertTime1;
|
||||
}
|
||||
|
||||
public void setInsertTime1(String insertTime1) {
|
||||
this.insertTime1 = insertTime1;
|
||||
}
|
||||
|
||||
public String getInsertTime2() {
|
||||
return this.insertTime2;
|
||||
}
|
||||
|
||||
public void setInsertTime2(String insertTime2) {
|
||||
this.insertTime2 = insertTime2;
|
||||
}
|
||||
|
||||
public String getInsertTimeOperator() {
|
||||
return this.insertTimeOperator;
|
||||
}
|
||||
|
||||
public void setInsertTimeOperator(String insertTimeOperator) {
|
||||
this.insertTimeOperator = insertTimeOperator;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime1() {
|
||||
return this.updateTime1;
|
||||
}
|
||||
|
||||
public void setUpdateTime1(String updateTime1) {
|
||||
this.updateTime1 = updateTime1;
|
||||
}
|
||||
|
||||
public String getUpdateTime2() {
|
||||
return this.updateTime2;
|
||||
}
|
||||
|
||||
public void setUpdateTime2(String updateTime2) {
|
||||
this.updateTime2 = updateTime2;
|
||||
}
|
||||
|
||||
public String getUpdateTimeOperator() {
|
||||
return this.updateTimeOperator;
|
||||
}
|
||||
|
||||
public void setUpdateTimeOperator(String updateTimeOperator) {
|
||||
this.updateTimeOperator = updateTimeOperator;
|
||||
}
|
||||
|
||||
public String getCorpModel() {
|
||||
return this.corpModel;
|
||||
}
|
||||
|
||||
public void setCorpModel(String corpModel) {
|
||||
this.corpModel = corpModel;
|
||||
}
|
||||
|
||||
public String getCorpModelOperator() {
|
||||
return this.corpModelOperator;
|
||||
}
|
||||
|
||||
public void setCorpModelOperator(String corpModelOperator) {
|
||||
this.corpModelOperator = corpModelOperator;
|
||||
}
|
||||
|
||||
public String getPartSup() {
|
||||
return this.partSup;
|
||||
}
|
||||
|
||||
public void setPartSup(String partSup) {
|
||||
this.partSup = partSup;
|
||||
}
|
||||
|
||||
public String getPartSupOperator() {
|
||||
return this.partSupOperator;
|
||||
}
|
||||
|
||||
public void setPartSupOperator(String partSupOperator) {
|
||||
this.partSupOperator = partSupOperator;
|
||||
}
|
||||
|
||||
public String getQrCodeStatus() {
|
||||
return this.qrCodeStatus;
|
||||
}
|
||||
|
||||
public void setQrCodeStatus(String qrCodeStatus) {
|
||||
this.qrCodeStatus = qrCodeStatus;
|
||||
}
|
||||
|
||||
public String getQrCodeStatusOperator() {
|
||||
return this.qrCodeStatusOperator;
|
||||
}
|
||||
|
||||
public void setQrCodeStatusOperator(String qrCodeStatusOperator) {
|
||||
this.qrCodeStatusOperator = qrCodeStatusOperator;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
package com.adc.da.search.service;
|
||||
|
||||
import com.adc.da.search.entity.EsPage;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ElasticsearchService {
|
||||
|
||||
/**
|
||||
* Elasticsearch 创建索引定义
|
||||
* @param index 要创建的索引
|
||||
* @return true表示创建成功,false表示创建失败
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
boolean createIndex(String index, XContentBuilder mapping);
|
||||
|
||||
/**
|
||||
* Elasticsearch 删除索引定义
|
||||
* @param index 要删除的索引
|
||||
* @return true表示删除成功,false表示删除失败
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
boolean deleteIndex(String index);
|
||||
|
||||
/**
|
||||
* Elasticsearch 判断索引是否存在定义
|
||||
* @param index 要判断的索引名称
|
||||
* @return true表示该索引存在,false表示该索引不存在
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
boolean isIndexExist(String index);
|
||||
|
||||
/**
|
||||
* 指定ID数据添加接口定义,
|
||||
* @param jsonObject 要增加的数据
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
|
||||
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
|
||||
* @param id 数据ID
|
||||
* @return 返回创建的文档的id
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
String addData(JSONObject jsonObject, String index, String type, String id);
|
||||
|
||||
String addDataForMap(Map<String,Object> attrInfoMap, String index, String type, String id);
|
||||
|
||||
/**
|
||||
* 不指定ID数据添加接口定义,
|
||||
* @param jsonObject 要增加的数据
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
|
||||
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
|
||||
* @return 返回创建的文档的id
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
String addData(JSONObject jsonObject, String index, String type);
|
||||
|
||||
/**
|
||||
* 通过ID删除数据定义
|
||||
*
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表
|
||||
* @param id 数据ID
|
||||
* @return 正确删除返回DELETED
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
String deleteDataById(String index, String type, String id);
|
||||
|
||||
/**
|
||||
* Elasticsearch 删除某个index所有的文档接口定义
|
||||
* @param index 要插入的索引
|
||||
* @return 删除返回的结果
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
long deleteAllDataOfIndex(String index);
|
||||
|
||||
/**
|
||||
* 通过ID 更新数据定义
|
||||
*
|
||||
* @param jsonObject 要更新的数据
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表
|
||||
* @param id 数据ID
|
||||
* @return 如果正确删除返回 UPDATED
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
String updateDataById(JSONObject jsonObject, String index, String type, String id);
|
||||
|
||||
String updateDataByIdForMap(Map<String,Object> attrInfoMap, String index, String type, String id);
|
||||
|
||||
/**
|
||||
* 通过ID获取数据定义
|
||||
*
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表
|
||||
* @param id 数据ID
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
Map<String, Object> searchDataById(String index, String type, String id, String fields);
|
||||
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称,可传入多个type逗号分隔
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> searchListData(String index, String type, String fields, String matchStr);
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称,可传入多个type逗号分隔
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> searchListData(String index, String type, String fields, String sortField, boolean matchPhrase, String matchStr);
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称,可传入多个type逗号分隔
|
||||
* @param size 文档大小限制
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param highlightField 高亮字段
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> searchListData(String index, String type, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr);
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称,可传入多个type逗号分隔
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param size 文档大小限制
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param highlightField 高亮字段
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> searchListData(String index, String type, long startTime, long endTime, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr);
|
||||
|
||||
/**
|
||||
* 使用分词查询,并分页
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称,可传入多个type逗号分隔
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页显示条数
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param highlightField 高亮字段
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
EsPage searchDataPage(String index, String type, int currentPage, int pageSize, long startTime, long endTime, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr);
|
||||
|
||||
/**
|
||||
* 高亮结果集 特殊处理
|
||||
*
|
||||
* @param searchResponse
|
||||
* @param highlightField
|
||||
*/
|
||||
List<Map<String, Object>> setSearchResponse(SearchResponse searchResponse, String highlightField);
|
||||
|
||||
/**
|
||||
* Elasticsearch 批量插入接口定义
|
||||
* @param index 要插入的索引
|
||||
* @param type 要插入数据对应的type
|
||||
* @param list 插入数据的list
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
String addBulkData(String index, String type, List<JSONObject> list);
|
||||
|
||||
/**
|
||||
* 默认查询全部数据,并按照对应的字段排序,方法内写了部分基础查询,主要是针对单个field但条件
|
||||
* 具体业务查询可参考方法体中注释代码
|
||||
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
|
||||
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
|
||||
* @param sortfield 需要排序的字段,
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
List<Map<String, Object>> searchListDataAndSort(String[] index, String[] type, String sortfield, String[] fields);
|
||||
|
||||
|
||||
/**
|
||||
* 涉及组合查询条件主要涉及到boolQueryBuilder的使用
|
||||
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
|
||||
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
|
||||
* @param sortfield 需要排序的字段,
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
List<Map<String, Object>> searchListDataUnit(String[] index, String[] type, String sortfield, String[] fields);
|
||||
|
||||
|
||||
/**
|
||||
* 涉及组合查询条件主要涉及到聚合函数的使用,主要是分组求平均值,依靠平均值排序 terms
|
||||
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
|
||||
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
List<Map<String, Object>> searchListDataGroup(String[] index, String[] type);
|
||||
|
||||
|
||||
/**
|
||||
* 涉及组合查询条件主要涉及到聚合函数的使用,较为复杂,按照年龄阶段分组后,再安装性别分组,求balance平均值 ranges
|
||||
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
|
||||
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-29
|
||||
*/
|
||||
List<Map<String, Object>> searchListDataGroupComplex(String[] index, String[] type);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询结果集searchResponse装换成List形式
|
||||
* @param searchResponse 需要转换的数据
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
List<Map<String, Object>> SearchResponseToList(SearchResponse searchResponse);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.adc.da.search.service;
|
||||
|
||||
import com.adc.da.search.entity.CommonSearchInfoEO;
|
||||
import com.adc.da.search.entity.SeniorSearchInfoEO;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface SearchCenterService {
|
||||
|
||||
List<Map<String, Object>> searchSarBykey(SeniorSearchInfoEO searchInfoEO) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询结果集searchResponse装换成List形式
|
||||
* @param searchResponse 需要转换的数据
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
List<Map<String, Object>> SearchResponseToList(SearchResponse searchResponse);
|
||||
|
||||
Map<String, Object> selectGroupdata(SeniorSearchInfoEO searchInfoEO);
|
||||
|
||||
String [] searchIdToImport(SeniorSearchInfoEO searchInfoEO);
|
||||
|
||||
List<Map<String, Object>> searchSarBykeyAndHighLight(SeniorSearchInfoEO searchInfoEO) throws Exception;
|
||||
|
||||
List<Map<String, Object>> searchSarBykeyAndHighLightNumber(SeniorSearchInfoEO searchInfoEO) throws Exception;
|
||||
|
||||
void searchByKey(CommonSearchInfoEO commonSearchInfoEO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.adc.da.search.service;
|
||||
|
||||
|
||||
import com.adc.da.search.entity.StandLawsEO;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface StandLawsSearchService {
|
||||
|
||||
String addStandLawsSearch(StandLawsEO standLawsEO);
|
||||
|
||||
String addStandLawsSearchForMap(Map<String,Object> attrInfoMap);
|
||||
|
||||
// String updateStandLawsSearch(StandLawsEO standLawsEO);
|
||||
|
||||
String updateStandLawsSearchForMap(Map<String,Object> attrInfoMap);
|
||||
|
||||
String deleteStandLawsSearch(StandLawsEO standLawsEO);
|
||||
}
|
||||
+748
@@ -0,0 +1,748 @@
|
||||
package com.adc.da.search.service.impl;
|
||||
|
||||
import com.adc.da.search.entity.EsPage;
|
||||
import com.adc.da.search.service.ElasticsearchService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.get.GetRequestBuilder;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.SearchType;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.text.Text;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.reindex.BulkByScrollResponse;
|
||||
import org.elasticsearch.index.reindex.DeleteByQueryAction;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.Max;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class ElasticsearchServiceImpl implements ElasticsearchService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ElasticsearchServiceImpl.class);
|
||||
@Autowired
|
||||
private TransportClient transportClient;
|
||||
|
||||
private TransportClient client;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
client = this.transportClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Elasticsearch 创建索引实现
|
||||
* @param index 要创建的索引
|
||||
* @return true表示创建成功,false表示创建失败
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
@Override
|
||||
public boolean createIndex(String index ,XContentBuilder mapping){
|
||||
if (!isIndexExist(index)) {
|
||||
logger.info("Index is not exits!");
|
||||
}
|
||||
CreateIndexRequestBuilder cib=client.admin().indices().prepareCreate(index);
|
||||
cib.addMapping(index, mapping);
|
||||
CreateIndexResponse indexresponse = cib.execute().actionGet();
|
||||
logger.info("执行建立成功?" + indexresponse.isAcknowledged());
|
||||
return indexresponse.isAcknowledged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Elasticsearch 删除索引实现
|
||||
* @param index 要删除的索引
|
||||
* @return true表示删除成功,false表示删除失败
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteIndex(String index) {
|
||||
if (!isIndexExist(index)) {
|
||||
logger.info("Index is not exits!");
|
||||
}
|
||||
DeleteIndexResponse dResponse = client.admin().indices().prepareDelete(index).get();
|
||||
if (dResponse.isAcknowledged()) {
|
||||
logger.info("delete index " + index + " successfully!");
|
||||
} else {
|
||||
logger.info("Fail to delete index " + index);
|
||||
}
|
||||
return dResponse.isAcknowledged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Elasticsearch 判断索引是否存在实现
|
||||
* @param index 要判断的索引名称
|
||||
* @return true表示该索引存在,false表示该索引不存在
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public boolean isIndexExist(String index) {
|
||||
IndicesExistsResponse inExistsResponse = client.admin().indices().exists(new IndicesExistsRequest(index)).actionGet();
|
||||
if (inExistsResponse.isExists()) {
|
||||
logger.info("Index [" + index + "] is exist!");
|
||||
} else {
|
||||
logger.info("Index [" + index + "] is not exist!");
|
||||
}
|
||||
return inExistsResponse.isExists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定ID数据添加接口实现,
|
||||
* @param jsonObject 要增加的数据
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
|
||||
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
|
||||
* @param id 数据ID
|
||||
* @return 返回创建的文档的id
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public String addData(JSONObject jsonObject, String index, String type, String id) {
|
||||
IndexResponse response = client.prepareIndex(index, type, id).setSource(jsonObject).get();
|
||||
logger.info("addData response status:{},id:{}", response.status().getStatus(), response.getId());
|
||||
return response.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addDataForMap(Map<String,Object> attrInfoMap, String index, String type, String id) {
|
||||
IndexResponse response = client.prepareIndex(index, type, id).setSource(attrInfoMap).get();
|
||||
logger.info("addData response status:{},id:{}", response.status().getStatus(), response.getId());
|
||||
return response.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 不指定ID数据添加接口实现,
|
||||
* @param jsonObject 要增加的数据
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
|
||||
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
|
||||
* @return 返回创建的文档的id
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public String addData(JSONObject jsonObject, String index, String type) {
|
||||
IndexResponse response = client.prepareIndex(index, type).setSource(jsonObject).get();
|
||||
logger.info("addData response status:{},id:{}", response.status().getStatus(), response.getId());
|
||||
return response.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID删除数据实现
|
||||
*
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表
|
||||
* @param id 数据ID
|
||||
* @return 正确删除返回DELETED
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public String deleteDataById(String index, String type, String id) {
|
||||
DeleteResponse response = client.prepareDelete(index, type, id).get();
|
||||
logger.info("deleteDataById response status:{},id:{}", response.status().getStatus(), response.getId());
|
||||
return response.getResult().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Elasticsearch 删除某个index所有的文档接口实现
|
||||
* @param index 要插入的索引
|
||||
* @return 删除返回的结果,一共删除多少条
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
@Override
|
||||
public long deleteAllDataOfIndex(String index) {
|
||||
BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client)
|
||||
.filter(QueryBuilders.matchAllQuery())
|
||||
.source(index)
|
||||
.get();
|
||||
//一共删除掉多少条
|
||||
long deleted = response.getDeleted();
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID 更新数据实现
|
||||
*
|
||||
* @param jsonObject 要更新的数据
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表
|
||||
* @param id 数据ID
|
||||
* @return 如果正确删除返回 UPDATED
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public String updateDataById(JSONObject jsonObject, String index, String type, String id) {
|
||||
UpdateRequest updateRequest = new UpdateRequest();
|
||||
updateRequest.index(index).type(type).id(id).doc(jsonObject);
|
||||
UpdateResponse result;
|
||||
try {
|
||||
result = this.client.update(updateRequest).get();
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
return e.getMessage();
|
||||
}
|
||||
return result.getResult().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateDataByIdForMap(Map<String,Object> attrInfoMap, String index, String type, String id) {
|
||||
UpdateRequest updateRequest = new UpdateRequest();
|
||||
updateRequest.index(index).type(type).id(id).doc(attrInfoMap);
|
||||
UpdateResponse result;
|
||||
try {
|
||||
result = this.client.update(updateRequest).get();
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
return e.getMessage();
|
||||
}
|
||||
return result.getResult().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID获取数据实现
|
||||
*
|
||||
* @param index 索引,类似数据库
|
||||
* @param type 类型,类似表
|
||||
* @param id 数据ID
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @return Map结构的数据集
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> searchDataById(String index, String type, String id, String fields) {
|
||||
|
||||
GetRequestBuilder getRequestBuilder = client.prepareGet(index, type, id);
|
||||
if (StringUtils.isNotEmpty(fields)) {
|
||||
getRequestBuilder.setFetchSource(fields.split(","), null);
|
||||
}
|
||||
GetResponse getResponse = getRequestBuilder.get();
|
||||
return getResponse.getSource();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListData(String index, String type, String fields, String matchStr) {
|
||||
return searchListData(index, type, 0, 0, null, fields, null, false, null, matchStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListData(String index, String type, String fields, String sortField, boolean matchPhrase, String matchStr) {
|
||||
return searchListData(index, type, 0, 0, null, fields, sortField, matchPhrase, null, matchStr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称
|
||||
* @param size 文档大小限制
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param highlightField 高亮字段
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListData(String index, String type, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr) {
|
||||
return searchListData(index, type, 0, 0, size, fields, sortField, matchPhrase, highlightField, matchStr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用分词查询
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param size 文档大小限制
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param highlightField 高亮字段
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListData(String index, String type, long startTime, long endTime, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr) {
|
||||
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index);
|
||||
if (StringUtils.isNotEmpty(type)) {
|
||||
searchRequestBuilder.setTypes(type.split(","));
|
||||
}
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
|
||||
if (startTime > 0 && endTime > 0) {
|
||||
boolQuery.must(QueryBuilders.rangeQuery("processTime")
|
||||
.format("epoch_millis")
|
||||
.from(startTime)
|
||||
.to(endTime)
|
||||
.includeLower(true)
|
||||
.includeUpper(true));
|
||||
}
|
||||
|
||||
//搜索的的字段
|
||||
if (StringUtils.isNotEmpty(matchStr)) {
|
||||
for (String s : matchStr.split(",")) {
|
||||
String[] ss = s.split("=");
|
||||
if (ss.length > 1) {
|
||||
if (matchPhrase == Boolean.TRUE) {
|
||||
boolQuery.must(QueryBuilders.matchPhraseQuery(s.split("=")[0], s.split("=")[1]));
|
||||
} else {
|
||||
boolQuery.must(QueryBuilders.matchQuery(s.split("=")[0], s.split("=")[1]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 高亮(xxx=111,aaa=222)
|
||||
if (StringUtils.isNotEmpty(highlightField)) {
|
||||
HighlightBuilder highlightBuilder = new HighlightBuilder();
|
||||
|
||||
//highlightBuilder.preTags("<span style='color:red' >");//设置前缀
|
||||
//highlightBuilder.postTags("</span>");//设置后缀
|
||||
|
||||
// 设置高亮字段
|
||||
highlightBuilder.field(highlightField);
|
||||
searchRequestBuilder.highlighter(highlightBuilder);
|
||||
}
|
||||
|
||||
|
||||
searchRequestBuilder.setQuery(boolQuery);
|
||||
|
||||
if (StringUtils.isNotEmpty(fields)) {
|
||||
searchRequestBuilder.setFetchSource(fields.split(","), null);
|
||||
}
|
||||
searchRequestBuilder.setFetchSource(true);
|
||||
|
||||
if (StringUtils.isNotEmpty(sortField)) {
|
||||
searchRequestBuilder.addSort(sortField, SortOrder.DESC);
|
||||
}
|
||||
|
||||
if (size != null && size > 0) {
|
||||
searchRequestBuilder.setSize(size);
|
||||
}
|
||||
|
||||
//打印的内容 可以在 Elasticsearch head 和 Kibana 上执行查询
|
||||
logger.info("\n{}", searchRequestBuilder);
|
||||
|
||||
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
|
||||
|
||||
long totalHits = searchResponse.getHits().totalHits;
|
||||
long length = searchResponse.getHits().getHits().length;
|
||||
|
||||
logger.info("共查询到[{}]条数据,处理数据条数[{}]", totalHits, length);
|
||||
|
||||
if (searchResponse.status().getStatus() == 200) {
|
||||
// 解析对象
|
||||
return setSearchResponse(searchResponse, highlightField);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用分词查询,并分页
|
||||
*
|
||||
* @param index 索引名称
|
||||
* @param type 类型名称,可传入多个type逗号分隔
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页显示条数
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
* @param sortField 排序字段
|
||||
* @param matchPhrase true 使用,短语精准匹配
|
||||
* @param highlightField 高亮字段
|
||||
* @param matchStr 过滤条件(xxx=111,aaa=222)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public EsPage searchDataPage(String index, String type, int currentPage, int pageSize, long startTime, long endTime, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr) {
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index);
|
||||
if (StringUtils.isNotEmpty(type)) {
|
||||
searchRequestBuilder.setTypes(type.split(","));
|
||||
}
|
||||
searchRequestBuilder.setSearchType(SearchType.QUERY_THEN_FETCH);
|
||||
|
||||
// 需要显示的字段,逗号分隔(缺省为全部字段)
|
||||
if (StringUtils.isNotEmpty(fields)) {
|
||||
searchRequestBuilder.setFetchSource(fields.split(","), null);
|
||||
}
|
||||
|
||||
//排序字段
|
||||
if (StringUtils.isNotEmpty(sortField)) {
|
||||
searchRequestBuilder.addSort(sortField, SortOrder.DESC);
|
||||
}
|
||||
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
|
||||
if (startTime > 0 && endTime > 0) {
|
||||
boolQuery.must(QueryBuilders.rangeQuery("processTime")
|
||||
.format("epoch_millis")
|
||||
.from(startTime)
|
||||
.to(endTime)
|
||||
.includeLower(true)
|
||||
.includeUpper(true));
|
||||
}
|
||||
|
||||
// 查询字段
|
||||
if (StringUtils.isNotEmpty(matchStr)) {
|
||||
for (String s : matchStr.split(",")) {
|
||||
String[] ss = s.split("=");
|
||||
if (matchPhrase == Boolean.TRUE) {
|
||||
boolQuery.must(QueryBuilders.matchPhraseQuery(s.split("=")[0], s.split("=")[1]));
|
||||
} else {
|
||||
boolQuery.must(QueryBuilders.matchQuery(s.split("=")[0], s.split("=")[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 高亮(xxx=111,aaa=222)
|
||||
if (StringUtils.isNotEmpty(highlightField)) {
|
||||
HighlightBuilder highlightBuilder = new HighlightBuilder();
|
||||
|
||||
//highlightBuilder.preTags("<span style='color:red' >");//设置前缀
|
||||
//highlightBuilder.postTags("</span>");//设置后缀
|
||||
|
||||
// 设置高亮字段
|
||||
highlightBuilder.field(highlightField);
|
||||
searchRequestBuilder.highlighter(highlightBuilder);
|
||||
}
|
||||
|
||||
searchRequestBuilder.setQuery(QueryBuilders.matchAllQuery());
|
||||
searchRequestBuilder.setQuery(boolQuery);
|
||||
|
||||
// 分页应用
|
||||
searchRequestBuilder.setFrom(currentPage).setSize(pageSize);
|
||||
|
||||
// 设置是否按查询匹配度排序
|
||||
searchRequestBuilder.setExplain(true);
|
||||
|
||||
//打印的内容 可以在 Elasticsearch head 和 Kibana 上执行查询
|
||||
logger.info("\n{}", searchRequestBuilder);
|
||||
|
||||
// 执行搜索,返回搜索响应信息
|
||||
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
|
||||
|
||||
long totalHits = searchResponse.getHits().totalHits;
|
||||
long length = searchResponse.getHits().getHits().length;
|
||||
|
||||
logger.debug("共查询到[{}]条数据,处理数据条数[{}]", totalHits, length);
|
||||
|
||||
if (searchResponse.status().getStatus() == 200) {
|
||||
// 解析对象
|
||||
List<Map<String, Object>> sourceList = setSearchResponse(searchResponse, highlightField);
|
||||
|
||||
return new EsPage(currentPage, pageSize, (int) totalHits, sourceList);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 高亮结果集 特殊处理
|
||||
*
|
||||
* @param searchResponse
|
||||
* @param highlightField
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> setSearchResponse(SearchResponse searchResponse, String highlightField) {
|
||||
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
for (SearchHit searchHit : searchResponse.getHits().getHits()) {
|
||||
searchHit.getSourceAsMap().put("id", searchHit.getId());
|
||||
|
||||
if (StringUtils.isNotEmpty(highlightField)) {
|
||||
logger.debug("遍历 高亮结果集,覆盖 正常结果集" + searchHit.getSourceAsMap());
|
||||
Text[] text = searchHit.getHighlightFields().get(highlightField).getFragments();
|
||||
|
||||
if (text != null) {
|
||||
for (Text str : text) {
|
||||
stringBuffer.append(str.string());
|
||||
}
|
||||
//遍历 高亮结果集,覆盖 正常结果集
|
||||
searchHit.getSourceAsMap().put(highlightField, stringBuffer.toString());
|
||||
}
|
||||
}
|
||||
sourceList.add(searchHit.getSourceAsMap());
|
||||
}
|
||||
return sourceList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Elasticsearch 批量插入接口实现
|
||||
* @param index
|
||||
* @param type
|
||||
* @param list
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-27
|
||||
*/
|
||||
@Override
|
||||
public String addBulkData(String index, String type, List<JSONObject> list) {
|
||||
BulkRequestBuilder bulkRequestBuilder = client.prepareBulk();
|
||||
for(int i=0;i<list.size();i++){
|
||||
IndexRequestBuilder indexRequestBuilder = client.prepareIndex(index, type, UUID.randomUUID().toString()).setSource(list.get(i));
|
||||
bulkRequestBuilder.add(indexRequestBuilder);
|
||||
}
|
||||
BulkResponse response = bulkRequestBuilder.get();
|
||||
/* for (BulkItemResponse respons : response) {
|
||||
respons.getResponse().getResult().equals("created");
|
||||
}*/
|
||||
return "success";
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认查询全部数据,并按照对应的字段排序,方法内写了部分基础查询,具体业务查询可参考方法体中注释代码
|
||||
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
|
||||
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
|
||||
* @param sortfield 需要排序的字段,
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-28
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListDataAndSort( String[] index,String[] type,String sortfield,String[] fields) {
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index)
|
||||
.setTypes(type)
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
//设置全文搜索
|
||||
//.setQuery(QueryBuilders.matchAllQuery())
|
||||
//设置某个field的搜索条件项,此处是模糊搜索;text:mill ,搜索address中含有关键字 mill;text:mill lane,搜索address中含有关键字mill或者lane的
|
||||
//.setQuery(QueryBuilders.matchQuery("address","mill lane"))
|
||||
//使用matchPhraseQuery过程中,当text:mill lane ,搜索address中即含有关键字mill lane,mill lane 词组不会被拆分,作为一个整体当做查询条件。
|
||||
.setQuery(QueryBuilders.matchPhraseQuery("address","lane mill"));
|
||||
//如果需要按照多个字段排序,直接依次添加addSort
|
||||
//.addSort(sortfield,SortOrder.DESC)
|
||||
//设置查询数量
|
||||
//.setSize(60)
|
||||
//设置从第几个开始查
|
||||
//.setFrom(0)
|
||||
//设置要查询的字段,fields
|
||||
//.setFetchSource(fields,null)
|
||||
/*.setPostFilter(QueryBuilders.rangeQuery("age").from(12).to(18)) // Filter
|
||||
.setExplain(true);*/
|
||||
SearchResponse response = searchRequestBuilder.get();
|
||||
List<Map<String, Object>> result = SearchResponseToList(response);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListDataUnit(String[] index, String[] type, String sortfield, String[] fields) {
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index)
|
||||
.setTypes(type)
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
|
||||
|
||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||
|
||||
//boolQueryBuilder两次.must ,如下,表示address中必须包含lane和mill
|
||||
//boolQueryBuilder.must(QueryBuilders.matchQuery("address","lane"));
|
||||
//boolQueryBuilder.must(QueryBuilders.matchQuery("address","mill"));
|
||||
|
||||
//boolQueryBuilder两次.should ,如下,表示address中必须包含lane或者mill
|
||||
//boolQueryBuilder.should(QueryBuilders.matchQuery("address","lane"));
|
||||
//boolQueryBuilder.should(QueryBuilders.matchQuery("address","mill"));
|
||||
|
||||
//boolQueryBuilder两次.mustNot ,如下,表示address中必须不能包含lane和mill
|
||||
//boolQueryBuilder.mustNot(QueryBuilders.matchQuery("address","lane"));
|
||||
//boolQueryBuilder.mustNot(QueryBuilders.matchQuery("address","mill"));
|
||||
|
||||
//BoolQuerBuilder 可以使用must,should,mustnot 组合使用
|
||||
//boolQueryBuilder.mustNot(QueryBuilders.matchQuery("state","ID"));
|
||||
//boolQueryBuilder.must(QueryBuilders.matchQuery("age",40));
|
||||
//boolQueryBuilder.must(QueryBuilders.matchQuery("balance",28969));
|
||||
|
||||
//boolQueryBuilder.filter中可以添加RangeQueryBuilder,下面注释中两种定义的RangeQueryBuilder是一样的,不同的两种方式
|
||||
//RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery("balance").from(20000).to(30000).includeLower(true).includeUpper(true);
|
||||
//RangeQueryBuilder rangeQueryBuilder2 = QueryBuilders.rangeQuery("age").gte(20).lte(23);
|
||||
//boolQueryBuilder.filter(rangeQueryBuilder);
|
||||
//boolQueryBuilder.filter(rangeQueryBuilder2);
|
||||
|
||||
searchRequestBuilder.setQuery(boolQueryBuilder);
|
||||
SearchResponse response = searchRequestBuilder.get();
|
||||
List<Map<String, Object>> result = SearchResponseToList(response);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 涉及组合查询条件主要涉及到聚合函数的使用,主要是分组求平均值,依靠平均值排序
|
||||
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
|
||||
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-29
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListDataGroup(String[] index, String[] type) {
|
||||
SearchResponse sr = client.prepareSearch(index)
|
||||
.setTypes(type)
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.addAggregation(
|
||||
//分组依靠关键字terms
|
||||
AggregationBuilders.terms("by_state")
|
||||
.field("state.keyword")
|
||||
.subAggregation(
|
||||
//分组后求平均值依靠关键字avg,其他具体聚合函数可以参考官网
|
||||
// https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_metrics_aggregations.html
|
||||
AggregationBuilders.avg("average_balance")
|
||||
.field("balance")
|
||||
)
|
||||
//分组后的排序方法,分别是聚合函数平均值,分组后统计数据,分组后关键字key,根据需求选择合适的排序
|
||||
.order(BucketOrder.aggregation("average_balance",false))
|
||||
.order(BucketOrder.count(true))
|
||||
.order(BucketOrder.key(true))
|
||||
)
|
||||
.execute()
|
||||
.actionGet();
|
||||
//分组后得到的数据整合
|
||||
StringTerms result = sr.getAggregations().get("by_state");
|
||||
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
|
||||
for (StringTerms.Bucket bucket : result.getBuckets()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("key",bucket.getKeyAsString());
|
||||
map.put("count",bucket.getDocCount());
|
||||
Avg avg = bucket.getAggregations().get("average_balance");
|
||||
map.put("averagebalance",avg.getValue());
|
||||
sourceList.add(map);
|
||||
}
|
||||
return sourceList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 涉及组合查询条件主要涉及到聚合函数的使用,较为复杂,按照年龄阶段分组后,再安装性别分组,求balance平均值 ranges
|
||||
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
|
||||
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
|
||||
* @return
|
||||
* @author gaoyan
|
||||
* date 2018-08-29
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> searchListDataGroupComplex(String[] index, String[] type) {
|
||||
SearchResponse sr = client.prepareSearch(index)
|
||||
.setTypes(type)
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.addAggregation(
|
||||
//分组依靠关键字range
|
||||
AggregationBuilders.range("by_age")
|
||||
.field("age")
|
||||
.addRange(20,30)
|
||||
.addRange(30,40)
|
||||
.addRange(40,50)
|
||||
.subAggregation(
|
||||
//分组依靠关键字terms
|
||||
AggregationBuilders.terms("by_gender")
|
||||
.field("gender.keyword")
|
||||
.subAggregation(
|
||||
//分组后求依靠关键字avg,其他具体聚合函数可以参考官网
|
||||
// https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_metrics_aggregations.html
|
||||
AggregationBuilders.max("max_balance")
|
||||
.field("balance")
|
||||
)
|
||||
)
|
||||
)
|
||||
.execute()
|
||||
.actionGet();
|
||||
//分组后得到的数据整合
|
||||
Range result = sr.getAggregations().get("by_age");
|
||||
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
|
||||
for (Range.Bucket bucket : result.getBuckets()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("key",bucket.getKeyAsString());
|
||||
map.put("count",bucket.getDocCount());
|
||||
|
||||
List<Map<String, Object>> sourcechildList = new ArrayList<Map<String, Object>>();
|
||||
StringTerms resultchild = bucket.getAggregations().get("by_gender");
|
||||
for (StringTerms.Bucket bucketchild : resultchild.getBuckets()) {
|
||||
Map<String, Object> childmap = new HashMap<>();
|
||||
childmap.put("key",bucketchild.getKeyAsString());
|
||||
childmap.put("count",bucketchild.getDocCount());
|
||||
Max max = bucketchild.getAggregations().get("max_balance");
|
||||
map.put("maxbalance",max.getValue());
|
||||
sourcechildList.add(childmap);
|
||||
}
|
||||
|
||||
map.put("gender",sourcechildList);
|
||||
sourceList.add(map);
|
||||
}
|
||||
return sourceList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> SearchResponseToList(SearchResponse searchResponse) {
|
||||
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
|
||||
for (SearchHit searchHit : searchResponse.getHits().getHits()) {
|
||||
searchHit.getSourceAsMap().put("id", searchHit.getId());
|
||||
sourceList.add(searchHit.getSourceAsMap());
|
||||
}
|
||||
return sourceList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1313
File diff suppressed because it is too large
Load Diff
+490
@@ -0,0 +1,490 @@
|
||||
package com.adc.da.search.service.impl;
|
||||
|
||||
import com.adc.da.search.entity.FullTextSearchEO;
|
||||
import com.adc.da.search.entity.StandLawsEO;
|
||||
import com.adc.da.search.service.ElasticsearchService;
|
||||
import com.adc.da.search.service.StandLawsSearchService;
|
||||
import com.adc.da.util.DateUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(StandLawsSearchServiceImpl.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private TransportClient transportClient;
|
||||
|
||||
private TransportClient client;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
client = this.transportClient;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ElasticsearchService elasticsearchService;
|
||||
|
||||
@Override
|
||||
public String addStandLawsSearch(StandLawsEO standLawsEO) {
|
||||
String indexstate = "";
|
||||
//if(elasticsearchService.isIndexExist(standLawsEO.getType())){
|
||||
indexstate = elasticsearchService.addData((JSONObject) JSON.toJSON(standLawsEO),standLawsEO.getType(),standLawsEO.getType(),standLawsEO.getId());
|
||||
// 方便全文检索,重新建索引
|
||||
FullTextSearchEO fullTextSearchEO =getFullTextSearch(standLawsEO);
|
||||
indexstate = elasticsearchService.addData((JSONObject) JSON.toJSON(fullTextSearchEO),"fulltextserch","fulltextserch",fullTextSearchEO.getId());
|
||||
return indexstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addStandLawsSearchForMap(Map<String,Object> attrInfoMap) {
|
||||
String indexstate = "";
|
||||
String type = String.valueOf(attrInfoMap.get("type"));
|
||||
indexstate = elasticsearchService.addDataForMap(attrInfoMap,type,type,String.valueOf(attrInfoMap.get("id")));
|
||||
if ("stand".equals(type) || "laws".equals(type) || "bussstand".equals(type)) {
|
||||
// 方便全文检索,重新建索引
|
||||
Map<String,Object> fullTextSearchEO =getFullTextSearchForMap(attrInfoMap);
|
||||
indexstate = elasticsearchService.addDataForMap(fullTextSearchEO,"fulltextserch","fulltextserch",String.valueOf(fullTextSearchEO.get("id")));
|
||||
}
|
||||
|
||||
return indexstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateStandLawsSearchForMap(Map<String,Object> attrInfoMap){
|
||||
Set<String> keys = attrInfoMap.keySet();
|
||||
for (String key:keys) {
|
||||
String value = String.valueOf(attrInfoMap.get(key));
|
||||
if (StringUtils.isNotBlank(value) && !"null".equals(value)){
|
||||
value = value.replace(","," , ");
|
||||
attrInfoMap.put(key,value);
|
||||
}
|
||||
}
|
||||
String result = "";
|
||||
// 先判断索引是否存在
|
||||
String type = String.valueOf(attrInfoMap.get("type"));
|
||||
String id = String.valueOf(attrInfoMap.get("id"));
|
||||
if(elasticsearchService.isIndexExist(type)){
|
||||
Map<String, Object> indexstate = elasticsearchService.searchDataById(type,type,id,null);
|
||||
if(indexstate == null || indexstate.isEmpty()){
|
||||
result = elasticsearchService.addDataForMap(attrInfoMap,type,type,id);
|
||||
} else {
|
||||
result = elasticsearchService.updateDataByIdForMap(attrInfoMap,type,type,id);
|
||||
}
|
||||
} else {
|
||||
result = elasticsearchService.addDataForMap(attrInfoMap,type,type,id);
|
||||
}
|
||||
if ("stand".equals(type) || "laws".equals(type) || "bussstand".equals(type)) {
|
||||
// 方便全文检索,重新建索引
|
||||
Map<String,Object> fullTextSearchEO =getFullTextSearchForMap(attrInfoMap);
|
||||
if(elasticsearchService.isIndexExist("fulltextserch")){
|
||||
Map<String, Object> indexstate = elasticsearchService.searchDataById("fulltextserch","fulltextserch",id,null);
|
||||
if(indexstate == null || indexstate.isEmpty()){
|
||||
result = elasticsearchService.addDataForMap(fullTextSearchEO,"fulltextserch","fulltextserch",id);
|
||||
} else {
|
||||
result = elasticsearchService.updateDataByIdForMap(fullTextSearchEO,"fulltextserch","fulltextserch",id);
|
||||
}
|
||||
} else {
|
||||
result = elasticsearchService.updateDataByIdForMap(fullTextSearchEO,"fulltextserch","fulltextserch",id);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String deleteStandLawsSearch(StandLawsEO standLawsEO){
|
||||
String result = "";
|
||||
// 先判断索引是否存在
|
||||
if(elasticsearchService.isIndexExist(standLawsEO.getType())){
|
||||
Map<String, Object> indexstate = elasticsearchService.searchDataById(standLawsEO.getType(),standLawsEO.getType(),standLawsEO.getId(),null);
|
||||
if(indexstate != null && !indexstate.isEmpty()){
|
||||
result = elasticsearchService.deleteDataById(standLawsEO.getType(),standLawsEO.getType(),standLawsEO.getId());
|
||||
}
|
||||
}
|
||||
if(elasticsearchService.isIndexExist("fulltextserch")){
|
||||
Map<String, Object> indexstate = elasticsearchService.searchDataById("fulltextserch","fulltextserch",standLawsEO.getId(),null);
|
||||
if(indexstate != null && !indexstate.isEmpty()){
|
||||
result = elasticsearchService.deleteDataById("fulltextserch","fulltextserch",standLawsEO.getId());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Map<String,Object> getFullTextSearchForMap(Map<String,Object> attrInfoMap){
|
||||
boolean isForeign = false;
|
||||
Map<String,Object> fullTextSearchEO = new HashMap<>();
|
||||
fullTextSearchEO.put("id",String.valueOf(attrInfoMap.get("id")));
|
||||
if ("FOREIGN".equals(String.valueOf(attrInfoMap.get("standType")))){
|
||||
fullTextSearchEO.put("indexType",String.valueOf(attrInfoMap.get("standType")));
|
||||
isForeign = true;
|
||||
}else {
|
||||
fullTextSearchEO.put("indexType", String.valueOf(attrInfoMap.get("type")));
|
||||
}
|
||||
if("stand".equals(attrInfoMap.get("type"))){
|
||||
// 标准全文
|
||||
fullTextSearchEO.put("title",attrInfoMap.get("numbershow")+" "+attrInfoMap.get("nameshow"));
|
||||
|
||||
for (String key : attrInfoMap.keySet()) {
|
||||
if (null == attrInfoMap.get(key) || "".equals(attrInfoMap.get(key))){
|
||||
attrInfoMap.put(key, "null");
|
||||
}
|
||||
}
|
||||
// fullTextSearchEO.put("issueTime",attrInfoMap.get("issueTime"));
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
// contentBuilder.append("区域:东亚 ");
|
||||
if (!isForeign) {
|
||||
contentBuilder.append("适用区域:").append(attrInfoMap.get("countryShow")).append(" ");
|
||||
}
|
||||
contentBuilder.append("标准状态:").append(attrInfoMap.get("standstateshow")).append(" ");
|
||||
//
|
||||
contentBuilder.append("纳入标准法规清单的国家/地区: ").append(attrInfoMap.get("accessCountry")).append(" ");
|
||||
contentBuilder.append("标准类别: ").append(attrInfoMap.get("standSortShow")).append(" ");
|
||||
contentBuilder.append("标准号: ").append(attrInfoMap.get("numbershow")).append(" ");
|
||||
contentBuilder.append("标准名称: ").append(attrInfoMap.get("nameshow")).append(" ");
|
||||
contentBuilder.append("标准英文名称: ").append(attrInfoMap.get("standEnName")).append(" ");
|
||||
// contentBuilder.append("发布日期:"+attrInfoMap.get("issueTime")+" ");
|
||||
contentBuilder.append("覆盖关系: ").append(attrInfoMap.get("FGXXSXXXShow")).append(" ");
|
||||
contentBuilder.append("代替标准编号: ").append(attrInfoMap.get("DTBJH")).append(" ");
|
||||
if (StringUtils.isBlank(String.valueOf(attrInfoMap.get("BDTBH")))){
|
||||
contentBuilder.append("被代替标准编号: ").append(attrInfoMap.get("BDTBH")).append(" ");
|
||||
}else {
|
||||
contentBuilder.append("被代替标准编号: ").append(attrInfoMap.get("BDTBZBH")).append(" ");
|
||||
}
|
||||
contentBuilder.append("对应其他标准: ").append(attrInfoMap.get("CBBH")).append(" ");
|
||||
contentBuilder.append("引用标准: ").append(attrInfoMap.get("YYBJ")).append(" ");
|
||||
contentBuilder.append("被引用标准: ").append(attrInfoMap.get("BYYBJ")).append(" ");
|
||||
if (isForeign){
|
||||
contentBuilder.append("等效标准: ").append(attrInfoMap.get("DXBZ"));
|
||||
}
|
||||
contentBuilder.append("相关流程: ").append(attrInfoMap.get("XGLC")).append(" ");
|
||||
contentBuilder.append("参会记录: ").append(attrInfoMap.get("CHJL")).append(" ");
|
||||
|
||||
contentBuilder.append("文本说明: ").append(attrInfoMap.get("synopsis")).append(" ");
|
||||
contentBuilder.append("重要度: ").append(attrInfoMap.get("isRelateAccess")).append(" ");
|
||||
if (!isForeign) {
|
||||
contentBuilder.append("归口管理部门: ").append(attrInfoMap.get("GKDWShow")).append(" ");
|
||||
}
|
||||
if (!isForeign) {
|
||||
contentBuilder.append("我司参与深度: ").append(attrInfoMap.get("CYSDShow")).append(" ");
|
||||
}
|
||||
if (!isForeign) {
|
||||
contentBuilder.append("组织标准起草的执行机构/单位: ").append(attrInfoMap.get("FBJGShow")).append(" ");
|
||||
}
|
||||
contentBuilder.append("监管类型: ").append(attrInfoMap.get("ZRLXShow")).append(" ");
|
||||
contentBuilder.append("适用车辆类型: ").append(attrInfoMap.get("CLLXShow")).append(" ");
|
||||
contentBuilder.append("标签: ").append(attrInfoMap.get("GXHBQShow")).append(" ");
|
||||
if (!isForeign) {
|
||||
contentBuilder.append("工作组信息: ").append(attrInfoMap.get("GZZXXName")).append(" ");
|
||||
}
|
||||
contentBuilder.append("要求类型: ").append(attrInfoMap.get("YQLXShow")).append(" ");
|
||||
contentBuilder.append("新车型实施日期(文本): ").append(attrInfoMap.get("XCXSSRQ")).append(" ");
|
||||
contentBuilder.append("在产车实施日期(文本): ").append(attrInfoMap.get("ZCCSSRQ")).append(" ");
|
||||
contentBuilder.append("EOP实施日期(文本): ").append(attrInfoMap.get("EOPSSRQ")).append(" ");
|
||||
contentBuilder.append("法规维护人: ").append(attrInfoMap.get("FGWHRName")).append(" ");
|
||||
contentBuilder.append("责任部门: ").append(attrInfoMap.get("ZRBMShow")).append(" ");
|
||||
contentBuilder.append("相关部门: ").append(attrInfoMap.get("XGBMShow")).append(" ");
|
||||
contentBuilder.append("SVPPS: ").append(attrInfoMap.get("SVPPSName")).append(" ");
|
||||
contentBuilder.append("FO: ").append(attrInfoMap.get("FOShow")).append(" ");
|
||||
contentBuilder.append("项目评估角色: ").append(attrInfoMap.get("XMPGJSShow")).append(" ");
|
||||
if (attrInfoMap.containsKey("content")){
|
||||
if (null !=attrInfoMap.get("content") && StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("content")))){
|
||||
String con = String.valueOf(attrInfoMap.get("content"));
|
||||
con = con.replace(",","");
|
||||
if (StringUtils.isBlank(con)){
|
||||
attrInfoMap.put("content","--");
|
||||
}
|
||||
}
|
||||
}
|
||||
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.put("textContent",textContent.toString());
|
||||
if (null != attrInfoMap.get("issueTime") && !"".equals(attrInfoMap.get("issueTime")) && !"null".equals(attrInfoMap.get("issueTime"))) {
|
||||
fullTextSearchEO.put("issue_time", attrInfoMap.get("issueTime"));
|
||||
}else {
|
||||
fullTextSearchEO.put("issue_time", "--");
|
||||
}
|
||||
} else if("laws".equals(attrInfoMap.get("type"))){
|
||||
// 政策全文
|
||||
for (String key : attrInfoMap.keySet()) {
|
||||
if (null == attrInfoMap.get(key) || "".equals(attrInfoMap.get(key))){
|
||||
attrInfoMap.put(key, "null");
|
||||
}
|
||||
}
|
||||
fullTextSearchEO.put("title",attrInfoMap.get("numbershow")+" "+attrInfoMap.get("nameshow"));
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
contentBuilder.append("适用区域: ").append(attrInfoMap.get("countryShow")).append(" ");
|
||||
contentBuilder.append("政策状态: ").append(attrInfoMap.get("standstateshow")).append(" ");
|
||||
contentBuilder.append("政策号: ").append(attrInfoMap.get("numbershow")).append(" ");
|
||||
contentBuilder.append("政策名称: ").append(attrInfoMap.get("nameshow")).append(" ");
|
||||
contentBuilder.append("英文名称: ").append(attrInfoMap.get("standEnName")).append(" ");
|
||||
// contentBuilder.append("发布日期:"+attrInfoMap.get("issueTime")+" ");
|
||||
contentBuilder.append("纳入标准法规清单的国家/地区: ").append(attrInfoMap.get("accessCountry")).append(" ");
|
||||
contentBuilder.append("代替政策编号: ").append(attrInfoMap.get("replaceLawsNum")).append(" ");
|
||||
contentBuilder.append("重要度: ").append(attrInfoMap.get("isRelateAccess")).append(" ");
|
||||
contentBuilder.append("要求类型: ").append(attrInfoMap.get("YQLXShow")).append(" ");
|
||||
contentBuilder.append("适用车辆类型: ").append(attrInfoMap.get("SYCLLXShow")).append(" ");
|
||||
// contentBuilder.append("监管类型:"+attrInfoMap.get("")+" ");
|
||||
contentBuilder.append("监管类型: ").append(attrInfoMap.get("ZRLXShow")).append(" ");
|
||||
contentBuilder.append("个性化标签: ").append(attrInfoMap.get("GXHBQShow")).append(" ");
|
||||
contentBuilder.append("新车型实施日期(文本): ").append(attrInfoMap.get("XCXSSRQ")).append(" ");
|
||||
contentBuilder.append("在产车实施日期(文本): ").append(attrInfoMap.get("ZCCSSRQ")).append(" ");
|
||||
contentBuilder.append("EOP实施日期(文本): ").append(attrInfoMap.get("EOPSSRQ")).append(" ");
|
||||
contentBuilder.append("维护工程师: ").append(attrInfoMap.get("ZCGCSShow")).append(" ");
|
||||
contentBuilder.append("组织标准起草的执行机构/单位: ").append(attrInfoMap.get("FBJGShow")).append(" ");
|
||||
contentBuilder.append("SVPPS: ").append(attrInfoMap.get("SVPPSName")).append(" ");
|
||||
contentBuilder.append("相关部门: ").append(attrInfoMap.get("XGBMShow")).append(" ");
|
||||
contentBuilder.append("责任部门: ").append(attrInfoMap.get("ZRBMShow")).append(" ");
|
||||
contentBuilder.append("FO: ").append(attrInfoMap.get("FOShow")).append(" ");
|
||||
contentBuilder.append("归口管理部门: ").append(attrInfoMap.get("GKGLBMShow")).append(" ");
|
||||
contentBuilder.append("我司是否参与: ").append(attrInfoMap.get("WSSFCYShow")).append(" ");
|
||||
contentBuilder.append("相关流程: ").append(attrInfoMap.get("XGLC")).append(" ");
|
||||
// contentBuilder.append("相关资料:"+attrInfoMap.get("")+" ");
|
||||
if (attrInfoMap.containsKey("content")){
|
||||
if (null !=attrInfoMap.get("content") && StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("content")))){
|
||||
String con = String.valueOf(attrInfoMap.get("content"));
|
||||
con = con.replace(",","");
|
||||
if (StringUtils.isBlank(con)){
|
||||
attrInfoMap.put("content","--");
|
||||
}
|
||||
}
|
||||
}
|
||||
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.put("textContent",textContent.toString());
|
||||
if (null != attrInfoMap.get("issue_time") && !"".equals(attrInfoMap.get("issue_time")) && !"null".equals(attrInfoMap.get("issue_time"))) {
|
||||
fullTextSearchEO.put("issue_time", attrInfoMap.get("issue_time"));
|
||||
}else {
|
||||
fullTextSearchEO.put("issue_time", "--");
|
||||
}
|
||||
}else if ("bussstand".equals(attrInfoMap.get("type"))){
|
||||
|
||||
for (String key : attrInfoMap.keySet()) {
|
||||
if (null == attrInfoMap.get(key) || "".equals(attrInfoMap.get(key))){
|
||||
attrInfoMap.put(key, "null");
|
||||
}
|
||||
}
|
||||
fullTextSearchEO.put("title",attrInfoMap.get("standNumber")+" - 《"+attrInfoMap.get("nameshow")+"》");
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd HH:mm:ss");
|
||||
contentBuilder.append("企标编号: ").append(String.valueOf(attrInfoMap.get("numbershow"))).append(" ");
|
||||
contentBuilder.append("企标名称: ").append(String.valueOf(attrInfoMap.get("nameshow"))).append(" ");
|
||||
contentBuilder.append("英文名称: ").append(attrInfoMap.get("standEnName")).append(" ");
|
||||
contentBuilder.append("标准状态: ").append(String.valueOf(attrInfoMap.get("standstateshow"))).append(" ");
|
||||
// contentBuilder.append("发布日期:"+String.valueOf(attrInfoMap.get("issue_time"))+" ");
|
||||
contentBuilder.append("标准实施日期: ");
|
||||
contentBuilder.append(String.valueOf(attrInfoMap.get("put_time")));
|
||||
contentBuilder.append("代替企标编号: ").append(attrInfoMap.get("replaceStandNum"));
|
||||
contentBuilder.append("被代替企标编号: ").append(attrInfoMap.get("replacedStandNum"));
|
||||
contentBuilder.append("废止日期: ");
|
||||
if (StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("FZRQString")).trim())) {
|
||||
contentBuilder.append(String.valueOf(attrInfoMap.get("FZRQString"))).append(" ");
|
||||
}else{
|
||||
contentBuilder.append("--").append(" ");
|
||||
}
|
||||
contentBuilder.append("复审日期: ");
|
||||
if (StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("FSRQString")).trim())) {
|
||||
contentBuilder.append(String.valueOf(attrInfoMap.get("FSRQString"))).append(" ");
|
||||
}else{
|
||||
contentBuilder.append("--").append(" ");
|
||||
}
|
||||
contentBuilder.append("密级: ").append(String.valueOf(attrInfoMap.get("QBMJShow"))).append(" ");
|
||||
contentBuilder.append("授权: ").append(String.valueOf(attrInfoMap.get("QBSQShow"))).append(" ");
|
||||
contentBuilder.append("涉及会签部门: ").append(String.valueOf(attrInfoMap.get("XHQBMShow"))).append(" ");
|
||||
contentBuilder.append("SVPPS: ").append(String.valueOf(attrInfoMap.get("SVPPSName"))).append(" ");
|
||||
contentBuilder.append("相关部门: ").append(String.valueOf(attrInfoMap.get("XGBMShow"))).append(" ");
|
||||
contentBuilder.append("主起草人: ").append(String.valueOf(attrInfoMap.get("ZYQCRShow"))).append(" ");
|
||||
contentBuilder.append("起草部门: ").append(String.valueOf(attrInfoMap.get("ZRBMShow"))).append(" ");
|
||||
contentBuilder.append("主起草部门: ").append(String.valueOf(attrInfoMap.get("ZQCBMName"))).append(" ");
|
||||
contentBuilder.append("其他起草人: ").append(String.valueOf(attrInfoMap.get("QTQCRShow"))).append(" ");
|
||||
contentBuilder.append("外发审批角色: ").append(String.valueOf(attrInfoMap.get("WFSPJSShow"))).append(" ");
|
||||
contentBuilder.append("规范性引用文件: ").append(String.valueOf(attrInfoMap.get("GFXYYWJ"))).append(" ");
|
||||
contentBuilder.append("相关流程: ").append(String.valueOf(attrInfoMap.get("XGLC"))).append(" ");
|
||||
if (attrInfoMap.containsKey("content")){
|
||||
if (null !=attrInfoMap.get("content") && StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("content")))){
|
||||
String con = String.valueOf(attrInfoMap.get("content"));
|
||||
con = con.replace(",","");
|
||||
if (StringUtils.isBlank(con)){
|
||||
attrInfoMap.put("content","--");
|
||||
}
|
||||
}
|
||||
}
|
||||
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
|
||||
// contentBuilder.append("相关计划:"+String.valueOf(attrInfoMap.get(""))+" ");
|
||||
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.put("textContent",textContent.toString());
|
||||
if (null != attrInfoMap.get("issue_time") && !"".equals(attrInfoMap.get("issue_time")) && !"null".equals(attrInfoMap.get("issue_time"))) {
|
||||
fullTextSearchEO.put("issue_time", attrInfoMap.get("issue_time"));
|
||||
}else {
|
||||
fullTextSearchEO.put("issue_time", "--");
|
||||
}
|
||||
}
|
||||
return fullTextSearchEO;
|
||||
}
|
||||
|
||||
FullTextSearchEO getFullTextSearch(StandLawsEO standLawsEO){
|
||||
FullTextSearchEO fullTextSearchEO = new FullTextSearchEO();
|
||||
fullTextSearchEO.setId(standLawsEO.getId());
|
||||
fullTextSearchEO.setIndexType(standLawsEO.getType());
|
||||
if(standLawsEO.getType().equals("stand")){
|
||||
// 标准全文
|
||||
fullTextSearchEO.setTitle(standLawsEO.getNumbershow()+" "+standLawsEO.getNameshow());
|
||||
fullTextSearchEO.setIssue_time(standLawsEO.getIssue_time());
|
||||
fullTextSearchEO.setIssueTimeStr(standLawsEO.getIssueTimeStr());
|
||||
fullTextSearchEO.setPut_time(standLawsEO.getPut_time());
|
||||
fullTextSearchEO.setPutTimeStr(standLawsEO.getPutTimeStr());
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
contentBuilder.append("区域:东亚 ");
|
||||
contentBuilder.append("国家/地区:"+standLawsEO.getCountryShow()+" ");
|
||||
contentBuilder.append("标准性质:"+standLawsEO.getNatureShow()+" ");
|
||||
contentBuilder.append("标准状态:"+standLawsEO.getStatecodeShow()+" ");
|
||||
contentBuilder.append("内容摘要:"+standLawsEO.getSynopsis()+" ");
|
||||
contentBuilder.append("标准文本:"+standLawsEO.getContent()+" ");
|
||||
contentBuilder.append("标准类别:"+standLawsEO.getStandSortShow()+" ");
|
||||
contentBuilder.append("标准号:"+standLawsEO.getNumbershow()+" ");
|
||||
contentBuilder.append("标准名称:"+standLawsEO.getNameshow()+" ");
|
||||
contentBuilder.append("标准英文名称:"+standLawsEO.getStandEnName()+" ");
|
||||
contentBuilder.append("发布日期:"+DateUtils.dateToString(standLawsEO.getIssue_time(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("实施日期:"+DateUtils.dateToString(standLawsEO.getPut_time(),"yyyy-MM-dd")+" ");
|
||||
//时间处理
|
||||
contentBuilder.append("新定型车实施日期:"+ DateUtils.dateToString(standLawsEO.getNewcarPutTime(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("新生产车实施日期:"+DateUtils.dateToString(standLawsEO.getNewproductPutTime(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("注册登记车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("在产车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
|
||||
//时间处理
|
||||
contentBuilder.append("适用认证:"+standLawsEO.getApplyAuthShow()+" ");
|
||||
contentBuilder.append("发布部门:"+standLawsEO.getIssueUnit()+" ");
|
||||
contentBuilder.append("代替标准号:"+standLawsEO.getReplace_stand_num()+" ");
|
||||
contentBuilder.append("被代替标准号:"+standLawsEO.getReplaced_stand_num()+" ");
|
||||
contentBuilder.append("采用国际标准号:"+standLawsEO.getInterStandNum()+" ");
|
||||
contentBuilder.append("采标程度:"+standLawsEO.getAdoptExtentShow()+" ");
|
||||
contentBuilder.append("适用车型:"+standLawsEO.getApplyArcticShow()+" ");
|
||||
contentBuilder.append("能源种类:"+standLawsEO.getEnergyKindShow()+" ");
|
||||
contentBuilder.append("起草单位:"+standLawsEO.getDrafting_unit()+" ");
|
||||
contentBuilder.append("起草人:"+standLawsEO.getDraft_user()+" ");
|
||||
contentBuilder.append("关键词:"+standLawsEO.getStandTag()+" ");
|
||||
contentBuilder.append("备注:"+standLawsEO.getRemarks()+" ");
|
||||
contentBuilder.append("责任部门:"+standLawsEO.getResponsibleUnitShow()+" ");
|
||||
contentBuilder.append("所属专业领域:"+standLawsEO.getCategoryShow()+" ");
|
||||
// contentBuilder.append("总成分类:"+" ");
|
||||
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.setTextContent(textContent.toString());
|
||||
} else if(standLawsEO.getType().equals("bussstand")){
|
||||
//企业标准全文
|
||||
fullTextSearchEO.setTitle(standLawsEO.getNumbershow()+" "+standLawsEO.getNameshow());
|
||||
fullTextSearchEO.setIssue_time(standLawsEO.getIssue_time());
|
||||
fullTextSearchEO.setIssueTimeStr(standLawsEO.getIssueTimeStr());
|
||||
fullTextSearchEO.setPut_time(standLawsEO.getPut_time());
|
||||
fullTextSearchEO.setPutTimeStr(standLawsEO.getPutTimeStr());
|
||||
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
// contentBuilder.append("区域:东亚 ");
|
||||
contentBuilder.append("国家:"+standLawsEO.getCountryShow()+" ");
|
||||
contentBuilder.append("标准类别:"+standLawsEO.getStandSortShow()+" ");
|
||||
contentBuilder.append("标准编号:"+standLawsEO.getNumbershow()+" ");
|
||||
contentBuilder.append("标准名称:"+standLawsEO.getNameshow()+" ");
|
||||
contentBuilder.append("标准英文名称:"+standLawsEO.getStandEnName()+" ");
|
||||
contentBuilder.append("标准状态:"+standLawsEO.getStatecodeShow()+" ");
|
||||
contentBuilder.append("标准性质:"+standLawsEO.getNatureShow()+" ");
|
||||
// contentBuilder.append("规范性引用标准:"+standLawsEO.getNatureShow()+" ");
|
||||
contentBuilder.append("责任部门:"+standLawsEO.getResponsibleUnitShow()+" ");
|
||||
//contentBuilder.append("主要编制者:"+standLawsEO.getResponsibleUnitShow()+" ");
|
||||
contentBuilder.append("发布日期:"+standLawsEO.getIssueTimeStr()+" ");
|
||||
contentBuilder.append("实施日期:"+standLawsEO.getPutTimeStr()+" ");
|
||||
contentBuilder.append("实施年份:"+standLawsEO.getPutYear()+" ");
|
||||
contentBuilder.append("首发日期:"+standLawsEO.getFirstPutTime()+" ");
|
||||
contentBuilder.append("标准文本:"+standLawsEO.getContent()+" ");
|
||||
contentBuilder.append("适用认证:"+standLawsEO.getApplyAuthShow()+" ");
|
||||
contentBuilder.append("适用车型:"+standLawsEO.getApplyArcticShow()+" ");
|
||||
contentBuilder.append("能源种类:"+standLawsEO.getEnergyKindShow()+" ");
|
||||
contentBuilder.append("代替标准号:"+standLawsEO.getReplace_stand_num()+" ");
|
||||
contentBuilder.append("被代替标准号:"+standLawsEO.getReplaced_stand_num()+" ");
|
||||
contentBuilder.append("关键词:"+standLawsEO.getStandTag()+" ");
|
||||
contentBuilder.append("内容摘要:"+standLawsEO.getSynopsis()+" ");
|
||||
contentBuilder.append("备注:"+standLawsEO.getRemarks()+" ");
|
||||
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.setTextContent(textContent.toString());
|
||||
} else if(standLawsEO.getType().equals("laws")){
|
||||
// 政策全文
|
||||
fullTextSearchEO.setTitle(standLawsEO.getNumbershow()+" "+standLawsEO.getNameshow());
|
||||
fullTextSearchEO.setIssue_time(standLawsEO.getIssue_time());
|
||||
fullTextSearchEO.setIssueTimeStr(standLawsEO.getIssueTimeStr());
|
||||
fullTextSearchEO.setPut_time(standLawsEO.getPut_time());
|
||||
fullTextSearchEO.setPutTimeStr(standLawsEO.getPutTimeStr());
|
||||
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
contentBuilder.append("国家/地区:"+standLawsEO.getCountryShow()+" ");
|
||||
contentBuilder.append("文件号:"+standLawsEO.getNumbershow()+" ");
|
||||
contentBuilder.append("文件名称:"+standLawsEO.getNameshow()+" ");
|
||||
contentBuilder.append("文件英文名称:"+standLawsEO.getStandEnName()+" ");
|
||||
contentBuilder.append("文件状态:"+standLawsEO.getStatecodeShow()+" ");
|
||||
contentBuilder.append("文件性质:"+standLawsEO.getNatureShow()+" ");
|
||||
contentBuilder.append("发布日期:"+DateUtils.dateToString(standLawsEO.getIssue_time(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("实施日期:"+DateUtils.dateToString(standLawsEO.getPut_time(),"yyyy-MM-dd")+" ");
|
||||
//时间处理
|
||||
contentBuilder.append("新定型车实施日期:"+ DateUtils.dateToString(standLawsEO.getNewcarPutTime(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("新生产车实施日期:"+DateUtils.dateToString(standLawsEO.getNewproductPutTime(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("注册登记车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
|
||||
contentBuilder.append("在产车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
|
||||
//时间处理
|
||||
contentBuilder.append("发布部门:"+standLawsEO.getIssueUnit()+" ");
|
||||
contentBuilder.append("责任部门:"+standLawsEO.getResponsibleUnitShow()+" ");
|
||||
contentBuilder.append("文件附件全文:"+standLawsEO.getContent()+" ");
|
||||
contentBuilder.append("适用车型:"+standLawsEO.getApplyArcticShow()+" ");
|
||||
contentBuilder.append("适用认证:"+standLawsEO.getApplyAuthShow()+" ");
|
||||
contentBuilder.append("能源种类:"+standLawsEO.getEnergyKindShow()+" ");
|
||||
contentBuilder.append("所属专业领域:"+standLawsEO.getCategoryShow()+" ");
|
||||
contentBuilder.append("代替标准号:"+standLawsEO.getReplace_stand_num()+" ");
|
||||
contentBuilder.append("被代替标准号:"+standLawsEO.getReplaced_stand_num()+" ");
|
||||
contentBuilder.append("关键词:"+standLawsEO.getStandTag()+" ");
|
||||
contentBuilder.append("内容摘要:"+standLawsEO.getSynopsis()+" ");
|
||||
contentBuilder.append("备注:"+standLawsEO.getRemarks()+" ");
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.setTextContent(textContent.toString());
|
||||
}
|
||||
return fullTextSearchEO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实现StringBuilder的replaceAll
|
||||
*
|
||||
* @param stb
|
||||
* @param oldStr 被替换的字符串
|
||||
* @param newStr 替换oldStr
|
||||
* @return
|
||||
*/
|
||||
public static StringBuilder replaceAll(StringBuilder stb, String oldStr, String newStr) {
|
||||
if (stb == null || oldStr == null || newStr == null || stb.length() == 0 || oldStr.length() == 0)
|
||||
return stb;
|
||||
int index = stb.indexOf(oldStr);
|
||||
if (index > -1 && !oldStr.equals(newStr)) {
|
||||
int lastIndex = 0;
|
||||
while (index > -1) {
|
||||
stb.replace(index, index + oldStr.length(), newStr);
|
||||
lastIndex = index + newStr.length();
|
||||
index = stb.indexOf(oldStr, lastIndex);
|
||||
}
|
||||
}
|
||||
return stb;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.adc.da.search.util;
|
||||
|
||||
/**
|
||||
*Elasticsearch接口实现过程中用到的常量定义
|
||||
* @author gaoyan
|
||||
* date 2018/08/27
|
||||
*/
|
||||
public class ElasticsearchConstant {
|
||||
//构造方法
|
||||
public ElasticsearchConstant() {
|
||||
// 不做操作
|
||||
}
|
||||
//正确删除后返回结构
|
||||
public static final String SUCCESS_DELETED = "DELETED";
|
||||
//删除过程中未找到对应数据返回结果
|
||||
public static final String HAVE_NOT_FOUND= "NOT_FOUND";
|
||||
}
|
||||
@@ -35,5 +35,55 @@
|
||||
<version>3.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>1.8.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itextpdf</artifactId>
|
||||
<version>5.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zip4j</groupId>
|
||||
<artifactId>zip4j</artifactId>
|
||||
<scope>system</scope>
|
||||
<version>1.3.1</version>
|
||||
<systemPath>${basedir}/src/main/lib/zip4j-1.3.1.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,223 @@
|
||||
package com.adc.da.common;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>OT_CONVERT_MQ OtConvertMqEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2018-09-25 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public class ConvertMqEO extends BaseEntity {
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
private Integer validFlag;
|
||||
private String attId;
|
||||
private String filePath;
|
||||
private String fileOriginPath;
|
||||
private String userId;
|
||||
private Integer mqState;
|
||||
private String mqCode;
|
||||
private String id;
|
||||
private String addOrUp;
|
||||
|
||||
//向文件表添加信息
|
||||
private String lawsId;
|
||||
private String resId;
|
||||
private String convertType;
|
||||
private String pdfPath;
|
||||
private String pdfId;
|
||||
private String fileSuffix;
|
||||
private String standFileClassify;
|
||||
private String oriAttId;
|
||||
private String lawsFileClassify;
|
||||
|
||||
private int againNum;
|
||||
/** **/
|
||||
public Integer getValidFlag() {
|
||||
return this.validFlag;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setValidFlag(Integer validFlag) {
|
||||
this.validFlag = validFlag;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getAttId() {
|
||||
return this.attId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setAttId(String attId) {
|
||||
this.attId = attId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getFilePath() {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public Integer getMqState() {
|
||||
return this.mqState;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setMqState(Integer mqState) {
|
||||
this.mqState = mqState;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getMqCode() {
|
||||
return this.mqCode;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setMqCode(String mqCode) {
|
||||
this.mqCode = mqCode;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/** **/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFileOriginPath() {
|
||||
return fileOriginPath;
|
||||
}
|
||||
|
||||
public void setFileOriginPath(String fileOriginPath) {
|
||||
this.fileOriginPath = fileOriginPath;
|
||||
}
|
||||
|
||||
public String getLawsId() {
|
||||
return lawsId;
|
||||
}
|
||||
|
||||
public void setLawsId(String lawsId) {
|
||||
this.lawsId = lawsId;
|
||||
}
|
||||
|
||||
public String getResId() {
|
||||
return resId;
|
||||
}
|
||||
|
||||
public void setResId(String resId) {
|
||||
this.resId = resId;
|
||||
}
|
||||
|
||||
public String getConvertType() {
|
||||
return convertType;
|
||||
}
|
||||
|
||||
public void setConvertType(String convertType) {
|
||||
this.convertType = convertType;
|
||||
}
|
||||
|
||||
public String getPdfPath() {
|
||||
return pdfPath;
|
||||
}
|
||||
|
||||
public void setPdfPath(String pdfPath) {
|
||||
this.pdfPath = pdfPath;
|
||||
}
|
||||
|
||||
public String getAddOrUp() {
|
||||
return addOrUp;
|
||||
}
|
||||
|
||||
public void setAddOrUp(String addOrUp) {
|
||||
this.addOrUp = addOrUp;
|
||||
}
|
||||
|
||||
public String getPdfId() {
|
||||
return pdfId;
|
||||
}
|
||||
|
||||
public void setPdfId(String pdfId) {
|
||||
this.pdfId = pdfId;
|
||||
}
|
||||
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
public String getFileSuffix() {
|
||||
return fileSuffix;
|
||||
}
|
||||
|
||||
public void setFileSuffix(String fileSuffix) {
|
||||
this.fileSuffix = fileSuffix;
|
||||
}
|
||||
|
||||
public String getStandFileClassify() {
|
||||
return standFileClassify;
|
||||
}
|
||||
|
||||
public void setStandFileClassify(String standFileClassify) {
|
||||
this.standFileClassify = standFileClassify;
|
||||
}
|
||||
|
||||
public String getOriAttId() {
|
||||
return oriAttId;
|
||||
}
|
||||
|
||||
public void setOriAttId(String oriAttId) {
|
||||
this.oriAttId = oriAttId;
|
||||
}
|
||||
|
||||
public int getAgainNum() {
|
||||
return againNum;
|
||||
}
|
||||
|
||||
public void setAgainNum(int againNum) {
|
||||
this.againNum = againNum;
|
||||
}
|
||||
|
||||
public String getLawsFileClassify() {
|
||||
return lawsFileClassify;
|
||||
}
|
||||
|
||||
public void setLawsFileClassify(String lawsFileClassify) {
|
||||
this.lawsFileClassify = lawsFileClassify;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.adc.da.mq.dao;
|
||||
|
||||
import com.adc.da.common.ConvertMqEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface OtConvertEODao extends BaseMapper<ConvertMqEO> {
|
||||
|
||||
int deleteByAttId(String value);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.adc.da.mq.service;
|
||||
|
||||
import com.adc.da.common.ConvertMqEO;
|
||||
import com.adc.da.mq.dao.OtConvertEODao;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CreateMQService {
|
||||
@Autowired
|
||||
private AmqpTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private OtConvertEODao otConvertEODao;
|
||||
/**
|
||||
* @Author yangxuenan
|
||||
* @Description 创建消息队列
|
||||
* Date 2018/8/24 13:59
|
||||
* @Param [convert, convertType]
|
||||
* @return int
|
||||
**/
|
||||
public void sendMQ(ConvertMqEO convert) throws Exception{
|
||||
String otId = UUIDUtils.randomUUID20();
|
||||
//向OT_CONVERT_EO表中添加/修改数据
|
||||
//判断用户是初次发送还是重新发送,初次将添加到数据库,重新发送将修改原数据信息
|
||||
convert.setMqState(0);
|
||||
convert.setModifyTime(new Date());
|
||||
if("0".equals(convert.getAddOrUp()) && StringUtils.isEmpty(convert.getId())){
|
||||
convert.setId(otId);
|
||||
convert.setMqCode(convert.getConvertType());
|
||||
convert.setCreationTime(new Date());
|
||||
convert.setValidFlag(0);
|
||||
otConvertEODao.insert(convert);
|
||||
} else {
|
||||
otConvertEODao.updateById(convert);
|
||||
}
|
||||
|
||||
//将数据信息保存并发送给消息队列
|
||||
Map<String,Object> convertInfo = new HashMap<String,Object>();
|
||||
//标准/政策ID
|
||||
convertInfo.put("lawsId", convert.getLawsId());
|
||||
//标准/政策关联的res表ID
|
||||
convertInfo.put("resId", convert.getResId());
|
||||
//文档的ID
|
||||
convertInfo.put("attId", convert.getAttId());
|
||||
//判断当前操作是新增还是修改
|
||||
convertInfo.put("addUpFlag", convert.getAddOrUp());
|
||||
//资源类型(标准,政策,企标)
|
||||
convertInfo.put("convertType", convert.getConvertType());
|
||||
//文档路径
|
||||
convertInfo.put("path", convert.getFilePath());
|
||||
convertInfo.put("standFileClassify", convert.getStandFileClassify());
|
||||
convertInfo.put("lawsFileClassify", convert.getLawsFileClassify());
|
||||
if("0".equals(convert.getAddOrUp())){
|
||||
//otId在转换表中数据ID
|
||||
convertInfo.put("otId", otId);
|
||||
//在stand_file等资源与文件关联表中转换成功的pdf数据ID
|
||||
convertInfo.put("standFilePdfId", UUIDUtils.randomUUID20());
|
||||
convertInfo.put("againNum",0);
|
||||
} else {
|
||||
convertInfo.put("otId", convert.getId());
|
||||
convertInfo.put("standFilePdfId", convert.getPdfId());
|
||||
convertInfo.put("againNum",convert.getAgainNum());
|
||||
}
|
||||
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR", "convert-key_SQ_GSAR", convertInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.adc.da.mq.service;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CreateStandMQService {
|
||||
@Autowired
|
||||
private AmqpTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sarStandardsInfoEO 标准实体
|
||||
* @param addOrUpdate
|
||||
* @throws Exception
|
||||
*/
|
||||
public void sendStandMQ(Object sarStandardsInfoEO, String addOrUpdate) throws Exception{
|
||||
JSONObject json = JSONObject.fromObject(sarStandardsInfoEO);
|
||||
String sarStandardsInfoStr = json.toString();
|
||||
Map<String,Object> standMap = new HashMap<String,Object>();
|
||||
standMap.put("sarStandards", sarStandardsInfoStr);
|
||||
standMap.put("addOrUpdate", addOrUpdate);
|
||||
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("stand-exchange_SQ_GSAR", "stand-key_SQ_GSAR", standMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package com.adc.da.mq.service;
|
||||
|
||||
import com.adc.da.slrs.otSvpps.entity.OtSvpps;
|
||||
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SendStandMQService {
|
||||
|
||||
@Autowired
|
||||
private ISarStandardsInfoService sarStandardsInfoService;
|
||||
|
||||
@Autowired
|
||||
private SysInfoEOService sysInfoEOService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IOtSvppsService otSvppsEOService;
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SendStandMQService.class);
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(value = "createStandMQ_SQ_GSAR", durable = "true"),
|
||||
exchange = @Exchange(value = "stand-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
|
||||
key = "stand-key_SQ_GSAR"))
|
||||
public void createMQ(Map<String,Object> standMap, Message message, Channel channel) throws Exception{
|
||||
try{
|
||||
try{
|
||||
Thread.sleep(5000);
|
||||
insertOrUpdateStandInfo(standMap);
|
||||
}catch(InterruptedException e){
|
||||
logger.error(e.toString());
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索中心标准消息队列进入添加数据方法前失败!");
|
||||
logger.error(e.getMessage(),e);
|
||||
}finally {
|
||||
Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
channel.basicAck(tag,false);
|
||||
logger.debug("消息确认成功!!!!!!!!!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void insertOrUpdateStandInfo(Map<String,Object> standMap){
|
||||
String addOrUpdate = standMap.get("addOrUpdate").toString();
|
||||
String sarStandards = standMap.get("sarStandards").toString();
|
||||
JSONObject jsonobject = JSONObject.fromObject(sarStandards);
|
||||
SarStandardsInfo infoEO = (SarStandardsInfo) JSONObject.toBean(jsonobject,SarStandardsInfo.class);
|
||||
String attr = infoEO.getSarStandAttrEOStr();
|
||||
JSONObject jsonobject1 = JSONObject.fromObject(attr);
|
||||
Map<String,Object> map = (Map)jsonobject1;
|
||||
String GZZXX = String.valueOf(map.get("GZZXX"));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// 往索引表中插入数据
|
||||
String getCodeName = "";
|
||||
Map<String,Object> saveMap = new HashMap<>();
|
||||
String baseSearchContent = "";
|
||||
// 开始存放数据
|
||||
saveMap.put("id",infoEO.getId());
|
||||
saveMap.put("BYYBJ", map.getOrDefault("BYYBJ", ""));
|
||||
saveMap.put("BDTBH", map.getOrDefault("BDTBH", ""));
|
||||
saveMap.put("country",infoEO.getCountry());
|
||||
|
||||
if (StringUtils.isNotEmpty(infoEO.getCountry())) {
|
||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getCountry());
|
||||
saveMap.put("countryShow",codeName);
|
||||
}
|
||||
saveMap.put("standSort",infoEO.getStandSort());
|
||||
saveMap.put("stand_sort",infoEO.getStandSort());
|
||||
if (StringUtils.isNotEmpty(infoEO.getStandSort())) {
|
||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort());
|
||||
saveMap.put("standSortShow",codeName);
|
||||
getCodeName = codeName;
|
||||
}
|
||||
saveMap.put("standNumber",infoEO.getStandNumber());
|
||||
saveMap.put("stand_number",infoEO.getStandNumber());
|
||||
saveMap = dealNumberMsg(saveMap,infoEO,getCodeName);
|
||||
saveMap.put("standYear",infoEO.getStandYear());
|
||||
saveMap.put("stand_year",infoEO.getStandYear());
|
||||
saveMap.put("nameshow",infoEO.getStandName());
|
||||
saveMap.put("stand_name",infoEO.getStandName());
|
||||
saveMap.put("standEnName",infoEO.getStandEnName());
|
||||
saveMap.put("stand_en_name",infoEO.getStandEnName());
|
||||
|
||||
if ("1".equals(infoEO.getIsRelateAccess())) {
|
||||
saveMap.put("isRelateAccess","A" );
|
||||
}else{
|
||||
saveMap.put("isRelateAccess","B" );
|
||||
}
|
||||
if (StringUtils.isNotEmpty(infoEO.getStandState())) {
|
||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandState());
|
||||
saveMap.put("standstateshow",codeName);
|
||||
}
|
||||
saveMap.put("issueTime",infoEO.getIssueTime());
|
||||
|
||||
String newDate = infoEO.getIssueTime();
|
||||
if (StringUtils.isNotBlank(infoEO.getIssueTime()) && StringUtils.isNotBlank(infoEO.getIssueTime().trim()) && infoEO.getIssueTime().trim().length()>10) {
|
||||
newDate = infoEO.getIssueTime().trim().substring(0,10);
|
||||
}
|
||||
|
||||
saveMap.put("issue_time",newDate);
|
||||
Date issue_time_data = null;
|
||||
if (StringUtils.isNotBlank(infoEO.getIssueTime())) {
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
issue_time_data = format.parse(newDate+" 00:00:00");
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
}
|
||||
if (issue_time_data != null) {
|
||||
saveMap.put("issue_time_data",issue_time_data.getTime());
|
||||
}else{
|
||||
saveMap.put("issue_time_data",0L);
|
||||
}
|
||||
saveMap.put("synopsis",infoEO.getSynopsis());
|
||||
saveMap.put("standType",infoEO.getStandType());
|
||||
// 自定义属性字段
|
||||
String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr();
|
||||
Map<String,Object> attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr);
|
||||
if (attrInfoMap != null && !attrInfoMap.isEmpty()) {
|
||||
attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "stand",baseSearchContent);
|
||||
saveMap.putAll(attrInfoMap);
|
||||
}
|
||||
saveMap.put("baseSearchContent",baseSearchContent);
|
||||
saveMap.put("type","stand");
|
||||
saveMap.put("validFlag","0");
|
||||
saveMap.put("content",infoEO.getFileIds());
|
||||
saveMap.put("CHJL",infoEO.getCHJL());
|
||||
|
||||
String SVPPSSting = "";
|
||||
if (attrInfoMap != null) {
|
||||
if (attrInfoMap.containsKey("SVPPS")){
|
||||
String svpps = String.valueOf(attrInfoMap.get("SVPPS"));
|
||||
List<String> ids = new ArrayList<>(Arrays.asList(svpps.split(",")));
|
||||
for (String id: ids){
|
||||
String num = "";
|
||||
try {
|
||||
OtSvpps otSvppsEO = otSvppsEOService.getById(id);
|
||||
if (null != otSvppsEO) {
|
||||
if ("NA".equals(otSvppsEO.getTNum())) {
|
||||
if ("NA".equals(otSvppsEO.getSNum())) {
|
||||
num = otSvppsEO.getFNum();
|
||||
} else {
|
||||
num = otSvppsEO.getSNum();
|
||||
}
|
||||
} else {
|
||||
num = otSvppsEO.getTNum();
|
||||
}
|
||||
}
|
||||
if ("".equals(SVPPSSting)){
|
||||
SVPPSSting = num;
|
||||
}else {
|
||||
SVPPSSting = SVPPSSting + "," + num;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
saveMap.put("SVPPSName",SVPPSSting);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Date XCXSSRQ_data = null;
|
||||
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("XCXSSRQ")))) {
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (String.valueOf(saveMap.get("XCXSSRQ")).trim().length()>10) {
|
||||
XCXSSRQ_data = format.parse(String.valueOf(saveMap.get("XCXSSRQ")).trim().substring(0,10) + " 00:00:00");
|
||||
saveMap.put("XCXSSRQ",String.valueOf(saveMap.get("XCXSSRQ")).trim().substring(0,10));
|
||||
}else{
|
||||
XCXSSRQ_data = format.parse(String.valueOf(saveMap.get("XCXSSRQ")).trim() + " 00:00:00");
|
||||
saveMap.put("XCXSSRQ",String.valueOf(saveMap.get("XCXSSRQ")).trim());
|
||||
}
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
}
|
||||
if (XCXSSRQ_data != null) {
|
||||
saveMap.put("XCXSSRQ_data",XCXSSRQ_data.getTime());
|
||||
}else{
|
||||
saveMap.put("XCXSSRQ_data",0L);
|
||||
}
|
||||
saveMap.put("XCXSSRQ",String.valueOf(saveMap.get("XCXSSRQ")+" "));
|
||||
|
||||
Date ZCCSSRQ_data = null;
|
||||
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("ZCCSSRQ")))) {
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (String.valueOf(saveMap.get("ZCCSSRQ")).trim().length()>10) {
|
||||
ZCCSSRQ_data = format.parse(String.valueOf(saveMap.get("ZCCSSRQ")).trim().substring(0, 10) + " 00:00:00");
|
||||
saveMap.put("ZCCSSRQ",String.valueOf(saveMap.get("ZCCSSRQ")).trim().substring(0, 10));
|
||||
}else {
|
||||
ZCCSSRQ_data = format.parse(String.valueOf(saveMap.get("ZCCSSRQ")).trim() + " 00:00:00");
|
||||
saveMap.put("ZCCSSRQ",String.valueOf(saveMap.get("ZCCSSRQ")).trim());
|
||||
}
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
}
|
||||
if (ZCCSSRQ_data != null) {
|
||||
saveMap.put("ZCCSSRQ_data",ZCCSSRQ_data.getTime());
|
||||
}else{
|
||||
saveMap.put("ZCCSSRQ_data",0L);
|
||||
}
|
||||
saveMap.put("ZCCSSRQ",String.valueOf(saveMap.get("ZCCSSRQ")+" "));
|
||||
|
||||
Date EOPSSRQ_data = null;
|
||||
String ESSRQ= null;
|
||||
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("EOPSSRQ")))) {
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (String.valueOf(saveMap.get("EOPSSRQ")).trim().length()>10){
|
||||
ESSRQ = String.valueOf(saveMap.get("EOPSSRQ")).trim().substring(0,10);
|
||||
}else {
|
||||
ESSRQ = String.valueOf(saveMap.get("EOPSSRQ")).trim();
|
||||
}
|
||||
EOPSSRQ_data = format.parse(ESSRQ + " 00:00:00");
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
map.put("EOPSSRQ",ESSRQ);
|
||||
}
|
||||
if (EOPSSRQ_data != null) {
|
||||
saveMap.put("EOPSSRQ_data",EOPSSRQ_data.getTime());
|
||||
}else{
|
||||
saveMap.put("EOPSSRQ_data",0L);
|
||||
}
|
||||
saveMap.put("EOPSSRQ",String.valueOf(saveMap.get("EOPSSRQ")+" "));
|
||||
|
||||
if (map.containsKey("DXBZ")){
|
||||
saveMap.put("DXBZ",map.get("DXBZ"));
|
||||
}else{
|
||||
saveMap.put("DXBZ","");
|
||||
}
|
||||
//当建立代替时,产生的没有文件的问题
|
||||
if (StringUtils.isBlank(String.valueOf(saveMap.get("content")))) {
|
||||
String context = String.valueOf(saveMap.get("FBGBJBD")) + ","
|
||||
+ String.valueOf(saveMap.get("XXZLXX")) + ","
|
||||
+ String.valueOf(saveMap.get("ZQYJG")) + ","
|
||||
+ String.valueOf(saveMap.get("BPG")) + ","
|
||||
+ String.valueOf(saveMap.get("CA")) + ","
|
||||
+ String.valueOf(saveMap.get("SSG")) + ","
|
||||
+ String.valueOf(saveMap.get("ZBJBD"));
|
||||
context = context.replace(",,", ",");
|
||||
saveMap.put("content", context);
|
||||
}
|
||||
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("FO"))) && !"null".equals(String.valueOf(saveMap.get("FO")))){
|
||||
saveMap.put("FO",String.valueOf(saveMap.get("FO"))+" ");
|
||||
}
|
||||
if("add".equals(addOrUpdate)){
|
||||
sarStandardsInfoService.insertIntoIndexForMap(saveMap);
|
||||
} else {
|
||||
sarStandardsInfoService.updateIntoIndexForMap(saveMap);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String,Object> dealNumberMsg (Map<String,Object> saveMap,SarStandardsInfo infoEO,String getCodeName) {
|
||||
if(StringUtils.isNotEmpty(infoEO.getStandYear())){
|
||||
String number = getCodeName + " " + infoEO.getStandNumber() + "-" + infoEO.getStandYear();
|
||||
saveMap.put("numbershow",number);
|
||||
int index = infoEO.getStandNumber().indexOf(".");
|
||||
int index1 = infoEO.getStandNumber().indexOf(":");
|
||||
String numberExpNull = "";
|
||||
if(index > -1){
|
||||
numberExpNull = (getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index) + "-" + infoEO.getStandNumber().substring(0,index));
|
||||
} else if (index1 > -1) {
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index1) + "-" + infoEO.getStandNumber().substring(0,index1);
|
||||
} else {
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","");
|
||||
}
|
||||
saveMap.put("numberExpNull",numberExpNull);
|
||||
} else {
|
||||
String num = getCodeName + " " + infoEO.getStandNumber();
|
||||
saveMap.put("numbershow",num);
|
||||
int index = infoEO.getStandNumber().indexOf(".");
|
||||
String numberExpNull = "";
|
||||
if(index > -1){
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + num.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index) + "-" + infoEO.getStandNumber().substring(0,index);
|
||||
} else {
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + num.replaceAll(" ","");
|
||||
}
|
||||
saveMap.put("numberExpNull",numberExpNull);
|
||||
}
|
||||
return saveMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.adc.da.slrs.sarInstitution.controller;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "|机构管理|")
|
||||
@RequestMapping("/api/SarInstitution/institution")
|
||||
public class TsInstitutionController extends BaseController<TsInstitution> {
|
||||
@Autowired
|
||||
private ITsInstitutionService tsInstitutionService;
|
||||
@Autowired
|
||||
private ITsUserService tsUserService;
|
||||
|
||||
/**
|
||||
* 查询所有机构
|
||||
* @return ResponseMessage<List<TsInstitution>>
|
||||
*/
|
||||
@ApiOperation("查询所有机构")
|
||||
@GetMapping
|
||||
public ResponseMessage<List<TsInstitution>> getInstitution(){
|
||||
List<TsInstitution> institutions=tsInstitutionService.getInstitution();
|
||||
return Result.success(institutions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有机构和人员
|
||||
* @return ResponseMessage<List<TsInstitution>>
|
||||
*/
|
||||
@ApiOperation("查询所有机构和人员")
|
||||
@GetMapping("/institutionAndUser")
|
||||
public ResponseMessage<List<TsInstitution>> getInstitutionAndUser(){
|
||||
List<TsInstitution> institutions=tsInstitutionService.getInstitutionAndUser();
|
||||
return Result.success(institutions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机构人员
|
||||
* @param institutionId:机构ID
|
||||
* @return ResponseMessage<List<TsUser>>
|
||||
*/
|
||||
@ApiOperation("查询机构的人员")
|
||||
@GetMapping("/user")
|
||||
public ResponseMessage<List<TsUser>> getUserByInstitutionId(@RequestParam String institutionId){
|
||||
List<TsUser> tsUsers=tsUserService.getUserByInstitutionId(institutionId);
|
||||
return Result.success(tsUsers);
|
||||
}
|
||||
|
||||
@ApiOperation("导入机构数据")
|
||||
@PostMapping("/import")
|
||||
public ResponseMessage<Object> importInstitution(Map<String,Object> param){
|
||||
String json= (String) param.get("json");
|
||||
tsInstitutionService.parseInstitution(json);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.adc.da.slrs.sarInstitution.dao;
|
||||
|
||||
import com.adc.da.slrs.sarInstitution.entity.InstitutionAndUser;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
public interface TsInstitutionDao extends BaseMapper<TsInstitution> {
|
||||
|
||||
/**
|
||||
* 查询最高级机构及其人员
|
||||
* @return List<TsInstitution>
|
||||
*/
|
||||
List<TsInstitution> selectRootAndUser();
|
||||
|
||||
/**
|
||||
* 根据父节点查询机构及其人员
|
||||
* @param parentId:父节点Id
|
||||
* @return List<TsInstitution>
|
||||
*/
|
||||
List<TsInstitution> selectAndUserByParent(String parentId);
|
||||
|
||||
/**
|
||||
* 批量插入机构
|
||||
* @param tsInstitutions:机构列表
|
||||
*/
|
||||
void batchInsert(List<TsInstitution> tsInstitutions);
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.adc.da.slrs.sarInstitution.entity;
|
||||
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class InstitutionAndUser {
|
||||
private TsInstitution institution;
|
||||
private List<TsUser> users;
|
||||
private List<InstitutionAndUser> children;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.adc.da.slrs.sarInstitution.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SyncInstitution {
|
||||
private String orgNumber;
|
||||
private String orgName;
|
||||
private String departmentName;
|
||||
private String orgStatus;
|
||||
private String orgShortName;
|
||||
private String parentOrgNumber;
|
||||
private String orgFullPath;
|
||||
private String order;
|
||||
private String modifyTimestamp;
|
||||
|
||||
public static List<TsInstitution> syncToInstitution(List<SyncInstitution> syncInstitutions){
|
||||
List<TsInstitution> tsInstitutions=new ArrayList<>();
|
||||
for(SyncInstitution syncInstitution:syncInstitutions){
|
||||
tsInstitutions.add(new TsInstitution(syncInstitution.getOrgNumber(),syncInstitution.getParentOrgNumber(),syncInstitution.getOrgName()));
|
||||
}
|
||||
return tsInstitutions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.adc.da.slrs.sarInstitution.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="TsInstitution对象", description="")
|
||||
public class TsInstitution extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "上级机构")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty(value = "机构层级")
|
||||
private Integer level;
|
||||
|
||||
@ApiModelProperty(value = "机构名")
|
||||
private String name;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "子机构")
|
||||
private List<Object> children;
|
||||
|
||||
@JsonIgnore
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "人员")
|
||||
private List<TsUserVO> users;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("是否是机构")
|
||||
private Boolean disabled;
|
||||
|
||||
public TsInstitution() {
|
||||
}
|
||||
|
||||
public TsInstitution(String id, String parentId, String name) {
|
||||
this.id = id;
|
||||
this.parentId = parentId;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.adc.da.slrs.sarInstitution.entity;
|
||||
|
||||
import com.adc.da.slrs.sarPosition.entity.TsPosition;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TsUserVO {
|
||||
public interface disable{
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
@NotNull(message = "userId不能为空",groups = {disable.class})
|
||||
@TableId(value = "USID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "帐户")
|
||||
@TableField("ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
@TableField("PASSWORD")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "用户姓名")
|
||||
@TableField("UNAME")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "用户性别(1为男,2为女)")
|
||||
@TableField("SEX")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty(value = "用户来源")
|
||||
@TableField("USER_SOURCE")
|
||||
private String userSource;
|
||||
|
||||
@ApiModelProperty(value = "用户手机号")
|
||||
@TableField("PHONE")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "用户状态")
|
||||
@TableField("STATE")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "用户邮箱")
|
||||
@TableField("EMAIL")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "所属部门名称")
|
||||
@TableField("INSTITUTION_NAME")
|
||||
private String institutionName;
|
||||
|
||||
@ApiModelProperty(value = "所属部门ID")
|
||||
@TableField("INSTITUTION_ID")
|
||||
private String institutionId;
|
||||
|
||||
@ApiModelProperty(value = "岗位名")
|
||||
@TableField("POSITION_NAME")
|
||||
private String positionName;
|
||||
|
||||
@ApiModelProperty(value = "岗位ID")
|
||||
@TableField("POSITION_ID")
|
||||
private String positionId;
|
||||
|
||||
@ApiModelProperty(value = "工号")
|
||||
@TableField("WORK_NUM")
|
||||
private String workNum;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
@TableField("EXT_INFO")
|
||||
private String extInfo;
|
||||
|
||||
@TableField("OPER_USER")
|
||||
private String operUser;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("CREATION_TIME")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp creationTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField("MODIFY_TIME")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp modifyTime;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
@TableField("VALID_FLAG")
|
||||
private String validFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否禁用(0为未禁用,1为已禁用)")
|
||||
@NotNull(message = "disableFlag不能为空",groups = {disable.class})
|
||||
@TableField("DISABLE_FLAG")
|
||||
private String disableFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否锁定")
|
||||
@TableField("UNLOCK_FLAG")
|
||||
private String unlockFlag;
|
||||
|
||||
@ApiModelProperty(value = "用户类型")
|
||||
@TableField("USER_TYPE")
|
||||
private String userType;
|
||||
|
||||
@ApiModelProperty(value = "对接单点登录用户ID")
|
||||
@TableField("SSO_ID")
|
||||
private String ssoId;
|
||||
|
||||
@ApiModelProperty(value = "岗位")
|
||||
@TableField(exist = false)
|
||||
private List<TsPosition> positions;
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.adc.da.slrs.sarInstitution.service;
|
||||
|
||||
import com.adc.da.slrs.sarInstitution.entity.SyncInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zxy
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
public interface ITsInstitutionService extends IService<TsInstitution> {
|
||||
|
||||
/**
|
||||
* 查询所有机构
|
||||
*/
|
||||
List<TsInstitution> getInstitution();
|
||||
|
||||
List<TsInstitution> getInstitutionAndUser();
|
||||
|
||||
/**
|
||||
* 批量插入机构
|
||||
* @param tsInstitutions:机构列表
|
||||
*/
|
||||
void batchInsert(List<TsInstitution> tsInstitutions);
|
||||
|
||||
public void parseInstitution(String json);
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package com.adc.da.slrs.sarInstitution.service.impl;
|
||||
|
||||
|
||||
import com.adc.da.slrs.sarInstitution.dao.TsInstitutionDao;
|
||||
import com.adc.da.slrs.sarInstitution.entity.InstitutionAndUser;
|
||||
import com.adc.da.slrs.sarInstitution.entity.SyncInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsUserVO;
|
||||
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import com.adc.da.sync.service.SyncUserService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Service
|
||||
public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsInstitution> implements ITsInstitutionService {
|
||||
@Autowired
|
||||
private TsInstitutionDao tsInstitutionDao;
|
||||
|
||||
/**
|
||||
* 查询所有机构
|
||||
*/
|
||||
@Override
|
||||
public List<TsInstitution> getInstitution() {
|
||||
//查询第一层机构
|
||||
QueryWrapper<TsInstitution> institutionQueryWrapper=new QueryWrapper<>();
|
||||
institutionQueryWrapper.eq("level",1);
|
||||
List<TsInstitution> institutionRoot=tsInstitutionDao.selectList(institutionQueryWrapper);
|
||||
for(TsInstitution tsInstitution:institutionRoot){
|
||||
tsInstitution.setChildren(recursionGetInstitution(tsInstitution));
|
||||
}
|
||||
return institutionRoot;
|
||||
}
|
||||
/**
|
||||
* 递归获取子机构
|
||||
* @param tsInstitution:父机构
|
||||
* @return List<TsInstitution>
|
||||
*/
|
||||
private List<Object> recursionGetInstitution(TsInstitution tsInstitution){
|
||||
List<Object> institutionObject=new ArrayList<>();
|
||||
QueryWrapper<TsInstitution> institutionQueryWrapper=new QueryWrapper<>();
|
||||
institutionQueryWrapper.eq("parent_id",tsInstitution.getId());
|
||||
institutionQueryWrapper.eq("level",tsInstitution.getLevel()+1);
|
||||
List<TsInstitution> tsInstitutions=tsInstitutionDao.selectList(institutionQueryWrapper);
|
||||
for(TsInstitution tsInstitutionNode:tsInstitutions){
|
||||
tsInstitutionNode.setChildren(recursionGetInstitution(tsInstitutionNode));
|
||||
institutionObject.add(tsInstitutionNode);
|
||||
}
|
||||
return institutionObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有机构
|
||||
*/
|
||||
@Override
|
||||
public List<TsInstitution> getInstitutionAndUser() {
|
||||
//查询第一层机构
|
||||
List<TsInstitution> institutionRoot=tsInstitutionDao.selectRootAndUser();
|
||||
for(TsInstitution tsInstitution:institutionRoot){
|
||||
tsInstitution.setDisabled(true);
|
||||
tsInstitution.setChildren(recursionGetInstitutionAndUser(tsInstitution));
|
||||
for(TsUserVO user:tsInstitution.getUsers()){
|
||||
tsInstitution.getChildren().add(user);
|
||||
}
|
||||
}
|
||||
return institutionRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入机构
|
||||
* @param tsInstitutions:机构列表
|
||||
*/
|
||||
@Override
|
||||
public void batchInsert(List<TsInstitution> tsInstitutions) {
|
||||
if(tsInstitutions!=null&&tsInstitutions.size()>0){
|
||||
tsInstitutionDao.batchInsert(tsInstitutions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归获取子机构
|
||||
* @param tsInstitution:父机构
|
||||
* @return List<TsInstitution>
|
||||
*/
|
||||
private List<Object> recursionGetInstitutionAndUser(TsInstitution tsInstitution){
|
||||
List<Object> institutionObject=new ArrayList<>();
|
||||
List<TsInstitution> tsInstitutions=tsInstitutionDao.selectAndUserByParent(tsInstitution.getId());
|
||||
|
||||
for(TsInstitution tsInstitutionNode:tsInstitutions){
|
||||
tsInstitutionNode.setDisabled(true);
|
||||
tsInstitutionNode.setChildren(recursionGetInstitutionAndUser(tsInstitutionNode));
|
||||
institutionObject.add(tsInstitutionNode);
|
||||
for(TsUserVO user:tsInstitutionNode.getUsers()){
|
||||
tsInstitutionNode.getChildren().add(user);
|
||||
}
|
||||
}
|
||||
return institutionObject;
|
||||
}
|
||||
|
||||
public void parseInstitution(String json){
|
||||
JSONObject jsonObject= JSON.parseObject(json);
|
||||
JSONArray results=jsonObject.getJSONArray("results");
|
||||
List<SyncInstitution> syncInstitutions=results.toJavaList(SyncInstitution.class);
|
||||
List<TsInstitution> tsInstitutions=SyncInstitution.syncToInstitution(syncInstitutions);
|
||||
batchInsert(tsInstitutions);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.adc.da.slrs.sarInterpretationStandard.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarInterpretationForeignStandard对象", description="")
|
||||
public class SarInterpretationForeignStandard extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String standardNum;
|
||||
|
||||
private String standardName;
|
||||
|
||||
private String correspondDomesticStandard;
|
||||
|
||||
private String specificItem;
|
||||
|
||||
private String coreTechnicalRequirement;
|
||||
|
||||
private String comparedDomesticStandard;
|
||||
|
||||
private String complianceState;
|
||||
|
||||
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.adc.da.slrs.sarInterpretationStandard.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarInterpretationNationalStandard对象", description="")
|
||||
public class SarInterpretationNationalStandard extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String standardNum;
|
||||
|
||||
private String standardName;
|
||||
|
||||
private Integer lastVersionNum;
|
||||
|
||||
private String specificItem;
|
||||
|
||||
private String coreTechnicalRequirement;
|
||||
|
||||
private String comparedWithPrevious;
|
||||
|
||||
private String complianceState;
|
||||
|
||||
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.adc.da.slrs.sarInterpretationStandard.service.impl;
|
||||
|
||||
import com.adc.da.slrs.sarInterpretationStandard.entity.SarInterpretationForeignStandard;
|
||||
import com.adc.da.slrs.sarInterpretationStandard.dao.SarInterpretationForeignStandardDao;
|
||||
import com.adc.da.slrs.sarInterpretationStandard.service.ISarInterpretationForeignStandardService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-16
|
||||
*/
|
||||
@Service
|
||||
public class SarInterpretationForeignStandardServiceImpl extends ServiceImpl<SarInterpretationForeignStandardDao, SarInterpretationForeignStandard> implements ISarInterpretationForeignStandardService {
|
||||
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.adc.da.slrs.sarInterpretationStandard.service.impl;
|
||||
|
||||
import com.adc.da.slrs.sarInterpretationStandard.entity.SarInterpretationNationalStandard;
|
||||
import com.adc.da.slrs.sarInterpretationStandard.dao.SarInterpretationNationalStandardDao;
|
||||
import com.adc.da.slrs.sarInterpretationStandard.service.ISarInterpretationNationalStandardService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-16
|
||||
*/
|
||||
@Service
|
||||
public class SarInterpretationNationalStandardServiceImpl extends ServiceImpl<SarInterpretationNationalStandardDao, SarInterpretationNationalStandard> implements ISarInterpretationNationalStandardService {
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-24
|
||||
*/
|
||||
@RestController
|
||||
@Api(description = "|SarDetailedIdAttFile|")
|
||||
@RequestMapping("/api/sarLawsAttrDetailedList/sar-detailed-id-att-file")
|
||||
public class SarDetailedIdAttFileController extends BaseController<SarDetailedIdAttFile> {
|
||||
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.controller;
|
||||
|
||||
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.*;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.service.ISarLawsAttrDetailedListService;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@RestController
|
||||
//@Api(description = "|SarLawsAttrDetailedList|")
|
||||
@Api(tags = "标准法规清单详情")
|
||||
@RequestMapping("/api/sarLawsAttrDetailedList/sar-laws-attr-detailed-list")
|
||||
public class SarLawsAttrDetailedListController extends BaseController<SarLawsAttrDetailedList> {
|
||||
|
||||
@Autowired
|
||||
private ISarLawsAttrDetailedListService iSarLawsAttrDetailedList;
|
||||
@Autowired
|
||||
private IAttFileEOService attFileEOService;
|
||||
@Autowired
|
||||
private SarLawsAttrDetailedListDao sarLawsAttrDetailedListDao;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param Page 页数
|
||||
* @param Size 大小
|
||||
* @param id 清单id
|
||||
* @return ResponseMessage
|
||||
* @author zzy
|
||||
* date 2021-06-17
|
||||
**/
|
||||
@ApiOperation(value = "查询标准信息")
|
||||
@GetMapping("/selectLawsById")
|
||||
public ResponseMessage selectLawsById(@RequestParam(defaultValue = "1")int Page, @RequestParam(defaultValue = "10") int Size, String id,String standName,String responseUnit){
|
||||
List<LawsDto> laws = iSarLawsAttrDetailedList.selectLaws(id,Page-1,Size,standName);
|
||||
return Result.success("200",laws);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询附件信息")
|
||||
@GetMapping("/selectFile")
|
||||
public ResponseMessage selectFile(String Id){
|
||||
AttFileEO attFileEO = attFileEOService.getFileInfo(Id);
|
||||
return Result.success("200",attFileEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Page 页数
|
||||
* @param Size 大小
|
||||
* @param id 清单id
|
||||
* @return ResponseMessage
|
||||
* @author zzy
|
||||
* date 2021-06-17
|
||||
* 标准主表中的数据不全,先预留接口
|
||||
**/
|
||||
@ApiOperation(value = "检索和高级检索")
|
||||
@PostMapping("/selectByStandId")
|
||||
public ResponseMessage selectByStandId(@RequestParam(defaultValue = "1")int Page, @RequestParam(defaultValue = "10") int Size, String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param response 返回头
|
||||
* @param standExcelVo standExcelVo类
|
||||
* @return void
|
||||
* @author 作者信息
|
||||
* date 2021-06-24
|
||||
**/
|
||||
@ApiOperation(value = "导出标准信息")
|
||||
@RequestMapping("/ExportLawsById")
|
||||
public void ExportLawsById(HttpServletResponse response, StandExcelVo standExcelVo){
|
||||
try {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
if(standExcelVo.getExportName()==null){
|
||||
standExcelVo.setExportName("标准导出信息");
|
||||
}
|
||||
String fileName = URLEncoder.encode(standExcelVo.getExportName(), "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
List<LittleLawsDto> data = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(standExcelVo.getIds())){
|
||||
List<String> list= sarLawsAttrDetailedListDao.selectLawsId2(standExcelVo.getId());
|
||||
if (CollectionUtils.isEmpty(list)) return;
|
||||
data=sarLawsAttrDetailedListDao.selectLawsById(list,null);
|
||||
}else {
|
||||
data=sarLawsAttrDetailedListDao.selectLawsById(standExcelVo.getIds(),null);
|
||||
}
|
||||
List<StandExcelDto> standExcel=new ArrayList<>();
|
||||
for (LittleLawsDto littleLawsDto:data){
|
||||
StandExcelDto standExcelDto=StandExcelDto.builder()
|
||||
.standNumber(littleLawsDto.getStandNumber())
|
||||
.standName(littleLawsDto.getStandName())
|
||||
.standEnName(littleLawsDto.getStandEnName())
|
||||
.responseUnit("责任部门")
|
||||
.newCarTime("无字段")
|
||||
.nowCarTime("无字段")
|
||||
.typeApplicable("无字段")
|
||||
.issueTime(littleLawsDto.getIssueTime())
|
||||
.textStatus(littleLawsDto.getTextStatus())
|
||||
.build();
|
||||
standExcel.add(standExcelDto);
|
||||
}
|
||||
EasyExcel.write(response.getOutputStream(), StandExcelDto.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
|
||||
.doWrite(standExcel);
|
||||
} catch (Exception e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(Result.error()));
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.dao;
|
||||
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-24
|
||||
*/
|
||||
@Mapper
|
||||
public interface SarDetailedIdAttFileDao extends BaseMapper<SarDetailedIdAttFile> {
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.dao;
|
||||
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LittleLawsDto;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandExcelDto;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface SarLawsAttrDetailedListDao extends BaseMapper<SarLawsAttrDetailedList> {
|
||||
|
||||
//根据清单id,查出标准的id并排序
|
||||
List<String> selectLawsId(String standId,Integer page,Integer size);
|
||||
//根据标准id查出数据
|
||||
List<LittleLawsDto> selectLawsById(List<String> LawsIds,String standName);
|
||||
List<String> selectLawsId2(String standId);
|
||||
Boolean insertList(List<SarLawsAttrDetailedList> sarLawsAttrDetailedLists);
|
||||
Boolean deleteByStandId(String standId);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* //Dto,用于从标准主表中查询和检索信息
|
||||
* 主表还未完善需修改
|
||||
*
|
||||
* @author ZhangZhiYuan
|
||||
* date 2021-06-16
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
public class LawsDto {
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String standNumber;
|
||||
@ApiModelProperty(value = "中文名称")
|
||||
private String standName;
|
||||
@ApiModelProperty(value = "英文名称")
|
||||
private String standEnName;
|
||||
@ApiModelProperty(value = "责任部门")
|
||||
private String responseUnit;
|
||||
@ApiModelProperty(value = "新车型实施日期")
|
||||
private String newCarTime;
|
||||
@ApiModelProperty(value = "在产车实施日期")
|
||||
private String nowCarTime;
|
||||
@ApiModelProperty(value = "适用车辆类型")
|
||||
private String typeApplicable;
|
||||
@ApiModelProperty(value = "发布日期")
|
||||
private String issueTime;
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
private String textStatus;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* //TODO 添加类、接口描述
|
||||
* 能从主表中查出的LawsDto所需要的数据
|
||||
* @author ZhangZhiYuan
|
||||
* date 2021-06-22
|
||||
*/
|
||||
@Data
|
||||
public class LittleLawsDto {
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String standNumber;
|
||||
@ApiModelProperty(value = "中文名称")
|
||||
private String standName;
|
||||
@ApiModelProperty(value = "英文名称")
|
||||
private String standEnName;
|
||||
@ApiModelProperty(value = "发布日期")
|
||||
private String issueTime;
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
private String textStatus;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
* 上传的附件和清单id的关联表
|
||||
* @author zzy
|
||||
* @since 2021-06-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarDetailedIdAttFile对象", description="")
|
||||
public class SarDetailedIdAttFile extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "清单id")
|
||||
private String detailedId;
|
||||
|
||||
@ApiModelProperty(value = "文件id")
|
||||
private String fileId;
|
||||
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarLawsAttrDetailedList对象", description="")
|
||||
public class SarLawsAttrDetailedList extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "标准政策表的id")
|
||||
private String standId;
|
||||
|
||||
@ApiModelProperty(value = "标准清单主键")
|
||||
private String detailedListId;
|
||||
|
||||
@ApiModelProperty(value = "顺序")
|
||||
private String number;
|
||||
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* //TODO 添加类、接口描述
|
||||
*用于导出标准数据信息
|
||||
* 需要后期修改
|
||||
* @author ZhangZhiYuan
|
||||
* @date 2021-06-24
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class StandExcelDto {
|
||||
@ExcelProperty("标准编号")
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String standNumber;
|
||||
@ExcelProperty("中文名称")
|
||||
@ApiModelProperty(value = "中文名称")
|
||||
private String standName;
|
||||
@ExcelProperty("英文名称")
|
||||
@ApiModelProperty(value = "英文名称")
|
||||
private String standEnName;
|
||||
@ExcelProperty("责任部门")
|
||||
@ApiModelProperty(value = "责任部门")
|
||||
private String responseUnit;
|
||||
@ExcelProperty("新车型实施日期")
|
||||
@ApiModelProperty(value = "新车型实施日期")
|
||||
private String newCarTime;
|
||||
@ExcelProperty("在产车实施日期")
|
||||
@ApiModelProperty(value = "在产车实施日期")
|
||||
private String nowCarTime;
|
||||
@ExcelProperty("适用车辆类型")
|
||||
@ApiModelProperty(value = "适用车辆类型")
|
||||
private String typeApplicable;
|
||||
@ExcelProperty("发布日期")
|
||||
@ApiModelProperty(value = "发布日期")
|
||||
private String issueTime;
|
||||
@ExcelProperty("文本状态")
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
private String textStatus;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* //TODO 添加类、接口描述
|
||||
*
|
||||
* @author ZhangZhiYuan
|
||||
* @date 2021-06-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "标准导出类")
|
||||
public class StandExcelVo {
|
||||
@ApiModelProperty("文件名")
|
||||
String exportName;
|
||||
@ApiModelProperty("标准ID列表")
|
||||
List<String> ids;
|
||||
@ApiModelProperty("ID")
|
||||
String id;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.service;
|
||||
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-24
|
||||
*/
|
||||
public interface ISarDetailedIdAttFileService extends IService<SarDetailedIdAttFile> {
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.service;
|
||||
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LawsDto;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandExcelVo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
public interface ISarLawsAttrDetailedListService extends IService<SarLawsAttrDetailedList> {
|
||||
|
||||
List<LawsDto> selectLaws(String standId, Integer Page, Integer Size,String standName);
|
||||
Boolean insertDetailedList(String id,String[] lawsIds);
|
||||
Boolean updateDetailedLaws(String id,String[] lawsIds);
|
||||
void exportExcel(HttpServletResponse response, StandExcelVo standExcelVo);
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.service.impl;
|
||||
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarDetailedIdAttFile;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarDetailedIdAttFileDao;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.service.ISarDetailedIdAttFileService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-24
|
||||
*/
|
||||
@Service
|
||||
public class SarDetailedIdAttFileServiceImpl extends ServiceImpl<SarDetailedIdAttFileDao, SarDetailedIdAttFile> implements ISarDetailedIdAttFileService {
|
||||
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package com.adc.da.slrs.sarLawsAttrDetailedList.service.impl;
|
||||
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LawsDto;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.LittleLawsDto;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandExcelVo;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.service.ISarLawsAttrDetailedListService;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zzy
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@Service
|
||||
public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrDetailedListDao, SarLawsAttrDetailedList> implements ISarLawsAttrDetailedListService {
|
||||
|
||||
@Autowired
|
||||
SarLawsAttrDetailedListDao sarLawsAttrDetailedListDao;
|
||||
//从主表中查询信息
|
||||
@Override
|
||||
public List<LawsDto> selectLaws(String standId, Integer Page, Integer Size,String standName) {
|
||||
List<String> lawsIds = sarLawsAttrDetailedListDao.selectLawsId(standId,Page,Size);
|
||||
if (CollectionUtils.isEmpty(lawsIds)){
|
||||
return null;
|
||||
}
|
||||
List<LittleLawsDto> lawsDtoList = sarLawsAttrDetailedListDao.selectLawsById(lawsIds,standName);
|
||||
List<LawsDto> list = new ArrayList<>();
|
||||
for (LittleLawsDto laws:lawsDtoList){
|
||||
LawsDto lawsDto = LawsDto.builder()
|
||||
.id(laws.getId())
|
||||
.standNumber(laws.getStandNumber())
|
||||
.standName(laws.getStandName())
|
||||
.standEnName(laws.getStandEnName())
|
||||
.issueTime(laws.getIssueTime())
|
||||
.textStatus(laws.getTextStatus())
|
||||
.build();
|
||||
list.add(lawsDto);
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//向清单表和主表中的关联表插入信息
|
||||
@Override
|
||||
public Boolean insertDetailedList(String standId, String[] lawsIds) {
|
||||
if (!StringUtils.isEmpty(lawsIds)){
|
||||
try {
|
||||
List<SarLawsAttrDetailedList> attrDetailedLists = new ArrayList<>();
|
||||
int a=0;
|
||||
for (String lawsId:lawsIds){
|
||||
SarLawsAttrDetailedList sarLawsAttrDetailedList = SarLawsAttrDetailedList.builder()
|
||||
.id(UUIDUtils.randomUUID20())
|
||||
.standId(lawsId)
|
||||
.detailedListId(standId)
|
||||
.number(String.valueOf(a))
|
||||
.build();
|
||||
attrDetailedLists.add(sarLawsAttrDetailedList);
|
||||
a++;
|
||||
}
|
||||
sarLawsAttrDetailedListDao.insertList(attrDetailedLists);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//修改关联表中的信息,先删除后修改
|
||||
@Override
|
||||
public Boolean updateDetailedLaws(String id, String[] lawsIds) {
|
||||
try {
|
||||
QueryWrapper<SarLawsAttrDetailedList> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("detailed_list_id",id);
|
||||
sarLawsAttrDetailedListDao.delete(wrapper);
|
||||
insertDetailedList(id,lawsIds);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportExcel(HttpServletResponse response, StandExcelVo standExcelVo){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.controller;
|
||||
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.service.impl.SarLawsDetailedListServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author szc
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@RestController
|
||||
//@Api(description = "|SarLawsDetailedList|")
|
||||
@Api(tags = "标准法规清单")
|
||||
@RequestMapping("/api/sarLawsDetailedList/sar-laws-detailed-list")
|
||||
public class SarLawsDetailedListController extends BaseController<SarLawsDetailedList> {
|
||||
|
||||
@Autowired
|
||||
private SarLawsDetailedListServiceImpl sarLawsDetailedListService;
|
||||
|
||||
/**
|
||||
* @param idList 要进行删除的清单id
|
||||
* @return ResponseMessage
|
||||
* @author zzy
|
||||
* date 2021-06-22
|
||||
**/
|
||||
@ApiOperation(value = "批量删除清单")
|
||||
@PostMapping("/deleteListAll")
|
||||
public ResponseMessage deleteListAll(String[] idList) {
|
||||
if (idList == null || idList.length == 0) {
|
||||
return Result.success("200", "要删除的数据为空");
|
||||
} else {
|
||||
List<String> list = new ArrayList<>(Arrays.asList(idList));
|
||||
String src = sarLawsDetailedListService.del(list);
|
||||
return Result.success("200", src);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param addDetailedDto AddDetailed类
|
||||
* @return ResponseMessage
|
||||
* @author zzy
|
||||
* date 2021-06-22
|
||||
**/
|
||||
@ApiOperation(value = "增加清单")
|
||||
@PostMapping("/insertList")
|
||||
public ResponseMessage insertList(AddDetailedDto addDetailedDto) {
|
||||
String src = sarLawsDetailedListService.add(addDetailedDto);
|
||||
return Result.success(src);
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态查询
|
||||
* @param page 页数
|
||||
* @param pageSize 大小
|
||||
* @param sortKey 进行三个页面的分类1,2,3
|
||||
* @param countryArea 动态查询输入 国家清单
|
||||
* @param detailedList 列表
|
||||
* @param projectName 其他
|
||||
* @param detailedListName 动态查询输入
|
||||
* @return ResponseMessage
|
||||
*/
|
||||
@ApiOperation(value = "动态查询")
|
||||
@GetMapping("/getAllStand")
|
||||
public ResponseMessage getAllStand(Integer page,Integer pageSize, String sortKey,
|
||||
String countryArea, String projectName,
|
||||
String detailedList,
|
||||
String detailedListName) {
|
||||
|
||||
if ("null".equals(countryArea))countryArea=null;
|
||||
if ("null".equals(projectName))projectName=null;
|
||||
if ("null".equals(detailedList))detailedList=null;
|
||||
if ("null".equals(detailedListName))detailedListName=null;
|
||||
if (StringUtils.isNotEmpty(sortKey)) {
|
||||
IPage<SarLawsDetailedList> publicList = sarLawsDetailedListService.AllSelectD(page, pageSize, sortKey,
|
||||
countryArea, projectName, detailedList, detailedListName);
|
||||
return Result.success("200", publicList);
|
||||
} else {
|
||||
return Result.success("200", null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param detailedUpDto 修改的信息,通过类进行接收
|
||||
* @return ResponseMessage
|
||||
* @author 张志远
|
||||
* date 2021-06-22
|
||||
**/
|
||||
@ApiOperation(value = "修改清单")
|
||||
@PutMapping("/updateList")
|
||||
public ResponseMessage updateList(@RequestBody DetailedUpDto detailedUpDto) {
|
||||
|
||||
String src = sarLawsDetailedListService.updateList(detailedUpDto);
|
||||
return Result.success("200",src,true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.dao;
|
||||
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author szc
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface SarLawsDetailedListDao extends BaseMapper<SarLawsDetailedList> {
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* //TODO 添加类、接口描述
|
||||
*
|
||||
* @author ZhangZhiYuan
|
||||
* @date 2021-06-24
|
||||
*/
|
||||
@Data
|
||||
public class AddDetailedDto {
|
||||
|
||||
@ApiModelProperty(value = "国家或地区")
|
||||
private String countryArea;
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty(value = "清单类别")
|
||||
private String detailedList;
|
||||
@ApiModelProperty(value = "区分,国家地区为1,项目名称为2,清单类别为3")
|
||||
private String sortKey;
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
private String detailedListName;
|
||||
|
||||
@ApiModelProperty(value = "清单详情")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "清单状态,1为未发布,2为发布")
|
||||
private String detailedListState;
|
||||
@ApiModelProperty(value = "适用领域")
|
||||
private String applicationScope;
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updatePeople;
|
||||
@ApiModelProperty(value = "上传的附件")
|
||||
private MultipartFile[] files;
|
||||
@ApiModelProperty(value = "要添加的清单id")
|
||||
private String[] lawsIds;
|
||||
|
||||
|
||||
public MultipartFile getFiles(int i) {
|
||||
return files[i];
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* //TODO 添加类、接口描述
|
||||
*
|
||||
* @author ZhangZhiYuan
|
||||
* @date 2021-06-25
|
||||
*/
|
||||
@Data
|
||||
public class DetailedUpDto {
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "国家或地区")
|
||||
private String countryArea;
|
||||
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty(value = "清单类别")
|
||||
private String detailedList;
|
||||
|
||||
@ApiModelProperty(value = "区分,国家地区为1,项目名称为2,清单类别为3")
|
||||
private String sortKey;
|
||||
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
private String detailedListName;
|
||||
|
||||
@ApiModelProperty(value = "清单状态,1为未发布,2为发布")
|
||||
private String detailedListState;
|
||||
|
||||
@ApiModelProperty(value = "清单版本,默认V0")
|
||||
private String detailedListVision;
|
||||
|
||||
@ApiModelProperty(value = "适用领域")
|
||||
private String applicationScope;
|
||||
|
||||
// @ApiModelProperty(value = "附件id")
|
||||
// private String fileId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date reNewTime;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String reNewPeople;
|
||||
|
||||
@ApiModelProperty(value = "要添加的清单id")
|
||||
private String[] lawsIds;
|
||||
|
||||
@ApiModelProperty(value = "清单详情")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* //TODO 添加类、接口描述
|
||||
*
|
||||
* @author ZhangZhiYuan
|
||||
* @date 2021-06-22
|
||||
*/
|
||||
@Data
|
||||
public class IdListDto {
|
||||
@ApiModelProperty("未符合项ID列表")
|
||||
private List<String> Ids;
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author szc
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarLawsDetailedList对象", description="")
|
||||
public class SarLawsDetailedList extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "国家或地区")
|
||||
@TableField("country_area")
|
||||
private String countryArea;
|
||||
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
@TableField("project_name")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty(value = "清单类别")
|
||||
@TableField("detailed_list")
|
||||
private String detailedList;
|
||||
|
||||
@ApiModelProperty(value = "区分,国家地区为1,项目名称为2,清单类别为3")
|
||||
@TableField("sort_key")
|
||||
private String sortKey;
|
||||
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
@TableField("detailed_list_name")
|
||||
private String detailedListName;
|
||||
|
||||
@ApiModelProperty(value = "清单状态,1为未发布,2为发布")
|
||||
@TableField("detailed_list_state")
|
||||
private String detailedListState;
|
||||
|
||||
@ApiModelProperty(value = "清单版本,默认V0")
|
||||
@TableField("detailed_list_vesion")
|
||||
private String detailedListVision;
|
||||
|
||||
@ApiModelProperty(value = "适用领域")
|
||||
@TableField("application_scope")
|
||||
private String applicationScope;
|
||||
|
||||
@ApiModelProperty(value = "清单列表")
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
@TableField("update_people")
|
||||
private String updatePeople;
|
||||
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.service;
|
||||
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author szc
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
public interface ISarLawsDetailedListService extends IService<SarLawsDetailedList> {
|
||||
String del(List<String> idList);
|
||||
String add(AddDetailedDto addDetailedDto);
|
||||
IPage<SarLawsDetailedList> AllSelectD(Integer pages, Integer size, String sortKey,
|
||||
String countryArea,String projectName,
|
||||
String detailedList, String detailedListName);
|
||||
// IPage<SarLawsDetailedList> selectAllP(Integer pages,Integer size,String sortKey);
|
||||
|
||||
String updateList(DetailedUpDto detailedUpDto);
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.service.impl;
|
||||
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarDetailedIdAttFileDao;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.service.impl.SarLawsAttrDetailedListServiceImpl;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.dao.SarLawsDetailedListDao;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
|
||||
import com.adc.da.slrs.sarLawsDetailedList.service.ISarLawsDetailedListService;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author szc
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
@Service
|
||||
public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedListDao, SarLawsDetailedList> implements ISarLawsDetailedListService {
|
||||
|
||||
@Autowired
|
||||
public SarLawsDetailedListDao sarLawsDetailedListDao;
|
||||
@Autowired
|
||||
public IAttFileEOService iAttFileEOService;
|
||||
@Autowired
|
||||
private SarLawsAttrDetailedListDao sarLawsAttrDetailedListDao;
|
||||
@Autowired
|
||||
private SarLawsAttrDetailedListServiceImpl service;
|
||||
|
||||
@Override
|
||||
public String del(List<String> idList) {
|
||||
QueryWrapper<SarLawsAttrDetailedList> wrapper = new QueryWrapper<>();
|
||||
for (String id:idList){
|
||||
wrapper.eq("detailed_list_id",id);
|
||||
sarLawsAttrDetailedListDao.delete(wrapper);
|
||||
}
|
||||
sarLawsDetailedListDao.deleteBatchIds(idList);
|
||||
return "删除成功";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String add(AddDetailedDto addDetailedDto) {
|
||||
try {
|
||||
SarLawsDetailedList sarLawsDetailedList = SarLawsDetailedList.builder()
|
||||
.id(UUIDUtils.randomUUID20())
|
||||
.sortKey(addDetailedDto.getSortKey())
|
||||
.detailedListName(addDetailedDto.getDetailedListName())
|
||||
.detailedListState("1")
|
||||
.detailedListVision("v0")
|
||||
.applicationScope(addDetailedDto.getApplicationScope())
|
||||
.updateTime(new Date())
|
||||
.updatePeople(addDetailedDto.getUpdatePeople())
|
||||
.remark(addDetailedDto.getRemark())
|
||||
.build();
|
||||
switch (addDetailedDto.getSortKey()) {
|
||||
case "1":
|
||||
sarLawsDetailedList.setCountryArea(addDetailedDto.getCountryArea());
|
||||
break;
|
||||
case "2":
|
||||
sarLawsDetailedList.setProjectName(addDetailedDto.getProjectName());
|
||||
break;
|
||||
case "3":
|
||||
sarLawsDetailedList.setDetailedList(addDetailedDto.getDetailedList());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sarLawsDetailedListDao.insert(sarLawsDetailedList);
|
||||
service.insertDetailedList(sarLawsDetailedList.getId(),addDetailedDto.getLawsIds());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "添加成功";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<SarLawsDetailedList> AllSelectD(Integer pages, Integer size, String sortKey,
|
||||
String countryArea,String projectName,
|
||||
String detailedList,String detailedListName) {
|
||||
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
|
||||
if ("1".equals(sortKey) ) {
|
||||
wrapper.like(StringUtils.isNotEmpty(countryArea),"country_area",countryArea).
|
||||
like(StringUtils.isNotEmpty(detailedListName),"detailed_list_name",detailedListName);
|
||||
}else if ("2".equals(sortKey)) {
|
||||
wrapper.like(StringUtils.isNotEmpty(projectName),"project_name",projectName).
|
||||
like(StringUtils.isNotEmpty(detailedListName),"detailed_list_name",detailedListName);
|
||||
|
||||
}else if ("3".equals(sortKey)){
|
||||
wrapper.like(StringUtils.isNotEmpty(detailedList),"detailed_list_state",detailedList).
|
||||
like(StringUtils.isNotEmpty(detailedListName),"detailed_list_name",detailedListName);
|
||||
}
|
||||
wrapper.eq("sort_key",sortKey);
|
||||
Page<SarLawsDetailedList> page = new Page<>(pages, size);
|
||||
IPage<SarLawsDetailedList> userIPage = sarLawsDetailedListDao.selectPage(page, wrapper);
|
||||
System.out.println("总条数" + userIPage.getTotal());
|
||||
System.out.println("总页数" + userIPage.getPages());
|
||||
return userIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateList(DetailedUpDto detailedUpDto) {
|
||||
SarLawsDetailedList list = sarLawsDetailedListDao.selectById(detailedUpDto.getId());
|
||||
//国家或地区
|
||||
if (StringUtils.isBlank(detailedUpDto.getCountryArea())) list.setCountryArea(null);
|
||||
else if ("null".equals(detailedUpDto.getCountryArea()));
|
||||
else list.setCountryArea(detailedUpDto.getCountryArea());
|
||||
//项目名称
|
||||
if (StringUtils.isBlank(detailedUpDto.getProjectName())) list.setProjectName(null);
|
||||
else if ("null".equals(detailedUpDto.getProjectName()));
|
||||
else list.setProjectName(detailedUpDto.getProjectName());
|
||||
//清单类别
|
||||
if (StringUtils.isBlank(detailedUpDto.getDetailedList())) list.setDetailedList(null);
|
||||
else if ("null".equals(detailedUpDto.getDetailedList()));
|
||||
else list.setDetailedList(detailedUpDto.getDetailedList());
|
||||
//清单名称
|
||||
if (StringUtils.isBlank(detailedUpDto.getDetailedListName())) list.setDetailedListName(null);
|
||||
else if ("null".equals(detailedUpDto.getDetailedListName()));
|
||||
else list.setDetailedListName(detailedUpDto.getDetailedListName());
|
||||
//适用领域
|
||||
if (StringUtils.isBlank(detailedUpDto.getApplicationScope())) list.setApplicationScope(null);
|
||||
else if ("null".equals(detailedUpDto.getApplicationScope()));
|
||||
else list.setApplicationScope(detailedUpDto.getApplicationScope());
|
||||
//清单详情
|
||||
if (StringUtils.isBlank(detailedUpDto.getRemark())) list.setRemark(null);
|
||||
else if ("null".equals(detailedUpDto.getRemark()));
|
||||
list.setRemark(detailedUpDto.getRemark());
|
||||
//更新时间
|
||||
list.setUpdateTime(new Date());
|
||||
//更新人
|
||||
if (StringUtils.isBlank(detailedUpDto.getReNewPeople())) list.setUpdatePeople(null);
|
||||
else if ("null".equals(detailedUpDto.getReNewPeople()));
|
||||
else list.setUpdatePeople(detailedUpDto.getReNewPeople());
|
||||
|
||||
sarLawsDetailedListDao.updateById(list);
|
||||
service.updateDetailedLaws(detailedUpDto.getId(), detailedUpDto.getLawsIds());
|
||||
return "修改成功";
|
||||
}
|
||||
}
|
||||
+31
-3
@@ -9,11 +9,10 @@ import com.adc.da.sys.common.SelectionResult;
|
||||
import com.adc.da.sys.service.IDicTypeEOService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -59,7 +58,9 @@ public class SarMenuController extends BaseController<SarMenu> {
|
||||
for (SarMenu resultMenu : resultList) {
|
||||
if ("gxhbq".equals(resultMenu.getId())) {
|
||||
// 查出配置管理项
|
||||
System.out.println(resultMenu);
|
||||
List<SelectionResult> getDicList = dicTypeEOService.getDicTypeByDicId("ZHFKGAACTNUCN9AR5YBM");
|
||||
System.out.println(getDicList);
|
||||
if (getDicList != null && !getDicList.isEmpty()) {
|
||||
for (SelectionResult selectionResult : getDicList) {
|
||||
int i=0;
|
||||
@@ -76,6 +77,33 @@ public class SarMenuController extends BaseController<SarMenu> {
|
||||
}
|
||||
}
|
||||
resultList.addAll(listDic);
|
||||
System.out.println("listDic");
|
||||
System.out.println(listDic);
|
||||
return Result.success(resultList);
|
||||
}
|
||||
|
||||
@ApiOperation("查询所有菜单")
|
||||
@GetMapping
|
||||
public ResponseMessage<List<SarMenu>> getAll(){
|
||||
List<SarMenu> sarMenus=sarMenuEOService.getAll();
|
||||
return Result.success(sarMenus);
|
||||
}
|
||||
|
||||
@ApiOperation("添加菜单")
|
||||
@PostMapping("/add")
|
||||
public ResponseMessage<Object> addMenu(@RequestBody SarMenu sarMenu){
|
||||
return sarMenuEOService.addMenu(sarMenu);
|
||||
}
|
||||
|
||||
@ApiOperation("编辑菜单")
|
||||
@PutMapping
|
||||
public ResponseMessage<Object> updateMenu(@Validated(SarMenu.update.class) @RequestBody SarMenu sarMenu){
|
||||
return sarMenuEOService.updateMenu(sarMenu);
|
||||
}
|
||||
|
||||
@ApiOperation("删除菜单")
|
||||
@DeleteMapping
|
||||
public ResponseMessage<Object> delMenu(@RequestParam String menuId){
|
||||
return sarMenuEOService.delMenu(menuId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.adc.da.base.entity.BaseEntity;
|
||||
import com.adc.da.utils.treetool.annotation.TreeNodeId;
|
||||
import com.adc.da.utils.treetool.annotation.TreeNodeName;
|
||||
import com.adc.da.utils.treetool.annotation.TreeNodeParentId;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
@@ -17,6 +18,8 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
@@ -30,13 +33,15 @@ import org.springframework.data.annotation.Transient;
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarMenu对象", description="")
|
||||
public class SarMenu extends BaseEntity {
|
||||
public interface update{
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@TreeNodeId
|
||||
@NotNull(message = "id不能为空",groups = {update.class})
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId("ID")
|
||||
@TableId(value = "ID",type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "标准法规划分")
|
||||
@@ -61,6 +66,10 @@ public class SarMenu extends BaseEntity {
|
||||
@TableField("DISPLAY_SEQ")
|
||||
private Integer displaySeq;
|
||||
|
||||
@ApiModelProperty(value = "路径")
|
||||
@TableField("HREF")
|
||||
private String href;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
@TableField("VALID_FLAG")
|
||||
private Integer validFlag;
|
||||
@@ -77,6 +86,10 @@ public class SarMenu extends BaseEntity {
|
||||
@TableField("REMARKS")
|
||||
private String remarks;
|
||||
|
||||
@ApiModelProperty(value = "子菜单")
|
||||
@TableField(exist = false)
|
||||
private List<SarMenu> children;
|
||||
|
||||
@TableField(exist=false)
|
||||
private List<String> roleIds;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.slrs.sarMenu.service;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -24,4 +25,44 @@ public interface ISarMenuService extends IService<SarMenu> {
|
||||
List<String> queryRoleMenuIdList(String sordDivide, String menuId) throws Exception;
|
||||
|
||||
List<String> getChildMenuList(String menuId);
|
||||
|
||||
/**
|
||||
* 通过ids查询menus
|
||||
* @param menuIds:菜单ID
|
||||
* @return List<SarMenu>
|
||||
*/
|
||||
List<SarMenu> getMenusByIds(List<String> menuIds);
|
||||
|
||||
/**
|
||||
* 查询所有菜单
|
||||
*/
|
||||
List<SarMenu> getAll();
|
||||
|
||||
/**
|
||||
* 添加菜单
|
||||
* @param sarMenu:菜单信息
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
ResponseMessage<Object> addMenu(SarMenu sarMenu);
|
||||
|
||||
/**
|
||||
* 编辑菜单
|
||||
* @param sarMenu:菜单信息
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
ResponseMessage<Object> updateMenu(SarMenu sarMenu);
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param menuId :菜单ID
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
ResponseMessage<Object> delMenu(String menuId);
|
||||
|
||||
/**
|
||||
* 通过Ids查询menu
|
||||
* @param menuIds :菜单Ids
|
||||
* @return List<Menu>
|
||||
*/
|
||||
List<SarMenu> getMenuByIds(List<String> menuIds);
|
||||
}
|
||||
|
||||
+115
@@ -1,5 +1,7 @@
|
||||
package com.adc.da.slrs.sarMenu.service.impl;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
||||
import com.adc.da.slrs.sarMenu.dao.SarMenuDao;
|
||||
@@ -152,4 +154,117 @@ public class SarMenuServiceImpl extends ServiceImpl<SarMenuDao, SarMenu> impleme
|
||||
}
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ids查询menus
|
||||
* @param menuIds:菜单ID
|
||||
* @return List<SarMenu>
|
||||
*/
|
||||
@Override
|
||||
public List<SarMenu> getMenusByIds(List<String> menuIds) {
|
||||
QueryWrapper<SarMenu> menuQueryWrapper=new QueryWrapper<>();
|
||||
menuQueryWrapper.in("id",menuIds);
|
||||
return dao.selectList(menuQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有菜单
|
||||
*/
|
||||
@Override
|
||||
public List<SarMenu> getAll() {
|
||||
QueryWrapper<SarMenu> sarMenuQueryWrapper=new QueryWrapper<>();
|
||||
sarMenuQueryWrapper.orderByAsc("DISPLAY_SEQ");
|
||||
sarMenuQueryWrapper.isNull("PARENT_ID");
|
||||
List<SarMenu> sarMenus=dao.selectList(sarMenuQueryWrapper);
|
||||
for(SarMenu sarMenu:sarMenus){
|
||||
sarMenu.setChildren(recursionGetChildren((sarMenu)));
|
||||
}
|
||||
return sarMenus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加菜单
|
||||
* @param sarMenu:菜单信息
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<Object> addMenu(SarMenu sarMenu) {
|
||||
if(sarMenu.getParentId()!=null){
|
||||
SarMenu parent=dao.selectById(sarMenu.getParentId());
|
||||
if(parent==null){
|
||||
return Result.error("该父菜单不存在");
|
||||
}
|
||||
}
|
||||
dao.insert(sarMenu);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑菜单
|
||||
* @param sarMenu:菜单信息
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<Object> updateMenu(SarMenu sarMenu) {
|
||||
SarMenu oldMenu=dao.selectById(sarMenu.getId());
|
||||
if(oldMenu==null){
|
||||
return Result.error("该菜单不存在");
|
||||
}
|
||||
if(sarMenu.getParentId()!=null){
|
||||
SarMenu parent=dao.selectById(sarMenu.getParentId());
|
||||
if(parent==null){
|
||||
return Result.error("父节点不存在");
|
||||
}
|
||||
}
|
||||
dao.updateById(sarMenu);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param menuId :菜单ID
|
||||
* @return ResponseMessage<Object>
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<Object> delMenu(String menuId) {
|
||||
QueryWrapper<SarMenu> sarMenuQueryWrapper=new QueryWrapper<>();
|
||||
sarMenuQueryWrapper.eq("parent_id",menuId);
|
||||
List<SarMenu> children=dao.selectList(sarMenuQueryWrapper);
|
||||
if(children!=null&&children.size()>0){
|
||||
return Result.error("该菜单有子节点,无法删除");
|
||||
}
|
||||
dao.deleteById(menuId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过Ids查询menu
|
||||
* @param menuIds :菜单Ids
|
||||
* @return List<Menu>
|
||||
*/
|
||||
@Override
|
||||
public List<SarMenu> getMenuByIds(List<String> menuIds) {
|
||||
if(menuIds!=null&&menuIds.size()>0){
|
||||
QueryWrapper<SarMenu> sarMenuQueryWrapper=new QueryWrapper<>();
|
||||
sarMenuQueryWrapper.in("id",menuIds);
|
||||
return dao.selectList(sarMenuQueryWrapper);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归调用获取子节点
|
||||
* @param parent:父节点
|
||||
* @return List<SarMenu>
|
||||
*/
|
||||
private List<SarMenu> recursionGetChildren(SarMenu parent){
|
||||
QueryWrapper<SarMenu> sarMenuQueryWrapper=new QueryWrapper<>();
|
||||
sarMenuQueryWrapper.orderByAsc("DISPLAY_SEQ");
|
||||
sarMenuQueryWrapper.eq("PARENT_ID",parent.getId());
|
||||
List<SarMenu> children=dao.selectList(sarMenuQueryWrapper);
|
||||
for(SarMenu sarMenu:children){
|
||||
sarMenu.setChildren(recursionGetChildren((sarMenu)));
|
||||
}
|
||||
return children;
|
||||
}
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.controller;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenuEO;
|
||||
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserPersonalMenuService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenu;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "福田标准法规--个人中心--我的板块")
|
||||
@RequestMapping("/${restPath}/sarPersonalCenter/sar-user-personal-menu")
|
||||
public class SarUserPersonalMenuController extends BaseController<SarUserPersonalMenu> {
|
||||
|
||||
@Autowired
|
||||
private ISarUserPersonalMenuService iSarUserPersonalMenuService;
|
||||
|
||||
@ApiOperation("获取用户的板块列表")
|
||||
@GetMapping("/getList")
|
||||
public ResponseMessage<IPage<SarUserPersonalMenu>> getList(SarUserPersonalMenuEO eo){
|
||||
return iSarUserPersonalMenuService.getUserPersonalMenu(eo);
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户的板块列表")
|
||||
@PostMapping("/update")
|
||||
public ResponseMessage<IPage<SarUserPersonalMenu>> update(@RequestBody SarUserPersonalMenuEO eo){
|
||||
return iSarUserPersonalMenuService.updateUserPersonalMenu(eo);
|
||||
}
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.controller;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
|
||||
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserStarService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-21
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "福田标准法规--个人中心--我的收藏")
|
||||
@RequestMapping("/${restPath}/sarPersonalCenter/sar-user-star")
|
||||
public class SarUserStarController extends BaseController<SarUserStar> {
|
||||
|
||||
@Autowired
|
||||
private ISarUserStarService iSarUserStarService;
|
||||
|
||||
@ApiOperation("获取用户收藏列表")
|
||||
@GetMapping("/getList")
|
||||
public ResponseMessage<IPage<SarUserStar>> getUserStarList(SarUserStarEO sarUserStarEO) {
|
||||
return iSarUserStarService.getUserStarList(sarUserStarEO);
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除用户收藏")
|
||||
@PostMapping("/deleteList")
|
||||
public ResponseMessage<IPage<SarUserStar>> deleteList(@RequestBody SarUserStarEO sarUserStars) {
|
||||
return iSarUserStarService.deleteList(sarUserStars);
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户收藏")
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage<Boolean> deleteById(@RequestBody SarUserStarEO sarUserStars) {
|
||||
return iSarUserStarService.deleteById(sarUserStars);
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户收藏")
|
||||
@PostMapping("/addStar")
|
||||
public ResponseMessage<Boolean> addStar(@RequestBody SarUserStar sarUserStar) {
|
||||
return iSarUserStarService.addStar(sarUserStar);
|
||||
}
|
||||
|
||||
@ApiOperation("获取当前用户是否收藏该页面")
|
||||
@GetMapping("/isStar")
|
||||
public ResponseMessage<Boolean> isStar(String userId, String url) {
|
||||
return iSarUserStarService.isStar(userId,url);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.dao;
|
||||
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenu;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
public interface SarUserPersonalMenuDao extends BaseMapper<SarUserPersonalMenu> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.dao;
|
||||
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-21
|
||||
*/
|
||||
public interface SarUserStarDao extends BaseMapper<SarUserStar> {
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarUserPersonalMenu对象", description="")
|
||||
public class SarUserPersonalMenu extends BaseEntity {
|
||||
|
||||
@TableId(type = IdType.UUID)
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
private String menuName;
|
||||
|
||||
private String menuId;
|
||||
|
||||
private Integer state;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String menuUrl;
|
||||
|
||||
|
||||
public SarUserPersonalMenu(String menuName, String menuId, String menuUrl) {
|
||||
this.menuName = menuName;
|
||||
this.menuId = menuId;
|
||||
this.menuUrl = menuUrl;
|
||||
}
|
||||
|
||||
public SarUserPersonalMenu() {
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarUserPersonalMenu批量操作对象", description="")
|
||||
public class SarUserPersonalMenuEO extends SarUserPersonalMenu {
|
||||
|
||||
@ApiModelProperty("当页数量")
|
||||
private Integer size=20;
|
||||
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer current=1;
|
||||
|
||||
@ApiModelProperty("操作信息")
|
||||
private List<SarUserPersonalMenu> sarUserPersonalMenus;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-21
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value="SarUserStar对象", description="")
|
||||
public class SarUserStar extends BaseEntity {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "收藏名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "收藏类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "收藏具体信息")
|
||||
private String info;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "所属模块")
|
||||
private String modular;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "该收藏对应的路由")
|
||||
private String url;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarUserStar批量操作对象", description="")
|
||||
public class SarUserStarEO extends SarUserStar{
|
||||
|
||||
@ApiModelProperty("当页数量")
|
||||
private Integer size=20;
|
||||
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer current=1;
|
||||
|
||||
@ApiModelProperty("操作信息")
|
||||
private List<SarUserStar> sarUserStars;
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.service;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenu;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenuEO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
public interface ISarUserPersonalMenuService extends IService<SarUserPersonalMenu> {
|
||||
|
||||
public ResponseMessage<IPage<SarUserPersonalMenu>> getUserPersonalMenu(SarUserPersonalMenuEO eo);
|
||||
|
||||
public ResponseMessage<IPage<SarUserPersonalMenu>> updateUserPersonalMenu(SarUserPersonalMenuEO eo);
|
||||
|
||||
public void updateUserPersonalMenuForRole(List<SarMenu> menus, String userId);
|
||||
|
||||
/**
|
||||
* 更新用户权限
|
||||
* @param roleId:角色ID
|
||||
*/
|
||||
void setPersonalMenu(String roleId);
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.service;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-21
|
||||
*/
|
||||
public interface ISarUserStarService extends IService<SarUserStar> {
|
||||
public ResponseMessage<IPage<SarUserStar>> getUserStarList(SarUserStarEO sarUserStarEO);
|
||||
public ResponseMessage<IPage<SarUserStar>> deleteList(@RequestBody SarUserStarEO sarUserStars);
|
||||
public ResponseMessage<Boolean> deleteById(@RequestBody SarUserStarEO sarUserStars);
|
||||
public ResponseMessage<Boolean> addStar(@RequestBody SarUserStar sarUserStar);
|
||||
public ResponseMessage<Boolean> isStar(String userId, String url);
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.service.impl;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenu;
|
||||
import com.adc.da.slrs.sarPersonalCenter.dao.SarUserPersonalMenuDao;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenuEO;
|
||||
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserPersonalMenuService;
|
||||
import com.adc.da.slrs.sarUser.service.impl.TsUserServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Service
|
||||
public class SarUserPersonalMenuServiceImpl extends ServiceImpl<SarUserPersonalMenuDao, SarUserPersonalMenu> implements ISarUserPersonalMenuService {
|
||||
@Autowired
|
||||
@Lazy
|
||||
private TsUserServiceImpl tsUserService;
|
||||
|
||||
@Override
|
||||
public ResponseMessage<IPage<SarUserPersonalMenu>> getUserPersonalMenu(SarUserPersonalMenuEO eo) {
|
||||
if(eo.getUserId()==null||eo.getUserId().trim().length()==0){
|
||||
return Result.error("userId不能为空");
|
||||
}
|
||||
QueryWrapper<SarUserPersonalMenu> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",eo.getUserId());
|
||||
if(eo.getMenuUrl()!=null)queryWrapper.eq("menu_url",eo.getMenuUrl());
|
||||
if(eo.getMenuName()!=null&&eo.getMenuName().trim().length()>0)queryWrapper.like("menu_name",eo.getMenuName().trim());
|
||||
if(eo.getState()!=null)queryWrapper.eq("state",eo.getState());
|
||||
|
||||
IPage<SarUserPersonalMenu> iPage=new Page<>(eo.getCurrent(),eo.getSize());
|
||||
IPage<SarUserPersonalMenu> page = page(iPage, queryWrapper);
|
||||
while (page.getRecords().remove(null));
|
||||
return Result.success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseMessage<IPage<SarUserPersonalMenu>> updateUserPersonalMenu(SarUserPersonalMenuEO eo) {
|
||||
if(eo.getUserId()==null||eo.getUserId().trim().length()==0){
|
||||
return Result.error("userId不能为空");
|
||||
}
|
||||
List<SarUserPersonalMenu> menus=new ArrayList<>();
|
||||
if(eo.getSarUserPersonalMenus()!=null){
|
||||
for (SarUserPersonalMenu menu : eo.getSarUserPersonalMenus()) {
|
||||
if(menu.getId()!=null&&menu.getId().trim().length()>0&&menu.getState()!=null){
|
||||
|
||||
SarUserPersonalMenu sarUserPersonalMenu=new SarUserPersonalMenu();
|
||||
sarUserPersonalMenu.setState(menu.getState()==0?0:1);
|
||||
QueryWrapper<SarUserPersonalMenu> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",eo.getUserId());
|
||||
queryWrapper.eq("id",menu.getId());
|
||||
|
||||
update(sarUserPersonalMenu,queryWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getUserPersonalMenu(eo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserPersonalMenuForRole(List<SarMenu> menuList,String userId) {
|
||||
Set<String> ids=new HashSet<>();
|
||||
|
||||
for (SarMenu menu : menuList) {
|
||||
if(menu.getId()!=null&&menu.getId().trim().length()>0){
|
||||
|
||||
QueryWrapper<SarUserPersonalMenu> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",userId);
|
||||
queryWrapper.eq("menu_id",menu.getId());
|
||||
List<SarUserPersonalMenu> menus = getBaseMapper().selectList(queryWrapper);
|
||||
if (menus.size()>0) {
|
||||
ids.add(menus.get(0).getId());
|
||||
continue;
|
||||
}
|
||||
|
||||
SarUserPersonalMenu sarUserPersonalMenu=new SarUserPersonalMenu();
|
||||
sarUserPersonalMenu.setMenuName(menu.getMenuName());
|
||||
sarUserPersonalMenu.setMenuUrl(menu.getHref());
|
||||
sarUserPersonalMenu.setUserId(userId);
|
||||
sarUserPersonalMenu.setMenuId(menu.getId());
|
||||
sarUserPersonalMenu.setState(0);
|
||||
|
||||
getBaseMapper().insert(sarUserPersonalMenu);
|
||||
ids.add(sarUserPersonalMenu.getId());
|
||||
}
|
||||
}
|
||||
QueryWrapper<SarUserPersonalMenu> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.notIn("id",ids);
|
||||
queryWrapper.eq("user_id",userId);
|
||||
getBaseMapper().delete(queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户权限
|
||||
* @param roleId:角色ID
|
||||
*/
|
||||
@Async
|
||||
@Override
|
||||
public void setPersonalMenu(String roleId) {
|
||||
List<String> userIds=tsUserService.getUserIdsByRoleId(roleId);
|
||||
for(String userId:userIds){
|
||||
List<SarMenu> menus=tsUserService.getMenusByUserId(userId);
|
||||
updateUserPersonalMenuForRole(menus,userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
package com.adc.da.slrs.sarPersonalCenter.service.impl;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
||||
import com.adc.da.slrs.sarPersonalCenter.dao.SarUserStarDao;
|
||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
|
||||
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserStarService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-21
|
||||
*/
|
||||
@Service
|
||||
public class SarUserStarServiceImpl extends ServiceImpl<SarUserStarDao, SarUserStar> implements ISarUserStarService {
|
||||
|
||||
@Autowired
|
||||
private ISarUserStarService iSarUserStarService;
|
||||
|
||||
@Override
|
||||
public ResponseMessage<IPage<SarUserStar>> getUserStarList(SarUserStarEO sarUserStarEO) {
|
||||
if (sarUserStarEO.getUserId() == null) {
|
||||
return Result.error("userId不能为空");
|
||||
} else {
|
||||
if (sarUserStarEO.getSize() == null || sarUserStarEO.getSize() <= 0) sarUserStarEO.setSize(20);
|
||||
if (sarUserStarEO.getCurrent() == null || sarUserStarEO.getCurrent() <= 0) sarUserStarEO.setCurrent(1);
|
||||
QueryWrapper<SarUserStar> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("user_id", sarUserStarEO.getUserId());
|
||||
if(sarUserStarEO.getType()!=null)wrapper.like("type",sarUserStarEO.getType());
|
||||
if(sarUserStarEO.getName()!=null)wrapper.like("name",sarUserStarEO.getName());
|
||||
if(sarUserStarEO.getModular()!=null)wrapper.like("modular",sarUserStarEO.getModular());
|
||||
if(sarUserStarEO.getInfo()!=null)wrapper.like("info",sarUserStarEO.getInfo());
|
||||
if(sarUserStarEO.getUrl()!=null)wrapper.like("url",sarUserStarEO.getUrl());
|
||||
IPage<SarUserStar> page = iSarUserStarService.page(new Page<>(sarUserStarEO.getCurrent(), sarUserStarEO.getSize()), wrapper);
|
||||
while (page.getRecords().remove(null)) ;
|
||||
return Result.success(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseMessage<IPage<SarUserStar>> deleteList(@RequestBody SarUserStarEO sarUserStars) {
|
||||
if (sarUserStars.getUserId() == null) {
|
||||
return Result.error("userId不能为空");
|
||||
}
|
||||
if (!(sarUserStars.getSarUserStars() == null || sarUserStars.getSarUserStars().size() <= 0)) {
|
||||
for (SarUserStar sarUserStar : sarUserStars.getSarUserStars()) {
|
||||
if (sarUserStar.getId() != null) {
|
||||
QueryWrapper<SarUserStar> sarUserStarQueryWrapper = new QueryWrapper<>();
|
||||
sarUserStarQueryWrapper.eq("id", sarUserStar.getId());
|
||||
sarUserStarQueryWrapper.eq("user_id", sarUserStars.getUserId());
|
||||
iSarUserStarService.remove(sarUserStarQueryWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getUserStarList(sarUserStars);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseMessage<Boolean> deleteById(@RequestBody SarUserStarEO sarUserStars) {
|
||||
if (sarUserStars.getUserId() == null) {
|
||||
return Result.error("userId不能为空");
|
||||
}
|
||||
if ((sarUserStars.getId() == null && sarUserStars.getUrl() == null)) {
|
||||
return Result.error("url或id不能为空");
|
||||
}
|
||||
QueryWrapper<SarUserStar> sarUserStarQueryWrapper = new QueryWrapper<>();
|
||||
if(sarUserStars.getId()!=null)sarUserStarQueryWrapper.eq("id", sarUserStars.getId());
|
||||
else sarUserStarQueryWrapper.eq("url", sarUserStars.getUrl());
|
||||
sarUserStarQueryWrapper.eq("user_id", sarUserStars.getUserId());
|
||||
|
||||
|
||||
return Result.success(iSarUserStarService.remove(sarUserStarQueryWrapper));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseMessage<Boolean> addStar(@RequestBody SarUserStar sarUserStar) {
|
||||
if (sarUserStar.getUserId() == null) {
|
||||
return Result.error("userId不能为空");
|
||||
}
|
||||
if (sarUserStar.getUrl() == null
|
||||
&& sarUserStar.getModular() == null
|
||||
&& sarUserStar.getName() == null
|
||||
&& sarUserStar.getType() == null) {
|
||||
return Result.error("数据有误");
|
||||
}
|
||||
|
||||
sarUserStar.setId(null);
|
||||
sarUserStar.setCreateTime(new Date());
|
||||
|
||||
return Result.success(iSarUserStarService.save(sarUserStar));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseMessage<Boolean> isStar(String userId, String url) {
|
||||
if (userId == null) {
|
||||
return Result.error("userId不能为空");
|
||||
}
|
||||
if (url == null) {
|
||||
return Result.error("url不能为空");
|
||||
}
|
||||
|
||||
QueryWrapper<SarUserStar> sarUserStarQueryWrapper = new QueryWrapper<>();
|
||||
sarUserStarQueryWrapper.eq("user_id", userId);
|
||||
sarUserStarQueryWrapper.eq("url", url);
|
||||
int count = iSarUserStarService.count(sarUserStarQueryWrapper);
|
||||
|
||||
return Result.success(count > 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.adc.da.slrs.sarPosition.controller;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarPosition.entity.TsPositionRoleVO;
|
||||
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
|
||||
import com.adc.da.slrs.sarRole.entity.TsRole;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.adc.da.slrs.sarPosition.entity.TsPosition;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-23
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "|岗位管理|")
|
||||
@RequestMapping("/api/sarPosition/position")
|
||||
public class TsPositionController extends BaseController<TsPosition> {
|
||||
@Autowired
|
||||
private ITsPositionService tsPositionService;
|
||||
|
||||
/**
|
||||
* 查询岗位(可通过name筛选)
|
||||
* @param tsPosition:筛选信息
|
||||
*/
|
||||
@ApiOperation("查询岗位")
|
||||
@GetMapping
|
||||
public ResponseMessage<List<TsPosition>> getPosition(TsPosition tsPosition){
|
||||
List<TsPosition> positions=tsPositionService.getPosition(tsPosition);
|
||||
return Result.success(positions);
|
||||
}
|
||||
|
||||
@ApiOperation("新增岗位")
|
||||
@PostMapping
|
||||
public ResponseMessage<Object> addPosition(@Validated(TsPosition.insert.class) TsPosition tsPosition){
|
||||
return tsPositionService.addPosition(tsPosition);
|
||||
}
|
||||
|
||||
@ApiOperation("配置角色")
|
||||
@PostMapping("/role")
|
||||
public ResponseMessage<List<TsRole>> setRole(@Valid @RequestBody TsPositionRoleVO tsPositionRoleVO){
|
||||
return tsPositionService.setRole(tsPositionRoleVO);
|
||||
}
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@GetMapping("/role")
|
||||
public ResponseMessage<List<TsRole>> getRole(@RequestParam String positionId){
|
||||
List<TsRole> roles=tsPositionService.getRole(positionId);
|
||||
return Result.success(roles);
|
||||
}
|
||||
|
||||
@ApiOperation("编辑岗位")
|
||||
@PutMapping
|
||||
public ResponseMessage<Object> updatePosition(@Validated(TsPosition.update.class) TsPosition tsPosition){
|
||||
return tsPositionService.updatePosition(tsPosition);
|
||||
}
|
||||
|
||||
@ApiOperation("删除岗位")
|
||||
@DeleteMapping
|
||||
public ResponseMessage<Object> deletePosition(@RequestParam String positionId){
|
||||
return tsPositionService.deletePosition(positionId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.adc.da.slrs.sarPosition.dao;
|
||||
|
||||
import com.adc.da.slrs.sarPosition.entity.TsPosition;
|
||||
import com.adc.da.slrs.sarRole.entity.TsRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zyl
|
||||
* @since 2021-06-23
|
||||
*/
|
||||
public interface TsPositionDao extends BaseMapper<TsPosition> {
|
||||
|
||||
/**
|
||||
* 查询岗位绑定的角色ID
|
||||
* @param positionId:岗位ID
|
||||
* @return List<String>:角色ID
|
||||
*/
|
||||
@Select("select role_id from ts_position_role where position_id=#{positionId}")
|
||||
List<String> getRoleId(String positionId);
|
||||
|
||||
/**
|
||||
* 绑定角色
|
||||
* @param positionId:岗位ID
|
||||
* @param roleId:角色ID
|
||||
*/
|
||||
@Insert("insert into ts_position_role (position_id,role_id) values (#{positionId},#{roleId})")
|
||||
void insertRole(String positionId, String roleId);
|
||||
|
||||
/**
|
||||
* 解绑角色
|
||||
* @param positionId:岗位ID
|
||||
* @param roleId:角色ID
|
||||
*/
|
||||
@Delete("delete from ts_position_role where position_id=#{positionId} and role_id=#{roleId}")
|
||||
void deleteRole(String positionId, String roleId);
|
||||
|
||||
/**
|
||||
* 查询岗位绑定的角色信息
|
||||
* @param positionId:岗位ID
|
||||
* @return List<TsRole>
|
||||
*/
|
||||
List<TsRole> getRole(String positionId);
|
||||
|
||||
/**
|
||||
* 查询岗位以及绑定的角色信息
|
||||
* @param tsPosition:岗位信息
|
||||
* @return List<TsPosition>
|
||||
*/
|
||||
List<TsPosition> selectPositionAndRole(TsPosition tsPosition);
|
||||
|
||||
/**
|
||||
* 通过岗位列表查询绑定的角色列表
|
||||
* @param positionIds:岗位列表
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getRoleIdsByPositionIds(List<String> positionIds);
|
||||
|
||||
/**
|
||||
* 通过roleId查询岗位ID列表
|
||||
* @param roleId:角色ID
|
||||
* @return List<String>
|
||||
*/
|
||||
@Select("select position_id from ts_position_role where role_id=#{roleId}")
|
||||
List<String> getPositionIdsByRoleId(String roleId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user