e2ba1ee0 by 夏齐

首次提交

0 parents
Showing 35 changed files with 3514 additions and 0 deletions
.idea
*.iml
.classpath
.factorypath
.project
.settings
.DS_Store
target
<?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>
<groupId>com.pashanhoo</groupId>
<artifactId>hzbdcsyn</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<!-- -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>${org.spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.29</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.29</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${org.spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<!--<dependency>-->
<!-- <groupId>org.springframework.session</groupId>-->
<!-- <artifactId>spring-session-data-redis</artifactId>-->
<!-- <version>${org.spring.session.version}</version>-->
<!--</dependency>-->
<!--&lt;!&ndash; 引入Redis依赖 &ndash;&gt;-->
<!--<dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
<!-- <version>${org.spring.boot.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!-- <groupId>redis.clients</groupId>-->
<!-- <artifactId>jedis</artifactId>-->
<!-- <version>2.9.3</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!-- <groupId>org.springframework.session</groupId>-->
<!-- <artifactId>spring-session</artifactId>-->
<!-- <version>1.0.2.RELEASE</version>-->
<!--</dependency>-->
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.1.12.RELEASE</version>
</dependency>
<!-- Swagger API文档 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.swagger2.version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.9.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
<version>1.16.20</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.2.4.Final</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>${org.spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.60</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.1.10.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>3.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<!-- <dependency>
<groupId>polaris</groupId>
<artifactId>polaris-fileattachment</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>-->
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.3.4</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${oracle.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.16</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>net.glxn.qrgen</groupId>
<artifactId>javase</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.ofdrw</groupId>
<artifactId>ofdrw-full</artifactId>
<version>1.8.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.8.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<!--使用通配符,当然可以定义多个exclude标签进行排除-->
<exclude>application*.yml</exclude>
</excludes>
</resource>
<!--根据激活条件引入打包所需的配置和文件-->
<resource>
<directory>src/main/resources</directory>
<!--引入所需环境的配置文件-->
<filtering>true</filtering>
<includes>
<include>application.yaml</include>
<!--根据maven选择环境导入配置文件-->
<include>application-${profile.active}.yaml</include>
</includes>
</resource>
</resources>
</build>
<profiles>
<profile>
<!--不同环境的唯一id-->
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profile.active>dev</profile.active>
</properties>
</profile>
<!--生产环境-->
<profile>
<id>prod</id>
<properties>
<profile.active>prod</profile.active>
</properties>
</profile>
</profiles>
<properties>
<oracle.version>11.2.0.4</oracle.version>
<geotools.version>24-SNAPSHOT</geotools.version>
<org.springframework.version>5.1.8.RELEASE</org.springframework.version>
<org.spring.boot.version>2.1.8.RELEASE</org.spring.boot.version>
<org.spring.amqp>2.2.2.RELEASE</org.spring.amqp>
<org.spring.security.version>5.1.6.RELEASE</org.spring.security.version>
<!--<org.spring.session.version>2.1.4.RELEASE</org.spring.session.version>-->
<fasterxml.jackson.version>2.10.0</fasterxml.jackson.version>
<maven-deploy-plugin_version>2.8.2</maven-deploy-plugin_version>
<mybatis-plus.version>3.1.2</mybatis-plus.version>
<springfox.spring.web.version>2.9.2</springfox.spring.web.version>
<springfox.swagger2.version>2.9.2</springfox.swagger2.version>
<mapstruct.version>1.3.0.Final</mapstruct.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
package com.pashanhoo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication(scanBasePackages={"com.pashanhoo"})
@EnableTransactionManagement
@MapperScan(basePackages = {"com.pashanhoo.**.mapper"})
public class Application {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.run(args);
}
}
package com.pashanhoo;
import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* swagger配置类
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
// 为当前包路径
.apis(RequestHandlerSelectors.basePackage("com.pashanhoo"))
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.any())
.build();
}
// 构建 api文档的详细信息函数,注意这里的注解引用的是哪个
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
// 页面标题
.title("接口文档")
// 版本号
.version("1.0")
// 描述
.description("API 描述")
.build();
}
}
package com.pashanhoo.common;
public interface CommonConstant {
/**
* 新增校验报错状态
*/
Integer CHECK_ERROR_2002=2002;
/**
* {@code 500 Server Error} (HTTP/1.0 - RFC 1945)
*/
Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
/**
* {@code 200 OK} (HTTP/1.0 - RFC 1945)
*/
Integer SC_OK_200 = 200;
/**
* {@code 200 OK} (HTTP/1.0 - RFC 1945)
*/
Integer SC_INFO_206 = 206;
/**
* {@code 200 OK} (HTTP/1.0 - RFC 1945)
*/
Integer SC_INFO_210 = 210;
/**
* 字典信息缓存
*/
String SYS_DICT_NAME = "sys:dict:name:";
/**
* 字典信息缓存
*/
String SYS_DICT_ID = "sys:dict:id:";
/**
* 字典信息单条
*/
String SYS_DICT_ALL = "sys:dict:all:";
/**
* 字典信息缓存
*/
String SYS_DICT_CODE = "sys:dict:code:";
/**
* 菜单列表
*/
String MENU_TREE = "sys:menu:";
}
package com.pashanhoo.common;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Component
public class EciHttpUtil {
private static Logger logger = LoggerFactory.getLogger(EciHttpUtil.class);
@Value("${app.AppToken}")
private String appToken;
@Value("${app.AppSecret}")
private String appSecret;
@Value("${app.hostUrl}")
private String hostUrl;
public Map doPostForNew(String url, String params) {
logger.info("http request url:" + url);
logger.info("http request url:" + params);
PrintWriter out = null;
BufferedReader in = null;
Map jsonObject = new HashMap();
try{
URL url1=new URL(url);
HttpURLConnection conn= (HttpURLConnection) url1.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
//x-qys-signature生成方式:Md5(AppToken + AppSecret + timestamp),获取32位小写值
long times=System.currentTimeMillis();
String unSignature = appToken + appSecret + times;
String signature = MD5Util.getMD5(unSignature);
conn.setRequestProperty("x-qys-accesstoken", appToken);
conn.setRequestProperty("x-qys-signature", signature);
conn.setRequestProperty("x-qys-timestamp", String.valueOf(times));
logger.info("x-qys-accesstoken==="+appToken);
logger.info("x-qys-signature==="+signature);
logger.info("x-qys-timestamp==="+System.currentTimeMillis());
out=new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8"));
out.print(params);
out.flush();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
String result="";
String line;
while ((line = in.readLine()) != null) {
result += line;
}
jsonObject = JSONObject.parseObject(result, Map.class);
}catch (Exception ex){
logger.info("发送 POST 请求出现异常!" + ex);
ex.printStackTrace();
}finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return jsonObject;
}
public Map doGetForNew(String url) {
logger.info("http request url:" + url);
BufferedReader in = null;
String result = "";
Map jsonObject = new HashMap();
try{
URL url1=new URL(url);
HttpURLConnection conn= (HttpURLConnection) url1.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setRequestProperty("Charset", "utf-8");
conn.setDoInput(true);
conn.setDoOutput(false);
//x-qys-signature生成方式:Md5(AppToken + AppSecret + timestamp),获取32位小写值
long times=System.currentTimeMillis();
String unSignature = appToken +appSecret + times;
String signature = MD5Util.getMD5(unSignature);
conn.setRequestProperty("x-qys-accesstoken", appToken);
conn.setRequestProperty("x-qys-signature", signature);
conn.setRequestProperty("x-qys-timestamp", String.valueOf(times));
logger.info("x-qys-accesstoken==="+appToken);
logger.info("x-qys-signature==="+signature);
logger.info("x-qys-timestamp==="+System.currentTimeMillis());
conn.connect();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
jsonObject = JSONObject.parseObject(result, Map.class);
}catch (Exception ex){
logger.info("发送 POST 请求出现异常!" + ex);
ex.printStackTrace();
}finally {
try {
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return jsonObject;
}
/**
* 文件下载
*
* @param documentId 合同文档ID
* @return
*/
public String download(String documentId,String bh) {
String url = hostUrl + "/document/download" + "?documentId=" + documentId;
InputStream in = null;
String absolutePath = "";
OutputStream out = null;
try{
URL url1=new URL(url);
HttpURLConnection conn= (HttpURLConnection) url1.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setRequestProperty("Charset", "utf-8");
conn.setDoInput(true);
conn.setDoOutput(true);
long times=System.currentTimeMillis();
//x-qys-signature生成方式:Md5(AppToken + AppSecret + timestamp),获取32位小写值
String unSignature = appToken + appSecret + times;
String signature = MD5Util.getMD5(unSignature);
conn.setRequestProperty("x-qys-accesstoken", appToken);
conn.setRequestProperty("x-qys-signature", signature);
conn.setRequestProperty("x-qys-timestamp", String.valueOf(times));
logger.info("x-qys-accesstoken==="+appToken);
logger.info("x-qys-signature==="+signature);
logger.info("x-qys-timestamp==="+System.currentTimeMillis());
conn.connect();
in =conn.getInputStream();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
String dateDir = simpleDateFormat.format(new Date());
File savePath = new File("D:\\ECI\\" + dateDir+bh);
if (!savePath.exists()) {
savePath.mkdirs();
}
File filePath = new File(savePath + "\\" + documentId+".ofd");
if (!filePath.exists()){
filePath.createNewFile();
}
out = new FileOutputStream(filePath);
byte[] buffer = new byte[4096];
int readLength = 0;
while ((readLength = in.read(buffer)) != -1) {
out.write(buffer, 0, readLength);
}
absolutePath = filePath.getAbsolutePath();
out.flush();
}catch (Exception ex){
logger.info("发送 POST 请求出现异常!" + ex);
ex.printStackTrace();
}finally {
try {
if (in != null) {
in.close();
}
if(out != null) {
out.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return absolutePath;
}
}
package com.pashanhoo.common;
import java.security.MessageDigest;
public class MD5Util {
public static String getMD5(String unEncryption) {
char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
try {
byte[] btInput = unEncryption.getBytes();
// 获得MD5摘要算法的 MessageDigest 对象
MessageDigest mdInst = MessageDigest.getInstance("MD5");
// 使用指定的字节更新摘要
mdInst.update(btInput);
// 获得密文
byte[] md = mdInst.digest();
// 把密文转换成十六进制的字符串形式
char[] str = new char[md.length * 2];
int k = 0;
for (byte byte0 : md) {
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
return new String(str).toLowerCase();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
package com.pashanhoo.common;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PageInfo {
@ApiModelProperty(name = "currentPage",value = "页码")
private Integer currentPage = 1;
@ApiModelProperty(name = "pageSize",value = "每页个数")
private Integer pageSize = 10;
@ApiModelProperty(name = "sortField",value = "排序字段" )
private String sortField;
@ApiModelProperty(name = "sortOrder",value = "升序(asc)或降序(desc)")
private String sortOrder;
public void defaultFillPageProp(String sortField, String sortOrder) {
if(StringUtils.isBlank(this.sortField)) {
this.sortField = sortField;
this.sortOrder = sortOrder;
}
}
}
package com.pashanhoo.common;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.commons.codec.binary.Base64;
import java.io.*;
public class PdfUtil {
/**
* 获取文件base64
*
*/
public static String fileToBase64(InputStream in) {
String base64String="";
try {
byte[] bytes = toByteArray(in);
in.read(bytes);
base64String = Base64.encodeBase64String(bytes);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != in) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return base64String;
}
}
public static byte[] toByteArray(InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[1024*4];
int n = 0;
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
}
return output.toByteArray();
}
}
package com.pashanhoo.common;
import net.glxn.qrgen.core.image.ImageType;
import net.glxn.qrgen.javase.QRCode;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
public class QRCodeUtil {
public static void imgUrl(String url,String fileName) {
try{
ByteArrayOutputStream out= QRCode.from(url).to(ImageType.PNG).stream();
byte[] data = out.toByteArray();
OutputStream oute = new FileOutputStream(new File("E:\\ewm\\"+fileName));
oute.write(data);
oute.flush();
oute.close();
}catch(Exception ex){
ex.printStackTrace();
}
}
}
package com.pashanhoo.common;
import com.pashanhoo.qys.service.EciService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@Configuration
@EnableScheduling
public class QysTask {
@Autowired
private EciService eciService;
@Scheduled(cron="0 0/5 * * * ?")
public void accessCreateContract() {
System.out.println("===========创建合同定时任务进来了=========");
eciService.accessCreateContract();
System.out.println("===========创建合同定时任务走了=========");
}
}
package com.pashanhoo.common;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@ApiModel(value = "接口返回对象", description = "接口返回对象")
@JsonInclude
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功标志
*/
@ApiModelProperty(value = "成功标志")
private boolean success = true;
/**
* 返回处理消息
*/
@ApiModelProperty(value = "返回处理消息")
private String message = "操作成功!";
/**
* 返回代码
*/
@ApiModelProperty(value = "返回代码")
private Integer code = 0;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T result;
/**
* 时间戳
*/
@ApiModelProperty(value = "时间戳")
private long timestamp = System.currentTimeMillis();
public Result() {
}
public Result<T> success(String message) {
this.message = message;
this.code = CommonConstant.SC_OK_200;
this.success = true;
return this;
}
public static Result<Object> ok() {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setMessage("成功");
return r;
}
public static Result<Object> ok(String msg) {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setMessage(msg);
return r;
}
public static <T> Result<T> ok(T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
return r;
}
public static Result<String> content(String data) {
Result<String> r = new Result<String>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
return r;
}
public static Result<Object> info(Object data) {
Result<Object> r = new Result<Object>();
r.setSuccess(false);
r.setCode(CommonConstant.SC_INFO_206);
r.setResult(data);
return r;
}
public static Result<Object> exception(String data) {
Result<Object> r = new Result<Object>();
r.setSuccess(false);
r.setCode(CommonConstant.SC_INFO_210);
r.setMessage(data);
return r;
}
public static <T> Result<T> ok(T data, String msg) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setMessage(msg);
r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
return r;
}
public static Result<String> error(String msg) {
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
}
public static Result<String> checkError(String msg) {
return error(CommonConstant.CHECK_ERROR_2002, msg);
}
public static Result<String> error(int code, String msg) {
Result<String> r = new Result<String>();
r.setCode(code);
r.setMessage(msg);
r.setSuccess(false);
return r;
}
public static <T> Result<T> error(String message, T data) {
Result<T> r = new Result<T>();
r.setMessage(message);
r.setResult(data);
r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
r.setSuccess(false);
return r;
}
public Result<T> error500(String message) {
this.message = message;
this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
this.success = false;
return this;
}
// /**
// * 无权限访问返回结果
// */
// public static Result<String> noauth(String msg) {
// return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
// }
public static long getSerialVersionUID() {
return serialVersionUID;
}
public boolean getSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public T getResult() {
return result;
}
public void setResult(T result) {
this.result = result;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
}
package com.pashanhoo.common;
import com.pashanhoo.zhj.service.ZhjDatasSynService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
@Configuration
@EnableScheduling
public class ZhjTask {
@Autowired
private ZhjDatasSynService zhjDatasSynService;
//@Scheduled(cron="0 0 21 * * ? ")
public void execute() {
System.out.println("===========每天晚上九点定时任务进来了=========");
zhjDatasSynService.send_bdcYwInfo();
System.out.println("===========每天晚上九点定时任务走了=========");
}
}
package com.pashanhoo.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
package com.pashanhoo.qys.controller;
import com.pashanhoo.common.Result;
import com.pashanhoo.qys.service.EciService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/eci/")
@Api(tags = "电子证照相关接口")
public class EciController {
@Autowired
private EciService eciService;
@PostMapping("accessCreateContract")
@ApiOperation("创建合同接口")
public Result accessCreateContract(@ApiParam("不动产权基本信息id")@RequestParam String zsbs,@ApiParam("证件号码")@RequestParam String qlrzjh,@ApiParam("证书编号")@RequestParam String bh) {
eciService.createContractForHandle(zsbs,qlrzjh,bh);
return Result.ok();
}
@GetMapping("accessDetails")
@ApiOperation("合同详情接口")
public Result accessDetails(@ApiParam("电子证照表主键ID")@RequestParam String biz_id) {
eciService.accessDetailsForHandle(biz_id);
return Result.ok();
}
@GetMapping("accessDownload")
@ApiOperation("下载合同文档接口")
public Result accessDownload(@ApiParam("电子证照表主键ID")@RequestParam String biz_id) {
eciService.accessDownloadForHandle(biz_id);
return Result.ok();
}
@GetMapping("convert")
@ApiOperation("ofd转换服务接口")
public Result convert(@ApiParam("电子证照表主键ID")@RequestParam String biz_id) {
eciService.convertElecForHandle(biz_id);
return Result.ok();
}
}
package com.pashanhoo.qys.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
public class ActionRequest implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 是
* 签署动作类型:CORPORATE(企业签章),PERSONAL(个人签字),LP(法定代表人签字),AUDIT(审批)
*/
private String type;
/**
* 是
* 签署动作名称
*/
private String name;
/**
* 是
* 签署动作名称
*/
private String autoSign;
/**
* 是
* 签署顺序(从1开始);如果想按顺序签署,则分别设置签署动作的serialNo为1,2,3;如果想无序签署,则设置签署动作的serialNo为1,1,1;设置签署动作顺序为1,2,2时,表示第一个先签署,后两个同时签署。
*/
private Integer serialNo;
}
package com.pashanhoo.qys.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.web.multipart.MultipartFile;
import java.io.Serializable;
import java.util.List;
/**
* 创建合同请求实体
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class CreateContractRequest implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 是
* 合同名称
*/
private String subject;
/**
* 否
* 合同编号,对接方系统中的业务编号
*/
private String sn;
/**
* 否
* 用印流程ID
*/
private String categoryId;
/**
* 否
* 是否发起合同,默认true。(true:立即发起;false:保存为草稿)
*/
private boolean send;
/**
* 否
* 合同创建人姓名
*/
private String creatorName;
/**
* 否
* 合同创建人手机号码
*/
private String creatorContact;
/**
* 否
* 发起方名称
*/
private String tenantName;
/**
* 受理申请pdf文件
*/
private MultipartFile file;
/**
* title
*/
private String title;
/**
* title
*/
private String fileType;
/**
* 否
* 签署方,为空时在合同签署完成后需要调用接口“封存合同”主动结束合同
*/
private List<SignatoryRequest> signatories;
/**
* 否
* 模板参数
*/
private List<DocumentParam> documentParams;
}
package com.pashanhoo.qys.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
public class DocumentParam implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 是
* 模板参数名称
*/
private String name;
/**
* 是
* 模板参数值
*/
private String value;
}
package com.pashanhoo.qys.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 电子证照表实体
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("ELEC_LICENSE_INFO")
public class ElecLicenseInfoDo {
/**
* 合同标识,主键,自己生成
*/
/**
* 主键
*/
@TableId(value = "BIZ_ID", type = IdType.UUID)
private String bizId;
/**
* 合同ID
*/
@TableField("CONTRACT_ID")
private Long contractId;
/**
* 模板参数
*/
@TableField("DOCUMENT_PARAM")
private String documentParam;
/**
* 合同文档ID
*/
@TableField("DOCUMENT_ID")
private String documentId;
/**
* 合同类型.1:不动产登记证明.2:不动产权证书.3:不动产查询证明
*/
@TableField("HTLX")
private String htlx;
/**
* 业务号
*/
@TableField("YWH")
private String ywh;
/**
* 证书标识
*/
@TableField("ZSBS")
private String zsbs;
/**
* 提交参数
*/
@TableField("TJCS")
private String tjcs;
/**
* 返回结果
*/
@TableField("FHJG")
private String fhjg;
/**
* 推送状态
*/
@TableField("TSZT")
private String tszt;
/**
* 合同状态(DRAFT:草稿,FILLING:拟定中,SIGNING:签署中,COMPLETE:已完成,REJECTED:已退回,RECALLED:已撤回,EXPIRED:已过期,TERMINATING:作废中,TERMINATED:已作废,DELETE:已删除,FINISHED:强制完成)
*/
@TableField("HTZT")
private String htzt;
/**
* 推送时间
*/
@TableField("TSSJ")
private Date tssj;
/**
* 是否下载 1是2否
*/
@TableField("SFXZ")
private String sfxz;
/**
* ofd文件地址
*/
@TableField("OFD_WJDZ")
private String ofdWjdz;
/**
* 是否转换1是2否
*/
@TableField("SFZH")
private String sfzh;
/**
* jpg文件地址
*/
@TableField("JPG_WJDZ")
private String jpgWjdz;
/**
* jpg文件地址
*/
@TableField("SIGN_URL")
private String signUrl;
/**
* 备注
*/
@TableField("BZ")
private String bz;
/**
* 二维码图片
*/
@TableField("EWMIMAGE")
private byte[] ewmimage;
/**
* 0:临时状态,1:现势,2:历史状态
*/
@TableField("DZZZ_STATE")
private String dzzz_state;
/**
* 0:正常,1:创建合同接口报错,2:合同详情接口报错,3:下载ofd接口报错,4:ofd转换接口报错
*/
@TableField("ERR_STATE")
private String err_state;
/**
* 证书编号
*/
@TableField("ZSBH")
private String zsbh;
/**
* 权利人名称
*/
@TableField("QLRMC")
private String qlrmc;
/**
* 证件号
*/
@TableField("ZJH")
private String zjh;
}
package com.pashanhoo.qys.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class SignatoryRequest implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 是
* 签约主体类型:COMPANY(外部企业),PERSONAL(个人)
*/
private String tenantType;
/**
* 是
* 签约主体名称
*/
private String tenantName;
/**
* 是
* 签署顺序(从1开始);如果想按顺序签署,则分别设置签署方的serialNo为1,2,3;如果想无序签署,则设置签署方的serialNo为1,1,1;设置签署方顺序为1,2,2时,表示第一个先签署,后两个同时签署。
*/
private Integer serialNo;
/**
* 是
* 签约主体名称
*/
private String contact;
/**
* 否
* 签署动作,用印流程非预设且签署方为发起方时,使用用户传入的签署动作,其余情况使用用印流程的配置
*/
private List<ActionRequest> actions;
}
package com.pashanhoo.qys.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pashanhoo.qys.entity.ElecLicenseInfoDo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ElecLicenseInfoMapper extends BaseMapper<ElecLicenseInfoDo> {
List<ElecLicenseInfoDo> getEciInfoByZsbs(String zsbs);
List<ElecLicenseInfoDo> getDocumentIdIsNull(String ywh);
/**
* 获取合同文档ID已经入库并且还未下载集合
*
* @return
*/
List<ElecLicenseInfoDo> getWaitForDownload(String ywh);
/**
* 获取已经下载还未转换的集合
*
* @return
*/
List<ElecLicenseInfoDo> getWaitForConvert(String ywh);
/**
* 根据业务号和不动产单元号查询义务人名称
*/
List<String> getYwrMcByCOnditon(@Param("ywh")String ywh, @Param("bdcdyh")String bdcdyh);
void updateEciInfo(@Param("bizId")String bizId);
ElecLicenseInfoDo getElecLicenseInfo(ElecLicenseInfoDo elecLicenseInfoDo);
}
package com.pashanhoo.qys.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pashanhoo.common.Result;
import com.pashanhoo.qys.entity.ElecLicenseInfoDo;
public interface EciService extends IService<ElecLicenseInfoDo> {
/**
* 定时任务执行接口
*/
void accessCreateContract();
/**
* 手动执行创建合同
*/
Result createContractForHandle(String zsbs,String qlrzjh,String bh);
/**
* 手动执行获取详情
*/
Result accessDetailsForHandle(String biz_id);
/**
* 手动执行下载合同
*/
Result accessDownloadForHandle(String biz_id);
/**
* 手动执行ofd转换
*/
Result convertElecForHandle(String biz_id);
}
package com.pashanhoo.qys.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pashanhoo.common.EciHttpUtil;
import com.pashanhoo.common.Result;
import com.pashanhoo.qys.entity.ElecLicenseInfoDo;
import com.pashanhoo.qys.mapper.ElecLicenseInfoMapper;
import com.pashanhoo.qys.service.EciService;
import com.pashanhoo.zhj.mapper.RegBusBdcqzsdjxxMapper;
import net.glxn.qrgen.core.image.ImageType;
import net.glxn.qrgen.javase.QRCode;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.ofdrw.converter.ImageMaker;
import org.ofdrw.reader.OFDReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class EciServiceImpl extends ServiceImpl<ElecLicenseInfoMapper, ElecLicenseInfoDo> implements EciService {
private static Logger logger = LoggerFactory.getLogger(EciServiceImpl.class);
@Value("${app.hostUrl}")
private String hostUrl;
@Value("${app.bdcdjzmlc}")
private String bdcdjzmlc;
@Value("${app.bdcqzslc}")
private String bdcqzslc;
@Autowired
private RegBusBdcqzsdjxxMapper regBusBdcqzsdjxxMapper;
@Autowired
private ElecLicenseInfoMapper elecLicenseInfoMapper;
@Autowired
private EciHttpUtil eciHttpUtil;
@Override
public void accessCreateContract() {
try{
List<Map> list=assemblyInfo();
if(list!=null && list.size()>0){
for (int i = 0; i < list.size(); i++) {
//=========创建合同t==============
ElecLicenseInfoDo elecLicenseInfo=createContract(list.get(i));
if(null==elecLicenseInfo || !"0".equals(elecLicenseInfo.getErr_state())){
continue;
}
//=========合同详情==============
ElecLicenseInfoDo details=accessDetails(elecLicenseInfo);
if(null==details || !"0".equals(details.getErr_state())){
continue;
}
//=========证照下载==============
ElecLicenseInfoDo download=accessDownload(details);
if(null==download || !"0".equals(download.getErr_state())){
continue;
}
//=========ofd转换==============
ElecLicenseInfoDo ofdzh=convertElec(download);
if(null==ofdzh || !"0".equals(ofdzh.getErr_state())){
continue;
}
//修改电子证书标识
elecLicenseInfoMapper.updateEciInfo(ofdzh.getBizId());
}
}
}catch (Exception ex){
ex.printStackTrace();
}
}
@Override
public Result createContractForHandle(String zsbs, String qlrzjh, String bh) {
List<Map> list=createInfoByHandle(zsbs,qlrzjh,bh);
if(list!=null && list.size()>0){
for (int i = 0; i < list.size(); i++) {
createContract(list.get(i));
}
}
return Result.ok();
}
@Override
public Result accessDetailsForHandle(String biz_id) {
ElecLicenseInfoDo elecLicenseInfoDo=this.getById(biz_id);
if(elecLicenseInfoDo!=null){
accessDetails(elecLicenseInfoDo);
}
return Result.ok();
}
@Override
public Result accessDownloadForHandle(String biz_id) {
ElecLicenseInfoDo elecLicenseInfoDo=this.getById(biz_id);
if(elecLicenseInfoDo!=null){
accessDownload(elecLicenseInfoDo);
}
return Result.ok();
}
@Override
public Result convertElecForHandle(String biz_id) {
ElecLicenseInfoDo elecLicenseInfoDo=this.getById(biz_id);
if(elecLicenseInfoDo!=null){
convertElec(elecLicenseInfoDo);
elecLicenseInfoMapper.updateEciInfo(biz_id);
}
return Result.ok();
}
/**
*插入电子证照表记录
* @param tjcs
* @param documentParam
* @param backjson
* @param jbxxmap
*/
public ElecLicenseInfoDo insertEciInfo(String tjcs,String documentParam, Map backjson,Map jbxxmap){
ElecLicenseInfoDo elecLicenseInfoDo=new ElecLicenseInfoDo();
elecLicenseInfoDo.setTjcs(tjcs);
elecLicenseInfoDo.setDocumentParam(documentParam);
elecLicenseInfoDo.setZsbh((String) jbxxmap.get("BH"));
elecLicenseInfoDo.setQlrmc((String) jbxxmap.get("QLRMC"));
elecLicenseInfoDo.setZjh((String) jbxxmap.get("ZJH"));
if(backjson.isEmpty()){
elecLicenseInfoDo.setErr_state("1");
}else{
if ((Integer)backjson.get("code")==0) {
Long contractId = Long.valueOf((String) backjson.get("contractId"));
//合同ID入库
elecLicenseInfoDo.setContractId(contractId);
elecLicenseInfoDo.setErr_state("0");
regBusBdcqzsdjxxMapper.updateBdcqzsjbxxInfo((String) jbxxmap.get("ID"));
}else{
elecLicenseInfoDo.setErr_state("1");
}
}
elecLicenseInfoDo.setYwh((String) jbxxmap.get("YWH"));
if(((String)jbxxmap.get("BDCQZH")).contains("证明")){
elecLicenseInfoDo.setHtlx("1");
}else{
elecLicenseInfoDo.setHtlx("2");
}
elecLicenseInfoDo.setZsbs((String) jbxxmap.get("ID"));
elecLicenseInfoDo.setEwmimage(getImage((String) jbxxmap.get("ID"),(String) jbxxmap.get("QLRMC"),(String) jbxxmap.get("ZJH")));
//返回结果入库
elecLicenseInfoDo.setFhjg(JSON.toJSONString(backjson));
//未下载
elecLicenseInfoDo.setSfxz("2");
//未转换
elecLicenseInfoDo.setSfzh("2");
this.save(elecLicenseInfoDo);
return elecLicenseInfoDo;
}
/**
*修改电子证照表记录
* @param tjcs
* @param documentParam
* @param backjson
* @param
*/
public ElecLicenseInfoDo updateEciInfo(String tjcs,String documentParam, Map backjson,ElecLicenseInfoDo elecLicenseInfoDo){
elecLicenseInfoDo.setTjcs(tjcs);
elecLicenseInfoDo.setDocumentParam(documentParam);
if(backjson.isEmpty()){
elecLicenseInfoDo.setErr_state("1");
}else{
if ((Integer)backjson.get("code")==0) {
Long contractId = Long.valueOf((String) backjson.get("contractId"));
//合同ID入库
elecLicenseInfoDo.setContractId(contractId);
elecLicenseInfoDo.setErr_state("0");
regBusBdcqzsdjxxMapper.updateBdcqzsjbxxInfo(elecLicenseInfoDo.getZsbs());
}else{
elecLicenseInfoDo.setErr_state("1");
}
}
//返回结果入库
elecLicenseInfoDo.setFhjg(JSON.toJSONString(backjson));
//未下载
elecLicenseInfoDo.setSfxz("2");
//未转换
elecLicenseInfoDo.setSfzh("2");
this.updateById(elecLicenseInfoDo);
return elecLicenseInfoDo;
}
/**
* 生成文件流
* @param jbxxId
* @return
*/
public byte[] getImage(String jbxxId,String qlr,String zjh){
byte[] data=null;
try{
String imageurl="https://www.hzbdcdj.com/api?scene="+jbxxId+"&qlr="+ URLEncoder.encode(qlr,"UTF-8")+"&zjh="+zjh;
logger.info("55555555============"+imageurl);
ByteArrayOutputStream out= QRCode.from(imageurl).to(ImageType.PNG).stream();
data = out.toByteArray();
}catch (Exception ex){
ex.printStackTrace();
}
return data;
}
/**
* 根据基本信息id生成二维码图片加密字符串
* @param jbxxId
* @return
*/
public String getBase64ewm(String jbxxId,String qlr,String zjh){
byte[] data=getImage(jbxxId,qlr,zjh);
String base64ewm =Base64.encodeBase64String(data);
return base64ewm;
}
/**
* 创建合同
* @param map
*/
public ElecLicenseInfoDo createContract(Map map){
String url=hostUrl + "/contract/createbycategory";
ElecLicenseInfoDo elecLicenseInfo=null;
try{
String ywh = (String) map.get("YWH");
Map jsonMap = new HashMap();
jsonMap.put("sn", ywh);
jsonMap.put("send", "true");
jsonMap.put("creatorName", "");
jsonMap.put("creatorContact", "");
jsonMap.put("tenantName", "汉中市不动产登记交易服务中心");
String zsbh= (String) map.get("BH");//去掉汉字的证书编号,数字组合
Map<String, String> documentMap = new HashMap<String, String>();
String bdcqzh = (String) map.get("BDCQZH");
if (bdcqzh.contains("证明")) {
jsonMap.put("subject", "不动产登记证明");
jsonMap.put("categoryId", bdcdjzmlc);
List<String> ywrmcList=elecLicenseInfoMapper.getYwrMcByCOnditon(ywh,(String) map.get("BDCDYH"));
documentMap.put("bdczmh", zsbh);
documentMap.put("zmqlhsx",getzmsx((String) map.get("DJLX"),(String) map.get("BDCDYH")));
documentMap.put("ywr", StringUtils.join(ywrmcList.toArray(), ","));
documentMap.put("qt", map.get("QT")==null ? "无": (String) map.get("QT"));
} else {
jsonMap.put("subject", "不动产登记证书");
jsonMap.put("categoryId", bdcqzslc);
documentMap.put("bdcqzh",zsbh);
documentMap.put("gyqk", map.get("GYQK")==null ? "": (String) map.get("GYQK"));
documentMap.put("qllx", map.get("QLLX")==null ? "": (String) map.get("QLLX"));
documentMap.put("qlxz", map.get("QLXZ")==null ? "": (String) map.get("QLXZ"));
documentMap.put("yt", map.get("YT")==null ? "": (String) map.get("YT"));
documentMap.put("mj", map.get("MJ")==null ? "": (String) map.get("MJ"));
documentMap.put("syqx", map.get("SYQX")==null ? "": (String) map.get("SYQX"));
documentMap.put("qlqtzk", map.get("QLQTZK")==null ? "": (String) map.get("QLQTZK"));
}
List list2 = new ArrayList();
Map map2 = new HashMap();
map2.put("type", "CORPORATE");
map2.put("name", "汉中市不动产登记交易服务中心");
map2.put("serialNo", "1");
list2.add(map2);
List list1 = new ArrayList();
Map map1 = new HashMap();
map1.put("tenantType", "CORPORATE");
map1.put("tenantName", "汉中市不动产登记交易服务中心");
map1.put("serialNo", "1");
map1.put("actions", list2);
list1.add(map1);
jsonMap.put("signatories", list1);
documentMap.put("djsj", map.get("Y")==null ? "":(String) map.get("Y"));
documentMap.put("y", map.get("Y")==null ? "":(String) map.get("Y"));
documentMap.put("m", map.get("M")==null ? "":(String) map.get("M"));
documentMap.put("d", map.get("D")==null ? "":(String) map.get("D"));
documentMap.put("qlr", map.get("QLRMC")==null ? "":(String) map.get("QLRMC"));
documentMap.put("zl", map.get("ZL")==null ? "":(String) map.get("ZL"));
documentMap.put("bdcdyh", map.get("BDCDYH")==null ? "":(String) map.get("BDCDYH"));
documentMap.put("fj", "业务号:"+ywh);
documentMap.put("qx", "汉台区");
String base64ewm =getBase64ewm((String) map.get("ID"),(String) map.get("QLRMC"),(String) map.get("ZJH"));
Map ewmMap = new HashMap();
ewmMap.put("fileName", map.get("ID")+".png");
ewmMap.put("value", "data:image/png;base64,"+base64ewm);
documentMap.put("ewm", JSON.toJSONString(ewmMap));
List<Map> arryList = new ArrayList<Map>();
for (Map.Entry<String, String> entry : documentMap.entrySet()) {
convert(arryList, entry.getKey(), entry.getValue());
}
jsonMap.put("documentParams", arryList);
String inparam=JSON.toJSONString(jsonMap);
Map jsonObject =eciHttpUtil.doPostForNew(url, inparam);
elecLicenseInfo =new ElecLicenseInfoDo();
elecLicenseInfo.setYwh((String) map.get("YWH"));
elecLicenseInfo.setZsbs((String) map.get("ID"));
elecLicenseInfo.setZsbh(zsbh);
elecLicenseInfo.setZjh((String) map.get("ZJH"));
elecLicenseInfo =elecLicenseInfoMapper.getElecLicenseInfo(elecLicenseInfo);
if(elecLicenseInfo==null){
//电子证照表记录
elecLicenseInfo=insertEciInfo(inparam,JSON.toJSONString(documentMap),jsonObject,map);
}else{
elecLicenseInfo=updateEciInfo(inparam,JSON.toJSONString(documentMap),jsonObject,elecLicenseInfo);
}
}catch (Exception ex){
ex.printStackTrace();
}
return elecLicenseInfo;
}
public void convert(List arryList,String name,String value){
Map map=new HashMap();
map.put("name",name);
map.put("value",value);
arryList.add(map);
}
public ElecLicenseInfoDo accessDetails(ElecLicenseInfoDo waitForDetail) {
ElecLicenseInfoDo elecLicenseInfoDo=null;
try {
Long contractId = waitForDetail.getContractId();
String url = hostUrl+ "/contract/detail?contractId=" + contractId;
logger.info("请求合同详情接口url:" + url);
Map jsonObject = eciHttpUtil.doGetForNew(url);
if(jsonObject.isEmpty()){
waitForDetail.setErr_state("2");
}else{
Integer code = (Integer) jsonObject.get("code");
logger.info("合同详情接口请求结果:" + jsonObject);
if (code==0) {
Map obj1= (Map) jsonObject.get("contract");
List list= (List) obj1.get("documents");
Map map= (Map) list.get(0);
waitForDetail.setErr_state("0");
waitForDetail.setDocumentId((String) map.get("id"));
}else{
waitForDetail.setErr_state("2");
}
}
//文档ID入库
this.updateById(waitForDetail);
elecLicenseInfoDo=waitForDetail;
} catch (Exception e) {
e.printStackTrace();
}
return elecLicenseInfoDo;
}
/**
* 下载合同方法
* @return
*/
public ElecLicenseInfoDo accessDownload(ElecLicenseInfoDo waitForDownload) {
ElecLicenseInfoDo downloadInfo=null;
try{
String documentId = waitForDownload.getDocumentId();
String bh=waitForDownload.getZsbh();
String ofdPath = eciHttpUtil.download(documentId,bh);
if (StringUtils.isNotBlank(ofdPath)) {
//入库ofd文件地址
waitForDownload.setSfxz("1");
waitForDownload.setOfdWjdz(ofdPath);
waitForDownload.setErr_state("0");
}else{
waitForDownload.setErr_state("3");
}
this.updateById(waitForDownload);
downloadInfo=waitForDownload;
}catch (Exception ex){
ex.printStackTrace();
}
return downloadInfo;
}
public ElecLicenseInfoDo convertElec(ElecLicenseInfoDo waitForConvert) {
//转换后文件输出路径
ElecLicenseInfoDo convert=null;
try {
String ofdPath = waitForConvert.getOfdWjdz();
String id=waitForConvert.getDocumentId();
String bh=waitForConvert.getZsbh();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
String dateDir = simpleDateFormat.format(new Date());
String url=ofdToImg(ofdPath,"D:\\ECI\\"+ dateDir+bh+"\\",id);
if(StringUtils.isNotBlank(url)){
waitForConvert.setSfzh("1");
waitForConvert.setJpgWjdz(url);
waitForConvert.setErr_state("0");
}else{
waitForConvert.setErr_state("4");
}
this.updateById(waitForConvert);
convert=waitForConvert;
} catch (Exception e) {
e.printStackTrace();
}
return convert;
}
/**
* 将ofd转换为图片
* @param
* @param imgPath 目标文件路径
*/
public String ofdToImg(String ofdPath, String imgPath,String id) {
File savePath = new File(imgPath);
if (!savePath.exists()) {
savePath.mkdirs();
}
// 1. 文件输入路径
Path src = Paths.get(ofdPath);
// 2. 加载指定目录字体(非必须)
// FontLoader.getInstance().scanFontDir(new File("src/test/resources/fonts"));
// 3. 创建转换转换对象,设置 每毫米像素数量(Pixels per millimeter)
try(OFDReader reader = new OFDReader(src);) {
ImageMaker imageMaker = new ImageMaker(reader, 15);
for (int i = 0; i < imageMaker.pageSize(); i++) {
// 4. 指定页码转换图片
BufferedImage image = imageMaker.makePage(i);
Path dist = Paths.get( imgPath+ id + ".jpg");
// 5. 存储为指定格式图片
ImageIO.write(image, "JPG", dist.toFile());
return imgPath + id + ".jpg";
}
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
/**
*根据缮证类型决定生成对应的权利相关信息
*/
public List<Map> assemblyInfo(){
List<Map> oldlist=regBusBdcqzsdjxxMapper.getBdcqzsjbxxInfo();
List<Map> list=new ArrayList<Map>();
if(oldlist!=null && oldlist.size()>0){
for (int i = 0; i < oldlist.size(); i++) {
Map map=oldlist.get(i);
String bh= (String)map.get("BH");
String zsbh[]=bh.split(",");
if(zsbh!=null && zsbh.length>0){
String qlqtzk=(String)map.get("QLQTZK");
Map qrlInfoMap=regBusBdcqzsdjxxMapper.getQlrInfoByYwh((String) map.get("YWH"));
String allQlrmc=(String)qrlInfoMap.get("QLRMC");
String allZjh=(String)qrlInfoMap.get("ZJH");
if(StringUtils.isNotBlank(allQlrmc)){
for (int k = 0; k < zsbh.length; k++) {
String qlr[]=allQlrmc.split(",");
String zjh[]=allZjh.split(",");
Map hashMap=new HashMap(map);
hashMap.put("QLRMC",qlr[k]);
hashMap.put("BH",zsbh[k]);
hashMap.put("ZJH",zjh[k]);
List list1= Arrays.asList(qlr);
List arrList = new ArrayList(list1);
arrList.remove(qlr[k]);
String gyr=StringUtils.join(arrList.toArray(),",");
if(StringUtils.isNotBlank(qlqtzk)){
qlqtzk=qlqtzk.substring(0, qlqtzk.length() - 1);
hashMap.put("QLQTZK",qlqtzk+hashMap.get("GYQK")+";共有人:"+gyr);
}
list.add(hashMap);
}
}
}
}
}
return list;
}
/**
* 手动版创建合同组件信息
* @return
*/
public List<Map> createInfoByHandle(String zsbs,String qlrzjh,String bh){
List<Map> list=new ArrayList<Map>();
Map map=regBusBdcqzsdjxxMapper.getBdcqzsJbxxById(zsbs);
if(map!=null){
Map qrlInfoMap=regBusBdcqzsdjxxMapper.getQlrInfoByYwh((String) map.get("YWH"));
String allQlrmc=(String)qrlInfoMap.get("QLRMC");
if(StringUtils.isNotBlank(allQlrmc)){
String allZjh=(String)qrlInfoMap.get("ZJH");
if(StringUtils.isNotBlank(allZjh)){
String zjh[]=allZjh.split(",");
String qlqtzk=(String)map.get("QLQTZK");
for (int k = 0; k < zjh.length; k++) {
if(StringUtils.equals(qlrzjh,zjh[k])){
String qlr[]=allQlrmc.split(",");
Map hashMap=new HashMap(map);
hashMap.put("QLRMC",qlr[k]);
hashMap.put("BH",bh);
hashMap.put("ZJH",qlrzjh);
List list1= Arrays.asList(qlr);
List arrList = new ArrayList(list1);
arrList.remove(qlr[k]);
String gyr=StringUtils.join(arrList.toArray(),",");
if(StringUtils.isNotBlank(qlqtzk)){
qlqtzk=qlqtzk.substring(0, qlqtzk.length() - 1);
hashMap.put("QLQTZK",qlqtzk+hashMap.get("GYQK")+";共有人:"+gyr);
}
list.add(hashMap);
}
}
}
}
}
return list;
}
public String getzmsx(String djxl,String bdcdyh){
//证明权利或事项
if(djxl.equals("214") || djxl.equals("215")
|| djxl.equals("213") || djxl.equals("209")
|| djxl.equals("315") || djxl.equals("605")
|| djxl.equals("430") || djxl.equals("316")
|| djxl.equals("606") || djxl.equals("431")
|| djxl.equals("427") || djxl.equals("428")
|| djxl.equals("317") || djxl.equals("318")
|| djxl.equals("608") || djxl.equals("433")
|| djxl.equals("422") || djxl.equals("217")){
if(djxl.equals("213") || djxl.equals("316")
|| djxl.equals("606") || djxl.equals("431")
|| djxl.equals("427") || djxl.equals("428")){
return "在建工程抵押权";
}else {
return "抵押权";
}
}else {
//预抵押变更事项可以修改期房和现房的预抵押所以应取上一笔的预抵押信息,获取上一笔抵押登记小类
if (djxl.equals("818") || djxl.equals("607")
|| djxl.equals("432")){
Map rightsInfo= regBusBdcqzsdjxxMapper.getRightsInfo(bdcdyh);
if(rightsInfo!=null){
return regBusBdcqzsdjxxMapper.getInfoByValue((String) rightsInfo.get("REMARKS"),"reg_bus_djxl");
}
}else {
if(djxl.equals("609") || djxl.equals("812") || djxl.equals("809") || djxl.equals("810") || djxl.equals("811")){
return regBusBdcqzsdjxxMapper.getInfoByValue("803","reg_bus_djxl");
}else{
return regBusBdcqzsdjxxMapper.getInfoByValue(djxl,"reg_bus_djxl");
}
}
}
return "";
}
}
package com.pashanhoo.zhj.controller;
import com.pashanhoo.common.Result;
import com.pashanhoo.zhj.service.ZhjDatasSynService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/zhj/")
@Api(tags = "智慧局信息同步相关接口")
public class SynZhjInfoController {
@Autowired
private ZhjDatasSynService zhjDatasSynService;
@PostMapping("ZhjDatasSynInfo")
@ApiOperation("定时智慧局数据同步接口")
public Result ZhjDatasSynInfo() {
zhjDatasSynService.send_bdcYwInfo();
return Result.ok();
}
@PostMapping("synZdInfoByywh")
@ApiOperation("手动执行智慧局数据同步接口")
public Result synZdInfoByywh(@ApiParam("业务号")@RequestParam String ywh) {
zhjDatasSynService.synZdInfoByywh(ywh);
return Result.ok();
}
@PostMapping("synHInfoByYwh")
@ApiOperation("手动执行智慧局数据同步接口")
public Result synHInfoByYwh(@ApiParam("业务号")@RequestParam String ywh) {
zhjDatasSynService.synHInfoByYwh(ywh);
return Result.ok();
}
@PostMapping("synQSZTInfoByYwh")
@ApiOperation("手动执行智慧局数据同步接口")
public Result synQSZTInfoByYwh(@ApiParam("业务号")@RequestParam String ywh) {
zhjDatasSynService.synQSZTInfoByYwh(ywh);
return Result.ok();
}
}
package com.pashanhoo.zhj.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("REG_BUS_BDCQZSDJXX")
public class RegBusBdcqzsdjxxDo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "ID", type = IdType.UUID)
private String id;
/**
* 业务号
*/
@TableField("YWH")
private String ywh;
/**
* 不动产权证号
*/
@TableField("BDCQZH")
private String bdcqzh;
/**
* 不动产权证编号
*/
@TableField("BDCQZBH")
private String bdcqzbh;
/**
* 印刷序列号
*/
@TableField("YSXLH")
private String ysxlh;
/**
* 登簿时间
*/
@TableField("DBSJ")
private String dbsj;
/**
* 权利人名称
*/
@TableField("QLRMC")
private String qlrmc;
/**
* 共有情况
*/
@TableField("GYQK")
private String gyqk;
/**
* 坐落
*/
@TableField("ZL")
private String zl;
/**
* 宗地代码
*/
@TableField("ZDDM")
private String zddm;
/**
* 不动产单元号
*/
@TableField("BDCDYH")
private String bdcdyh;
/**
* 权利类型
*/
@TableField("QLLX")
private String qllx;
/**
* 权利性质
*/
@TableField("QLXZ")
private String qlxz;
/**
* 用途
*/
@TableField("YT")
private String yt;
/**
* 面积
*/
@TableField("MJ")
private String mj;
/**
* 使用期限
*/
@TableField("SYQX")
private String syqx;
/**
* 权利其他状况
*/
@TableField("QLQTZK")
private String qlqtzk;
/**
* 附记
*/
@TableField("FJ")
private String fj;
/**
* 抵押登记信息
*/
@TableField("DYDJXX")
private String dydjxx;
/**
* 解除抵押登记信息
*/
@TableField("JCDYDJXX")
private String jcdydjxx;
/**
* 查封情况
*/
@TableField("CFQK")
private String cfqk;
/**
* 解除查封
*/
@TableField("JCCF")
private String jccf;
/**
* 图号
*/
@TableField("TH")
private String th;
/**
* 批文号
*/
@TableField("PWH")
private String pwh;
/**
* 划拨价款
*/
@TableField("HBJK")
private String hbjk;
/**
* 划拨合同号
*/
@TableField("HBHTH")
private String hbhth;
/**
* 发证时间
*/
@TableField("FZSJ")
private String fzsj;
/**
* 终止时间
*/
@TableField("ZZSJ")
private String zzsj;
/**
* 登记类型
*/
@TableField("DJLX")
private String djlx;
/**
* 当前土地或者房屋登记状态
*/
@TableField("STATUS")
private String status;
/**
* 是否注销 分割合并后原数据注销
*/
@TableField("ISLOGOUT")
private String islogout;
/**
* 0:正常办理,1:分割合并变更更正附带确权产生数据
*/
@TableField("ISFDSJ")
private Integer isfdsj;
/**
* 是否历史数据手工录入
*/
@TableField("ISHISTORY")
private String ishistory;
/**
* 是否打印出证
*/
@TableField("ISPRINT")
private String isprint;
/**
* 确权类型
*/
@TableField("RIGHTS")
private String rights;
/**
* 创建者
*/
@TableField("CREATE_BY")
private String create_by;
/**
* 创建日期
*/
@TableField("CREATE_DATE")
private Date create_date;
/**
* 更新者
*/
@TableField("UPDATE_BY")
private String update_by;
/**
* 更新日期
*/
@TableField("UPDATE_DATE")
private Date update_date;
/**
* 备注
*/
@TableField("REMARKS")
protected String remarks;
/**
* 删除标记(0:正常;1:删除;2:审核)
*/
@TableField("DEL_FLAG")
protected String del_flag;
/**
* 上手id(原业务id)
*/
@TableField("OLDID")
private String oldid;
}
package com.pashanhoo.zhj.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("SYN_ZHJINFO")
public class SynZhjInfoDo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "ID", type = IdType.UUID)
private String id;
/**
* 业务号
*/
@TableField("YWH")
private String ywh;
/**
* 宗地表同步状态0:未同步 1:已同步
*/
@TableField("ZD_STATE")
private String zd_state;
/**
* 户表同步状态0:未同步 1:已同步
*/
@TableField("H_STATE")
private String h_state;
/**
* 户权属表同步状态0:未同步 1:已同步
*/
@TableField("HQS_STATE")
private String hqs_state;
/**
* 创建者
*/
@TableField("CREATE_BY")
private String create_by;
/**
* 创建日期
*/
@TableField("CREATE_DATE")
private Date create_date;
/**
* 更新者
*/
@TableField("UPDATE_BY")
private String update_by;
/**
* 更新日期
*/
@TableField("UPDATE_DATE")
private Date update_date;
/**
* 删除标记(0:正常;1:删除;2:审核)
*/
@TableField("DEL_FLAG")
protected String del_flag;
}
package com.pashanhoo.zhj.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pashanhoo.zhj.entity.RegBusBdcqzsdjxxDo;
import com.pashanhoo.zhj.entity.SynZhjInfoDo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface RegBusBdcqzsdjxxMapper extends BaseMapper<RegBusBdcqzsdjxxDo> {
/**
* 批量业务号查询登记信息表数据
* @param selectAllListInfo
* @return
*/
List<RegBusBdcqzsdjxxDo> getZsdjInfoList(List<SynZhjInfoDo> selectAllListInfo);
/**
* 业务号查询登记信息表数据
* @param ywh
* @return
*/
List<RegBusBdcqzsdjxxDo> getZsdjInfoListByYwh(String ywh);
/**
* 根据宗地代码查询宗地信息
* @param regBusBdcqzsdjxxDo
* @return
*/
public List<Map> getZdInfoByZddm(RegBusBdcqzsdjxxDo regBusBdcqzsdjxxDo);
/**
* 根据宗地代码查询户信息
* @param regBusBdcqzsdjxxDo
* @return
*/
public List<Map> getHQSInfoByZddm(RegBusBdcqzsdjxxDo regBusBdcqzsdjxxDo);
/**
* 根据宗地代码查询户权属状态信息
* @param regBusBdcqzsdjxxDo
* @return
*/
public List<Map> getQSZTInfoByZddm(RegBusBdcqzsdjxxDo regBusBdcqzsdjxxDo);
/**
* 查询所有需要创建电子证照并且已经登簿的业务信息
* @return
*/
public List<Map> getBdcqzsjbxxInfo();
/**
* 查询所有需要创建电子证照并且已经登簿的业务信息
* @return
*/
public List<Map> getBdcqzsjbxxInfoByYwh(String ywh);
public List<Map> getUserInfo();
public void updateBdcqzsjbxxInfo(String id);
public Map getQlrInfoByYwh(String ywh);
public String getQlrInfoByYwhAndqlr(@Param("ywh") String ywh, @Param("qlrmc") String qlrmc);
public Map getBdcqzsJbxxById(String id);
public String getInfoByValue(@Param("value") String value, @Param("type") String type);
Map getRightsInfo(@Param("bdcdyh")String bdcdyh);
Map getDyqqInfo(@Param("ywh")String ywh,@Param("bdcdyh")String bdcdyh);
String getHtbhInfo(@Param("ywh")String ywh);
Map getBdcjbxxInfo(@Param("bdcdyh")String bdcdyh);
Map getJbxxInfoByYwhAndBdcdyh(@Param("ywh")String ywh,@Param("bdcdyh")String bdcdyh);
Map getJbxxById(@Param("id")String id);
Map getZdjbxxByZddm(@Param("zddm")String zddm);
Map getZrzInfo(@Param("bdcdyh")String bdcdyh);
Map getHInfo(@Param("bdcdyh")String bdcdyh);
}
package com.pashanhoo.zhj.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pashanhoo.zhj.entity.SynZhjInfoDo;
import java.util.List;
public interface SynZhjInfoMapper extends BaseMapper<SynZhjInfoDo> {
List<SynZhjInfoDo> selectAllInfo();
void updatezdzt(String ywh);
void updateHzt(String ywh);
void updateHqszt(String ywh);
}
package com.pashanhoo.zhj.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pashanhoo.zhj.entity.RegBusBdcqzsdjxxDo;
public interface ZhjDatasSynService extends IService<RegBusBdcqzsdjxxDo> {
public void send_bdcYwInfo();
public void synZdInfoByywh(String ywh);
public void synHInfoByYwh(String ywh);
public void synQSZTInfoByYwh(String ywh);
}
package com.pashanhoo.zhj.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pashanhoo.zhj.entity.RegBusBdcqzsdjxxDo;
import com.pashanhoo.zhj.entity.SynZhjInfoDo;
import com.pashanhoo.zhj.mapper.RegBusBdcqzsdjxxMapper;
import com.pashanhoo.zhj.mapper.SynZhjInfoMapper;
import com.pashanhoo.zhj.service.ZhjDatasSynService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 案卷基本信息 服务实现类
* </p>
*
* @author
* @since 2021-11-05
*/
@Service
public class ZhjDatasSynServiceImpl extends ServiceImpl<RegBusBdcqzsdjxxMapper, RegBusBdcqzsdjxxDo> implements ZhjDatasSynService {
private static Logger logger = LoggerFactory.getLogger(ZhjDatasSynServiceImpl.class);
@Autowired
private SynZhjInfoMapper synZhjInfoMapper;
@Autowired
private RegBusBdcqzsdjxxMapper regBusBdcqzsdjxxMapper;
//智慧局内网ip
private String zhjurl="http://172.16.56.10:7050";
//认证令牌
private String appkey="3cd832c411238faa1df46d532a21bfcd";
private String appSecret="ee7612083f63c2ce0d016c2aefd0a8d2";
public void send_bdcYwInfo() {
List<SynZhjInfoDo> selectAllListInfo=synZhjInfoMapper.selectAllInfo();
if(selectAllListInfo!=null && selectAllListInfo.size()>0){
final List<RegBusBdcqzsdjxxDo> zsdjInfoList=regBusBdcqzsdjxxMapper.getZsdjInfoList(selectAllListInfo);
if(zsdjInfoList!=null && zsdjInfoList.size()>0){
String url=zhjurl+"/dclp/hzapi/token?appKey="+appkey+"&appSecret="+appSecret;
Map map1=doGetForNew(url);
if(map1!=null && (Integer)map1.get("code")==200){
final Map map2= (Map) map1.get("data");
final String token= (String) map2.get("token");
//组装宗地基本信息
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("===============当前线程是:"+Thread.currentThread().getName());
synZdInfo(zsdjInfoList,token);
}
}).start();
//组装户信息
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("===============当前线程是:"+Thread.currentThread().getName());
synHInfo(zsdjInfoList,token);
}
}).start();
//组装权属状态
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("===============当前线程是:"+Thread.currentThread().getName());
synQSZTInfo(zsdjInfoList,token);
}
}).start();
}
}
}
}
/**
*根据业务通过swagger接口手动推送宗地基本信息
* @param ywh
* @param
*/
public void synZdInfoByywh(String ywh){
List<RegBusBdcqzsdjxxDo> zsdjInfoList =regBusBdcqzsdjxxMapper.getZsdjInfoListByYwh(ywh);
if(zsdjInfoList!=null && zsdjInfoList.size()>0){
String url=zhjurl+"/dclp/hzapi/token?appKey="+appkey+"&appSecret="+appSecret;
Map map1=doGetForNew(url);
if(map1!=null && (Integer)map1.get("code")==200){
Map map2= (Map) map1.get("data");
String token= (String) map2.get("token");
synZdInfo(zsdjInfoList,token);
}
}
}
/**
* 给智慧局推送宗地基本信息
* @param zsdjInfoList
* @param token
*/
public void synZdInfo(List<RegBusBdcqzsdjxxDo> zsdjInfoList,String token) {
try{
if(zsdjInfoList!=null && zsdjInfoList.size()>0){
for (int i = 0; i < zsdjInfoList.size(); i++) {
RegBusBdcqzsdjxxDo busBdcqzsdjxxDo= zsdjInfoList.get(i);
List<Map> zdjglist = regBusBdcqzsdjxxMapper.getZdInfoByZddm(busBdcqzsdjxxDo);
if(zdjglist!=null && zdjglist.size()>0){
for (int j = 0; j < zdjglist.size(); j++) {
Map map=zdjglist.get(j);
StringBuilder params = new StringBuilder();
params.append("?").append("DJQDM=").append(map.get("DJQDM")).append("&")
.append("DJQMC=").append(URLEncoder.encode((String) map.get("DJQMC"),"UTF-8")).append("&")
.append("DJZQDM=").append(map.get("DJZQDM")).append("&")
.append("DJZQMC=").append(URLEncoder.encode((String) map.get("DJZQMC"),"UTF-8")).append("&")
.append("BDCDYH=").append(map.get("BDCDYH")).append("&")
.append("ZL=").append(URLEncoder.encode((String) map.get("ZL"),"UTF-8")).append("&")
.append("ZDMJ=").append(map.get("ZDMJ")).append("&")
.append("YT=").append(URLEncoder.encode((String) map.get("YT"),"UTF-8"));
String url1=zhjurl+"/dclp/hzapi/ZDJGMS"+params.toString();
Integer code=doPostForNew(url1,"", token);
if(code==200){
synZhjInfoMapper.updatezdzt(busBdcqzsdjxxDo.getYwh());
}
}
}
}
}
}catch (Exception ex){
ex.printStackTrace();
}
}
/**
* 根据业务通过swagger接口手动推送户信息
* @param ywh
* @param
*/
public void synHInfoByYwh(String ywh){
List<RegBusBdcqzsdjxxDo> zsdjInfoList =regBusBdcqzsdjxxMapper.getZsdjInfoListByYwh(ywh);
if(zsdjInfoList!=null && zsdjInfoList.size()>0){
String url=zhjurl+"/dclp/hzapi/token?appKey="+appkey+"&appSecret="+appSecret;
Map map1=doGetForNew(url);
if(map1!=null && (Integer)map1.get("code")==200){
Map map2= (Map) map1.get("data");
String token= (String) map2.get("token");
synHInfo(zsdjInfoList,token);
}
}
}
/**
* 给智慧局推送户基本信息
* @param zsdjInfoList
* @param token
*/
public void synHInfo(List<RegBusBdcqzsdjxxDo> zsdjInfoList,String token){
try{
if(zsdjInfoList!=null && zsdjInfoList.size()>0){
for (int i = 0; i < zsdjInfoList.size(); i++) {
RegBusBdcqzsdjxxDo busBdcqzsdjxxDo= zsdjInfoList.get(i);
List<Map> hlist = regBusBdcqzsdjxxMapper.getHQSInfoByZddm(busBdcqzsdjxxDo);
if(hlist!=null && hlist.size()>0){
for (int j = 0; j < hlist.size(); j++) {
Map map=hlist.get(j);
StringBuilder params = new StringBuilder();
params.append("?").append("BDCDYH=").append(map.get("BDCDYH")).append("&")
.append("ZRZH=").append(map.get("ZRZH")).append("&")
.append("CH=").append(map.get("CH")).append("&")
.append("ZL=").append(URLEncoder.encode((String) map.get("ZL"),"UTF-8")).append("&")
.append("SJCS=").append(map.get("SJCS")).append("&")
.append("SHBW=").append(URLEncoder.encode((String) map.get("SHBW"),"UTF-8")).append("&")
.append("HX=").append(map.get("HX")).append("&")
.append("HXJG=").append(map.get("HXJG")).append("&")
.append("FWYT1=").append(map.get("FWYT1")).append("&")
.append("SCJZMJ=").append(map.get("SCJZMJ")).append("&")
.append("SCTNJZMJ=").append(map.get("SCTNJZMJ")).append("&")
.append("SCDXBFJZMJ=").append(map.get("SCDXBFJZMJ")).append("&")
.append("FTTDMJ=").append(map.get("FTTDMJ")).append("&")
.append("FWLX=").append(map.get("FWLX")).append("&")
.append("FWXZ=").append(map.get("FWXZ")).append("&")
.append("QLLX=").append(map.get("QLLX")).append("&")
.append("DJLX=").append(map.get("DJLX")).append("&")
.append("SYQMJ=").append(map.get("SYQMJ")).append("&")
.append("SYQQSSJ=").append(map.get("SYQQSSJ")).append("&")
.append("SYQJSSJ=").append(map.get("SYQJSSJ")).append("&")
.append("BDCQZH=").append(URLEncoder.encode((String) map.get("BDCQZH"),"UTF-8")).append("&")
.append("QXDM=").append(map.get("QXDM")).append("&")
.append("DJSJ=").append(map.get("DJSJ")).append("&")
.append("QSZT=").append(map.get("QSZT")).append("&")
.append("ZT=").append(map.get("ZT"));
String url1=zhjurl+"/dclp/hzapi/HQSJGMS"+params.toString();
Integer code=doPostForNew(url1,"", token);
if(code==200){
synZhjInfoMapper.updatezdzt(busBdcqzsdjxxDo.getYwh());
}
}
}
}
}
}catch (Exception ex){
ex.printStackTrace();
}
}
/**
* 给智慧局推送权属状态基本信息
* @param ywh
* @param
*/
public void synQSZTInfoByYwh(String ywh){
List<RegBusBdcqzsdjxxDo> zsdjInfoList =regBusBdcqzsdjxxMapper.getZsdjInfoListByYwh(ywh);
if(zsdjInfoList!=null && zsdjInfoList.size()>0){
String url=zhjurl+"/dclp/hzapi/token?appKey="+appkey+"&appSecret="+appSecret;
Map map1=doGetForNew(url);
if(map1!=null && (Integer)map1.get("code")==200){
Map map2= (Map) map1.get("data");
String token= (String) map2.get("token");
synQSZTInfo(zsdjInfoList,token);
}
}
}
/**
* 给智慧局推送权属状态基本信息
* @param zsdjInfoList
* @param token
*/
public void synQSZTInfo(List<RegBusBdcqzsdjxxDo> zsdjInfoList,String token){
if(zsdjInfoList!=null && zsdjInfoList.size()>0){
for (int i = 0; i < zsdjInfoList.size(); i++) {
RegBusBdcqzsdjxxDo busBdcqzsdjxxDo= zsdjInfoList.get(i);
List<Map> qsztList = regBusBdcqzsdjxxMapper.getQSZTInfoByZddm(busBdcqzsdjxxDo);
if(qsztList!=null && qsztList.size()>0){
for (int j = 0; j < qsztList.size(); j++) {
Map map=qsztList.get(j);
StringBuilder params = new StringBuilder();
params.append("?").append("BDCDYH=").append(map.get("BDCDYH")).append("&")
.append("DYQSZT=").append(map.get("DYQSZT")).append("&")
.append("YYQSZT=").append(map.get("YYQSZT")).append("&")
.append("CFQSZT=").append(map.get("CFQSZT")).append("&")
.append("YGQSZT=").append(map.get("YGQSZT"));
String url1=zhjurl+"/dclp/hzapi/QSZT"+params.toString();
Integer code=doPostForNew(url1,"", token);
if(code==200){
synZhjInfoMapper.updatezdzt(busBdcqzsdjxxDo.getYwh());
}
}
}
}
}
}
public Map doGetForNew(String url) {
logger.info("http request url:" + url);
BufferedReader in = null;
String result = "";
Map jsonObject=new HashMap();
try{
URL url1=new URL(url);
HttpURLConnection conn= (HttpURLConnection) url1.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setRequestProperty("Charset", "utf-8");
conn.setDoInput(true);
conn.setDoOutput(false);
//x-qys-signature生成方式:Md5(AppToken + AppSecret + timestamp),获取32位小写值
conn.connect();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
jsonObject=JSONObject.parseObject(result,Map.class);
logger.info("http request back:" + jsonObject);
}catch (Exception ex){
logger.info("发送 POST 请求出现异常!" + ex);
ex.printStackTrace();
}finally {
try {
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return jsonObject;
}
public Integer doPostForNew(String url, String params,String token) {
logger.info("http request url:" + url);
logger.info("http request params:" + params);
PrintWriter out = null;
BufferedReader in = null;
String result = "";
Map jsonObject=new HashMap();
Integer code=200;
try{
URL url1=new URL(url);
HttpURLConnection conn= (HttpURLConnection) url1.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("accept","*/*");
conn.setRequestProperty("connection","Keep-Alive");
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
conn.setRequestProperty("X-Access-Token", token);
out=new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8"));
out.print(params);
out.flush();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
jsonObject=JSONObject.parseObject(result,Map.class);
logger.info("http request back:" + jsonObject);
code= (Integer) jsonObject.get("code");
}catch (Exception ex){
logger.info("发送 POST 请求出现异常!" + ex);
ex.printStackTrace();
code=-1;
}finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return code;
}
}
spring:
profiles:
active: @profile.active@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="10 seconds">
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="/home/project/logs"/>
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<!--<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />-->
<!--<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />-->
<!--<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />-->
<!-- 彩色日志格式 -->
<!--<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(-&#45;&#45;){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>-->
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--输出到文件-->
<!--时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_debug.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、
以及指定<appender>。<logger>仅有一个name属性,
一个可选的level和一个可选的addtivity属性。
name:用来指定受此logger约束的某一个包或者具体的某一个类。
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。
如果未设置此属性,那么当前logger将会继承上级的级别。
addtivity:是否向上级logger传递打印信息。默认是true。
-->
<!--<logger name="org.springframework.web" level="info"/>-->
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>-->
<!--
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别:
-->
<!--<logger name="com.pashanhoo.*" level="DEBUG" />-->
<!--开发环境:打印控制台-->
<springProfile name="dev">
<logger name="com.pashanhoo" level="debug" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
</springProfile>
<!-- 生产环境. -->
<springProfile name="prod">
<logger name="com.pashanhoo" level="INFO" additivity="false">
<appender-ref ref="INFO_FILE"/>
</logger>
</springProfile>
<!--
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
不能设置为INHERITED或者同义词NULL。默认是DEBUG
可以包含零个或多个元素,标识这个appender将会添加到这个logger。
-->
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<!-- <appender-ref ref="DEBUG_FILE" />-->
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
<!--生产环境:输出到文件-->
<!--<springProfile name="pro">-->
<!--<root level="info">-->
<!--<appender-ref ref="CONSOLE" />-->
<!--<appender-ref ref="DEBUG_FILE" />-->
<!--<appender-ref ref="INFO_FILE" />-->
<!--<appender-ref ref="ERROR_FILE" />-->
<!--<appender-ref ref="WARN_FILE" />-->
<!--</root>-->
<!--</springProfile>-->
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pashanhoo.qys.mapper.ElecLicenseInfoMapper">
<update id="updateEciInfo">
update ELEC_LICENSE_INFO set ERR_STATE='0',DZZZ_STATE='1' where biz_id=#{bizId}
</update>
<select id="getEciInfoByZsbs" resultType="com.pashanhoo.qys.entity.ElecLicenseInfoDo">
select * from ELEC_LICENSE_INFO where zsbs=#{zsbs}
</select>
<select id="getDocumentIdIsNull" resultType="com.pashanhoo.qys.entity.ElecLicenseInfoDo">
select *
from ELEC_LICENSE_INFO
where DOCUMENT_ID is null and htzt='COMPLETE' and ywh = #{ywh}
</select>
<select id="getWaitForDownload" resultType="com.pashanhoo.qys.entity.ElecLicenseInfoDo">
select *
from ELEC_LICENSE_INFO
where DOCUMENT_ID is not null
and SFXZ = '2' and ywh = #{ywh}
</select>
<select id="getWaitForConvert" resultType="com.pashanhoo.qys.entity.ElecLicenseInfoDo">
select *
from ELEC_LICENSE_INFO
where SFXZ = '1'
and SFZH = '2'
and ofd_wjdz is not null and ywh = #{ywh}
</select>
<select id="getYwrMcByCOnditon" resultType="java.lang.String">
select qlrmc as ywr
from reg_bus_ywr c
where ywh = #{ywh}
and bdcdyh = #{bdcdyh}
and del_flag = '0'
and qszt = '1'
</select>
<select id="getElecLicenseInfo" resultType="com.pashanhoo.qys.entity.ElecLicenseInfoDo">
select *
from ELEC_LICENSE_INFO
where ywh = #{ywh} and zsbs=#{zsbs} and zsbh=#{zsbh} and zjh=#{zjh}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pashanhoo.zhj.mapper.RegBusBdcqzsdjxxMapper">
<update id="updateBdcqzsjbxxInfo">
update reg_bus_bdcqzsdjxx set ISCJDZZZ='1' where ID=#{id}
</update>
<select id="getZsdjInfoList" resultType="com.pashanhoo.zhj.entity.RegBusBdcqzsdjxxDo" parameterType="com.pashanhoo.zhj.entity.SynZhjInfoDo">
select * from reg_bus_bdcqzsdjxx where
del_flag='0'
and
ywh in
<foreach collection="list" item="selectAllListInfo" open="(" close=")" separator=",">
#{selectAllListInfo.ywh,jdbcType=VARCHAR}
</foreach>
</select>
<select id="getZsdjInfoListByYwh" resultType="com.pashanhoo.zhj.entity.RegBusBdcqzsdjxxDo" parameterType="java.lang.String">
select * from reg_bus_bdcqzsdjxx where
del_flag='0'
and ywh=#{ywh}
</select>
<select id="getZdInfoByZddm" parameterType="string" resultType="java.util.Map">
select c.seachcity as djqdm,
(select label
from sys_dict b
where type = 'reg_bus_djq'
and b.value = c.seachcity) as djqmc,
c.seachdistrict as djzqdm,
(select label
from sys_dict b
where type = 'reg_bus_djzq'
and b.value = c.seachdistrict) as djzqmc,
c.bdcdyh,
c.zl,
c.zdmj,
c.yt
from reg_base_zdjbxx c,reg_bus_bdcqzsdjxx a
where a.del_flag = '0'
and a.islogout = '0'
and a.bdcdyh = c.bdcdyh
and a.bdcdyh=#{bdcdyh}
and a.ywh=#{ywh}
and c.del_flag = '0'
</select>
<select id="getHQSInfoByZddm" parameterType="string" resultType="java.util.Map">
select c.bdcdyh,
c.zrzh,
c.ch,
c.zl,
c.sjcs,
c.shbw,
c.hx,
c.hxjg,
c.fwyt1,
c.scjzmj,
c.sctnjzmj,
c.scdxbfjzmj,
c.fttdmj,
c.fwlx,
c.fwxz,
b.qllx,
b.djlx,
b.syqmj,
to_char(trunc(b.syqqssj),'yyyy-mm-dd') as syqqssj,
to_char(trunc(b.syqjssj),'yyyy-mm-dd') as syqjssj,
b.bdcqzh,
b.qxdm,
to_char(trunc(b.djsj),'yyyy-mm-dd') as djsj,
b.qszt,
c.zt
from reg_base_h c, reg_bus_jsydsyq b
where c.del_flag = '0'
and c.rights != '3'
and exists (select 1
from reg_bus_bdcqzsdjxx a
where a.del_flag = '0'
and a.islogout = '0'
and a.bdcdyh = c.bdcdyh
and a.ywh=#{ywh}
and a.bdcdyh =#{bdcdyh})
and c.zddm=b.zddm
and b.del_flag = '0'
</select>
<select id="getQSZTInfoByZddm" parameterType="string" resultType="java.util.Map">
select #{bdcdyh} as bdcdyh,
nvl((select decode(qszt,'1','0','1') from reg_bus_dyaq where ywh=#{ywh} and bdcdyh=#{bdcdyh} and del_flag='0' and qszt=1),'0') as dyqszt,
nvl((select decode(qszt,'1','0','1') from reg_bus_ygdj where ywh=#{ywh} and bdcdyh=#{bdcdyh} and del_flag='0' and qszt=1),'0') as ygqszt,
nvl((select decode(qszt,'1','0','1') from reg_bus_yydj where ywh=#{ywh} and bdcdyh=#{bdcdyh} and del_flag='0' and qszt=1),'0') as yyqszt,
nvl((select decode(qszt,'1','0','1') from reg_bus_cfdj where ywh=#{ywh} and bdcdyh=#{bdcdyh} and del_flag='0' and qszt=1),'0') as cfqszt
from dual
</select>
<select id="getBdcqzsjbxxInfo" resultType="java.util.Map">
select c.id,
c.ywh,
c.bdcdyh,
c.bdcqzh,
c.create_date,
c.qlrmc,
c.gyqk,
c.zl,
(select label from sys_dict c where type ='reg_bus_qllx' and value= c.qllx and del_flag='0') qllx,
c.djlx,
c.qlxz,
c.qt,
c.yt,
c.mj,
c.syqx,
c.qlqtzk,
c.fj,
c.rights,
REPLACE(c.dbsj,'-','') as djsj,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'YYYY') as y,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'MM') as m,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'dd') as d,
c.bdcqzbh as bh
from reg_bus_bdcqzsdjxx c
where c.del_flag = '0'
and c.isxydzzz = '1'
and c.iscjdzzz = '0'
and dbsj is not null
</select>
<select id="getBdcqzsjbxxInfoByYwh" resultType="java.util.Map">
select c.id,
c.ywh,
c.bdcdyh,
c.bdcqzh,
c.create_date,
c.qlrmc,
c.gyqk,
c.zl,
(select label from sys_dict c where type ='reg_bus_qllx' and value= c.qllx and del_flag='0') qllx,
c.djlx,
c.qlxz,
c.qt,
c.yt,
c.mj,
c.syqx,
c.qlqtzk,
c.fj,
c.rights,
REPLACE(c.dbsj,'-','') as djsj,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'YYYY') as y,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'MM') as m,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'dd') as d,
c.bdcqzbh as bh
from reg_bus_bdcqzsdjxx c
where c.del_flag = '0'
and c.isxydzzz = '1'
and c.iscjdzzz = '0'
and c.ywh=#{ywh}
and dbsj is not null
</select>
<select id="getQlrInfoByYwh" resultType="java.util.Map">
select wm_concat(qlrmc) as qlrmc,wm_concat(zjh) as zjh from reg_bus_qlr c where ywh =#{ywh} and del_flag='0' and qszt='1' order by sxh
</select>
<select id="getQlrInfoByYwhAndqlr" resultType="java.lang.String">
select zjh from reg_bus_qlr c where ywh =#{ywh} and qlrmc=#{qlrmc} and del_flag='0' and qszt='1' order by sxh
</select>
<select id="getBdcqzsJbxxById" resultType="java.util.Map">
select c.id,
c.ywh,
c.bdcdyh,
c.bdcqzh,
c.create_date,
c.qlrmc,
c.gyqk,
c.zl,
(select label from sys_dict c where type ='reg_bus_qllx' and value= c.qllx and del_flag='0') qllx,
c.djlx,
c.qlxz,
c.qt,
c.yt,
c.mj,
c.syqx,
c.qlqtzk,
c.fj,
c.rights,
REPLACE(c.dbsj,'-','') as djsj,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'YYYY') as y,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'MM') as m,
to_char(to_date(c.dbsj, 'yyyy-mm-dd'),'dd') as d,
c.bdcqzbh as bh
from reg_bus_bdcqzsdjxx c
where c.id=#{id}
</select>
<select id="getInfoByValue" resultType="java.lang.String">
select label from sys_dict c where del_flag='0' and type=#{type} and value=#{value}
</select>
<select id="getRightsInfo" resultType="java.util.Map">
select * from ( SELECT * FROM reg_bus_rights a WHERE a.bdcdyh = #{bdcdyh} order by del_flag ) where rownum=1
</select>
<select id="getDyqqInfo" resultType="java.util.Map">
select c.bdbzzqse,to_char(c.zwlxqssj,'yyyymmdd') as zwlxqssj,to_char(c.zwlxjssj,'yyyymmdd') as zwlxjssj from reg_bus_dyaq c where ywh=#{ywh} and bdcdyh=#{bdcdyh} and qszt='1'
</select>
<select id="getHtbhInfo" resultType="java.lang.String">
select htbh from reg_bus_ygdj c where qszt='1' and del_flag='0' and ywh=#{ywh}
</select>
<select id="getBdcjbxxInfo" resultType="java.util.Map">
select * from reg_bus_bdcqzsdjxx c where bdcdyh=#{bdcdyh} and islogout='0' and dbsj is not null and del_flag='0'
</select>
<select id="getJbxxInfoByYwhAndBdcdyh" resultType="java.util.Map">
select * from reg_bus_bdcqzsdjxx c where ywh=#{ywh} and bdcdyh=#{bdcdyh} and islogout='0' and dbsj is not null and del_flag='0'
</select>
<select id="getJbxxById" resultType="java.util.Map">
select * from reg_bus_bdcqzsdjxx c where id=#{id}
</select>
<select id="getZdjbxxByZddm" resultType="java.util.Map">
select * from reg_base_zdjbxx where del_flag='0' and zddm=#{zddm} and islogout='0'
</select>
<select id="getZrzInfo" resultType="java.util.Map">
select * from reg_base_zrz where bdcdyh=#{bdcdyh} and del_flag='0'
</select>
<select id="getHInfo" resultType="java.util.Map">
select * from reg_base_h c where bdcdyh=#{bdcdyh} and islogout='0' and del_flag='0'
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pashanhoo.zhj.mapper.SynZhjInfoMapper">
<select id="selectAllInfo" resultType="com.pashanhoo.zhj.entity.SynZhjInfoDo">
select * from syn_zhjinfo where ZD_STATE='0' and H_STATE='0' and HQS_STATE='0' and del_flag='0'
</select>
<update id="updatezdzt">
update syn_zhjinfo set ZD_STATE='1' where ywh=#{ywh}
</update>
<update id="updateHzt">
update syn_zhjinfo set H_STATE='1' where ywh=#{ywh}
</update>
<update id="updateHqszt">
update syn_zhjinfo set HQS_STATE='1' where ywh=#{ywh}
</update>
</mapper>