|
@@ -861,56 +861,56 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
//如果不存在基线成本快照,则生成
|
|
|
- List<EarningSnapshot> earningSnapshots = earningSnapshotMapper.selectList(new QueryWrapper<EarningSnapshot>().eq("project_id", p.getId()).orderByDesc("id").last("limit 1"));
|
|
|
- boolean shouldAdd = false;
|
|
|
- if (earningSnapshots.size() == 0) {
|
|
|
- shouldAdd = true;
|
|
|
- } else {
|
|
|
- //检查是否发生变化
|
|
|
- String data = earningSnapshots.get(0).getCostData();
|
|
|
- if (data == null) {
|
|
|
- shouldAdd = true;
|
|
|
- } else {
|
|
|
- JSONArray oldArray = JSONArray.parseArray(data);
|
|
|
- if (oldArray.size() != costList.size()) {
|
|
|
- //条目数量有变化,需要新增
|
|
|
- shouldAdd = true;
|
|
|
- } else {
|
|
|
- for (int i=0; i<oldArray.size(); i++) {
|
|
|
- JSONObject jsonObject = oldArray.getJSONObject(i);
|
|
|
- ProjectBasecost projectBasecost = JSONObject.toJavaObject(jsonObject, ProjectBasecost.class);
|
|
|
- Optional<ProjectBasecost> first = costList.stream().filter(cost -> cost.getBaseId().equals(projectBasecost.getBaseId())).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- if (!first.get().getBaseAmount().equals(projectBasecost.getBaseAmount())) {
|
|
|
- shouldAdd = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- } else {
|
|
|
- //有新增的条目,需要增加
|
|
|
- shouldAdd = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (shouldAdd) {
|
|
|
- EarningSnapshot record = new EarningSnapshot();
|
|
|
- record.setProjectId(p.getId());
|
|
|
- record.setCreatorId(user.getId());
|
|
|
- record.setCreatorName(user.getName());
|
|
|
- record.setContractAmount(p.getContractAmount());
|
|
|
- record.setCostData(projectBaseCostData);
|
|
|
- record.setCostTotal(p.getBudget());
|
|
|
- record.setProfit(p.getContractAmount() - p.getBudget());
|
|
|
- if (p.getContractAmount() > 0) {
|
|
|
- record.setProfitPercent(100.0*(p.getContractAmount() - p.getBudget())/p.getContractAmount());
|
|
|
- earningSnapshotMapper.insert(record);
|
|
|
- }
|
|
|
+// List<EarningSnapshot> earningSnapshots = earningSnapshotMapper.selectList(new QueryWrapper<EarningSnapshot>().eq("project_id", p.getId()).orderByDesc("id").last("limit 1"));
|
|
|
+// boolean shouldAdd = false;
|
|
|
+// if (earningSnapshots.size() == 0) {
|
|
|
+// shouldAdd = true;
|
|
|
+// } else {
|
|
|
+// //检查是否发生变化
|
|
|
+// String data = earningSnapshots.get(0).getCostData();
|
|
|
+// if (data == null) {
|
|
|
+// shouldAdd = true;
|
|
|
+// } else {
|
|
|
+// JSONArray oldArray = JSONArray.parseArray(data);
|
|
|
+// if (oldArray.size() != costList.size()) {
|
|
|
+// //条目数量有变化,需要新增
|
|
|
+// shouldAdd = true;
|
|
|
+// } else {
|
|
|
+// for (int i=0; i<oldArray.size(); i++) {
|
|
|
+// JSONObject jsonObject = oldArray.getJSONObject(i);
|
|
|
+// ProjectBasecost projectBasecost = JSONObject.toJavaObject(jsonObject, ProjectBasecost.class);
|
|
|
+// Optional<ProjectBasecost> first = costList.stream().filter(cost -> cost.getBaseId().equals(projectBasecost.getBaseId())).findFirst();
|
|
|
+// if (first.isPresent()) {
|
|
|
+// if (!first.get().getBaseAmount().equals(projectBasecost.getBaseAmount())) {
|
|
|
+// shouldAdd = true;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// //有新增的条目,需要增加
|
|
|
+// shouldAdd = true;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
- }
|
|
|
+// if (shouldAdd) {
|
|
|
+// EarningSnapshot record = new EarningSnapshot();
|
|
|
+// record.setProjectId(p.getId());
|
|
|
+// record.setCreatorId(user.getId());
|
|
|
+// record.setCreatorName(user.getName());
|
|
|
+// record.setContractAmount(p.getContractAmount());
|
|
|
+// record.setCostData(projectBaseCostData);
|
|
|
+// record.setCostTotal(p.getBudget());
|
|
|
+// record.setProfit(p.getContractAmount() - p.getBudget());
|
|
|
+// if (p.getContractAmount() > 0) {
|
|
|
+// record.setProfitPercent(100.0*(p.getContractAmount() - p.getBudget())/p.getContractAmount());
|
|
|
+// earningSnapshotMapper.insert(record);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
}
|
|
|
if (projectKeyNodesData != null) {
|
|
|
updateProjectKeyNodesData(projectKeyNodesData, p.getId());
|
|
@@ -1096,6 +1096,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
for (int i=0;i<array.size(); i++) {
|
|
|
ProjectBasecost projectBasecost = JSONObject.toJavaObject(array.getJSONObject(i), ProjectBasecost.class);
|
|
|
projectBasecost.setProjectId(projectId);
|
|
|
+ if (projectBasecost.getBaseAmount() == null) {
|
|
|
+ projectBasecost.setBaseAmount(0.0);
|
|
|
+ }
|
|
|
Optional<ProjectCurrentcost> first = projectCurrentcostList.stream().filter(pc -> pc.getBaseId().equals(projectBasecost.getBaseId())).findFirst();
|
|
|
if(first.isPresent()){
|
|
|
ProjectCurrentcost projectCurrentcost = first.get();
|
|
@@ -10239,9 +10242,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
sum.add("合计");
|
|
|
sum.add("");
|
|
|
sum.add("");
|
|
|
- sum.add(pTimeSum.toString());
|
|
|
+ sum.add(new BigDecimal(pTimeSum).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
sum.add(new BigDecimal(pFteSum).setScale(2, RoundingMode.HALF_UP) + "");
|
|
|
- sum.add((monthTime - pTimeSum) + "");
|
|
|
+ sum.add(new BigDecimal(monthTime - pTimeSum).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
pTimeSum = 0.0F;
|
|
|
pFteSum = 0.0F;
|
|
|
dataList.add(sum);
|
|
@@ -10279,9 +10282,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
pSum.add("合计");
|
|
|
pSum.add("");
|
|
|
pSum.add("");
|
|
|
- pSum.add(pTimeSum.toString());
|
|
|
+ pSum.add(new BigDecimal(pTimeSum).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
pSum.add(new BigDecimal(pFteSum).setScale(2, RoundingMode.HALF_UP) + "");
|
|
|
- pSum.add((monthTime - pTimeSum) + "");
|
|
|
+ pSum.add(new BigDecimal(monthTime - pTimeSum).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
pTimeSum = 0.0F;
|
|
|
pFteSum = 0.0F;
|
|
|
|
|
@@ -10293,10 +10296,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
sum.add(customName + "合计");
|
|
|
sum.add("");
|
|
|
sum.add("");
|
|
|
- sum.add(aTimeSum.toString());
|
|
|
+ sum.add(new BigDecimal((aTimeSum)).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
//sum.add(new BigDecimal(aFteSum).setScale(2, RoundingMode.HALF_UP) + "");
|
|
|
sum.add("");
|
|
|
- sum.add((monthTime - aTimeSum) + "");
|
|
|
+ sum.add(new BigDecimal((monthTime - aTimeSum)).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
pTimeSum = 0.0F;
|
|
|
pFteSum = 0.0F;
|
|
|
aTimeSum = 0.0F;
|
|
@@ -10340,9 +10343,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
pSum.add("合计");
|
|
|
pSum.add("");
|
|
|
pSum.add("");
|
|
|
- pSum.add(pTimeSum.toString());
|
|
|
+ pSum.add(new BigDecimal(pTimeSum).setScale(2, RoundingMode.HALF_UP) + "");
|
|
|
pSum.add(new BigDecimal(pFteSum).setScale(2, RoundingMode.HALF_UP) + "");
|
|
|
- pSum.add((monthTime - pTimeSum) + "");
|
|
|
+ pSum.add(new BigDecimal((monthTime - pTimeSum)).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
dataList.add(pSum);
|
|
|
|
|
|
ArrayList<String> sum = new ArrayList<>();
|
|
@@ -10354,7 +10357,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
sum.add(aTimeSum.toString());
|
|
|
//sum.add(new BigDecimal(aFteSum).setScale(2, RoundingMode.HALF_UP) + "");
|
|
|
sum.add("");
|
|
|
- sum.add((monthTime - aTimeSum) + "");
|
|
|
+ sum.add(new BigDecimal((monthTime - aTimeSum)).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
dataList.add(sum);
|
|
|
}
|
|
|
}
|