|
@@ -1,17 +1,17 @@
|
|
|
package com.management.platform.task;
|
|
package com.management.platform.task;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
-import com.management.platform.entity.*;
|
|
|
|
|
|
|
+import com.management.platform.entity.FinanceMonthlyWorktime;
|
|
|
|
|
+import com.management.platform.entity.SaleOrderDetail;
|
|
|
|
|
+import com.management.platform.entity.SaleOrderMain;
|
|
|
import com.management.platform.entity.vo.TisTimeVO;
|
|
import com.management.platform.entity.vo.TisTimeVO;
|
|
|
-import com.management.platform.mapper.*;
|
|
|
|
|
|
|
+import com.management.platform.mapper.FinanceMonthlyWorktimeMapper;
|
|
|
|
|
+import com.management.platform.mapper.FmwDetailMapper;
|
|
|
import com.management.platform.service.*;
|
|
import com.management.platform.service.*;
|
|
|
-import com.management.platform.util.MessageUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
|
import org.springframework.http.*;
|
|
import org.springframework.http.*;
|
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -49,6 +49,10 @@ public class DataCollectTask {
|
|
|
private UserFvTimeService userFvTimeService;
|
|
private UserFvTimeService userFvTimeService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ProjectService projectService;
|
|
private ProjectService projectService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private SaleOrderMainService saleOrderMainService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private SaleOrderDetailService saleOrderDetailService;
|
|
|
|
|
|
|
|
@Scheduled(cron = "30 10 8,12,20 * * ?")
|
|
@Scheduled(cron = "30 10 8,12,20 * * ?")
|
|
|
// @Scheduled(cron = "30 08 21 * * ?")
|
|
// @Scheduled(cron = "30 08 21 * * ?")
|
|
@@ -169,5 +173,43 @@ public class DataCollectTask {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 同步销售订单数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @Scheduled(cron ="0 0 4 * * ?")
|
|
|
|
|
+ public void saleOrderData(){
|
|
|
|
|
+ if(isDev){return;}
|
|
|
|
|
+ if(isPrivateDeploy) return;
|
|
|
|
|
+ LocalDate nowDate = LocalDate.now();
|
|
|
|
|
+ int today = nowDate.getMonthValue();
|
|
|
|
|
+ int lastDay = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
|
|
|
|
|
+ if(today != lastDay){
|
|
|
|
|
+ return ;
|
|
|
|
|
+ }
|
|
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
|
|
+ String getUrl = PREFIX_URL+"/dataCollect/getSaleOrderData";
|
|
|
|
|
+ SimpleDateFormat sdfYm = new SimpleDateFormat("yyyy-MM");
|
|
|
|
|
+ Date date = new Date();
|
|
|
|
|
+ String dateYm = sdfYm.format(date);
|
|
|
|
|
+ //校验cppid
|
|
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
+ Map<String, Object> requestBody = new HashMap<>();
|
|
|
|
|
+ HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
|
|
|
|
|
+ ResponseEntity<List<SaleOrderMain>> checkResponse = restTemplate.exchange(getUrl, HttpMethod.POST, requestEntity
|
|
|
|
|
+ ,new ParameterizedTypeReference<List<SaleOrderMain>>(){});
|
|
|
|
|
+ if (checkResponse.getStatusCode() == HttpStatus.OK) {
|
|
|
|
|
+ List<SaleOrderMain> resList = checkResponse.getBody();
|
|
|
|
|
+ if(null!=resList&&resList.size()>0){
|
|
|
|
|
+ saleOrderMainService.saveOrUpdateBatch(resList);
|
|
|
|
|
+ List<SaleOrderDetail> saleOrderDetails=new ArrayList<>();
|
|
|
|
|
+ for (SaleOrderMain saleOrderMain : resList) {
|
|
|
|
|
+ List<SaleOrderDetail> details = saleOrderMain.getSaleOrderDetails();
|
|
|
|
|
+ saleOrderDetails.addAll(details);
|
|
|
|
|
+ }
|
|
|
|
|
+ saleOrderDetailService.saveOrUpdateBatch(saleOrderDetails);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|