|
@@ -1,6 +1,5 @@
|
|
|
package com.malk.lanyun.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -33,7 +32,6 @@ import java.sql.PreparedStatement;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
-import java.util.logging.Level;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static java.lang.Integer.parseInt;
|
|
@@ -742,56 +740,53 @@ public class TimerServiceImpl implements TimerService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateMaterialProject(String projectCode, String date, Double firstCost, Double nowCost, int type) {
|
|
|
- double cost;
|
|
|
+ public void updateMaterialProject(String projectCode, String date, Double firstCost, Double nowCost, String formInstId) {
|
|
|
if(ObjectUtil.isEmpty(firstCost) || firstCost == 0.0){
|
|
|
- cost = nowCost;
|
|
|
- } else {
|
|
|
- cost = firstCost;
|
|
|
- }
|
|
|
-
|
|
|
- List<Map> bigList = ydService.queryFormData_all(YDParam.builder()
|
|
|
- .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
- .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
+ List<Map> bigList = ydService.queryFormData_all(YDParam.builder()
|
|
|
+ .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
+ .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
.formUuid("FORM-97BA6C6C8C50416A9E5854F2F4B5C3F3R4WC")
|
|
|
- //测试档案
|
|
|
-// .formUuid("FORM-CE163643B967429CABA97CC8733E3B5B1RZZ")
|
|
|
- .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_ltxrn8h1", projectCode)))
|
|
|
- .build());
|
|
|
- bigList.forEach(e->{
|
|
|
- List<Map> sonList = (List<Map>) e.get("tableField_lrru2tnq");
|
|
|
- if (ObjectUtil.isNotEmpty(sonList)){
|
|
|
- sonList.forEach(s->{
|
|
|
- //年月文本
|
|
|
- String projectDate = s.get("textField_luh0k82j").toString();
|
|
|
- //剩余物耗定额
|
|
|
- double remaining = Double.parseDouble(s.get("numberField_lrru2tnv").toString());
|
|
|
- //已用物耗定额
|
|
|
- double used = Double.parseDouble(s.get("numberField_ludujw4f").toString());
|
|
|
- log.info("cost:{}",cost);
|
|
|
- if (date.equals(projectDate)){
|
|
|
- if (type == 0){
|
|
|
- remaining = remaining - cost;
|
|
|
+ //测试档案
|
|
|
+// .formUuid("FORM-D3F341E3315140F4ADC9E5005260309E8B27")
|
|
|
+ .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_ltxrn8h1", projectCode)))
|
|
|
+ .build());
|
|
|
+ bigList.forEach(e->{
|
|
|
+ List<Map> sonList = (List<Map>) e.get("tableField_lrru2tnq");
|
|
|
+ if (ObjectUtil.isNotEmpty(sonList)){
|
|
|
+ sonList.forEach(s->{
|
|
|
+ //年月文本
|
|
|
+ String projectDate = s.get("textField_luh0k82j").toString();
|
|
|
+ //剩余物耗定额
|
|
|
+ double remaining = Double.parseDouble(s.get("numberField_lrru2tnv").toString());
|
|
|
+ //已用物耗定额
|
|
|
+ double used = Double.parseDouble(s.get("numberField_ludujw4f").toString());
|
|
|
+ log.info("cost:{}",nowCost);
|
|
|
+ if (date.equals(projectDate)){
|
|
|
+ remaining = remaining - nowCost;
|
|
|
s.put("numberField_lrru2tnv",remaining);
|
|
|
- used = used + cost;
|
|
|
- s.put("numberField_ludujw4f",used);
|
|
|
- } else if (type == 1) {
|
|
|
- remaining = remaining + cost - nowCost;
|
|
|
- s.put("numberField_lrru2tnv",remaining);
|
|
|
- used = used - cost + nowCost;
|
|
|
+ used = used + nowCost;
|
|
|
s.put("numberField_ludujw4f",used);
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
+ .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
+ .formInstanceId(e.get("formInstanceId").toString())
|
|
|
+// .useLatestVersion(true)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq", sonList)))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ });
|
|
|
+ log.info("日常物耗流程id为:{}",formInstId);
|
|
|
+ log.info("初始物耗费用合计为:{}",firstCost);
|
|
|
+ log.info("本次物耗费用合计为:{}",nowCost);
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.appType("APP_ERBDTFS82HOVBPL3NFH0")
|
|
|
.systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
|
|
|
- .formInstanceId(e.get("formInstanceId").toString())
|
|
|
-// .useLatestVersion(true)
|
|
|
- .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq", sonList)))
|
|
|
+ .formInstanceId(formInstId)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("numberField_m0xizy3q", nowCost)))
|
|
|
.build(), YDConf.FORM_OPERATION.update);
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -921,9 +916,9 @@ public class TimerServiceImpl implements TimerService {
|
|
|
if (ObjectUtil.isNotNull(dataValue.get(0).get("value"))){
|
|
|
Date value = DateUtil.parse(dataValue.get(0).get("value").toString());
|
|
|
// if (dataValue.get(0).get("value").toString().substring(0,7).equals("2024-09")){
|
|
|
- if (DateUtil.compare(value,beginOfMonth)>=0 && DateUtil.compare(date,value)>=0){
|
|
|
+ if (DateUtil.compare(value,beginOfMonth)>=0 && DateUtil.compare(date,value)>=0){
|
|
|
// month[0]++;
|
|
|
- inJobIdSet.add(e.get("userid").toString());
|
|
|
+ inJobIdSet.add(e.get("userid").toString());
|
|
|
// }
|
|
|
}
|
|
|
}
|