|
@@ -2,9 +2,9 @@ package com.management.platform.task;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.management.platform.entity.*;
|
|
|
-import com.management.platform.entity.vo.TisTimeVO;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
|
import org.springframework.http.*;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
@@ -39,7 +39,7 @@ public class DataCollectTask {
|
|
|
@Resource
|
|
|
private ProjectCategoryMapper projectCategoryMapper;
|
|
|
|
|
|
- private static final String PREFIX_URL = "http://58.210.104.138:10020";
|
|
|
+ public static final String PREFIX_URL = "http://58.210.104.138:10020";
|
|
|
|
|
|
private static final int specialCompanyId = 7536;
|
|
|
|
|
@@ -53,6 +53,8 @@ public class DataCollectTask {
|
|
|
|
|
|
@Resource
|
|
|
private FmwDetailMapper fmwDetailMapper;
|
|
|
+ @Autowired
|
|
|
+ private FinanceMonthlyWorktimeMapper financeMonthlyWorktimeMapper;
|
|
|
|
|
|
|
|
|
// private static HikariDataSource sqlServerDataSource;
|
|
@@ -71,10 +73,41 @@ public class DataCollectTask {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String insertUrl = PREFIX_URL+"/dataCollect/insertCisData";
|
|
|
SimpleDateFormat sdfYmd = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat sdfYm = new SimpleDateFormat("yyyy-MM");
|
|
|
Date date = new Date();
|
|
|
+ String dateYm = sdfYm.format(date);
|
|
|
+
|
|
|
+ List<FinanceMonthlyWorktime> financeMonthlyWorktimes = financeMonthlyWorktimeMapper.selectList(new LambdaQueryWrapper<FinanceMonthlyWorktime>()
|
|
|
+ .eq(FinanceMonthlyWorktime::getCompanyId, specialCompanyId)
|
|
|
+ .eq(FinanceMonthlyWorktime::getYmonth, dateYm)
|
|
|
+ .eq(FinanceMonthlyWorktime::getStatus, 1)
|
|
|
+ );
|
|
|
+ if(!CollectionUtils.isEmpty(financeMonthlyWorktimes)){
|
|
|
+// for (FinanceMonthlyWorktime financeMonthlyWorktime : financeMonthlyWorktimes) {
|
|
|
+//// sdfYmd.format(financeMonthlyWorktime.get)
|
|
|
+// List<TisTimeVO> timeVOList = fmwDetailMapper.getTisTimeByDateYm(financeMonthlyWorktime.getId());
|
|
|
+// if(!CollectionUtils.isEmpty(timeVOList)){
|
|
|
+// timeVOList.forEach(t->t.setDateStr(dateStr));
|
|
|
+// HttpHeaders headers = new HttpHeaders();
|
|
|
+// headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+// Map<String, Object> requestBody = new HashMap<>();
|
|
|
+// requestBody.put("tisList", timeVOList);
|
|
|
+// HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
|
|
|
+//
|
|
|
+// ResponseEntity<String> tisResponse = restTemplate.exchange(insertUrl, HttpMethod.POST, requestEntity, String.class);
|
|
|
+// if (tisResponse.getStatusCode() == HttpStatus.OK) {
|
|
|
+// System.out.println("插入成功");
|
|
|
+// }else{
|
|
|
+// System.out.println(dateStr + "插入失败");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
String dateStr = sdfYmd.format(date);
|
|
|
-// List<TisTimeVO> timeVOList = fmwDetailMapper.getTisTimeByDate(specialCompanyId,dateStr);
|
|
|
- List<TisTimeVO> timeVOList = reportMapper.getTisTimeByDate(specialCompanyId,dateStr);
|
|
|
+// List<TisTimeVO> timeVOList = fmwDetailMapper.getTisTimeByDateYm(specialCompanyId,dateStr);
|
|
|
+// List<TisTimeVO> timeVOList = reportMapper.getTisTimeByDate(specialCompanyId,dateStr);
|
|
|
|
|
|
// for (TisTimeVO tisTimeVO : timeVOList) {
|
|
|
// String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
|
|
@@ -91,21 +124,6 @@ public class DataCollectTask {
|
|
|
// System.err.println("数据库操作错误: " + e.getMessage());
|
|
|
// }
|
|
|
// }
|
|
|
- if(!CollectionUtils.isEmpty(timeVOList)){
|
|
|
- timeVOList.forEach(t->t.setDateStr(dateStr));
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
- Map<String, Object> requestBody = new HashMap<>();
|
|
|
- requestBody.put("tisList", timeVOList);
|
|
|
- HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
|
|
|
-
|
|
|
- ResponseEntity<String> tisResponse = restTemplate.exchange(insertUrl, HttpMethod.POST, requestEntity, String.class);
|
|
|
- if (tisResponse.getStatusCode() == HttpStatus.OK) {
|
|
|
- System.out.println("插入成功");
|
|
|
- }else{
|
|
|
- System.out.println(dateStr + "插入失败");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
// for (TisTimeVO tisTimeVO : timeVOList) {
|
|
|
// String sqlQuery = "select top 1 iRealCOID from ca_batchmap where cMOCode = ? and iMOSubSN = ? ";
|