|
@@ -104,23 +104,25 @@ public class ProjectServiceImpl implements ProjectService {
|
|
|
@Override
|
|
|
public Project selectById(String id) {
|
|
|
Project project = projectMapper.selectById(id);
|
|
|
- if(StringUtils.isNotBlank(project.getZrbmId())){
|
|
|
- CommonResult<DeptRespDTO> dept = deptApi.getDept(project.getZrbmId());
|
|
|
- project.setZrbm(dept.getCheckedData().getName());
|
|
|
- }
|
|
|
- List<Contract> contracts = contractService.selectByProject(project.getId());
|
|
|
- BigDecimal amount = BigDecimal.ZERO;
|
|
|
- BigDecimal balance = BigDecimal.ZERO;
|
|
|
- BigDecimal should = BigDecimal.ZERO;
|
|
|
- for (Contract contract : contracts) {
|
|
|
- amount = amount.add(contract.getContractAmount() != null? contract.getContractAmount():BigDecimal.ZERO);
|
|
|
- balance = balance.add(contract.getContractBalance() != null? contract.getContractBalance():BigDecimal.ZERO);
|
|
|
- should = should.add(contract.getReceivableAmount() != null? contract.getReceivableAmount():BigDecimal.ZERO);
|
|
|
- project.setContractNumber(contract.getContractNumber());
|
|
|
+ if(project!=null){
|
|
|
+ if(StringUtils.isNotBlank(project.getZrbmId())){
|
|
|
+ CommonResult<DeptRespDTO> dept = deptApi.getDept(project.getZrbmId());
|
|
|
+ project.setZrbm(dept.getCheckedData().getName());
|
|
|
+ }
|
|
|
+ List<Contract> contracts = contractService.selectByProject(project.getId());
|
|
|
+ BigDecimal amount = BigDecimal.ZERO;
|
|
|
+ BigDecimal balance = BigDecimal.ZERO;
|
|
|
+ BigDecimal should = BigDecimal.ZERO;
|
|
|
+ for (Contract contract : contracts) {
|
|
|
+ amount = amount.add(contract.getContractAmount() != null? contract.getContractAmount():BigDecimal.ZERO);
|
|
|
+ balance = balance.add(contract.getContractBalance() != null? contract.getContractBalance():BigDecimal.ZERO);
|
|
|
+ should = should.add(contract.getReceivableAmount() != null? contract.getReceivableAmount():BigDecimal.ZERO);
|
|
|
+ project.setContractNumber(contract.getContractNumber());
|
|
|
+ }
|
|
|
+ project.setContractAmount(amount);
|
|
|
+ project.setContractBalance(balance);
|
|
|
+ project.setReceivableAmount(should);
|
|
|
}
|
|
|
- project.setContractAmount(amount);
|
|
|
- project.setContractBalance(balance);
|
|
|
- project.setReceivableAmount(should);
|
|
|
return project;
|
|
|
}
|
|
|
|