Browse Source

单个用户添加登录密码修复,测试计划查询

zsf 1 year ago
parent
commit
3e5cf16934

+ 2 - 2
src/main/java/com/rf/psychological/plan/dao/repository/TestPlanUserRepository.java

@@ -39,9 +39,9 @@ public interface TestPlanUserRepository extends BaseRepository<TestPlanUserEntit
      * @param pageable
      * @return
      */
-    @Query(value = "select * from t_test_plan_user join t_user_info on t_user_info.id = u_id\n" +
+    @Query(value = "select * from t_test_plan_user tu join t_user_info on t_user_info.id = u_id\n" +
             "where test_plan_id=?1 and if(?2 is not null and ?2 !='',(t_user_info.pet_name like CONCAT('%',?2,'%') or phone like CONCAT('%',?2,'%')),1=1)\n" +
-            "  order by create_time desc ",
+            "  order by tu.create_time desc ",
             countQuery = "select count(*) from t_test_plan_user join t_user_info on t_user_info.id = u_id\n" +
                     "where test_plan_id=?1 and if(?2 is not null and ?2 !='',(t_user_info.pet_name like CONCAT('%',?2,'%') or phone like CONCAT('%',?2,'%')),1=1)\n",
             nativeQuery = true)

+ 1 - 0
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -1097,6 +1097,7 @@ public class ServerController extends BaseController {
                 tempUserDB.setBirthday(idCardStr.substring(6,10)+"-"+idCardStr.substring(10,12)+"-"+idCardStr.substring(12,14));
                 tempUserDB.setIdCard(idCardStr);
                 tempUserDB.setCreateTime(DateUtil.now());
+                tempUserDB.setProfession(profession.toString());
                 //查看当前用户是否已经在数据库存在
                 UserEntity phoneAndInstitutionNo = userService.findPhoneAndInstitutionNoAndRoleType(tempUserDB.getPhone(), institutionNo,Constant.DEFAULT_VALUE_ONE);
                 if (phoneAndInstitutionNo != null) {

+ 1 - 1
src/main/java/com/rf/psychological/user/dao/repository/UserRepository.java

@@ -51,7 +51,7 @@ public interface UserRepository extends BaseRepository<UserEntity, String> {
      * @param institutionNo
      * @return
      */
-    @Query(value = "select id,gender,password,pet_name,phone,birthday,profession,institution_name,institution_no,user_status,g_id,model,role_type,create_time from t_user_info where institution_no = :institutionNo   and role_type ='1' and  " +
+    @Query(value = "select * from t_user_info where institution_no = :institutionNo   and role_type ='1' and  " +
             " if(:searchKey is not null and :searchKey!='',(pet_name like %:searchKey% or phone like %:searchKey% ) , 1=1) " +
             "and if(:status is not null and :status!='',(t_user_info.user_status = :status) , 1=1) limit :pageNum ,:pageSize ", nativeQuery = true)
     List<UserEntity> getUserListByInstitutionNo(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("searchKey") String searchKey, @Param("institutionNo") String institutionNo, @Param("status") String status);

+ 6 - 1
src/main/java/com/rf/psychological/user/rest/UserController.java

@@ -2,6 +2,7 @@ package com.rf.psychological.user.rest;
 
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Validator;
 import com.alibaba.fastjson.JSONObject;
 import com.rf.psychological.base.rest.BaseController;
 import com.rf.psychological.enums.UserRole;
@@ -354,13 +355,17 @@ public class UserController extends BaseController {
             UserEntity userInfo = this.userService.findPhoneAndInstitutionNoAndRoleType(userEntity.getPhone(), userEntity.getInstitutionNo(),userEntity.getRoleType());
             if (userInfo == null) {
                 String idCardStr = userEntity.getPhone();
+                if (!Validator.isCitizenId(idCardStr)){
+
+                    return fail("账号不符合身份证规则");
+
+                }
                 userEntity.setPassword(DigestUtils.md5DigestAsHex(idCardStr.substring(12).getBytes()));
                 userEntity.setUserStatus(Constant.USER_STATUS_NORMAL);
                 userEntity.setRoleType(UserRole.COMMON.getType());
                 userEntity.setBirthday(idCardStr.substring(6,10)+"-"+idCardStr.substring(10,12)+"-"+idCardStr.substring(12,14));
                 userEntity.setIdCard(idCardStr);
                 userEntity.setCreateTime(DateUtil.now());
-                userEntity.setPassword(DigestUtils.md5DigestAsHex(userEntity.getPassword().getBytes()));
                 this.userService.save(userEntity);
                 return success();
             } else {