wxr 2022-11-23 交银理财威科数据先行代码

main
wangxuanran 2022-11-23 21:16:45 +08:00
parent 618d1b2a3d
commit cf1bb661ed
28 changed files with 732 additions and 58 deletions

View File

@ -100,7 +100,7 @@
<beans>
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:application.properties" />
<property name="locations" value="classpath:application.properties"/>
</bean>
<bean id="basetest" class="basetest.BaseTestConfig">
<property name="serverName" value="${serverName}"/>

View File

@ -0,0 +1,16 @@
package weaver.xuanran.wang.common.annocation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <h1>Action</h1>
* @Author xuanran.wang
* @Date 2022/11/23 10:29
*/
@Target({ElementType.FIELD,ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ActionJobParam {
}

View File

@ -0,0 +1,18 @@
package weaver.xuanran.wang.common.annocation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <h1>action</h1>
*
* @Author xuanran.wang
* @Date 2022/11/23 10:23
*/
@Target({ElementType.FIELD,ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ParamNotNull {
String value() default "";
}

View File

@ -0,0 +1,46 @@
package weaver.xuanran.wang.common.mapper;
import aiyh.utils.annotation.recordset.Delete;
import aiyh.utils.annotation.recordset.ParamMapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import java.util.List;
/**
* @Author xuanran.wang
* @Date 2022/11/11 18:12
*/
@SqlMapper
public interface CommonMapper {
@Select(" select tablename \n" +
" from modeinfo t1 \n" +
" left join workflow_bill t2 \n" +
" on t1.formid = t2.id \n" +
" where t1.id = #{modelId}")
String getModelNameByModelId(@ParamMapper("modelId") String modelId);
/**
* <h1>id</h1>
* @author xuanran.wang
* @dateTime 2022/11/17 10:41
* @param tableName
* @param id id
* @return
**/
@Delete("delete from $t{tableName} where id = #{id}")
boolean deleteModelDataById(@ParamMapper("tableName") String tableName,
@ParamMapper("id") String id);
/**
* <h1>id</h1>
* @author xuanran.wang
* @dateTime 2022/11/17 10:41
* @param tableName
* @param ids ids
* @return
**/
@Delete("delete from $t{tableName} where id in (${ids})")
boolean deleteModelDataByIds(@ParamMapper("tableName") String tableName,
@ParamMapper("ids") List<String> ids);
}

View File

@ -0,0 +1,175 @@
package weaver.xuanran.wang.common.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.xuanran.wang.common.annocation.ParamNotNull;
import java.io.*;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
* <h1></h1>
* @Author xuanran.wang
* @Date 2022/11/23 10:25
*/
public class CommonUtil {
private final Logger logger = Util.getLogger();
public static final int SQL_IN_PAGE_SIZE = 100;
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/11/23 16:02
* @param srcFilePath
* @param acceptFilePath
**/
public static void unZip(String srcFilePath, String acceptFilePath) throws RuntimeException {
// 判断源文件是否存在
if (!new File(srcFilePath).exists()) {
throw new CustomerException(srcFilePath + " 路径不存在");
}
// 开始解压
ZipFile zipFile = null;
try {
zipFile = new ZipFile(new File(srcFilePath), Charset.forName("GBK"));
Enumeration<?> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
if (entry.isDirectory()) {
String dirPath = acceptFilePath + File.separator + entry.getName();
File dir = new File(dirPath);
dir.mkdirs();
} else {
String temp = acceptFilePath + File.separator + entry.getName();
File targetFile = new File(temp);
if(!targetFile.getParentFile().exists()){
targetFile.getParentFile().mkdirs();
}
targetFile.createNewFile();
InputStream is = zipFile.getInputStream(entry);
FileOutputStream fos = new FileOutputStream(targetFile);
int len;
byte[] buf = new byte[1024];
while ((len = is.read(buf)) != -1) {
fos.write(buf, 0, len);
}
// 关流顺序,先打开的后关闭
fos.close();
is.close();
}
}
} catch (Exception e) {
throw new CustomerException("解压文件出现异常: " + e.getMessage());
} finally {
if(zipFile != null){
try {
zipFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/11/23 17:22
* @param filePath
* @return
**/
public static String readFileByLines(String filePath) {
if(!new File(filePath).exists()){
return "";
}
File file = new File(filePath);
BufferedReader reader = null;
StringBuilder builder = new StringBuilder();
try {
reader = new BufferedReader(new FileReader(file));
String tempString = null;
// 一次读入一行直到读入null为文件结束
while ((tempString = reader.readLine()) != null) {
builder.append(tempString);
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException ie) {
}
}
}
return builder.toString();
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/11/23 15:59
* @param t
**/
public static <T> void checkParamNotNull(T t) throws IllegalAccessException {
Class<?> clazz = t.getClass();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
ParamNotNull paramNotNull = field.getDeclaredAnnotation(ParamNotNull.class);
if(paramNotNull == null){
continue;
}
field.setAccessible(true);
Object value = field.get(t);
Class<?> valueClass = field.getType();
boolean isNull = false;
if(valueClass.isAssignableFrom(String.class)){
if(StringUtils.isBlank(Util.null2String(value))){
isNull = true;
}
}
if(valueClass.isAssignableFrom(List.class)){
if(CollectionUtils.isEmpty((List) value)){
isNull = true;
}
}
if(valueClass.isAssignableFrom(Map.class)){
if(MapUtils.isEmpty((Map) value)){
isNull = true;
}
}
if(isNull){
throw new CustomerException("classPath : [ " + clazz.getName() + " ], field : [ " + field.getName() + " ] is not be null!");
}
}
}
public static <T> List<List<T>> splitList(List<T> list, int splitSize) {
//判断集合是否为空
if (CollectionUtils.isEmpty(list))
return Collections.emptyList();
//计算分割后的大小
int maxSize = (list.size() + splitSize - 1) / splitSize;
//开始分割
return Stream.iterate(0, n -> n + 1)
.limit(maxSize)
.parallel()
.map(a -> list.parallelStream().skip((long) a * splitSize).limit(splitSize).collect(Collectors.toList()))
.filter(b -> !b.isEmpty())
.collect(Collectors.toList());
}
}

View File

@ -0,0 +1,103 @@
package weaver.xuanran.wang.common.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
import aiyh.utils.sqlUtil.whereUtil.Where;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.formmode.data.ModeDataIdUpdate;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.TimeUtil;
import weaver.xuanran.wang.common.mapper.CommonMapper;
import java.util.List;
import java.util.Map;
/**
* @Author xuanran.wang
* @Date 2022/11/11 18:05
*/
public class CusInfoToOAUtil {
private static final CommonMapper commonMapper = Util.getMapper(CommonMapper.class);
private static final ModeDataIdUpdate modeDataIdUpdate = ModeDataIdUpdate.getInstance();
private static final ModeRightInfo moderightinfo = new ModeRightInfo();
private static final Logger log = Util.getLogger();
public static final String TABLE_NAME_PLACEHOLDER = "#\\{table}";
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/11/23 17:00
* @param modelId id
* @param params map
* @param whereSql sql
* @param whereParams
* @return id
**/
public static int execute(int modelId,
Map<String, Object> params,
String whereSql,
List<String> whereParams) {
if(modelId < 0){
throw new RuntimeException("建模模块id不能小于0!");
}
String tableName = commonMapper.getModelNameByModelId(String.valueOf(modelId));
if(StringUtils.isBlank(tableName)){
throw new CustomerException("模块id为 " + modelId + ", 在系统中暂没查询到对应表单!");
}
RecordSet rs = new RecordSet();
int mainId = -1;
boolean needModeRight = false;
if(StringUtils.isNotBlank(whereSql)){
whereSql = whereSql.replaceAll(TABLE_NAME_PLACEHOLDER, tableName);
if (rs.executeQuery(whereSql, whereParams) && rs.next()) {
mainId = Util.getIntValue(rs.getString(1),-1);
}
}
if(mainId < 0){
mainId = getNewIdByModelInfo(tableName, modelId);
needModeRight = true;
}
Where where = Util.createPrepWhereImpl()
.whereAnd("id").whereEqual(mainId);
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(
tableName,
params,
where
);
if (!rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs())) {
String error = Util.logStr("错误信息写入建模后置处理执行更新sql失败!" +
" 当前sql [{}], 当前参数 [{}], where条件[{}]", sqlResult.getSqlStr(),
JSONObject.toJSONString(sqlResult.getArgs()), mainId);
log.error(error);
throw new CustomerException(error);
}
if(needModeRight){
moderightinfo.rebuildModeDataShareByEdit(1, modelId, mainId);
}
return mainId;
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/11/23 21:02
* @param modelId id
* @param ids
* @return
**/
public static boolean deleteModelDataByIds(String modelId, List<String> ids){
String tableName = commonMapper.getModelNameByModelId(modelId);
return commonMapper.deleteModelDataByIds(tableName, ids);
}
private static Integer getNewIdByModelInfo(String modelTableName, int modelId){
String currentDateTime = TimeUtil.getCurrentTimeString();
//日期
String currentDate = currentDateTime.substring(0, 10);
//时间
String currentTime = currentDateTime.substring(11);
return modeDataIdUpdate.getModeDataNewId(modelTableName, modelId, 1, 0, currentDate, currentTime);
}
}

View File

@ -3,10 +3,6 @@ package weaver.xuanran.wang.traffic_bank.waco_first.entity;
import lombok.Data;
import weaver.xuanran.wang.traffic_bank.waco_first.annocation.BodyPath;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* <h1></h1>
*
@ -15,6 +11,7 @@ import javax.xml.bind.annotation.XmlRootElement;
*/
@Data
public class Info {
private String infoId;
private String adminPenaltyTitle;
private String trialCourt;
private String jurisdictionName;

View File

@ -1,8 +1,16 @@
package weaver.xuanran.wang.traffic_bank.waco_first.job;
import aiyh.utils.Util;
import com.jcraft.jsch.ChannelSftp;
import org.apache.log4j.Logger;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.xuanran.wang.common.annocation.ParamNotNull;
import weaver.xuanran.wang.common.util.CommonUtil;
import weaver.xuanran.wang.traffic_bank.waco_first.entity.Info;
import weaver.xuanran.wang.traffic_bank.waco_first.service.WacoDataPushOAService;
import weaver.xuanran.wang.util.FtpUtil;
import java.util.List;
/**
* <h1></h1>
@ -13,9 +21,58 @@ import weaver.interfaces.schedule.BaseCronJob;
public class WacoDataPushOA extends BaseCronJob {
private final Logger logger = Util.getLogger();
/**
* <h2>ftpUrl</h2>
**/
@ParamNotNull
private String ftpUrl;
/**
* <h2>ftp</h2>
**/
@ParamNotNull
private String ftpPort;
/**
* <h2>ftp</h2>
**/
@ParamNotNull
private String ftpUserName;
/**
* <h2>ftp</h2>
**/
@ParamNotNull
private String ftpPassWord;
/**
* <h2></h2>
**/
@ParamNotNull
private String localPath;
/**
* <h2>id</h2>
**/
@ParamNotNull
private String modelId;
/**
* <h2> -1</h2>
**/
private String secCategory;
private final WacoDataPushOAService dataPushOAService = new WacoDataPushOAService();
@Override
public void execute() {
try {
CommonUtil.checkParamNotNull(this);
ChannelSftp connect = FtpUtil.connect(ftpUrl, Util.getIntValue(ftpPort), ftpUserName, ftpPassWord);
List<Info> infos = dataPushOAService.getInfoListFromFtp(connect, localPath);
dataPushOAService.writeInfoToOA(Util.getIntValue(modelId, -1),Util.getIntValue(secCategory, -1), infos);
} catch (Exception e) {
logger.error(Util.logStr("计划任务执行失败!, 具体异常信息 : {}", e.getMessage()));
}
}
}

View File

@ -1,15 +1,33 @@
package weaver.xuanran.wang.traffic_bank.waco_first.service;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;
import com.weaver.procedure.doc.Doc_diracl_insert_type3;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.docs.webservices.DocInfo;
import weaver.docs.webservices.DocServiceImpl;
import weaver.general.GCONST;
import weaver.general.TimeUtil;
import weaver.hrm.User;
import weaver.xuanran.wang.common.util.CommonUtil;
import weaver.xuanran.wang.common.util.CusInfoToOAUtil;
import weaver.xuanran.wang.traffic_bank.waco_first.annocation.BodyPath;
import weaver.xuanran.wang.traffic_bank.waco_first.entity.Info;
import weaver.xuanran.wang.util.FtpUtil;
import java.io.File;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
/**
@ -20,6 +38,107 @@ import java.util.regex.Matcher;
*/
public class WacoDataPushOAService {
private static final String SUFFIX = ".zip";
private static final String DATA_SUFFIX = ".xml";
private final Logger logger = Util.getLogger();
private static final String WACO_TEMP_PATH = File.separator + "WACO" + File.separator + "temp" + File.separator;
private static final String INSERT_DOC_DETAIL_CONTENT_SQL = "insert into docdetailcontent(docid,doccontent) values(?,?)";
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/11/23 16:29
* @param connect ftp
* @param localPath ftp
* @return xml
**/
public List<Info> getInfoListFromFtp(ChannelSftp connect, String localPath){
// 获取当天日期文件存在格式 /files/administrativePenalty/2022/05/30/20220530.zip
String currentDate = TimeUtil.getCurrentDateString();
String[] currentDateSplit = currentDate.split("-");
String currentDatePath = StringUtils.join(currentDateSplit, "/");
// 进行路径拼接
localPath += currentDatePath;
String fileName = currentDate.replaceAll("-","") + SUFFIX;
String realPath = localPath + "/" + fileName;
logger.info(Util.logStr("ftp文件路径:{}, 文件名:{}, 全路径:{}",localPath, fileName, realPath));
if (!FtpUtil.isExist(localPath, fileName, connect)) {
throw new CustomerException("ftp上不存在 " + localPath + "/" + fileName + " 文件, 请检查!");
}
// 临时路径
String zipOATempPath = GCONST.getSysFilePath() + WACO_TEMP_PATH + fileName;
logger.info(Util.logStr("存放OA临时文件路径:{}", zipOATempPath));
if (!FtpUtil.download(localPath, fileName, zipOATempPath, connect)) {
logger.error(Util.logStr("从ftp下载文件失败!"));
}
String tempFolder = GCONST.getSysFilePath() + WACO_TEMP_PATH;
// 进行解压
CommonUtil.unZip(zipOATempPath,tempFolder);
ArrayList<Info> infos = new ArrayList<>();
try {
getAllInfoByPath(infos, tempFolder, DATA_SUFFIX);
}catch (Exception e){
throw new CustomerException("获取指定文件夹下的所有xml信息出现异常: " + e.getMessage());
}
if(CollectionUtils.isEmpty(infos)){
throw new CustomerException("获取到xml信息集合为空,请检查!");
}
return infos;
}
public void writeInfoToOA(int modelId, int secCategory, List<Info> infos) {
String whereSql = "select 1 from " + CusInfoToOAUtil.TABLE_NAME_PLACEHOLDER + " where infoId = ?";
List<String> ids = new ArrayList<>();
try {
for (Info info : infos) {
Map<String, Object> param = getParamsMapByInfo(secCategory, info);
int dataId = CusInfoToOAUtil.execute(modelId, param,
whereSql,
Collections.singletonList(info.getInfoId()));
ids.add(String.valueOf(dataId));
}
}catch (Exception e){
logger.error(Util.logStr("写入建模出现异常:[{}]", e.getMessage()));
List<List<String>> splitList = CommonUtil.splitList(ids, CommonUtil.SQL_IN_PAGE_SIZE);
for (List<String> list : splitList) {
if (!CusInfoToOAUtil.deleteModelDataByIds(String.valueOf(modelId), list)) {
logger.error(Util.logStr("删除数据失败, 数据集合 : [{}] ", JSONObject.toJSONString(list)));
}
}
}
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/11/23 21:09
* @param secCategory
* @param info
* @return
**/
public Map<String, Object> getParamsMapByInfo(int secCategory, Info info) throws Exception {
Class<? extends Info> clazz = info.getClass();
Field[] fields = clazz.getDeclaredFields();
HashMap<String, Object> res = new HashMap<>();
for (Field field : fields) {
field.setAccessible(true);
Object value = field.get(info);
BodyPath annotation = field.getDeclaredAnnotation(BodyPath.class);
if(annotation != null){
DocInfo docInfo = new DocInfo();
docInfo.setSeccategory(secCategory);
docInfo.setDocSubject(Util.null2String(info.getAdminPenaltyTitle()));
String body = CommonUtil.readFileByLines(info.getBodyPath());
docInfo.setDoccontent(body);
DocServiceImpl docService = new DocServiceImpl();
int docId = docService.createDocByUser(docInfo, new User(1));
res.put(field.getName(), docId);
}else {
res.put(field.getName(), value);
}
}
return res;
}
/**
* <h1>xml</h1>
* @author xuanran.wang
@ -39,6 +158,7 @@ public class WacoDataPushOAService {
}else {
if (childFile.getName().endsWith(suffix)) {
Info info = xmlStrToObject(path + File.separator + childFile.getName());
info.setInfoId(childFile.getName());
res.add(info);
}
}

View File

@ -1,6 +1,7 @@
package weaver.xuanran.wang.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.jcraft.jsch.*;
import org.apache.log4j.Logger;
@ -18,7 +19,8 @@ import java.util.Vector;
* @Date 2022/11/22 17:25
*/
public class FtpUtil {
private final Logger logger = Util.getLogger();
private static final Logger logger = Util.getLogger();
/**
* <h1>ftp</h1>
* @author xuanran.wang
@ -29,7 +31,8 @@ public class FtpUtil {
* @param password
* @return
**/
public ChannelSftp connect(String host, int port, String username, String password) {
public static ChannelSftp connect(String host, int port, String username, String password) {
logger.info(Util.logStr("--------- stp connect begin host : [{}], port : [{}], username : [{}], password : [{}] ---------", host, port, username, password));
ChannelSftp sftp = null;
Channel channel=null;
Session sshSession=null;
@ -42,16 +45,9 @@ public class FtpUtil {
sshConfig.put("StrictHostKeyChecking", "no");
sshSession.setConfig(sshConfig);
sshSession.connect();
if(logger.isInfoEnabled()){
logger.info("***************** Session connected. **********************");
logger.info("***************** Opening Channel. **********************");
}
channel = sshSession.openChannel("sftp");
channel.connect();
sftp = (ChannelSftp) channel;
if(logger.isInfoEnabled()){
logger.info("***************** Connected to " + host + ". **********************");
}
} catch (Throwable e) {
if (channel!=null) {
try {
@ -76,7 +72,7 @@ public class FtpUtil {
*
* @param sftp
*/
public void disconnect(String host, ChannelSftp sftp){
public static void disconnect(String host, ChannelSftp sftp){
// 关闭连接
try {
if (null != sftp) {
@ -106,7 +102,7 @@ public class FtpUtil {
* @param sftp
* @return
*/
public boolean isExist(String directory, String fileName, ChannelSftp sftp) {
public static boolean isExist(String directory, String fileName, ChannelSftp sftp) {
try {
Vector<ChannelSftp.LsEntry> v = listFiles(directory, sftp);
Iterator<ChannelSftp.LsEntry> it = v.iterator();
@ -129,7 +125,7 @@ public class FtpUtil {
* @param uploadFile
* @param sftp
*/
public boolean upload(String directory, String uploadFile, ChannelSftp sftp) {
public static boolean upload(String directory, String uploadFile, ChannelSftp sftp) {
boolean successFlg = true;
try {
sftp.cd(directory);
@ -151,25 +147,17 @@ public class FtpUtil {
* @param saveFile
* @param sftp
*/
public boolean download(String directory, String downloadFile, String saveFile, ChannelSftp sftp) {
public static boolean download(String directory, String downloadFile, String saveFile, ChannelSftp sftp) {
boolean successFlg = true;
try {
logger.info("下载目录为 " + directory);
sftp.cd(directory);
File file = new File(saveFile);
if(!file.getParentFile().exists()){
file.getParentFile().mkdirs();
}
String pwd = sftp.pwd();
logger.info("pwd => " + pwd);
logger.info("downloadFile => " + downloadFile);
sftp.get(downloadFile, new FileOutputStream(file));
if(logger.isInfoEnabled()){
logger.info("***************** Finished **********************");
}
} catch (Exception e) {
successFlg = false;
logger.info("下载文件出现异常 => " + e.getMessage());
throw new CustomerException("下载文件出现异常: " + e.getMessage());
}
return successFlg;
}
@ -180,7 +168,7 @@ public class FtpUtil {
* @param deleteFile
* @param sftp
*/
public void delete(String directory, String deleteFile, ChannelSftp sftp) {
public static void delete(String directory, String deleteFile, ChannelSftp sftp) {
try {
sftp.cd(directory);
sftp.rm(deleteFile);
@ -205,14 +193,14 @@ public class FtpUtil {
* @return
* @throws SftpException
*/
public Vector<ChannelSftp.LsEntry> listFiles(String directory, ChannelSftp sftp) throws SftpException {
public static Vector<ChannelSftp.LsEntry> listFiles(String directory, ChannelSftp sftp) throws SftpException {
return sftp.ls(directory);
}
/**
*
*/
public void makeDirs(String localSavePath) {
public static void makeDirs(String localSavePath) {
File localFile = new File(localSavePath);
if (!localFile.exists()) {
localFile.mkdirs();

View File

@ -1,4 +0,0 @@
serverName=ecology
rootPath=F:\wxr\e9-project-ebu7-dev1\src\main\resources\resources
systemFilePath=F:\wxr\e9-project-ebu7-dev1\src\main\resources\file
logPath=F:\wxr\e9-project-ebu7-dev1\src\main\resources\log

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:application.properties" />
</bean>
<bean id="basetest" class="basetest.BaseTestConfig">
<property name="serverName" value="${serverName}"/>
<property name="rootPath" value="${rootPath}"/>
<property name="systemFilePath" value="${systemFilePath}"/>
<property name="logPath" value="${logPath}"/>
</bean>
</beans>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="2E058366389">
<info>
<adminPenaltyTitle>唐山银保监分局行政处罚信息公开表唐银保监罚决字202216号</adminPenaltyTitle>
<trialCourt>中国银行保险监督管理委员会唐山监管分局</trialCourt>
<jurisdictionName>唐山市</jurisdictionName>
<adminPenaltyNumber>唐银保监罚决字202216号</adminPenaltyNumber>
<industryClassification>金融/银行</industryClassification>
<adminPenaltyDate>2022.09.14</adminPenaltyDate>
<punishmentObjectType>银行监督/个人;银行监督/银行类金融机构/六大行</punishmentObjectType>
<punishedParties>中国农业银行股份有限公司唐山丰润支行</punishedParties>
<punishedPeople>江宁(时任中国农业银行股份有限公司唐山丰润支行行长)</punishedPeople>
<lawAccording>《中华人民共和国银行业监督管理法》第四十六条、第四十八条</lawAccording>
<punishmentCause>银行监督/违反审慎经营规则</punishmentCause>
<punishmentResult>银行监督/罚款;银行监督/警告</punishmentResult>
<punishmentAmount>25万元不含---30万元</punishmentAmount>
<bodyPath>./2E058366389/body.txt</bodyPath>
</info>
</article>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="2E058366391">
<info>
<adminPenaltyTitle>唐山银保监分局行政处罚信息公开表唐银保监罚决字202215号</adminPenaltyTitle>
<trialCourt>中国银行保险监督管理委员会唐山监管分局</trialCourt>
<jurisdictionName>唐山市</jurisdictionName>
<adminPenaltyNumber>唐银保监罚决字202215号</adminPenaltyNumber>
<industryClassification>金融/银行</industryClassification>
<adminPenaltyDate>2022.09.14</adminPenaltyDate>
<punishmentObjectType>银行监督/银行类金融机构/六大行;银行监督/个人</punishmentObjectType>
<punishedParties>中国农业银行股份有限公司唐山广场支行</punishedParties>
<punishedPeople>许卿(时任中国农业银行股份有限公司唐山广场支行行长)</punishedPeople>
<lawAccording>《中华人民共和国银行业监督管理法》第四十六条、第四十八条</lawAccording>
<punishmentCause>银行监督/违反审慎经营规则</punishmentCause>
<punishmentResult>银行监督/警告;银行监督/罚款</punishmentResult>
<punishmentAmount>25万元不含---30万元</punishmentAmount>
<bodyPath>./2E058366391/body.txt</bodyPath>
</info>
</article>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="2E058366432">
<info>
<adminPenaltyTitle>唐山银保监分局行政处罚信息公开表唐银保监罚决字202214号</adminPenaltyTitle>
<trialCourt>中国银行保险监督管理委员会唐山监管分局</trialCourt>
<jurisdictionName>唐山市</jurisdictionName>
<adminPenaltyNumber>唐银保监罚决字202214号</adminPenaltyNumber>
<industryClassification>金融/银行</industryClassification>
<adminPenaltyDate>2022.09.14</adminPenaltyDate>
<punishmentObjectType>银行监督/个人;银行监督/银行类金融机构/六大行</punishmentObjectType>
<punishedParties>中国农业银行股份有限公司唐山龙泽路支行</punishedParties>
<punishedPeople>吕秀阁(时任中国农业银行股份有限公司唐山龙泽路支行行长)</punishedPeople>
<lawAccording>《中华人民共和国银行业监督管理法》第四十六条、第四十八条</lawAccording>
<punishmentCause>银行监督/违反审慎经营规则</punishmentCause>
<punishmentResult>银行监督/警告;银行监督/罚款</punishmentResult>
<punishmentAmount>35万元不含---40万元</punishmentAmount>
<bodyPath>./2E058366432/body.txt</bodyPath>
</info>
</article>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="2E058366443">
<info>
<adminPenaltyTitle>中国银保监会绍兴监管分局行政处罚信息公开表绍银保监罚决字20228号</adminPenaltyTitle>
<trialCourt>中国银行保险监督管理委员会绍兴监管分局</trialCourt>
<jurisdictionName>绍兴市</jurisdictionName>
<adminPenaltyNumber>绍银保监罚决字20228号</adminPenaltyNumber>
<industryClassification>金融/银行</industryClassification>
<adminPenaltyDate>2022.09.14</adminPenaltyDate>
<punishmentObjectType>银行监督/银行类金融机构/全国股份制银行</punishmentObjectType>
<punishedParties>上海浦东发展银行股份有限公司绍兴分行</punishedParties>
<punishedPeople>上海浦东发展银行股份有限公司绍兴分行(胡牧)</punishedPeople>
<lawAccording>《中华人民共和国银行业监督管理法》第四十六条第五项</lawAccording>
<punishmentCause>银行监督/违反审慎经营规则</punishmentCause>
<punishmentResult>银行监督/罚款</punishmentResult>
<punishmentAmount>15万元不含---20万元</punishmentAmount>
<bodyPath>./2E058366443/body.txt</bodyPath>
</info>
</article>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="2E058366448">
<info>
<adminPenaltyTitle>泉州银保监分局行政处罚信息公开表泉银保监罚决字202212号</adminPenaltyTitle>
<trialCourt>中国银行保险监督管理委员会泉州监管分局</trialCourt>
<jurisdictionName>泉州市</jurisdictionName>
<adminPenaltyNumber>泉银保监罚决字202212号</adminPenaltyNumber>
<industryClassification>金融/银行</industryClassification>
<adminPenaltyDate>2022.09.14</adminPenaltyDate>
<punishmentObjectType>银行监督/银行类金融机构/六大行</punishmentObjectType>
<punishedParties>中国工商银行股份有限公司泉州分行</punishedParties>
<punishedPeople>中国工商银行股份有限公司泉州分行(郑一鹏)</punishedPeople>
<lawAccording>《中国银监会办公厅关于加强银行业金融机构内控管理有效防范柜面业务操作风险的通知》银监办发201597号第十二条《中国银监会办公厅关于进一步强化内控合规管理防范案件风险的通知》银监办发201710号第四条、第六条《中国银监会办公厅关于进一步加强网上银行风险防控工作的通知》银监办发201162号第三条《中华人民共和国银行业监督管理法》第二十一条第三款、第四十六条第</lawAccording>
<punishmentCause>银行监督/违反审慎经营规则</punishmentCause>
<punishmentResult>银行监督/罚款</punishmentResult>
<punishmentAmount>25万元不含---30万元</punishmentAmount>
<bodyPath>./2E058366448/body.txt</bodyPath>
</info>
</article>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="2E058366449">
<info>
<adminPenaltyTitle>泉州银保监分局行政处罚信息公开表泉银保监罚决字202211号</adminPenaltyTitle>
<trialCourt>中国银行保险监督管理委员会泉州监管分局</trialCourt>
<jurisdictionName>泉州市</jurisdictionName>
<adminPenaltyNumber>泉银保监罚决字202211号</adminPenaltyNumber>
<industryClassification>金融/银行</industryClassification>
<adminPenaltyDate>2022.09.14</adminPenaltyDate>
<punishmentObjectType>银行监督/个人;银行监督/银行类金融机构/六大行</punishmentObjectType>
<punishedParties>中国工商银行股份有限公司泉州丰泽支行</punishedParties>
<punishedPeople>中国工商银行股份有限公司泉州丰泽支行(陈彬莲)</punishedPeople>
<lawAccording>《中国银监会办公厅关于银行自助设备管理风险提示的通知》银监办发2014124号第六条《中国银监会办公厅关于加强银行业金融机构内控管理有效防范柜面业务操作风险的通知》银监办发201597号第十二条《中国银监会办公厅关于加强银行业消费者权益保护解决当前群众关切问题的指导意见》银监办发201625号第二条《中国银监会办公厅关于进一步强化内控合规管理防范案件风险的通知》银监办发201710号第四条、第六条《中华人民共和国银行业监督管理法》第二十一条第三款、第四十六条第项、第四十八条第</lawAccording>
<punishmentCause>银行监督/违反审慎经营规则</punishmentCause>
<punishmentResult>银行监督/警告;银行监督/罚款</punishmentResult>
<punishmentAmount>45万元不含---50万元</punishmentAmount>
<bodyPath>./2E058366449/body.txt</bodyPath>
</info>
</article>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="2E058366450">
<info>
<adminPenaltyTitle>泉州银保监分局行政处罚信息公开表泉银保监罚决字202210号</adminPenaltyTitle>
<trialCourt>中国银行保险监督管理委员会泉州监管分局</trialCourt>
<jurisdictionName>泉州市</jurisdictionName>
<adminPenaltyNumber>泉银保监罚决字202210号</adminPenaltyNumber>
<industryClassification>金融/银行</industryClassification>
<adminPenaltyDate>2022.09.14</adminPenaltyDate>
<punishmentObjectType>银行监督/个人;银行监督/银行类金融机构/六大行</punishmentObjectType>
<punishedParties>中国工商银行股份有限公司泉州津淮街支行</punishedParties>
<punishedPeople>中国工商银行股份有限公司泉州津淮街支行(邱燕芳、黄原英、黄春凤、柯文瑜)</punishedPeople>
<lawAccording>《中国银监会办公厅关于加强银行业金融机构内控管理有效防范柜面业务操作风险的通知》银监办发201597号第十二条《中国银监会办公厅关于加强银行业消费者权益保护解决当前群众关切问题的指导意见》银监办发201625号第二条第项《中国银监会办公厅关于进一步强化内控合规管理防范案件风险的通知》银监办发201710号第四条、第六条《中华人民共和国银行业监督管理法》第二十一条第三款、第四十六条第项、第四十八条第</lawAccording>
<punishmentCause>银行监督/违反审慎经营规则</punishmentCause>
<punishmentResult>银行监督/罚款;银行监督/警告;银行监督/取消终身任职资格</punishmentResult>
<punishmentAmount />
<bodyPath>./2E058366450/body.txt</bodyPath>
</info>
</article>

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,11 +1,24 @@
package xuanran.wang.traffic_bank.waco_first;
import aiyh.utils.excention.CustomerException;
import basetest.BaseTest;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.DailyRollingFileAppender;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.Priority;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.general.GCONST;
import weaver.general.TimeUtil;
import weaver.xuanran.wang.common.util.CommonUtil;
import weaver.xuanran.wang.traffic_bank.waco_first.entity.Info;
import weaver.xuanran.wang.traffic_bank.waco_first.service.WacoDataPushOAService;
import weaver.xuanran.wang.util.FtpUtil;
import java.io.File;
import java.util.ArrayList;
/**
@ -24,16 +37,35 @@ public class WacoFirstTest extends BaseTest {
**/
@Test
public void testParseXml() throws Exception {
ArrayList<Info> infos = new ArrayList<>();
wacoDataPushOAService.getAllInfoByPath(infos, "F:\\wxr\\项目\\交银理财\\威科先行\\20220924","xml");
System.out.println(infos);
for (Info info : infos) {
System.out.println("解析的对象 \n : ");
System.out.println(JSONObject.toJSONString(info));
System.out.println("\n");
System.out.println("文件地址 : " + info.getBodyPath());
System.out.println("info " + JSONObject.toJSONString(infos));
}
/**
* <h1>xml</h1>
* @author xuanran.wang
* @dateTime 2022/11/22 21:22
**/
@Test
public void testUnZipFile() throws Exception {
String currentDate = TimeUtil.getCurrentDateString();
String WACO_TEMP_PATH = "WACO" + File.separator + "temp" + File.separator;
String fileName = currentDate.replaceAll("-","") + ".zip";
String zipOATempPath = GCONST.getSysFilePath() + WACO_TEMP_PATH + fileName;
String tempFolder = GCONST.getSysFilePath() + WACO_TEMP_PATH;
// 进行解压
CommonUtil.unZip(zipOATempPath,tempFolder);
ArrayList<Info> infos = new ArrayList<>();
try {
wacoDataPushOAService.getAllInfoByPath(infos, tempFolder, ".xml");
}catch (Exception e){
throw new CustomerException("获取指定文件夹下的所有xml信息出现异常: " + e.getMessage());
}
// String name = "./2E058366389/body.txt";
// System.out.println(name.replaceAll("/","a"));
if(CollectionUtils.isEmpty(infos)){
throw new CustomerException("获取到xml信息集合为空,请检查!");
}
System.out.println("infos : \n " + JSONObject.toJSONString(infos));
}
}