项目基本信息
This commit is contained in:
parent
3f18765190
commit
e2fcf7a96c
@ -234,12 +234,12 @@ public class BaseDataController {
|
||||
String encryptUserid = rsa.encryptBase64("1",CharsetUtil.CHARSET_UTF_8,KeyType.PublicKey);
|
||||
|
||||
//调用ECOLOGY系统接口
|
||||
String data = HttpRequest.post(address + api)
|
||||
.header("appid",APPID)
|
||||
.header("token",token)
|
||||
.header("userid",encryptUserid)
|
||||
.body(jsonParams)
|
||||
.execute().body();
|
||||
String data = HttpRequest.post(address + api)
|
||||
.header("appid",APPID)
|
||||
.header("token",token)
|
||||
.header("userid",encryptUserid)
|
||||
.body(jsonParams)
|
||||
.execute().body();
|
||||
System.out.println("testRestful():"+data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.zhgd.xmgl.modules.cost.entity.CostSubject;
|
||||
import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import io.loadkit.Res;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@ -168,19 +169,8 @@ public class CostCalculateController {
|
||||
@ApiImplicitParam(name = "id", value = "成本核算ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<CostCalculate> delete(@RequestBody CostCalculate costCalculate) {
|
||||
Result<CostCalculate> result = new Result<CostCalculate>();
|
||||
CostCalculate costCalculateEntity = costCalculateService.getById(costCalculate.getId());
|
||||
if (costCalculateEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = costCalculateService.removeById(costCalculate.getId());
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
costCalculateService.removeById(costCalculate.getId());
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -128,7 +128,7 @@ public class CostContractSettlementController {
|
||||
String typeName = object.getString("type");
|
||||
for (int i = 0; i < type.length; i++) {
|
||||
if (type[i].equals(typeName)) {
|
||||
costContractSettlement.setType(i);
|
||||
costContractSettlement.setType(i + 1);
|
||||
}
|
||||
}
|
||||
costContractSettlement.setTotalCost(object.getString("totalCost"));
|
||||
|
||||
@ -42,6 +42,8 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
|
||||
List<CostSubject> list = costSubjectService.list(wrapper);
|
||||
List<CostSubject> filter = list.stream().filter(l -> StringUtils.isNotBlank(l.getName())).collect(Collectors.toList());
|
||||
List<CostBudgetDto> dtoList = convert(filter);
|
||||
List<CostSubject> total = list.stream().filter(l -> StringUtils.isBlank(l.getName())).collect(Collectors.toList());
|
||||
dtoList.addAll(convert(total));
|
||||
if (dtoList.size() > 0) {
|
||||
List<CostSubject> allList = costSubjectService.list();
|
||||
List<CostBudgetDto> allDtoList = convert(allList);
|
||||
@ -49,8 +51,6 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
|
||||
.eq(CostBudget::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||
getChildren(dtoList, allDtoList, budgetList, true);
|
||||
}
|
||||
List<CostSubject> total = list.stream().filter(l -> StringUtils.isBlank(l.getName())).collect(Collectors.toList());
|
||||
dtoList.addAll(convert(total));
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
@ -100,25 +100,38 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
|
||||
.eq(CostBudget::getSubjectId, costSubject1.getId())
|
||||
.eq(CostBudget::getProjectSn, budget.getProjectSn()));
|
||||
List<CostBudget> collect = allBudgetList.stream().filter(c -> subIds.contains(c.getSubjectId().toString())).collect(Collectors.toList());
|
||||
BigDecimal budgetCost = collect.stream().map(s -> new BigDecimal(s.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal actualCost = collect.stream().map(s -> new BigDecimal(s.getActualCost())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
budget1.setBudgetCost(budgetCost.toString());
|
||||
budget1.setActualCost(actualCost.toString());
|
||||
if (actualCost.toString().equals("0")) {
|
||||
budget1.setCostDifference("0");
|
||||
} else {
|
||||
BigDecimal ratio1 = actualCost.subtract(budgetCost).divide(budgetCost, 2, BigDecimal.ROUND_HALF_UP);
|
||||
budget1.setCostDifference(ratio1.multiply(new BigDecimal(100)).toString());
|
||||
}
|
||||
this.updateById(budget1);
|
||||
calculatePrice(budget1, collect);
|
||||
}
|
||||
}
|
||||
|
||||
List<CostSubject> parentList = costSubjectService.list(Wrappers.<CostSubject>lambdaQuery()
|
||||
.eq(CostSubject::getType, costSubject.getType())
|
||||
.eq(CostSubject::getParentId, 0));
|
||||
List<CostBudget> budParentList = this.list(Wrappers.<CostBudget>lambdaQuery()
|
||||
.in(CostBudget::getSubjectId, parentList.stream().filter(p -> StringUtils.isNotBlank(p.getName())).map(p -> p.getId()).collect(Collectors.toList())));
|
||||
CostBudget total = this.getOne(Wrappers.<CostBudget>lambdaQuery().eq(CostBudget::getProjectSn, budget.getProjectSn())
|
||||
.eq(CostBudget::getSubjectId, parentList.stream().filter(p -> StringUtils.isBlank(p.getName())).collect(Collectors.toList()).get(0)));
|
||||
calculatePrice(total, budParentList);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void calculatePrice(CostBudget parent, List<CostBudget> children) {
|
||||
BigDecimal budgetCost = children.stream().map(s -> new BigDecimal(s.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal actualCost = children.stream().map(s -> new BigDecimal(s.getActualCost())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
parent.setBudgetCost(budgetCost.toString());
|
||||
parent.setActualCost(actualCost.toString());
|
||||
if (actualCost.toString().equals("0")) {
|
||||
parent.setCostDifference("0");
|
||||
} else {
|
||||
BigDecimal ratio1 = actualCost.subtract(budgetCost).divide(budgetCost, 2, BigDecimal.ROUND_HALF_UP);
|
||||
parent.setCostDifference(ratio1.multiply(new BigDecimal(100)).toString());
|
||||
}
|
||||
this.updateById(parent);
|
||||
}
|
||||
|
||||
private void addChildren(List<CostBudgetDto> list, List<CostBudgetDto> resultList) {
|
||||
for (CostBudgetDto costBudgetDto : list) {
|
||||
resultList.add(costBudgetDto);
|
||||
|
||||
@ -47,8 +47,8 @@ public class CostCalculateServiceImpl extends ServiceImpl<CostCalculateMapper, C
|
||||
.eq(CostCalculate::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||
getChildren(dtoList, allDtoList, budgetList, true);
|
||||
}
|
||||
List<CostSubject> total = list.stream().filter(l -> StringUtils.isBlank(l.getName())).collect(Collectors.toList());
|
||||
dtoList.addAll(convert(total));
|
||||
// List<CostSubject> total = list.stream().filter(l -> StringUtils.isBlank(l.getName())).collect(Collectors.toList());
|
||||
// dtoList.addAll(convert(total));
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
@ -73,14 +73,20 @@ public class CostCalculateServiceImpl extends ServiceImpl<CostCalculateMapper, C
|
||||
CostCalculate calculate1 = this.getOne(Wrappers.<CostCalculate>lambdaQuery()
|
||||
.eq(CostCalculate::getSubjectId, costSubject1.getId())
|
||||
.eq(CostCalculate::getProjectSn, calculate.getProjectSn()));
|
||||
List<CostCalculate> collect = allBudgetList.stream().filter(c -> subIds.contains(c.getSubjectId().toString())).collect(Collectors.toList());
|
||||
if(calculate1 == null) {
|
||||
calculate1 = new CostCalculate();
|
||||
}
|
||||
List<CostCalculate> collect = allBudgetList.stream().filter(c -> subIds.contains(c.getSubjectId().toString())
|
||||
&& StringUtils.isNotBlank(c.getQuantity())).collect(Collectors.toList());
|
||||
BigDecimal quantity = collect.stream().map(s -> new BigDecimal(s.getQuantity())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal unitPrice = collect.stream().map(s -> new BigDecimal(s.getUnitPrice())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal totalPrice = collect.stream().map(s -> new BigDecimal(s.getTotalPrice())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
calculate1.setQuantity(quantity.toString());
|
||||
calculate1.setTotalPrice(totalPrice.toString());
|
||||
calculate1.setUnitPrice(unitPrice.divide(new BigDecimal(subIds.size()), 2, BigDecimal.ROUND_HALF_UP).toString());
|
||||
this.updateById(calculate1);
|
||||
calculate1.setUnitPrice(unitPrice.divide(new BigDecimal(collect.size()), 2, BigDecimal.ROUND_HALF_UP).toString());
|
||||
calculate1.setSubjectId(costSubject1.getId());
|
||||
calculate1.setProjectSn(calculate.getProjectSn());
|
||||
this.saveOrUpdate(calculate1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -32,11 +32,13 @@ public class CostContractServiceImpl extends ServiceImpl<CostContractMapper, Cos
|
||||
public Page<CostContract> pageList(Page page, Wrapper<CostContract> wrapper) {
|
||||
Page<CostContract> result = this.page(page, wrapper);
|
||||
List<Integer> list = result.getRecords().stream().map(r -> r.getId()).collect(Collectors.toList());
|
||||
List<CostContractSettlement> settlements = costContractSettlementService.list(Wrappers.<CostContractSettlement>lambdaQuery()
|
||||
.in(CostContractSettlement::getContractId, list));
|
||||
for (CostContract record : result.getRecords()) {
|
||||
List<Integer> typeList = settlements.stream().filter(s -> s.getContractId() == record.getId()).map(s -> s.getType()).collect(Collectors.toList());
|
||||
record.setSettlementState(typeList.contains(3) ? 1 : 0);
|
||||
if (list.size() > 0) {
|
||||
List<CostContractSettlement> settlements = costContractSettlementService.list(Wrappers.<CostContractSettlement>lambdaQuery()
|
||||
.in(CostContractSettlement::getContractId, list));
|
||||
for (CostContract record : result.getRecords()) {
|
||||
List<Integer> typeList = settlements.stream().filter(s -> s.getContractId() == record.getId()).map(s -> s.getType()).collect(Collectors.toList());
|
||||
record.setSettlementState(typeList.contains(3) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.cost.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.cost.dto.CostBulletinDto;
|
||||
@ -10,10 +14,12 @@ import com.zhgd.xmgl.modules.cost.entity.CostSubject;
|
||||
import com.zhgd.xmgl.modules.cost.mapper.CostSubjectMapper;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostContractService;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostSubjectService;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -83,11 +89,24 @@ public class CostSubjectServiceImpl extends ServiceImpl<CostSubjectMapper, CostS
|
||||
|
||||
@Override
|
||||
public List<CostBulletinDto> getCostBulletin(Map<String, Object> map) {
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
String month = MapUtils.getString(map, "month");
|
||||
List<CostContract> contractList = costContractService.list(Wrappers.<CostContract>lambdaQuery());
|
||||
List<Project> projects = projectService.list(Wrappers.<Project>lambdaQuery()
|
||||
.eq(Project::getNature, 1));
|
||||
LambdaQueryWrapper<Project> wrapper = Wrappers.<Project>lambdaQuery().eq(Project::getNature, 1);
|
||||
if (StringUtils.isNotBlank(projectSn)) {
|
||||
wrapper.eq(Project::getProjectSn, projectSn);
|
||||
}
|
||||
if (StringUtils.isNotBlank(month)) {
|
||||
DateTime time = DateUtil.parse(month + "-01", "yyyy-MM-dd");
|
||||
wrapper.ge(Project::getCompleteWorkDate, DateUtil.beginOfMonth(time))
|
||||
.le(Project::getCompleteWorkDate, DateUtil.endOfMonth(time));
|
||||
}
|
||||
List<Project> projects = projectService.list(wrapper);
|
||||
List<CostBulletinDto> costBulletinDtoList = new ArrayList<>();
|
||||
for (Project project : projects) {
|
||||
if (StringUtils.isBlank(project.getProjectAcreage()) || StringUtils.isBlank(project.getSaleAcreage())) {
|
||||
continue;
|
||||
}
|
||||
List<CostContract> projectContract = contractList.stream().filter(c -> c.getProjectSn().equals(project.getProjectSn())).collect(Collectors.toList());
|
||||
BigDecimal total = projectContract.stream().map(p -> p.getHthszj()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
CostBulletinDto costBulletinDto = new CostBulletinDto();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user