|
@@ -17,10 +17,8 @@ import com.malk.service.dingtalk.DDClient_Personnel;
|
|
|
import com.malk.utils.UtilDateTime;
|
|
|
import com.malk.utils.UtilExcel;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
-import com.mysql.cj.util.StringUtils;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.poi.util.StringUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@@ -1173,9 +1171,9 @@ public class TimerServiceImpl implements TimerService {
|
|
|
.formUuid("FORM-84AFCA01E1C24216BD46DC13FB3A82D4B4ZB")
|
|
|
.searchFieldJson(JSON.toJSONString(UtilMap.map("textField_ltxqbvzu, selectField_ltxy8wyr, selectField_ltxqfrj8", code,"启用",area)))
|
|
|
.build());
|
|
|
- if (businessList.size()>=2){
|
|
|
- businessList = businessList.stream().filter(map -> map.get("textField_ludp2v7i") != "临时采购").collect(Collectors.toList());
|
|
|
- }
|
|
|
+ if (businessList.size()>=2){
|
|
|
+ businessList = businessList.stream().filter(map -> map.get("textField_ludp2v7i") != "临时采购").collect(Collectors.toList());
|
|
|
+ }
|
|
|
System.out.println(businessList.size());
|
|
|
if(ObjectUtil.isNotNull(businessList)){
|
|
|
if (ObjectUtil.isNotNull(businessList.get(0).get("numberField_ltxqbvzz"))){
|
|
@@ -1419,4 +1417,81 @@ public class TimerServiceImpl implements TimerService {
|
|
|
.updateFormDataJson(JSON.toJSONString(UtilMap.map("numberField_m3dvrmfd, numberField_m3dvrmfe, numberField_m3dvrmff, numberField_m3dvrmfg", rg, wh, rgRate, whRate)))
|
|
|
.build(), YDConf.FORM_OPERATION.update);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateOutputPredict() {
|
|
|
+ //获取上月时间戳
|
|
|
+ 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());
|
|
|
+ dataList.forEach(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");
|
|
|
+// 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) {
|
|
|
+ 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")
|
|
|
+ .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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}
|