Compare commits

...

3 Commits

Author SHA1 Message Date
yuqh 71e82ff166 Merge remote-tracking branch 'origin/wansheng' into wansheng 2025-04-17 08:42:35 +08:00
yuqh fd9dfb426a 获取客户档案 2025-04-17 08:41:52 +08:00
yuqh 7dbcd66011 文件配置 2025-03-20 10:15:39 +08:00
21 changed files with 800 additions and 361 deletions

View File

@ -0,0 +1,85 @@
package com.hzya.frame.plugin.wsdata.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.seeyon.customer.service.ICustomerService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpATTRS;
import com.jcraft.jsch.SftpException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
/**
* 主数据模版(MdmModule)表服务接口
*
* @author makejava
* @since 2024-06-18 10:33:32
*/
public class WsDataInitializer extends PluginBaseEntity {
@Autowired
private ICustomerService customerService;
Logger logger = LoggerFactory.getLogger(WsDataInitializer.class);
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "WsDataInitializer";
}
@Override
public String getPluginName() {
return "获取CRM客户档案";
}
@Override
public String getPluginLabel() {
return "WsDataInitializer";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
JsonResultEntity result = new JsonResultEntity();
try {
result =customerService.getCrmCustomer(requestJson);
} catch (Exception e) {
throw new RuntimeException(e);
}
return result;
}
}

View File

@ -1,23 +0,0 @@
#######################澳星环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: GBK
file:
# 日志保存路径
path: E:\yongansystem\log
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: E:\yongansystem\file
zt:
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -1,27 +0,0 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: D:\yongansystem\kangarooDataCenter\v3\logs
spring:
datasource:
dynamic:
datasource:
master:
# url: jdbc:mysql://ufidahz.com.cn:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# username: root
# password: bd993088e8a7c3dc5f44441617f9b4bf
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: D:\yongansystem\kangarooDataCenter\v3\logs
zt:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -1,82 +0,0 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /Users/apple/Desktop/log/local
spring:
data:
mongodb:
# host: 192.168.2.237
# port: 27017
# database: businesscenter
# auto-index-creation: true
# password: hzya1314
# username: hzya
flyway:
# 启动flyway migration, 默认为true
enabled: false
datasource:
dynamic:
druid:
filters: stat,log4j2
datasource:
master:
# url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
# username: hzyazt
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: dm.jdbc.driver.DmDriver
# type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
# url: jdbc:dm://hzya.ufyct.com:9040/businesscenter?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
# url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
# username: hzyazt
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: dm.jdbc.driver.DmDriver
savefile:
# 文件保存路径
path: /Users/apple/Desktop/log/local
tomcatpath: /Users/apple/Desktop/log/local
pluginpath: /Users/apple/Desktop/log/local
zt:
url: http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826
#电子回单下载临时存放位置
elec_path: /Users/xiangerlin/Downloads/
OA:
data_source_code: yc_oa
server:
port: 10086
# mysqldump -d mylm -hhzya.ufyct.com -p9096 -uroot -phzya1314 >%dirName%\table_view.sql
database:
databaseName: businesscenter
host: 192.168.2.237
port: 3306
username: root
password: hzya@1314
filePase: /Users/apple/Desktop/log
fileName: data.sql
#sftp:
# host: 192.168.2.237
# port: 9091
# username: cs237
# password: hzya@1314
# filePase: /databaseBack

View File

@ -1,23 +0,0 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /Users/apple/Desktop/log/local
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/apple/Desktop/log/local
zt:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -3,7 +3,7 @@ logging:
#日志级别 指定目录级别
level:
root: info
encodings: GBK
encodings: UTF-8
file:
# 日志保存路径
path: D:\yongansystem\log
@ -25,9 +25,9 @@ spring:
filters: stat,log4j2
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
url: jdbc:mysql://192.168.3.42:3306/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 617e55dada79e04983a2dfcb3c63ad10
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
@ -35,7 +35,7 @@ savefile:
tomcatpath: D:\yongansystem\apache-tomcat-9.0.97
pluginpath: D:\yongansystem\apache-tomcat-9.0.97\webapps\kangarooDataCenterV3\WEB-INF\classes
zt:
url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface
url: http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface
database:
# databaseName: businesscenter

View File

@ -1,35 +0,0 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /Users/xiangerlin/work/app/logs/dev
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/file/dev
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
#电子回单下载临时存放位置
elec_path: /Users/xiangerlin/Downloads/
OA:
data_source_code: yc-test

View File

@ -1,90 +0,0 @@
#logging:
# #日志级别 指定目录级别
# level:
# root: info
# encodings: UTF-8
# file:
# # 日志保存路径
# path: /zt/log
#spring:
# flyway:
# # 启动flyway migration, 默认为true
# enabled: false
# datasource:
# dynamic:
# druid:
# filters: stat,log4j2
# datasource:
# master:
# url: jdbc:dm://10.75.51.82:5238?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
# username: businesscenter
# password: 6842568689469adad597d144ee104063
# driver-class-name: dm.jdbc.driver.DmDriver
#savefile:
# # 文件保存路径
# path: /zt/file
#公司mysql
#ax:
# url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface
#logging:
# #日志级别 指定目录级别warn
# level:
# root: info
# encodings: UTF-8
# file:
# # 日志保存路径
# path: /home/webservice/zt/log
#spring:
# datasource:
# dynamic:
# datasource:
# master:
# url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# username: root
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
#savefile:
# # 文件保存路径
# path: /home/webservice/zt/file
#公司服务器达梦
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /zt/log
spring:
flyway:
# 启动flyway migration, 默认为true
enabled: false
datasource:
dynamic:
druid:
filters: stat,log4j2
datasource:
master:
url: jdbc:dm://ufidahz.com.cn:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
username: hzyazt
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: dm.jdbc.driver.DmDriver
savefile:
# 文件保存路径
path: /zt/file
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826
#电子回单下载临时存放位置
elec_path: /zt/elecfile
OA:
data_source_code: yc_oa

View File

@ -1,21 +0,0 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /Users/xiangerlin/work/app/logs/ydc
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/logs/ydc

View File

@ -1,31 +0,0 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /Users/xiangerlin/work/app/logs/yuecheng
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/logs/yuecheng
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185

View File

@ -1,23 +0,0 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: E:\yongansystem\log
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: bd993088e8a7c3dc5f44441617f9b4bf
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: E:\yongansystem\log
zt:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>WsDataInitializer</id>
<name>WsDataInitializer插件</name>
<category>90000009</category>
</plugin>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName">
<bean name="WsDataInitializer" class="com.hzya.frame.plugin.wsdata.plugin.WsDataInitializer" />
</beans>

View File

@ -36,9 +36,9 @@ public class temButtom {
@Test
public void test01() {
String a = AESUtil.encrypt("sa123!");
String a = AESUtil.encrypt("hzya@1314");
System.out.println(a);
String b = AESUtil.decrypt("62e4295b615a30dbf3b8ee96f41c820b");
String b = AESUtil.decrypt("617e55dada79e04983a2dfcb3c63ad10");
System.out.println(b);
}

View File

@ -0,0 +1,24 @@
package com.hzya.frame.seeyon.customer.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.seeyon.customer.entity.CustomerEntity;
import java.util.HashMap;
import java.util.List;
/***
* @Content:客户供应商
* @Author 👻👻👻👻yqh👻👻👻👻
* @Date 2020/12/29 14:00
* @Param
* @return
**/
public interface ICustomerDao extends IBaseDao<CustomerEntity,Long> {
@DS("WS_OA")
List<CustomerEntity> selectCustomers( CustomerEntity entity);
int updaterCustomers(CustomerEntity entity);
}

View File

@ -0,0 +1,43 @@
package com.hzya.frame.seeyon.customer.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.seeyon.customer.dao.ICustomerDao;
import com.hzya.frame.seeyon.customer.entity.CustomerEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
/**
*
* @content 客户
* @className: Administrator
* @author laborer
* @date 2025-04-03 9:58
*
*/
@Repository(value = "CustomerDaoImpl")
public class CustomerDaoImpl extends MybatisGenericDao<CustomerEntity,Long> implements ICustomerDao {
protected Logger logger = LogManager.getLogger(super.getClass());
@DS("#entity.dataSourceCode")
@Override
public List<CustomerEntity> selectCustomers(CustomerEntity entity) {
return (List<CustomerEntity>) super.selectList("com.hzya.frame.seeyon.customer.entity.CustomerEntity.CustomerEntity_list_base",entity);
}
@DS("#entity.dataSourceCode")
@Override
public int updaterCustomers(CustomerEntity entity) {
return super.update("com.hzya.frame.seeyon.customer.entity.CustomerEntity.CustomerEntity_update",entity);
}
}

View File

@ -0,0 +1,27 @@
package com.hzya.frame.seeyon.customer.entity;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.List;
/**
*
* @content 客户档案
* @className: Administrator
* @author laborer
* @date 2025-04-03 9:54
*
*/
public class CustomerEntity extends BaseEntity {
private String sqlStr;
public String getSqlStr() {
return sqlStr;
}
public void setSqlStr(String sqlStr) {
this.sqlStr = sqlStr;
}
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.seeyon.customer.entity.CustomerEntity">
<resultMap id="get-CustomerEntity-result" type="com.hzya.frame.seeyon.customer.entity.CustomerEntity">
<!--主键 -->
<result property="id" column="id" />
</resultMap>
<sql id="CustomerEntity_Base_Column_List">
id
</sql>
<select id="CustomerEntity_list_base" resultMap="get-CustomerEntity-result" parameterType="com.hzya.frame.seeyon.customer.entity.CustomerEntity">
${sqlStr}
</select>
<!--通过主键修改方法-->
<update id="CustomerEntity_update" parameterType = "java.util.Map" >
${sqlStr}
</update>
</mapper>

View File

@ -0,0 +1,30 @@
package com.hzya.frame.seeyon.customer.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.seeyon.customer.entity.CustomerEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import java.util.List;
/**
*
* @content 客户
* @className: Administrator
* @author laborer
* @date 2025-04-03 9:55
*
*/
public interface ICustomerService extends IBaseService<CustomerEntity, Long> {
/**
*
* @content 获取CRM客户信息
* @className: Administrator
* @author laborer
* @date 2025-04-03 10:06
*
*/
JsonResultEntity getCrmCustomer(JSONObject requestJson)throws Exception;
}

View File

@ -0,0 +1,441 @@
package com.hzya.frame.seeyon.customer.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.seeyon.customer.dao.ICustomerDao;
import com.hzya.frame.seeyon.customer.entity.CustomerEntity;
import com.hzya.frame.seeyon.customer.service.ICustomerService;
import com.hzya.frame.seeyon.util.OACrmUtil;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.print.DocFlavor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
*
* @content 客户档案
* @className: Administrator
* @author laborer
* @date 2025-04-03 9:56
*
*/
@Service(value = "CustomerImpl")
public class CustomerImpl extends BaseService<CustomerEntity, Long> implements ICustomerService {
@Autowired
private ICustomerDao cstomerDao;
/**
*
* @content 获取CRM客户档案信息
* @className: Administrator
* @author laborer
* @date 2025-04-03 10:07
*
*/
@Override
public JsonResultEntity getCrmCustomer(JSONObject requestJson)throws Exception {
JsonResultEntity resultJson = new JsonResultEntity();
JSONArray datas = new JSONArray();
JSONArray result = new JSONArray();
//获取CRM可回档案数据
int i = 0;
while (true){
result = getCrmCustomers(i++);
if(result.size()>0){
datas.addAll(result);
}else{
break;
}
}
if(datas.size()>0){
//处理客户数据推送OA
for(int j=0;j<datas.size();j++){
System.out.println(j);
//将CRM的数据进行转换
JSONObject data = bdCrmData(datas.getJSONObject(j));
JSONObject tokenParm = new JSONObject();
tokenParm.put("password","45562434-8459-47b4-8df0-78fad8405bc4");
tokenParm.put("userName","hzya_rest");
tokenParm.put("loginName","YongAn");
//通过客户编码以及公司名称判断是否走新增还是更新
String gs = data.getString("gs");
String u8ckhbh = data.getString("u8ckhbh");
if(StrUtil.isEmpty(gs)|| StrUtil.isEmpty(u8ckhbh)){
logger.info("公司名称或者客户编码为空,数据不处理");
continue;
}
String sqlStr = "select \n" +
"main.id,\n" +
"item.showvalue as gs\n" +
"from formmain_5753 main \n" +
"left join ctp_enum_item item on main.field0032 = item.id\n" +
"where item.showvalue is not null\n" +
"and field0005 = '"+u8ckhbh+"' " +
"and item.showvalue = '"+gs+"'";
CustomerEntity entity = new CustomerEntity();
entity.setDataSourceCode("WS_OA");
entity.setSqlStr(sqlStr);
List<CustomerEntity>customerEntityList = cstomerDao.selectCustomers(entity);
String id = "";
if(CollectionUtils.isNotEmpty(customerEntityList)){
id = customerEntityList.get(0).getId();
}
if(StrUtil.isEmpty(id)){
//获取token
String oaToken = OACrmUtil.getOaToken(tokenParm.toJSONString(),"8000550010");
//将转换的数据进行OA数据组装
JSONObject oaData = getOACrmData(data,oaToken);
logger.info("OA请求前参数"+oaData.toString());
//调用
OACrmUtil.getOaData(oaData.toString(),"8000550012",oaToken);
}else{
String zq = StrUtil.isEmpty(data.getString("xyqxt")) ? null :data.getString("xyqxt");
String zxedwy = StrUtil.isEmpty(data.getString("zxedwy")) ? null :data.getString("zxedwy");
String ywy = StrUtil.isEmpty(data.getString("ywy")) ? "" :data.getString("ywy");
String updateSql = "update formmain_5753 " +
"set field0002 = "+zq+", " +
"field0003="+zxedwy+", " +
"field0034='"+ywy+"' " +
"where id = '"+id+"' ";
// System.out.println("");
entity.setSqlStr(updateSql);
cstomerDao.updaterCustomers(entity);
}
}
}
return resultJson;
}
private JSONObject getOACrmData(JSONObject data,String token) {
JSONObject resultJson = new JSONObject();
resultJson.put("formCode","formmain_5753");
resultJson.put("loginName","YongAn");
resultJson.put("rightId","8225261366084062087.8502143236212605767");
JSONArray dataList = new JSONArray();
JSONObject dataObj = new JSONObject();
JSONObject masterTable = new JSONObject();
masterTable.put("name","formmain_5753");
JSONObject record = new JSONObject();
record.put("id",data.getString("id"));
JSONArray fields = new JSONArray();
//添加主表数据
//通过公司名称获取公司主键
String gs = data.getString("gs");
JSONObject gsObj = new JSONObject();
Long ref_enum_id = 4404497076308233424L;
gsObj.put("show_value",gs);
gsObj.put("ref_enum_id", ref_enum_id);
String resultGs = OACrmUtil.getOaData(gsObj.toString(),"8000550011",token);
if(StrUtil.isNotEmpty(resultGs)){
JSONObject gsObj1 = JSONObject.parseObject(resultGs);
JSONArray gsData = gsObj1.getJSONArray("data");
if(gsData.size()>0){
JSONObject gsData1 = gsData.getJSONObject(0);
JSONObject field0032 = new JSONObject();
field0032.put("showValue","公司");
field0032.put("name","field0032");
field0032.put("value",gsData1.getString("item_id"));
fields.add(field0032);
}
}
//客户编码
JSONObject u8ckhbh = new JSONObject();
u8ckhbh.put("showValue","客户编码");
u8ckhbh.put("name","field0005");
u8ckhbh.put("value",data.getString("u8ckhbh"));
fields.add(u8ckhbh);
//客户名称
JSONObject khmc = new JSONObject();
khmc.put("showValue","客户名称");
khmc.put("name","field0001");
khmc.put("value",data.getString("khmc"));
fields.add(khmc);
//最早出库日期
JSONObject zzckrq = new JSONObject();
zzckrq.put("showValue","最早出库日期");
zzckrq.put("name","field0007");
zzckrq.put("value",data.getString("zzckrq"));
fields.add(zzckrq);
//账期
JSONObject zq = new JSONObject();
zq.put("showValue","账期");
zq.put("name","field0002");
zq.put("value",data.getInteger("xyqxt"));
fields.add(zq);
//信用额度
JSONObject zxedwy = new JSONObject();
zxedwy.put("showValue","信用额度");
zxedwy.put("name","field0003");
zxedwy.put("value",data.getString("zxedwy"));
fields.add(zxedwy);
//是否超账期需要格式化枚举
String sfczqStr = data.getString("sfczq");
if(StrUtil.isNotEmpty(sfczqStr)){
if("".equals(sfczqStr)){
sfczqStr = "2243692026822872135";
}
if("".equals(sfczqStr)){
sfczqStr = "7200503983140586429";
}
//是否超账期
JSONObject sfczq = new JSONObject();
sfczq.put("showValue","是否超账期");
sfczq.put("name","field0012");
sfczq.put("value",sfczqStr);
fields.add(sfczq);
}
//超账期天数
JSONObject czqts = new JSONObject();
czqts.put("showValue","超账期天数");
czqts.put("name","field0016");
czqts.put("value",data.getString("czqts"));
fields.add(czqts);
//客户所属区域
JSONObject khssqy = new JSONObject();
khssqy.put("showValue","客户所属区域");
khssqy.put("name","field0022");
khssqy.put("value",data.getString("khssqy"));
fields.add(khssqy);
//是否超信用额度
String sfcxyedStr = data.getString("sfcxyed");
if(StrUtil.isNotEmpty(sfcxyedStr)){
if("".equals(sfcxyedStr)){
sfcxyedStr = "2243692026822872135";
}
if("".equals(sfcxyedStr)){
sfcxyedStr = "7200503983140586429";
}
//是否超账期
JSONObject sfcxyed = new JSONObject();
sfcxyed.put("showValue","是否超信用额度");
sfcxyed.put("name","field0018");
sfcxyed.put("value",sfcxyedStr);
fields.add(sfcxyed);
}
//超额度金额
JSONObject cedjew = new JSONObject();
cedjew.put("showValue","超额度金额");
cedjew.put("name","field0020");
cedjew.put("value",data.getString("cedjew"));
fields.add(cedjew);
//国内外
String gnwStr = data.getString("gnw");
if(StrUtil.isNotEmpty(gnwStr)){
if("国内".equals(gnwStr)){
gnwStr = "579326676033489409";
}
if("国外".equals(gnwStr)){
gnwStr = "-8968140678130349914";
}
//是否超账期
JSONObject gnw = new JSONObject();
gnw.put("showValue","国内外");
gnw.put("name","field0010");
gnw.put("value",gnwStr);
fields.add(gnw);
}
//逾期未收款
JSONObject yqwsk = new JSONObject();
yqwsk.put("showValue","逾期未收款");
yqwsk.put("name","field0024");
yqwsk.put("value",data.getString("yqwsk"));
fields.add(yqwsk);
//业务员
JSONObject ywy = new JSONObject();
ywy.put("showValue","业务员");
ywy.put("name","field0020");
ywy.put("value",data.getString("ywy"));
fields.add(ywy);
record.put("fields",fields);
masterTable.put("record",record);
dataObj.put("masterTable",masterTable);
dataList.add(dataObj);
resultJson.put("dataList",dataList);
return resultJson;
}
private JSONObject bdCrmData(JSONObject jsonObject) {
JSONObject main = new JSONObject();
JSONObject mainTable = jsonObject.getJSONObject("mainTable");
//主键
JSONObject mainid = mainTable.getJSONObject("id");
if(null != mainid){
main.put("id",mainid.getString("fieldValue"));
}
//客户名称
JSONArray khmc = mainTable.getJSONArray("khmc");
if(null != khmc && khmc.size()>0){
main.put("khmc",khmc.getJSONObject(0).getString("fieldOptionName"));
}
//客户编号
JSONObject u8ckhbh = mainTable.getJSONObject("u8ckhbh");
if(null != u8ckhbh){
main.put("u8ckhbh",u8ckhbh.getString("fieldValue"));
}
//公司
JSONArray gs = mainTable.getJSONArray("gs");
if(null != gs && gs.size()>0){
main.put("gs",gs.getJSONObject(0).getString("fieldOptionName"));
}
//信用额度万元
JSONObject zxedwy = mainTable.getJSONObject("zxedwy");
if(null != zxedwy){
main.put("zxedwy",zxedwy.getString("fieldValue"));
}
//信用期限
JSONObject xyqxt = mainTable.getJSONObject("xyqxt");
if(null != xyqxt){
main.put("xyqxt",xyqxt.getString("fieldValue"));
}
//是否超账期
JSONArray sfczq = mainTable.getJSONArray("sfczq");
if(null != sfczq && sfczq.size()>0){
main.put("sfczq",sfczq.getJSONObject(0).getString("fieldOptionName"));
}
//客户所属区域
JSONArray khssqy = mainTable.getJSONArray("khssqy");
if(null != khssqy && khssqy.size()>0){
main.put("khssqy",khssqy.getJSONObject(0).getString("fieldOptionName"));
}
//是否超信用额度
JSONArray sfcxyed = mainTable.getJSONArray("sfcxyed");
if(null != sfcxyed && sfcxyed.size()>0){
main.put("sfcxyed",sfcxyed.getJSONObject(0).getString("fieldOptionName"));
}
//超账期天数
JSONObject czqts = mainTable.getJSONObject("czqts");
if(null != czqts){
main.put("czqts",czqts.getString("fieldValue"));
}
//超额度金额
JSONObject cedjew = mainTable.getJSONObject("cedjew");
if(null != cedjew){
main.put("cedjew",cedjew.getString("fieldValue"));
}
//国内国外
JSONArray gnw = mainTable.getJSONArray("gnw");
if(null != gnw && gnw.size()>0){
main.put("gnw",gnw.getJSONObject(0).getString("fieldOptionName"));
}
//逾期未收款
JSONObject yqwsk = mainTable.getJSONObject("yqwsk");
if(null != yqwsk){
main.put("yqwsk",yqwsk.getString("fieldValue"));
}
//逾期未收款
JSONObject zzckrq = mainTable.getJSONObject("zzckrq");
if(null != zzckrq){
main.put("zzckrq",zzckrq.getString("fieldValue"));
}
//业务员
JSONArray ywy = mainTable.getJSONArray("ywy");
if(null != ywy && ywy.size()>0){
main.put("ywy",ywy.getJSONObject(0).getString("fieldOptionName"));
}
//
// JSONArray detail1 = jsonObject.getJSONArray("detail1");
// JSONArray detailsAdd = new JSONArray();
// if(null != detail1 && detail1.size()>0){
// detail1.forEach(item->{
// JSONObject detail = new JSONObject();
// JSONObject itemObj = (JSONObject) item;
// //调整日期
// JSONObject dzrq = itemObj.getJSONObject("dzrq");
// detail.put("dzrq",dzrq.getString("fieldValue"));
//
// //账期
// JSONObject zq = itemObj.getJSONObject("zq");
// detail.put("zq",zq.getString("fieldValue"));
// //额度
// JSONObject ed = itemObj.getJSONObject("ed");
// detail.put("ed",ed.getString("fieldValue"));
// //调整人
// JSONArray dzr = itemObj.getJSONArray("dzr");
// if(dzr.size()>0){
// detail.put("dzr",dzr.getJSONObject(0).getString("fieldOptionName"));
// }
// //id
// JSONObject id = itemObj.getJSONObject("id");
// detail.put("id",id.getString("fieldValue"));
// detailsAdd.add(detail);
//
// });
// }
return main;
}
public JSONArray getCrmCustomers(int num)throws Exception {
String method = "CRM_CustomerCreditFile_P002";
JSONObject main = new JSONObject();
main.put("access_name","oatocrm");
main.put("access_pwd","oatocrm");
main.put("corpid","bb1c9f7dddb8b44f23610c43da60403");
main.put("userid","1089749390615511042");
JSONObject datajson = new JSONObject();
JSONObject header = new JSONObject();
header.put("objId","1112666919331422216");
datajson.put("header",header);
JSONObject mainTable = new JSONObject();
mainTable.put("zt","0");
datajson.put("mainTable",mainTable);
JSONObject pageInfo = new JSONObject();
pageInfo.put("pageNo",num);
pageInfo.put("pageSize",1000);
datajson.put("pageInfo",pageInfo);
JSONObject operationinfo = new JSONObject();
operationinfo.put("isReturnDetail","y");
operationinfo.put("fieldNoFindIgnore","false");
datajson.put("operationinfo",operationinfo);
main.put("datajson",datajson);
String result = OACrmUtil.getCrmCustomer(method,main.toJSONString());
if(StrUtil.isEmpty(result)){
throw new RuntimeException("获取客户档案失败");
}
JSONObject resObj = JSONObject.parseObject(result);
JSONObject message = resObj.getJSONObject("message");
if(!"success".equals(message.getString("msg"))){
throw new RuntimeException("获取客户档案失败"+message.getString("msg"));
}
JSONObject data = resObj.getJSONObject("data");
JSONObject datajsons = data.getJSONObject("datajson");
JSONArray datas = datajsons.getJSONArray("datas");
return datas;
}
}

View File

@ -0,0 +1,109 @@
package com.hzya.frame.seeyon.util;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* com.hzya.frame.bip.v3.v2207.util
*
* @author makejava
* @date 2024-05 -30 14:20
*/
public class OACrmUtil {
private static String IP = "http://192.168.3.70:30800/ws/CRM/";
public static String getCrmCustomer(String method,String parm){
System.out.println("推送参数"+parm);
String result = HttpRequest.post(IP+method)
.header("reqid", "3906052d-2d72-4e01-96e3-053e0b47063e")//头信息多个头信息多次调用此方法即可
.header("reqfrom", "reqfrom")//头信息多个头信息多次调用此方法即可
.header("Authorization", "Basic b2EtWFNBUUY1NjE6WXZDWnNGNXQxR1k3bWlSYlcxWE5vcjlpRzZJeE5rYVQ=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
return result;
}
public static String sendBillToOa(String parm, String apiCode,String token){
String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
System.out.println("推送参数"+parm);
String result = HttpRequest.post(baseUrl)
.header("appId", "800023")//头信息多个头信息多次调用此方法即可
.header("access_token", token)//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
return analytic(result);
}
return null;
}
public static String getOaData(String parm, String apiCode,String token){
String baseUrl = "http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface";
System.out.println("推送参数"+parm);
String result = HttpRequest.post(baseUrl)
.header("appId", "800055")//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("token", token)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYA3QLcONeW3qKqiApiY18mzN1wTyrS8WJBzLp+jGmsJFhCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "I2Z0QGHykRnRUhuMuCliVONF2zz1uAI5FHb059netpVuqLC50JYLZHU0gb/kkMHGj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
return analytic(result);
}
return null;
}
public static String getOaToken(String parm, String apiCode){
String baseUrl = "http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface";
String result = HttpRequest.post(baseUrl)
.header("appId", "800055")//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYA3QLcONeW3qKqiApiY18mzN1wTyrS8WJBzLp+jGmsJFhCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "I2Z0QGHykRnRUhuMuCliVONF2zz1uAI5FHb059netpVuqLC50JYLZHU0gb/kkMHGj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
// System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
JSONObject obj = JSON.parseObject( analytic(result));
return obj.getString("id");
}
return null;
}
public static String getToken(String userCode, String apiCode){
String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
String result = HttpRequest.post(baseUrl)
.header("appId", "800023")//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("usercode", userCode)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body("")//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
JSONObject obj = JSON.parseObject( analytic(result));
JSONObject data = obj.getJSONObject("data");
return data.getString("access_token");
}
return null;
}
public static String analytic(String parm){
JSONObject main = JSON.parseObject(parm);
return main.getString("attribute");
}
}