diff --git a/README.md b/README.md index 0de6efe..e48d96f 100644 --- a/README.md +++ b/README.md @@ -1,43 +1 @@ -## 版权声明 -* BladeX是一个商业化软件,系列产品知识产权归**上海布雷德科技有限公司**独立所有 -* 您一旦开始复制、下载、安装或者使用本产品,即被视为完全理解并接受本协议的各项条款 -* 更多详情请看:[BladeX商业授权许可协议](/LICENSE) - -## 答疑流程 ->1. 遇到问题或Bug ->2. 业务型问题打断点调试尝试找出问题所在 ->3. 系统型问题通过百度、谷歌、社区查找解决方案 ->4. 未解决问题则进入技术社区进行发帖提问:[https://sns.bladex.vip/](https://sns.bladex.vip/) ->5. 将帖子地址发至商业群,特别简单三言两语就能描述清楚的也可在答疑时间内发至商业群提问 ->6. 发帖的时候一定要描述清楚,详细描述遇到问题的**重现步骤**、**报错详细信息**、**相关代码与逻辑**、**使用软件版本**以及**操作系统版本**,否则随意发帖提问将会提高我们的答疑难度。 - -## 答疑时间 -* 工作日:9:00 ~ 17:00 提供答疑,周末、节假日休息,暂停答疑 -* 请勿**私聊提问**,以免被其他用户的消息覆盖从而无法获得答疑 -* 答疑时间外遇到问题可以将问题发帖至[技术社区](https://sns.bladex.vip/),我们后续会逐个回复 - -## 授权范围 -* 专业版:只可用于**个人学习**及**个人私活**项目,不可用于公司或团队,不可泄露给任何第三方 -* 企业版:可用于**企业名下**的任何项目,企业版员工在**未购买**专业版授权前,只授权开发**所在授权企业名下**的项目,**不得将BladeX用于个人私活** -* 共同遵守:若甲方需要您提供项目源码,则需代为甲方购买BladeX企业授权,甲方购买后续的所有项目都无需再次购买授权 - -## 商用权益 -* ✔️ 遵守[商业协议](/LICENSE)的前提下,将BladeX系列产品用于授权范围内的商用项目,并上线运营 -* ✔️ 遵守[商业协议](/LICENSE)的前提下,不限制项目数,不限制服务器数 -* ✔️ 遵守[商业协议](/LICENSE)的前提下,将自行编写的业务代码申请软件著作权 - -## 何为侵权 -* ❌ 不遵守商业协议,私自销售商业源码 -* ❌ 以任何理由将BladeX源码用于申请软件著作权 -* ❌ 将商业源码以任何途径任何理由泄露给未授权的单位或个人 -* ❌ 开发完毕项目,没有为甲方购买企业授权,向甲方提供了BladeX代码 -* ❌ 基于BladeX拓展研发与BladeX有竞争关系的衍生框架,并将其开源或销售 - -## 侵权后果 -* 情节较轻:第一次发现警告处理 -* 情节较重:封禁账号,踢出商业群,并保留追究法律责任的权利 -* 情节严重:与本地律师事务所合作,以公司名义起诉侵犯计算机软件著作权 - -## 举报有奖 -* 向官方提供有用线索并成功捣毁盗版个人或窝点,将会看成果给予 500~10000 不等的现金奖励 -* 官方唯一指定QQ:1272154962 \ No newline at end of file +* \ No newline at end of file diff --git a/src/main/java/org/springblade/ftpdemo/service/Method.java b/src/main/java/org/springblade/ftpdemo/service/Method.java index 79ea09c..664d35d 100644 --- a/src/main/java/org/springblade/ftpdemo/service/Method.java +++ b/src/main/java/org/springblade/ftpdemo/service/Method.java @@ -8,7 +8,11 @@ import java.io.IOException; * @since 2022/11/27 */ public interface Method { - void upMethod(String readFile, String upSrc,String tableName,String operationName) throws Exception; + void upMethod(String readFile, String upSrc, String tableName, String operationName) throws Exception; - Boolean creatIdentificationUpFile(Integer type,String yyyyMMdd,String yyyyMMddToday) throws IOException; + Boolean creatIdentificationUpFile(Integer type, String yyyyMMdd, String yyyyMMddToday) throws IOException; + + Boolean creatForUpFile(Integer type, String yyyyMMdd, String yyyyMMddToday) throws IOException; + + Boolean creatFiveUpFile(Integer type, String yyyyMMdd, String yyyyMMddToday) throws IOException; } diff --git a/src/main/java/org/springblade/ftpdemo/service/impl/MethodImpl.java b/src/main/java/org/springblade/ftpdemo/service/impl/MethodImpl.java index a57dfbc..1940d9d 100644 --- a/src/main/java/org/springblade/ftpdemo/service/impl/MethodImpl.java +++ b/src/main/java/org/springblade/ftpdemo/service/impl/MethodImpl.java @@ -5,15 +5,16 @@ import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.ftpdemo.cache.CodeCache; import org.springblade.ftpdemo.controller.SSHRemoteCall; +import org.springblade.ftpdemo.entity.NbmsEnprefix; import org.springblade.ftpdemo.entity.NbmsEntApply; import org.springblade.ftpdemo.service.Method; +import org.springblade.ftpdemo.service.NbmsEnprefixService; import org.springblade.ftpdemo.service.NbmsEntApplyServcie; import org.springblade.ftpdemo.util.Constant; import org.springblade.ftpdemo.util.Encrypt; import org.springframework.stereotype.Service; import java.io.*; -import java.util.Date; import java.util.List; /** @@ -24,7 +25,6 @@ import java.util.List; @AllArgsConstructor public class MethodImpl implements Method { private final NbmsEntApplyServcie nbmsEntApplyServcie; - String companyCode; //标识码企业前缀 String companyName; // 标识解析节点经营主体名称 String level; // 标识解析系统级别 @@ -38,6 +38,7 @@ public class MethodImpl implements Method { String startIP = "223.99.228.240"; String endIP = "223.99.228.240"; String position = "中国山东省济南市自由贸易试验区济南片区颖秀路2299号"; + private NbmsEnprefixService enprefixService; @Override public void upMethod(String readFile, String upSrc, String tableName, String operationName) throws Exception { @@ -87,30 +88,31 @@ public class MethodImpl implements Method { /** * 生成三、 标识解析企业主体信息上报文件 + * * @param type 0 代表注册 1 代表修改 * @return */ @Override - public Boolean creatIdentificationUpFile(Integer type,String yyyyMMdd,String yyyyMMddToday) throws IOException { + public Boolean creatIdentificationUpFile(Integer type, String yyyyMMdd, String yyyyMMddToday) throws IOException { - List list =null; + List list = null; // 新增操作 - if (type==0) { - list = nbmsEntApplyServcie.lambdaQuery().eq(NbmsEntApply::getFirstAuditStatus, 2) - .eq(NbmsEntApply::getApplyType, 1) - .eq(NbmsEntApply::getApplyStep,4) - .ge(NbmsEntApply::getUpdateDate,yyyyMMdd) - .le(NbmsEntApply::getUpdateDate,yyyyMMddToday) - .list(); + if (type == 0) { + list = nbmsEntApplyServcie.lambdaQuery().eq(NbmsEntApply::getFirstAuditStatus, 2) + .eq(NbmsEntApply::getApplyType, 1) + .eq(NbmsEntApply::getApplyStep, 4) + .ge(NbmsEntApply::getUpdateDate, yyyyMMdd) + .le(NbmsEntApply::getUpdateDate, yyyyMMddToday) + .list(); } // 修改操作 - if (type==1){ - list = nbmsEntApplyServcie.lambdaQuery().eq(NbmsEntApply::getFirstAuditStatus, 2) + if (type == 1) { + list = nbmsEntApplyServcie.lambdaQuery().eq(NbmsEntApply::getFirstAuditStatus, 2) .eq(NbmsEntApply::getApplyType, 2) .eq(NbmsEntApply::getApplyType, 3) - .eq(NbmsEntApply::getApplyStep,4) - .ge(NbmsEntApply::getUpdateDate,yyyyMMdd) - .le(NbmsEntApply::getUpdateDate,yyyyMMddToday) + .eq(NbmsEntApply::getApplyStep, 4) + .ge(NbmsEntApply::getUpdateDate, yyyyMMdd) + .le(NbmsEntApply::getUpdateDate, yyyyMMddToday) .list(); } // 创建输出流 @@ -148,6 +150,103 @@ public class MethodImpl implements Method { return false; } + /** + * 四、 标识解析企业主体信息上报 + * + * @param type 0 代表注册 1 代表修改 + */ + @Override + public Boolean creatForUpFile(Integer type, String yyyyMMdd, String yyyyMMddToday) throws IOException { + List list = null; + if (type == 0) { + list = enprefixService.query() + .select("DISTINCT(ent_name)") + .ge("update_date", yyyyMMdd) + .le("update_date", yyyyMMddToday) + .eq("proxy_state", 4) + .list(); + } + if (Func.isEmpty(list)) { + return false; + } + // 创建输出流 + FileOutputStream stream = new FileOutputStream("d://aaa//test.txt"); + for (NbmsEnprefix enprefix : list) { + companyName = enprefix.getEntName(); + String template = companyName + "|" + startIP + "|" + endIP + "|" + position + "\n"; + byte[] bytes = template.getBytes(); + stream.write(bytes); + } + stream.flush(); + stream.close(); + return true; + } + + /** + * 五、 标识注册企业主体信息上报 + * + * @param type + * @param yyyyMMdd + * @param yyyyMMddToday + * @return + */ + @Override + public Boolean creatFiveUpFile(Integer type, String yyyyMMdd, String yyyyMMddToday) throws IOException { + + List list = null; + // 新增操作 + if (type == 0) { + list = nbmsEntApplyServcie.lambdaQuery().eq(NbmsEntApply::getFirstAuditStatus, 2) + .eq(NbmsEntApply::getApplyType, 1) + .eq(NbmsEntApply::getApplyStep, 4) + .ge(NbmsEntApply::getUpdateDate, yyyyMMdd) + .le(NbmsEntApply::getUpdateDate, yyyyMMddToday) + .list(); + } + // 修改操作 + if (type == 1) { + list = nbmsEntApplyServcie.lambdaQuery().eq(NbmsEntApply::getFirstAuditStatus, 2) + .eq(NbmsEntApply::getApplyType, 2) + .eq(NbmsEntApply::getApplyType, 3) + .eq(NbmsEntApply::getApplyStep, 4) + .ge(NbmsEntApply::getUpdateDate, yyyyMMdd) + .le(NbmsEntApply::getUpdateDate, yyyyMMddToday) + .list(); + } + // 创建输出流 + FileOutputStream stream = new FileOutputStream("d://aaa//test.txt"); + if (Func.isNotEmpty(list)) { + for (NbmsEntApply nbmsEnapply : list) { + companyCode = nbmsEnapply.getEntPrefix(); + companyName = nbmsEnapply.getOrgName(); +// level = "4"; + accessProvince = nbmsEnapply.getOrgAddrProvince(); + accessProvince = CodeCache.codeMap.get(accessProvince); + + accessCity = nbmsEnapply.getOrgAddrCity(); + accessCity = CodeCache.codeMap.get(accessCity); + + registerTime = DateUtil.format(nbmsEnapply.getUpdateDate(), "yyyy-MM-dd HH:mm:ss"); + + categoryA = nbmsEnapply.getIndustrySpecific(); + categoryA = CodeCache.codeMap.get(categoryA); + + categoryB = nbmsEnapply.getIndustryCategory(); + categoryB = CodeCache.codeMap.get(categoryB); + + companyType = judge(nbmsEnapply.getOrgNature()); + serviceProfession = categoryB; + + String template = companyCode + "|" + companyName + "|" + "|" + accessProvince + "|" + accessCity + "|" + registerTime + "|" + categoryA + "|" + categoryB + "|" + companyType + "|" + serviceProfession + "\n"; + byte[] bytes = template.getBytes(); + stream.write(bytes); + } + stream.flush(); + stream.close(); + return true; + } + return false; + } // private void deleteFile(String src) { diff --git a/src/main/java/org/springblade/ftpdemo/task/IdentificationUpTask.java b/src/main/java/org/springblade/ftpdemo/task/IdentificationUpTask.java index 4baeeb7..7024d6f 100644 --- a/src/main/java/org/springblade/ftpdemo/task/IdentificationUpTask.java +++ b/src/main/java/org/springblade/ftpdemo/task/IdentificationUpTask.java @@ -26,14 +26,25 @@ public class IdentificationUpTask { @Scheduled(cron = "0 0/1 * * * ?") public void refreshAliDeviceStatus() { - // 检测新增并上传 - packMethod(0); - // 检测更新并上传 - packMethod(1); + // 标识解析企业主体信息上报检测新增并上传 + threePackMethod(0); + // 标识解析企业主体信息上报检测更新并上传 + threePackMethod(1); + + fourPackMethod(0); + fourPackMethod(1); + + fivePackMethod(0); + fivePackMethod(1); + } - private void packMethod(Integer type) { + /** + * 三、 标识解析企业主体信息上报 + * @param type 0 新增 1 更新 + */ + private void threePackMethod(Integer type) { // 时间格式化 Date now = DateUtil.now(); Date date = DateUtil.minusDays(now, 1); @@ -56,6 +67,50 @@ public class IdentificationUpTask { // 要上传的目录 String upSrc = "/001/" + yyyyMMdd; // 表名(文件名的一部分) + String tableName = "SDQN-basic_identification-"; + String operationName = ""; + if (type == 0) { + // 操作类型为新增 + operationName = "-add.bin"; + } + if (type == 1) { + // 操作类型为更新 + operationName = "-update.bin"; + } + try { + method.upMethod(fileName, upSrc, tableName, operationName); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + /** + * 四、 标识解析企业主体信息上报 + * @param type 0 新增 1 更新 + */ + private void fourPackMethod(Integer type){ + // 时间格式化 + Date now = DateUtil.now(); + Date date = DateUtil.minusDays(now, 1); + String yyyyMMdd = DateUtil.format(date, "yyyyMMdd"); + String yyyyMMddToday = DateUtil.format(now, "yyyyMMdd"); + Boolean temp = false; + + try { + temp = method.creatForUpFile(type, yyyyMMdd, yyyyMMddToday); + } catch (IOException e) { + throw new RuntimeException(e); + } + // 如果没有生成文件,可直接结束 + if (!temp) { + return; + } + + String fileName = "d://aaa//test.txt"; + // 要上传的目录 + String upSrc = "/002/" + yyyyMMdd; + // 表名(文件名的一部分) String tableName = "SDQN-basic_identification_ip-"; String operationName = ""; if (type == 0) { @@ -71,6 +126,49 @@ public class IdentificationUpTask { } catch (Exception e) { throw new RuntimeException(e); } + } + + /** + * 五、 标识注册企业主体信息上报 + * @param type + */ + private void fivePackMethod(Integer type){ + // 时间格式化 + Date now = DateUtil.now(); + Date date = DateUtil.minusDays(now, 1); + String yyyyMMdd = DateUtil.format(date, "yyyyMMdd"); + String yyyyMMddToday = DateUtil.format(now, "yyyyMMdd"); + Boolean temp = false; + + try { + temp = method.creatFiveUpFile(type, yyyyMMdd, yyyyMMddToday); + } catch (IOException e) { + throw new RuntimeException(e); + } + // 如果没有生成文件,可直接结束 + if (!temp) { + return; + } + + String fileName = "d://aaa//test.txt"; + // 要上传的目录 + String upSrc = "/003/" + yyyyMMdd; + // 表名(文件名的一部分) + String tableName = "SDQN-basic_registered-"; + String operationName = ""; + if (type == 0) { + // 操作类型为新增 + operationName = "-add.bin"; + } + if (type == 1) { + // 操作类型为更新 + operationName = "-update.bin"; + } + try { + method.upMethod(fileName, upSrc, tableName, operationName); + } catch (Exception e) { + throw new RuntimeException(e); + } } }