|
|
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.dao.EmptyResultDataAccessException;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
@@ -30,6 +31,7 @@ public class PnsDataSyncTask {
|
|
|
@Autowired
|
|
|
private BaseDao baseDao;
|
|
|
|
|
|
+ @Scheduled(cron = "0 0/1 * * * ?")
|
|
|
public void UploadSaleData(){
|
|
|
logger.info("Sale Upload Start---");
|
|
|
List<PNSSendData> saleUploads = getSaleDataUpload();
|
|
|
@@ -60,6 +62,7 @@ public class PnsDataSyncTask {
|
|
|
logger.info("{}",pageReq);
|
|
|
try {
|
|
|
HttpUtil.Response response = HttpUtil.sendPostRequest(pnsConfig.getRoute(), reqHeader, pageReq, false);
|
|
|
+ logger.info("{}",response.getResponseText());
|
|
|
if (response.getStatusCode() == HttpStatus.OK.value()) {
|
|
|
String data = response.getResponseText();
|
|
|
if (StringUtil.hasText(data)) {
|
|
|
@@ -81,7 +84,7 @@ public class PnsDataSyncTask {
|
|
|
try {
|
|
|
List<PNSSendData> sendSales = baseDao
|
|
|
.getJdbcTemplate()
|
|
|
- .query("SELECT * FROM PNS_SENDDATADETAIL WHERE MAIN_ID=1 ", new BeanPropertyRowMapper<PNSSendData>(PNSSendData.class));
|
|
|
+ .query("SELECT * FROM PNS_SENDDATADETAIL WHERE MAIN_ID=1 AND UPLOAD=0 ", new BeanPropertyRowMapper<PNSSendData>(PNSSendData.class));
|
|
|
int num = 0;
|
|
|
for(PNSSendData sendSale : sendSales) {
|
|
|
num ++;
|
|
|
@@ -90,7 +93,9 @@ public class PnsDataSyncTask {
|
|
|
}
|
|
|
sendSale.setRow_number(num); //分页处理序号问题
|
|
|
sendSale.setCust_id(pnsConfig.getCust_id());
|
|
|
+ sendSale.setYmonth("2022-11");
|
|
|
}
|
|
|
+ baseDao.execute("UPDATE PNS_SENDDATADETAIL SET UPLOAD=1");
|
|
|
return sendSales;
|
|
|
} catch (EmptyResultDataAccessException e) {
|
|
|
return null;
|