|
@@ -88,64 +88,64 @@ public class TimerServiceImpl implements TimerService {
|
|
|
dataList.forEach(formData -> {
|
|
|
// if("PM00411".equals(UtilMap.getString(formData, "textField_ltxrn8h1"))){
|
|
|
|
|
|
- //获取撤场时间
|
|
|
- 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");
|
|
|
+ //获取撤场时间
|
|
|
+ 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");
|
|
|
// details = details.stream().filter(item -> UtilMap.isNotBlankString(item, "dateField_lrru2tnr")).collect(Collectors.toList());
|
|
|
- // 数据格式化
|
|
|
+ // 数据格式化
|
|
|
// details.forEach(row -> {
|
|
|
// row.put("textField_luh0k82j", UtilDateTime.format(new Date(UtilMap.getLong(row, "dateField_lrru2tnr")), "yyyy-MM"));
|
|
|
// }
|
|
|
// });
|
|
|
// Collections.sort(details, Comparator.comparingLong(o -> UtilMap.getLong(o, "dateField_lrru2tnr")));
|
|
|
|
|
|
- // 查找当月数据
|
|
|
- LocalDateTime currentDate = UtilDateTime.firstDayOfLastMonth(LocalDateTime.now());
|
|
|
+ // 查找当月数据
|
|
|
+ LocalDateTime currentDate = UtilDateTime.firstDayOfLastMonth(LocalDateTime.now());
|
|
|
// LocalDateTime currentDate = UtilDateTime.parseLocalDateTime("2024-07-01 00:00:00");
|
|
|
|
|
|
- try {
|
|
|
- Optional optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(currentDate) == UtilMap.getLong(item, "dateField_lrru2tnr") || (currentDate.getYear() +"-"+ String.format("%02d", currentDate.getMonthValue())).equals(UtilMap.getString(item,"textField_luh0k82j"))).findAny();
|
|
|
- log.info("上个月数据, {}, {}", currentDate, optional);
|
|
|
- if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ try {
|
|
|
+ Optional optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(currentDate) == UtilMap.getLong(item, "dateField_lrru2tnr") || (currentDate.getYear() +"-"+ String.format("%02d", currentDate.getMonthValue())).equals(UtilMap.getString(item,"textField_luh0k82j"))).findAny();
|
|
|
+ log.info("上个月数据, {}, {}", currentDate, optional);
|
|
|
+ if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- LocalDateTime lastMonthDate = UtilDateTime.firstDayOfLastMonth(currentDate);
|
|
|
+ LocalDateTime lastMonthDate = UtilDateTime.firstDayOfLastMonth(currentDate);
|
|
|
// LocalDateTime lastMonthDate = UtilDateTime.parseLocalDateTime("2024-06-01 00:00:00");
|
|
|
- Map currentRow = (Map) optional.get();
|
|
|
- optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(lastMonthDate) == UtilMap.getLong(item, "dateField_lrru2tnr") || (currentDate.getYear() +"-"+ String.format("%02d", currentDate.getMonthValue())).equals(UtilMap.getString(item,"textField_luh0k82j"))).findAny();
|
|
|
- log.info("上上月数据, {}, {}", lastMonthDate, optional);
|
|
|
-
|
|
|
- float price;
|
|
|
- if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
|
|
|
- price = UtilMap.getFloat(currentRow, "numberField_lrru2tns");
|
|
|
- currentRow.put("numberField_lrru2tnz", price); // 取本月收入定额
|
|
|
- } else {
|
|
|
- price = UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz");
|
|
|
- currentRow.put("numberField_lrru2tnz", price); // 取上月收入预估
|
|
|
- }
|
|
|
- //明细合计
|
|
|
- currentRow.put("numberField_lryopn7o", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
|
|
|
- currentRow.put("numberField_m1hhyqiv", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
|
|
|
+ Map currentRow = (Map) optional.get();
|
|
|
+ optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(lastMonthDate) == UtilMap.getLong(item, "dateField_lrru2tnr") || (currentDate.getYear() +"-"+ String.format("%02d", currentDate.getMonthValue())).equals(UtilMap.getString(item,"textField_luh0k82j"))).findAny();
|
|
|
+ log.info("上上月数据, {}, {}", lastMonthDate, optional);
|
|
|
+
|
|
|
+ float price;
|
|
|
+ if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
|
|
|
+ price = UtilMap.getFloat(currentRow, "numberField_lrru2tns");
|
|
|
+ currentRow.put("numberField_lrru2tnz", price); // 取本月收入定额
|
|
|
+ } else {
|
|
|
+ price = UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz");
|
|
|
+ currentRow.put("numberField_lrru2tnz", price); // 取上月收入预估
|
|
|
+ }
|
|
|
+ //明细合计
|
|
|
+ currentRow.put("numberField_lryopn7o", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
|
|
|
+ currentRow.put("numberField_m1hhyqiv", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
|
|
|
|
|
|
- price += UtilMap.getFloat(formData, "numberField_lutjev0u");
|
|
|
- log.info("price, {}", price);
|
|
|
+ price += UtilMap.getFloat(formData, "numberField_lutjev0u");
|
|
|
+ log.info("price, {}", price);
|
|
|
|
|
|
- System.out.println("更新内容:" + JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)));
|
|
|
- // 合计初始化
|
|
|
+ System.out.println("更新内容:" + JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)));
|
|
|
+ // 合计初始化
|
|
|
// price = details.stream().map(item -> UtilMap.getFloat(item, "numberField_lrru2tnz")).collect(Collectors.toList()).stream().reduce(0f, (acc, cur) -> acc + cur);
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
- .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
- .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
+ .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
+ .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
|
|
|
// .useLatestVersion(true)
|
|
|
- .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)))
|
|
|
- .build(), YDConf.FORM_OPERATION.update);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+ }
|
|
|
// }
|
|
|
|
|
|
});
|
|
@@ -1441,52 +1441,21 @@ public class TimerServiceImpl implements TimerService {
|
|
|
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");
|
|
|
-// details = details.stream().filter(item -> UtilMap.isNotBlankString(item, "dateField_lrru2tnr")).collect(Collectors.toList());
|
|
|
- // 数据格式化
|
|
|
-// details.forEach(row -> {
|
|
|
-// row.put("textField_luh0k82j", UtilDateTime.format(new Date(UtilMap.getLong(row, "dateField_lrru2tnr")), "yyyy-MM"));
|
|
|
-// }
|
|
|
-// });
|
|
|
-// Collections.sort(details, Comparator.comparingLong(o -> UtilMap.getLong(o, "dateField_lrru2tnr")));
|
|
|
-
|
|
|
// 查找当月数据
|
|
|
LocalDateTime currentDate = UtilDateTime.firstDayOfLastMonth(LocalDateTime.now());
|
|
|
-// LocalDateTime currentDate = UtilDateTime.parseLocalDateTime("2024-07-01 00:00:00");
|
|
|
-
|
|
|
try {
|
|
|
Optional optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(currentDate) == UtilMap.getLong(item, "dateField_lrru2tnr")).findAny();
|
|
|
log.info("上个月数据, {}, {}", currentDate, optional);
|
|
|
- if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") != 0f) {
|
|
|
+ if (!optional.isPresent()) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
-// LocalDateTime lastMonthDate = UtilDateTime.firstDayOfLastMonth(currentDate);
|
|
|
-//// LocalDateTime lastMonthDate = UtilDateTime.parseLocalDateTime("2024-06-01 00:00:00");
|
|
|
Map currentRow = (Map) optional.get();
|
|
|
-// optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(lastMonthDate) == UtilMap.getLong(item, "dateField_lrru2tnr")).findAny();
|
|
|
-// log.info("上上月数据, {}, {}", lastMonthDate, optional);
|
|
|
-//
|
|
|
-// float price = 0f;
|
|
|
-// if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
|
|
|
-// price = UtilMap.getFloat(currentRow, "numberField_lrru2tns");
|
|
|
-// currentRow.put("numberField_lrru2tnz", price); // 取本月收入定额
|
|
|
-// } else {
|
|
|
-// price = UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz");
|
|
|
-// currentRow.put("numberField_lrru2tnz", price); // 取上月收入预估
|
|
|
-// }
|
|
|
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");
|
|
|
}
|
|
|
//明细合计
|
|
|
currentRow.put("numberField_m1hhyqiv", open + UtilMap.getFloat(currentRow, "numberField_m5uf580r"));
|
|
|
-
|
|
|
-// price += UtilMap.getFloat(formData, "numberField_lutjev0u");
|
|
|
-// log.info("price, {}", price);
|
|
|
-
|
|
|
-// System.out.println("更新内容:" + JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)));
|
|
|
- // 合计初始化
|
|
|
-// price = details.stream().map(item -> UtilMap.getFloat(item, "numberField_lrru2tnz")).collect(Collectors.toList()).stream().reduce(0f, (acc, cur) -> acc + cur);
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
.systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
@@ -1525,4 +1494,73 @@ public class TimerServiceImpl implements TimerService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateYearPredict() {
|
|
|
+ long lastMonth = DateUtil.beginOfMonth(DateUtil.lastMonth()).getTime();
|
|
|
+
|
|
|
+ List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
|
|
|
+ .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
+ .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
+ .formUuid("FORM-97BA6C6C8C50416A9E5854F2F4B5C3F3R4WC")
|
|
|
+// .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lrr3rg6h", "XM00345")))
|
|
|
+ .build());
|
|
|
+ log.info("项目点数据, {}", dataList.size());
|
|
|
+ System.out.println(dataList.size());
|
|
|
+ dataList.forEach(
|
|
|
+ formData -> {
|
|
|
+ System.out.println(formData);
|
|
|
+ // 获取撤场时间
|
|
|
+ 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());
|
|
|
+ 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");
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|