Commit 0a903dfd authored by LSL's avatar LSL

浙农定时时间问题

parent a5c7c0db
...@@ -5,7 +5,6 @@ import cn.hutool.core.io.FileUtil; ...@@ -5,7 +5,6 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.extra.ssh.Sftp; import cn.hutool.extra.ssh.Sftp;
import com.jqtx.infrastructure.oss.starter.config.OssUtils; import com.jqtx.infrastructure.oss.starter.config.OssUtils;
import com.jqtx.windows.common.config.BaseConfig;
import com.jqtx.windows.common.config.SftpConfig; import com.jqtx.windows.common.config.SftpConfig;
import com.jqtx.windows.common.config.snow.SnowSequenceHelper; import com.jqtx.windows.common.config.snow.SnowSequenceHelper;
import com.jqtx.windows.component.BackedDetailComponent; import com.jqtx.windows.component.BackedDetailComponent;
...@@ -64,36 +63,42 @@ public class BackedBurdenJob { ...@@ -64,36 +63,42 @@ public class BackedBurdenJob {
public void run() { public void run() {
String param = XxlJobHelper.getJobParam(); String param = XxlJobHelper.getJobParam();
Sftp sftp = new Sftp(sftpConfig.getSshHost(), sftpConfig.getSshPort(), sftpConfig.getSshUser(), sftpConfig.getSshPass(), CharsetUtil.CHARSET_UTF_8); Sftp sftp = new Sftp(sftpConfig.getSshHost(), sftpConfig.getSshPort(), sftpConfig.getSshUser(), sftpConfig.getSshPass(), CharsetUtil.CHARSET_UTF_8);
String date = ""; try {
if (StringUtils.isNotEmpty(param)) { String date = "";
date = param; if (StringUtils.isNotEmpty(param)) {
}else { date = param;
Calendar cal = Calendar.getInstance(); } else {
//获取前面的时间用-负号 Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); //获取前面的时间用-负号
cal.add(Calendar.DAY_OF_MONTH, -1); cal.setTime(new Date());
Date time = cal.getTime(); cal.add(Calendar.DAY_OF_MONTH, -1);
date = DateUtil.format(time, "yyyyMMdd"); Date time = cal.getTime();
} date = DateUtil.format(time, "yyyyMMdd");
if (sftp.isDir("/download/assurance/" + date)) { }
sftp.cd("/download/assurance/" + date); if (sftp.isDir("/download/assurance/" + date)) {
sftp.get("assurance_" + date + ".txt", "/assurance_sftp.txt"); sftp.cd("/download/assurance/" + date);
ossUtils.ossUpload("ZN/assurance/" + "assurance_" + date + ".txt", FileUtil.file("/assurance_sftp.txt")); sftp.get("assurance_" + date + ".txt", "/assurance_sftp.txt");
String stringObject = getStringObject("ZN/assurance/" + "assurance_" + date + ".txt"); ossUtils.ossUpload("ZN/assurance/" + "assurance_" + date + ".txt", FileUtil.file("/assurance_sftp.txt"));
log.info("oss融担数据:{}", stringObject); String stringObject = getStringObject("ZN/assurance/" + "assurance_" + date + ".txt");
//存储并去平账 log.info("oss融担数据:{}", stringObject);
List<BurdenModel> getlist = getlist(stringObject); //存储并去平账
for (BurdenModel model : getlist) { List<BurdenModel> getlist = getlist(stringObject);
if (new BigDecimal(model.getPepayBurden()).compareTo(BigDecimal.ZERO) > 0 ) { for (BurdenModel model : getlist) {
backedBurdenComponent.insert(model); if (new BigDecimal(model.getPepayBurden()).compareTo(BigDecimal.ZERO) > 0) {
backedBurden(model); backedBurdenComponent.insert(model);
backedBurden(model);
}
} }
FileUtil.del("/assurance_sftp.txt");
} else {
log.info("浙农融担文件不存在:{}", date);
} }
FileUtil.del("/assurance_sftp.txt"); } catch (Exception e) {
} else { log.info("浙农代偿错误:{}", e.getMessage());
log.info("浙农融担文件不存在:{}", date); } finally {
//关闭sftp连接
sftp.close();
} }
} }
public String getStringObject(String uri) { public String getStringObject(String uri) {
......
...@@ -43,27 +43,34 @@ public class RedeemJob { ...@@ -43,27 +43,34 @@ public class RedeemJob {
public void run() { public void run() {
String param = XxlJobHelper.getJobParam(); String param = XxlJobHelper.getJobParam();
Sftp sftp = new Sftp(sftpConfig.getSshHost(), sftpConfig.getSshPort(), sftpConfig.getSshUser(), sftpConfig.getSshPass(), CharsetUtil.CHARSET_UTF_8); Sftp sftp = new Sftp(sftpConfig.getSshHost(), sftpConfig.getSshPort(), sftpConfig.getSshUser(), sftpConfig.getSshPass(), CharsetUtil.CHARSET_UTF_8);
String date = ""; try {
if (StringUtils.isNotEmpty(param)) { String date = "";
date = param; if (StringUtils.isNotEmpty(param)) {
}else { date = param;
Calendar cal = Calendar.getInstance(); } else {
//获取前面的时间用-负号 Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); //获取前面的时间用-负号
cal.add(Calendar.DAY_OF_MONTH, -1); cal.setTime(new Date());
Date time = cal.getTime(); cal.add(Calendar.DAY_OF_MONTH, -1);
date = DateUtil.format(time, "yyyyMMdd"); Date time = cal.getTime();
} date = DateUtil.format(time, "yyyyMMdd");
if (sftp.isDir("/download/compensatory/" + date)) { }
sftp.cd("/download/compensatory/" + date); if (sftp.isDir("/download/compensatory/" + date)) {
sftp.get("compensatory_" + date + ".txt", "/compensatory_sftp.txt"); sftp.cd("/download/compensatory/" + date);
ossUtils.ossUpload("ZN/compensatory/" + "compensatory_" + date + ".txt", FileUtil.file("/compensatory_sftp.txt")); sftp.get("compensatory_" + date + ".txt", "/compensatory_sftp.txt");
String stringObject = getStringObject("ZN/compensatory/" + "compensatory_" + date + ".txt"); ossUtils.ossUpload("ZN/compensatory/" + "compensatory_" + date + ".txt", FileUtil.file("/compensatory_sftp.txt"));
log.info("oss代偿数据:{}", stringObject); String stringObject = getStringObject("ZN/compensatory/" + "compensatory_" + date + ".txt");
redeemComponent.insert(getlist(stringObject)); log.info("oss代偿数据:{}", stringObject);
FileUtil.del("/compensatory_sftp.txt"); redeemComponent.insert(getlist(stringObject));
} else { FileUtil.del("/compensatory_sftp.txt");
log.info("浙农代偿文件不存在:{}", date); } else {
log.info("浙农代偿文件不存在:{}", date);
}
} catch (Exception e) {
log.info("浙农代偿错误:{}", e.getMessage());
} finally {
//关闭sftp连接
sftp.close();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment