Browse Source

导入报告对 签字注师1 进行校验

huangguoce 1 day atrás
parent
commit
2ae199a83d

+ 10 - 0
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/factory/UserApiFallbackFactory.java

@@ -245,6 +245,11 @@ public class UserApiFallbackFactory implements FallbackFactory <IUserApi> {
             }
 
             @Override
+            public String getUserIdByUserName(String name) {
+                return null;
+            }
+
+            @Override
             public Integer getUserPostCountById(String id) {
                 return null;
             }
@@ -289,6 +294,11 @@ public class UserApiFallbackFactory implements FallbackFactory <IUserApi> {
 
             }
 
+            @Override
+            public UserDTO getCount(String id) {
+                return null;
+            }
+
         };
     }
 }

+ 16 - 0
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/feign/IUserApi.java

@@ -377,6 +377,15 @@ public interface IUserApi {
     String getUserIdByName(@RequestParam(value = "name")String name);
 
     /**
+     * 根据用户name获取用户id,无租户限制
+     * @param name
+     * @return
+     */
+    @GetMapping(value = BASE_URL + "/getUserIdByUserName")
+    String getUserIdByUserName(@RequestParam(value = "name")String name);
+
+
+    /**
      * 根据用户id查询是否存在“部门主任”岗位
      * @param id
      * @return
@@ -431,6 +440,13 @@ public interface IUserApi {
     @GetMapping(value = BASE_URL + "/logoutByUserAll")
     void logoutByUserAll();
 
+    /**
+     * 根据用户id获取被选次数
+     * @return
+     */
+    @GetMapping(value = BASE_URL + "/getCount")
+    UserDTO getCount(@RequestParam("id")String id);
+
 }
 
 

+ 17 - 5
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/projectReport/service/CwProjectReportService.java

@@ -5633,17 +5633,29 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
                         continue;
                     }
                     //校验签字注师
-                    String signatureAnnotator1 = iUserApi.getUserIdByName(item.getSignatureAnnotator1());
-                    String signatureAnnotator2 = iUserApi.getUserIdByName(item.getSignatureAnnotator2());
+                    String signatureAnnotator1 = iUserApi.getUserIdByUserName(item.getSignatureAnnotator1());
+                    String signatureAnnotator2 = iUserApi.getUserIdByUserName(item.getSignatureAnnotator2());
                     //处理签字注师信息
                     if (StringUtils.isBlank(signatureAnnotator1) && StringUtils.isBlank(signatureAnnotator2)) {
                         result.add("第" + (actualIndex) + "条,报告名为" + item.getReportName() + "的数据存在以下问题:签字注师1和签字注师2至少填写一个");
                         continue;
                     } else {
+                        UserDTO userCountDto = iUserApi.getCount(signatureAnnotator1);
+                        if (userCountDto.getAccountantUserCount() >= 100 && userCountDto.getAccountantUserFlag() == 1) {
+                            if(!"王真".equals(userCountDto.getName())){
+                                result.add("第" + (actualIndex) + "条,报告名为" + item.getReportName() + "的数据存在以下问题:签字注师1被选次数大于100次");
+                                continue;
+                            }else{
+                                 if(userCountDto.getAccountantUserCount() >= 120 ){
+                                     result.add("第" + (actualIndex) + "条,报告名为" + item.getReportName() + "的数据存在以下问题:签字注师1王真的被选次数已达120次");
+                                     continue;
+                                 }
+                            }
+                        }
                         item.setSignatureAnnotator1(signatureAnnotator1);
                         item.setSignatureAnnotator2(signatureAnnotator2);
                     }
-                    String nextAssignee = iUserApi.getUserIdByName(item.getNextAssignee());
+                    String nextAssignee = iUserApi.getUserIdByUserName(item.getNextAssignee());
                     if (StringUtils.isBlank(nextAssignee)) {
                         result.add("第" + (actualIndex) + "条,报告名为" + item.getReportName() + "的数据存在以下问题:未找到下一节点审核人的信息");
                         continue;
@@ -5654,7 +5666,7 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
                     if (StringUtils.isBlank(item.getRealCreate())) {
                         item.setRealCreate(userDTO.getId());
                     } else {
-                        String userId = iUserApi.getUserIdByName(item.getRealCreate());
+                        String userId = iUserApi.getUserIdByUserName(item.getRealCreate());
                         if (StringUtils.isNotBlank(userId)) {
                             item.setRealCreate(userId);
                         } else {
@@ -5692,7 +5704,7 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
                         String projectResult = cwProjectRecordsService.importProjectRecords(cwProjectRecordsDTOS);
 
                         if (StringUtils.isNotBlank(projectResult)) {
-                            result.add("第" + (actualIndex) + "条,报告名为" + item.getReportName() + "的数据存在以下问题:" + projectResult);
+                            result.add("第" + (actualIndex) + "条,报告名为" + item.getReportName() + "的数据存在以下问题:该项目信息未登记,请先登记,或在表格内将对应项目信息进行补充完整后再次上传" );
                             continue;
                         }else{
                             LambdaQueryWrapper<CwProjectRecords> projectWrapper = new LambdaQueryWrapper<>();

BIN
jeeplus-modules/jeeplus-finance/src/main/resources/dot/报告批量导入模板.xlsx


+ 22 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/feign/UserApiImpl.java

@@ -18,6 +18,7 @@ import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.service.mapstruct.UserWrapper;
 import com.jeeplus.sys.utils.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.web.bind.annotation.RestController;
@@ -316,6 +317,11 @@ public class UserApiImpl implements IUserApi {
     }
 
     @Override
+    public String getUserIdByUserName(String name) {
+        return userService.getUserIdByUserName(name) ;
+    }
+
+    @Override
     public Integer getUserPostCountById(String id) {
         return userService.getUserPostCountById(id) ;
     }
@@ -367,4 +373,20 @@ public class UserApiImpl implements IUserApi {
         }
     }
 
+    public UserDTO getCount(String id){
+        UserDTO userDTO = userService.get(id);
+        List<UserDTO> signatureAnnotator2List = userService.getSignatureAnnotator2List(new UserDTO());
+        for (UserDTO dto : signatureAnnotator2List) {
+
+            if (userDTO.getId().equals(dto.getId())) {
+                userDTO.setAccountantUserFlag(0);
+                break;
+            } else {
+                userDTO.setAccountantUserFlag(1);
+            }
+        }
+        userDTO.setAccountantUserCount(userService.getAccountantUserCount(id));
+        return userDTO;
+    }
+
 }

+ 9 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/UserMapper.java

@@ -214,6 +214,15 @@ public interface UserMapper extends BaseMapper <User> {
     String getUserIdByName(@Param("name") String name);
 
     /**
+     * 根据条件查询用户id
+     * @param name
+     * @return
+     */
+    @InterceptorIgnore(tenantLine = "true")
+    String getUserIdByUserName(@Param("name") String name);
+
+
+    /**
      * 根据部门获取员工数据
      * @param officeIds
      * @param type

+ 4 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml

@@ -332,6 +332,10 @@ select a.id, a.company_id as "companyDTO.id", a.office_id as "officeDTO.id", a.l
 		select id from sys_user su where su.name = #{name} limit 1
 	</select>
 
+    <select id="getUserIdByUserName" resultType="string">
+        select id from sys_user su where su.name = #{name} limit 1
+    </select>
+
     <sql id="userOfficeColumns">
     	a.id,
     	a.login_name AS "loginName",

+ 10 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/UserService.java

@@ -594,6 +594,16 @@ public class UserService extends ServiceImpl<UserMapper, User> {
         return userMapper.getUserIdByName(name);
     }
 
+    /**
+     * 根据用户name获取用户id
+     *
+     * @param name
+     * @return
+     */
+    public String getUserIdByUserName(String name) {
+        return userMapper.getUserIdByUserName(name);
+    }
+
     //根据部门查询用户信息
     public List<OfficeDTO> getUserByOffice(List<String> officeIds, String type) {
         return userMapper.getUserByOffice(officeIds, type);