修改bug#41582

This commit is contained in:
梁琦涛
2021-10-28 10:55:13 +08:00
parent 8f5bc2f104
commit 90a2585224
4 changed files with 78 additions and 15 deletions
@@ -24,8 +24,10 @@ import com.jero.common.util.oConvertUtils;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.entity.PayWorkingGroupDataFile;
import com.jero.project.service.IPayWorkingGroupDataFileService;
import com.jero.project.service.IPayWorkingGroupService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -56,6 +58,8 @@ public class PayWorkingGroupDataFileController extends JeroController<PayWorking
@Resource
private RolePermissionService rolePermissionService;
@Resource
private IPayWorkingGroupService payWorkingGroupService;
@Value("${jero.path.upload}")
private String upLoadPath;
@@ -82,10 +86,20 @@ public class PayWorkingGroupDataFileController extends JeroController<PayWorking
&& payWorkingGroupDataFile.getProjectType() != PayProjectCommon.PROJECT_TYPE_FILE2){
return Result.error("项目状态不正确!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission("fileMaintenance:search")){
payWorkingGroupDataFile.setCreateBy(sysUser.getUsername());
if(payWorkingGroupDataFile.getProjectType() == PayProjectCommon.PROJECT_TYPE_FILE1){
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupDataFile.getProjectId());
if(Objects.isNull(payWorkingGroup)){
throw new JeroBootException("工作组不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission("fileMaintenance:search")
&& !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId())
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
throw new JeroBootException("资料不可操作!");
}
}
if(!StringUtils.isBlank(payWorkingGroupDataFile.getFileName())){
payWorkingGroupDataFile.setFileName(oConvertUtils.replaceAllPercent(payWorkingGroupDataFile.getFileName()));
}
@@ -15,6 +15,7 @@ import com.jero.common.dto.SendMessageDTO;
import com.jero.common.enums.CompanyMessageEnums;
import com.jero.common.exception.JeroBootException;
import com.jero.common.service.ProjectDetailService;
import com.jero.common.service.RolePermissionService;
import com.jero.common.service.SendMessageService;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.vo.LoginUser;
@@ -85,6 +86,8 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
private IPayMailBillProjectService payMailBillProjectService;
@Resource
private IPayIncomeContractAssociatedService payIncomeContractAssociatedService;
@Resource
private RolePermissionService rolePermissionService;
/**
* 分页列表查询
@@ -111,6 +114,16 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
if(!StringUtils.isBlank(payWorkingGroupSubItem.getChargeCompanyTemporaryName())){
payWorkingGroupSubItem.setChargeCompanyTemporaryName(oConvertUtils.replaceAllPercent(payWorkingGroupSubItem.getChargeCompanyTemporaryName()));
}
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
return Result.error("工作组不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission("workingGroupMember:search")
&& !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId())
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
return Result.error("工作组成员不可操作!");
}
Page<PayWorkingGroupSubItem> page = new Page<>(pageNo, pageSize);
IPage<PayWorkingGroupSubItem> pageList = payWorkingGroupSubItemService.queryPageList(page, payWorkingGroupSubItem, paymentDate);
if(!CollectionUtils.isEmpty(pageList.getRecords())){
@@ -302,6 +315,7 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
if (StringUtils.isBlank(payWorkingGroupSubItem.getProjectIds())) {
return Result.error("id不能为空!");
}
String[] s = payWorkingGroupSubItem.getProjectIds().split(",");
for (String s1 : s) {
if (StringUtils.isBlank(s1)) {
@@ -316,12 +330,18 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
if(Objects.isNull(payWorkingGroup)){
return Result.error("工作组不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission("workingGroupMember:setDunningReminder")
&& !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId())
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
throw new JeroBootException("工作组成员不可操作!");
}
List<String> listContacts = listPayWorkingGroupSubItem.stream().map(PayWorkingGroupSubItem::getContactsTemporaryIdOne).collect(Collectors.toList());
List<PayContactsManagementTemporary> listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listContacts);
if(CollectionUtils.isEmpty(listPayContactsManagementTemporary)){
return Result.error("联系人不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
listPayWorkingGroupSubItem.forEach(p->{
List<PayContactsManagementTemporary> listContactsInfo = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(p.getContactsTemporaryIdOne(),item.getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContactsInfo)){
@@ -469,6 +489,16 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
@GetMapping(value = "/exportXls")
@ApiOperation(value = "工作组成员-导出excel", notes = "工作组成员-导出excel")
public ModelAndView exportXls(HttpServletRequest request, PayWorkingGroupSubItem payWorkingGroupSubItem) {
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
throw new JeroBootException("工作组不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission("workingGroupMember:export")
&& !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId())
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
throw new JeroBootException("工作组成员不可操作!");
}
return super.exportXls(request, payWorkingGroupSubItem, PayWorkingGroupSubItem.class, "工作组成员");
}
@@ -19,9 +19,6 @@
<if test="payWorkingGroupDataFile.fileName != null and payWorkingGroupDataFile.fileName != ''">
AND osf.file_name LIKE CONCAT('%',CONCAT(#{payWorkingGroupDataFile.fileName},'%'))
</if>
<if test="payWorkingGroupDataFile.createBy != null and payWorkingGroupDataFile.createBy != ''">
AND pwgdf.create_by = #{payWorkingGroupDataFile.createBy}
</if>
ORDER BY pwgdf.create_time desc
</select>
@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.jero.common.api.vo.Result;
import com.jero.common.common.ProjectCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.common.service.ContractCreateProjectSendMessageService;
import com.jero.common.service.ProjectDetailService;
import com.jero.common.service.RolePermissionService;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.ImportExcelUtil;
import com.jero.common.util.ValidUtil;
import com.jero.common.vo.ProjectStatusVO;
@@ -33,6 +36,7 @@ import com.jero.temporary.service.IPayContactsManagementTemporaryService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportCheckUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
@@ -43,7 +47,6 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@@ -81,6 +84,8 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
private IPayMeetingRemindRecordService payMeetingRemindRecordService;
@Resource
private ContractCreateProjectSendMessageService contractCreateProjectSendMessageService;
@Resource
private RolePermissionService rolePermissionService;
@Override
@@ -181,6 +186,16 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
if(Objects.isNull(payWorkingGroupSubItemOld)){
throw new JeroBootException("项目不存在!");
}
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
throw new JeroBootException("工作组不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission("workingGroupMember:edit")
&& !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId())
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
throw new JeroBootException("工作组成员不可操作!");
}
// 项目为打包状态 || 到账!=0 || 开票!=0 || 邮寄!=0
if(!Objects.equals(payWorkingGroupSubItem.getChargeCompanyId(),payWorkingGroupSubItemOld.getChargeCompanyId())
&& (Objects.equals(payWorkingGroupSubItem.getPack(),PayProjectCommon.PACKAGING1)
@@ -205,10 +220,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
throw new JeroBootException("应收金额不能为空");
}
}
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
throw new JeroBootException("工作组不存在!");
}
try {
// 编辑保存前再次校验来款项目是否存在
LambdaQueryWrapper<PayWorkingGroupSubItem> queryWrapper = new LambdaQueryWrapper<>();
@@ -566,7 +578,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
if (StringUtils.isBlank(id)) {
throw new JeroBootException("id不能为空!");
}
deleteProject(id);
deleteProject(id,"workingGroupMember:delete");
payWorkingGroupSubItemService.removeById(id);
}
@@ -581,7 +593,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
if (StringUtils.isBlank(s1)) {
throw new JeroBootException("id不能为空!");
}
deleteProject(s1);
deleteProject(s1,"workingGroupMember:batchDel");
}
payWorkingGroupSubItemService.removeByIds(Arrays.asList(ids.split(",")));
}
@@ -604,7 +616,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
* @Return
* @Exception
*/
private void deleteProject(String id){
private void deleteProject(String id,String perm){
PayWorkingGroupSubItem payWorkingGroupSubItem = payWorkingGroupSubItemService.getById(id);
// 到账!=0
if(!Objects.equals(payWorkingGroupSubItem.getInAccount(),PayProjectCommon.IN_ACCOUNT0)){
@@ -618,6 +630,16 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
if(!Objects.equals(payWorkingGroupSubItem.getMail(),PayProjectCommon.MAIL0)){
throw new JeroBootException("项目已有邮寄信息不可删除!");
}
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
throw new JeroBootException("工作组不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!rolePermissionService.getRolePermission(perm)
&& !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId())
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
throw new JeroBootException("工作组成员不可操作!");
}
// 校验项目是否已关联合同 抛异常
payIncomeContractService.getPayIncomeContractAssociated(Collections.singletonList(payWorkingGroupSubItem.getId()));
// 如果已打报,同步删除打包关联