From 2b88f76c533a2fa94cd029b8a88c2d4da437552c Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 29 三月 2024 08:55:22 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
index 8088df0..75b8f44 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
@@ -141,6 +141,12 @@
         IPage<UnionApply> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
         QueryWrapper<UnionApply> queryWrapper = new QueryWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
+
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(user.getType().equals(Constants.TWO)){
+            queryWrapper.lambda().eq(UnionApply::getCompanyId, pageWrap.getModel().getCompanyId());
+        }
+
         if (pageWrap.getModel().getId() != null) {
             queryWrapper.lambda().eq(UnionApply::getId, pageWrap.getModel().getId());
         }
@@ -220,10 +226,28 @@
     }
 
 
+
+    @Override
+    public UnionApply detail(Integer applyId){
+        UnionApply unionApply = unionApplyJoinMapper.selectJoinOne(UnionApply.class,
+                new MPJLambdaWrapper<UnionApply>()
+                        .selectAll(UnionApply.class)
+                        .selectAs(Solutions::getName,UnionApply::getSolutionName)
+                        .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad  where ad.UNION_APPLY_ID = t.id ) as insureNum")
+                        .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId)
+                        .eq(UnionApply::getId,applyId)
+                        .last(" limit 1 ")
+        );
+        return unionApply;
+    }
+
+
+
+
     @Override
     public Integer merge(SaveUnionApplyDTO saveUnionApplyDTO){
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        if(user.getType().equals(Constants.TWO)){
+        if(!user.getType().equals(Constants.TWO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣�");
         }
         if(Objects.isNull(saveUnionApplyDTO)
@@ -290,7 +314,7 @@
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public void cancelMerge(Integer id){
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        if(user.getType().equals(Constants.TWO)){
+        if(!user.getType().equals(Constants.TWO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
         }
         UnionApply unionApply = unionApplyMapper.selectById(id);
@@ -340,6 +364,9 @@
             throw  new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(!user.getType().equals(Constants.TWO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
         UnionApply unionApply = unionApplyMapper.selectById(uploadMultifileDTO.getBusinessId());
         if(Objects.isNull(unionApply)||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
@@ -388,6 +415,9 @@
             throw  new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(!user.getType().equals(Constants.TWO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
         UnionApply unionApply = unionApplyJoinMapper.selectById(id);
         if(unionApply == null ||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.DATA_EMPTY);
@@ -451,6 +481,9 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(!user.getType().equals(Constants.TWO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
         UnionApply unionApply = unionApplyJoinMapper.selectById(unionApplyBXDDTO.getId());
         if(unionApply == null ||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.DATA_EMPTY);

--
Gitblit v1.9.3