From 05600d089901d44e8d5036046025b6a90ceb896a Mon Sep 17 00:00:00 2001 From: heheng <heheng@123456> Date: 星期二, 03 十二月 2024 16:57:20 +0800 Subject: [PATCH] 修改及增加功能 --- expert-system/src/main/java/com/gkhy/system/service/impl/SysExpertInfoServiceImpl.java | 38 +++++++++++++++++++++++++++++++++----- 1 files changed, 33 insertions(+), 5 deletions(-) diff --git a/expert-system/src/main/java/com/gkhy/system/service/impl/SysExpertInfoServiceImpl.java b/expert-system/src/main/java/com/gkhy/system/service/impl/SysExpertInfoServiceImpl.java index a0a16f8..c9c1f28 100644 --- a/expert-system/src/main/java/com/gkhy/system/service/impl/SysExpertInfoServiceImpl.java +++ b/expert-system/src/main/java/com/gkhy/system/service/impl/SysExpertInfoServiceImpl.java @@ -2,11 +2,14 @@ import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.common.enums.DeleteFlagEnum; import com.gkhy.common.exception.ServiceException; import com.gkhy.common.utils.SecurityUtils; +import com.gkhy.common.utils.StringUtils; import com.gkhy.system.domain.SysExpertInfo; +import com.gkhy.system.domain.vo.request.ExpertBatchChangeReq; import com.gkhy.system.domain.vo.request.SysExpertInfoRoundReq; import com.gkhy.system.domain.vo.request.SysExpertSearchReqDto; import com.gkhy.system.domain.vo.response.ProjectExpertSectionResp; @@ -30,10 +33,8 @@ @Override public List<SysExpertInfo> exportInfoList(SysExpertInfo expertInfo) { - //todo 验证是否是管理不是管理只能看本部门 - if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ - expertInfo.setDeptId(SecurityUtils.getDeptId()); - } + // + return baseMapper.expertInfoList(expertInfo); } @@ -41,6 +42,9 @@ public int addExpertInfo(SysExpertInfo expertInfo) { if(!checkIdCardUnique(new SysExpertInfo().setIdCard(expertInfo.getIdCard()))){ throw new ServiceException("该业务处室申请数据已存在"); + } + if(StringUtils.isEmpty(expertInfo.getPersonalOpinionKey()) && StringUtils.isEmpty(expertInfo.getRecommendUnitOpinionKey())){ + throw new ServiceException("专家本人意见和推荐单位意见不能同时为空"); } expertInfo.setCreateBy(expertInfo.getName()); boolean b=save(expertInfo); @@ -55,6 +59,7 @@ if(!checkIdCardUnique(expertInfo)){ throw new ServiceException("该业务处室申请数据已存在"); } + checkHavePer(expertInfo.getId()); expertInfo.setUpdateBy(SecurityUtils.getUsername()); boolean b=updateById(expertInfo); if(!b){ @@ -65,6 +70,8 @@ @Override public int delExpertInfo(Long expertId) { + checkHavePer(expertId); + SysExpertInfo expertInfo = new SysExpertInfo(); expertInfo.setId(expertId); expertInfo.setDelFlag(DeleteFlagEnum.DELETED.getCode().intValue()); @@ -86,6 +93,13 @@ return baseMapper.getExpertInfoById(expertId); } + private void checkHavePer(Long expertId){ + SysExpertInfo sysExpertInfo = checkExpertInfoDataScope(expertId); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && !sysExpertInfo.getDeptId().toString().equals(SecurityUtils.getDeptId().toString())) + { + throw new ServiceException("没有权限操作该专家信息!"); + } + } public SysExpertInfo checkExpertInfoDataScope(Long expertId) { @@ -120,10 +134,24 @@ @Override public List<ProjectExpertSectionResp> getExpertRound(SysExpertInfoRoundReq req) { - req.setDeptId(SecurityUtils.getDeptId()); + // req.setDeptId(SecurityUtils.getDeptId()); return baseMapper.getExpertRound(req); } + @Override + public void batchChangeEmploymentDate(ExpertBatchChangeReq req) { + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ + throw new ServiceException("无权操作!"); + } + + baseMapper.update(null, Wrappers.<SysExpertInfo>lambdaUpdate() + .set(SysExpertInfo::getUpdateBy,SecurityUtils.getUsername()) + .set(SysExpertInfo::getEmploymentDateStart,req.getEmploymentDateStart()) + .set(SysExpertInfo::getEmploymentDateEnd,req.getEmploymentDateEnd()) + .in(SysExpertInfo::getId,req.getId())); + + } + public boolean checkIdCardUnique(SysExpertInfo expertInfo){ Long expertId = expertInfo.getId()==null? -1L : expertInfo.getId(); SysExpertInfo info = baseMapper.checkIdcardUnique(expertInfo.getIdCard(),expertInfo.getDeptId()); -- Gitblit v1.9.2