|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.eis.task;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.eis.dto.stksto.QueryAccountantProjectDto;
|
|
|
import com.uas.eis.dto.stksto.QueryCashFlowItemsDto;
|
|
|
@@ -10,12 +11,14 @@ import com.uas.eis.service.RequestSTKService;
|
|
|
import com.uas.eis.service.STKService;
|
|
|
import com.uas.eis.vo.stkVo.AccountantProjectVo;
|
|
|
import com.uas.eis.vo.stkVo.CashFlowItemsVo;
|
|
|
+import com.uas.eis.vo.stkVo.HttpResultResponse;
|
|
|
import com.uas.eis.vo.stkVo.TravellingMerchantVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
@@ -23,7 +26,7 @@ import java.util.List;
|
|
|
import java.util.Set;
|
|
|
|
|
|
@Slf4j
|
|
|
-//@Component
|
|
|
+@Component
|
|
|
public class STKTask {
|
|
|
|
|
|
/**
|
|
|
@@ -204,14 +207,15 @@ public class STKTask {
|
|
|
|
|
|
|
|
|
//现金流项目
|
|
|
- //@Scheduled(cron = "0 58 09 * * ?")
|
|
|
+ @Scheduled(cron = "0 58 22 * * ?")
|
|
|
public void queryCashFlowItems(){
|
|
|
- StkCommonDto dto = new StkCommonDto();
|
|
|
+ //StkCommonDto dto = new StkCommonDto();
|
|
|
QueryCashFlowItemsDto dtoParam = new QueryCashFlowItemsDto();
|
|
|
- int pageXjl = 1;
|
|
|
- dto.setPage(String.valueOf(pageXjl));
|
|
|
+ /*dto.setPage(String.valueOf(pageXjl));
|
|
|
dto.setSize("500");
|
|
|
- dto.setParam(dtoParam);
|
|
|
+ dto.setParam(dtoParam);*/
|
|
|
+ Integer page = 1;
|
|
|
+ Integer size = 100;
|
|
|
//是否跳出循环
|
|
|
Boolean isBreak = true;
|
|
|
//是否发生异常
|
|
|
@@ -222,10 +226,10 @@ public class STKTask {
|
|
|
if (num >= 5) {
|
|
|
break;
|
|
|
}
|
|
|
- log.info("while循环获取现金流,查询参数:{}", JSONObject.toJSONString(dto));
|
|
|
CashFlowItemsVo cashFlowItemsVo = new CashFlowItemsVo();
|
|
|
try {
|
|
|
- cashFlowItemsVo = requestSTKService.getCashFlowItems(dto);
|
|
|
+ HttpResultResponse resultResponse = requestSTKService.buildPostParam(page,size,dtoParam);
|
|
|
+ cashFlowItemsVo = JSONObject.parseObject(resultResponse.getBody(),CashFlowItemsVo.class);
|
|
|
if (cashFlowItemsVo.getCode() != 200) {
|
|
|
num = num + 1;
|
|
|
continue;
|
|
|
@@ -239,13 +243,12 @@ public class STKTask {
|
|
|
num = num +1;
|
|
|
}
|
|
|
//判断没发生异常,且是最后一页条件判断==》没有下页编码,或者当前页数等于返回页数
|
|
|
- if (!exception && null != cashFlowItemsVo && null != cashFlowItemsVo.getData() && Integer.valueOf(dto.getPage()) >= pageXjl){
|
|
|
+ if (!exception && null != cashFlowItemsVo && page >= cashFlowItemsVo.getPages()){
|
|
|
isBreak = false;
|
|
|
}
|
|
|
|
|
|
if(!exception){
|
|
|
- pageXjl = pageXjl+1;
|
|
|
- dto.setPage(String.valueOf(pageXjl));
|
|
|
+ page = page +1;
|
|
|
}
|
|
|
}
|
|
|
}
|