first commit

This commit is contained in:
lijiazhuo
2025-08-22 14:36:10 +08:00
commit 6c5a040969
58 changed files with 34059 additions and 0 deletions

31
.gitignore vendored Normal file
View File

@ -0,0 +1,31 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

118
.mvn/wrapper/MavenWrapperDownloader.java vendored Normal file
View File

@ -0,0 +1,118 @@
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.5";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

BIN
.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

2
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar

37
README.md Normal file
View File

@ -0,0 +1,37 @@
项目概述:
此项目为法大大电子合同签章项目,主要为各种合同的签发以及下载
对接人:
葛梦伟,王茜 葛梦伟为dp合同负责人王茜为自营项目负责人如需要接口文档请找王茜
项目主要为推送以及定时:
以下为相关接口:
@PostMapping("/dpbg")
@PostMapping("/anquantongchou")
@PostMapping("/dpapp")
@PostMapping("/qianzhang")
@PostMapping("/bx")
@PostMapping("/DP")
@PostMapping("/DPzulin")
@PostMapping("/jiashiyuanfuwu")
@PostMapping("/lianying")
@PostMapping("/lianying1")
@PostMapping("/ty")
@PostMapping("/tuizu")
@PostMapping("/xuqian")
@PostMapping("/jinan")
@PostMapping("/jinanyinjianurl")
@PostMapping("/qianzhang1")
@PostMapping("/tuizu1")
@PostMapping("/xuqian1")
定时任务:
@Scheduled(cron = "0 0 22 * * ?") // 每天晚上 22:00 执行
public static void main1() throws Exception {
。。。。。。
}

322
mvnw vendored Normal file
View File

@ -0,0 +1,322 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ]; then
if [ -f /etc/mavenrc ]; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ]; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
darwin=false
mingw=false
case "$(uname)" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true ;;
Darwin*)
darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="$(/usr/libexec/java_home)"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ]; then
if [ -r /etc/gentoo-release ]; then
JAVA_HOME=$(java-config --jre-home)
fi
fi
if [ -z "$M2_HOME" ]; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ]; do
ls=$(ls -ld "$PRG")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' >/dev/null; then
PRG="$link"
else
PRG="$(dirname "$PRG")/$link"
fi
done
saveddir=$(pwd)
M2_HOME=$(dirname "$PRG")/..
# make it fully qualified
M2_HOME=$(cd "$M2_HOME" && pwd)
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=$(cygpath --unix "$M2_HOME")
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw; then
[ -n "$M2_HOME" ] &&
M2_HOME="$( (
cd "$M2_HOME"
pwd
))"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="$( (
cd "$JAVA_HOME"
pwd
))"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="$(which javac)"
if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=$(which readlink)
if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then
if $darwin; then
javaHome="$(dirname \"$javaExecutable\")"
javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac"
else
javaExecutable="$(readlink -f \"$javaExecutable\")"
fi
javaHome="$(dirname \"$javaExecutable\")"
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ]; then
if [ -n "$JAVA_HOME" ]; then
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="$(which java)"
fi
fi
if [ ! -x "$JAVACMD" ]; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ]; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]; then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ]; do
if [ -d "$wdir"/.mvn ]; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=$(
cd "$wdir/.."
pwd
)
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' <"$1")"
fi
}
BASE_DIR=$(find_maven_basedir "$(pwd)")
if [ -z "$BASE_DIR" ]; then
exit 1
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
fi
while IFS="=" read key value; do
case "$key" in wrapperUrl)
jarUrl="$value"
break
;;
esac
done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
fi
if command -v wget >/dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl >/dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=$(cygpath --path --windows "$javaClass")
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=$(cygpath --path --windows "$M2_HOME")
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

182
mvnw.cmd vendored Normal file
View File

@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

78
pom.xml Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>sso</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sso</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.45</version>
</dependency>
<dependency>
<groupId>com.fadada.api</groupId>
<artifactId>fasc-openapi-java-sdk</artifactId>
<version>5.3.7.1221</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,17 @@
package com.example.sso;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@EnableAsync
public class SsoApplication {
public static void main(String[] args) {
SpringApplication.run(SsoApplication.class, args);
}
}

View File

@ -0,0 +1,53 @@
package com.example.sso.config;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Configuration
@EnableAsync
public class AsyncConfig implements AsyncConfigurer {
// ThredPoolTaskExcutor的处理流程
// 当池子大小小于corePoolSize就新建线程并处理请求
// 当池子大小等于corePoolSize把请求放入workQueue中池子里的空闲线程就去workQueue中取任务并处理
// 当workQueue放不下任务时就新建线程入池并处理请求如果池子大小撑到了maximumPoolSize就用RejectedExecutionHandler来做拒绝处理
// 当池子的线程数大于corePoolSize时多余的线程会等待keepAliveTime长时间如果无请求可处理就自行销毁
@Override
@Bean
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// 核心线程数:线程池创建的时候初始化的线程数
executor.setCorePoolSize(30);
// 最大线程数:线程池最大的线程数,只有缓冲队列满了之后才会申请超过核心线程数的线程
executor.setMaxPoolSize(100);
// 缓冲队列:用来缓冲执行任务的队列
executor.setQueueCapacity(50);
// 线程池关闭:等待所有任务都完成再关闭
executor.setWaitForTasksToCompleteOnShutdown(true);
// 等待时间等待5秒后强制停止
executor.setAwaitTerminationSeconds(5);
// 允许空闲时间超过核心线程之外的线程到达60秒后会被销毁
executor.setKeepAliveSeconds(60);
// 线程名称前缀
executor.setThreadNamePrefix("fadada");
// 缓冲队列满了之后的拒绝策略:由调用线程处理(一般是主线程)
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// 初始化线程
executor.initialize();
return executor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return null;
}
}

View File

@ -0,0 +1,21 @@
package com.example.sso.config;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.annotation.Validated;
@Configuration
@ConfigurationProperties(prefix = "fdd")
@NoArgsConstructor
@AllArgsConstructor
@Validated
@Getter
@Setter
public class FddConfig {
private String AppID;
private String AppSecret;
}

View File

@ -0,0 +1,23 @@
package com.example.sso.config;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.annotation.Validated;
//import javax.validation.constraints.NotBlank;
@Configuration
@ConfigurationProperties(prefix = "sso")
@NoArgsConstructor
@AllArgsConstructor
@Validated
@Getter
@Setter
public class SSOConfig {
private String acs;
private String secret;
}

View File

@ -0,0 +1,189 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class AnQuanTongChou {
Logger logger = LoggerFactory.getLogger(getClass());
@PostMapping("/anquantongchou")
public String dp(@RequestBody JSONObject signature) throws Exception {
logger.info(signature.toJSONString());
JSONObject data = signature.getJSONObject("data");
String flowContractno = data.getString("flow_contractno");
String flowPaname = data.getString("flow_paname");
String flowLegal = data.getString("flow_legal");
String flowName = data.getString("flow_name");
String flowPbid = data.getString("flow_pbid");
String flowPbphoneno = data.getString("flow_pbphoneno");
String flowChangedate = data.getString("flow_changedate");
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "安全统筹参统协议" + "$" + flowName + "$" + flowContractno);
initiator.put("signTemplateId", "1719883223970124571");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flowName != null) {
actorlist.put("actorName", flowName);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flowName != null) {
actorlist.put("identNameForMatch", flowName);
}
actorlist.put("certType", "id_card");
if (flowPbid != null) {
actorlist.put("certNoForMatch", flowPbid);
}
if (flowPbphoneno != null) {
actorlist.put("notifyAddress", flowPbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "参与方1");
actorlists.put("actorType", "corp");
if (flowPaname != null) {
actorlists.put("actorName", flowPaname);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
actorlists.put("actorOpenId", "a9da2a884ca24aaaa03bf53b21792b06");
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1719883223970124571");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
jsonObject2.put("sealId", 1720410919082196954l);
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
jsonArray.add(actor);
jsonArray.add(actors);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("安全统筹参统协议" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//合同编号
JSONObject dpflowChangedate = new JSONObject();
dpflowChangedate.put("fieldId", "6826496343");
if (flowChangedate != null) {
dpflowChangedate.put("fieldValue", flowChangedate);
}
dpflowChangedate.put("docId", doc);
//合同编号
JSONObject DPflowHtid1 = new JSONObject();
DPflowHtid1.put("fieldId", "3220703350");
if (flowChangedate != null) {
DPflowHtid1.put("fieldValue", flowChangedate);
}
DPflowHtid1.put("docId", doc);
sizejsonarray.add(dpflowChangedate);
sizejsonarray.add(DPflowHtid1);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
logger.info("安全统筹参统协议写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("安全统筹参统协议完成" + signtask);
return "完成";
}
}

View File

@ -0,0 +1,330 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Slf4j
@Async
public class AppController {
@PostMapping("/dpapp")
public String qianzhangdp(@RequestBody JSONObject signature) throws Exception {
JSONObject data = signature.getJSONObject("data");
String yifang = data.getString("yifang");
String gongminshenfenhaoma = data.getString("gongminshenfenhaoma");
String lianxidianhua = data.getString("lianxidianhua");
String shoukuanrenmingcheng = data.getString("shoukuanrenmingcheng");
String kaihuhangmingcheng = data.getString("kaihuhangmingcheng");
String kaihuhangzhanghao = data.getString("kaihuhangzhanghao");
String fuwuqixianqishiriqinian = data.getString("fuwuqixianqishiriqinian");
String fuwuqixianqishiriqiyue = data.getString("fuwuqixianqishiriqiyue");
String fuwuqixianqishiriqiri = data.getString("fuwuqixianqishiriqiri");
String fuwuqixianjieshuriqinian = data.getString("fuwuqixianjieshuriqinian");
String fuwuqixianjieshuriqiyue = data.getString("fuwuqixianjieshuriqiyue");
String fuwuqixianjieshuriqiri = data.getString("fuwuqixianjieshuriqiri");
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "经纪人服务协议");
initiator.put("signTemplateId", "1706240027829119578");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "用户方");
actorlist.put("actorType", "person");
if (yifang != null) {
actorlist.put("actorName", yifang);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (yifang != null) {
actorlist.put("identNameForMatch", yifang);
}
actorlist.put("certType", "id_card");
if (gongminshenfenhaoma != null) {
actorlist.put("certNoForMatch", gongminshenfenhaoma);
}
if (lianxidianhua != null) {
actorlist.put("notifyAddress", lianxidianhua);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "企业方");
actorlists.put("actorType", "corp");
actorlists.put("actorName", "银建的士");
actorlists.put("actorOpenId", "625776ecae6742cb8eb710beedef9b4c");
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
/* if (flowCompany != null) {
if (flowCompany.equals("北京康建利福汽车服务有限公司")) {
actorlists.put("actorOpenId", "232063a6e4dd45889db2f843ff75b658");
} else if (flowCompany.equals("北京康建利华汽车服务有限责任公司")) {
actorlists.put("actorOpenId", "92c4c1cd7ae14c0ea799d4a7ec547950");
} else if (flowCompany.equals("北京康建益华汽车服务有限公司")) {
actorlists.put("actorOpenId", "d9cf1eb503b442e6bd963df573412af4");
}
}*/
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1706240027829119578");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
/* if (flowCompany.equals("北京康建利福汽车服务有限公司")) {
jsonObject2.put("sealId", 1707030330912199731l);
} else if (flowCompany.equals("北京康建利华汽车服务有限责任公司")) {
jsonObject2.put("sealId", 1707030386850185754l);
} else if (flowCompany.equals("北京康建益华汽车服务有限公司")) {
jsonObject2.put("sealId", 1707029844237168249l);
}*/
jsonObject2.put("sealId", 1705574268127146240l);
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
jsonArray.add(actor);
jsonArray.add(actors);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
log.info("DP小程序" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//身份证号
JSONObject DPflowPbid = new JSONObject();
DPflowPbid.put("fieldId", "2742648076");
if (yifang != null) {
DPflowPbid.put("fieldValue", yifang);
}
DPflowPbid.put("docId", doc);
//身份证号
JSONObject dpgongminshenfenhaoma = new JSONObject();
dpgongminshenfenhaoma.put("fieldId", "2695002117");
if (gongminshenfenhaoma != null) {
dpgongminshenfenhaoma.put("fieldValue", gongminshenfenhaoma);
}
dpgongminshenfenhaoma.put("docId", doc);
//身份证号
JSONObject dpglianxidianhua = new JSONObject();
dpglianxidianhua.put("fieldId", "5323259454");
if (lianxidianhua != null) {
dpglianxidianhua.put("fieldValue", lianxidianhua);
}
dpglianxidianhua.put("docId", doc);
//身份证号
JSONObject dpgshoukuanrenmingcheng = new JSONObject();
dpgshoukuanrenmingcheng.put("fieldId", "8995965727");
if (shoukuanrenmingcheng != null) {
dpgshoukuanrenmingcheng.put("fieldValue", shoukuanrenmingcheng);
}
dpgshoukuanrenmingcheng.put("docId", doc);
//身份证号
JSONObject dpkaihuhangmingcheng = new JSONObject();
dpkaihuhangmingcheng.put("fieldId", "3563634135");
if (kaihuhangmingcheng != null) {
dpkaihuhangmingcheng.put("fieldValue", kaihuhangmingcheng);
}
dpkaihuhangmingcheng.put("docId", doc);
//身份证号
JSONObject dpkaihuhangzhanghao = new JSONObject();
dpkaihuhangzhanghao.put("fieldId", "1234568350");
if (kaihuhangzhanghao != null) {
dpkaihuhangzhanghao.put("fieldValue", kaihuhangzhanghao);
}
dpkaihuhangzhanghao.put("docId", doc);
//身份证号
JSONObject dpfuwuqixianqishiriqinian = new JSONObject();
dpfuwuqixianqishiriqinian.put("fieldId", "7136400739");
if (fuwuqixianqishiriqinian != null) {
dpfuwuqixianqishiriqinian.put("fieldValue", fuwuqixianqishiriqinian);
}
dpfuwuqixianqishiriqinian.put("docId", doc);
//身份证号
JSONObject dpfuwuqixianqishiriqiyue = new JSONObject();
dpfuwuqixianqishiriqiyue.put("fieldId", "5133332576");
if (fuwuqixianqishiriqiyue != null) {
dpfuwuqixianqishiriqiyue.put("fieldValue", fuwuqixianqishiriqiyue);
}
dpfuwuqixianqishiriqiyue.put("docId", doc);
//身份证号
JSONObject dpfuwuqixianqishiriqiri = new JSONObject();
dpfuwuqixianqishiriqiri.put("fieldId", "5711127066");
if (fuwuqixianqishiriqiri != null) {
dpfuwuqixianqishiriqiri.put("fieldValue", fuwuqixianqishiriqiri);
}
dpfuwuqixianqishiriqiri.put("docId", doc);
//身份证号
JSONObject dpfuwuqixianjieshuriqinian = new JSONObject();
dpfuwuqixianjieshuriqinian.put("fieldId", "8594690260");
if (fuwuqixianjieshuriqinian != null) {
dpfuwuqixianjieshuriqinian.put("fieldValue", fuwuqixianjieshuriqinian);
}
dpfuwuqixianjieshuriqinian.put("docId", doc);
//身份证号
JSONObject dpfuwuqixianjieshuriqiyue = new JSONObject();
dpfuwuqixianjieshuriqiyue.put("fieldId", "8856624986");
if (fuwuqixianjieshuriqiyue != null) {
dpfuwuqixianjieshuriqiyue.put("fieldValue", fuwuqixianjieshuriqiyue);
}
dpfuwuqixianjieshuriqiyue.put("docId", doc);
//身份证号
JSONObject dpfuwuqixianjieshuriqiri = new JSONObject();
dpfuwuqixianjieshuriqiri.put("fieldId", "3016246868");
if (fuwuqixianjieshuriqiri != null) {
dpfuwuqixianjieshuriqiri.put("fieldValue", fuwuqixianjieshuriqiri);
}
dpfuwuqixianjieshuriqiri.put("docId", doc);
sizejsonarray.add(DPflowPbid);
sizejsonarray.add(dpgongminshenfenhaoma);
sizejsonarray.add(dpglianxidianhua);
sizejsonarray.add(dpgshoukuanrenmingcheng);
sizejsonarray.add(dpkaihuhangmingcheng);
sizejsonarray.add(dpkaihuhangzhanghao);
sizejsonarray.add(dpfuwuqixianqishiriqinian);
sizejsonarray.add(dpfuwuqixianqishiriqiyue);
sizejsonarray.add(dpfuwuqixianqishiriqiri);
sizejsonarray.add(dpfuwuqixianjieshuriqinian);
sizejsonarray.add(dpfuwuqixianjieshuriqiyue);
sizejsonarray.add(dpfuwuqixianjieshuriqiri);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
log.info("DPapp写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
log.info("DPapp完成" + signtask);
return "";
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,385 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class FddControllerDpBianGeng {
Logger logger = LoggerFactory.getLogger(getClass());
@PostMapping("/dpbg")
public String dp(@RequestBody JSONObject signature) throws Exception {
logger.info(signature.toJSONString());
JSONObject data = signature.getJSONObject("data");
String flow_company = data.getString("flow_company");//合同编号
String flow_registrid = data.getString("flow_registrid");//承包合同开始日期
String flow_legal = data.getString("flow_legal");//承包合同终止日期
String flow_site = data.getString("flow_site");//签订日期
String flow_name = data.getString("flow_name");//公司名称
String flow_pbid = data.getString("flow_pbid");//乙方
String flow_pbphoneno = data.getString("flow_pbphoneno");//联系电话
String flow_pbaddress = data.getString("flow_pbaddress");//联系电话
String flow_wcsdate = data.getString("flow_wcsdate");//合同编号
String flow_company_2 = data.getString("flow_company_2");//承包合同开始日期
String flow_registrid_2 = data.getString("flow_registrid_2");//承包合同终止日期
String flow_legal_2 = data.getString("flow_legal_2");//签订日期
String flow_site_2 = data.getString("flow_site_2");//公司名称
String flow_contractno = data.getString("flow_contractno");//公司名称
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "DP变更协议" + "$" + flow_name + "$" + flow_contractno);
initiator.put("signTemplateId", "1754475649672115405");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flow_name != null) {
actorlist.put("actorName", flow_name);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flow_name != null) {
actorlist.put("identNameForMatch", flow_name);
}
actorlist.put("certType", "id_card");
if (flow_pbid != null) {
actorlist.put("certNoForMatch", flow_pbid);
}
if (flow_pbphoneno != null) {
actorlist.put("notifyAddress", flow_pbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "甲方");
actorlists.put("actorType", "corp");
if (flow_company != null) {
actorlists.put("actorName", flow_company);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (flow_company != null) {
if (flow_company.equals("北京康建利福汽车服务有限公司")) {
actorlists.put("actorOpenId", "232063a6e4dd45889db2f843ff75b658");
}
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONObject actors1 = new JSONObject();
//actor详细信息企业丙方
JSONObject actorlists1 = new JSONObject();
actorlists1.put("actorId", "丙方");
actorlists1.put("actorType", "corp");
if (flow_company_2 != null) {
actorlists1.put("actorName", flow_company_2);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (flow_company_2 != null) {
if (flow_company_2.equals("北京银环泰西汽车服务有限公司")) {
actorlists1.put("actorOpenId", "802b22355a0545558be4a1b1dad746a6");
}
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes1 = new JSONArray();
notifyTypes1.add("start");
notifyTypes1.add("finish");
actorlists1.put("notifyType", notifyTypes1);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1754475649672115405");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
jsonObject2.put("fieldId", "5005908017");
if (flow_company.equals("北京康建利福汽车服务有限公司")) {
jsonObject2.put("sealId", 1707030330912199731l);
}
//丙方印章
JSONArray SignField1 = new JSONArray();
JSONObject jsonObject21 = new JSONObject();
JSONObject ownerId1 = new JSONObject(); // docid
ownerId1.put("ownerId", openid);
ownerId1.put("signTemplateId", "1754475649672115405");
String ownerIdJSONString2 = ownerId1.toJSONString();
String doc2 = FDaDaUtil.doc(ownerIdJSONString2);
jsonObject21.put("fieldDocId", doc2);
jsonObject21.put("fieldId", "5275451633");
if (flow_company_2.equals("北京银环泰西汽车服务有限公司")) {
jsonObject21.put("sealId", 1754044354642191353l);
}
SignField.add(jsonObject2);
SignField1.add(jsonObject21);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
//丙方
JSONObject signConfigInfo1 = new JSONObject();
JSONObject signConfigInfos1 = new JSONObject();
signConfigInfos1.put("requestVerifyFree", true);
signConfigInfo1.put("signConfigInfo", signConfigInfo1);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
actors1.put("actor", actorlists1);
actors1.put("signFields", SignField1);
actors1.put("signConfigInfo", signConfigInfos1);
jsonArray.add(actor);
jsonArray.add(actors);
jsonArray.add(actors1);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
logger.info("入参 " + jsonString);
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("DP租赁变更" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//合同编号
JSONObject flow_company1 = new JSONObject();
flow_company1.put("fieldId", "2904585592");
if (flow_company != null) {
flow_company1.put("fieldValue", flow_company);
}
flow_company1.put("docId", doc);
JSONObject flow_registrid1 = new JSONObject();
flow_registrid1.put("fieldId", "7737543576");
if (flow_registrid != null) {
flow_registrid1.put("fieldValue", flow_registrid);
}
flow_registrid1.put("docId", doc);
JSONObject flow_legal1 = new JSONObject();
flow_legal1.put("fieldId", "7332206065");
if (flow_legal != null) {
flow_legal1.put("fieldValue", flow_legal);
}
flow_legal1.put("docId", doc);
JSONObject flow_site1 = new JSONObject();
flow_site1.put("fieldId", "0243447648");
if (flow_site != null) {
flow_site1.put("fieldValue", flow_site);
}
flow_site1.put("docId", doc);
JSONObject flow_name1 = new JSONObject();
flow_name1.put("fieldId", "3221966137");
if (flow_name != null) {
flow_name1.put("fieldValue", flow_name);
}
flow_name1.put("docId", doc);
JSONObject flow_pbid1 = new JSONObject();
flow_pbid1.put("fieldId", "1649670023");
if (flow_pbid != null) {
flow_pbid1.put("fieldValue", flow_pbid);
}
flow_pbid1.put("docId", doc);
JSONObject flow_pbaddress1 = new JSONObject();
flow_pbaddress1.put("fieldId", "6262025935");
if (flow_pbaddress != null) {
flow_pbaddress1.put("fieldValue", flow_pbaddress);
}
flow_pbaddress1.put("docId", doc);
JSONObject flow_wcsdate1 = new JSONObject();
flow_wcsdate1.put("fieldId", "0545220484");
if (flow_wcsdate != null) {
flow_wcsdate1.put("fieldValue", flow_wcsdate);
}
flow_wcsdate1.put("docId", doc);
JSONObject flow_company_21 = new JSONObject();
flow_company_21.put("fieldId", "9919283566");
if (flow_company_2 != null) {
flow_company_21.put("fieldValue", flow_company_2);
}
flow_company_21.put("docId", doc);
JSONObject flow_registrid_21 = new JSONObject();
flow_registrid_21.put("fieldId", "9236200533");
if (flow_registrid_2 != null) {
flow_registrid_21.put("fieldValue", flow_registrid_2);
}
flow_registrid_21.put("docId", doc);
JSONObject flow_legal_21 = new JSONObject();
flow_legal_21.put("fieldId", "8191881584");
if (flow_legal_2 != null) {
flow_legal_21.put("fieldValue", flow_legal_2);
}
flow_legal_21.put("docId", doc);
JSONObject flow_site_21 = new JSONObject();
flow_site_21.put("fieldId", "3607440370");
if (flow_site_2 != null) {
flow_site_21.put("fieldValue", flow_site_2);
}
flow_site_21.put("docId", doc);
sizejsonarray.add(flow_company1);
sizejsonarray.add(flow_registrid1);
sizejsonarray.add(flow_legal1);
sizejsonarray.add(flow_site1);
sizejsonarray.add(flow_name1);
sizejsonarray.add(flow_pbid1);
sizejsonarray.add(flow_pbaddress1);
sizejsonarray.add(flow_wcsdate1);
sizejsonarray.add(flow_company_21);
sizejsonarray.add(flow_registrid_21);
sizejsonarray.add(flow_legal_21);
sizejsonarray.add(flow_site_21);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
logger.info("DP租赁变更写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("DP租赁变更完成" + signtask);
return "完成";
}
}

View File

@ -0,0 +1,304 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class FddControllerDpZuLin {
Logger logger = LoggerFactory.getLogger(getClass());
@PostMapping("/DPzulin")
public String dp(@RequestBody JSONObject signature) throws Exception {
logger.info(signature.toJSONString());
JSONObject data = signature.getJSONObject("data");
String flowHtid = data.getString("flow_htid");//合同编号
String flowWcsdate = data.getString("flow_wcsdate");//承包合同开始日期
String flowWcedate = data.getString("flow_wcedate");//承包合同终止日期
String flowSigndate = data.getString("flow_signdate");//签订日期
String flowCompany = data.getString("flow_company");//公司名称
String flowName = data.getString("flow_name");//乙方
String flowPbphoneno = data.getString("flow_pbphoneno");//联系电话
String flowPbid = data.getString("flow_pbid");//联系电话
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "DP租赁合同续签书" + "$" + flowName + "$" + flowHtid);
initiator.put("signTemplateId", "1713952710910137269");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flowName != null) {
actorlist.put("actorName", flowName);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flowName != null) {
actorlist.put("identNameForMatch", flowName);
}
actorlist.put("certType", "id_card");
if (flowPbid != null) {
actorlist.put("certNoForMatch", flowPbid);
}
if (flowPbphoneno != null) {
actorlist.put("notifyAddress", flowPbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "参与方1");
actorlists.put("actorType", "corp");
if (flowCompany != null) {
actorlists.put("actorName", flowCompany);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (flowCompany != null) {
if (flowCompany.equals("北京康建利福汽车服务有限公司")) {
actorlists.put("actorOpenId", "232063a6e4dd45889db2f843ff75b658");
} else if (flowCompany.equals("北京康建利华汽车服务有限责任公司")) {
actorlists.put("actorOpenId", "92c4c1cd7ae14c0ea799d4a7ec547950");
} else if (flowCompany.equals("北京康建益华汽车服务有限公司")) {
actorlists.put("actorOpenId", "d9cf1eb503b442e6bd963df573412af4");
}
else if (flowCompany.equals("北京康惠利华汽车服务有限公司")) {
actorlists.put("actorOpenId", "53277e0df0e94bafaa588a512c6cfb38");
}
else if (flowCompany.equals("北京吉康利华汽车服务有限公司")) {
actorlists.put("actorOpenId", "cbbf3223d68849e29b5b8b04e49e667f");
}
else if (flowCompany.equals("北京康盛利华汽车服务有限公司")) {
actorlists.put("actorOpenId", "4b4a7f1edcf747f7ba99e5467fb785d2");
}
else if (flowCompany.equals("北京康益利华汽车服务有限公司")) {
actorlists.put("actorOpenId", "962a15a606fc4edca405072b6fd36ae0");
}
else if (flowCompany.equals("北京康旭利华汽车服务有限公司")) {
actorlists.put("actorOpenId", "b33a54d98bcd4a6cacb5ccbd23d0efff");
}
else if (flowCompany.equals("北京康祥利华汽车服务有限公司")) {
actorlists.put("actorOpenId", " 6d856bd3e4974bfdb0121b0d4317bc9b");
}
else if (flowCompany.equals("北京康达利华汽车服务有限公司")) {
actorlists.put("actorOpenId", " c15af6a7de354f72bb60854f4d3ad0f6");
}
else if (flowCompany.equals("北京银环泰西汽车服务有限公司")) {
actorlists.put("actorOpenId", "802b22355a0545558be4a1b1dad746a6");
}
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1713952710910137269");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
if (flowCompany.equals("北京康建利福汽车服务有限公司")) {
jsonObject2.put("sealId", 1707030330912199731l);
} else if (flowCompany.equals("北京康建利华汽车服务有限责任公司")) {
jsonObject2.put("sealId", 1707030386850185754l);
} else if (flowCompany.equals("北京康建益华汽车服务有限公司")) {
jsonObject2.put("sealId", 1707029844237168249l);
}
else if (flowCompany.equals("北京康达利华汽车服务有限公司")) {
jsonObject2.put("sealId", 1718245358848135952l);
}
else if (flowCompany.equals("北京康祥利华汽车服务有限公司")) {
jsonObject2.put("sealId", 1718245334155196686l);
}
else if (flowCompany.equals("北京康旭利华汽车服务有限公司")) {
jsonObject2.put("sealId", 1718245307668188635l);
}
else if (flowCompany.equals("北京康益利华汽车服务有限公司")) {
jsonObject2.put("sealId", 1718245283084112873l);
}
else if (flowCompany.equals("北京康盛利华汽车服务有限公司")) {
jsonObject2.put("sealId", 1718245251260127675l);
}
else if (flowCompany.equals("北京吉康利华汽车服务有限公司")) {
jsonObject2.put("sealId", 1718245214971163597l);
}
else if (flowCompany.equals("北京康惠利华汽车服务有限公司")) {
jsonObject2.put("sealId", 1718244928831114720l);
}
else if (flowCompany.equals("北京银环泰西汽车服务有限公司")) {
jsonObject2.put("sealId", 1754044354642191353l);
}
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
jsonArray.add(actor);
jsonArray.add(actors);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("DP租赁" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//合同编号
JSONObject DPflowHtid = new JSONObject();
DPflowHtid.put("fieldId", "7006319403");
if (flowHtid != null) {
DPflowHtid.put("fieldValue", flowHtid);
}
DPflowHtid.put("docId", doc);
//合同编号
JSONObject DPflowHtid1 = new JSONObject();
DPflowHtid1.put("fieldId", "2367324344");
if (flowHtid != null) {
DPflowHtid1.put("fieldValue", flowHtid);
}
DPflowHtid1.put("docId", doc);
//合同编号
JSONObject DPflowWcsdate = new JSONObject();
DPflowWcsdate.put("fieldId", "5995296570");
if (flowWcsdate != null) {
DPflowWcsdate.put("fieldValue", flowWcsdate);
}
DPflowWcsdate.put("docId", doc);
//合同编号
JSONObject DPflowWcedate = new JSONObject();
DPflowWcedate.put("fieldId", "1102636496");
if (flowWcedate != null) {
DPflowWcedate.put("fieldValue", flowWcedate);
}
DPflowWcedate.put("docId", doc);
//合同编号
JSONObject DPflowSigndate = new JSONObject();
DPflowSigndate.put("fieldId", "0439952210");
if (flowSigndate != null) {
DPflowSigndate.put("fieldValue", flowSigndate);
}
DPflowSigndate.put("docId", doc);
sizejsonarray.add(DPflowHtid);
sizejsonarray.add(DPflowHtid1);
sizejsonarray.add(DPflowWcsdate);
sizejsonarray.add(DPflowWcedate);
sizejsonarray.add(DPflowSigndate);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
logger.info("DP租赁写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("DP租赁完成" + signtask);
return "完成";
}
}

View File

@ -0,0 +1,137 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Slf4j
@Async
public class FddControllerJiaShiYuanFuWu {
@PostMapping("/jiashiyuanfuwu")
public void jiashiyuanfuwu(@RequestBody JSONObject signature) throws Exception {
log.info("简道云数据 " + signature);
JSONObject test = signature.getJSONObject("data");
String flow_contractno = test.getString("flow_contractno");
String flow_jname = test.getString("flow_jname");
String flow_jid = test.getString("flow_jid");
String flow_jphoneno = test.getString("flow_jphoneno");
String flow_yname = test.getString("flow_yname");
String flow_yid = test.getString("flow_yid");
String flow_yphoneno = test.getString("flow_yphoneno");
String flow_leixing = test.getString("flow_leixing");
if (flow_leixing.equals("驾驶员")) {
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "银建出租车(北京)安全生产责任书-驾驶员" + "$" + flow_yname + "$" + flow_contractno);
initiator.put("signTemplateId", "1737352150377183454");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flow_yname != null) {
actorlist.put("actorName", flow_yname);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flow_yname != null) actorlist.put("identNameForMatch", flow_yname);
actorlist.put("certType", "id_card");
if (flow_yid != null) actorlist.put("certNoForMatch", flow_yid);
if (flow_yphoneno != null) {
actorlist.put("notifyAddress", flow_yphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1737352150377183454");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonArray.add(actor);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
log.info("服务协议" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//甲方联系电话
JSONObject ldflowPaphoneno = new JSONObject();
ldflowPaphoneno.put("fieldId", "5096439064");
if (flow_jname != null) {
ldflowPaphoneno.put("fieldValue", flow_jname);
}
ldflowPaphoneno.put("docId", doc);
sizejsonarray.add(ldflowPaphoneno);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
log.info("劳动写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
log.info("服务协议完成" + signtask);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,380 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class
FddControllerTY {
Logger logger = LoggerFactory.getLogger(getClass());
@PostMapping("/ty")
public String xuqian(@RequestBody JSONObject signature) throws Exception {
logger.info(signature.toJSONString());
JSONObject data = signature.getJSONObject("data");
//字段
String flow_pbphoneno = data.getString("flow_pbphoneno"); //乙方联系电话
String flow2ndphoneno = data.getString("flow_2ndphoneno");//对班手机号
String flowPbid = data.getString("flow_pbid"); //乙方身份证号
String flow2ndpbid = data.getString("flow_2ndpbid");//对班身份号码
String flowName = data.getString("flow_name"); //乙方姓名
String flow2ndname = data.getString("flow_2ndname");//对班姓名
String province = data.getJSONObject("flow_pbaddress").getString("province");//乙方户籍地址 JSON
String city = data.getJSONObject("flow_pbaddress").getString("city");
String district = data.getJSONObject("flow_pbaddress").getString("district");
String detail = data.getJSONObject("flow_pbaddress").getString("detail");
String flowpbaddress = province + city + district + detail;
String province9 = data.getJSONObject("flow_2ndpbaddress").getString("province");//对班户口簿住址
String city9 = data.getJSONObject("flow_2ndpbaddress").getString("city");
String district9 = data.getJSONObject("flow_2ndpbaddress").getString("district");
String detail9 = data.getJSONObject("flow_2ndpbaddress").getString("detail");
String flowpbaddress1 = province9 + city9 + district9 + detail9;
// String flowPresentaddress = data.getString("flow_presentaddress");
String city1 = data.getJSONObject("flow_presentaddress").getString("city"); //乙方现居住地址 JSON
String district1 = data.getJSONObject("flow_presentaddress").getString("district");
String detail1 = data.getJSONObject("flow_presentaddress").getString("detail");
String province1 = data.getJSONObject("flow_presentaddress").getString("province");
String flowPresentaddress = province1+city1 + district1 + detail1;
String city8 = data.getJSONObject("flow_2ndpreaddress").getString("city"); //乙方现居住地址 JSON
String district8 = data.getJSONObject("flow_2ndpreaddress").getString("district");
String detail8 = data.getJSONObject("flow_2ndpreaddress").getString("detail");
String province8 = data.getJSONObject("flow_2ndpreaddress").getString("province");
String flowPresentaddress1 = province8+city8 + district8 + detail8 ;
String flowLsdate = data.getString("flow_lsdate"); //劳动合同开始日期
String flow2ndlsdate = data.getString("flow_2ndlsdate");//对班劳动合同开始日期
String flowLedate = data.getString("flow_ledate"); //劳动合同终止日期
String flow2ndledate = data.getString("flow_2ndledate");//对班劳动合同终止日期
String flowContractno = data.getString("flow_contractno"); //合同编号
String flow2ndcontractno = data.getString("flow_2ndcontractno");//合同编号对班
String flowQcno = data.getString("flow_qcno");//乙方从业资格证号
String flow2ndqcno = data.getString("flow_2ndqcno");//乙方从业资格证号对班
String flowPlateno = data.getString("flow_plateno");//车牌号
String flowBmodel = data.getString("flow_shortname"); //品牌型号
String flowEngineno = data.getString("flow_engineno"); //车辆识别代号
String flowSdisplay = data.getString("flow_sdisplay"); //人数
String flowWcsdate = data.getString("flow_wcsdate"); //承包合同开始日期
String flowWcedate = data.getString("flow_wcedate"); //承包合同终止日期
Double flowContractfee = data.getDouble("flow_contractfee"); //承包金
Double flow2ndcontractfee = data.getDouble("flow_2ndcontractfee");//承包金对班
String flowEmcontact = data.getString("flow_emcontact"); //紧急联系人姓名
String flow2ndemcontact = data.getString("flow_2ndemcontact");//紧急联系人姓名对班
String flowEmcontactid = data.getString("flow_emcontactid"); //紧急联系人身份证号
String flow2ndemcontactid = data.getString("flow_2ndemcontactid");//紧急联系人身份证号对班
String flowRelation = data.getString("flow_relation"); //关系
String flow2ndrelation = data.getString("flow_2ndrelation");//关系对班
String flowEcphone = data.getString("flow_ecphone"); //紧急联系人电话
String flow2ndecphone = data.getString("flow_2ndecphone");//紧急联系人电话对班
// String flowEcadress = data.getString("flow_ecadress");
String city2 = data.getJSONObject("flow_ecadress").getString("city"); //紧急联系人住址 JSON
String district2 = data.getJSONObject("flow_ecadress").getString("district");
String detail2 = data.getJSONObject("flow_ecadress").getString("detail");
String province2 = data.getJSONObject("flow_ecadress").getString("province");
String flowEcadress = province2+city2 + district2 + detail2;
String city5 = data.getJSONObject("flow_2ndecaddress").getString("city"); //紧急联系人住址 JSON 对班
String district5 = data.getJSONObject("flow_2ndecaddress").getString("district");
String detail5 = data.getJSONObject("flow_2ndecaddress").getString("detail");
String province5 = data.getJSONObject("flow_2ndecaddress").getString("province");
String flowEcadress1 = province5+city5 + district5 + detail5;
String flowRegdate = data.getString("flow_regdate"); //注册登记日期
Double flowReceived = data.getDouble("flow_received"); //实收金额
Double flowUnpaid = data.getDouble("flow_unpaid"); //未缴金额
Double flow1stmonth = data.getDouble("flow_1stmonth"); //第一个月金额
Double flow2ndmonth = data.getDouble("flow_2ndmonth"); //第二个月金额
Double flow3rdmonth = data.getDouble("flow_3rdmonth"); //第三个月金额
Double flow4thmonth = data.getDouble("flow_4thmonth"); //第四个月金额
Double flow5thmonth = data.getDouble("flow_5thmonth"); //第五个月金额
Double flowSubsidy = data.getDouble("flow_subsidy");//岗位补贴
Double flow2ndsubsidy = data.getDouble("flow_2ndsubsidy");//岗位补贴对班
Double flowDsdfexpense = data.getDouble("flow_dsdfexpense");//代收代付费用
Double flow2nddsdfexp = data.getDouble("flow_2nddsdfexp");//代收代付费用对班
Double flowSocialpf = data.getDouble("flow_socialpf");//社保个人费额
Double flow2ndsocialpf = data.getDouble("flow_2ndsocialpf");//社保个人费额对班
Double flowNetpayable = data.getDouble("flow_netpayable");//应交净额
Double flow2ndnetpayable = data.getDouble("flow_2ndnetpayable");//应交净额对班
Double flowFyjcxdiscount = data.getDouble("flow_fyjcxdiscount");//非银建参险优惠
Double flow2ndfyjcxdisc = data.getDouble("flow_2ndfyjcxdisc");//非银建参险优惠对班
Double flowTempsubsidy = data.getDouble("flow_tempsubsidy");//临时性补贴金额
String flowFyjcxremark = data.getString("flow_fyjcxremark");//非银建参险备注1
String flowTempsubsidy1 = data.getString("flow_tempsubsidy1");//临时性补贴1
Double flow1stmpayment = data.getDouble("flow_1stmpayment");//首月承包金
Double flow2nd1mpayment = data.getDouble("flow_2nd1mpayment");//首月承包金对班
String flowOperationdp = data.getString("flow_operationdp");//营运日期打印
String flowCbenddp = data.getString("flow_cbenddp");//参保终止日期打印
String flowAfteredp = data.getString("flow_afteredp");//参保终止后一日打印
Double flowCbtempsub = data.getDouble("flow_cbtempsub");//临时性补贴金额(含参保)
Double flowDjnetcfee = data.getDouble("flow_djnetcfee");//趸交净承包金
Double flowDjtotalfee = data.getDouble("flow_djtotalfee");//趸交总金额
Double flowTotalfuel = data.getDouble("flow_totalfuel");//燃料补贴合计
Double flowFuelnetpayable = data.getDouble("flow_fuelnetpayable");//应交净额-燃油车
Double flowTempfuelsub = data.getDouble("flow_tempfuelsub");//临时性补贴金额-燃油
String flowFyjcxremark2 = data.getString("flow_fyjcxremark2");//非银建参险备注2
Double flowStandardfee = data.getDouble("flow_standardfee");//应收预收承包金标准
Double flow2ndstandardfee = data.getDouble("flow_2ndstandardfee");//应收预收承包金标准对班
String flowBranch = data.getString("flow_branch");//分司
String flowNewlsdate = data.getString("flow_newlsdate");//新劳动开始日期打印
String flowNewledate = data.getString("flow_newledate");//新劳动终止日期打印
String flowLsdate1 = data.getString("flow_lsdate");//劳动开始日期打印
String flowReletdate = data.getString("flow_reletdate");//续租日期打印
String flowNewosdate = data.getString("flow_newosdate");//新运营开始日期打印
String flowNewoedate = data.getString("flow_newoedate");//新运营终止日期打印
String flowOsdate = data.getString("flow_osdate");//运营开始日期打印
String flowRegdatep = data.getString("flow_regdatep");//注册登记日期打印
String flowNetreceivable = data.getString("flow_netreceivable");//应收净额
Double flowTempsub = data.getDouble("flow_tempsub");//临时性补贴
Double flowTempsub1 = data.getDouble("flow_tempsub1");//临时性补贴1
String flowBrand = data.getString("flow_brand");//车辆品牌
String flowModel = data.getString("flow_model");//车辆型号
String flowDxcontractfee = data.getString("flow_dxcontractfee");//对班承包金大写
String flowDepartment = data.getString("flow_department");//所属部门-辅助
String flowPlan = data.getString("flow_plan");//单班/双班
String flowTopic = data.getString("flow_topic"); //标题
String flowAgentn = data.getString("flow_agentn");//代签人姓名-辅助
String flowAgentph = data.getString("flow_agentph");//代签人电话-辅助
String flowAgentid = data.getString("flow_agentid");//代签人身份证号-辅助
String flowLcontract = data.getString("flow_lcontract");//劳动合同打印请求-辅助
String flowWcontract = data.getString("flow_wcontract");//承包合同打印请求-辅助
String flowAgreement = data.getString("flow_agreement");//补充协议打印请求-辅助
String flowCletter = data.getString("flow_cletter");//变更书打印请求-辅助
/*
劳动合同续签书(新版)
*/
if ( flowDepartment.equals("银建") && flowLcontract.equals("劳动合同续签书(新版") && flowPlan.equals("单班")) {
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "a825f8de90314255a52c01364fab64bd");
initiator.put("initiator", openid);
if (flowTopic != null) {
initiator.put("signTaskSubject", flowTopic);
}
initiator.put("signTemplateId", "1704880841335165412");
initiator.put("businessId", "d9fc06c633be2b06b41bb5c3ba4874d6");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flowName != null) {
actorlist.put("actorName", flowName);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flowName != null) {
actorlist.put("identNameForMatch", flowName);
}
actorlist.put("certType", "id_card");
if (flowPbid != null) {
actorlist.put("certNoForMatch", flowPbid);
}
if (flow_pbphoneno != null) {
actorlist.put("notifyAddress", flow_pbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "参与方1");
actorlists.put("actorType", "corp");
if (flowDepartment != null) {
actorlists.put("actorName", flowDepartment);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
actorlists.put("actorOpenId", "a825f8de90314255a52c01364fab64bd");
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("fieldDocId", "73157873");
jsonObject2.put("sealId", 1704289212889193190l);
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
//代理人
JSONObject actorsproxy = new JSONObject();
//代理人详细信息
JSONObject actorsproxylist = new JSONObject();
actorsproxylist.put("actorId", "代理人");
actorsproxylist.put("actorType", "person");
if(flowAgentn != null) {
actorsproxylist.put("actorName", flowAgentn);
}
JSONArray actorsproxylistpermissions = new JSONArray();
actorsproxylistpermissions.add("sign");
actorsproxylist.put("identNameForMatch", flowAgentn);
actorsproxylist.put("certType", "id_card");
if (flowAgentid != null) {
actorsproxylist.put("certNoForMatch", flowAgentid);
}
if (flowAgentph != null) {
actorsproxylist.put("notifyAddress", flowAgentph);
}
JSONArray notifyTypeactorsproxylist = new JSONArray();
notifyTypeactorsproxylist.add("start");
notifyTypeactorsproxylist.add("finish");
actorsproxylist.put("notifyType", notifyTypeactorsproxylist);
actorsproxylist.put("permissions", actorsproxylistpermissions);
actorsproxy.put("actor", actorsproxylist);
jsonArray.add(actor);
jsonArray.add(actors);
jsonArray.add(actorsproxy);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("劳动" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//乙方姓名1
JSONObject ldflowName = new JSONObject();
ldflowName.put("fieldId", "3982518788");
if (flowName != null) {
ldflowName.put("fieldValue", flowName);
}
ldflowName.put("docId", "73157873");
//乙方姓名
JSONObject ldflowName1 = new JSONObject();
ldflowName1.put("fieldId", "3117332022");
if (flowName != null) {
ldflowName1.put("fieldValue", flowName);
}
ldflowName1.put("docId", "73157873");
//乙方身份证号
JSONObject ldflowPbid = new JSONObject();
ldflowPbid.put("fieldId", "2184861742");
if (flowName != null) {
ldflowPbid.put("fieldValue", flowPbid);
}
ldflowPbid.put("docId", "73157873");
//乙方户籍地址
JSONObject ldflowpbaddress = new JSONObject();
ldflowpbaddress.put("fieldId", "1637427462");
if (flowpbaddress != null) {
ldflowpbaddress.put("fieldValue", flowpbaddress);
}
ldflowpbaddress.put("docId", "73157873");
//乙方现居住地址
JSONObject ldflowPresentaddress = new JSONObject();
ldflowPresentaddress.put("fieldId", "4908666081");
if (flowPresentaddress != null) {
ldflowPresentaddress.put("fieldValue", flowPresentaddress);
}
ldflowPresentaddress.put("docId", "73157873");
//乙方联系电话
JSONObject ldflow_pbphoneno = new JSONObject();
ldflow_pbphoneno.put("fieldId", "0350599957");
if (flow_pbphoneno != null) {
ldflow_pbphoneno.put("fieldValue", flow_pbphoneno);
}
ldflow_pbphoneno.put("docId", "73157873");
//劳动合同开始日期
JSONObject ldflowLsdate = new JSONObject();
ldflowLsdate.put("fieldId", "1523244579");
if (flowLsdate != null) {
ldflowLsdate.put("fieldValue", flowLsdate);
}
ldflowLsdate.put("docId", "73157873");
//劳动合同终止日期
JSONObject ldflowLedate = new JSONObject();
ldflowLedate.put("fieldId", "4919598971");
if (flowLedate != null) {
ldflowLedate.put("fieldValue", flowLedate);
}
ldflowLedate.put("docId", "73157873");
sizejsonarray.add(ldflowName);
sizejsonarray.add(ldflowName1);
sizejsonarray.add(ldflowPbid);
sizejsonarray.add(ldflowpbaddress);
sizejsonarray.add(ldflowPresentaddress);
sizejsonarray.add(ldflow_pbphoneno);
sizejsonarray.add(ldflowLsdate);
sizejsonarray.add(ldflowLedate);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
logger.info("劳动写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("劳动完成" + signtask);
}
return "";
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,115 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FddCryptUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@RestController
@Slf4j
public class FddHuiDiao {
@RequestMapping(value = "/v5",method = RequestMethod.POST)
@ResponseBody
public String v5(@RequestParam Map<String, String> map,
HttpServletRequest request) throws Exception {
System.out.println("----进入v5回调进来了");
Enumeration<String> headerNames = request.getHeaderNames();
log.info("请求头信息:");
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
//根据名称获取请求头的值
String value = request.getHeader(name);
System.out.println(name+"---"+value);
log.info(name+"---"+value);
}
String event = request.getHeader("x-fasc-event");
System.out.println("参数标记:"+event);
String sign = request.getHeader("x-fasc-sign");
String header = request.getHeader("x-fasc-event");
System.out.println("参数标记1:"+header);
System.out.println("摘要sign:"+sign);
System.out.println("----上面是请求头参数");
map.forEach((k, v) -> {
System.out.println(k + ":" + v);
});
//appSecret 业务一应用<AppId, AppSecret>对中的秘钥AppSecret
String appSecret = "";
//参与签名计算的Key-Value列表
Map<String, String> paramMap = new HashMap<>();
paramMap.put("X-FASC-App-Id", request.getHeader("x-fasc-app-id"));
paramMap.put("X-FASC-Sign-Type", request.getHeader("x-fasc-sign-type"));
paramMap.put("X-FASC-Timestamp", request.getHeader("x-fasc-timestamp"));
paramMap.put("X-FASC-Nonce", request.getHeader("x-fasc-nonce"));
paramMap.put("X-FASC-Event", request.getHeader("x-fasc-event"));
paramMap.put("bizContent", map.get("bizContent").trim());
if(map.get("bizContent").trim().equals(map.get("bizContent"))){
System.out.println("没有空格");
}else{
System.out.println("有空格");
}
String paramToSignStr = FddCryptUtil.sortParameters(paramMap);
log.info("paramToSignStr:"+paramToSignStr);
//计算之后得到签名 该签名需要放到请求头
String signature = FddCryptUtil.sign(paramToSignStr, request.getHeader("x-fasc-timestamp"), appSecret);
System.out.println("test:"+signature);
log.info("test:"+signature);
if(header != null && !header.equals("")){
if(sign.equals(signature) && !sign.equals("")&& sign != null){
System.out.println("摘要正确");
log.info("摘要正确");
Map json = JSONObject.parseObject(map.get("bizContent"),Map.class);
if("user-authorize".equals(header)){
log.info("个人用户授权事件回调通知");
System.out.println("----------------");
}
if("sign-task-finished".equals(header)){
log.info("签署任务完成事件");
System.out.println("-----------");
}
}else{
log.info("摘要不对,不计入。传入摘要:"+sign);
log.info("摘要不对,不计入。计算摘要:"+signature);
System.out.println("摘要不对,不计入");
}
}
// JSONObject jsonObject = new JSONObject();
//
// jsonObject.put("msg","success");
return "success";
}
}

View File

@ -0,0 +1,145 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.FuWuuUil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class FuWuController {
static Logger logger = LoggerFactory.getLogger(FuWuController.class);
public static void main(String[] args) throws Exception {
int qpsLimit = 99; // 设置QPS限制
JSONObject jsonObject123 = new JSONObject();
jsonObject123.put("app_id", "628eeaace7f28c00089a60cc");
jsonObject123.put("entry_id", "65dd4d4cf3f99beb95f2b7e9");
jsonObject123.put("limit", "1000000");
String jsonString123 = jsonObject123.toJSONString();
String select = FuWuuUil.select(jsonString123);
JSONObject jsonObject1458 = JSON.parseObject(select);
String data = jsonObject1458.getString("data");
JSONArray jsonArray147 = JSON.parseArray(data);
int size = jsonArray147.size();
long interval = size / qpsLimit; // 计算每个请求之间的时间间隔(毫秒)
for (Object o :jsonArray147 ) { // 假设有1000次请求
JSONObject test = (JSONObject) o;
String htlx = test.getString("htlx");
String shoujihao = test.getString("shoujihao");
String shenfenhaoma = test.getString("shenfenhaoma");
String xingming = test.getString("xingming");
String hetongbianhao = test.getString("hetongbianhao");
long startTime = System.currentTimeMillis(); // 记录请求开始时间
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", htlx + "$" + xingming + "$" + hetongbianhao);
initiator.put("signTemplateId", "1709000493259133120");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (shenfenhaoma != null) {
actorlist.put("actorName", shenfenhaoma);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (xingming != null) actorlist.put("identNameForMatch", xingming);
actorlist.put("certType", "id_card");
if (shenfenhaoma != null) actorlist.put("certNoForMatch", shenfenhaoma);
if (shoujihao != null) {
actorlist.put("notifyAddress", shoujihao);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
jsonArray.add(actor);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("服务协议" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("服务协议完成" + signtask);
long endTime = System.currentTimeMillis(); // 记录请求结束时间
long elapsedTime = endTime - startTime; // 计算请求处理时间
if (elapsedTime < interval) {
try {
Thread.sleep(interval - elapsedTime); // 线程休眠以控制QPS
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}

View File

@ -0,0 +1,647 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.dao.JiNanYinJianUpdata;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class JiNanYinJianController {
Logger logger = LoggerFactory.getLogger(getClass());
@PostMapping("/jinan")
public String jinanyinjian(@RequestBody JSONObject signature) throws Exception {
logger.info(signature.toJSONString());
JSONObject data = signature.getJSONObject("data");
//字段
String id = data.getString("_id");//甲方名称1
String contract_num = data.getString("contract_num");//甲方名称1
String company_name = data.getString("company_name");//甲方名称1
String per_name = data.getString("per_name");//社会信用代码
String per_num = data.getString("per_num");//法人
String per_sex = data.getString("per_sex");//住所
String per_phone = data.getString("per_phone");//乙方姓名1
String cert_num = data.getString("cert_num");//身份号码
String per_id = data.getString("per_id");//户籍地址
String driver_license_firstdate = data.getString("driver_license_firstdate");//通讯地址
String home_addr = data.getString("home_addr");//联系电话
String d_per_num = data.getString("d_per_num");//承包合同开始日期
String d_per_phone = data.getString("d_per_phone");//承包合同终止日期
String d_home_addr = data.getString("d_home_addr");//车牌号
String lease_date_in = data.getString("lease_date_in");//承包金标准
String lease_date_out = data.getString("lease_date_out");//开户银行名称
String signed_date = data.getString("signed_date");//开户银行账号
String car_num = data.getString("car_num");//是否趸交
String car_color = data.getString("car_color");//是否收取履约服务费
String car_engine = data.getString("car_engine");//趸交说明
String car_frame = data.getString("car_frame");//联系电话
String car_model = data.getString("car_model");//承包合同开始日期
String car_register_date = data.getString("car_register_date");//承包合同终止日期
String text_cash_pledge_norm = data.getString("text_cash_pledge_norm");//车牌号
String text_contract_penalty1 = data.getString("text_contract_penalty1");//承包金标准
String text_contract_penalty2 = data.getString("text_contract_penalty2");//开户银行名称
String lease_limit = data.getString("lease_limit");//开户银行账号
String d_per_name = data.getString("d_per_name");//开户银行账号
Integer cash_pledge_norm = data.getInteger("cash_pledge_norm");//保证金
Integer per_rent = data.getInteger("per_rent");//服务费
Integer insurance_amount = data.getInteger("insurance_amount");//保证金
Integer contract_penalty1 = data.getInteger("contract_penalty1");//服务费
Integer contract_penalty2 = data.getInteger("contract_penalty2");//保证金
/*
dpj济南合同
*/
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "汽车租赁合同" + "$" + per_name + "$" + contract_num);
initiator.put("signTemplateId", "1737514827381172269");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (per_name != null) {
actorlist.put("actorName", per_name);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (per_name != null) {
actorlist.put("identNameForMatch", per_name);
}
actorlist.put("certType", "id_card");
if (per_num != null) {
actorlist.put("certNoForMatch", per_num);
}
if (per_phone != null) {
actorlist.put("notifyAddress", per_phone);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "参与方1");
actorlists.put("actorType", "corp");
if (company_name != null) {
actorlists.put("actorName", company_name);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (company_name != null) {
actorlists.put("actorOpenId", "aa6b91c45ece4fb9b712c6176a6eea32");
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1737514827381172269");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
jsonObject2.put("sealId", 1736496811210163145l);
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
//代理人
JSONObject actorsproxy = new JSONObject();
//代理人详细信息
JSONObject actorsproxylist = new JSONObject();
actorsproxylist.put("actorId", "担保人");
actorsproxylist.put("actorType", "person");
if (d_per_name != null) {
actorsproxylist.put("actorName", d_per_name);
}
JSONArray actorsproxylistpermissions = new JSONArray();
actorsproxylistpermissions.add("sign");
actorsproxylist.put("identNameForMatch", d_per_name);
actorsproxylist.put("certType", "id_card");
if (d_per_num != null) {
actorsproxylist.put("certNoForMatch", d_per_num);
}
if (d_per_phone != null) {
actorsproxylist.put("notifyAddress", d_per_phone);
}
JSONArray notifyTypeactorsproxylist = new JSONArray();
notifyTypeactorsproxylist.add("start");
notifyTypeactorsproxylist.add("finish");
actorsproxylist.put("notifyType", notifyTypeactorsproxylist);
actorsproxylist.put("permissions", actorsproxylistpermissions);
actorsproxy.put("actor", actorsproxylist);
jsonArray.add(actor);
jsonArray.add(actors);
jsonArray.add(actorsproxy);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("济南银建" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//甲方名称1
JSONObject company_name1 = new JSONObject();
company_name1.put("fieldId", "5755834810");
if (company_name != null) {
company_name1.put("fieldValue", company_name);
}
company_name1.put("docId", doc);
//社会信用代码
JSONObject company_name2 = new JSONObject();
company_name2.put("fieldId", "5045426716");
if (company_name != null) {
company_name2.put("fieldValue", company_name);
}
company_name2.put("docId", doc);
//法人
JSONObject per_name1 = new JSONObject();
per_name1.put("fieldId", "3071399848");
if (per_name != null) {
per_name1.put("fieldValue", per_name);
}
per_name1.put("docId", doc);
//住所
JSONObject per_name2 = new JSONObject();
per_name2.put("fieldId", "1835588809");
if (per_name != null) {
per_name2.put("fieldValue", per_name);
}
per_name2.put("docId", doc);
//通讯地址
JSONObject per_num1 = new JSONObject();
per_num1.put("fieldId", "6555589534");
if (per_num != null) {
per_num1.put("fieldValue", per_num);
}
per_num1.put("docId", doc);
//乙方姓名1
JSONObject per_num2 = new JSONObject();
per_num2.put("fieldId", "7750332736");
if (per_num != null) {
per_num2.put("fieldValue", per_num);
}
per_num2.put("docId", doc);
//身份号码
JSONObject per_sex1 = new JSONObject();
per_sex1.put("fieldId", "3907302783");
if (per_sex != null) {
per_sex1.put("fieldValue", per_sex);
}
per_sex1.put("docId", doc);
//户籍地址
JSONObject per_phone1 = new JSONObject();
per_phone1.put("fieldId", "0333753228");
if (per_phone != null) {
per_phone1.put("fieldValue", per_phone);
}
per_phone1.put("docId", doc);
//通讯地址
JSONObject per_phone2 = new JSONObject();
per_phone2.put("fieldId", "6943225084");
if (per_phone != null) {
per_phone2.put("fieldValue", per_phone);
}
per_phone2.put("docId", doc);
//联系电话
JSONObject cert_num1 = new JSONObject();
cert_num1.put("fieldId", "3660575167");
if (cert_num != null) {
cert_num1.put("fieldValue", cert_num);
}
cert_num1.put("docId", doc);
//承包合同开始日期
JSONObject per_id1 = new JSONObject();
per_id1.put("fieldId", "1449935238");
if (per_id != null) {
per_id1.put("fieldValue", per_id);
}
per_id1.put("docId", doc);
//承包合同终止日期
JSONObject driver_license_firstdate1 = new JSONObject();
driver_license_firstdate1.put("fieldId", "9215835730");
if (driver_license_firstdate != null) {
driver_license_firstdate1.put("fieldValue", driver_license_firstdate);
}
driver_license_firstdate1.put("docId", doc);
//承包金标准
JSONObject home_addr1 = new JSONObject();
home_addr1.put("fieldId", "2868224526");
if (home_addr != null) {
home_addr1.put("fieldValue", home_addr);
}
home_addr1.put("docId", doc);
//保证金
JSONObject d_per_num1 = new JSONObject();
d_per_num1.put("fieldId", "2112242233");
if (d_per_num != null) {
d_per_num1.put("fieldValue", d_per_num);
}
d_per_num1.put("docId", doc);
//合同签订日期1
JSONObject d_per_phone1 = new JSONObject();
d_per_phone1.put("fieldId", "2306191308");
if (d_per_phone != null) {
d_per_phone1.put("fieldValue", d_per_phone);
}
d_per_phone1.put("docId", doc);
//合同签订日期2
JSONObject d_home_addr1 = new JSONObject();
d_home_addr1.put("fieldId", "6313748633");
if (d_home_addr != null) {
d_home_addr1.put("fieldValue", d_home_addr);
}
d_home_addr1.put("docId", doc);
//签订日期
JSONObject lease_date_in1 = new JSONObject();
lease_date_in1.put("fieldId", "2964883270");
if (lease_date_in != null) {
lease_date_in1.put("fieldValue", lease_date_in);
}
lease_date_in1.put("docId", doc);
//合同签订日期3
JSONObject lease_date_in2 = new JSONObject();
lease_date_in2.put("fieldId", "3454720784");
if (lease_date_in != null) {
lease_date_in2.put("fieldValue", lease_date_in);
}
lease_date_in2.put("docId", doc);
//合同签订日期4
JSONObject lease_date_out1 = new JSONObject();
lease_date_out1.put("fieldId", "4610533288");
if (lease_date_out != null) {
lease_date_out1.put("fieldValue", lease_date_out);
}
lease_date_out1.put("docId", doc);
//甲方
JSONObject signed_date1 = new JSONObject();
signed_date1.put("fieldId", "3098649737");
if (signed_date != null) {
signed_date1.put("fieldValue", signed_date);
}
signed_date1.put("docId", doc);
//甲方
JSONObject signed_date2 = new JSONObject();
signed_date2.put("fieldId", "6602962453");
if (signed_date != null) {
signed_date2.put("fieldValue", signed_date);
}
signed_date2.put("docId", doc);
//车牌号
JSONObject signed_date3 = new JSONObject();
signed_date3.put("fieldId", "0903990574");
if (signed_date != null) {
signed_date3.put("fieldValue", signed_date);
}
signed_date3.put("docId", doc);
//准缴优惠
JSONObject signed_date4 = new JSONObject();
signed_date4.put("fieldId", "6050132953");
if (signed_date != null) {
signed_date4.put("fieldValue", signed_date);
}
signed_date4.put("docId", doc);
//首月租车费用
JSONObject car_num1 = new JSONObject();
car_num1.put("fieldId", "4630656779");
if (car_num != null) {
car_num1.put("fieldValue", car_num);
}
car_num1.put("docId", doc);
//首月租车费用
JSONObject car_num2 = new JSONObject();
car_num2.put("fieldId", "2397539297");
if (car_num != null) {
car_num2.put("fieldValue", car_num);
}
car_num2.put("docId", doc);
//-------------------------------------------------------------------------------------------------------------
//首月租车费用
JSONObject car_color1 = new JSONObject();
car_color1.put("fieldId", "2572395994");
if (car_color != null) {
car_color1.put("fieldValue", car_color);
}
car_color1.put("docId", doc);
//首月租车费用
JSONObject car_engine1 = new JSONObject();
car_engine1.put("fieldId", "7049655343");
if (car_engine != null) {
car_engine1.put("fieldValue", car_engine);
}
car_engine1.put("docId", doc);
//首月租车费用
JSONObject car_frame1 = new JSONObject();
car_frame1.put("fieldId", "2898149272");
if (car_frame != null) {
car_frame1.put("fieldValue", car_frame);
}
car_frame1.put("docId", doc);
//首月租车费用
JSONObject car_model1 = new JSONObject();
car_model1.put("fieldId", "1650547250");
if (car_model != null) {
car_model1.put("fieldValue", car_model);
}
car_model1.put("docId", doc);
//首月租车费用
JSONObject car_register_date1 = new JSONObject();
car_register_date1.put("fieldId", "1081642210");
if (car_register_date != null) {
car_register_date1.put("fieldValue", car_register_date);
}
car_register_date1.put("docId", doc);
//首月租车费用
JSONObject cash_pledge_norm1 = new JSONObject();
cash_pledge_norm1.put("fieldId", "2267943318");
if (cash_pledge_norm != null) {
cash_pledge_norm1.put("fieldValue", cash_pledge_norm);
}
cash_pledge_norm1.put("docId", doc);
//首月租车费用
JSONObject per_rent1 = new JSONObject();
per_rent1.put("fieldId", "4402648346");
if (per_rent != null) {
per_rent1.put("fieldValue", per_rent);
}
per_rent1.put("docId", doc);
//首月租车费用
JSONObject insurance_amount1 = new JSONObject();
insurance_amount1.put("fieldId", "2107387102");
if (insurance_amount != null) {
insurance_amount1.put("fieldValue", insurance_amount);
}
insurance_amount1.put("docId", doc);
//首月租车费用
JSONObject contract_penalty11 = new JSONObject();
contract_penalty11.put("fieldId", "7327671063");
if (contract_penalty1 != null) {
contract_penalty11.put("fieldValue", contract_penalty1);
}
contract_penalty11.put("docId", doc);
//首月租车费用
JSONObject contract_penalty21 = new JSONObject();
contract_penalty21.put("fieldId", "8152999645");
if (contract_penalty2 != null) {
contract_penalty21.put("fieldValue", contract_penalty2);
}
contract_penalty21.put("docId", doc);
//首月租车费用
JSONObject text_cash_pledge_norm1 = new JSONObject();
text_cash_pledge_norm1.put("fieldId", "3097155615");
if (text_cash_pledge_norm != null) {
text_cash_pledge_norm1.put("fieldValue", text_cash_pledge_norm);
}
text_cash_pledge_norm1.put("docId", doc);
//首月租车费用
JSONObject text_contract_penalty11 = new JSONObject();
text_contract_penalty11.put("fieldId", "9701936372");
if (text_contract_penalty1 != null) {
text_contract_penalty11.put("fieldValue", text_contract_penalty1);
}
text_contract_penalty11.put("docId", doc);
//首月租车费用
JSONObject text_contract_penalty21 = new JSONObject();
text_contract_penalty21.put("fieldId", "5639851666");
if (text_contract_penalty2 != null) {
text_contract_penalty21.put("fieldValue", text_contract_penalty2);
}
text_contract_penalty21.put("docId", doc);
//首月租车费用
JSONObject lease_limit1 = new JSONObject();
lease_limit1.put("fieldId", "7326064328");
if (lease_limit != null) {
lease_limit1.put("fieldValue", lease_limit);
}
lease_limit1.put("docId", doc);
//首月租车费用
JSONObject lease_limit2 = new JSONObject();
lease_limit2.put("fieldId", "5284815255");
if (lease_limit != null) {
lease_limit2.put("fieldValue", lease_limit);
}
lease_limit2.put("docId", doc);
//首月租车费用
JSONObject home_addr11 = new JSONObject();
home_addr11.put("fieldId", "7578569287");
if (home_addr != null) {
home_addr11.put("fieldValue", home_addr);
}
home_addr11.put("docId", doc);
sizejsonarray.add(company_name1);
sizejsonarray.add(company_name2);
sizejsonarray.add(per_name1);
sizejsonarray.add(per_name2);
sizejsonarray.add(per_num1);
sizejsonarray.add(per_num2);
sizejsonarray.add(per_sex1);
sizejsonarray.add(per_phone1);
sizejsonarray.add(per_phone2);
sizejsonarray.add(cert_num1);
sizejsonarray.add(per_id1);
sizejsonarray.add(driver_license_firstdate1);
sizejsonarray.add(home_addr1);
sizejsonarray.add(d_per_num1);
sizejsonarray.add(d_per_phone1);
sizejsonarray.add(d_home_addr1);
sizejsonarray.add(lease_date_in1);
sizejsonarray.add(lease_date_in2);
sizejsonarray.add(lease_date_out1);
sizejsonarray.add(signed_date1);
sizejsonarray.add(signed_date2);
sizejsonarray.add(signed_date3);
sizejsonarray.add(signed_date4);
sizejsonarray.add(car_num1);
sizejsonarray.add(car_num2);
sizejsonarray.add(car_color1);
sizejsonarray.add(car_engine1);
sizejsonarray.add(car_frame1);
sizejsonarray.add(car_model1);
sizejsonarray.add(car_register_date1);
sizejsonarray.add(cash_pledge_norm1);
sizejsonarray.add(per_rent1);
sizejsonarray.add(insurance_amount1);
sizejsonarray.add(contract_penalty11);
sizejsonarray.add(contract_penalty21);
sizejsonarray.add(text_cash_pledge_norm1);
sizejsonarray.add(text_contract_penalty11);
sizejsonarray.add(text_contract_penalty21);
sizejsonarray.add(lease_limit1);
sizejsonarray.add(lease_limit2);
sizejsonarray.add(home_addr11);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
logger.info("济南银建写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("济南银建完成" + signtask);
JiNanYinJianUpdata.upid(id,signTaskId);
return "完成啦!!!!!";
}
}

View File

@ -0,0 +1,45 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.dao.JiNanYinJianUpdata;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class JiNanYinJianGetUrl {
Logger logger = LoggerFactory.getLogger(getClass());
@PostMapping("/jinanyinjianurl")
public String jinanyinjian(@RequestBody JSONObject signature) throws Exception {
logger.info(signature.toJSONString());
JSONObject data = signature.getJSONObject("data");
//字段
String id = data.getString("_id");//甲方名称1
String task_id = data.getString("task_id");//甲方名称1
JSONObject jsonObject = new JSONObject();
jsonObject.put("signTaskId", task_id);
String jsonString = jsonObject.toJSONString();
String geturl = FDaDaUtil.geturl(jsonString);
JSONObject jsonObject1 = JSON.parseObject(geturl);
String string = jsonObject1.getJSONObject("data").getString("signTaskPreviewUrl");
if (!string.isEmpty()) {
JiNanYinJianUpdata.upurl(id, string);
} else {
JiNanYinJianUpdata.upurl(id, "(●ˇ∀ˇ●) 驾驶员未签合同或链接已失效 (❤ ω ❤)");
}
return "完成啦!!!!!!!!";
}
}

View File

@ -0,0 +1,184 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.FuWuuUil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Log4j
@Component
public class NewFuWuController {
static Logger logger = LoggerFactory.getLogger(NewFuWuController.class);
public static void main(String[] args) throws Exception {
JSONObject jsonObject123 = new JSONObject();
jsonObject123.put("app_id", "628eeaace7f28c00089a60cc");
jsonObject123.put("entry_id", "678df84087d6def223709ed4");
jsonObject123.put("limit", 10000);
String jsonString123 = jsonObject123.toJSONString();
String select = FuWuuUil.select(jsonString123);
JSONObject jsonObject1458 = JSON.parseObject(select);
String data = jsonObject1458.getString("data");
logger.info("简道云数据 " +data);
JSONArray jsonArray147 = JSON.parseArray(data);
int size = jsonArray147.size();
for (Object o :jsonArray147 ) { // 假设有1000次请求
JSONObject test = (JSONObject) o;
String flow_contractno = test.getString("flow_contractno");
String flow_jname = test.getString("flow_jname");
String flow_jid = test.getString("flow_jid");
String flow_jphoneno = test.getString("flow_jphoneno");
String flow_yname = test.getString("flow_yname");
String flow_yid = test.getString("flow_yid");
String flow_yphoneno = test.getString("flow_yphoneno");
String flow_leixing = test.getString("flow_leixing");
if (flow_leixing.equals("驾驶员")) {
Thread.sleep(500);
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "银建出租车(北京)安全生产责任书-驾驶员" + "$" + flow_yname + "$" + flow_contractno);
initiator.put("signTemplateId", "1737352150377183454");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flow_yname != null) {
actorlist.put("actorName", flow_yname);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flow_yname != null) actorlist.put("identNameForMatch", flow_yname);
actorlist.put("certType", "id_card");
if (flow_yid != null) actorlist.put("certNoForMatch", flow_yid);
if (flow_yphoneno != null) {
actorlist.put("notifyAddress", flow_yphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1737352150377183454");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
/* //代理人
JSONObject actorsproxy = new JSONObject();
//代理人详细信息
JSONObject actorsproxylist = new JSONObject();
actorsproxylist.put("actorId", "甲方");
actorsproxylist.put("actorType", "person");
if (flow_jname != null) {
actorsproxylist.put("actorName", flow_jname);
}
JSONArray actorsproxylistpermissions = new JSONArray();
actorsproxylistpermissions.add("sign");
if (flow_jphoneno != null) {
actorsproxylist.put("notifyAddress", flow_jphoneno);
}
JSONArray notifyTypeactorsproxylist = new JSONArray();
notifyTypeactorsproxylist.add("start");
notifyTypeactorsproxylist.add("finish");
actorsproxylist.put("notifyType", notifyTypeactorsproxylist);
actorsproxylist.put("permissions", actorsproxylistpermissions);
actorsproxy.put("actor", actorsproxylist);*/
jsonArray.add(actor);
// jsonArray.add(actorsproxy);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
logger.info("法大大数据 " +jsonString );
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("服务协议" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//甲方联系电话
JSONObject ldflowPaphoneno = new JSONObject();
ldflowPaphoneno.put("fieldId", "5096439064");
if (flow_jname != null) {
ldflowPaphoneno.put("fieldValue", flow_jname);
}
ldflowPaphoneno.put("docId", doc);
sizejsonarray.add(ldflowPaphoneno);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
logger.info("劳动写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("服务协议完成" + signtask);
}
}
}
}

View File

@ -0,0 +1,141 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.FuWuuUil;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Log4j
public class NewaFuWuController {
static Logger logger = LoggerFactory.getLogger(NewaFuWuController.class);
public static void main(String[] args) throws Exception {
JSONObject jsonObject123 = new JSONObject();
jsonObject123.put("app_id", "628eeaace7f28c00089a60cc");
jsonObject123.put("entry_id", "678df84087d6def223709ed4");
jsonObject123.put("limit", 10000);
String jsonString123 = jsonObject123.toJSONString();
String select = FuWuuUil.select(jsonString123);
JSONObject jsonObject1458 = JSON.parseObject(select);
String data = jsonObject1458.getString("data");
logger.info("简道云数据 " +data);
JSONArray jsonArray147 = JSON.parseArray(data);
int size = jsonArray147.size();
for (Object o :jsonArray147 ) { // 假设有1000次请求
JSONObject test = (JSONObject) o;
String flow_contractno = test.getString("flow_contractno");
String flow_jname = test.getString("flow_jname");
String flow_jid = test.getString("flow_jid");
String flow_jphoneno = test.getString("flow_jphoneno");
String flow_yname = test.getString("flow_yname");
String flow_yid = test.getString("flow_yid");
String flow_yphoneno = test.getString("flow_yphoneno");
String flow_leixing = test.getString("flow_leixing");
if (flow_leixing.equals("分司经理")) {
long startTime = System.currentTimeMillis(); // 记录请求开始时间
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "银建出租车(北京)安全生产责任书-分司经理" + "$" + flow_yname + "$" + flow_contractno);
initiator.put("signTemplateId", "1737355745575113607");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flow_yname != null) {
actorlist.put("actorName", flow_yname);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flow_yphoneno != null) {
actorlist.put("notifyAddress", flow_yphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//代理人
JSONObject actorsproxy = new JSONObject();
//代理人详细信息
JSONObject actorsproxylist = new JSONObject();
actorsproxylist.put("actorId", "甲方");
actorsproxylist.put("actorType", "person");
if (flow_jname != null) {
actorsproxylist.put("actorName", flow_jname);
}
JSONArray actorsproxylistpermissions = new JSONArray();
actorsproxylistpermissions.add("sign");
if (flow_jphoneno != null) {
actorsproxylist.put("notifyAddress", flow_jphoneno);
}
JSONArray notifyTypeactorsproxylist = new JSONArray();
notifyTypeactorsproxylist.add("start");
notifyTypeactorsproxylist.add("finish");
actorsproxylist.put("notifyType", notifyTypeactorsproxylist);
actorsproxylist.put("permissions", actorsproxylistpermissions);
actorsproxy.put("actor", actorsproxylist);
jsonArray.add(actor);
jsonArray.add(actorsproxy);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
logger.info("法大大数据 " +jsonString );
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("服务协议" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("服务协议完成" + signtask);
long endTime = System.currentTimeMillis(); // 记录请求结束时间
long elapsedTime = endTime - startTime; // 计算请求处理时间
}
}
}
}

View File

@ -0,0 +1,70 @@
package com.example.sso.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Test1 {
public static void main(String[] args) throws Exception {
Logger logger = LoggerFactory.getLogger(Test1.class);
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "11" + "@@" + "shoujihao" + "@@" + "shenfenhaoma");
initiator.put("signTemplateId", "1709000186853141812");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
actorlist.put("actorName", "shenfenhaoma");
JSONArray permissions = new JSONArray();
permissions.add("sign");
actorlist.put("notifyAddress", "15232585208");
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
jsonArray.add(actor);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("劳动" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("劳动完成" + signtask);
}
}

View File

@ -0,0 +1,51 @@
package com.example.sso.dao;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.TimeUtils;
import org.springframework.util.StringUtils;
public class A {
public static JSONArray jsonArray() throws Exception {
Integer num = Totle.num();
JSONArray jsonArray1 = new JSONArray();
for (int i = 1; i <num+1 ; i++) {
JSONObject jsonObject = new JSONObject();
JSONObject ownerId = new JSONObject();
ownerId.put("idType", "corp");
ownerId.put("openId", "625776ecae6742cb8eb710beedef9b4c");
jsonObject.put("ownerId", ownerId);
JSONObject listFilter = new JSONObject();
listFilter.put("signTaskStatus", "task_finished");
jsonObject.put("listFilter", listFilter);
jsonObject.put("listPageNo",i);
jsonObject.put("listPageSize",100);
String jsonString = jsonObject.toJSONString();
String down = FDaDaUtil.list(jsonString);
JSONObject jsonObject1 = JSON.parseObject(down);
JSONArray jsonArray = jsonObject1.getJSONObject("data").getJSONArray("signTasks");
for (Object o : jsonArray){
JSONObject oo = (JSONObject) o;
String finishTime = oo.getString("finishTime");
String signTaskId = oo.getString("signTaskId");
String signTaskSubject = oo.getString("signTaskSubject");
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("finishTime",finishTime);
jsonObject2.put("signTaskId",signTaskId);
jsonObject2.put("signTaskSubject",signTaskSubject);
jsonArray1.add(jsonObject2);
}
}
return jsonArray1;
}
}

View File

@ -0,0 +1,16 @@
package com.example.sso.dao;
import com.example.sso.util.APIUtils;
import java.util.Map;
public class Files {
public static Map<String, String> test(){
APIUtils api = new APIUtils("628eeaace7f28c00089a60cc", "65a4d762edb3f1bd573b3e4e","BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
Map<String, String> down = api.down();
return down;
}
}

View File

@ -0,0 +1,15 @@
package com.example.sso.dao;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
public class GetUrl {
public static void main(String[] args) throws Exception {
JSONObject jsonObject = new JSONObject();
jsonObject.put("clientCorpId","i");
String jsonString = jsonObject.toJSONString();
String fddurl = FDaDaUtil.fddurl(jsonString);
System.out.println(fddurl);
}
}

View File

@ -0,0 +1,39 @@
package com.example.sso.dao;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.V5utils;
public class JiNanYinJianUpdata {
public static void upid (String id, String ids) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("app_id","6745a634191aba3dc9841f39");
jsonObject.put("entry_id","67580b75a458134eadb544ef");
jsonObject.put("data_id",id);
JSONObject data = new JSONObject();
JSONObject task_id = new JSONObject();
task_id.put("value",ids);
data.put("task_id",task_id);
jsonObject.put("data",data);
String jsonString = jsonObject.toJSONString();
V5utils.updata(jsonString);
}
public static void upurl (String id, String url) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("app_id","6745a634191aba3dc9841f39");
jsonObject.put("entry_id","67aaf03f87d6def223023715");
jsonObject.put("data_id",id);
JSONObject data = new JSONObject();
JSONObject task_id = new JSONObject();
task_id.put("value",url);
data.put("contract_text",task_id);
jsonObject.put("data",data);
String jsonString = jsonObject.toJSONString();
V5utils.updata(jsonString);
}
}

View File

@ -0,0 +1,34 @@
package com.example.sso.dao;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
public class Totle {
public static Integer num() throws Exception {
JSONObject jsonObject = new JSONObject();
JSONObject ownerId = new JSONObject();
ownerId.put("idType", "corp");
ownerId.put("openId", "625776ecae6742cb8eb710beedef9b4c");
jsonObject.put("ownerId", ownerId);
JSONObject listFilter = new JSONObject();
listFilter.put("signTaskStatus", "task_finished");
jsonObject.put("listFilter", listFilter);
String jsonString = jsonObject.toJSONString();
String down = FDaDaUtil.list(jsonString);
JSONObject jsonObject1 = JSON.parseObject(down);
Integer integer = jsonObject1.getJSONObject("data").getInteger("listPageCount");
return integer;
}
public static void main(String[] args) throws Exception {
Integer num = Totle.num();
for (int i = 0; i < num; i++) {
System.out.println(i);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,631 @@
package com.example.sso.newhetong;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.log4j.Log4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Log4j
@Async
public class NewFddControllerXuQian {
@PostMapping("/xuqian1")
public String xuqian(@RequestBody JSONObject signature) throws Exception {
log.info(signature.toJSONString());
JSONObject data = signature.getJSONObject("data");
//字段
String flow_pbphoneno = data.getString("flow_pbphoneno"); //乙方联系电话
String flow2ndphoneno = data.getString("flow_2ndphoneno");//对班手机号
String flowPbid = data.getString("flow_pbid"); //乙方身份证号
String flow2ndpbid = data.getString("flow_2ndpbid");//对班身份号码
String flowName = data.getString("flow_name"); //乙方姓名
String flow2ndname = data.getString("flow_2ndname");//对班姓名
String flowLsdate = data.getString("flow_lsdate"); //劳动合同开始日期
String flow2ndlsdate = data.getString("flow_2ndlsdate");//对班劳动合同开始日期
String flowLedate = data.getString("flow_ledate"); //劳动合同终止日期
String flow2ndledate = data.getString("flow_2ndledate");//对班劳动合同终止日期
String flowContractno = data.getString("flow_contractno"); //合同编号
String flow2ndcontractno = data.getString("flow_2ndcontractno");//合同编号对班
String flowQcno = data.getString("flow_qcno");//乙方从业资格证号
String flow2ndqcno = data.getString("flow_2ndqcno");//乙方从业资格证号对班
String flowPlateno = data.getString("flow_plateno");//车牌号
String flowBmodel = data.getString("flow_shortname"); //品牌型号
String flowEngineno = data.getString("flow_engineno"); //车辆识别代号
String flowSdisplay = data.getString("flow_sdisplay"); //人数
String flowWcsdate = data.getString("flow_wcsdate"); //承包合同开始日期
String flowWcedate = data.getString("flow_wcedate"); //承包合同终止日期
Integer flowContractfee = data.getInteger("flow_contractfee"); //承包金
Integer flow2ndcontractfee = data.getInteger("flow_2ndcontractfee");//承包金对班
String flowEmcontact = data.getString("flow_emcontact"); //紧急联系人姓名
String flow2ndemcontact = data.getString("flow_2ndemcontact");//紧急联系人姓名对班
String flowEmcontactid = data.getString("flow_emcontactid"); //紧急联系人身份证号
String flow2ndemcontactid = data.getString("flow_2ndemcontactid");//紧急联系人身份证号对班
String flowRelation = data.getString("flow_relation"); //关系
String flow2ndrelation = data.getString("flow_2ndrelation");//关系对班
String flowEcphone = data.getString("flow_ecphone"); //紧急联系人电话
String flow2ndecphone = data.getString("flow_2ndecphone");//紧急联系人电话对班
String flow_signsite = data.getString("flow_signsite");//紧急联系人电话对班
// String flowEcadress = data.getString("flow_ecadress");
/* String city2 = data.getJSONObject("flow_ecadress").getString("city"); //紧急联系人住址 JSON
String district2 = data.getJSONObject("flow_ecadress").getString("district");
String detail2 = data.getJSONObject("flow_ecadress").getString("detail");
String province2 = data.getJSONObject("flow_ecadress").getString("province");
String flowEcadress = province2 + city2 + district2 + detail2;*/
/*String city5 = data.getJSONObject("flow_2ndecaddress").getString("city"); //紧急联系人住址 JSON 对班
String district5 = data.getJSONObject("flow_2ndecaddress").getString("district");
String detail5 = data.getJSONObject("flow_2ndecaddress").getString("detail");
String province5 = data.getJSONObject("flow_2ndecaddress").getString("province");
String flowEcadress1 = province5 + city5 + district5 + detail5;*/
String flowRegdate = data.getString("flow_regdate"); //注册登记日期
Integer flowReceived = data.getInteger("flow_received"); //实收金额
Integer flowUnpaid = data.getInteger("flow_unpaid"); //未缴金额
Integer flow1stmonth = data.getInteger("flow_1stmonth"); //第一个月金额
Integer flow2ndmonth = data.getInteger("flow_2ndmonth"); //第二个月金额
Integer flow3rdmonth = data.getInteger("flow_3rdmonth"); //第三个月金额
Integer flow4thmonth = data.getInteger("flow_4thmonth"); //第四个月金额
Integer flow5thmonth = data.getInteger("flow_5thmonth"); //第五个月金额
Integer flowSubsidy = data.getInteger("flow_subsidy");//岗位补贴
Integer flow2ndsubsidy = data.getInteger("flow_2ndsubsidy");//岗位补贴对班
Integer flowDsdfexpense = data.getInteger("flow_dsdfexpense");//代收代付费用
Integer flow2nddsdfexp = data.getInteger("flow_2nddsdfexp");//代收代付费用对班
Integer flowSocialpf = data.getInteger("flow_socialpf");//社保个人费额
Integer flow2ndsocialpf = data.getInteger("flow_2ndsocialpf");//社保个人费额对班
Integer flowNetpayable = data.getInteger("flow_netpayable");//应交净额
Integer flow2ndnetpayable = data.getInteger("flow_2ndnetpayable");//应交净额对班
String flowFyjcxdiscount = data.getString("flow_fyjcxdiscount");//非银建参险优惠
Integer flow2ndfyjcxdisc = data.getInteger("flow_2ndfyjcxdisc");//非银建参险优惠对班
Integer flowTempsubsidy = data.getInteger("flow_tempsubsidy");//临时性补贴金额
String flowFyjcxremark = data.getString("flow_fyjcxremark");//非银建参险备注1
String flowTempsubsidy1 = data.getString("flow_tempsubsidy1");//临时性补贴1
Integer flow1stmpayment = data.getInteger("flow_1stmpayment");//首月承包金
Integer flow2nd1mpayment = data.getInteger("flow_2nd1mpayment");//首月承包金对班
String flowOperationdp = data.getString("flow_operationdp");//营运日期打印
String flowCbenddp = data.getString("flow_cbenddp");//参保终止日期打印
String flowAfteredp = data.getString("flow_afteredp");//参保终止后一日打印
Integer flowCbtempsub = data.getInteger("flow_cbtempsub");//临时性补贴金额(含参保)
Integer flowDjnetcfee = data.getInteger("flow_djnetcfee");//趸交净承包金
Integer flowDjtotalfee = data.getInteger("flow_djtotalfee");//趸交总金额
Integer flowTotalfuel = data.getInteger("flow_totalfuel");//燃料补贴合计
Integer flowFuelnetpayable = data.getInteger("flow_fuelnetpayable");//应交净额-燃油车
Integer flowTempfuelsub = data.getInteger("flow_tempfuelsub");//临时性补贴金额-燃油
String flowFyjcxremark2 = data.getString("flow_fyjcxremark2");//非银建参险备注2
Integer flowStandardfee = data.getInteger("flow_standardfee");//应收预收承包金标准
Integer flow2ndstandardfee = data.getInteger("flow_2ndstandardfee");//应收预收承包金标准对班
String flowBranch = data.getString("flow_branch");//分司
String flowNewlsdate = data.getString("flow_newlsdate");//新劳动开始日期打印
String flow2ndnewlsdate = data.getString("flow_2ndnewlsdate");//对班新劳动开始日期打印
String flowNewledate = data.getString("flow_newledate");//新劳动终止日期打印
String flow2ndnewledate = data.getString("flow_2ndnewledate");//对班新劳动终止日期打印
String flowReletdate = data.getString("flow_reletdate");//续租日期打印
String flowNewosdate = data.getString("flow_newosdate");//新运营开始日期打印
String flowNewoedate = data.getString("flow_newoedate");//新运营终止日期打印
String flowOsdate = data.getString("flow_osdate");//运营开始日期打印
String flowRegdatep = data.getString("flow_regdatep");//注册登记日期打印
String flowNetreceivable = data.getString("flow_netreceivable");//应收净额
Integer flowTempsub = data.getInteger("flow_tempsub");//临时性补贴
String flowTempsub1 = data.getString("flow_tempsub1");//临时性补贴1
String flowBrand = data.getString("flow_brand");//车辆品牌
String flowModel = data.getString("flow_model");//车辆型号
String flowDxcontractfee = data.getString("flow_dxcontractfee");//对班承包金大写
String flow2nddxcontractfee = data.getString("flow_2nddxcontractfee");//对班承包金大写
String flowPaname = data.getString("flow_paname");//甲方名称
String flowRegistrid = data.getString("flow_registrid");//注册号
String flowLegal = data.getString("flow_legal");//法定代表人
String flowSite = data.getString("flow_site");//住所或营业场所
String flowPaphoneno = data.getString("flow_paphoneno");//甲方联系电话
String flowBqcno = data.getString("flow_bqcno");//经营资格证编号
String flowOedate = data.getString("flow_oedate");//运营终止日期打印
String flowPazipcode = data.getString("flow_pazipcode");//甲方邮编
String flowSex = data.getString("flow_sex");//甲方性别
String flowEducation = data.getString("flow_education");//对班文化程度
String flowPbaddress = data.getString("flow_pbaddress");//户口簿地址
String flowPreaddress = data.getString("flow_preaddress");//现地址
String flowStreet = data.getString("flow_street");//对班街道办事处
String flowUnit = data.getString("flow_unit");//对班驾驶员所在单位(离退休前)
String flowDepartment = data.getString("flow_department");//所属部门-辅助
String flowPlan = data.getString("flow_plan");//单班/双班
String flowTopic = data.getString("flow_topic"); //标题
String flowAgentn = data.getString("flow_agentn");//代签人姓名-辅助
String flowAgentph = data.getString("flow_agentph");//代签人电话-辅助
String flowAgentid = data.getString("flow_agentid");//代签人身份证号-辅助
String flowLcontract = data.getString("flow_laborrenew");//劳动合同打印请求-辅助
String flowWcontract = data.getString("flow_contractrenew");//承包合同打印请求-辅助
String flowAgreement = data.getString("flow_agreementrenew");//补充协议打印请求-辅助
String flowCletter = data.getString("flow_cletter");//变更书打印请求-辅助
if (flowLcontract.equals("劳动合同续签书(新版)") && flowPlan.equals("单班")) {
log.info("修改版本");
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "劳动合同续签" + "$" + flowName + "$" + flowContractno);
initiator.put("signTemplateId", "1750389991193114916");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flowName != null) {
actorlist.put("actorName", flowName);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flowName != null) {
actorlist.put("identNameForMatch", flowName);
}
actorlist.put("certType", "id_card");
if (flowPbid != null) {
actorlist.put("certNoForMatch", flowPbid);
}
if (flow_pbphoneno != null) {
actorlist.put("notifyAddress", flow_pbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "参与方1");
actorlists.put("actorType", "corp");
if (flowDepartment != null) {
actorlists.put("actorName", flowDepartment);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (!flowDepartment.equals("银建新能源")) {
actorlists.put("actorOpenId", "625776ecae6742cb8eb710beedef9b4c");
String entryids = FDaDaUtil.entryids(flowPaname);
actorlists.put("actorEntityId", entryids);
} else if (flowDepartment.equals("银建新能源")) {
actorlists.put("actorOpenId", "a0c12949a1c54ff9bfa45dbe957fbc5d");
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1750389991193114916");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
if (flowDepartment.equals("银建")) {
jsonObject2.put("sealId", 1705990704393128941l);
} else if (flowDepartment.equals("金建")) {
jsonObject2.put("sealId", 1705991374867130717l);
} else if (flowDepartment.equals("金银建")) {
jsonObject2.put("sealId", 1705991362754131529l);
} else if (flowDepartment.equals("华建")) {
jsonObject2.put("sealId", 1705991079845184562l);
} else if (flowDepartment.equals("银建新能源")) {
jsonObject2.put("sealId", 1706510414541115296l);
}
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
//代理人
JSONObject actorsproxy = new JSONObject();
//代理人详细信息
JSONObject actorsproxylist = new JSONObject();
actorsproxylist.put("actorId", "代理人");
actorsproxylist.put("actorType", "person");
if (flowAgentn != null) {
actorsproxylist.put("actorName", flowAgentn);
}
JSONArray actorsproxylistpermissions = new JSONArray();
actorsproxylistpermissions.add("sign");
actorsproxylist.put("identNameForMatch", flowAgentn);
actorsproxylist.put("certType", "id_card");
if (flowAgentid != null) {
actorsproxylist.put("certNoForMatch", flowAgentid);
}
if (flowAgentph != null) {
actorsproxylist.put("notifyAddress", flowAgentph);
}
JSONArray notifyTypeactorsproxylist = new JSONArray();
notifyTypeactorsproxylist.add("start");
notifyTypeactorsproxylist.add("finish");
actorsproxylist.put("notifyType", notifyTypeactorsproxylist);
actorsproxylist.put("permissions", actorsproxylistpermissions);
actorsproxy.put("actor", actorsproxylist);
jsonArray.add(actor);
jsonArray.add(actors);
jsonArray.add(actorsproxy);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
log.info(" 劳动合同续签" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//车牌号码
JSONObject ldflowPlateno = new JSONObject();
ldflowPlateno.put("fieldId", "7509555813");
if (flowPlateno != null) {
ldflowPlateno.put("fieldValue", flowPlateno);
}
ldflowPlateno.put("docId", doc);
//新劳动开始日期打印
JSONObject ldflowNewlsdate = new JSONObject();
ldflowNewlsdate.put("fieldId", "1535477127");
if (flowNewlsdate != null) {
ldflowNewlsdate.put("fieldValue", flowNewlsdate);
}
ldflowNewlsdate.put("docId", doc);
//新劳动终止日期打印
JSONObject ldflowNewledate = new JSONObject();
ldflowNewledate.put("fieldId", "0918401694");
if (flowNewledate != null) {
ldflowNewledate.put("fieldValue", flowNewledate);
}
ldflowNewledate.put("docId", doc);
//劳动开始日期打印
JSONObject ldflowLsdate = new JSONObject();
ldflowLsdate.put("fieldId", "5032230838");
if (flowLsdate != null) {
ldflowLsdate.put("fieldValue", flowLsdate);
}
ldflowLsdate.put("docId", doc);
//姓名
JSONObject ldflowName = new JSONObject();
ldflowName.put("fieldId", "0444257021");
if (flowName != null) {
ldflowName.put("fieldValue", flowName);
}
ldflowName.put("docId", doc);
//身份号码
JSONObject ldflowPbid = new JSONObject();
ldflowPbid.put("fieldId", "6595830430");
if (flowPbid != null) {
ldflowPbid.put("fieldValue", flowPbid);
}
ldflowPbid.put("docId", doc);
JSONObject flow_signsite1 = new JSONObject();
flow_signsite1.put("fieldId", "0982815893");
if (flow_signsite != null) {
flow_signsite1.put("fieldValue", flow_signsite);
}
flow_signsite1.put("docId", doc);
sizejsonarray.add(ldflowPlateno);
sizejsonarray.add(ldflowNewlsdate);
sizejsonarray.add(ldflowNewledate);
sizejsonarray.add(ldflowLsdate);
sizejsonarray.add(ldflowName);
sizejsonarray.add(ldflowPbid);
sizejsonarray.add(flow_signsite1);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
log.info("劳动合同续签写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
log.info("劳动合同续签完成" + signtask);
}
if (flowWcontract.equals("承包合同续签书(新版)") && flowPlan.equals("单班")) {
log.info("修改版本");
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "承包合同续签" + "$" + flowName + "$" + flowContractno);
initiator.put("signTemplateId", "1706062957356164580");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flowName != null) {
actorlist.put("actorName", flowName);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flowName != null) {
actorlist.put("identNameForMatch", flowName);
}
actorlist.put("certType", "id_card");
if (flowPbid != null) {
actorlist.put("certNoForMatch", flowPbid);
}
if (flow_pbphoneno != null) {
actorlist.put("notifyAddress", flow_pbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "参与方1");
actorlists.put("actorType", "corp");
if (flowDepartment != null) {
actorlists.put("actorName", flowDepartment);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (!flowDepartment.equals("银建新能源")) {
actorlists.put("actorOpenId", "625776ecae6742cb8eb710beedef9b4c");
String entryids = FDaDaUtil.entryids(flowPaname);
actorlists.put("actorEntityId", entryids);
} else if (flowDepartment.equals("银建新能源")) {
actorlists.put("actorOpenId", "a0c12949a1c54ff9bfa45dbe957fbc5d");
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1706062957356164580");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
if (flowDepartment.equals("银建")) {
jsonObject2.put("sealId", 1705990704393128941l);
} else if (flowDepartment.equals("金建")) {
jsonObject2.put("sealId", 1705991374867130717l);
} else if (flowDepartment.equals("金银建")) {
jsonObject2.put("sealId", 1705991362754131529l);
} else if (flowDepartment.equals("华建")) {
jsonObject2.put("sealId", 1705991079845184562l);
} else if (flowDepartment.equals("银建新能源")) {
jsonObject2.put("sealId", 1706510414541115296l);
}
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
//代理人
JSONObject actorsproxy = new JSONObject();
//代理人详细信息
JSONObject actorsproxylist = new JSONObject();
actorsproxylist.put("actorId", "代理人");
actorsproxylist.put("actorType", "person");
if (flowAgentn != null) {
actorsproxylist.put("actorName", flowAgentn);
}
JSONArray actorsproxylistpermissions = new JSONArray();
actorsproxylistpermissions.add("sign");
actorsproxylist.put("identNameForMatch", flowAgentn);
actorsproxylist.put("certType", "id_card");
if (flowAgentid != null) {
actorsproxylist.put("certNoForMatch", flowAgentid);
}
if (flowAgentph != null) {
actorsproxylist.put("notifyAddress", flowAgentph);
}
JSONArray notifyTypeactorsproxylist = new JSONArray();
notifyTypeactorsproxylist.add("start");
notifyTypeactorsproxylist.add("finish");
actorsproxylist.put("notifyType", notifyTypeactorsproxylist);
actorsproxylist.put("permissions", actorsproxylistpermissions);
actorsproxy.put("actor", actorsproxylist);
jsonArray.add(actor);
jsonArray.add(actors);
jsonArray.add(actorsproxy);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
log.info(" 承包合同续签" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//车牌号码
JSONObject ldflowPlateno = new JSONObject();
ldflowPlateno.put("fieldId", "2495009387");
if (flowPlateno != null) {
ldflowPlateno.put("fieldValue", flowPlateno);
}
ldflowPlateno.put("docId", doc);
//新运营开始日期打印
JSONObject ldflowNewlsdate = new JSONObject();
ldflowNewlsdate.put("fieldId", "1365222160");
if (flowNewosdate != null) {
ldflowNewlsdate.put("fieldValue", flowNewosdate);
}
ldflowNewlsdate.put("docId", doc);
//新劳动终止日期打印
JSONObject ldflowNewledate = new JSONObject();
ldflowNewledate.put("fieldId", "0911813810");
if (flowNewoedate != null) {
ldflowNewledate.put("fieldValue", flowNewoedate);
}
ldflowNewledate.put("docId", doc);
//劳动开始日期打印
JSONObject ldflowLsdate = new JSONObject();
ldflowLsdate.put("fieldId", "7871204800");
if (flowOsdate != null) {
ldflowLsdate.put("fieldValue", flowOsdate);
}
ldflowLsdate.put("docId", doc);
//续租日期打印1
//姓名
JSONObject ldflowName = new JSONObject();
ldflowName.put("fieldId", "6044269466");
if (flowName != null) {
ldflowName.put("fieldValue", flowName);
}
ldflowName.put("docId", doc);
//身份号码
JSONObject ldflowPbid = new JSONObject();
ldflowPbid.put("fieldId", "7880195003");
if (flowPbid != null) {
ldflowPbid.put("fieldValue", flowPbid);
}
ldflowPbid.put("docId", doc);
sizejsonarray.add(ldflowPlateno);
sizejsonarray.add(ldflowNewlsdate);
sizejsonarray.add(ldflowNewledate);
sizejsonarray.add(ldflowLsdate);
sizejsonarray.add(ldflowName);
sizejsonarray.add(ldflowPbid);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
log.info("承包合同续签写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
log.info("承包合同续签完成" + signtask);
}
return "";
}
}

View File

@ -0,0 +1,201 @@
package com.example.sso.schedule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.dao.A;
import com.example.sso.dao.Files;
import com.example.sso.util.APIUtils;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.TimeUtils;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.internal.util.logging.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
@Component
@Slf4j
public class Down {
Logger logger = LoggerFactory.getLogger(getClass());
@Scheduled(cron = "0 0 22 * * ?") // 每天晚上 22:00 执行
public static void main1() throws Exception {
String saveDir = "/home/fadada/file/";
//可以可以无
JSONObject jsonObject = new JSONObject();
JSONObject ownerId = new JSONObject();
ownerId.put("idType", "corp");
ownerId.put("openId", "625776ecae6742cb8eb710beedef9b4c");
jsonObject.put("ownerId", ownerId);
JSONObject listFilter = new JSONObject();
listFilter.put("signTaskStatus", "task_finished");
jsonObject.put("listFilter", listFilter);
String jsonString = jsonObject.toJSONString();
String down = FDaDaUtil.list(jsonString);
JSONObject jsonObject1 = JSON.parseObject(down);
//去A类拿分页数据
JSONArray jsonArray = A.jsonArray();
long currentTimestamp = System.currentTimeMillis();
Long tim = TimeUtils.tim(currentTimestamp);
String s = "";
String TaskSubject = "";
for (Object o : jsonArray) {
try {
JSONObject oo = (JSONObject) o;
String finishTime = oo.getString("finishTime");
long parseLong = Long.parseLong(finishTime);
if (parseLong >= tim && parseLong <= currentTimestamp) {
String signTaskId = oo.getString("signTaskId");
String signTaskSubject = oo.getString("signTaskSubject");
TaskSubject += signTaskSubject + ",";
s += signTaskId + ",";
}
} catch (NumberFormatException e) {
System.out.println("异常");
continue;
}
log.info("完成");
}
// System.out.println(TaskSubject);
String substring1 = TaskSubject.substring(0, TaskSubject.length() - 1);
String[] splitStr1 = splitStr(substring1);
String substring = s.substring(0, s.length() - 1);
String[] splitStr = splitStr(substring);
System.out.println(splitStr.length);
for (int i = 0; i < splitStr.length; i++) {
String s1 = splitStr[i];
String s2 = splitStr1[i];
String urls = FDaDaUtil.urls(s1);
FDaDaUtil.fileUrl(urls, s2, saveDir);
if (s2.contains("$")) {
String[] split = s2.split("\\$");
String s3 = split[0];
String s4 = split[1];
String s5 = split[2];
//新增简道云文件准备
Map<String, String> test = Files.test();
JSONObject object = (JSONObject) JSON.toJSON(test);
String transactionid = object.getString("transaction_id"); //transaction_id
JSONArray list = object.getJSONArray("token_and_url_list");
JSONObject token = new JSONObject();
for (int j = 0; j < list.size(); j++) {
token = list.getJSONObject(j);
}
String tokens = token.getString("token");//token
String keys = APIUtils.keys(s2, tokens);
//新增简道云
JSONObject test11 = new JSONObject(); //最外层
test11.put("app_id", "628eeaace7f28c00089a60cc");
test11.put("entry_id", "65a4d762edb3f1bd573b3e4e");
test11.put("transaction_id", transactionid);
JSONObject jsonObjectdata = new JSONObject(); //data层
JSONObject htlx = new JSONObject(); //合同类型
htlx.put("value", s3);
JSONObject htbh = new JSONObject(); //合同编号
htbh.put("value", s5);
JSONObject shfhm = new JSONObject(); //姓名
shfhm.put("value", s4);
JSONObject htzht = new JSONObject(); //主题
htzht.put("value", s2);
JSONObject ht = new JSONObject(); //文件
JSONArray hts = new JSONArray();
hts.add(keys);
ht.put("value", hts);
jsonObjectdata.put("htlx", htlx);
jsonObjectdata.put("shfhm", shfhm);
jsonObjectdata.put("htbh", htbh);
jsonObjectdata.put("htzht", htzht);
jsonObjectdata.put("ht", ht);
test11.put("data", jsonObjectdata);
String jsonString11 = test11.toJSONString();
String add = APIUtils.add(jsonString11);
System.out.println(add);
}
}
}
public static String[] splitStr(String str) {
return str.split(",");
}
public static String urls() throws Exception {
String ids = ids();
JSONObject jsonobjects = new JSONObject();
JSONObject ownerIds = new JSONObject();
ownerIds.put("idType", "corp");
ownerIds.put("openId", "625776ecae6742cb8eb710beedef9b4c");
jsonobjects.put("ownerId", ownerIds);
jsonobjects.put("signTaskId", ids);
String jsonString = jsonobjects.toJSONString();
String down = FDaDaUtil.down(jsonString);
return down;
}
public static String ids() throws Exception {
JSONObject jsonObject = new JSONObject();
JSONObject ownerId = new JSONObject();
ownerId.put("idType", "corp");
ownerId.put("openId", "625776ecae6742cb8eb710beedef9b4c");
jsonObject.put("ownerId", ownerId);
JSONObject listFilter = new JSONObject();
listFilter.put("signTaskStatus", "task_finished");
jsonObject.put("listFilter", listFilter);
String jsonString = jsonObject.toJSONString();
String down = FDaDaUtil.list(jsonString);
JSONObject jsonObject1 = JSON.parseObject(down);
JSONArray jsonArray = jsonObject1.getJSONObject("data").getJSONArray("signTasks");
long currentTimestamp = System.currentTimeMillis();
// 计算前24小时的时间戳
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(currentTimestamp));
calendar.add(Calendar.HOUR_OF_DAY, -24);
//后24小时
Calendar calendars = Calendar.getInstance();
calendars.setTime(new Date(currentTimestamp));
calendars.add(Calendar.HOUR_OF_DAY, 24);
long last24hrsTimestamp = calendar.getTimeInMillis();
long next24hrsTimestamp = calendars.getTimeInMillis();
String s = "";
for (Object o : jsonArray) {
JSONObject oo = (JSONObject) o;
String finishTime = oo.getString("finishTime");
long parseLong = Long.parseLong(finishTime);
if (parseLong >= last24hrsTimestamp && parseLong <= next24hrsTimestamp) {
String signTaskId = oo.getString("signTaskId");
s += signTaskId + ",";
}
}
String substring = s.substring(0, s.length() - 1);
return substring;
}
}

View File

@ -0,0 +1,44 @@
package com.example.sso.service;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.example.sso.config.SSOConfig;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.Date;
@Service
@NoArgsConstructor
@AllArgsConstructor
public class SSOService {
@Getter @Setter @Autowired private SSOConfig ssoConfig;
public String getResponse(String request,String username) {
Algorithm algorithm = Algorithm.HMAC256("");
JWTVerifier verifier = JWT.require(algorithm)
.withIssuer("com.jiandaoyun")
.build();
// DecodedJWT decoded = verifier.verify(request);
// if (!"sso_req".equals(decoded.getClaim("type").asString())) {
// return "";
// }
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.HOUR_OF_DAY, 1);
return JWT.create()
.withIssuer("com.jiandaoyun")
.withClaim("type", "sso_res")
.withClaim("username", username)
.withAudience("com.jiandaoyun")
.withExpiresAt(calendar.getTime())
.sign(algorithm);
}
}

View File

@ -0,0 +1,56 @@
package com.example.sso.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.dao.Totle;
import com.example.sso.util.FDaDaUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class A {
public void main11() throws Exception {
Integer num = Totle.num();
JSONArray jsonArray1 = new JSONArray();
for (int i = 1; i < num + 1; i++) {
JSONObject jsonObject = new JSONObject();
JSONObject ownerId = new JSONObject();
ownerId.put("idType", "corp");
ownerId.put("openId", "625776ecae6742cb8eb710beedef9b4c");
jsonObject.put("ownerId", ownerId);
JSONObject listFilter = new JSONObject();
listFilter.put("signTaskStatus", "task_finished");
jsonObject.put("listFilter", listFilter);
jsonObject.put("listPageNo", i);
jsonObject.put("listPageSize", 100);
String jsonString = jsonObject.toJSONString();
String down = FDaDaUtil.list(jsonString);
JSONObject jsonObject1 = JSON.parseObject(down);
JSONArray jsonArray = jsonObject1.getJSONObject("data").getJSONArray("signTasks");
for (Object o : jsonArray) {
JSONObject oo = (JSONObject) o;
String finishTime = oo.getString("finishTime");
String signTaskId = oo.getString("signTaskId");
String signTaskSubject = oo.getString("signTaskSubject");
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("finishTime", finishTime);
jsonObject2.put("signTaskId", signTaskId);
jsonObject2.put("signTaskSubject", signTaskSubject);
jsonArray1.add(jsonObject2);
}
}
String string = jsonArray1.toString();
log.info(string);
}
}

View File

@ -0,0 +1,105 @@
package com.example.sso.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.controller.FuWuController;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.FuWuuUil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class B {
public static void main(String[] args) throws Exception {
Logger logger = LoggerFactory.getLogger(B.class);
JSONObject jsonObject123 = new JSONObject();
jsonObject123.put("app_id", "628eeaace7f28c00089a60cc");
jsonObject123.put("entry_id", "65dd4d4cf3f99beb95f2b7e9");
jsonObject123.put("limit", "1000000");
String jsonString123 = jsonObject123.toJSONString();
String select = FuWuuUil.select(jsonString123);
JSONObject jsonObject1458 = JSON.parseObject(select);
String data = jsonObject1458.getString("data");
JSONArray jsonArray147 = JSON.parseArray(data);
for (Object o : jsonArray147) { // 假设有1000次请求
JSONObject test = (JSONObject) o;
String htlx = test.getString("htlx");
String shoujihao = test.getString("shoujihao");
String shenfenhaoma = test.getString("shenfenhaoma");
String xingming = test.getString("xingming");
String hetongbianhao = test.getString("hetongbianhao");
String beizhu = test.getString("beizhu");
if (!beizhu.isEmpty()) {
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", htlx + "$" + xingming + "$" + hetongbianhao);
initiator.put("signTemplateId", "1709000493259133120");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (shenfenhaoma != null) {
actorlist.put("actorName", shenfenhaoma);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (xingming != null) actorlist.put("identNameForMatch", xingming);
actorlist.put("certType", "id_card");
if (shenfenhaoma != null) actorlist.put("certNoForMatch", shenfenhaoma);
if (shoujihao != null) {
actorlist.put("notifyAddress", shoujihao);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
jsonArray.add(actor);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd(jsonString);
logger.info("服务协议" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
String signtask = FDaDaUtil.signtask(signTaskIds);
logger.info("服务协议完成" + signtask);
}
}
}
}

View File

@ -0,0 +1,397 @@
package com.example.sso.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.V5utils;
import lombok.extern.slf4j.Slf4j;
import java.time.Year;
@Slf4j
public class C {
public static void main(String[] args) throws Exception {
if (Year.now().getValue() == 2025) { // 仅2025年执行
JSONObject jsonObject77 = new JSONObject();
jsonObject77.put("app_id", "6437c223ee895d000812a37d");
jsonObject77.put("entry_id", "68932968bf5e56180de56507");
jsonObject77.put("limit", 10000);
String jsonString123 = jsonObject77.toJSONString();
String select = V5utils.list(jsonString123);
JSONObject jsonObject258545 = JSON.parseObject(select);
JSONArray jsonArray2 = jsonObject258545.getJSONArray("data");
for (Object o : jsonArray2){
JSONObject data = (JSONObject) o;
String flow_company = data.getString("flow_company");//合同编号
String flow_registrid = data.getString("flow_registrid");//承包合同开始日期
String flow_legal = data.getString("flow_legal");//承包合同终止日期
String flow_site = data.getString("flow_site");//签订日期
String flow_name = data.getString("flow_name");//公司名称
String flow_pbid = data.getString("flow_pbid");//乙方
String flow_pbphoneno = data.getString("flow_pbphoneno");//联系电话
String flow_pbaddress = data.getString("flow_pbaddress");//联系电话
String flow_wcsdate = data.getString("flow_wcsdate");//合同编号
String flow_company_2 = data.getString("flow_company_2");//承包合同开始日期
String flow_registrid_2 = data.getString("flow_registrid_2");//承包合同终止日期
String flow_legal_2 = data.getString("flow_legal_2");//签订日期
String flow_site_2 = data.getString("flow_site_2");//公司名称
String flow_contractno = data.getString("flow_contractno");//公司名称
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "DP变更协议" + "$" + flow_name + "$" + flow_contractno);
initiator.put("signTemplateId", "1754475649672115405");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flow_name != null) {
actorlist.put("actorName", flow_name);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flow_name != null) {
actorlist.put("identNameForMatch", flow_name);
}
actorlist.put("certType", "id_card");
if (flow_pbid != null) {
actorlist.put("certNoForMatch", flow_pbid);
}
if (flow_pbphoneno != null) {
actorlist.put("notifyAddress", flow_pbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "甲方");
actorlists.put("actorType", "corp");
if (flow_company != null) {
actorlists.put("actorName", flow_company);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (flow_company != null) {
if (flow_company.equals("北京康建利福汽车服务有限公司")) {
actorlists.put("actorOpenId", "232063a6e4dd45889db2f843ff75b658");
}
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONObject actors1 = new JSONObject();
//actor详细信息企业丙方
JSONObject actorlists1 = new JSONObject();
actorlists1.put("actorId", "丙方");
actorlists1.put("actorType", "corp");
if (flow_company_2 != null) {
actorlists1.put("actorName", flow_company_2);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (flow_company_2 != null) {
if (flow_company_2.equals("北京银环泰西汽车服务有限公司")) {
actorlists1.put("actorOpenId", "802b22355a0545558be4a1b1dad746a6");
}
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes1 = new JSONArray();
notifyTypes1.add("start");
notifyTypes1.add("finish");
actorlists1.put("notifyType", notifyTypes1);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1754475649672115405");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
jsonObject2.put("fieldId", "5005908017");
if (flow_company.equals("北京康建利福汽车服务有限公司")) {
jsonObject2.put("sealId", 1707030330912199731l);
}
//丙方印章
JSONArray SignField1 = new JSONArray();
JSONObject jsonObject21 = new JSONObject();
JSONObject ownerId1 = new JSONObject(); // docid
ownerId1.put("ownerId", openid);
ownerId1.put("signTemplateId", "1754475649672115405");
String ownerIdJSONString2 = ownerId1.toJSONString();
String doc2 = FDaDaUtil.doc(ownerIdJSONString2);
jsonObject21.put("fieldDocId", doc2);
jsonObject21.put("fieldId", "5275451633");
if (flow_company_2.equals("北京银环泰西汽车服务有限公司")) {
jsonObject21.put("sealId", 1754044354642191353l);
}
SignField.add(jsonObject2);
SignField1.add(jsonObject21);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
//丙方
JSONObject signConfigInfo1 = new JSONObject();
JSONObject signConfigInfos1 = new JSONObject();
signConfigInfos1.put("requestVerifyFree", true);
signConfigInfo1.put("signConfigInfo", signConfigInfo1);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
actors1.put("actor", actorlists1);
actors1.put("signFields", SignField1);
actors1.put("signConfigInfo", signConfigInfos1);
jsonArray.add(actor);
jsonArray.add(actors);
jsonArray.add(actors1);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
log.info("入参 " + jsonString);
String fdd = FDaDaUtil.fdd(jsonString);
log.info("DP租赁变更" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//合同编号
JSONObject flow_company1 = new JSONObject();
flow_company1.put("fieldId", "2904585592");
if (flow_company != null) {
flow_company1.put("fieldValue", flow_company);
}
flow_company1.put("docId", doc);
JSONObject flow_registrid1 = new JSONObject();
flow_registrid1.put("fieldId", "7737543576");
if (flow_registrid != null) {
flow_registrid1.put("fieldValue", flow_registrid);
}
flow_registrid1.put("docId", doc);
JSONObject flow_legal1 = new JSONObject();
flow_legal1.put("fieldId", "7332206065");
if (flow_legal != null) {
flow_legal1.put("fieldValue", flow_legal);
}
flow_legal1.put("docId", doc);
JSONObject flow_site1 = new JSONObject();
flow_site1.put("fieldId", "0243447648");
if (flow_site != null) {
flow_site1.put("fieldValue", flow_site);
}
flow_site1.put("docId", doc);
JSONObject flow_name1 = new JSONObject();
flow_name1.put("fieldId", "3221966137");
if (flow_name != null) {
flow_name1.put("fieldValue", flow_name);
}
flow_name1.put("docId", doc);
JSONObject flow_pbid1 = new JSONObject();
flow_pbid1.put("fieldId", "1649670023");
if (flow_pbid != null) {
flow_pbid1.put("fieldValue", flow_pbid);
}
flow_pbid1.put("docId", doc);
JSONObject flow_pbaddress1 = new JSONObject();
flow_pbaddress1.put("fieldId", "6262025935");
if (flow_pbaddress != null) {
flow_pbaddress1.put("fieldValue", flow_pbaddress);
}
flow_pbaddress1.put("docId", doc);
JSONObject flow_wcsdate1 = new JSONObject();
flow_wcsdate1.put("fieldId", "0545220484");
if (flow_wcsdate != null) {
flow_wcsdate1.put("fieldValue", flow_wcsdate);
}
flow_wcsdate1.put("docId", doc);
JSONObject flow_company_21 = new JSONObject();
flow_company_21.put("fieldId", "9919283566");
if (flow_company_2 != null) {
flow_company_21.put("fieldValue", flow_company_2);
}
flow_company_21.put("docId", doc);
JSONObject flow_registrid_21 = new JSONObject();
flow_registrid_21.put("fieldId", "9236200533");
if (flow_registrid_2 != null) {
flow_registrid_21.put("fieldValue", flow_registrid_2);
}
flow_registrid_21.put("docId", doc);
JSONObject flow_legal_21 = new JSONObject();
flow_legal_21.put("fieldId", "8191881584");
if (flow_legal_2 != null) {
flow_legal_21.put("fieldValue", flow_legal_2);
}
flow_legal_21.put("docId", doc);
JSONObject flow_site_21 = new JSONObject();
flow_site_21.put("fieldId", "3607440370");
if (flow_site_2 != null) {
flow_site_21.put("fieldValue", flow_site_2);
}
flow_site_21.put("docId", doc);
sizejsonarray.add(flow_company1);
sizejsonarray.add(flow_registrid1);
sizejsonarray.add(flow_legal1);
sizejsonarray.add(flow_site1);
sizejsonarray.add(flow_name1);
sizejsonarray.add(flow_pbid1);
sizejsonarray.add(flow_pbaddress1);
sizejsonarray.add(flow_wcsdate1);
sizejsonarray.add(flow_company_21);
sizejsonarray.add(flow_registrid_21);
sizejsonarray.add(flow_legal_21);
sizejsonarray.add(flow_site_21);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
log.info("DP租赁变更写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
log.info("DP租赁变更完成" + signtask);
}
}
}
}

View File

@ -0,0 +1,273 @@
package com.example.sso.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.V5utils;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class D {
public static void main(String[] args) throws Exception {
JSONObject jsonObject77 = new JSONObject();
jsonObject77.put("app_id", "628eeaace7f28c00089a60cc");
jsonObject77.put("entry_id", "689ea4bf0499bc380806c204");
jsonObject77.put("limit", 10000);
String jsonString123 = jsonObject77.toJSONString();
String select = V5utils.list(jsonString123);
JSONObject jsonObject258545 = JSON.parseObject(select);
JSONArray jsonArray2 = jsonObject258545.getJSONArray("data");
for (Object o : jsonArray2){
JSONObject data = (JSONObject) o;
String flow_htbh = data.getString("flow_htbh");//合同编号
String flow_jf = data.getString("flow_jf");//承包合同开始日期
String flow_jfxm = data.getString("flow_jfxm");//承包合同终止日期
String flow_jfphone = data.getString("flow_jfphone");//签订日期
String flow_yf = data.getString("flow_yf");//公司名称
String flow_yfxm = data.getString("flow_yfxm");//乙方
String flow_yfphone = data.getString("flow_yfphone");//联系电话
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "安全防范责任书" + "$" + flow_yfxm + "$" + flow_htbh);
initiator.put("signTemplateId", "1755246721977137779");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flow_yfxm != null) {
actorlist.put("actorName", flow_yfxm);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flow_yfxm != null) {
actorlist.put("identNameForMatch", flow_yfxm);
}
actorlist.put("certType", "id_card");
if (flow_yfphone != null) {
actorlist.put("notifyAddress", flow_yfphone);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "甲方");
actorlists.put("actorType", "person");
if (flow_jfxm != null) {
actorlists.put("actorName", flow_jfxm);
}
JSONArray permissions1 = new JSONArray();
permissions1.add("sign");
if (flow_jfxm != null) {
actorlists.put("identNameForMatch", flow_jfxm);
}
actorlist.put("certType", "id_card");
if (flow_jfphone != null) {
actorlists.put("notifyAddress", flow_jfphone);
}
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1755246721977137779");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
//丙方印章
JSONArray SignField1 = new JSONArray();
JSONObject jsonObject21 = new JSONObject();
JSONObject ownerId1 = new JSONObject(); // docid
ownerId1.put("ownerId", openid);
ownerId1.put("signTemplateId", "1755246721977137779");
String ownerIdJSONString2 = ownerId1.toJSONString();
String doc2 = FDaDaUtil.doc(ownerIdJSONString2);
jsonObject21.put("fieldDocId", doc2);
SignField.add(jsonObject2);
SignField1.add(jsonObject21);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
jsonArray.add(actor);
jsonArray.add(actors);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
log.info("入参 " + jsonString);
String fdd = FDaDaUtil.fdd(jsonString);
log.info("DP租赁变更" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//合同编号
JSONObject flow_company1 = new JSONObject();
flow_company1.put("fieldId", "1418356822");
if (flow_jf != null) {
flow_company1.put("fieldValue", flow_jf);
}
flow_company1.put("docId", doc);
JSONObject flow_registrid1 = new JSONObject();
flow_registrid1.put("fieldId", "7029913971");
if (flow_jfxm != null) {
flow_registrid1.put("fieldValue", flow_jfxm);
}
flow_registrid1.put("docId", doc);
JSONObject flow_legal1 = new JSONObject();
flow_legal1.put("fieldId", "1507319616");
if (flow_yf != null) {
flow_legal1.put("fieldValue", flow_yf);
}
flow_legal1.put("docId", doc);
JSONObject flow_site1 = new JSONObject();
flow_site1.put("fieldId", "0433900773");
if (flow_yfxm != null) {
flow_site1.put("fieldValue", flow_yfxm);
}
flow_site1.put("docId", doc);
sizejsonarray.add(flow_company1);
sizejsonarray.add(flow_registrid1);
sizejsonarray.add(flow_legal1);
sizejsonarray.add(flow_site1);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
log.info("DP租赁变更写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
log.info("DP租赁变更完成" + signtask);
}
}
}

View File

@ -0,0 +1,400 @@
package com.example.sso.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.sso.util.FDaDaUtil;
import com.example.sso.util.V5utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.Year;
@Slf4j
@Component
public class DpBianGengDingShi {
@Scheduled(cron = "0 0 7 11 8 ?")
public void main1() throws Exception {
if (Year.now().getValue() == 2025) { // 仅2025年执行
JSONObject jsonObject77 = new JSONObject();
jsonObject77.put("app_id", "6437c223ee895d000812a37d");
jsonObject77.put("entry_id", "68932968bf5e56180de56507");
jsonObject77.put("limit", 10);
String jsonString123 = jsonObject77.toJSONString();
String select = V5utils.list(jsonString123);
JSONObject jsonObject258545 = JSON.parseObject(select);
JSONArray jsonArray2 = jsonObject258545.getJSONArray("data");
for (Object o : jsonArray2){
JSONObject data = (JSONObject) o;
String flow_company = data.getString("flow_company");//合同编号
String flow_registrid = data.getString("flow_registrid");//承包合同开始日期
String flow_legal = data.getString("flow_legal");//承包合同终止日期
String flow_site = data.getString("flow_site");//签订日期
String flow_name = data.getString("flow_name");//公司名称
String flow_pbid = data.getString("flow_pbid");//乙方
String flow_pbphoneno = data.getString("flow_pbphoneno");//联系电话
String flow_pbaddress = data.getString("flow_pbaddress");//联系电话
String flow_wcsdate = data.getString("flow_wcsdate");//合同编号
String flow_company_2 = data.getString("flow_company_2");//承包合同开始日期
String flow_registrid_2 = data.getString("flow_registrid_2");//承包合同终止日期
String flow_legal_2 = data.getString("flow_legal_2");//签订日期
String flow_site_2 = data.getString("flow_site_2");//公司名称
String flow_contractno = data.getString("flow_contractno");//公司名称
//创建签署任务
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "625776ecae6742cb8eb710beedef9b4c");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "DP变更协议" + "$" + flow_name + "$" + flow_contractno);
initiator.put("signTemplateId", "1754475649672115405");
initiator.put("businessId", "a09900c24614bd4c1de10c55712a3e0e");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "乙方");
actorlist.put("actorType", "person");
if (flow_name != null) {
actorlist.put("actorName", flow_name);
}
JSONArray permissions = new JSONArray();
permissions.add("sign");
if (flow_name != null) {
actorlist.put("identNameForMatch", flow_name);
}
actorlist.put("certType", "id_card");
if (flow_pbid != null) {
actorlist.put("certNoForMatch", flow_pbid);
}
if (flow_pbphoneno != null) {
actorlist.put("notifyAddress", flow_pbphoneno);
}
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "甲方");
actorlists.put("actorType", "corp");
if (flow_company != null) {
actorlists.put("actorName", flow_company);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (flow_company != null) {
if (flow_company.equals("北京康建利福汽车服务有限公司")) {
actorlists.put("actorOpenId", "232063a6e4dd45889db2f843ff75b658");
}
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONObject actors1 = new JSONObject();
//actor详细信息企业丙方
JSONObject actorlists1 = new JSONObject();
actorlists1.put("actorId", "丙方");
actorlists1.put("actorType", "corp");
if (flow_company_2 != null) {
actorlists1.put("actorName", flow_company_2);
}
/*JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);*/
if (flow_company_2 != null) {
if (flow_company_2.equals("北京银环泰西汽车服务有限公司")) {
actorlists1.put("actorOpenId", "802b22355a0545558be4a1b1dad746a6");
}
}
/*actorlists.put("notifyAddress", "13520145209");*/
JSONArray notifyTypes1 = new JSONArray();
notifyTypes1.add("start");
notifyTypes1.add("finish");
actorlists1.put("notifyType", notifyTypes1);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
JSONObject ownerId = new JSONObject(); // docid
ownerId.put("ownerId", openid);
ownerId.put("signTemplateId", "1754475649672115405");
String ownerIdJSONString = ownerId.toJSONString();
String doc = FDaDaUtil.doc(ownerIdJSONString);
jsonObject2.put("fieldDocId", doc);
jsonObject2.put("fieldId", "5005908017");
if (flow_company.equals("北京康建利福汽车服务有限公司")) {
jsonObject2.put("sealId", 1707030330912199731l);
}
//丙方印章
JSONArray SignField1 = new JSONArray();
JSONObject jsonObject21 = new JSONObject();
JSONObject ownerId1 = new JSONObject(); // docid
ownerId1.put("ownerId", openid);
ownerId1.put("signTemplateId", "1754475649672115405");
String ownerIdJSONString2 = ownerId1.toJSONString();
String doc2 = FDaDaUtil.doc(ownerIdJSONString2);
jsonObject21.put("fieldDocId", doc2);
jsonObject21.put("fieldId", "5275451633");
if (flow_company_2.equals("北京银环泰西汽车服务有限公司")) {
jsonObject21.put("sealId", 1754044354642191353l);
}
SignField.add(jsonObject2);
SignField1.add(jsonObject21);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree", true);
signConfigInfo.put("signConfigInfo", signConfigInfo);
//丙方
JSONObject signConfigInfo1 = new JSONObject();
JSONObject signConfigInfos1 = new JSONObject();
signConfigInfos1.put("requestVerifyFree", true);
signConfigInfo1.put("signConfigInfo", signConfigInfo1);
actors.put("actor", actorlists);
actors.put("signFields", SignField);
actors.put("signConfigInfo", signConfigInfos);
actors1.put("actor", actorlists1);
actors1.put("signFields", SignField1);
actors1.put("signConfigInfo", signConfigInfos1);
jsonArray.add(actor);
jsonArray.add(actors);
jsonArray.add(actors1);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
log.info("入参 " + jsonString);
String fdd = FDaDaUtil.fdd(jsonString);
log.info("DP租赁变更" + fdd);
JSONObject jsonObject = JSON.parseObject(fdd);
//任务id
String signTaskId = jsonObject.getJSONObject("data").getString("signTaskId");
String signTaskIds = String.valueOf(jsonObject.getJSONObject("data"));
System.out.println("signTaskId____________________" + signTaskId);
System.out.println("signTaskIds========================" + signTaskIds);
//填写控件
JSONObject sizejsonobject = new JSONObject();
sizejsonobject.put("signTaskId", signTaskId);
// jsonObject.put( "actorId", "参与方2");
JSONArray sizejsonarray = new JSONArray();
//合同编号
JSONObject flow_company1 = new JSONObject();
flow_company1.put("fieldId", "2904585592");
if (flow_company != null) {
flow_company1.put("fieldValue", flow_company);
}
flow_company1.put("docId", doc);
JSONObject flow_registrid1 = new JSONObject();
flow_registrid1.put("fieldId", "7737543576");
if (flow_registrid != null) {
flow_registrid1.put("fieldValue", flow_registrid);
}
flow_registrid1.put("docId", doc);
JSONObject flow_legal1 = new JSONObject();
flow_legal1.put("fieldId", "7332206065");
if (flow_legal != null) {
flow_legal1.put("fieldValue", flow_legal);
}
flow_legal1.put("docId", doc);
JSONObject flow_site1 = new JSONObject();
flow_site1.put("fieldId", "0243447648");
if (flow_site != null) {
flow_site1.put("fieldValue", flow_site);
}
flow_site1.put("docId", doc);
JSONObject flow_name1 = new JSONObject();
flow_name1.put("fieldId", "3221966137");
if (flow_name != null) {
flow_name1.put("fieldValue", flow_name);
}
flow_name1.put("docId", doc);
JSONObject flow_pbid1 = new JSONObject();
flow_pbid1.put("fieldId", "1649670023");
if (flow_pbid != null) {
flow_pbid1.put("fieldValue", flow_pbid);
}
flow_pbid1.put("docId", doc);
JSONObject flow_pbaddress1 = new JSONObject();
flow_pbaddress1.put("fieldId", "6262025935");
if (flow_pbaddress != null) {
flow_pbaddress1.put("fieldValue", flow_pbaddress);
}
flow_pbaddress1.put("docId", doc);
JSONObject flow_wcsdate1 = new JSONObject();
flow_wcsdate1.put("fieldId", "0545220484");
if (flow_wcsdate != null) {
flow_wcsdate1.put("fieldValue", flow_wcsdate);
}
flow_wcsdate1.put("docId", doc);
JSONObject flow_company_21 = new JSONObject();
flow_company_21.put("fieldId", "9919283566");
if (flow_company_2 != null) {
flow_company_21.put("fieldValue", flow_company_2);
}
flow_company_21.put("docId", doc);
JSONObject flow_registrid_21 = new JSONObject();
flow_registrid_21.put("fieldId", "9236200533");
if (flow_registrid_2 != null) {
flow_registrid_21.put("fieldValue", flow_registrid_2);
}
flow_registrid_21.put("docId", doc);
JSONObject flow_legal_21 = new JSONObject();
flow_legal_21.put("fieldId", "8191881584");
if (flow_legal_2 != null) {
flow_legal_21.put("fieldValue", flow_legal_2);
}
flow_legal_21.put("docId", doc);
JSONObject flow_site_21 = new JSONObject();
flow_site_21.put("fieldId", "3607440370");
if (flow_site_2 != null) {
flow_site_21.put("fieldValue", flow_site_2);
}
flow_site_21.put("docId", doc);
sizejsonarray.add(flow_company1);
sizejsonarray.add(flow_registrid1);
sizejsonarray.add(flow_legal1);
sizejsonarray.add(flow_site1);
sizejsonarray.add(flow_name1);
sizejsonarray.add(flow_pbid1);
sizejsonarray.add(flow_pbaddress1);
sizejsonarray.add(flow_wcsdate1);
sizejsonarray.add(flow_company_21);
sizejsonarray.add(flow_registrid_21);
sizejsonarray.add(flow_legal_21);
sizejsonarray.add(flow_site_21);
sizejsonobject.put("docFieldValues", sizejsonarray);
String sizeString = sizejsonobject.toJSONString();
String sizekongjian = FDaDaUtil.sizekongjian(sizeString);
log.info("DP租赁变更写控件" + sizekongjian);
System.out.println("控件填写完成=======================================");
String signtask = FDaDaUtil.signtask(signTaskIds);
log.info("DP租赁变更完成" + signtask);
}
}
}
}

View File

@ -0,0 +1,673 @@
package com.example.sso.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.Charsets;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.ssl.TrustStrategy;
import org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.*;
public class APIUtils {
public static final String WEBSITE = "https://www.jiyuankeshang.com";
private static boolean retryIfRateLimited = true;
private String urlGetWidgets;
private String urlGetFormData;
private String urlRetrieveData;
private String urlUpdateData;
private String urlCreateData;
private String urlDeleteData;
private String urlCreateUSer;
private String urlCreatePerson;
private String urlCreatePersonAll;
private String urlCreateDep;
private String urlCreateDepAll;
private String urlGetDepartment;
private String urlGetPeople;
private String urlDeletePeople;
private String urlDown;
private static String apiKey;
/**
* @param appId - 应用id
* @param entryId - 表单id
* @param apiKey - apiKey
*/
public APIUtils(String appId, String entryId, String apiKey) {
this.apiKey = apiKey;
this.initUrl(appId, entryId);
}
public Map<String, Object> createPerson(Map<String, Object> person) {
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlCreatePerson, person);
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
public Map<String, Object> createDep(Map<String, Object> person) {
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlCreatePerson, person);
data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
private void initUrl(String appId, String entryId) {
urlGetWidgets = WEBSITE + "/api/v1/app/" + appId + "/entry/" + entryId + "/widgets";
urlGetFormData = WEBSITE + "/api/v1/app/" + appId + "/entry/" + entryId + "/data";
urlRetrieveData = WEBSITE + "/api/v1/app/" + appId + "/entry/" + entryId + "/data_retrieve";
urlUpdateData = WEBSITE + "/api/v1/app/" + appId + "/entry/" + entryId + "/data_update";
urlCreateData = WEBSITE + "/api/v3/app/" + appId + "/entry/" + entryId + "/data_create";
urlDeleteData = WEBSITE + "/api/v1/app/" + appId + "/entry/" + entryId + "/data_delete";
urlCreatePerson = WEBSITE + "/api/v2/user/create";
urlCreateUSer = WEBSITE + "/api/v2/user/create";
urlCreateDep = WEBSITE + "/api/v2/department/create";
urlCreateDepAll = WEBSITE + "/api/v2/department/import";
urlCreatePersonAll = WEBSITE + "/api/v2/user/import";
urlGetDepartment = WEBSITE + "/api/v2/department/1/department_list";
urlGetPeople = WEBSITE + "/api/v2/department/1/member_list";
urlDeletePeople = WEBSITE + "/api/v2/user/batch_delete";
urlDown = WEBSITE + "/api/v1/app/" + appId + "/entry/" + entryId + "/file/get_upload_token";
}
public static HttpClient getSSLHttpClient() throws Exception {
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
//信任所有
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
return true;
}
}).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext);
return HttpClients.custom().setSSLSocketFactory(sslsf).build();
}
/**
* 获取部门成员信息
*
* @param - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> deletePeopleBatch(Map<String, Object> map) {
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlDeletePeople, map);
return result;
// data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 获取请求头信息
*
* @return
*/
public static Header[] getHttpHeaders() {
List<Header> headerList = new ArrayList<Header>();
headerList.add(new BasicHeader("Authorization", "Bearer " + apiKey));
headerList.add(new BasicHeader("Content-Type", "application/json;charset=utf-8"));
return headerList.toArray(new Header[headerList.size()]);
}
/**
* 查询人员信息
*
* @param username - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> findPerson(String username) {
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", WEBSITE + "/api/v2/user/" + username + "/user_retrieve", new HashMap<>());
data = (Map<String, Object>) result.get("data");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 发送HTTP请求
*
* @param method - HTTP动词 { GET|POST }
* @param url - 请求路径
* @param data - 请求的数据
* @throws Exception
*/
public static Object sendRequest(String method, String url, Map<String, Object> data) throws Exception {
HttpClient client = getSSLHttpClient();
Header[] headers = getHttpHeaders();
HttpRequestBase request;
method = method.toUpperCase();
if ("GET".equals(method)) {
// GET请求
URIBuilder uriBuilder = new URIBuilder(url);
if (data != null) {
// 添加请求参数
for (Map.Entry<String, Object> entry : data.entrySet()) {
uriBuilder.addParameter(entry.getKey(), (String) entry.getValue());
}
}
request = new HttpGet(uriBuilder.build());
} else if ("POST".equals(method)) {
// POST请求
request = new HttpPost(url);
ObjectMapper mapper = new ObjectMapper();
HttpEntity entity = new StringEntity(mapper.writeValueAsString(data), Charsets.UTF_8);
((HttpPost) request).setEntity(entity);
} else {
throw new RuntimeException("不支持的HTTP动词");
}
// 设置请求头
request.setHeaders(headers);
// 发送请求并获取返回结果
HttpResponse response = client.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> result = (Map<String, Object>) mapper.readValue(response.getEntity().getContent(), Object.class);
if (statusCode >= 400) {
// 请求错误
if ((Integer) result.get("code") == 8303 && retryIfRateLimited) {
// 频率超限1s后重试
Thread.sleep(1000);
return sendRequest(method, url, data);
} else {
return result;
}
} else {
// 处理返回结果
return result;
}
}
/**
* 获取表单字段
*
* @return 表单字段
*/
public List<Map<String, Object>> getFormWidgets() {
List<Map<String, Object>> widgets = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlGetWidgets, new HashMap<String, Object>());
widgets = (List<Map<String, Object>>) result.get("widgets");
} catch (Exception e) {
e.printStackTrace();
}
return widgets;
}
public List<Map<String, Object>> createUser(String username, String name, Integer[] departments) {
Map<String, Object> data = null;
try {
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("username", username);
requestData.put("name", name);
requestData.put("departments", departments);
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlCreateUSer, requestData);
data = (Map<String, Object>) result.get("data");
} catch (Exception e) {
e.printStackTrace();
}
return (List<Map<String, Object>>) data;
}
/**
* 按条件获取表单数据
*
* @param limit - 数据条数
* @param fields - 显示的字段
* @param filter - 过滤条件
* @param dataId - 上次取数的最后一个数据id
* @return - 返回的数据
*/
public List<Map<String, Object>> getFormData(final int limit, final String[] fields, final Map<String, Object> filter, String dataId) {
List<Map<String, Object>> data = null;
try {
// 构造请求数据
Map<String, Object> requestData = new HashMap<String, Object>() {
{
put("limit", limit);
put("fields", fields);
put("filter", filter);
}
};
if (dataId != null) {
requestData.put("data_id", dataId);
}
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlGetFormData, requestData);
data = (List<Map<String, Object>>) result.get("data");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 按条件获取全部表单数据
*
* @return 表单数据
*/
public List<Map<String, Object>> getAllFormData(String[] fields, Map<String, Object> filter) {
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
String offset = null;
do {
List<Map<String, Object>> data = this.getFormData(100, fields, filter, offset);
// 获取返回的数据
if (data == null || data.isEmpty()) {
// 已经获取全部的数据
offset = null;
} else {
// 获取最后一条数据的id
offset = (String) data.get(data.size() - 1).get("_id");
dataList.addAll(data);
}
} while (offset != null);
return dataList;
}
/**
* 搜索单条数据
*
* @param dataId - 要查询的数据id
* @return 表单数据
*/
public Map<String, Object> retrieveData(String dataId) {
Map<String, Object> data = null;
try {
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("data_id", dataId);
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlRetrieveData, requestData);
data = (Map<String, Object>) result.get("data");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 新增部门
*
* @param - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> createDataDep(Map<String, Object> requestData) {
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlCreateDep, requestData);
// data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 批量创建部门
*
* @param - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> createDataDepAll(Map<String, Object> requestData) {
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlCreateDepAll, requestData);
// data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 批量创建人员
*
* @param - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> createDataPersonAll(Map<String, Object> requestData) {
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlCreatePersonAll, requestData);
System.out.println(result);
return result;
// data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 获取部门信息
*
* @param - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> getDepartment() {
Map<String, Object> map = new HashMap<>();
map.put("has_child", 1);
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlGetDepartment, map);
System.out.println(result);
return result;
// data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 获取部门成员信息
*
* @param - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> getDepartmentPerson(String dno) {
Map<String, Object> map = new HashMap<>();
// map.put("has_child",1);
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", WEBSITE + "/api/v2/department/" + dno + "/member_list", map);
return result;
// data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
public Map<String, Object> deleteDepartment(Integer no) {
Map<String, Object> map = new HashMap<>();
map.put("has_child", 1);
Map<String, Object> data = null;
try {
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", WEBSITE + "/api/v2/department/" + no + "/delete", new HashMap<>());
System.out.println(result);
return result;
// data = (Map<String, Object>) result.get("department");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
// /**
// * 新增部门
// * @param - 创建数据内容
// * @return 更新后的数据
// */
// public Map<String, Object> createDataDep (Map<String, Object> requestData) {
// Map<String, Object> data = null;
// try {
// Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST",urlCreateDep, requestData);
// data = (Map<String, Object>) result.get("data");
// } catch (Exception e) {
// e.printStackTrace();
// }
// return data;
// }
/**
* 创建单条数据
*
* @param rawData - 创建数据内容
* @return 更新后的数据
*/
public Map<String, Object> createData(Map<String, Object> rawData) {
Map<String, Object> data = null;
try {
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("data", rawData);
requestData.put("is_start_workflow", true);
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlCreateData, requestData);
data = (Map<String, Object>) result.get("data");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 获取所有的人在简道云
*
* @return 更新后的数据
*/
public List<Map<String, Object>> getAllPeople() {
List<Map<String, Object>> data = null;
try {
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("has_child", true);
// System.out.println("准备发起HTTP请求"+urlGetPeople);
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlGetPeople, requestData);
data = (List<Map<String, Object>>) result.get("users");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 更新单条数据
*
* @return 更新结果
*/
public Map<String, Object> updateData(String dataId, Map<String, Object> update) {
Map<String, Object> data = null;
try {
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("data_id", dataId);
requestData.put("data", update);
Map<String, Object> result = (Map<String, Object>) this.sendRequest("POST", urlUpdateData, requestData);
data = (Map<String, Object>) result.get("data");
} catch (Exception e) {
e.printStackTrace();
}
return data;
}
/**
* 删除单条数据
*
* @return 删除结果
*/
public Map<String, String> deleteData(String dataId) {
Map<String, String> result = null;
try {
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("data_id", dataId);
result = (Map<String, String>) this.sendRequest("POST", urlDeleteData, requestData);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 下载
*
* @return 更新后的数据
*/
public Map<String, String> down() {
Map<String, String> result = null;
try {
UUID uuid = UUID.randomUUID();
Map<String, Object> requestData = new HashMap<String, Object>();
requestData.put("transaction_id", uuid.toString());
result = (Map<String, String>) this.sendRequest("POST", urlDown, requestData);
result.put("transaction_id", uuid.toString());
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* V5新增
*
* @return 更新后的数据
*/
public static String add(String jsonBody) throws Exception {
SSLContext sslContext = createTrustAllSSLContext();
CloseableHttpClient httpClient = createHttpClient(sslContext);
// 创建 POST 请求对象
HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/create");
String responseBody = null;
try {
// 设置请求头
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行请求,获取响应对象
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
// 从响应对象中获取响应实体
HttpEntity responseEntity = response.getEntity();
// 处理响应数据
responseBody = EntityUtils.toString(responseEntity);
System.out.println(responseBody);
} finally {
// 关闭响应对象
response.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 关闭 HttpClient
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return responseBody;
}
/**
* V5获取文件key
*
* @return 更新后的数据
*/
public static String keys(String top, String token) throws Exception {
String url = "https://www.jiyuankeshang.com/_/file/upload/put_file";
File file = new File("/home" + File.separator + "fadada" + File.separator +"file"+ File.separator + top+".pdf");
String PATH = "D:\\11.txt";
SSLContext sslContext = createTrustAllSSLContext();
CloseableHttpClient httpClient = createHttpClient(sslContext);
HttpPost httpPost = new HttpPost(url);
// httpPost.setHeader("Content-Type", "form-data");
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addPart("token", new StringBody(token, ContentType.create("text/plain", Charset.forName("UTF-8"))));
builder.addPart("file", new FileBody(file, ContentType.create("pdf"), file.getName()));
HttpEntity entity = builder.build();
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity entity1 = response.getEntity();
String string = EntityUtils.toString(entity1);
JSONObject jsonObject = JSON.parseObject(string);
String key = jsonObject.getString("key");
return key;
}
private static SSLContext createTrustAllSSLContext() throws Exception {
// 创建一个信任所有证书的 TrustManager
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
}
};
// 创建 SSL 上下文并初始化
SSLContext sslContext = SSLContexts.custom().build();
sslContext.init(null, trustAllCerts, null);
return sslContext;
}
private static CloseableHttpClient createHttpClient(SSLContext sslContext) {
// 创建 HttpClient 并设置信任所有证书的 SSL 上下文
return HttpClients.custom()
.setSSLContext(sslContext)
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
.build();
}
}

View File

@ -0,0 +1,11 @@
package com.example.sso.util;
import java.text.DecimalFormat;
public class Dou {
public static String zheng(Double d){
DecimalFormat decimalFormat = new DecimalFormat("#");
String formattedNumber = decimalFormat.format(d);
return formattedNumber;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,86 @@
package com.example.sso.util;
import com.fasc.open.api.utils.string.StringUtil;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.*;
import java.util.Map.Entry;
/**
* @author Fadada
* 2021/9/8 16:09:38
*/
public class FddCryptUtil {
private FddCryptUtil() {
}
private static final Charset UTF8 = StandardCharsets.UTF_8;
public static byte[] hmac256(byte[] key, String msg) throws Exception {
Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(key, mac.getAlgorithm());
mac.init(secretKeySpec);
return mac.doFinal(msg.getBytes(UTF8));
}
public static String sha256Hex(String s) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] d = md.digest(s.getBytes(UTF8));
return DatatypeConverter.printHexBinary(d).toLowerCase();
}
/**
* @param sortParam 排序后得参数字符串
* @param timestamp 时间戳
* @param appSecret 应用秘钥
* @return 签名值
* @throws Exception 异常
*/
public static String sign(String sortParam,
String timestamp,
String appSecret) throws Exception {
//将排序后字符串转为sha256Hex
String signText = sha256Hex(sortParam);
// ************* 计算签名 *************
byte[] secretSigning = hmac256((appSecret).getBytes(UTF8), timestamp);
//计算后得到签名
return DatatypeConverter.printHexBinary(hmac256(secretSigning, signText)).toLowerCase();
}
public static String sortParameters(Map<String, String> parameters) {
if (parameters.isEmpty()) {
return null;
}
List<String> removeKeys = new ArrayList<>();
for (Entry<String, String> entry : parameters.entrySet()) {
if (StringUtil.isBlank(entry.getValue())) {
removeKeys.add(entry.getKey());
}
}
for (String key : removeKeys) {
parameters.remove(key);
}
StringBuilder stringBuilder = new StringBuilder();
SortedMap<String, String> paramMap = new TreeMap<>(parameters);
int index = 0;
for (Entry<String, String> entry : paramMap.entrySet()) {
stringBuilder.append(entry.getKey()).append("=").append(entry.getValue());
index++;
if (index != parameters.size()) {
stringBuilder.append("&");
}
}
return stringBuilder.toString();
}
}

View File

@ -0,0 +1,103 @@
package com.example.sso.util;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
public class FuWuuUil {
public static String select(String jsonBody) throws Exception {
SSLContext sslContext = createTrustAllSSLContext();
CloseableHttpClient httpClient = createHttpClient(sslContext);
// 创建 POST 请求对象
HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/list");
String responseBody = null;
try {
// 设置请求头
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行请求,获取响应对象
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
// 从响应对象中获取响应实体
HttpEntity responseEntity = response.getEntity();
// 处理响应数据
responseBody = EntityUtils.toString(responseEntity);
} finally {
// 关闭响应对象
response.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 关闭 HttpClient
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return responseBody;
}
private static SSLContext createTrustAllSSLContext() throws Exception {
// 创建一个信任所有证书的 TrustManager
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
}
};
// 创建 SSL 上下文并初始化
SSLContext sslContext = SSLContexts.custom().build();
sslContext.init(null, trustAllCerts, null);
return sslContext;
}
private static CloseableHttpClient createHttpClient(SSLContext sslContext) {
// 创建 HttpClient 并设置信任所有证书的 SSL 上下文
return HttpClients.custom()
.setSSLContext(sslContext)
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
.build();
}
}

View File

@ -0,0 +1,278 @@
/*
package com.example.sso.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.Consts;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
import org.apache.tomcat.util.codec.binary.Base64;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.KeyManagementException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import static com.example.sso.util.HttpUtil.createIgnoreVerifySSL;
public class GetToken {
*
* 获取token
* @param args
* @throws Exception
public static void main(String[] args) throws Exception {
JSONObject initiator = new JSONObject();
JSONObject openid = new JSONObject();
openid.put("idType", "corp");
openid.put("openId", "a825f8de90314255a52c01364fab64bd");
initiator.put("initiator", openid);
initiator.put("signTaskSubject", "银建合同签署");
initiator.put("signTemplateId", "1703730023070189104");
initiator.put("businessId", "d9fc06c633be2b06b41bb5c3ba4874d6");
//参与方数组
JSONArray jsonArray = new JSONArray();
//actor个人对象
JSONObject actor = new JSONObject();
//actor详细信息个人
JSONObject actorlist = new JSONObject();
actorlist.put("actorId", "参与方2");
actorlist.put("actorType", "person");
actorlist.put("actorName", "ccc");
JSONArray permissions = new JSONArray();
permissions.add("sign");
actorlist.put("identNameForMatch", "李嘉卓");
actorlist.put("certType", "id_card");
actorlist.put("certNoForMatch", "130283199705306053");
actorlist.put("notifyAddress", "13672048916");
JSONArray notifyType = new JSONArray();
notifyType.add("start");
notifyType.add("finish");
actorlist.put("notifyType", notifyType);
actorlist.put("permissions", permissions);
actor.put("actor", actorlist);
//企业方对象
JSONObject actors = new JSONObject();
//actor详细信息企业
JSONObject actorlists = new JSONObject();
actorlists.put("actorId", "参与方1");
actorlists.put("actorType", "corp");
actorlists.put("actorName", "银建的士");
JSONArray permissionss = new JSONArray();
permissionss.add("sign");
actorlists.put("permissions",permissionss);
actorlists.put("actorOpenId","a825f8de90314255a52c01364fab64bd");
actorlists.put("notifyAddress", "13520145209");
JSONArray notifyTypes = new JSONArray();
notifyTypes.add("start");
notifyTypes.add("finish");
actorlists.put("notifyType", notifyTypes);
JSONArray SignField = new JSONArray();
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("fieldDocId","79184091");
jsonObject2.put("sealId",1704289212889193190l);
SignField.add(jsonObject2);
JSONObject signConfigInfo = new JSONObject();
JSONObject signConfigInfos = new JSONObject();
signConfigInfos.put("requestVerifyFree",true);
signConfigInfo.put("signConfigInfo",signConfigInfo);
actors.put("actor",actorlists);
actors.put("signFields",SignField);
actors.put("signConfigInfo",signConfigInfos);
jsonArray.add(actor);
jsonArray.add(actors);
initiator.put("actors", jsonArray);
String jsonString = initiator.toJSONString();
String fdd = FDaDaUtil.fdd("https://uat-api.fadada.com/api/v5/sign-task/create-with-template", jsonString);
//JSONObject jsonObject = JSON.parseObject(fdd);
// JSONArray signTemplates = jsonObject.getJSONObject("data").getJSONArray("signTemplateName");
JSONObject jsonObject = JSON.parseObject(fdd);
String s = String.valueOf(jsonObject.getJSONObject("data"))
.getString("signTaskId")
;
System.out.println(s);
// System.out.println(jsonObject.getJSONObject("data").getJSONArray("signTemplates"));
}
public static byte[] hmac256(byte[] key, String msg) throws Exception {
Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(key, mac.getAlgorithm());
mac.init(secretKeySpec);
return mac.doFinal(msg.getBytes());
}
private static String Hmac256(String appSecret,String timestamp) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(appSecret.getBytes("utf-8"), "HmacSHA256");
sha256_HMAC.init(secretKey);
byte[] hash = sha256_HMAC.doFinal(timestamp.getBytes("utf-8"));
String encodeStr = Base64.encodeBase64String(hash);
String encodeStr16=byte2Hex(hash);
// System.out.println(byte2Hex());
System.out.println(encodeStr16);
return encodeStr16;
}
private static String Hmac256Test(String appSecret,String timestamp) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(appSecret.getBytes("utf-8"), "HmacSHA256");
sha256_HMAC.init(secretKey);
byte[] hash = sha256_HMAC.doFinal(timestamp.getBytes("utf-8"));
String encodeStr = Base64.encodeBase64String(hash);
String encodeStr16=byte2Hex(hash);
// System.out.println(byte2Hex());
System.out.println(encodeStr16);
return encodeStr16;
}
*
* 将byte转为16进制
*
* @param bytes
* @return
private static String byte2Hex(byte[] bytes) {
StringBuffer stringBuffer = new StringBuffer();
String temp = null;
for (int i = 0; i < bytes.length; i++) {
temp = Integer.toHexString(bytes[i] & 0xFF);
if (temp.length() == 1) {
//1得到一位的进行补0操作
stringBuffer.append("0");
}
stringBuffer.append(temp);
}
return stringBuffer.toString();
}
*
* sha256加密
*
* @param str 要加密的字符串
* @return 加密后的字符串
public static String getSha256Str(String str) {
MessageDigest messageDigest;
String encodeStr = "";
try {
messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(str.getBytes(StandardCharsets.UTF_8));
encodeStr = byte2Hex(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return encodeStr;
}
public static String sendPost() throws KeyManagementException, NoSuchAlgorithmException {
//时间戳
String timestamp = Long.toString(System.currentTimeMillis());
//uuid
String nonce = UUIDGenerator.getUuid();
//采用绕过验证的方式处理https请求
SSLContext sslcontext = createIgnoreVerifySSL();
// 设置协议http和https对应的处理socket链接工厂的对象
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.INSTANCE)
.register("https", new SSLConnectionSocketFactory(sslcontext))
.build();
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connManager).build();
String result = null;
// 字符串编码
StringEntity entity = new StringEntity("{\"ownerId\":{\"idType\":\"corp\",\"openId\":\"a825f8de90314255a52c01364fab64bd\"}}", Consts.UTF_8);
// 设置content-type
entity.setContentType("application/x-www-form-urlencoded");
HttpPost httpPost = new HttpPost("https://uat-api.fadada.com/api/v5/sign-template/get-list");
// 防止被当成攻击添加的
httpPost.setHeader("X-FASC-App-Id", "80000693");
httpPost.setHeader("X-FASC-Sign-Type", "HMAC-SHA256");
httpPost.setHeader("X-FASC-Sign", "e65c344985464465afeda1a90c83a2ed6ef5d79d50f90d2ff3cc03f2601e7477");
httpPost.setHeader("X-FASC-Timestamp", timestamp);
httpPost.setHeader("X-FASC-Nonce", nonce);
httpPost.setHeader("X-FASC-AccessToken", "1b2f65390bc0463c84c1c7ea3caf1d0e");
httpPost.setHeader("X-FASC-Api-SubVersion", "5.1");
httpPost.setHeader("Content-Type","application/x-www-form-urlencoded");
// 接收参数设置
httpPost.setHeader("Accept", "application/json");
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpClient.execute(httpPost);
org.apache.http.HttpEntity httpEntity = response.getEntity();
result = EntityUtils.toString(httpEntity);
} catch (IOException e) {
// // log.error(e.getMessage());
} finally {
// 关闭CloseableHttpResponse
if (response != null) {
try {
response.close();
} catch (IOException e) {
// // log.error(e.getMessage());
}
}
}
return result;
}
}
*/

View File

@ -0,0 +1,176 @@
package com.example.sso.util;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
/** * Http工具类发送Http请求 Get请求请将参数放在url中 Post请求请将参数放在Map中 * * @author 程高伟 * @date 2017年1月5日 下午6:03:50 */
public class HttpUtil {
// private static final Logger log = LoggerFactory.getLogger(HttpUtil.class);
private static final CloseableHttpClient httpclient = HttpClients.createDefault();
private static final String userAgent = "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.87 Safari/537.36";
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext sc = SSLContext.getInstance("SSLv3");
// 实现一个X509TrustManager接口用于绕过验证不用修改里面的方法
X509TrustManager trustManager = new X509TrustManager() {
@Override
public void checkClientTrusted(
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
String paramString) throws CertificateException {
}
@Override
public void checkServerTrusted(
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
String paramString) throws CertificateException {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
sc.init(null, new TrustManager[] { trustManager }, null);
return sc;
}
public static String sendPosts(String url, String jsonStr) throws KeyManagementException, NoSuchAlgorithmException {
//采用绕过验证的方式处理https请求
SSLContext sslcontext = createIgnoreVerifySSL();
// 设置协议http和https对应的处理socket链接工厂的对象
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.INSTANCE)
.register("https", new SSLConnectionSocketFactory(sslcontext))
.build();
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connManager).build();
String result = null;
// 字符串编码
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
// 设置content-type
entity.setContentType("application/json");
HttpPost httpPost = new HttpPost(url);
// 防止被当成攻击添加的
httpPost.setHeader("Authorization", "Bearer "+"BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
// 接收参数设置
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpClient.execute(httpPost);
HttpEntity httpEntity = response.getEntity();
result = EntityUtils.toString(httpEntity);
} catch (IOException e) {
// log.error(e.getMessage());
} finally {
// 关闭CloseableHttpResponse
if (response != null) {
try {
response.close();
} catch (IOException e) {
// log.error(e.getMessage());
}
}
}
System.out.println(result);
return result;
}
/*
POST请求。获取token
*/
public static String sendPost(String url) throws Exception {
String result = null;
String appSecret = "0WPTPAJKWRULHJ9BGBCZGWGLNZRHY5HD";
String nonce = UUIDGenerator.getUuid();
String timestamp = Long.toString(System.currentTimeMillis());
Map<String, String> paramMap = new HashMap<>();
paramMap.put("X-FASC-App-Id", "00000916");
paramMap.put("X-FASC-Sign-Type", "HMAC-SHA256");
paramMap.put("X-FASC-Timestamp", timestamp);
paramMap.put("X-FASC-Nonce", nonce);
paramMap.put("X-FASC-Grant-Type", "client_credential");
paramMap.put("X-FASC-Api-SubVersion", "5.1");
String paramToSignStr = FddCryptUtil.sortParameters(paramMap);
String signature = FddCryptUtil.sign(paramToSignStr, timestamp, appSecret);
// System.out.println("签名值为================="+signature);
// 得到一个HttpPost对象
HttpPost httpPost = new HttpPost(url);
// 防止被当成攻击添加的
httpPost.setHeader("User-Agent", userAgent);
httpPost.setHeader("X-FASC-App-Id","00000916");
httpPost.setHeader("X-FASC-Sign-Type","HMAC-SHA256");
httpPost.setHeader("X-FASC-Sign",signature);
httpPost.setHeader("X-FASC-Timestamp",timestamp);
httpPost.setHeader("X-FASC-Nonce",nonce);
httpPost.setHeader("X-FASC-Grant-Type","client_credential");
httpPost.setHeader("X-FASC-Api-SubVersion","5.1");
CloseableHttpResponse response = null;
try {
// 执行HttpPost请求并得到一个CloseableHttpResponse
response = httpclient.execute(httpPost);
// 从CloseableHttpResponse中拿到HttpEntity
HttpEntity entity = response.getEntity();
// 将HttpEntity转换为字符串
result = EntityUtils.toString(entity);
} catch (IOException e) {
// log.error(e.getMessage());
} finally {
// 关闭CloseableHttpResponse
if (response != null) {
try {
response.close();
} catch (IOException e) {
// log.error(e.getMessage());
}
}
}
return result;
}
}

View File

@ -0,0 +1,50 @@
package com.example.sso.util;
import java.util.Calendar;
public class TimeUtils {
public static Long tim(long currentTimestamp){
// 创建 Calendar 对象,并设置为当前时间
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(currentTimestamp);
// 将时间往前推 24 小时
calendar.add(Calendar.HOUR_OF_DAY, -24);
// 获取前24小时的时间戳
long previous24HoursTimestamp = calendar.getTimeInMillis();
return previous24HoursTimestamp;
}
public static Long tim4(long currentTimestamp){
// 创建 Calendar 对象,并设置为当前时间
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(currentTimestamp);
// 将时间往前推 24 小时
calendar.add(Calendar.HOUR_OF_DAY, -48);
// 获取前24小时的时间戳
long previous24HoursTimestamp = calendar.getTimeInMillis();
return previous24HoursTimestamp;
}
public static Long tim2(long currentTimestamp){
// 创建 Calendar 对象,并设置为当前时间
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(currentTimestamp);
// 将时间往前推 24 小时
calendar.add(Calendar.HOUR_OF_DAY, -120);
// 获取前24小时的时间戳
long previous24HoursTimestamp = calendar.getTimeInMillis();
return previous24HoursTimestamp;
}
}

View File

@ -0,0 +1,45 @@
/**
* com.yq365.utils.random
* UUIDGenetrator.java
*/
package com.example.sso.util;
import java.util.UUID;
/**
* @author Fadada
* 2021/9/8 16:09:38
*/
public class UUIDGenerator {
private UUIDGenerator() {
}
/**
* 获得一个UUID
*
* @return String UUID
*/
public static String getUuid() {
String s = UUID.randomUUID().toString();
//去掉“-”符号
return s.substring(0, 8) + s.substring(9, 13) + s.substring(14, 18) + s.substring(19, 23) + s.substring(24);
}
/**
* 获得指定数目的UUID
*
* @param number int 需要获得的UUID数量
* @return String[] UUID数组
*/
public static String[] getUuid(int number) {
if (number < 1) {
return new String[0];
}
String[] ss = new String[number];
for (int i = 0; i < number; i++) {
ss[i] = getUuid();
}
return ss;
}
}

View File

@ -0,0 +1,190 @@
package com.example.sso.util;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class V5utils {
/*
查询多条数据
*/
public static String list(String jsonBody){
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建 POST 请求对象
HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/list");
String responseBody = null;
try {
// 设置请求头
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行请求,获取响应对象
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
// 从响应对象中获取响应实体
HttpEntity responseEntity = response.getEntity();
// 处理响应数据
responseBody = EntityUtils.toString(responseEntity);
System.out.println(responseBody);
} finally {
// 关闭响应对象
response.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 关闭 HttpClient
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return responseBody;
}
public static String delete(String jsonBody){
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建 POST 请求对象
HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/delete");
String responseBody = null;
try {
// 设置请求头
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行请求,获取响应对象
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
// 从响应对象中获取响应实体
HttpEntity responseEntity = response.getEntity();
// 处理响应数据
responseBody = EntityUtils.toString(responseEntity);
System.out.println(responseBody);
} finally {
// 关闭响应对象
response.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 关闭 HttpClient
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return responseBody;
}
//新增
public static String add(String jsonBody){
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建 POST 请求对象
HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/create");
String responseBody = null;
try {
// 设置请求头
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行请求,获取响应对象
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
// 从响应对象中获取响应实体
HttpEntity responseEntity = response.getEntity();
// 处理响应数据
responseBody = EntityUtils.toString(responseEntity);
System.out.println(responseBody);
} finally {
// 关闭响应对象
response.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 关闭 HttpClient
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return responseBody;
}
public static String updata(String jsonBody){
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建 POST 请求对象
HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/update");
String responseBody = null;
try {
// 设置请求头
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex");
StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行请求,获取响应对象
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
// 从响应对象中获取响应实体
HttpEntity responseEntity = response.getEntity();
// 处理响应数据
responseBody = EntityUtils.toString(responseEntity);
System.out.println(responseBody);
} finally {
// 关闭响应对象
response.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 关闭 HttpClient
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return responseBody;
}
}

View File

@ -0,0 +1,11 @@
sso:
acs: https://www.jiandaoyun.com/sso/custom/59bb7045f3b3ab31f241bbf1/acs
secret:
fdd:
AppID: 80000693
AppSecret: IZRCNUH7GBDBDFPLRNJYBTVYDIVYTWGL
server:
port: 8082
#正式环境
# port: 8080
#测试环境

View File

@ -0,0 +1,27 @@
package com.example.sso;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
//import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@SpringBootTest
class SsoApplicationTests {
// @Test
void context() {
String json = "[{\"name\":\"1111\",\"code\":\"123\"},{\"name\":\"1111\",\"code\":\"123\"},{\"name\":\"1234\",\"code\":\"111\"}]";
List list = JSONObject.parseArray(json);
HashSet hs = new HashSet(list);
String jsonSet = JSON.toJSONString(hs);
JSONArray newjsonarray= new JSONArray(Collections.singletonList(jsonSet));
System.out.println(newjsonarray);
}
}