From 247c6f8320097b060a4d08cd9fc96938149d9c4f Mon Sep 17 00:00:00 2001 From: ruanqi Date: Thu, 13 Feb 2025 15:25:06 +0800 Subject: [PATCH] =?UTF-8?q?0412=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/production/dao/DailyPlanMapper.java | 4 ++++ .../service/impl/ReworkRecordServiceImpl.java | 16 +++++++++++++++- .../mapper/production/DailyPlanMapper.xml | 8 +++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/heai/modules/production/dao/DailyPlanMapper.java b/src/main/java/com/heai/modules/production/dao/DailyPlanMapper.java index 459cb57..f40150c 100644 --- a/src/main/java/com/heai/modules/production/dao/DailyPlanMapper.java +++ b/src/main/java/com/heai/modules/production/dao/DailyPlanMapper.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.heai.modules.app.entity.ProductionWarehouseData; import com.heai.modules.app.entity.SoBomData; import com.heai.modules.production.entity.*; +import com.heai.modules.sys.entity.SysRoleEntity; import com.heai.modules.sys.entity.VpPartData; import io.swagger.models.auth.In; import org.apache.ibatis.annotations.Mapper; @@ -1039,4 +1040,7 @@ public interface DailyPlanMapper { List getTimeHistListForSfdc(SfdcTimeHistSOSData inData); List checkSPBOMIsIssure(SOScheduledRoutingOutData inData); + + List checkUserRole(@Param("userId") Long userId, + @Param("typeName") String typeName); } diff --git a/src/main/java/com/heai/modules/production/service/impl/ReworkRecordServiceImpl.java b/src/main/java/com/heai/modules/production/service/impl/ReworkRecordServiceImpl.java index 911d0a2..b8236bb 100644 --- a/src/main/java/com/heai/modules/production/service/impl/ReworkRecordServiceImpl.java +++ b/src/main/java/com/heai/modules/production/service/impl/ReworkRecordServiceImpl.java @@ -9,7 +9,10 @@ import com.heai.modules.production.entity.ReworkRecord; import com.heai.modules.production.entity.ReworkRecordData; import com.heai.modules.production.entity.SOScheduledRoutingOutData; import com.heai.modules.production.service.ReworkRecordService; +import com.heai.modules.sys.entity.SysRoleEntity; +import com.heai.modules.sys.entity.SysUserEntity; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -104,11 +107,22 @@ public class ReworkRecordServiceImpl extends ServiceImpl checkUserRole=dailyPlanMapper.checkUserRole(currentUser.getUserId(),"管理员"); + if(checkUserRole.size()==0){ + throw new RuntimeException("该用户没有权限"); + } lambdaUpdate().eq(ReworkRecord::getReworkNo,reworkRecord.getReworkNo()).remove(); } @Override public void cancelRework(ReworkRecord reworkRecord) { - baseMapper.cancelRework(reworkRecord); + SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); + List checkUserRole=dailyPlanMapper.checkUserRole(currentUser.getUserId(),"管理员"); + if(checkUserRole.size()==0){ + throw new RuntimeException("该用户没有权限"); + } + baseMapper.cancelRework(reworkRecord + ); } } diff --git a/src/main/resources/mapper/production/DailyPlanMapper.xml b/src/main/resources/mapper/production/DailyPlanMapper.xml index 09543b6..e912dac 100644 --- a/src/main/resources/mapper/production/DailyPlanMapper.xml +++ b/src/main/resources/mapper/production/DailyPlanMapper.xml @@ -1567,7 +1567,7 @@ from WorkCenterResource where site=#{site} and ResourceID=#{resourceID} and WorkCenterNo=#{workCenterNo} - select a.Site,a.TransNo from SOOpsTransferHeader a left join SOOpsTransferDetail b on a.site=b.site and a.TransNo=b.TransNo where a.site=#{site} and b.seqNo=#{seqNo} and a.need_inspect_flag='Y' and inspected_flag='N' and ToTypeFlag_DB='I' @@ -1619,4 +1619,10 @@ where a.orderNo=#{orderNo} and a.site=#{site} group by a.ComponentPartNo + + \ No newline at end of file