commit
This commit is contained in:
parent
78c917f69e
commit
ca43bad3d5
@ -92,8 +92,9 @@ public interface IPsContractInfoService {
|
||||
* 生成合同pdf
|
||||
* @param add
|
||||
* @param bo
|
||||
* @param isSave 是否保存数据库
|
||||
*/
|
||||
Long makePdf(PsContractInfo add ,PsContractInfoBo bo);
|
||||
Long makePdf(PsContractInfo add ,PsContractInfoBo bo,boolean isSave);
|
||||
|
||||
/**
|
||||
* 开发票(开发票操作)
|
||||
|
@ -74,7 +74,7 @@ public class SignApproverServiceImpl extends ApproverAbstractServiceImpl {
|
||||
info.setSignStatus(CommonStatusEnum.SUCCESS.getCode());
|
||||
contractInfoService.updateByCode(info);
|
||||
//生成合同
|
||||
contractInfoService.makePdf(info,bo);
|
||||
contractInfoService.makePdf(info,bo,true);
|
||||
}
|
||||
|
||||
//修改签章状态
|
||||
|
@ -65,7 +65,7 @@ public class UpdateContractApproverServiceImpl extends ApproverAbstractServiceIm
|
||||
add.setContractStatus(ContractStatusEnum.RETURN.getCode());
|
||||
contractInfoService.updateByCode(add);
|
||||
//4.生成合同
|
||||
contractInfoService.makePdf(add,bo);
|
||||
contractInfoService.makePdf(add,bo,true);
|
||||
//5.任务状态变为待派单,子任务删除
|
||||
List<PsTaskMain> task = taskMainMapper.selectList(Wrappers.<PsTaskMain>lambdaQuery().eq(PsTaskMain::getContractCode, psApproverRecord.getContractCode()).eq(PsTaskMain::getDelFlag, 0));
|
||||
List<Long> list = task.stream().map(PsTaskMain::getId).collect(Collectors.toList());
|
||||
|
@ -125,7 +125,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
//4.删除所有服务类型和服务项目,.插入服务类型
|
||||
businessService.saveList(bo.getBusinessList(),add.getContractCode());
|
||||
//7.生成合同
|
||||
return makePdf(add,bo);
|
||||
return makePdf(add,bo,true);
|
||||
}
|
||||
/**
|
||||
* 预览合同
|
||||
@ -154,7 +154,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
});
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
add.setContractAmount(sum);//合同总金额
|
||||
return makePdf(add,bo);
|
||||
return makePdf(add,bo,false);
|
||||
}
|
||||
|
||||
|
||||
@ -361,7 +361,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
* @param add
|
||||
* @param bo
|
||||
*/
|
||||
public Long makePdf(PsContractInfo add ,PsContractInfoBo bo){
|
||||
public Long makePdf(PsContractInfo add ,PsContractInfoBo bo,boolean isSave){
|
||||
Long ossId = null;
|
||||
SysDictData main = dictDataService.selectDict("contract_main", add.getContractMain());
|
||||
bo.getBusinessList().forEach(item->{
|
||||
@ -387,7 +387,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
//是否签章
|
||||
map.put(PdfGenerator.SIGN,StringUtils.equals(CommonStatusEnum.SUCCESS.getCode(),add.getSignStatus()));
|
||||
|
||||
String path = System.getProperty("user.dir")+"/"+bo.getCompanyInfoBo().getCompanyName()+"-"+add.getContractCode()+".pdf";
|
||||
String path = System.getProperty("user.dir")+"/"+(StringUtils.isBlank(bo.getCompanyInfoBo().getCompanyName())?"":bo.getCompanyInfoBo().getCompanyName()+"-")+add.getContractCode()+".pdf";
|
||||
log.info(JSON.toJSONString(map));
|
||||
// path = "D:/王立帅/临时/output.pdf";
|
||||
PdfGenerator.makePdf(map, path,TenplateEnum.CONTRACT.getName());
|
||||
@ -397,6 +397,8 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
ossId = sysOssVo.getOssId();
|
||||
//删除临时的合同文件
|
||||
if(file.exists())file.delete();
|
||||
//是否保存合同信息
|
||||
if(isSave){
|
||||
//更新合同id
|
||||
PsContractInfo psContractInfo = new PsContractInfo();
|
||||
psContractInfo.setContractCode(add.getContractCode());
|
||||
@ -404,6 +406,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
this.updateByCode(psContractInfo);
|
||||
//删除原合同
|
||||
if(add.getPdfId() != null)ossService.deleteWithValidByIds(List.of(add.getPdfId()),false);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("生成pdf失败",e);
|
||||
}
|
||||
@ -521,12 +524,15 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
//包含最后一天
|
||||
vo.setPeriod(DateUtils.calWorkDate(payList.get(0).getPayDate(),payList.get(payList.size()-1).getPayDate()) + 1);
|
||||
}
|
||||
if(vo.getFirstApplyDate() != null){
|
||||
Date date = new Date();
|
||||
Date startDate = vo.getFirstApplyDate();
|
||||
int year = (date.getYear() - startDate.getYear());
|
||||
int month = (date.getMonth() - startDate.getMonth());
|
||||
int day = (date.getDate() - startDate.getDate());
|
||||
vo.setConTime((year>0?year+"年":"")+(month>0?month+"月":"")+(day>0?day+"天":"") );
|
||||
}
|
||||
|
||||
//todo 签章未通过时查询未通过的原因
|
||||
return vo;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user