生成合同
This commit is contained in:
parent
a8ba3a08eb
commit
6121032236
@ -57,6 +57,10 @@
|
||||
<version>5.2.0</version>
|
||||
</dependency>
|
||||
<!--pdf所需pom end-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -87,7 +87,15 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
}
|
||||
add.setCompanyId(bo.getCompanyInfoBo().getId());//公司id
|
||||
MapstructUtils.convert(bo, add);
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
bo.getBusinessList().forEach(item->{
|
||||
BigDecimal mony = BigDecimal.ZERO;
|
||||
if(CollectionUtils.isNotEmpty(item.getDetailBos())){
|
||||
mony = item.getDetailBos().stream().map(PsContractBusinessDetailBo::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
item.setBusinessAmount(mony);
|
||||
});
|
||||
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
add.setContractAmount(sum);//合同总金额
|
||||
add.setContractStatus(type == 1?ContractStatusEnum.INIT.getCode():ContractStatusEnum.CREATE.getCode());//合同状态
|
||||
baseMapper.insertOrUpdate(add);
|
||||
@ -110,7 +118,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
add.setCustomManager(LoginHelper.getUserId());//所属销售经理id
|
||||
add.setCompanyId(bo.getCompanyInfoBo().getId());//公司id
|
||||
MapstructUtils.convert(bo, add);
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
add.setContractAmount(sum);//合同总金额
|
||||
return makePdf(add,bo);
|
||||
}
|
||||
@ -209,7 +217,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
//3.插入公司信息
|
||||
companyInfoService.saveBo(bo.getCompanyInfoBo());
|
||||
//4.装填合同信息
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
bo.setContractAmount(sum);//合同总金额
|
||||
//5.删除所有服务类型和服务项目,.插入服务类型
|
||||
businessService.saveList(bo.getBusinessList(),bo.getContractCode());
|
||||
@ -266,7 +274,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
PsContractInfoVo infoVo = this.queryContractByCode(contractCode);
|
||||
//查询是否有审批中的退款信息
|
||||
List<PsContractPayVo> payList = contractPayService.queryListByContractCode(contractCode,null,PayStatusEnum.PAYING);
|
||||
BigDecimal pay = payList.stream().map(PsContractPayVo::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal pay = payList.stream().map(PsContractPayVo::getMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//有未完成的退款:【合同列表】状态更新为【处理中】;并显示在【已完成回款列表】,重新生成任务
|
||||
if(infoVo.getPayMoney().subtract(pay).compareTo(BigDecimal.ZERO) > 0){
|
||||
info.setContractStatus(ContractStatusEnum.EXECUTION.getCode());
|
||||
@ -303,6 +311,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
map.put("company",bo.getCompanyInfoBo());
|
||||
map.put("customer",customer);
|
||||
String path = System.getProperty("user.dir")+"test.pdf";
|
||||
log.info(JSON.toJSONString(map));
|
||||
// path = "D:/王立帅/临时/output.pdf";
|
||||
PdfGenerator.makePdf(map, path,TenplateEnum.CONTRACT.getName());
|
||||
File file = new File(path);
|
||||
@ -352,10 +361,10 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
vo.setContractPayVoList(payList);
|
||||
//退款金额
|
||||
vo.setReturnMoney(payList.stream().filter(item->StringUtils.equals(item.getBusinessType(), PayBuinessStatusEnum.RETURN.getCode()))
|
||||
.map(PsContractPayVo::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
.map(PsContractPayVo::getMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
//收款金额
|
||||
BigDecimal netPay = payList.stream().filter(item -> StringUtils.equals(item.getBusinessType(), PayBuinessStatusEnum.PAY.getCode()))
|
||||
.map(PsContractPayVo::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
.map(PsContractPayVo::getMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal pay = netPay.subtract(vo.getReturnMoney());
|
||||
//已付金额(收款-退款)
|
||||
vo.setPayMoney(pay.compareTo(BigDecimal.ZERO)>=0?pay:BigDecimal.ZERO);
|
||||
|
@ -146,7 +146,7 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
|
||||
info.setPsCompanyInfoVos(id_companyMap.get(info.getId()));
|
||||
//报价金额
|
||||
if(CollectionUtils.isNotEmpty(info.getPsCustomPriceVo())){
|
||||
info.setPrice(info.getPsCustomPriceVo().stream().map(PsCustomPriceVo::getServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
info.setPrice(info.getPsCustomPriceVo().stream().map(PsCustomPriceVo::getServicePrice).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
}
|
||||
//最新的回访信息
|
||||
if(CollectionUtils.isNotEmpty(info.getPsCustomCallbackVo())){
|
||||
|
@ -6,8 +6,8 @@ import ${import};
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import annotation.com.pusong.common.excel.ExcelDictFormat;
|
||||
import convert.com.pusong.common.excel.ExcelDictConvert;
|
||||
import com.pusong.common.excel.annotation.ExcelDictFormat;
|
||||
import com.pusong.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -29,6 +29,8 @@ import com.pusong.system.domain.vo.SysOssVo;
|
||||
import com.pusong.system.mapper.SysOssMapper;
|
||||
import com.pusong.system.service.ISysOssService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -50,6 +52,7 @@ import java.util.Map;
|
||||
@Service
|
||||
public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SysOssServiceImpl.class);
|
||||
private final SysOssMapper baseMapper;
|
||||
|
||||
/**
|
||||
@ -195,7 +198,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
try {
|
||||
uploadResult = storage.uploadSuffix(file.getBytes(), suffix);
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
log.error("文件上传失败",e);
|
||||
throw new ServiceException("文件上传失败,请联系管理员");
|
||||
}
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||
|
Loading…
Reference in New Issue
Block a user