Merge branch 'master' into xuqiubiangeng1026

# Conflicts:
#	jero-boot-incoming-payment/src/main/java/com/jero/contract/entity/PaySpendingContract.java
This commit is contained in:
梁琦涛
2021-10-26 19:20:55 +08:00
11 changed files with 74 additions and 78 deletions
@@ -164,11 +164,15 @@ public class PaySpendingContract implements Serializable {
@ApiModelProperty(value = "合同约定付款次数")
private String contractPaymentTimes;
/**是否打包(1:是,0:否)*/
// @Excel(name = "是否打包(1:是,0:否)", width = 15)
@ApiModelProperty(value = "是否打包(1:是,0:否)")
// @NotNull(message = "是否打包不能为空")
// @Dict(dicCode = "yn")
private Integer pack;
/**打包年份*/
// @Excel(name = "打包年份", width = 15)
@ApiModelProperty(value = "打包年份")
@Pattern(regexp = "^\\d{4}$",message = "打包年份式错误")
// @Pattern(regexp = "^\\d{4}$",message = "打包年份式错误")
private String packYear;
/**合同状态(2:已通过,3:未通过,4:已归档)*/
@Excel(name = "合同状态(2:已通过,3:未通过,4:已存档)", width = 15)
@@ -251,10 +251,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("收入合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContractStatus.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),payIncomeContractStatus.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
// 项目已打包
if(Objects.equals(payIncomeContractStatus.getPack(),PayIncomeContractCommon.PACK1)){
@@ -320,10 +318,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContract.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),payIncomeContract.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
if(Objects.isNull(payIncomeContract.getAmountReceived())){
payIncomeContract.setAmountReceived(new BigDecimal("0.00"));
@@ -598,10 +594,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContract.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),payIncomeContract.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
// 查看项目类型
switch (String.valueOf(payIncomeContractAssociated.getProjectType())){
@@ -750,10 +744,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContractNew.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),payIncomeContractNew.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
// 验证合同状态是否为草稿或者未通过
if(!Objects.equals(payIncomeContract.getStatus(),PayIncomeContractCommon.STATUS2)
@@ -1010,10 +1002,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("收入合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContractStatus.getPrincipalId())){
throw new JeroBootException(payIncomeContractStatus.getContractName() + "收入合同不可操作!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),payIncomeContractStatus.getPrincipalId())){
throw new JeroBootException(payIncomeContractStatus.getContractName() + "收入合同不可操作!");
}
if(!Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS1)
&& !Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS4)){
@@ -1044,14 +1034,12 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
StringBuilder msg = new StringBuilder();
StringBuilder msg1 = new StringBuilder();
listPayIncomeContractStatus.forEach(p->{
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),p.getPrincipalId())){
msg.append("收入合同不可操作!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),p.getPrincipalId())){
msg.append(p.getContractName() + "收入合同不可操作!");
}
if(!Objects.equals(p.getStatus(),PayIncomeContractCommon.STATUS1)
&& !Objects.equals(p.getStatus(),PayIncomeContractCommon.STATUS4)){
msg1.append("收入合同不可删除!");
msg1.append(p.getContractName() + "收入合同不可删除!");
}
});
if(!StringUtils.isEmpty(msg)){
@@ -208,6 +208,10 @@ public class PaySpendingContractServiceImpl extends ServiceImpl<PaySpendingContr
if(Objects.isNull(paySpendingContractStatus)){
throw new JeroBootException("支出合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),paySpendingContractStatus.getPrincipalId())){
throw new JeroBootException("支出合同不可操作!");
}
List<PaySpendingContractInstallment> listPaySpendingContractInstallment = new ArrayList<>();
if(!CollectionUtils.isEmpty(input.getInstallment())){
listPaySpendingContractInstallment = input.getInstallment();
@@ -271,10 +275,8 @@ public class PaySpendingContractServiceImpl extends ServiceImpl<PaySpendingContr
throw new JeroBootException("支出合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),paySpendingContractStatus.getPrincipalId())){
throw new JeroBootException(paySpendingContractStatus.getContractName() + "支出合同不可操作!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY) && !Objects.equals(sysUser.getId(),paySpendingContractStatus.getPrincipalId())){
throw new JeroBootException("支出合同不可操作!");
}
paySpendingContractService.removeById(id);
LambdaUpdateWrapper<PaySpendingContractInstallment> updatePaySpendingContractInstallment = new LambdaUpdateWrapper<>();
@@ -291,6 +293,20 @@ public class PaySpendingContractServiceImpl extends ServiceImpl<PaySpendingContr
if(CollectionUtils.isEmpty(listPaySpendingContractStatus)){
throw new JeroBootException("支出合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
StringBuilder msg = new StringBuilder();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
listPaySpendingContractStatus.forEach(p->{
if(!Objects.equals(sysUser.getId(),p.getPrincipalId())){
msg.append(p.getContractName() + "支出合同不可操作!");
}
});
}
if(!StringUtils.isEmpty(msg)){
throw new JeroBootException(msg.toString());
}
paySpendingContractService.removeByIds(ids);
LambdaUpdateWrapper<PaySpendingContractInstallment> updatePaySpendingContractInstallment = new LambdaUpdateWrapper<>();
updatePaySpendingContractInstallment.in(PaySpendingContractInstallment::getContractId,ids);