|
|
|
@ -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<NbmsEntApply> list =null; |
|
|
|
|
List<NbmsEntApply> 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<NbmsEnprefix> 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<NbmsEntApply> 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) {
|
|
|
|
|