This commit is contained in:
pengjie 2024-09-02 17:16:21 +08:00
parent 621e6dabfa
commit c0f53b1a9e
4 changed files with 30 additions and 13 deletions

View File

@ -161,10 +161,19 @@ public class ProjectDataController {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject projectObj = jsonArray.getJSONObject(i).getJSONObject("mainTable");
CostContract costContract = JSONObject.parseObject(JSON.toJSONString(projectObj), CostContract.class);
contractList.add(costContract);
JSONArray detailArray = jsonArray.getJSONObject(i).getJSONArray("detail1");
StringBuilder gys = new StringBuilder();
for (int j = 0; j < detailArray.size(); j++) {
String gysbm = detailArray.getJSONObject(j).getString("gysbm");
if (StringUtils.isNotBlank(gysbm)) {
gys.append(gysbm);
gys.append(",");
}
}
System.out.println(detailArray);
costContract.setGysbm(gys.toString());
contractList.add(costContract);
}
costContractService.saveOrUpdateBatch(contractList);
}

View File

@ -448,7 +448,7 @@ public class CostBudgetController {
long count = 1;
while (count > 0 && num < 10) {
for (CostBudget costBudget : costBudgetList) {
if (StringUtils.isBlank(costBudget.getBudgetCost()) || costBudget.getBudgetCost().equals("0")) {
// if (StringUtils.isBlank(costBudget.getBudgetCost()) || costBudget.getBudgetCost().equals("0")) {
List<String> subIds = subjectList.stream().filter(s -> s.getParentId().toString().equals(costBudget.getSubjectId().toString()))
.map(c -> c.getId().toString()).collect(Collectors.toList());
List<CostBudget> costSubjects = costBudgetList.stream().filter(c -> subIds.contains(c.getSubjectId().toString())).collect(Collectors.toList());
@ -458,7 +458,7 @@ public class CostBudgetController {
costBudget.setActualCost("0");
costBudget.setCostDifference("0");
}
}
// }
}
count = costBudgetList.stream().filter(c -> StringUtils.isBlank(c.getBudgetCost())).count();
num ++;

View File

@ -416,6 +416,12 @@ public class CostContract implements Serializable {
@Excel(name = "项目信息", width = 15)
@ApiModelProperty(value = "项目信息")
private String xmxx;
/**
* 供应商编码
*/
@Excel(name = "供应商编码", width = 15)
@ApiModelProperty(value = "供应商编码")
private String gysbm;
/**
* 项目SN
*/

View File

@ -71,9 +71,11 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
BigDecimal reduce = costContractPayList.stream().filter(c -> contractIds.contains(c.getHtmc())).map(c -> new BigDecimal(c.getBczfje()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
costBudget.setActualCost(reduce.toString());
if (!costBudget.getActualCost().equals("0")) {
BigDecimal ratio = reduce.subtract(new BigDecimal(costBudget.getBudgetCost())).divide(new BigDecimal(costBudget.getBudgetCost()), 2, BigDecimal.ROUND_HALF_UP);
costBudget.setCostDifference(ratio.multiply(new BigDecimal(100)).toString());
}
}
getChildren(dtoList, allDtoList, budgetList, true);
}
return dtoList;