Browse Source

feat: 短信验证码发送服务迁移至此

duluosheng 3 months ago
parent
commit
9e904d40dc
55 changed files with 975 additions and 552 deletions
  1. 4 3
      .gitignore
  2. BIN
      .gradle/6.1.1/executionHistory/executionHistory.bin
  3. BIN
      .gradle/6.1.1/executionHistory/executionHistory.lock
  4. BIN
      .gradle/6.1.1/fileChanges/last-build.bin
  5. BIN
      .gradle/6.1.1/fileHashes/fileHashes.bin
  6. BIN
      .gradle/6.1.1/fileHashes/fileHashes.lock
  7. 0 0
      .gradle/6.1.1/gc.properties
  8. BIN
      .gradle/buildOutputCleanup/buildOutputCleanup.lock
  9. 0 2
      .gradle/buildOutputCleanup/cache.properties
  10. BIN
      .gradle/buildOutputCleanup/outputFiles.bin
  11. BIN
      .gradle/checksums/checksums.lock
  12. BIN
      .gradle/checksums/md5-checksums.bin
  13. BIN
      .gradle/checksums/sha1-checksums.bin
  14. 0 0
      .gradle/vcs-1/gc.properties
  15. 9 9
      build.gradle
  16. 0 6
      gradle/wrapper/gradle-wrapper.properties
  17. 0 183
      gradlew
  18. 0 100
      gradlew.bat
  19. 8 4
      src/main/java/com/finogeeks/swan/hxaccountsync/client/AdviserZoneClient.java
  20. 2 5
      src/main/java/com/finogeeks/swan/hxaccountsync/client/ContactClient.java
  21. 0 1
      src/main/java/com/finogeeks/swan/hxaccountsync/client/StaffClient.java
  22. 23 0
      src/main/java/com/finogeeks/swan/hxaccountsync/config/WsdlConfig.java
  23. 11 12
      src/main/java/com/finogeeks/swan/hxaccountsync/controllers/BindingController.java
  24. 1 1
      src/main/java/com/finogeeks/swan/hxaccountsync/controllers/JobController.java
  25. 105 0
      src/main/java/com/finogeeks/swan/hxaccountsync/controllers/SmsController.java
  26. 24 24
      src/main/java/com/finogeeks/swan/hxaccountsync/domain/Customer.java
  27. 66 65
      src/main/java/com/finogeeks/swan/hxaccountsync/domain/CustomerBinding.java
  28. 0 1
      src/main/java/com/finogeeks/swan/hxaccountsync/domain/TetgCpGpcZx.java
  29. 5 2
      src/main/java/com/finogeeks/swan/hxaccountsync/domain/TetgCpJgZx.java
  30. 13 0
      src/main/java/com/finogeeks/swan/hxaccountsync/entity/SmsReq.java
  31. 6 9
      src/main/java/com/finogeeks/swan/hxaccountsync/entity/StaffDto.java
  32. 0 2
      src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/BindingKafkaMsg.java
  33. 2 2
      src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/CustomerBindingInfo.java
  34. 0 12
      src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/CustomerBindingJoin.java
  35. 16 14
      src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/StaffBindingRes.java
  36. 3 4
      src/main/java/com/finogeeks/swan/hxaccountsync/repositories/CustomerBindingRepository.java
  37. 0 3
      src/main/java/com/finogeeks/swan/hxaccountsync/repositories/CustomerRepository.java
  38. 2 0
      src/main/java/com/finogeeks/swan/hxaccountsync/repositories/CustomerWXRepository.java
  39. 1 0
      src/main/java/com/finogeeks/swan/hxaccountsync/repositories/TetgCpCpfldyRepository.java
  40. 1 0
      src/main/java/com/finogeeks/swan/hxaccountsync/repositories/TetgCpGpcZxRepository.java
  41. 1 0
      src/main/java/com/finogeeks/swan/hxaccountsync/repositories/TetgCpJgZxRepository.java
  42. 1 1
      src/main/java/com/finogeeks/swan/hxaccountsync/repositories/mongo/UacCustomerDao.java
  43. 54 55
      src/main/java/com/finogeeks/swan/hxaccountsync/services/AccountJob.java
  44. 1 2
      src/main/java/com/finogeeks/swan/hxaccountsync/services/UacSchedule.java
  45. 52 0
      src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/CallWS.java
  46. 51 0
      src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/CallWSResponse.java
  47. 41 0
      src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/ObjectFactory.java
  48. 200 0
      src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/SendSmsService.java
  49. 33 0
      src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/SmsService.java
  50. 77 0
      src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/SmsServiceService.java
  51. 94 0
      src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/TokenService.java
  52. 16 21
      src/main/java/com/finogeeks/swan/hxaccountsync/util/Html2Text.java
  53. 7 7
      src/main/java/com/finogeeks/swan/hxaccountsync/util/ServiceUtil.java
  54. 37 0
      src/main/java/com/finogeeks/swan/hxaccountsync/util/SpringContextUtil.java
  55. 8 2
      src/main/resources/application.properties

+ 4 - 3
.gitignore

@@ -12,7 +12,8 @@
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*
 
-/.gradle/
+/.gradle/*
 /.idea/
-/gradle/
-/gradle/
+/gradle/*
+gradlew
+gradlew.bat

BIN
.gradle/6.1.1/executionHistory/executionHistory.bin


BIN
.gradle/6.1.1/executionHistory/executionHistory.lock


BIN
.gradle/6.1.1/fileChanges/last-build.bin


BIN
.gradle/6.1.1/fileHashes/fileHashes.bin


BIN
.gradle/6.1.1/fileHashes/fileHashes.lock


+ 0 - 0
.gradle/6.1.1/gc.properties


BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 0 - 2
.gradle/buildOutputCleanup/cache.properties

@@ -1,2 +0,0 @@
-#Tue Aug 11 14:53:17 CST 2020
-gradle.version=6.1.1

BIN
.gradle/buildOutputCleanup/outputFiles.bin


BIN
.gradle/checksums/checksums.lock


BIN
.gradle/checksums/md5-checksums.bin


BIN
.gradle/checksums/sha1-checksums.bin


+ 0 - 0
.gradle/vcs-1/gc.properties


+ 9 - 9
build.gradle

@@ -21,15 +21,15 @@ repositories {
 }
 
 dependencies {
-    implementation  'org.springframework.boot:spring-boot-starter-data-jpa'
-    implementation  'org.springframework.boot:spring-boot-starter-data-rest'
-    implementation  'org.springframework.boot:spring-boot-starter-web'
-
-    implementation  group: 'com.google.guava', name: 'guava', version: '29.0-jre'
-    implementation  group: 'commons-io', name: 'commons-io', version: '2.7'
-    implementation  group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
-
-    implementation  fileTree(dir: 'libs', include: ['*.jar'])
+    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
+    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
+    implementation 'org.springframework.boot:spring-boot-starter-web'
+    implementation group: 'dom4j', name: 'dom4j', version: '1.6.1'
+    implementation group: 'com.google.guava', name: 'guava', version: '29.0-jre'
+    implementation group: 'commons-io', name: 'commons-io', version: '2.7'
+    implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
+
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
 
     testImplementation('org.springframework.boot:spring-boot-starter-test') {
         exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'

+ 0 - 6
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +0,0 @@
-#Wed Aug 12 14:18:03 CST 2020
-distributionUrl=/gradle-6.1.1-all.zip
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME

+ 0 - 183
gradlew

@@ -1,183 +0,0 @@
-#!/usr/bin/env sh
-
-#
-# Copyright 2015 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.
-#
-
-##############################################################################
-##
-##  Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-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
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
-    echo "$*"
-}
-
-die () {
-    echo
-    echo "$*"
-    echo
-    exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
-  CYGWIN* )
-    cygwin=true
-    ;;
-  Darwin* )
-    darwin=true
-    ;;
-  MINGW* )
-    msys=true
-    ;;
-  NONSTOP* )
-    nonstop=true
-    ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-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
-    if [ ! -x "$JAVACMD" ] ; then
-        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-    fi
-else
-    JAVACMD="java"
-    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
-    MAX_FD_LIMIT=`ulimit -H -n`
-    if [ $? -eq 0 ] ; then
-        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
-            MAX_FD="$MAX_FD_LIMIT"
-        fi
-        ulimit -n $MAX_FD
-        if [ $? -ne 0 ] ; then
-            warn "Could not set maximum file descriptor limit: $MAX_FD"
-        fi
-    else
-        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
-    fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
-    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
-    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
-    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-    JAVACMD=`cygpath --unix "$JAVACMD"`
-
-    # We build the pattern for arguments to be converted via cygpath
-    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
-    SEP=""
-    for dir in $ROOTDIRSRAW ; do
-        ROOTDIRS="$ROOTDIRS$SEP$dir"
-        SEP="|"
-    done
-    OURCYGPATTERN="(^($ROOTDIRS))"
-    # Add a user-defined pattern to the cygpath arguments
-    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
-        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
-    fi
-    # Now convert the arguments - kludge to limit ourselves to /bin/sh
-    i=0
-    for arg in "$@" ; do
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
-        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
-
-        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
-            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
-        else
-            eval `echo args$i`="\"$arg\""
-        fi
-        i=`expr $i + 1`
-    done
-    case $i in
-        0) set -- ;;
-        1) set -- "$args0" ;;
-        2) set -- "$args0" "$args1" ;;
-        3) set -- "$args0" "$args1" "$args2" ;;
-        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
-        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
-    esac
-fi
-
-# Escape application args
-save () {
-    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
-    echo " "
-}
-APP_ARGS=`save "$@"`
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-exec "$JAVACMD" "$@"

+ 0 - 100
gradlew.bat

@@ -1,100 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem 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, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem  Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega

+ 8 - 4
src/main/java/com/finogeeks/swan/hxaccountsync/client/AdviserZoneClient.java

@@ -1,7 +1,10 @@
 package com.finogeeks.swan.hxaccountsync.client;
 
 import com.alibaba.fastjson.JSONObject;
-import com.finogeeks.swan.hxaccountsync.entity.*;
+import com.finogeeks.swan.hxaccountsync.entity.AddArticleReq;
+import com.finogeeks.swan.hxaccountsync.entity.AddCategoryReq;
+import com.finogeeks.swan.hxaccountsync.entity.AdviserZonePageResponse;
+import com.finogeeks.swan.hxaccountsync.entity.GetCategoryRes;
 import com.finogeeks.swan.hxaccountsync.exception.ServiceException;
 import com.finogeeks.swan.hxaccountsync.util.DataConverterUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -15,7 +18,6 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 
-import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -47,7 +49,8 @@ public class AdviserZoneClient {
         HttpHeaders headers = new HttpHeaders();
         headers.add("X-Consumer-Custom-ID", operator);
         headers.add("X-Consumer-Merchant-ID", mid);
-        ParameterizedTypeReference<AdviserZonePageResponse<GetCategoryRes>> typeRef = new ParameterizedTypeReference<AdviserZonePageResponse<GetCategoryRes>>() {};
+        ParameterizedTypeReference<AdviserZonePageResponse<GetCategoryRes>> typeRef = new ParameterizedTypeReference<AdviserZonePageResponse<GetCategoryRes>>() {
+        };
         ResponseEntity<AdviserZonePageResponse<GetCategoryRes>> responseEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<String>(headers), typeRef);
         if (!responseEntity.getStatusCode().is2xxSuccessful()) {
             throw new ServiceException(responseEntity.getStatusCode(), "FC_ERROR", "查询文章栏目错误");
@@ -74,7 +77,8 @@ public class AdviserZoneClient {
         HttpHeaders headers = new HttpHeaders();
         headers.add("X-Consumer-Custom-ID", operator);
         headers.add("X-Consumer-Merchant-ID", mid);
-        ParameterizedTypeReference<AdviserZonePageResponse<Object>> typeRef = new ParameterizedTypeReference<AdviserZonePageResponse<Object>>() {};
+        ParameterizedTypeReference<AdviserZonePageResponse<Object>> typeRef = new ParameterizedTypeReference<AdviserZonePageResponse<Object>>() {
+        };
         ResponseEntity<AdviserZonePageResponse<Object>> responseEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<String>(headers), typeRef);
         if (!responseEntity.getStatusCode().is2xxSuccessful()) {
             throw new ServiceException(responseEntity.getStatusCode(), "FC_ERROR", "查询文章错误");

+ 2 - 5
src/main/java/com/finogeeks/swan/hxaccountsync/client/ContactClient.java

@@ -1,12 +1,10 @@
 package com.finogeeks.swan.hxaccountsync.client;
 
-import com.finogeeks.swan.hxaccountsync.entity.*;
+import com.finogeeks.swan.hxaccountsync.entity.StaffDto;
 import com.finogeeks.swan.hxaccountsync.exception.ServiceException;
-import com.finogeeks.swan.hxaccountsync.util.DataConverterUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.ParameterizedTypeReference;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
@@ -16,7 +14,6 @@ import org.springframework.web.client.RestTemplate;
 
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 /**
  * @author loki guo
@@ -43,7 +40,7 @@ public class ContactClient {
     }
 
     public List<StaffDto> getStaffList() {
-        String url = baseUrl + BASE_URI_PREFIX + "/staff/" + superStaff  + "?jwt=" + jwt;
+        String url = baseUrl + BASE_URI_PREFIX + "/staff/" + superStaff + "?jwt=" + jwt;
         HttpHeaders headers = new HttpHeaders();
         headers.add("X-Consumer-Custom-ID", superStaff);
         headers.add("X-Consumer-Merchant-ID", mid);

+ 0 - 1
src/main/java/com/finogeeks/swan/hxaccountsync/client/StaffClient.java

@@ -14,7 +14,6 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 

+ 23 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/config/WsdlConfig.java

@@ -0,0 +1,23 @@
+package com.finogeeks.swan.hxaccountsync.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+
+@Configuration
+@EnableCaching
+@PropertySource("classpath:application.properties")
+public class WsdlConfig {
+
+    @Value("${kunlun.sms.url}")
+    private String smsWsdl;
+
+    public String getSmsWsdl() {
+        return smsWsdl;
+    }
+
+    public void setSmsWsdl(String deptWsdl) {
+        this.smsWsdl = deptWsdl;
+    }
+}

+ 11 - 12
src/main/java/com/finogeeks/swan/hxaccountsync/controllers/BindingController.java

@@ -28,16 +28,15 @@ import java.util.stream.Collectors;
 
 @Slf4j
 @RestController
-@RequestMapping("/binding")
+@RequestMapping("/api/v1/swan/kl-account-service/binding")
 public class BindingController {
 
-    @Value("${commonStaff}")
-    private String commonStaff;
-
     private final CustomerBindingRepository customerWXBindingRepository;
     private final CustomerRepository customerRepository;
     private final CustomerBindingInfoDao customerBindingInfoDao;
     private final CustomerWXRepository customerWXRepository;
+    @Value("${commonStaff}")
+    private String commonStaff;
 
     @Autowired
     public BindingController(CustomerBindingRepository customerWXBindingRepository, CustomerRepository customerRepository, CustomerBindingInfoDao customerBindingInfoDao, CustomerWXRepository customerWXRepository) {
@@ -75,13 +74,13 @@ public class BindingController {
         //通过unionId获取eno
         List<CustomerWX> wxs = customerWXRepository.findByUnionId(id);
         if (wxs == null || wxs.isEmpty()) {
-            return new BindingRes(bindStaff, commonStaff, "","POTENTIAL","");
+            return new BindingRes(bindStaff, commonStaff, "", "POTENTIAL", "");
         }
         CustomerWX wx = wxs.get(0);
         //通过eno获取到cust_no
         Customer c = customerRepository.findByEno(wx.getEno()).orElse(null);
         if (c == null) {
-            return new BindingRes(bindStaff, commonStaff, "","POTENTIAL","");
+            return new BindingRes(bindStaff, commonStaff, "", "POTENTIAL", "");
         }
 
         List<String> staffs = customerWXBindingRepository.findByCustNo(c.getCustId())
@@ -91,22 +90,22 @@ public class BindingController {
                 .collect(Collectors.toList());
 
         CustomerBindingInfo cus;
-        if(!useFcid) {
+        if (!useFcid) {
             cus = customerBindingInfoDao.findAllByUnionId(id).orElse(new CustomerBindingInfo());
-        }else {
+        } else {
             cus = customerBindingInfoDao.findAllByRetailId(id).orElse(new CustomerBindingInfo());
         }
 
         String type = "INDEPENDENT";
-        if(StringUtils.isEmpty(c.getFundId())) {
+        if (StringUtils.isEmpty(c.getFundId())) {
             type = "POTENTIAL";
         }
-        if(!StringUtils.isEmpty(c.getFundId()) && cus.getBinding() != null && cus.getBinding().contains(staffId)) {
+        if (!StringUtils.isEmpty(c.getFundId()) && cus.getBinding() != null && cus.getBinding().contains(staffId)) {
             type = "OWN";
-        }else if(!StringUtils.isEmpty(c.getFundId()) && cus.getBinding() != null && !cus.getBinding().isEmpty()){
+        } else if (!StringUtils.isEmpty(c.getFundId()) && cus.getBinding() != null && !cus.getBinding().isEmpty()) {
             type = "OTHERS";
         }
-        return new BindingRes(staffs, commonStaff, c.getFundId(), type,c.getName());
+        return new BindingRes(staffs, commonStaff, c.getFundId(), type, c.getName());
     }
 
     /**

+ 1 - 1
src/main/java/com/finogeeks/swan/hxaccountsync/controllers/JobController.java

@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Slf4j
 @RestController
-@RequestMapping("/oa")
+@RequestMapping("/api/v1/swan/kl-account-service/oa")
 public class JobController {
     private final AccountJob accountJob;
     private final UacSchedule uacSchedule;

+ 105 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/controllers/SmsController.java

@@ -0,0 +1,105 @@
+package com.finogeeks.swan.hxaccountsync.controllers;
+
+import com.finogeeks.swan.hxaccountsync.client.RightResponse;
+import com.finogeeks.swan.hxaccountsync.entity.SmsReq;
+import com.finogeeks.swan.hxaccountsync.exception.ServiceException;
+import com.finogeeks.swan.hxaccountsync.services.sms.SendSmsService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+@Slf4j
+@RestController
+@RequestMapping("/api/v1/swan/sms")
+public class SmsController {
+    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+    private static final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
+
+    @Value("${kunlun.sms.transSource}")
+    private String transSource;
+
+    @Value("${kunlun.sms.userId}")
+    private String userId;
+
+    @Value("${kunlun.sms.templateId}")
+    private String templateId;
+
+
+    /**
+     * @api {POST} /api/v1/swan/sms/login [S/S]  昆仑保险 - 发送登入短信验证码
+     * @apiGroup kunlun-sms
+     * @apiVersion __API_VERSION__
+     * @apiPrivate
+     * @apiParam (RequestBody) {string}    phone   手机号
+     * @apiParam (RequestBody) {string}    code    验证码
+     * @apiSuccessExample {json} Success Status:
+     * HTTP/1.1 200
+     * <pre>
+     *   {
+     *      "result": "success"
+     *   }
+     * </pre>
+     * @apiErrorExample Error Status:
+     * HTTP/1.1 500
+     */
+    @PostMapping("/login")
+    public RightResponse sendLoginSMS(@RequestBody SmsReq req) {
+        if (StringUtils.isEmpty(req.getPhone())) {
+            throw new ServiceException(HttpStatus.BAD_REQUEST, "SWAN_ERROR", "手机号为空");
+        }
+
+        if (StringUtils.isEmpty(req.getCode())) {
+            throw new ServiceException(HttpStatus.BAD_REQUEST, "SWAN_ERROR", "验证码为空");
+        }
+
+        log.debug("send login sms to: " + req.getPhone() + ", " + req.getCode());
+
+        //基本信息
+        String reqSeq = UUID.randomUUID().toString();//ITSM短信发送批号
+        String completeDateBegin = dateFormat.format(new Date());//要求发送完成的开始日期
+        String completeDateEnd = dateFormat.format(new Date());//要求发送完成的结束日期
+        String completeTimeBegin = "0";//要求完成的开始时间(分钟数)0代表:00:00 1439代表:23:59
+        String completeTimeEnd = "1439";//要求完成的结束时间(分钟数)0代表:00:00 1439代表:23:59
+        Map<String, String> reqSeqIdMobileMap = new HashMap<>();
+        Map<String, Map<String, String>> reqSeqIdParameterMap = new HashMap<>();
+
+        //2、准备参数
+        //发送一条短信
+        String reqSeqId = UUID.randomUUID().toString();//每条短信明显id
+        Map<String, String> parameterMap = new HashMap<>();
+        parameterMap.put("code", req.getCode());
+        parameterMap.put("effectiveTime", "2");
+        reqSeqIdMobileMap.put(reqSeqId, req.getPhone());
+        reqSeqIdParameterMap.put(reqSeqId, parameterMap);
+        //如果一个批次需要发送多条短信,请参考发送单条进行调整(略)
+
+        //3、发送短信
+        String res = SendSmsService.sendSms(transSource,
+                userId,
+                reqSeq,
+                templateId,
+                completeDateBegin,
+                completeDateEnd,
+                completeTimeBegin,
+                completeTimeEnd,
+                reqSeqIdMobileMap,
+                reqSeqIdParameterMap);
+
+        if (res != null && res.contains("提交成功")) {
+            return new RightResponse("success");
+        } else {
+            throw new ServiceException(HttpStatus.BAD_REQUEST, "SWAN_ERROR", "验证码发送失败");
+        }
+    }
+}

+ 24 - 24
src/main/java/com/finogeeks/swan/hxaccountsync/domain/Customer.java

@@ -10,30 +10,30 @@ import javax.persistence.Table;
 /**
  * create table T_E_ACCOUNT
  * (
- *   ID           NUMBER(15) not null,
- *   ENO          NUMBER(20) not null,
- *   TEL          VARCHAR2(12),
- *   USER_ID      VARCHAR2(40),
- *   CUSTID       VARCHAR2(12),
- *   FUNDID       CHAR(12),
- *   CCID         NUMBER(16),
- *   UNIONID      VARCHAR2(128),
- *   NAME         VARCHAR2(32),
- *   AVATAR       VARCHAR2(256),
- *   NICKNAME     VARCHAR2(50),
- *   STATUS       NUMBER(1),
- *   AC_STATUS    NUMBER(1),
- *   PWD          VARCHAR2(128),
- *   GESTURES_PWD VARCHAR2(50),
- *   SOURCE       VARCHAR2(32),
- *   BRANCH       NUMBER(8),
- *   UPDATE_DATE  VARCHAR2(20) not null,
- *   CREATE_DATE  VARCHAR2(20) not null,
- *   AID_FUNDID   VARCHAR2(200),
- *   CRD_FUNDID   CHAR(12),
- *   RATING_LVL   NUMBER(1),
- *   AVATAR_NEW   VARCHAR2(256),
- *   USER_SLOGAN  VARCHAR2(100)
+ * ID           NUMBER(15) not null,
+ * ENO          NUMBER(20) not null,
+ * TEL          VARCHAR2(12),
+ * USER_ID      VARCHAR2(40),
+ * CUSTID       VARCHAR2(12),
+ * FUNDID       CHAR(12),
+ * CCID         NUMBER(16),
+ * UNIONID      VARCHAR2(128),
+ * NAME         VARCHAR2(32),
+ * AVATAR       VARCHAR2(256),
+ * NICKNAME     VARCHAR2(50),
+ * STATUS       NUMBER(1),
+ * AC_STATUS    NUMBER(1),
+ * PWD          VARCHAR2(128),
+ * GESTURES_PWD VARCHAR2(50),
+ * SOURCE       VARCHAR2(32),
+ * BRANCH       NUMBER(8),
+ * UPDATE_DATE  VARCHAR2(20) not null,
+ * CREATE_DATE  VARCHAR2(20) not null,
+ * AID_FUNDID   VARCHAR2(200),
+ * CRD_FUNDID   CHAR(12),
+ * RATING_LVL   NUMBER(1),
+ * AVATAR_NEW   VARCHAR2(256),
+ * USER_SLOGAN  VARCHAR2(100)
  * )
  */
 @Entity

+ 66 - 65
src/main/java/com/finogeeks/swan/hxaccountsync/domain/CustomerBinding.java

@@ -8,7 +8,6 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
 import java.sql.Date;
 import java.util.ArrayList;
 import java.util.List;
@@ -16,74 +15,94 @@ import java.util.stream.Collectors;
 
 /**
  * create table v_cust_rlt_query (
- *     RLT_ID NUMBER(19),        --关系ID
- * 	CUST_NO VARCHAR2(32),     -- 客户号
- * 	FUND_ACCOUNT VARCHAR2(32),-- 资金账号
- * 	MEMBER_ID NUMBER(19),     --员工编号
- * 	STF_ID  VARCHAR2(32),     --员工工号
- * 	MARKET_CODE VARCHAR2(32), --经纪人代码
- * 	RLT_TYPE VARCHAR2(2),     --关系类型
- * 	RLT_BEGIN_DATE DATE,      --关系建立日期
- * 	RLT_END_DATE DATE,        --关系结束日期
- * 	HANDLE_STATUS CHAR(1),    --处理状态 正常:0 锁定:1 删除 2 取非2的值
- *     PROD_ID VARCHAR2(32),     --产品编号
- *     PROD_NAME VARCHAR2(64),   --产品名称
- *     OAACCOUNT VARCHAR2(32),   --员工拼写
- *     BRANCH_NO NUMBER(19),     -- 客户营业部编号
- *     ORG_NAME VARCHAR2(32),    -- 客户营业部名称
- *     MEMBER_NAME VARCHAR2(32),     -- 员工姓名
- *     MEMBER_MOBILE VARCHAR2(32),   -- 员工手机
- *     CERTIFICATE VARCHAR2(64),     -- 员工执业证书
- *     MEMBER_BRANCH_NO NUMBER(19),  -- 员工营业部编号
- *     MEMBER_ORG_NAME VARCHAR2(64), -- 员工营业部名称
- *     STF_TYPE VARCHAR2(64)         -- 员工岗位
+ * RLT_ID NUMBER(19),        --关系ID
+ * CUST_NO VARCHAR2(32),     -- 客户号
+ * FUND_ACCOUNT VARCHAR2(32),-- 资金账号
+ * MEMBER_ID NUMBER(19),     --员工编号
+ * STF_ID  VARCHAR2(32),     --员工工号
+ * MARKET_CODE VARCHAR2(32), --经纪人代码
+ * RLT_TYPE VARCHAR2(2),     --关系类型
+ * RLT_BEGIN_DATE DATE,      --关系建立日期
+ * RLT_END_DATE DATE,        --关系结束日期
+ * HANDLE_STATUS CHAR(1),    --处理状态 正常:0 锁定:1 删除 2 取非2的值
+ * PROD_ID VARCHAR2(32),     --产品编号
+ * PROD_NAME VARCHAR2(64),   --产品名称
+ * OAACCOUNT VARCHAR2(32),   --员工拼写
+ * BRANCH_NO NUMBER(19),     -- 客户营业部编号
+ * ORG_NAME VARCHAR2(32),    -- 客户营业部名称
+ * MEMBER_NAME VARCHAR2(32),     -- 员工姓名
+ * MEMBER_MOBILE VARCHAR2(32),   -- 员工手机
+ * CERTIFICATE VARCHAR2(64),     -- 员工执业证书
+ * MEMBER_BRANCH_NO NUMBER(19),  -- 员工营业部编号
+ * MEMBER_ORG_NAME VARCHAR2(64), -- 员工营业部名称
+ * STF_TYPE VARCHAR2(64)         -- 员工岗位
  * )
  */
 @Entity
 @Table(name = "v_cust_rlt_query", schema = "OADATA")
 @Data
-public class CustomerBinding implements Comparable{
+public class CustomerBinding implements Comparable {
+    private static final List<String> sortSeq = new ArrayList<String>() {
+        {
+            add("8");
+            add("1");
+            add("27");
+            add("24");
+            add("25");
+            add("26");
+            add("22");
+            add("2");
+            add("12");
+            add("13");
+            add("14");
+            add("23");
+        }
+    };
     @Id
     @Column(name = "RLT_ID")
     private long id;   //RLT_ID NUMBER(19),        --关系ID
-
     @Column(name = "CUST_NO")
     private String custNo;  //CUST_NO VARCHAR2(32),     -- 客户号
-
     @Column(name = "FUND_ACCOUNT")
     private String fundAccount;  //FUND_ACCOUNT VARCHAR2(32),-- 资金账号
-
     @Column(name = "MEMBER_ID")
     private long memberId;  //MEMBER_ID NUMBER(19),     --员工编号
-
     @Column(name = "STF_ID")
     private String stfId;  //STF_ID  VARCHAR2(32),     --员工工号
-
     @Column(name = "MARKET_CODE")
     private String marketCode;  //MARKET_CODE VARCHAR2(32), --经纪人代码
-
     @Column(name = "RLT_TYPE")
     private String rltType; //RLT_TYPE VARCHAR2(2),     --关系类型
-
     @Column(name = "RLT_BEGIN_DATE")
     private Date rltBeginDate; //RLT_BEGIN_DATE DATE,      --关系建立日期
-
     @Column(name = "RLT_END_DATE")
     private Date rltEndDate; //RLT_END_DATE DATE,        --关系结束日期
-
     @Column(name = "HANDLE_STATUS")
     private String handleStatus; //HANDLE_STATUS CHAR(1),    --处理状态 正常:0 锁定:1 删除 2 取非2的值
-
     @Column(name = "OAACCOUNT")
     private String oaAccount;
 
-    private static final List<String> sortSeq = new ArrayList<String>(){
-        {
-            add("8");add("1");add("27");add("24");add("25");
-            add("26");add("22");add("2");add("12");add("13");
-            add("14");add("23");
-        }
-    };
+    public static void main(String[] args) {
+        CustomerBinding c1 = new CustomerBinding();
+        c1.setRltType("23");
+        CustomerBinding c2 = new CustomerBinding();
+        CustomerBinding c3 = new CustomerBinding();
+        c2.setRltType("8");
+        CustomerBinding c4 = new CustomerBinding();
+        CustomerBinding c5 = new CustomerBinding();
+        c5.setRltType("12");
+        c4.setRltType("12");
+        List<CustomerBinding> list = new ArrayList<CustomerBinding>() {
+            {
+                add(c1);
+                add(c2);
+                add(c3);
+                add(c4);
+                add(c5);
+            }
+        }.stream().sorted().collect(Collectors.toList());
+        System.out.println(DataConverterUtil.object2Json(list));
+    }
 
     /**
      * 8  开发客户关系
@@ -101,44 +120,26 @@ public class CustomerBinding implements Comparable{
      */
     @Override
     public int compareTo(Object o) {
-        if(StringUtils.isEmpty(rltType)) {
+        if (StringUtils.isEmpty(rltType)) {
             return 1;
         }
-        if(!(o instanceof CustomerBinding)) {
+        if (!(o instanceof CustomerBinding)) {
             return 1;
         }
 
-        if(StringUtils.isEmpty(((CustomerBinding) o).getRltType())){
-           return 1;
+        if (StringUtils.isEmpty(((CustomerBinding) o).getRltType())) {
+            return 1;
         }
-        if(sortSeq.indexOf(rltType) == sortSeq.indexOf(((CustomerBinding) o).getRltType())) {
-            if(rltBeginDate == null || ((CustomerBinding) o).getRltBeginDate() == null) {
+        if (sortSeq.indexOf(rltType) == sortSeq.indexOf(((CustomerBinding) o).getRltType())) {
+            if (rltBeginDate == null || ((CustomerBinding) o).getRltBeginDate() == null) {
                 return 0;
             }
             //type相等,用时间来比较
-            if(rltBeginDate.getTime() > ((CustomerBinding) o).rltBeginDate.getTime()){
+            if (rltBeginDate.getTime() > ((CustomerBinding) o).rltBeginDate.getTime()) {
                 return -1;
             }
             return 1;
         }
         return sortSeq.indexOf(rltType) - sortSeq.indexOf(((CustomerBinding) o).getRltType());
     }
-
-    public static void main(String[] args) {
-        CustomerBinding c1 = new CustomerBinding();
-        c1.setRltType("23");
-        CustomerBinding c2 = new CustomerBinding();
-        CustomerBinding c3 = new CustomerBinding();
-        c2.setRltType("8");
-        CustomerBinding c4 = new CustomerBinding();
-        CustomerBinding c5 = new CustomerBinding();
-        c5.setRltType("12");
-        c4.setRltType("12");
-        List<CustomerBinding> list = new ArrayList<CustomerBinding>(){
-            {
-                add(c1);add(c2);add(c3);add(c4);add(c5);
-            }
-        }.stream().sorted().collect(Collectors.toList());
-        System.out.println(DataConverterUtil.object2Json(list));
-    }
 }

+ 0 - 1
src/main/java/com/finogeeks/swan/hxaccountsync/domain/TetgCpGpcZx.java

@@ -6,7 +6,6 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import java.math.BigDecimal;
 import java.sql.Date;
 
 /**

+ 5 - 2
src/main/java/com/finogeeks/swan/hxaccountsync/domain/TetgCpJgZx.java

@@ -2,9 +2,12 @@ package com.finogeeks.swan.hxaccountsync.domain;
 
 import lombok.Data;
 
-import javax.persistence.*;
-import java.sql.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.math.BigDecimal;
+import java.sql.Date;
 
 /**
  * @author guorao

+ 13 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/entity/SmsReq.java

@@ -0,0 +1,13 @@
+package com.finogeeks.swan.hxaccountsync.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SmsReq {
+    private String phone;
+    private String code;
+}

+ 6 - 9
src/main/java/com/finogeeks/swan/hxaccountsync/entity/StaffDto.java

@@ -3,9 +3,6 @@ package com.finogeeks.swan.hxaccountsync.entity;
 import com.finogeeks.swan.hxaccountsync.domain.KlDept;
 import com.finogeeks.swan.hxaccountsync.domain.KlUser;
 import lombok.Data;
-import org.bson.BSONObject;
-import org.bson.conversions.Bson;
-import org.bson.types.ObjectId;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
@@ -95,28 +92,28 @@ public class StaffDto {
 
 
     public AddJobReq toJobReq(String staff) {
-        return new AddJobReq(position,staff);
+        return new AddJobReq(position, staff);
     }
 
     public KlUser toKlUser() {
-        return  null;
+        return null;
     }
 
     public List<KlDept> toklDept() {
         String[] split = StringUtils.split(groups, ",");
         String parentId = null;
-        List<KlDept> deptList=new ArrayList<>();
-        for(String groupName:split){
+        List<KlDept> deptList = new ArrayList<>();
+        for (String groupName : split) {
             KlDept klDept = new KlDept();
             klDept.setGroupName(groupName);
             String id = UUID.randomUUID().toString();
             klDept.setId(id);
             klDept.setDeptCode(groups);
             klDept.setParentId(parentId);
-            parentId=id;
+            parentId = id;
             deptList.add(klDept);
         }
-        this.groupId=parentId;
+        this.groupId = parentId;
         return deptList;
     }
 }

+ 0 - 2
src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/BindingKafkaMsg.java

@@ -5,8 +5,6 @@ import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
-import java.util.List;
-
 /**
  * @author roshan
  */

+ 2 - 2
src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/CustomerBindingInfo.java

@@ -38,11 +38,11 @@ public class CustomerBindingInfo {
     public static CustomerBindingInfo fromData(List<CustomerBindingJoin> data, String retailId) {
         CustomerBindingInfo info = new CustomerBindingInfo();
         info.setRetailId(retailId);
-        if(data == null || data.isEmpty()) {
+        if (data == null || data.isEmpty()) {
             return info;
         }
         val bindings = data.stream()
-                .filter(it->!StringUtils.isEmpty(it.getOaAccount()))
+                .filter(it -> !StringUtils.isEmpty(it.getOaAccount()))
                 .map((binding) -> ServiceUtil.formatFcid(binding.getOaAccount()))
 
                 .collect(Collectors.toList());

+ 0 - 12
src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/CustomerBindingJoin.java

@@ -1,18 +1,6 @@
 package com.finogeeks.swan.hxaccountsync.entity.binding;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.finogeeks.swan.hxaccountsync.util.DataConverterUtil;
 import lombok.Data;
-import org.springframework.util.StringUtils;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.sql.Date;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
 
 
 @Data

+ 16 - 14
src/main/java/com/finogeeks/swan/hxaccountsync/entity/binding/StaffBindingRes.java

@@ -6,16 +6,18 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.springframework.util.StringUtils;
 
-import javax.validation.constraints.NotNull;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
- *   {
- *       "binding": ["aaa"], //绑定客户
- *       "otherBinding":["aaa"], //他人客户
- *       "independent":["111"],//独立客户
- *       "target":["111"] //目标客户
- *   }
+ * {
+ * "binding": ["aaa"], //绑定客户
+ * "otherBinding":["aaa"], //他人客户
+ * "independent":["111"],//独立客户
+ * "target":["111"] //目标客户
+ * }
  */
 @NoArgsConstructor
 @AllArgsConstructor
@@ -27,19 +29,19 @@ public class StaffBindingRes {
     private Set<String> target = new HashSet<>();
 
     public void add(CustomerBindingInfo info, String staffId) {
-        if(info == null) {
+        if (info == null) {
             return;
         }
         List<String> b = info.getBinding();
-        if(b != null && b.contains(staffId)) {
+        if (b != null && b.contains(staffId)) {
             binding.add(info.getUnionId());
             return;
         }
-        if(b != null && !b.isEmpty() && !b.contains(staffId)) {
+        if (b != null && !b.isEmpty() && !b.contains(staffId)) {
             otherBinding.add(info.getUnionId());
             return;
         }
-        if(!StringUtils.isEmpty(info.getFundAccount())){
+        if (!StringUtils.isEmpty(info.getFundAccount())) {
             independent.add(info.getUnionId());
             return;
         }
@@ -47,8 +49,8 @@ public class StaffBindingRes {
     }
 
     public void fillTarget(String[] unionIds) {
-        Arrays.stream(unionIds).filter( it -> !binding.contains(it) &&
+        Arrays.stream(unionIds).filter(it -> !binding.contains(it) &&
                 !otherBinding.contains(it) && !independent.contains(it))
-                .forEach(it-> target.add(it));
+                .forEach(it -> target.add(it));
     }
 }

+ 3 - 4
src/main/java/com/finogeeks/swan/hxaccountsync/repositories/CustomerBindingRepository.java

@@ -1,10 +1,6 @@
 package com.finogeeks.swan.hxaccountsync.repositories;
 
 import com.finogeeks.swan.hxaccountsync.domain.CustomerBinding;
-import com.finogeeks.swan.hxaccountsync.entity.binding.CustomerBindingJoin;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.data.repository.query.Param;
@@ -14,8 +10,11 @@ import java.util.Map;
 
 public interface CustomerBindingRepository extends CrudRepository<CustomerBinding, Integer> {
     List<CustomerBinding> findByCustNo(String custNo);
+
     List<CustomerBinding> findByCustNoIn(List<String> custNos);
+
     List<CustomerBinding> findByOaAccount(String oaAccount);
+
     List<CustomerBinding> findByOaAccountAndCustNoIn(String oaAccount, List<String> custNo);
 
 

+ 0 - 3
src/main/java/com/finogeeks/swan/hxaccountsync/repositories/CustomerRepository.java

@@ -1,9 +1,6 @@
 package com.finogeeks.swan.hxaccountsync.repositories;
 
 import com.finogeeks.swan.hxaccountsync.domain.Customer;
-import com.finogeeks.swan.hxaccountsync.domain.CustomerWX;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
 import org.springframework.data.repository.CrudRepository;
 
 import java.util.List;

+ 2 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/repositories/CustomerWXRepository.java

@@ -10,6 +10,8 @@ import java.util.List;
 
 public interface CustomerWXRepository extends CrudRepository<CustomerWX, Integer> {
     Page<CustomerWX> findAll(Pageable pageable);
+
     List<CustomerWX> findByUnionId(String unionId);
+
     List<CustomerWX> findByUnionIdIn(String[] unionIds);
 }

+ 1 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/repositories/TetgCpCpfldyRepository.java

@@ -8,5 +8,6 @@ import java.util.List;
 
 public interface TetgCpCpfldyRepository extends CrudRepository<TetgCpCpfldy, Long> {
     List<TetgCpCpfldy> findByIdInAndCpzt(List<Long> cpzt, Long status);
+
     List<TetgCpCpfldy> findByIdIn(List<Long> cpzt);
 }

+ 1 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/repositories/TetgCpGpcZxRepository.java

@@ -12,6 +12,7 @@ import java.util.Map;
 
 public interface TetgCpGpcZxRepository extends CrudRepository<TetgCpGpcZx, Long> {
     List<TetgCpGpcZx> findByZt(Long zt, Sort sort);
+
     List<TetgCpGpcZx> findBySsflInAndZt(Long[] ssfl, Long zt, Sort sort);
 
     @Query(value = "" +

+ 1 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/repositories/TetgCpJgZxRepository.java

@@ -12,6 +12,7 @@ import java.util.Map;
 
 public interface TetgCpJgZxRepository extends CrudRepository<TetgCpJgZx, Long> {
     List<TetgCpJgZx> findByZt(Long zt, Sort sort);
+
     List<TetgCpJgZx> findBySsflInAndZt(Long[] ssfl, Long zt, Sort sort);
 
     @Query(value = "" +

+ 1 - 1
src/main/java/com/finogeeks/swan/hxaccountsync/repositories/mongo/UacCustomerDao.java

@@ -8,5 +8,5 @@ import org.springframework.data.mongodb.repository.MongoRepository;
 
 
 public interface UacCustomerDao extends MongoRepository<UacCustomer, String> {
-    Page<UacCustomer> findAllByAccountTypeOrderByOid(String accountType,Pageable pageable);
+    Page<UacCustomer> findAllByAccountTypeOrderByOid(String accountType, Pageable pageable);
 }

+ 54 - 55
src/main/java/com/finogeeks/swan/hxaccountsync/services/AccountJob.java

@@ -2,12 +2,10 @@ package com.finogeeks.swan.hxaccountsync.services;
 
 import com.finogeeks.swan.hxaccountsync.client.ContactClient;
 import com.finogeeks.swan.hxaccountsync.client.StaffClient;
-import com.finogeeks.swan.hxaccountsync.domain.*;
+import com.finogeeks.swan.hxaccountsync.domain.JobEntity;
+import com.finogeeks.swan.hxaccountsync.domain.JobUserLinkEntity;
+import com.finogeeks.swan.hxaccountsync.domain.KlDept;
 import com.finogeeks.swan.hxaccountsync.entity.*;
-import com.finogeeks.swan.hxaccountsync.repositories.DeptRepository;
-import com.finogeeks.swan.hxaccountsync.repositories.JobRepository;
-import com.finogeeks.swan.hxaccountsync.repositories.JobUserLinkRepository;
-import com.finogeeks.swan.hxaccountsync.repositories.UserRepository;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
@@ -20,7 +18,10 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.lang.reflect.InvocationTargetException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * @author Roshan
@@ -157,7 +158,7 @@ public class AccountJob {
         List<StaffDto> staffList = contactClient.getStaffList();
 
         // 获取昆仑员工
-         for (StaffDto entity : staffList) {
+        for (StaffDto entity : staffList) {
             if (entity != null && entity.getStaffId() != null
                     && !StringUtils.isEmpty(entity.getAccount())) {
                 String oaAccount = entity.getAccount();
@@ -173,9 +174,9 @@ public class AccountJob {
                 constStaffExistSet.add(entity.getGroups());
             }
             //获取工作信息
-             if (entity != null && !StringUtils.isEmpty(entity.getPosition())) {
-                 constJobIdMap.put(entity.getPosition(), entity.getPosition());
-             }
+            if (entity != null && !StringUtils.isEmpty(entity.getPosition())) {
+                constJobIdMap.put(entity.getPosition(), entity.getPosition());
+            }
         }
 
         // 获取昆仑的的组织
@@ -207,14 +208,13 @@ public class AccountJob {
 
     private Iterable<KlDept> staff2KlDept(List<StaffDto> staffList) {
         List<KlDept> klDepts = new ArrayList<>();
-        for (StaffDto dto :staffList){
+        for (StaffDto dto : staffList) {
             klDepts.addAll(dto.toklDept());
         }
         return klDepts;
     }
 
 
-
     /**
      * 岗位和权限角色的对应关系
      *
@@ -251,7 +251,6 @@ public class AccountJob {
 //        }
 //        return role;
 //    }
-
     public void syncVirtualDepts(boolean withoutParent) {
         // 建立虚拟的直属部门
         for (String deptId : constVirtualSet) {
@@ -425,14 +424,14 @@ public class AccountJob {
                 String virtualDeptCode = convertDeptCode(deptEntity.getDeptCode());
                 if (!constGroupNumberIdMap.containsKey(virtualDeptCode)) {
                     // 虚拟直属部门名称错误
-                    log.error(virtualDeptName + "," + virtualDeptCode+ ",虚拟直属部门CODE错误");
+                    log.error(virtualDeptName + "," + virtualDeptCode + ",虚拟直属部门CODE错误");
                     continue;
                 }
                 groupId = constGroupNumberIdMap.get(virtualDeptCode);
             } else {
                 if (!constGroupNumberIdMap.containsKey(deptEntity.getDeptCode())) {
                     // 部门ID错误
-                    log.error(deptEntity.getGroupName()+ "," + deptEntity.getDeptCode() + ",部门CODE错误");
+                    log.error(deptEntity.getGroupName() + "," + deptEntity.getDeptCode() + ",部门CODE错误");
                     continue;
                 }
                 groupId = constGroupNumberIdMap.get(deptEntity.getDeptCode());
@@ -446,22 +445,22 @@ public class AccountJob {
             }
             if (staff == null) {
 //                if (entity.getXstatus() == 1) {
-                    // 在职的新员工
-                    AddStaffReq addReq = new AddStaffReq();
-                    addReq.setAccount(entity.getAccount());
-                    addReq.setName(entity.getName());
-                    addReq.setEmail(entity.getEmail());
-                    addReq.setPhone(entity.getPhone());
+                // 在职的新员工
+                AddStaffReq addReq = new AddStaffReq();
+                addReq.setAccount(entity.getAccount());
+                addReq.setName(entity.getName());
+                addReq.setEmail(entity.getEmail());
+                addReq.setPhone(entity.getPhone());
 //                    addReq.setEmployeeNo(entity.getBadge());
-                    addReq.setGroup(groupId);
-                    addReq.setShowGroup(true);
-                    addReq.setShowJob(true);
-                    addReq.setZoneStatus(1);
-                    addReq.setCompany(company);
-                    String jobName = null;
-
-                    if (entity != null && constJobNameMap.containsKey(entity.getPosition())) {
-                        String jobId = constJobNameMap.get(entity.getPosition());
+                addReq.setGroup(groupId);
+                addReq.setShowGroup(true);
+                addReq.setShowJob(true);
+                addReq.setZoneStatus(1);
+                addReq.setCompany(company);
+                String jobName = null;
+
+                if (entity != null && constJobNameMap.containsKey(entity.getPosition())) {
+                    String jobId = constJobNameMap.get(entity.getPosition());
 //                        String roleName = roleNameConvert(jobEntity.getTitle());
 //                        if (!StringUtils.isEmpty(roleName) && constRoleNameMap.containsKey(roleName)) {
 //                            String roleId = constRoleNameMap.get(roleName);
@@ -469,38 +468,38 @@ public class AccountJob {
 //                        } else {
 //                            addReq.setPermissionRoles(Lists.newArrayList());
 //                        }
-                        addReq.setJobs(Lists.newArrayList(jobId));
-                        try {
-                            staffClient.addStaff(superStaff, addReq);
-                        } catch (Exception e) {
-                            log.error(e.getMessage());
-                        }
+                    addReq.setJobs(Lists.newArrayList(jobId));
+                    try {
+                        staffClient.addStaff(superStaff, addReq);
+                    } catch (Exception e) {
+                        log.error(e.getMessage());
                     }
+                }
 //                }
             } else {
                 // 老员工
 //                if (entity.getXstatus() == 1) {
-                    // 在职
-                    UpdateStaffReq req = new UpdateStaffReq();
-                    req.setEmail(entity.getEmail());
+                // 在职
+                UpdateStaffReq req = new UpdateStaffReq();
+                req.setEmail(entity.getEmail());
 //                    req.setEmployeeNo(entity.getBadge());
-                    req.setGroup(groupId);
-                    req.setShowGroup(true);
-                    req.setShowJob(true);
-                    req.setCompany(company);
-                    req.setName(entity.getName());
-                    req.setAccount(entity.getAccount());
-                    JobEntity jobEntity = null;
-
-                    if (jobEntity != null && constJobNameMap.containsKey(entity.getPosition())) {
-                        String jobId = constJobNameMap.get(entity.getPosition());
-                        req.setJobs(Lists.newArrayList(jobId));
-                        try {
-                            staffClient.updateStaff(superStaff, fcid, req);
-                        } catch (Exception e) {
-                            log.error(e.getMessage());
-                        }
+                req.setGroup(groupId);
+                req.setShowGroup(true);
+                req.setShowJob(true);
+                req.setCompany(company);
+                req.setName(entity.getName());
+                req.setAccount(entity.getAccount());
+                JobEntity jobEntity = null;
+
+                if (jobEntity != null && constJobNameMap.containsKey(entity.getPosition())) {
+                    String jobId = constJobNameMap.get(entity.getPosition());
+                    req.setJobs(Lists.newArrayList(jobId));
+                    try {
+                        staffClient.updateStaff(superStaff, fcid, req);
+                    } catch (Exception e) {
+                        log.error(e.getMessage());
                     }
+                }
 //                }
 //                else {
 //                    // 离职

+ 1 - 2
src/main/java/com/finogeeks/swan/hxaccountsync/services/UacSchedule.java

@@ -1,7 +1,6 @@
 package com.finogeeks.swan.hxaccountsync.services;
 
 import com.alibaba.fastjson.JSONArray;
-import com.finogeeks.swan.hxaccountsync.entity.binding.BindingKafkaMsg;
 import com.finogeeks.swan.hxaccountsync.entity.binding.CustomerBindingInfo;
 import com.finogeeks.swan.hxaccountsync.entity.binding.CustomerBindingJoin;
 import com.finogeeks.swan.hxaccountsync.entity.customer.UacCustomer;
@@ -79,7 +78,7 @@ public class UacSchedule {
 
         //save to 中间表
         CustomerBindingInfo info = CustomerBindingInfo.fromData(list, customer.getFcid());
-        log.info(String.format("send kafka topic : %s,msg: %s",BINDING_TOPIC,DataConverterUtil.object2Json(info)));
+        log.info(String.format("send kafka topic : %s,msg: %s", BINDING_TOPIC, DataConverterUtil.object2Json(info)));
         kafkaTemplate.send(BINDING_TOPIC, DataConverterUtil.object2Json(info));
 //        CustomerBindingInfo exist = customerBindingInfoDao.findById(info.getRetailId()).orElse(null);
 //        if (info.equals(exist)) {

+ 52 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/CallWS.java

@@ -0,0 +1,52 @@
+package com.finogeeks.swan.hxaccountsync.services.sms;
+
+import javax.xml.bind.annotation.*;
+
+/**
+ * <p>anonymous complex type的 Java 类。
+ *
+ * <p>以下模式片段指定包含在此类中的预期内容。
+ *
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+        "message"
+})
+@XmlRootElement(name = "callWS")
+public class CallWS {
+
+    @XmlElement(required = true)
+    protected String message;
+
+    /**
+     * 获取message属性的值。
+     *
+     * @return possible object is
+     * {@link String }
+     */
+    public String getMessage() {
+        return message;
+    }
+
+    /**
+     * 设置message属性的值。
+     *
+     * @param value allowed object is
+     *              {@link String }
+     */
+    public void setMessage(String value) {
+        this.message = value;
+    }
+
+}

+ 51 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/CallWSResponse.java

@@ -0,0 +1,51 @@
+package com.finogeeks.swan.hxaccountsync.services.sms;
+
+import javax.xml.bind.annotation.*;
+
+/**
+ * <p>anonymous complex type的 Java 类。
+ *
+ * <p>以下模式片段指定包含在此类中的预期内容。
+ *
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="callWSReturn" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+        "callWSReturn"
+})
+@XmlRootElement(name = "callWSResponse")
+public class CallWSResponse {
+
+    @XmlElement(required = true)
+    protected String callWSReturn;
+
+    /**
+     * 获取callWSReturn属性的值。
+     *
+     * @return possible object is
+     * {@link String }
+     */
+    public String getCallWSReturn() {
+        return callWSReturn;
+    }
+
+    /**
+     * 设置callWSReturn属性的值。
+     *
+     * @param value allowed object is
+     *              {@link String }
+     */
+    public void setCallWSReturn(String value) {
+        this.callWSReturn = value;
+    }
+}

+ 41 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/ObjectFactory.java

@@ -0,0 +1,41 @@
+package com.finogeeks.swan.hxaccountsync.services.sms;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the com.kunlun.sms.servlet package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups.  Factory methods for each of these are
+ * provided in this class.
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.kunlun.sms.servlet
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link CallWS }
+     */
+    public CallWS createCallWS() {
+        return new CallWS();
+    }
+
+    /**
+     * Create an instance of {@link CallWSResponse }
+     */
+    public CallWSResponse createCallWSResponse() {
+        return new CallWSResponse();
+    }
+}

+ 200 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/SendSmsService.java

@@ -0,0 +1,200 @@
+package com.finogeeks.swan.hxaccountsync.services.sms;
+
+import lombok.extern.slf4j.Slf4j;
+import org.dom4j.Document;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * 发送短信验证码
+ *
+ * @author duluosheng
+ */
+@Slf4j
+public class SendSmsService {
+    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+    private static final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
+    static String targetMobile = "13800000000";
+    static String smsContent = "短信测试";
+
+    public static String sendSms(String transSource,
+                                 String userId,
+                                 String reqSeq,
+                                 String templateId,
+                                 String completeDateBegin,
+                                 String completeDateEnd,
+                                 String completeTimeBegin,
+                                 String completeTimeEnd,
+                                 Map<String, String> reqSeqIdMobileMap,
+                                 Map<String, Map<String, String>> reqSeqIdParameterMap) {
+        String returnMsg = null;
+        Map<String, String> pubParameterMap = new HashMap<>();
+        //1、获取token
+        String token = TokenService.getToken(userId);//获取请求token
+        //2、发送短信
+        pubParameterMap.put("TransSource", transSource);//调用系统
+        pubParameterMap.put("user_id", userId);//调用帐户
+        pubParameterMap.put("type", "2");//请求类型,设置为2
+        pubParameterMap.put("templateid", templateId);//短信模板,定义要发送短信内容
+        pubParameterMap.put("user_Token", token);//获取请求token
+        pubParameterMap.put("TransDate", dateFormat.format(new Date()));//交易日期
+        pubParameterMap.put("TransTime", timeFormat.format(new Date()));//交易时间
+        pubParameterMap.put("ReqSeq", reqSeq);//报文批次
+        pubParameterMap.put("sendKind", "12");//请求类型,设置为“12”
+        pubParameterMap.put("sendpriority", "0");//发送优先级,设置为0
+        pubParameterMap.put("completeDate_begin", completeDateBegin);//要求发送开始日期
+        pubParameterMap.put("completeDate_end", completeDateEnd);//要求发送的结束日期
+        pubParameterMap.put("completetime_begin", completeTimeBegin);//要求发送的开始时间,一天中的分钟数,最小0,00:00
+        pubParameterMap.put("completetime_end", completeTimeEnd);//要求发送的结束时间,一天中的分钟数,最大1439,23:59
+
+        //组装发送的短信报文
+        String message = generateXml(pubParameterMap, reqSeqIdMobileMap, reqSeqIdParameterMap);
+
+        // Please, do not remove this line from file template, here invocation of web service will be inserted
+        SmsServiceService smsServiceService = new SmsServiceService();
+        SmsService smsService = smsServiceService.getSmsService();
+        try {
+            log.debug("callWS:" + message);
+            returnMsg = smsService.callWS(message);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+        log.info("callWS, return: " + returnMsg);
+        return returnMsg;
+    }
+
+
+    /**
+     * 组装获取Token的xml
+     *
+     * <SMS>
+     * <PUB>
+     * <user_id></user_id>
+     * <type>1</type>
+     * <TransDate>2019-06-05</TransDate>
+     * <TransTime>11:33:11</TransTime>
+     * </PUB>
+     * </SMS>
+     */
+    private static String generateXml(Map<String, String> pubParameterMap, Map<String, String> mobileMap, Map<String, Map<String, String>> paramValueMap) {
+        Document doc = DocumentHelper.createDocument();
+        Element sms = DocumentHelper.createElement("SMS");
+        Element pub = DocumentHelper.createElement("PUB");
+        Element in = DocumentHelper.createElement("IN");
+        pub.addElement("TransSource").addText(pubParameterMap.get("TransSource"));
+        pub.addElement("user_id").addText(pubParameterMap.get("user_id"));
+        pub.addElement("type").addText(pubParameterMap.get("type"));
+        pub.addElement("templateid").addText(pubParameterMap.get("templateid"));
+        pub.addElement("user_Token").addText(pubParameterMap.get("user_Token"));
+        pub.addElement("TransDate").addText(pubParameterMap.get("TransDate"));
+        pub.addElement("TransTime").addText(pubParameterMap.get("TransTime"));
+        pub.addElement("ReqSeq").addText(pubParameterMap.get("ReqSeq"));
+        pub.addElement("sendKind").addText(pubParameterMap.get("sendKind"));
+        pub.addElement("sendpriority").addText(pubParameterMap.get("sendpriority"));
+        pub.addElement("completeDate_begin").addText(pubParameterMap.get("completeDate_begin"));
+        pub.addElement("completeDate_end").addText(pubParameterMap.get("completeDate_end"));
+        pub.addElement("completetime_begin").addText(pubParameterMap.get("completetime_begin"));
+        pub.addElement("completetime_end").addText(pubParameterMap.get("completetime_end"));
+
+        for (String reqSeqId : mobileMap.keySet()) {
+            Element msg = DocumentHelper.createElement("MSG");
+            msg.addElement("ReqSeqID").addText(reqSeqId);
+            msg.addElement("mobile").addText(mobileMap.get(reqSeqId));
+            Element paramValues = DocumentHelper.createElement("paramValues");
+            Map<String, String> parameterMap = paramValueMap.get(reqSeqId);
+            if (parameterMap != null) {
+                for (String name : parameterMap.keySet()) {
+                    String value = parameterMap.get(name);
+                    Element paramValue = DocumentHelper.createElement("paramValue");
+                    paramValue.addElement("name").addText(name);
+                    paramValue.addElement("value").addText(value);
+                    paramValues.add(paramValue);
+                }
+            }
+            msg.add(paramValues);
+            in.add(msg);
+        }
+        sms.add(pub);
+        sms.add(in);
+        doc.add(sms);
+        return doc.asXML();
+    }
+
+    public static void main(String[] args) {
+        ProcessInput(args);
+
+        //基本信息
+        String transSource = "10018";//ITSM调用系统
+        String userId = "1001810023";//ITSM调用账户
+        String templateId = "1001810321";//ITSM调用模板
+        String reqSeq = UUID.randomUUID().toString();//ITSM短信发送批号
+        String completeDateBegin = dateFormat.format(new Date());//要求发送完成的开始日期
+        String completeDateEnd = dateFormat.format(new Date());//要求发送完成的结束日期
+        String completeTimeBegin = "0";//要求完成的开始时间(分钟数)0代表:00:00 1439代表:23:59
+        String completeTimeEnd = "1439";//要求完成的结束时间(分钟数)0代表:00:00 1439代表:23:59
+        Map<String, String> reqSeqIdMobileMap = new HashMap<>();
+        Map<String, Map<String, String>> reqSeqIdParameterMap = new HashMap<>();
+
+        //2、准备参数
+
+        //发送一条短信
+        String reqSeqId = UUID.randomUUID().toString();//每条短信明显id
+        String mobile = targetMobile;//目标手机号码
+        Map<String, String> parameterMap1 = new HashMap<>();
+        parameterMap1.put("code", "107659");
+        parameterMap1.put("effectiveTime", "2");
+        reqSeqIdMobileMap.put(reqSeqId, mobile);
+        reqSeqIdParameterMap.put(reqSeqId, parameterMap1);
+        //如果一个批次需要发送多条短信,请参考发送单条进行调整(略)
+
+        //3、发送短信
+        sendSms(transSource,
+                userId,
+                reqSeq,
+                templateId,
+                completeDateBegin,
+                completeDateEnd,
+                completeTimeBegin,
+                completeTimeEnd,
+                reqSeqIdMobileMap,
+                reqSeqIdParameterMap);
+    }
+
+    public static void ProcessInput(String[] args) {
+        if (args.length < 1)
+            die();
+        for (int k = 0; k < args.length; k++) {
+            if (args[k].equals("-t")) {
+                if (++k < args.length) {
+                    targetMobile = args[k];
+                    log.debug("tel:");
+                    log.debug(targetMobile);
+                } else {
+                    log.error("-U missing Input");
+                    die();
+                }
+            } else if (args[k].equals("-c")) {
+                if (++k < args.length) {
+                    smsContent = args[k];
+                    log.debug("content :" + smsContent);
+                } else {
+                    die();
+                }
+            } else {
+                smsContent = String.format("%s %s", smsContent, args[k]);
+            }
+        }
+    }
+
+    public static void die() {
+        log.error("usage: java getActiveDomainAndServers [-U userName] [-P userPwd] [-I ServerIp]");
+        log.error("Error=Input Error!$");
+        System.exit(0);
+    }
+}

+ 33 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/SmsService.java

@@ -0,0 +1,33 @@
+package com.finogeeks.swan.hxaccountsync.services.sms;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.9-b130926.1035
+ * Generated source version: 2.2
+ */
+@WebService(name = "SmsService", targetNamespace = "http://servlet.sms.kunlun.com")
+@XmlSeeAlso({
+        ObjectFactory.class
+})
+public interface SmsService {
+
+    /**
+     * @param message
+     * @return returns java.lang.String
+     */
+    @WebMethod
+    @WebResult(name = "callWSReturn", targetNamespace = "http://servlet.sms.kunlun.com")
+    @RequestWrapper(localName = "callWS", targetNamespace = "http://servlet.sms.kunlun.com", className = "com.kunlun.sms.servlet.CallWS")
+    @ResponseWrapper(localName = "callWSResponse", targetNamespace = "http://servlet.sms.kunlun.com", className = "com.kunlun.sms.servlet.CallWSResponse")
+    String callWS(
+            @WebParam(name = "message", targetNamespace = "http://servlet.sms.kunlun.com")
+                    String message);
+}

+ 77 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/SmsServiceService.java

@@ -0,0 +1,77 @@
+package com.finogeeks.swan.hxaccountsync.services.sms;
+
+import com.finogeeks.swan.hxaccountsync.config.WsdlConfig;
+import com.finogeeks.swan.hxaccountsync.util.SpringContextUtil;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceFeature;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.9-b130926.1035
+ * Generated source version: 2.2
+ */
+public class SmsServiceService
+        extends Service {
+
+    private final static URL SMSSERVICESERVICE_WSDL_LOCATION;
+    private final static WebServiceException SMSSERVICESERVICE_EXCEPTION;
+    private final static QName SMSSERVICESERVICE_QNAME = new QName("http://servlet.sms.kunlun.com", "SmsServiceService");
+
+    static {
+        URL url = null;
+        WebServiceException e = null;
+        try {
+            WsdlConfig config = SpringContextUtil.getBean("wsdlConfig", WsdlConfig.class);
+            url = new URL(config.getSmsWsdl());
+        } catch (MalformedURLException ex) {
+            e = new WebServiceException(ex);
+        }
+        SMSSERVICESERVICE_WSDL_LOCATION = url;
+        SMSSERVICESERVICE_EXCEPTION = e;
+    }
+
+    public SmsServiceService() {
+        super(__getWsdlLocation(), SMSSERVICESERVICE_QNAME);
+    }
+
+
+    public SmsServiceService(URL wsdlLocation) {
+        super(wsdlLocation, SMSSERVICESERVICE_QNAME);
+    }
+
+
+    public SmsServiceService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    private static URL __getWsdlLocation() {
+        if (SMSSERVICESERVICE_EXCEPTION != null) {
+            throw SMSSERVICESERVICE_EXCEPTION;
+        }
+        return SMSSERVICESERVICE_WSDL_LOCATION;
+    }
+
+    /**
+     * @return returns SmsService
+     */
+    @WebEndpoint(name = "SmsService")
+    public SmsService getSmsService() {
+        return super.getPort(new QName("http://servlet.sms.kunlun.com", "SmsService"), SmsService.class);
+    }
+
+    /**
+     * @param features A list of {@link WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
+     * @return returns SmsService
+     */
+    @WebEndpoint(name = "SmsService")
+    public SmsService getSmsService(WebServiceFeature... features) {
+        return super.getPort(new QName("http://servlet.sms.kunlun.com", "SmsService"), SmsService.class, features);
+    }
+
+}

+ 94 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/services/sms/TokenService.java

@@ -0,0 +1,94 @@
+package com.finogeeks.swan.hxaccountsync.services.sms;
+
+import lombok.extern.slf4j.Slf4j;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 获取token
+ * author: duluosheng
+ */
+@Slf4j
+public class TokenService {
+    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+    private static final SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm:ss");
+
+    public static String getToken(String user_id) {
+        String returnMsg;
+        String token = null;
+        Map<String, String> parameterMap = new HashMap<>();
+        parameterMap.put("user_id", user_id);//调用帐户
+        parameterMap.put("type", "1");//请求类型,设置为“1”
+        parameterMap.put("TransDate", dateFormat.format(new Date()));
+        parameterMap.put("TransTime", timeFormat.format(new Date()));
+        String message = generateXml(parameterMap);
+        log.debug("getToken generateXml:" + message);
+        // Please, do not remove this line from file template, here invocation of web service will be inserted
+        SmsServiceService smsServiceService = new SmsServiceService();
+        SmsService smsService = smsServiceService.getSmsService();
+        try {
+            returnMsg = smsService.callWS(message);
+            //解析报文
+            token = parseResponse(returnMsg);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        log.debug("token:" + token);
+        return token;
+    }
+
+    private static String parseResponse(String response) throws DocumentException {
+        Document doc = DocumentHelper.parseText(response);
+        if (doc == null) {
+            return null;
+        }
+        Element root = doc.getRootElement();
+        if (root == null) {
+            return null;
+        }
+        Element out = root.element("OUT");
+        if (out == null) {
+            return null;
+        }
+        Element user_token = out.element("user_Token");
+        if (user_token == null) {
+            return null;
+        }
+        return user_token.getStringValue();
+    }
+
+
+    /**
+     * 组装获取Token的xml
+     *
+     * <SMS>
+     * <PUB>
+     * <user_id></user_id>
+     * <type>1</type>
+     * <TransDate>2019-06-05</TransDate>
+     * <TransTime>11:33:11</TransTime>
+     * </PUB>
+     * </SMS>
+     */
+    private static String generateXml(Map<String, String> parameterMap) {
+        Document doc = DocumentHelper.createDocument();
+        Element sms = DocumentHelper.createElement("SMS");
+        Element pub = DocumentHelper.createElement("PUB");
+        pub.addElement("user_id").addText(parameterMap.get("user_id"));
+        pub.addElement("type").addText(parameterMap.get("type"));
+        pub.addElement("TransDate").addText(parameterMap.get("TransDate"));
+        pub.addElement("TransTime").addText(parameterMap.get("TransTime"));
+
+        sms.add(pub);
+        doc.add(sms);
+        return doc.asXML();
+    }
+}

+ 16 - 21
src/main/java/com/finogeeks/swan/hxaccountsync/util/Html2Text.java

@@ -1,23 +1,32 @@
 package com.finogeeks.swan.hxaccountsync.util;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
 import javax.swing.text.html.HTMLEditorKit;
 import javax.swing.text.html.parser.ParserDelegator;
+import java.io.*;
 
 public class Html2Text extends HTMLEditorKit.ParserCallback {
 
-    private static Html2Text html2Text = new Html2Text();
+    private static final Html2Text html2Text = new Html2Text();
 
     StringBuffer s;
 
     public Html2Text() {
     }
 
+    public static String getContent(String str) {
+        try {
+            html2Text.parse(str);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return html2Text.getText();
+    }
+
+    public static void main(String[] args) {
+        System.out.println(getContent("<p><strong><span style=\"COLOR: #ff0000\">产品介绍</span></strong></p><p>侧重于中线,以“精选价值股票”为原则,以基本面,股票池跟踪、上市公司实地调研及估值模型为选股依据,注重公司价值挖掘。</p><p><span style=\"COLOR: #ff0000\"><strong>服务内容</strong></span></p><p>1、标的股的调入调出提醒、每周点评回顾、标的股的重大事项解读等。</p><p>2、营业部专属服务人员电话服务。</p><p><span style=\"COLOR: #ff0000\"><strong>产品收费规则</strong><br/><span style=\"COLOR: #000000\">仅针对推荐标的收费</span></span></p><p>买入</p><p>-原账户佣金率</p><p>卖出</p><p>-</p><p>&nbsp;</p><p><span style=\"COLOR: #ff0000\"><strong>产品止损原则</strong></span></p><p><span style=\"COLOR: #ff0000\"><strong>产品仓位控制</strong></span></p><p><span style=\"COLOR: #ff0000\"><strong>适合客户</strong></span></p><p><span style=\"COLOR: #ff0000\"><strong>风险说明</strong></span></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"));
+    }
+
     public void parse(String str) throws IOException {
 
         InputStream iin = new ByteArrayInputStream(str.getBytes());
@@ -37,18 +46,4 @@ public class Html2Text extends HTMLEditorKit.ParserCallback {
     public String getText() {
         return s.toString();
     }
-
-    public static String getContent(String str) {
-        try {
-            html2Text.parse(str);
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        return html2Text.getText();
-    }
-
-    public static void main(String[] args) {
-        System.out.println(getContent("<p><strong><span style=\"COLOR: #ff0000\">产品介绍</span></strong></p><p>侧重于中线,以“精选价值股票”为原则,以基本面,股票池跟踪、上市公司实地调研及估值模型为选股依据,注重公司价值挖掘。</p><p><span style=\"COLOR: #ff0000\"><strong>服务内容</strong></span></p><p>1、标的股的调入调出提醒、每周点评回顾、标的股的重大事项解读等。</p><p>2、营业部专属服务人员电话服务。</p><p><span style=\"COLOR: #ff0000\"><strong>产品收费规则</strong><br/><span style=\"COLOR: #000000\">仅针对推荐标的收费</span></span></p><p>买入</p><p>-原账户佣金率</p><p>卖出</p><p>-</p><p>&nbsp;</p><p><span style=\"COLOR: #ff0000\"><strong>产品止损原则</strong></span></p><p><span style=\"COLOR: #ff0000\"><strong>产品仓位控制</strong></span></p><p><span style=\"COLOR: #ff0000\"><strong>适合客户</strong></span></p><p><span style=\"COLOR: #ff0000\"><strong>风险说明</strong></span></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"));
-    }
 }

+ 7 - 7
src/main/java/com/finogeeks/swan/hxaccountsync/util/ServiceUtil.java

@@ -11,21 +11,21 @@ import java.util.stream.Collectors;
  * @author sunhui
  */
 public class ServiceUtil {
-   public static String formatFcid(String oaAccount) {
-       if(StringUtils.isEmpty(oaAccount)) return null;
-       return "@staff_" + oaAccount + ":im.hx168.com.cn";
-   }
+    public static String formatFcid(String oaAccount) {
+        if (StringUtils.isEmpty(oaAccount)) return null;
+        return "@staff_" + oaAccount + ":im.hx168.com.cn";
+    }
 
     public static String getOaAccount(String fcid) {
-        if(StringUtils.isEmpty(fcid)){
+        if (StringUtils.isEmpty(fcid)) {
             return null;
         }
 
-        return fcid.substring(fcid.indexOf("_") + 1,fcid.lastIndexOf(":"));
+        return fcid.substring(fcid.indexOf("_") + 1, fcid.lastIndexOf(":"));
     }
 
     public static List<String> getOaAccounts(String fcids) {
-        if(StringUtils.isEmpty(fcids)){
+        if (StringUtils.isEmpty(fcids)) {
             return null;
         }
         return Arrays.stream(fcids.split(","))

+ 37 - 0
src/main/java/com/finogeeks/swan/hxaccountsync/util/SpringContextUtil.java

@@ -0,0 +1,37 @@
+package com.finogeeks.swan.hxaccountsync.util;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+/**
+ * Spring工具类,获取Spring上下文对象等
+ */
+@Component
+public class SpringContextUtil implements ApplicationContextAware {
+    private static ApplicationContext applicationContext = null;
+
+    public static ApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        if (SpringContextUtil.applicationContext == null) {
+            SpringContextUtil.applicationContext = applicationContext;
+        }
+    }
+
+    public static Object getBean(String name) {
+        return getApplicationContext().getBean(name);
+    }
+
+    public static <T> T getBean(Class<T> clazz) {
+        return getApplicationContext().getBean(clazz);
+    }
+
+    public static <T> T getBean(String name, Class<T> clazz) {
+        return getApplicationContext().getBean(name, clazz);
+    }
+}

+ 8 - 2
src/main/resources/application.properties

@@ -23,7 +23,7 @@ spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.h
 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
 # Server Config
 server.tomcat.max-threads=400
-server.servlet.context-path=/api/v1/swan/kl-account-service
+
 # Staff Service Config
 staff.url=https://swan.finogeeks.club
 staff.super=@staff_super_M00000:111111.finogeeks.com
@@ -54,4 +54,10 @@ job.uacSchedule.cron=0/60 * * * * ?
 spring.kafka.bootstrap-servers=127.0.0.1:9092
 spring.kafka.producer.retries=3
 spring.kafka.producer.client-id=kl-account-service
-spring.kafka.consumer.group-id=kl-account-service
+spring.kafka.consumer.group-id=kl-account-service
+
+# ·¢ËͶÌÐÅÑéÖ¤Âë
+kunlun.sms.transSource=10018
+kunlun.sms.userId=1001810023
+kunlun.sms.templateId=1001810321
+kunlun.sms.url=http://10.5.3.109:7001/sms/services/SmsService?wsdl