|
@@ -34,6 +34,8 @@ import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.time.ZoneId;
|
|
|
|
|
+import java.time.ZonedDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
@@ -1551,7 +1553,7 @@ public class TimerServiceImpl implements TimerService {
|
|
|
@Override
|
|
@Override
|
|
|
public void updateOutputPredict() {
|
|
public void updateOutputPredict() {
|
|
|
//获取上月时间戳
|
|
//获取上月时间戳
|
|
|
- long lastMonth = DateUtil.beginOfMonth(DateUtil.lastMonth()).getTime();
|
|
|
|
|
|
|
+ List<Long> allTimestamp = getAllTimestamp();
|
|
|
List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
|
|
List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
|
|
|
.appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
.appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
.systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
.systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
@@ -1559,37 +1561,41 @@ public class TimerServiceImpl implements TimerService {
|
|
|
// .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lrr3rg6h", "XM00345")))
|
|
// .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lrr3rg6h", "XM00345")))
|
|
|
.build());
|
|
.build());
|
|
|
log.info("项目点数据, {}", dataList.size());
|
|
log.info("项目点数据, {}", dataList.size());
|
|
|
|
|
+
|
|
|
dataList.forEach(formData -> {
|
|
dataList.forEach(formData -> {
|
|
|
- //获取撤场时间
|
|
|
|
|
Long withdrawalTime = formData.get("dateField_lzaqu26p")==null?null:DateUtil.beginOfMonth(DateUtil.date(Long.parseLong(formData.get("dateField_lzaqu26p").toString()))).getTime();
|
|
Long withdrawalTime = formData.get("dateField_lzaqu26p")==null?null:DateUtil.beginOfMonth(DateUtil.date(Long.parseLong(formData.get("dateField_lzaqu26p").toString()))).getTime();
|
|
|
- if (UtilMap.getString(formData, "selectField_lrn2oy4a").equals("进行中") || (ObjectUtil.isNotNull(withdrawalTime) && lastMonth == withdrawalTime)){
|
|
|
|
|
- List<Map> details = UtilMap.getList(formData, "tableField_lrru2tnq");
|
|
|
|
|
- // 查找当月数据
|
|
|
|
|
- LocalDateTime currentDate = UtilDateTime.firstDayOfLastMonth(LocalDateTime.now());
|
|
|
|
|
- try {
|
|
|
|
|
- Optional optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(currentDate) == UtilMap.getLong(item, "dateField_lrru2tnr")).findAny();
|
|
|
|
|
- log.info("上个月数据, {}, {}", currentDate, optional);
|
|
|
|
|
- if (!optional.isPresent()) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- Map currentRow = (Map) optional.get();
|
|
|
|
|
- float open = UtilMap.getFloat(currentRow, "numberField_lryopn7o");
|
|
|
|
|
- if (ObjectUtil.isNotNull(currentRow.get("numberField_lrru2to2")) && UtilMap.getFloat(currentRow, "numberField_lrru2to2") > 0){
|
|
|
|
|
- open = UtilMap.getFloat(currentRow, "numberField_lrru2to2");
|
|
|
|
|
|
|
+ List<Map> details = UtilMap.getList(formData, "tableField_lrru2tnq");
|
|
|
|
|
+ for (int i = 0; i < allTimestamp.size(); i++) {
|
|
|
|
|
+ int finalI = i;
|
|
|
|
|
+ //获取撤场时间
|
|
|
|
|
+ if (UtilMap.getString(formData, "selectField_lrn2oy4a").equals("进行中") || (ObjectUtil.isNotNull(withdrawalTime) && Objects.equals(allTimestamp.get(finalI), withdrawalTime))){
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ Optional optional = details.stream().filter(item -> allTimestamp.get(finalI) == UtilMap.getLong(item, "dateField_lrru2tnr")).findAny();
|
|
|
|
|
+ if (!optional.isPresent()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ Map currentRow = (Map) optional.get();
|
|
|
|
|
+ float open = UtilMap.getFloat(currentRow, "numberField_lryopn7o_value");
|
|
|
|
|
+ if (ObjectUtil.isNotNull(currentRow.get("numberField_lrru2to2_value")) && UtilMap.getFloat(currentRow, "numberField_lrru2to2_value") > 0){
|
|
|
|
|
+ open = UtilMap.getFloat(currentRow, "numberField_lrru2to2_value");
|
|
|
|
|
+ }
|
|
|
|
|
+ //明细合计
|
|
|
|
|
+ currentRow.put("numberField_m1hhyqiv", open + UtilMap.getFloat(currentRow, "numberField_m5uf580r_value"));
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.info("项目点编号+周期:{}",formData.get("textField_ltxrn8h1") + allTimestamp.get(finalI).toString());
|
|
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
- //明细合计
|
|
|
|
|
- currentRow.put("numberField_m1hhyqiv", open + UtilMap.getFloat(currentRow, "numberField_m5uf580r"));
|
|
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
|
|
- .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
|
|
- .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
|
|
- .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
|
|
|
|
|
-// .useLatestVersion(true)
|
|
|
|
|
- .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq", details)))
|
|
|
|
|
- .build(), YDConf.FORM_OPERATION.update);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
|
|
+ .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
|
|
+ .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
|
|
+ .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
|
|
|
|
|
+ .useLatestVersion(true)
|
|
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq", details)))
|
|
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1620,20 +1626,16 @@ public class TimerServiceImpl implements TimerService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void updateYearPredict() {
|
|
public void updateYearPredict() {
|
|
|
- long lastMonth = DateUtil.beginOfMonth(DateUtil.lastMonth()).getTime();
|
|
|
|
|
|
|
+ List<Long> allTimestamp = getAllTimestamp();
|
|
|
|
|
|
|
|
List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
|
|
List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
|
|
|
.appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
.appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
.systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
.systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
.formUuid("FORM-97BA6C6C8C50416A9E5854F2F4B5C3F3R4WC")
|
|
.formUuid("FORM-97BA6C6C8C50416A9E5854F2F4B5C3F3R4WC")
|
|
|
-// .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lrr3rg6h", "XM00345")))
|
|
|
|
|
.build());
|
|
.build());
|
|
|
log.info("项目点数据, {}", dataList.size());
|
|
log.info("项目点数据, {}", dataList.size());
|
|
|
- System.out.println(dataList.size());
|
|
|
|
|
dataList.forEach(
|
|
dataList.forEach(
|
|
|
formData -> {
|
|
formData -> {
|
|
|
- System.out.println(formData);
|
|
|
|
|
- // 获取撤场时间
|
|
|
|
|
Long withdrawalTime =
|
|
Long withdrawalTime =
|
|
|
formData.get("dateField_lzaqu26p") == null
|
|
formData.get("dateField_lzaqu26p") == null
|
|
|
? null
|
|
? null
|
|
@@ -1641,49 +1643,49 @@ public class TimerServiceImpl implements TimerService {
|
|
|
DateUtil.date(
|
|
DateUtil.date(
|
|
|
Long.parseLong(formData.get("dateField_lzaqu26p").toString())))
|
|
Long.parseLong(formData.get("dateField_lzaqu26p").toString())))
|
|
|
.getTime();
|
|
.getTime();
|
|
|
- if (UtilMap.getString(formData, "selectField_lrn2oy4a").equals("进行中")
|
|
|
|
|
- || (ObjectUtil.isNotNull(withdrawalTime) && lastMonth == withdrawalTime)) {
|
|
|
|
|
- List<Map> details = UtilMap.getList(formData, "tableField_lrru2tnq");
|
|
|
|
|
- // 查找当月数据
|
|
|
|
|
- LocalDateTime currentDate = UtilDateTime.firstDayOfLastMonth(LocalDateTime.now());
|
|
|
|
|
- System.out.println("currentDate"+currentDate);
|
|
|
|
|
- try {
|
|
|
|
|
- Optional optional =
|
|
|
|
|
- details.stream()
|
|
|
|
|
- .filter(
|
|
|
|
|
- item ->
|
|
|
|
|
- UtilDateTime.getLocalDateTimeTimeStamp(currentDate)
|
|
|
|
|
- == UtilMap.getLong(item, "dateField_lrru2tnr"))
|
|
|
|
|
- .findAny();
|
|
|
|
|
- log.info("上个月数据, {}, {}", currentDate, optional);
|
|
|
|
|
-
|
|
|
|
|
- System.out.println("2222222222222222222");
|
|
|
|
|
- Map currentRow = (Map) optional.get();
|
|
|
|
|
- float open = UtilMap.getFloat(currentRow, "numberField_lrru2tns");
|
|
|
|
|
- if (ObjectUtil.isNotNull(currentRow.get("numberField_m1hhyqiv"))
|
|
|
|
|
- && UtilMap.getFloat(currentRow, "numberField_m1hhyqiv") > 0) {
|
|
|
|
|
- open = UtilMap.getFloat(currentRow, "numberField_m1hhyqiv");
|
|
|
|
|
|
|
+ List<Map> details = UtilMap.getList(formData, "tableField_lrru2tnq");
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < allTimestamp.size(); i++) {
|
|
|
|
|
+ int finalI = i;
|
|
|
|
|
+ // 获取撤场时间
|
|
|
|
|
+ if (UtilMap.getString(formData, "selectField_lrn2oy4a").equals("进行中")
|
|
|
|
|
+ || (ObjectUtil.isNotNull(withdrawalTime) && Objects.equals(allTimestamp.get(finalI), withdrawalTime))) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ Optional optional =
|
|
|
|
|
+ details.stream()
|
|
|
|
|
+ .filter(
|
|
|
|
|
+ item ->
|
|
|
|
|
+ allTimestamp.get(finalI)
|
|
|
|
|
+ == UtilMap.getLong(item, "dateField_lrru2tnr"))
|
|
|
|
|
+ .findAny();
|
|
|
|
|
+ log.info("上个月数据, {}, {}", allTimestamp.get(finalI), optional);
|
|
|
|
|
+
|
|
|
|
|
+ Map currentRow = (Map) optional.get();
|
|
|
|
|
+ float open = UtilMap.getFloat(currentRow, "numberField_lrru2tns_value");
|
|
|
|
|
+ if (ObjectUtil.isNotNull(currentRow.get("numberField_m1hhyqiv_value"))
|
|
|
|
|
+ && UtilMap.getFloat(currentRow, "numberField_m1hhyqiv_value") > 0) {
|
|
|
|
|
+ open = UtilMap.getFloat(currentRow, "numberField_m1hhyqiv_value");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 明细合计
|
|
|
|
|
+ currentRow.put(
|
|
|
|
|
+ "numberField_m8gn1uof",
|
|
|
|
|
+ open + UtilMap.getFloat(currentRow, "numberField_m5uf580r_value"));
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
- System.out.println("formInstanceId:" + UtilMap.getString(formData, "formInstanceId"));
|
|
|
|
|
- // 明细合计
|
|
|
|
|
- currentRow.put(
|
|
|
|
|
- "numberField_m8gn1uof",
|
|
|
|
|
- open + UtilMap.getFloat(currentRow, "numberField_m5uf580r"));
|
|
|
|
|
- ydClient.operateData(
|
|
|
|
|
- YDParam.builder()
|
|
|
|
|
- .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
|
|
- .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
|
|
- .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
|
|
|
|
|
- .useLatestVersion(true)
|
|
|
|
|
- .updateFormDataJson(
|
|
|
|
|
- JSON.toJSONString(UtilMap.map("tableField_lrru2tnq", details)))
|
|
|
|
|
- .build(),
|
|
|
|
|
- YDConf.FORM_OPERATION.update);
|
|
|
|
|
- System.out.println("更新成功");
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ ydClient.operateData(
|
|
|
|
|
+ YDParam.builder()
|
|
|
|
|
+ .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
|
|
+ .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
|
|
+ .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
|
|
|
|
|
+ .useLatestVersion(true)
|
|
|
|
|
+ .updateFormDataJson(
|
|
|
|
|
+ JSON.toJSONString(UtilMap.map("tableField_lrru2tnq", details)))
|
|
|
|
|
+ .build(),
|
|
|
|
|
+ YDConf.FORM_OPERATION.update);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1785,4 +1787,19 @@ public class TimerServiceImpl implements TimerService {
|
|
|
|
|
|
|
|
UtilExcel.exportMapAndListByTemplate(response, null, analysisList, ProjectAnalysis.class, fileName, "NC.xlsx");
|
|
UtilExcel.exportMapAndListByTemplate(response, null, analysisList, ProjectAnalysis.class, fileName, "NC.xlsx");
|
|
|
}
|
|
}
|
|
|
|
|
+ public List<Long> getAllTimestamp(){
|
|
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
|
|
+ int currentYear = now.getYear();
|
|
|
|
|
+ int currentMonth = now.getMonthValue();
|
|
|
|
|
+
|
|
|
|
|
+ List<Long> timestamps = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ for (int month = 1; month <= 12; month++) {
|
|
|
|
|
+ LocalDate firstDayOfMonth = LocalDate.of(currentYear, month, 1);
|
|
|
|
|
+ ZonedDateTime zonedDateTime = firstDayOfMonth.atStartOfDay(ZoneId.systemDefault());
|
|
|
|
|
+ long timestamp = zonedDateTime.toInstant().toEpochMilli();
|
|
|
|
|
+ timestamps.add(timestamp);
|
|
|
|
|
+ }
|
|
|
|
|
+ return timestamps;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|