Commit bb3d571c by liyanlin

fix

parent e1419cd8
......@@ -7,9 +7,12 @@ import com.bailuntec.job.service.BalanceSheetService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@RestController
......@@ -22,7 +25,28 @@ public class BalanceSheetController {
@GetMapping("/generate")
public String doScheduledTask(){
try{
balanceSheetService.generateBalanceSheet();
balanceSheetService.generateBalanceSheet(null);
}catch (Exception e){
e.printStackTrace();
logger.error(">>>>>生成资产负债表出错" + e.getMessage());
return "生成资产负债表出错";
}
return "生成资产负债表成功";
}
@PostMapping("/reload")
public String reload(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate localDate){
try{
LocalDateTime localDateTime = localDate.atTime(23,59,59);
balanceSheetService.syncBankAccount(localDate);
balanceSheetService.syncWithdrawOnWaySummary(localDate);
balanceSheetService.syncPayPal(localDateTime);
balanceSheetService.syncShortBorrowBalance(localDate);
balanceSheetService.syncCost(localDate);
balanceSheetService.syncBuy(localDate);
balanceSheetService.syncSemiInventoryBalance(localDate);
balanceSheetService.generateBalanceSheet(localDate);
balanceSheetService.getSupplierTransaction(localDate);
}catch (Exception e){
e.printStackTrace();
logger.error(">>>>>生成资产负债表出错" + e.getMessage());
......
......@@ -20,7 +20,7 @@ public class BalanceSheetJob {
public void syncBankAccount() {
try {
log.info("每天1点同步 银行帐号信息 开始");
balanceSheetService.syncBankAccount();
balanceSheetService.syncBankAccount(null);
log.info("每天1点同步 银行帐号信息 结束");
} catch (Exception ex) {
log.error("每天1点同步 银行帐号信息 异常:", ex);
......@@ -34,7 +34,7 @@ public class BalanceSheetJob {
public void syncWithdrawOnWaySummary() {
try {
log.info("每天1点 同步提现在途 开始");
balanceSheetService.syncWithdrawOnWaySummary();
balanceSheetService.syncWithdrawOnWaySummary(null);
log.info("每天1点 同步提现在途 结束");
} catch (Exception ex) {
log.error("每天1点 同步提现在途 异常:", ex);
......@@ -48,7 +48,7 @@ public class BalanceSheetJob {
public void syncPayPal() {
try {
log.info("每天1点 同步第三方余额 开始");
balanceSheetService.syncPayPal();
balanceSheetService.syncPayPal(null);
log.info("每天1点 同步第三方余额 结束");
} catch (Exception ex) {
log.error("每天1点 同步第三方余额 异常:", ex);
......@@ -64,7 +64,7 @@ public class BalanceSheetJob {
public void syncShortBorrowBalance() {
try {
log.info("每天1点 同步提现在途 开始");
balanceSheetService.syncShortBorrowBalance();
balanceSheetService.syncShortBorrowBalance(null);
log.info("每天1点 同步提现在途 结束");
} catch (Exception ex) {
log.error("每天1点 同步提现在途 异常:", ex);
......@@ -78,7 +78,7 @@ public class BalanceSheetJob {
public void syncCost() {
try {
log.info("每天1点 同步数据中心需要的费用单 开始");
balanceSheetService.syncCost();
balanceSheetService.syncCost(null);
log.info("每天1点 同步数据中心需要的费用单 结束");
} catch (Exception ex) {
log.error("每天1点 同步数据中心需要的费用单 异常:", ex);
......@@ -93,7 +93,7 @@ public class BalanceSheetJob {
public void syncBuy() {
try {
log.info("每天1点 同步费用系统采购单 开始");
balanceSheetService.syncBuy();
balanceSheetService.syncBuy(null);
log.info("每天1点 同步费用系统采购单 结束");
} catch (Exception ex) {
log.error("每天1点 同步费用系统采购单 异常:", ex);
......@@ -109,7 +109,7 @@ public class BalanceSheetJob {
public void syncSemiInventoryBalance() {
try {
log.info("每天 生成半成品数据 开始");
balanceSheetService.syncSemiInventoryBalance();
balanceSheetService.syncSemiInventoryBalance(null);
log.info("每天 生成半成品数据 结束");
} catch (Exception ex) {
log.error("每天 生成半成品数据 异常:", ex);
......@@ -143,7 +143,7 @@ public class BalanceSheetJob {
public void generateBalanceSheet() {
try {
log.info("每天3点 生成资产负债表 开始");
balanceSheetService.generateBalanceSheet();
balanceSheetService.generateBalanceSheet(null);
log.info("每天3点 生成资产负债表 结束");
} catch (Exception ex) {
log.error("每天3点 生成资产负债表 异常:", ex);
......@@ -154,7 +154,7 @@ public class BalanceSheetJob {
public void getSupplierTransaction() {
try {
log.info("每天4点 取供应商往来数据:应付账款和预付账款 开始");//
balanceSheetService.getSupplierTransaction();
balanceSheetService.getSupplierTransaction(null);
log.info("每天4点 取供应商往来数据:应付账款和预付账款 结束");
} catch (Exception ex) {
log.error("每天4点 取供应商往来数据:应付账款和预付账款 异常:", ex);
......@@ -174,7 +174,7 @@ public class BalanceSheetJob {
public void generateBalanceSheetNewResult() {
try {
log.info("每天7点 生成新资产负债结果表 开始");
balanceSheetService.generateBalanceSheetNewResult();
balanceSheetService.generateBalanceSheetNewResult(null);
log.info("每天7点 生成新资产负债结果表 结束");
} catch (Exception ex) {
log.error("每天7点 生成新资产负债结果表 异常:", ex);
......
......@@ -6,13 +6,14 @@ import com.bailuntec.infrastructure.mapper.DcJobConfigMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import javax.annotation.Resource;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
/**
......@@ -37,10 +38,10 @@ public class BalanceSheetServiceTest {
@Test
public void syncBankAccount() {
balanceSheetService.syncBankAccount();
//balanceSheetService.syncBankAccount();
}
@Test
/*@Test
public void syncWithdrawOnWaySummary() {
balanceSheetService.syncWithdrawOnWaySummary();
}
......@@ -73,9 +74,27 @@ public class BalanceSheetServiceTest {
@Test
@Rollback(value = false)
public void generateBalanceSheet() {
balanceSheetService.generateBalanceSheet();
balanceSheetService.getSupplierTransaction();
//LocalDate date = LocalDate.now().minusDays(1);
//balanceSheetService.getSupplierTransaction();
}*/
@Test
public void balanceSheetTest() throws ParseException {
for(long minus=4;minus>1;minus--) {
//long minus = 5;
LocalDate localDate = LocalDate.now().minusDays(minus);
LocalDateTime localDateTime = LocalDateTime.now().minusDays(minus);
balanceSheetService.syncBankAccount(localDate);
balanceSheetService.syncWithdrawOnWaySummary(localDate);
balanceSheetService.syncPayPal(localDateTime);
balanceSheetService.syncShortBorrowBalance(localDate);
balanceSheetService.syncCost(localDate);
balanceSheetService.syncBuy(localDate);
balanceSheetService.syncSemiInventoryBalance(localDate);
balanceSheetService.generateBalanceSheet(localDate);
balanceSheetService.getSupplierTransaction(localDate);
}
}
@Test
......
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