修改bug#40897

This commit is contained in:
梁琦涛
2021-10-20 10:03:40 +08:00
parent a207384214
commit ba77bc1810
8 changed files with 69 additions and 43 deletions
@@ -91,7 +91,7 @@
AND aa.associatedProject LIKE CONCAT('%',CONCAT(#{projectName},'%'))
</if>
<if test="payIncomeContract.principalId != null and payIncomeContract.principalId != ''">
AND aa.principal_id = #{payIncomeContract.principalId}
AND aa.principalId = #{payIncomeContract.principalId}
</if>
</where>
ORDER BY aa.chargeStatus desc,aa.statusOrder desc, aa.createTime desc
@@ -251,7 +251,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContract.getPrincipalId())){
if(!Objects.equals(sysUser.getId(),payIncomeContractStatus.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
}
@@ -743,7 +743,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContract.getPrincipalId())){
if(!Objects.equals(sysUser.getId(),payIncomeContractNew.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
}
}
@@ -1004,12 +1004,12 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),payIncomeContractStatus.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
throw new JeroBootException(payIncomeContractStatus.getContractName() + "收入合同不可操作!");
}
}
if(!Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS1)
&& !Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS4)){
throw new JeroBootException("收入合同不可删除!");
throw new JeroBootException(payIncomeContractStatus.getContractName() + "收入合同不可删除!");
}
payIncomeContractService.removeById(id);
LambdaUpdateWrapper<PayIncomeContractInstallment> updatePayIncomeContractInstallment = new LambdaUpdateWrapper<>();
@@ -1033,18 +1033,25 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("收入合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
StringBuilder msg = new StringBuilder();
StringBuilder msg1 = new StringBuilder();
listPayIncomeContractStatus.forEach(p->{
if(!Objects.equals(p.getStatus(),PayIncomeContractCommon.STATUS1)
&& !Objects.equals(p.getStatus(),PayIncomeContractCommon.STATUS4)){
throw new JeroBootException("收入合同不可删除!");
}
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),p.getPrincipalId())){
throw new JeroBootException("收入合同不可操作!");
msg.append("收入合同不可操作!");
}
}
if(!Objects.equals(p.getStatus(),PayIncomeContractCommon.STATUS1)
&& !Objects.equals(p.getStatus(),PayIncomeContractCommon.STATUS4)){
msg1.append("收入合同不可删除!");
}
});
if(!StringUtils.isEmpty(msg)){
throw new JeroBootException(msg.toString());
}
if(!StringUtils.isEmpty(msg1)){
throw new JeroBootException(msg1.toString());
}
payIncomeContractService.removeByIds(ids);
LambdaUpdateWrapper<PayIncomeContractInstallment> updatePayIncomeContractInstallment = new LambdaUpdateWrapper<>();
updatePayIncomeContractInstallment.in(PayIncomeContractInstallment::getContractId,ids);
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.common.RoleCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.DateUtils;
import com.jero.common.util.ImportExcelUtil;
import com.jero.common.util.ValidUtil;
@@ -25,6 +27,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -156,6 +159,12 @@ 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)){
if(!Objects.equals(sysUser.getId(),paySpendingContractStatus.getPrincipalId())){
throw new JeroBootException("支出合同不可操作!");
}
}
List<PaySpendingContractInstallment> listPaySpendingContractInstallment = new ArrayList<>();
if(!CollectionUtils.isEmpty(input.getInstallment())){
listPaySpendingContractInstallment = input.getInstallment();
@@ -217,6 +226,12 @@ 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)){
if(!Objects.equals(sysUser.getId(),paySpendingContractStatus.getPrincipalId())){
throw new JeroBootException(paySpendingContractStatus.getContractName() + "支出合同不可操作!");
}
}
paySpendingContractService.removeById(id);
LambdaUpdateWrapper<PaySpendingContractInstallment> updatePaySpendingContractInstallment = new LambdaUpdateWrapper<>();
updatePaySpendingContractInstallment.eq(PaySpendingContractInstallment::getContractId,id);
@@ -229,9 +244,21 @@ public class PaySpendingContractServiceImpl extends ServiceImpl<PaySpendingContr
LambdaQueryWrapper<PaySpendingContract> query = new LambdaQueryWrapper<>();
query.in(PaySpendingContract::getId,ids);
List<PaySpendingContract> listPaySpendingContractStatus = paySpendingContractService.list(query);
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(CollectionUtils.isEmpty(listPaySpendingContractStatus)){
throw new JeroBootException("收入合同不存在!");
}
StringBuilder msg = new StringBuilder();
listPaySpendingContractStatus.forEach(p->{
if(!sysUser.getRoleCode().contains(RoleCommon.CWRY)){
if(!Objects.equals(sysUser.getId(),p.getPrincipalId())){
msg.append(p.getContractName() + "支出合同不可操作!<br/>");
}
}
});
if(!StringUtils.isEmpty(msg)){
throw new JeroBootException(msg.toString());
}
paySpendingContractService.removeByIds(ids);
LambdaUpdateWrapper<PaySpendingContractInstallment> updatePaySpendingContractInstallment = new LambdaUpdateWrapper<>();
updatePaySpendingContractInstallment.in(PaySpendingContractInstallment::getContractId,ids);