add 会议、工作组 判断用户是否能操作所选年份数据

This commit is contained in:
lijiarao
2024-07-25 16:45:35 +08:00
parent b594b8bce5
commit 1a41ca5904
7 changed files with 85 additions and 14 deletions
@@ -11,6 +11,7 @@ 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.constant.CommonConstant;
import com.jero.common.dto.SendMessageDTO;
import com.jero.common.enums.CompanyMessageEnums;
@@ -64,6 +65,7 @@ import com.jero.modules.oss.service.IOSSFileService;
import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.entity.PayWorkingGroupSubItemContacts;
import com.jero.project.service.AnnualDataLockingService;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.project.service.IPayWorkingGroupSubItemContactsService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
@@ -157,6 +159,8 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
private SafetyCenterService safetyCenterService;
@Resource
private SafetyCenterSubitemContactsService safetyCenterSubitemContactsService;
@Resource
private AnnualDataLockingService annualDataLockingService;
/**
* 新增会议
*/
@@ -489,6 +493,9 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
throw new JeroBootException("会议费用为0时,不可上传收款二维码");
}
}
String year = payMeetingVO.getParticularYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
//根据会议类型进行校验
switch (meetingType) {
case MeetingCommon.WORKING_GROUP_MEETING:
@@ -663,6 +670,10 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
if (integer > 0) {
throw new JeroBootException("该会议有参会人无法删除");
}
PayMeeting payMeeting = getById(id);
String year = payMeeting.getParticularYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
removeById(id);
LambdaQueryWrapper<PayMeetingHotelContacts> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingHotelContacts::getMeetingId, id);
@@ -685,6 +696,10 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
PayMeeting payMeeting = getById(id);
meetingList.add(payMeeting.getMeetingName());
}
PayMeeting payMeeting = getById(id);
String year = payMeeting.getParticularYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
}
if (meetingList.size() > 0) {
throw new JeroBootException(meetingList + "会议下有参会人,无法删除");
@@ -200,9 +200,8 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
if (!b && !Objects.equals(payMeeting1.getDirectorId(),loginUser.getId())) {
throw new JeroBootException("只有会议负责人,会议联系人可以新增参会人");
}
if (annualDataLockingService.checkYear(payMeeting1.getParticularYear())) {
throw new JeroBootException(payMeeting1.getParticularYear()+"年数据已经锁定,无法修改");
}
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(payMeeting1.getParticularYear());
}
payMeetingSituation.setStatus(MeetingSubitemCommon.STATUS_3);
@@ -1035,7 +1034,8 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
if (meetingType1 != null && !Objects.equals(payMeeting.getMeetingType(),meetingType1)) {
throw new JeroBootException("数据权限不足");
}
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(payMeeting.getParticularYear());
//把原始数据保存下来,后面用于判断修改了那些字段
PayMeetingSituation oldObject = new PayMeetingSituation();
BeanUtils.copyProperties(payMeetingSituation, oldObject);
@@ -1554,6 +1554,11 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
*/
@Override
public void deleteById(String id) {
PayMeetingSituation meetingSituation = this.getById(id);
String meetingId = meetingSituation.getMeetingId();
PayMeeting payMeeting = meetingService.getById(meetingId);
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(payMeeting.getParticularYear());
removeSituationPack(id);
removeById(id);
}
@@ -1563,6 +1568,13 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
*/
@Override
public void deleteByIds(List<String> ids) {
List<PayMeetingSituation> payMeetingSituations = this.listByIds(ids);
List<String> meetingIds = payMeetingSituations.stream().map(PayMeetingSituation::getMeetingId).distinct().collect(Collectors.toList());
List<PayMeeting> payMeetings = meetingService.listByIds(meetingIds);
for (PayMeeting payMeeting : payMeetings) {
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(payMeeting.getParticularYear());
}
for (String id : ids) {
removeSituationPack(id);
}
@@ -20,6 +20,7 @@ import com.jero.mail.commont.constant;
import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.jero.project.service.AnnualDataLockingService;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
import com.jero.project.vo.PayWorkingGroupPayment;
@@ -59,7 +60,8 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
private IPayIncomeContractService payIncomeContractService;
@Resource
private RolePermissionService rolePermissionService;
@Resource
private AnnualDataLockingService annualDataLockingService;
/**
* 分页列表查询
*
@@ -295,6 +297,9 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
log.info("工作组项目-添加异常",e);
return Result.error("工作组项目已存在!");
}
String year = payWorkingGroup.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
payWorkingGroupService.setPayWorkingGroup(payWorkingGroup);
payWorkingGroupService.save(payWorkingGroup);
return Result.OK("添加成功!");
@@ -318,10 +323,17 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
if(StringUtils.isEmpty(payWorkingGroup.getId())){
return Result.error("工作组id不能为空!");
}
String year = payWorkingGroup.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
PayWorkingGroup payWorkingGroupOld = payWorkingGroupService.getById(payWorkingGroup.getId());
if(Objects.isNull(payWorkingGroupOld)){
return Result.error(payWorkingGroupOld.getWorkingGroupProject() + "工作组不存在!");
}
String oldYear = payWorkingGroupOld.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(oldYear);
// 工作组下有子项目的时候不能编辑是否收费字段
// 根据id找到原始数据,判断是否收费字段是否变动,如果变动则提示不可修改
if(!Objects.equals(payWorkingGroupOld.getPayFlag(),payWorkingGroup.getPayFlag())){
@@ -36,6 +36,7 @@ import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.jero.project.entity.PayWorkingGroupSubItemContacts;
import com.jero.project.service.AnnualDataLockingService;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.project.service.IPayWorkingGroupSubItemContactsService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
@@ -104,6 +105,8 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
private ISysUserService sysUserService;
@Resource
private IPayWorkingGroupSubItemContactsService payWorkingGroupSubItemContactsService;
@Resource
private AnnualDataLockingService annualDataLockingService;
/**
* 分页列表查询
@@ -463,6 +466,9 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
List<String> errInfoList = new ArrayList<>();
for (String workingGroupId : workingGroupIdsArr) {
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(workingGroupId);
String year = payWorkingGroup.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
BigDecimal yearChargeA = payWorkingGroup.getYearChargeA();
BigDecimal taxRate = new BigDecimal("0.06");
payWorkingGroupSubItem.setTaxRate(taxRate);
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollStreamUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.jero.common.common.RoleCommon;
import com.jero.common.constant.CacheConstant;
import com.jero.common.exception.JeroBootException;
import com.jero.common.service.ProjectDetailService;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.LoginUser;
@@ -140,7 +141,20 @@ public class AnnualDataLockingService extends ServiceImpl<AnnualDataLockingMappe
return baseMapper.countByYear(year) > 0;
}
/**
* 判断用户是否能操作所选年份数据
* @param year
*/
public void judgeUserYear(String year){
boolean b = checkYear(year);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (user.getRoleCode().equals(RoleCommon.XMFZR) && b){
throw new JeroBootException(year+"年数据已经锁定");
}
}
public void editById(AnnualDataLocking annualDataLocking) {
this.updateById(annualDataLocking);
}
@CacheEvict(value="annualDataLocking", allEntries=true)
@@ -33,10 +33,7 @@ import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.*;
import com.jero.project.mapper.PayWorkingGroupMapper;
import com.jero.project.mapper.PayWorkingGroupSubItemContactsMapper;
import com.jero.project.service.IPayResearchProjectService;
import com.jero.project.service.IPayWorkingGroupDataFileService;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
import com.jero.project.service.*;
import com.jero.project.vo.PayWorkingGroupVO;
import com.jero.statistics.entity.*;
import com.jero.temporary.entity.PayCompanyManagementTemporary;
@@ -103,6 +100,8 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
private IPayWorkingGroupDataFileService payWorkingGroupDataFileService;
@Resource
private IOSSFileService iossFileService;
@Resource
private AnnualDataLockingService annualDataLockingService;
@Value("${jero.path.upload}")
private String upLoadPath;
@@ -132,7 +131,9 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
!Objects.equals(payWorkingGroupOld.getPrincipalIdB(),sysUser.getId())){
throw new JeroBootException(payWorkingGroupOld.getWorkingGroupProject() + "工作组项目不可操作!");
}
String year = payWorkingGroupOld.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,id);
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query);
@@ -170,6 +171,9 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
!Objects.equals(payWorkingGroupOld.getPrincipalIdB(),sysUser.getId())){
sb.append(payWorkingGroupOld.getWorkingGroupProject() + "工作组项目不可操作!<br/>");
}
String year = payWorkingGroupOld.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId, p);
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query);
@@ -764,6 +768,9 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
if (Objects.isNull(payWorkingGroup)) {
throw new JeroBootException("工作组不存在");
}
String year = payWorkingGroup.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
// 找到是否付费标识
Integer payFlag = payWorkingGroup.getPayFlag();
if (Objects.isNull(payFlag)) {
@@ -45,10 +45,7 @@ import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.*;
import com.jero.project.mapper.PayWorkingGroupSubItemContactsMapper;
import com.jero.project.mapper.PayWorkingGroupSubItemMapper;
import com.jero.project.service.IPayCommonProjectService;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.project.service.IPayWorkingGroupSubItemContactsService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
import com.jero.project.service.*;
import com.jero.project.vo.SetChargeInput;
import com.jero.project.vo.SetLabelVO;
import com.jero.statistics.entity.AllMoney;
@@ -137,6 +134,8 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
IPayCommonProjectService payCommonProjectService;
@Resource
private PayContactsManagementMapper payContactsManagementMapper;
@Resource
private AnnualDataLockingService annualDataLockingService;
private static final String DATE_FORMAT = "yyyy-MM-dd";
@@ -338,6 +337,9 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(), sysUser.getId())) {
throw new JeroBootException("工作组成员不可操作!");
}
String year = payWorkingGroup.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
// 项目为打包状态 || 到账!=0 || 开票!=0 || 邮寄!=0
if (!Objects.equals(payWorkingGroupSubItem.getChargeCompanyId(), payWorkingGroupSubItemOld.getChargeCompanyId())
&& (Objects.equals(payWorkingGroupSubItem.getPack(), PayProjectCommon.PACKAGING1)
@@ -1381,6 +1383,9 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(), sysUser.getId())) {
throw new JeroBootException("工作组成员不可操作!");
}
String year = payWorkingGroup.getYear();
//判断用户是否能操作所选年份数据
annualDataLockingService.judgeUserYear(year);
// 校验项目是否已关联合同 抛异常
payIncomeContractService.getPayIncomeContractAssociated(Collections.singletonList(payWorkingGroupSubItem.getId()));
// 如果已打报,同步删除打包关联