zsf 1 год назад
Родитель
Сommit
d15fb9a643

+ 4 - 5
src/main/java/com/rf/psychological/plan/schedule/StaticScheduleTask.java

@@ -47,8 +47,7 @@ public class StaticScheduleTask {
     @Autowired
     private HisTestPlanService hisTestPlanService;
 
-    @Scheduled(initialDelay = 60000,fixedDelay = 60000)
-    @Profile({"dev","test","prod"})
+    //@Scheduled(initialDelay = 60000,fixedDelay = 60000)
     private void sendMessage (){
         log.info(new Date()+"执行静态任务----发送测试计划短信提醒");
         List<PlanMessageEntity> planMessageEntityList = this.planMessageService.findToSendMessage();
@@ -64,13 +63,13 @@ public class StaticScheduleTask {
                     List<UserEntity> userEntityList = this.userService.getUserByIds(userIdList);
                     if(userEntityList != null && userEntityList.size() > 0){
                         userEntityList.forEach(userEntity -> {
-                            if(userEntity.getModelPhone()==null && userEntity.getModelPhone().trim().length()<=0)return;
-                            if(userEntity.getModelPhone().equals(Constant.MAGIC_NUM_0)||userEntity.getModelPhone().equals(Constant.MAGIC_NUM_1)) return;
+                            if(userEntity.getModel()==null && userEntity.getModel().trim().length()<=0)return;
+                            if(userEntity.getModel().equals(Constant.MAGIC_NUM_0)||userEntity.getModel().equals(Constant.MAGIC_NUM_1)) return;
                             JSONObject jsonObject = new JSONObject();
                             jsonObject.put("userName",userEntity.getPetName());
                             jsonObject.put("beginTime",planEntity.getTestBeginTime());
                             jsonObject.put("endTime",planEntity.getTestEndTime());
-                            jsonObject.put("phone",userEntity.getModelPhone());
+                            jsonObject.put("phone",userEntity.getModel());
                             jsonArray.add(jsonObject);
                         });
                     }

+ 2 - 4
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -1064,10 +1064,8 @@ public class ServerController extends BaseController {
                 }
                 tempUserDB.setBirthday(users.get(3).toString());
                 tempUserDB.setProfession(users.get(4).toString());
-                tempUserDB.setAdditionInfo(users.get(5).toString());
                 userEntity.setBirthday(users.get(3).toString());
                 userEntity.setProfession(users.get(4).toString());
-                userEntity.setAdditionInfo(users.get(5).toString());
                 int repeatNum = userRepeatNameNumService.testOrNotNamePinyin(institutionNo, getPinyin(users.get(1).toString()));
                 if (users.size() > 6){
                     if (null == users.get(6) || users.get(6).equals("")) {
@@ -1123,10 +1121,10 @@ public class ServerController extends BaseController {
                     }
                 }
                 tempUserDB.setGId(defaultGroupId);
-                tempUserDB.setModelPhone("0");
+                tempUserDB.setModel("0");
                 tempUserDB.setRoleType(UserRole.COMMON.getType());
                 userEntity.setGId(defaultGroupId);
-                userEntity.setModelPhone("0");
+                userEntity.setModel("0");
                 userEntity.setRoleType(UserRole.COMMON.getType());
 
                 //查看当前用户是否已经在数据库存在

+ 10 - 5
src/main/java/com/rf/psychological/user/dao/model/UserEntity.java

@@ -39,8 +39,8 @@ public class UserEntity extends BaseEntity {
     @Column(name = "phone", columnDefinition = "varchar(50) not null comment '同一机构下登录账号'")
     private String phone;
 
-    @Column(name = "model_phone", columnDefinition = "varchar(11) default 0  comment '用户手机号:0->用户不填手机号 1->不在弹出手机框'")
-    private String modelPhone;
+    @Column(name = "model", columnDefinition = "varchar(11) default 0  comment '用户手机号:0->用户不填手机号 1->不在弹出手机框'")
+    private String model;
 
     @Column(name = "pet_name", columnDefinition = "varchar(10) not null comment '昵称'")
     private String petName;
@@ -48,6 +48,9 @@ public class UserEntity extends BaseEntity {
     @Column(name = "password", columnDefinition = "varchar(32) not null comment '密码'")
     private String password;
 
+    @Column(name = "id_card",columnDefinition = "varchar(50)  comment '身份证号'")
+    private String idCard;
+
     @Column(name = "gender", columnDefinition = "varchar(2) not null comment '性别(0-男;1-女)'")
     private String gender;
 
@@ -63,11 +66,9 @@ public class UserEntity extends BaseEntity {
     @Column(name = "institution_no", columnDefinition = "varchar(50) comment '所属机构编码'")
     private String institutionNo;
 
-    @Column(name = "user_status", columnDefinition = "varchar(2) comment '用户状态,1-待审核 2-审核通过 3--密码被重置需要重新登录'")
+    @Column(name = "user_status", columnDefinition = "varchar(2) comment '用户状态,1-正常 2-禁用 '")
     private String userStatus = "1";
 
-    @Column(name = "addition_info", columnDefinition = "varchar(500) comment '附加信息'")
-    private String additionInfo;
 
     @Column(name = "g_id", columnDefinition = "varchar(36) default '0' comment  '组id(未分组设为0)'")
     private String gId;
@@ -75,4 +76,8 @@ public class UserEntity extends BaseEntity {
     @Column(name = "role_type", columnDefinition = "varchar(2) default '1' comment  '角色(默认为1 1普通用户、2管理员、3机构超级管理员)'")
     private String roleType;
 
+
+    @Column(name = "extend", columnDefinition = "varchar(500) comment '附加信息'")
+    private String extend;
+
 }

+ 2 - 27
src/main/java/com/rf/psychological/user/rest/SystemController.java

@@ -87,7 +87,7 @@ public class SystemController extends BaseController {
             JSONObject jsonData = JSONObject.parseObject(data);
             JSONObject jsonUserEntity =jsonData.getJSONObject("data");
             UserEntity userEntity = jsonUserEntity.toJavaObject(UserEntity.class);
-            userEntity.setModelPhone(Constant.DEFAULT_VALUE_ZERO);
+            userEntity.setModel(Constant.DEFAULT_VALUE_ZERO);
             String institutionNo = userEntity.getInstitutionNo();
             if (StringUtils.isEmpty(institutionNo)){
                 return fail("","机构编号不能为空");
@@ -214,32 +214,7 @@ public class SystemController extends BaseController {
                 return fail("", "请先注册");
             }
             userEntity.setPassword(password);
-            //区分公网版和非公网版
-            if (Constant.WEB_INSTITUTION_CODE.equals(institutionNo)){
-                String authCode = dataParam.getString("authCode");
-                JSONObject jsonVerification = dataParam.getJSONObject("verification");
-                String jsonPhone = jsonVerification.getString("phone");
-                String jsonAuthCode = jsonVerification.getString("authCode");
-                String jsonBeginTime = jsonVerification.getString("beginTime");
-                if (StringUtils.isEmpty(jsonBeginTime ) || StringUtils.isEmpty(jsonAuthCode) ) {
-                    return fail("", "请重新获取验证码");
-                }
-                //计算时间差---分钟
-                //int diff = DateUtil.getDistanceByUnit(DateUtil.parseDate(jsonBeginTime), DateUtil.getCurrentDate(), 2);
-                long diff = DateUtil.between(DateUtil.date(), DateUtil.parse(jsonBeginTime,PURE_DATETIME_PATTERN), DateUnit.MINUTE);
-                if (diff < 0 || diff > 5) {
-                    return fail("", "验证码已失效");
-                }
-                if (jsonAuthCode.equals(authCode) && jsonPhone.equals(phone)) {
-                   // this.userService.updatePassword(phone, password, institutionNo,roleType);
-                    this.userService.save(userEntity);
-                } else {
-                    return fail("", "验证码错误");
-                }
-            }else {
-                this.userService.save(userEntity);
-               // this.userService.updatePassword(phone, password, institutionNo,roleType);
-            }
+            this.userService.save(userEntity);
             return success();
         }catch (Exception e){
             e.printStackTrace();

+ 3 - 315
src/main/java/com/rf/psychological/user/rest/UserController.java

@@ -109,7 +109,7 @@ public class UserController extends BaseController {
             resultJson.put("userId", userEntity.getId());
             resultJson.put("petName", userEntity.getPetName());
             resultJson.put("phone", userEntity.getPhone());
-            resultJson.put("modelPhone", userEntity.getModelPhone());
+            resultJson.put("model", userEntity.getModel());
             resultJson.put("institutionNo", userEntity.getInstitutionNo());
             resultJson.put("gId", userEntity.getGId());
             resultJson.put("gender", userEntity.getGender());
@@ -138,316 +138,6 @@ public class UserController extends BaseController {
 
     }
 
-    //----------------------------公网版接口begin--------------------------------------------------------------------------------
-
-    @SafetyProcess
-    @GetMapping("/authCode")
-    @ApiOperation(value = "向手机发送验证码")
-    public Result authCode(String phone) {
-        if (StringUtils.isEmpty(phone)) {
-            return failBadRequest();
-        } else {
-            SendMessageUtil sendMessageUtil = new SendMessageUtil();
-            String authCode = sendMessageUtil.sendMessage(phone);
-            String beginTime = DateUtil.getNowTime(DateUtil.DEFAULT_FILE_DATE);
-            // 创建返回的json对象
-            JSONObject resultJson = new JSONObject(true);
-            resultJson.put("beginTime", beginTime);
-            resultJson.put("authCode", authCode);
-            resultJson.put("phone", phone);
-            return success(resultJson);
-        }
-    }
-
-    /**
-     * 公网版注册用户
-     *
-     * @param json
-     * @return
-     */
-    @SafetyProcess
-    @PostMapping("/saveUser1")
-    @Deprecated
-    @ApiOperation("公网版注册用户")
-    public Result saveUserInfo(@RequestBody String json) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonData = JSONObject.parseObject(data);
-        String authCode = jsonData.getString("authCode");
-        JSONObject jsonVerification = jsonData.getJSONObject("verification");
-        String jsonPhone = jsonVerification.getString("phone");
-        String jsonAuthCode = jsonVerification.getString("authCode");
-        String jsonBeginTime = jsonVerification.getString("beginTime");
-        JSONObject jsonUserEntity = jsonData.getJSONObject("data");
-        UserEntity userEntity = jsonUserEntity.toJavaObject(UserEntity.class);
-        userEntity.setInstitutionNo(Constant.WEB_INSTITUTION_CODE);
-        userEntity.setInstitutionName(Constant.WEB_INSTITUTION_NAME);
-        userEntity.setGId("0");
-        userEntity.setModelPhone("0");
-        userEntity.setUserStatus(UserStatus.PASS.getType());
-        System.out.println(userEntity);
-        if (StringUtils.isEmpty(authCode)  || StringUtils.isEmpty( userEntity.getPhone() ) || StringUtils.isEmpty( userEntity.getPassword())
-                || StringUtils.isEmpty( userEntity.getGender() ) || StringUtils.isEmpty(userEntity.getPetName())
-                || StringUtils.isEmpty( userEntity.getBirthday())) {
-            return fail("", "请按要求填写所需信息");
-        }
-        if (StringUtils.isEmpty(jsonBeginTime)  || StringUtils.isEmpty(jsonAuthCode) ) {
-            return fail("", "请重新获取验证码");
-        }
-        //计算时间差---分钟
-        int diff = DateUtil.getDistanceByUnit(DateUtil.parseDate(jsonBeginTime), DateUtil.getCurrentDate(), 2);
-        if (diff < 0 || diff > 5) {
-            return fail("", "验证码已失效");
-        }
-        if (jsonAuthCode.equals(authCode) && jsonPhone.equals(userEntity.getPhone())) {
-            UserEntity userInfo = this.userService.findPhone(userEntity.getPhone());
-            if (userInfo == null) {
-                this.userService.save(userEntity);
-                return success();
-            } else {
-                return fail("", "账号已注册");
-            }
-        } else {
-            return fail("", "验证码错误");
-        }
-
-    }
-
-    @SafetyProcess
-    @PostMapping("/webLogin1")
-    @Deprecated
-    @ApiOperation(value = "公网版用户登录")
-    public Result webUserLogin(@RequestBody String json) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonObject = JSONObject.parseObject(data);
-        if (!jsonObject.containsKey("phone") || !jsonObject.containsKey("password")) {
-            return fail("", "手机号或密码不能为空");
-        }
-        String password = jsonObject.getString("password");
-        String phone =  jsonObject.getString("phone");
-        if (StringUtils.isEmpty(password) || StringUtils.isEmpty(phone)) {
-            return fail("", "手机号或密码不能为空");
-        }
-        UserEntity userEntity = this.userService.findPhone(phone);
-        if (userEntity != null && userEntity.getPassword().equals(password)) {
-            //生成token
-            HashMap<String, String> payload = new HashMap<>();
-            payload.put("userPhone", userEntity.getPhone());
-            payload.put("userId", userEntity.getId());
-            payload.put("petName", userEntity.getPetName());
-            payload.put("groupId", userEntity.getGId());
-            payload.put("institutionNo", userEntity.getInstitutionNo());
-            payload.put("type", userEntity.getRoleType());
-            String token = JWTUtil.getToken(payload);
-            // 创建返回的json对象
-            JSONObject resultJson = new JSONObject();
-            resultJson.put("userId", userEntity.getId());
-            resultJson.put("petName", userEntity.getPetName());
-            resultJson.put("phone", userEntity.getPhone());
-            resultJson.put("institutionNo", userEntity.getInstitutionNo());
-            resultJson.put("gId", userEntity.getGId());
-            resultJson.put("gender", userEntity.getGender());
-            resultJson.put("birthday", userEntity.getBirthday());
-            resultJson.put("profession", userEntity.getProfession());
-            resultJson.put("modelPhone", userEntity.getModelPhone());
-            resultJson.put("type", userEntity.getRoleType());
-            resultJson.put("token", token);
-            return success(resultJson);
-        } else {
-            return fail("", "手机号或密码错误");
-        }
-    }
-
-    /**
-     * 公网版忘记密码后修改密码
-     *
-     * @param
-     * @return
-     */
-    @SafetyProcess
-    @PostMapping("/webUpdatePassword1")
-    @Deprecated
-    @ApiOperation("公网版忘记密码后修改密码 --->forgotPassword")
-    public Result webUpdatePassword(@RequestBody String json) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonData = JSONObject.parseObject(data);
-        String phone = jsonData.getString("phone");
-        String password = jsonData.getString("password");
-        String authCode = jsonData.getString("authCode");
-        JSONObject jsonVerification = jsonData.getJSONObject("verification");
-        String jsonPhone = jsonVerification.getString("phone");
-        String jsonAuthCode = jsonVerification.getString("authCode");
-        String jsonBeginTime = jsonVerification.getString("beginTime");
-        if (authCode == null || phone == null || password == null) {
-            return fail("", "请按要求填写所需信息");
-        }
-        UserEntity userEntity = this.userService.findPhone(phone);
-        if (userEntity == null) {
-            return fail("", "请先注册");
-        }
-        if (StringUtils.isEmpty(jsonBeginTime ) || StringUtils.isEmpty(jsonAuthCode) ) {
-            return fail("", "请重新获取验证码");
-        }
-        //计算时间差---分钟
-        int diff = DateUtil.getDistanceByUnit(DateUtil.parseDate(jsonBeginTime), DateUtil.getCurrentDate(), 2);
-        if (diff < 0 || diff > 5) {
-            return fail("", "验证码已失效");
-        }
-        if (jsonAuthCode.equals(authCode) && jsonPhone.equals(phone)) {
-            //this.userService.updatePassword(phone, password, "10009");
-            return success();
-        } else {
-            return fail("", "验证码错误");
-        }
-
-    }
-
-
-    //----------------------------公网版接口end--------------------------------------------------------------------------------
-
-    //----------------------------局域网版接口begin--------------------------------------------------------------------------------
-
-    /**
-     * 局域网注册用户
-     *
-     * @param json
-     * @return
-     */
-    @SafetyProcess
-    @Deprecated
-    @PostMapping("/LANSaveUserInfo1")
-    @ApiOperation("局域网注册用户")
-    public Result LANSaveUserInfo(@RequestBody String json) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonData = JSONObject.parseObject(data);
-        JSONObject jsonUserEntity = jsonData.getJSONObject("data");
-        UserEntity userEntity = jsonUserEntity.toJavaObject(UserEntity.class);
-        userEntity.setInstitutionNo(Constant.LAN_INSTITUTION_CODE);
-        userEntity.setInstitutionName(Constant.LAN_INSTITUTION_NAME);
-        userEntity.setGId("0");
-        userEntity.setModelPhone("0");
-        userEntity.setUserStatus(UserStatus.PASS.getType());
-        if (StringUtils.isEmpty(userEntity.getPhone())  || StringUtils.isEmpty( userEntity.getPassword())
-                || StringUtils.isEmpty( userEntity.getGender())  || StringUtils.isEmpty( userEntity.getPetName())
-                || StringUtils.isEmpty( userEntity.getBirthday()) ) {
-            return fail("", "请按要求填写所需信息");
-        }
-        UserEntity userInfo = this.userService.findPhone(userEntity.getPhone());
-        if (userInfo == null) {
-            this.userService.save(userEntity);
-            return success(userEntity);
-        } else {
-            return fail("", "手机号已注册");
-        }
-    }
-
-    @SafetyProcess
-    @PostMapping("/LANLogin1")
-    @Deprecated
-    @ApiOperation(value = "局域网用户登录")
-    public Result LANLogin(@RequestBody String json, @ApiIgnore HttpSession session) throws Exception {
-
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonObject = JSONObject.parseObject(data);
-        if (!jsonObject.containsKey("phone") || !jsonObject.containsKey("password") || !jsonObject.containsKey("type")) {
-            return fail("", "账号或密码或用户类型不能为空");
-        }
-
-        String password = (String) jsonObject.get("password");
-        String phone = (String) jsonObject.get("phone");
-        //type = 1 是普通用户;type = 2 是超级管理员
-        String type = (String) jsonObject.get("type");
-        if (password.equals("") || phone.equals("") || type.equals("")) {
-            return fail("", "账号或密码或用户类型不能为空");
-        }
-
-        if (type.equals("1")) {
-            UserEntity userEntity = this.userService.findPhone(phone);
-            if (userEntity != null && userEntity.getPassword().equals(password)) {
-                //生成token
-                HashMap<String, String> payload = new HashMap<>();
-                payload.put("userPhone", userEntity.getPhone());
-                payload.put("userId", userEntity.getId());
-                payload.put("petName", userEntity.getPetName());
-                payload.put("groupId", userEntity.getGId());
-                payload.put("institutionNo", userEntity.getInstitutionNo());
-                payload.put("type", "user");
-                String token = JWTUtil.getToken(payload);
-                // 创建返回的json对象
-                JSONObject resultJson = new JSONObject();
-                resultJson.put("userId", userEntity.getId());
-                resultJson.put("petName", userEntity.getPetName());
-                resultJson.put("phone", userEntity.getPhone());
-                resultJson.put("institutionNo", userEntity.getInstitutionNo());
-                resultJson.put("gId", userEntity.getGId());
-                resultJson.put("gender", userEntity.getGender());
-                resultJson.put("birthday", userEntity.getBirthday());
-                resultJson.put("profession", userEntity.getProfession());
-                resultJson.put("modelPhone", userEntity.getModelPhone());
-                resultJson.put("type", "user");
-                resultJson.put("token", token);
-                return success(resultJson);
-            } else {
-                return fail("", "账号或密码错误");
-            }
-        } else {
-            UserEntity byInstitutionNoAndLoginName = this.userService.findPhoneAndInstitutionNo( phone,"10010");
-            if (byInstitutionNoAndLoginName != null) {
-                //生成token
-                HashMap<String, String> payload = new HashMap<>();
-                payload.put("userPhone", byInstitutionNoAndLoginName.getPhone());
-                payload.put("userId", byInstitutionNoAndLoginName.getId());
-                payload.put("petName", byInstitutionNoAndLoginName.getInstitutionName());
-                payload.put("institutionNo", byInstitutionNoAndLoginName.getInstitutionNo());
-                payload.put("type", "superAdmin");
-                String token = JWTUtil.getToken(payload);
-                // 创建返回的json对象
-                JSONObject resultJson = new JSONObject();
-                resultJson.put("InstitutionEntity", byInstitutionNoAndLoginName);
-                resultJson.put("type", "superAdmin");
-                if (byInstitutionNoAndLoginName.getPassword().equals(password)) {
-                    resultJson.put("token", token);
-                    return success(resultJson);
-                } else {
-                    return fail(resultJson, "账号或密码错误");
-                }
-            } else {
-                return fail("", "账号错误");
-            }
-        }
-    }
-
-
-    /**
-     * 修改密码
-     *
-     * @param
-     * @return
-     */
-    @SafetyProcess
-    @Deprecated
-    @PostMapping("/LANUpdatePassword1")
-    @ApiOperation("修改密码--->forgotPassword")
-    public Result LANUpdatePassword(@RequestBody String json) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonData = JSONObject.parseObject(data);
-        String phone = jsonData.getString("phone");
-        String password = jsonData.getString("password");
-        if (phone == null || password == null) {
-            return fail("", "请按要求填写所需信息");
-        }
-        UserEntity userEntity = this.userService.findPhone(phone);
-        if (userEntity == null) {
-            return fail("", "请先注册");
-        } else {
-            //this.userService.updatePassword(phone, password, "10010");
-            return success();
-        }
-
-    }
-
-
-    //----------------------------局域网版接口end--------------------------------------------------------------------------------
-
     /**
      * 修改密码
      *
@@ -504,9 +194,7 @@ public class UserController extends BaseController {
         if (userEntity == null) {
             return fail("", "请先注册");
         } else {
-            //this.userService.updatePassword(phone, DigestUtils.md5DigestAsHex(Constant.DEFAULT_PASSWORD.getBytes(StandardCharsets.UTF_8)), institutionNo);
             userEntity.setPassword(DigestUtils.md5DigestAsHex(Constant.DEFAULT_PASSWORD.getBytes(StandardCharsets.UTF_8)));
-            //userEntity.setUserStatus(UserStatus.UPDATE.getType());
             userService.save(userEntity);
 
             return success();
@@ -602,7 +290,7 @@ public class UserController extends BaseController {
         UserEntity userEntity = jsonUserEntity.toJavaObject(UserEntity.class);
         System.out.println(userEntity);
         userEntity.setGId("0");
-        userEntity.setModelPhone("0");
+        userEntity.setModel("0");
         //判断机构编号是否存在
         InstitutionEntity institutionEntity = this.institutionService.findByInstitutionNo(userEntity.getInstitutionNo());
         if (institutionEntity == null) {
@@ -720,7 +408,7 @@ public class UserController extends BaseController {
         if (userEntity == null){
             return fail("用户不存在");
         }
-        userEntity.setModelPhone(newModelPhone);
+        userEntity.setModel(newModelPhone);
         userEntity.setPetName(petName);
         userEntity.setGender(gender);
         userEntity.setBirthday(birthday);

+ 1 - 1
src/main/java/com/rf/psychological/user/service/impl/UserServiceImpl.java

@@ -194,7 +194,7 @@ public class UserServiceImpl implements UserService {
         if (userEntity == null){
             return null;
         }
-        userEntity.setModelPhone(newModelPhone);
+        userEntity.setModel(newModelPhone);
         userEntity.setPetName(petName);
         userEntity.setGender(gender);
         userEntity.setBirthday(birthday);