Browse Source

用户批量导出

zsf 1 year ago
parent
commit
71dd735e00

+ 73 - 109
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -11,13 +11,11 @@ import com.rf.psychological.dao.model.AnswerEntity;
 import com.rf.psychological.dao.model.CategorySubjectEntity;
 import com.rf.psychological.dao.model.CognitiveTaskEntity;
 import com.rf.psychological.enums.UserRole;
-import com.rf.psychological.file.excel.ExcelClass;
-import com.rf.psychological.group.dao.model.GroupAuthEntity;
-import com.rf.psychological.group.dao.model.GroupEntity;
 import com.rf.psychological.group.service.GroupAuthService;
 import com.rf.psychological.group.service.GroupInfoService;
-import com.rf.psychological.institution.model.InstitutionAuthEntity;
+import com.rf.psychological.institution.model.InstitutionEntity;
 import com.rf.psychological.institution.service.InstitutionAuthService;
+import com.rf.psychological.institution.service.InstitutionService;
 import com.rf.psychological.plan.service.TestPlanContendService;
 import com.rf.psychological.scale.dao.model.ScaleEntity;
 import com.rf.psychological.scale.dao.model.ScaleMarksEntity;
@@ -27,7 +25,6 @@ import com.rf.psychological.scale.service.*;
 import com.rf.psychological.security.SafetyProcess;
 import com.rf.psychological.socket.MyClient;
 import com.rf.psychological.user.dao.model.UserEntity;
-import com.rf.psychological.user.service.UserRepeatNameNumService;
 import com.rf.psychological.user.service.UserService;
 import com.rf.psychological.utils.*;
 import io.swagger.annotations.Api;
@@ -39,11 +36,11 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
 import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
 import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
 import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.domain.Page;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.DigestUtils;
@@ -96,9 +93,6 @@ public class ServerController extends BaseController {
     @Autowired
     private InstitutionAuthService institutionAuthService;
 
-    @Autowired
-    private UserRepeatNameNumService userRepeatNameNumService;
-
     @Autowired
     private CategorySubjectService categorySubjectService;
 
@@ -114,6 +108,9 @@ public class ServerController extends BaseController {
     @Autowired
     private GroupInfoService groupInfoService;
 
+    @Autowired
+    private InstitutionService institutionService;
+
     @SafetyProcess
     @GetMapping("server")
     public Result scanServer() {
@@ -1029,130 +1026,97 @@ public class ServerController extends BaseController {
         if (institutionNo == null) {
             return fail("机构编号为空");
         }
-        //String message = "提交成功";
-        String filePath = "";//用户信息上传之后生成的用户名密码文件保存路径
         String fileName = file.getOriginalFilename();
         List<List<Object>> datas = ExcelUtil.getBankListByExcelForUserImport(file.getInputStream(), fileName);
-        //插入数据库信息
-        List<UserEntity> userListDB = new ArrayList<>();
-        //生成导入后用户信息
-        List<UserEntity> userLists = new ArrayList<>();
+        if(CollectionUtils.isEmpty(datas)){
+            return fail("内容为空");
+        }
 
         StringBuilder result = new StringBuilder();
-        result.append("账号:");
         //判断是否有已经存在数据库的
         boolean isExist = false;
-        //UserEntity tempUserDB;
-        String defaultGroupId = null;
         try {
+            int y = 0;
             for (int i = 0; i < datas.size(); i++) {
                 List<Object> users = datas.get(i);
-                //北京师范大学亚太实验学校, 陈亚浩2, 男, 2001-10-01, 学生, , 六年级一班, null, null
-                //插入数据库的信息
-                UserEntity tempUserDB = new UserEntity();
-                //导入成功用户信息
-                UserEntity userEntity = new UserEntity();
-                tempUserDB.setInstitutionName(users.get(0).toString());
-                tempUserDB.setPetName(users.get(1).toString());
-                userEntity.setInstitutionName(users.get(0).toString());
-                userEntity.setPetName(users.get(1).toString());
-                userEntity.setGender(users.get(2).toString());
-                if ("男".equals(users.get(2).toString())) {
-                    tempUserDB.setGender("0");
-                } else {
-                    tempUserDB.setGender("1");
+                if (users.size()<7) {
+                    y = i + 1;
+                    result.append("第" + y +"条数据信息不完整").append("\r\n");
+                    isExist = true;
+                    continue;
                 }
-                tempUserDB.setBirthday(users.get(3).toString());
-                tempUserDB.setProfession(users.get(4).toString());
-                userEntity.setBirthday(users.get(3).toString());
-                userEntity.setProfession(users.get(4).toString());
-                int repeatNum = userRepeatNameNumService.testOrNotNamePinyin(institutionNo, getPinyin(users.get(1).toString()));
-                if (users.size() > 6){
-                    if (null == users.get(6) || users.get(6).equals("")) {
-                        tempUserDB.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
-                        userEntity.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
-                    }else {
-                        tempUserDB.setPhone(users.get(6).toString());
-                        userEntity.setPhone(users.get(6).toString());
-                    }
-                }else {
-                    tempUserDB.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
-                    userEntity.setPhone(repeatNum == 0 ? getPinyin(users.get(1).toString()) : getPinyin(users.get(1).toString()) + repeatNum);
+                Object petName = users.get(0);
+                Object phone = users.get(1);
+                Object password = users.get(2);
+                Object gender = users.get(3);
+                Object idCard = users.get(4);
+                Object mobile = users.get(5);
+                Object orgNum = users.get(6);
+                if (petName == null || petName == "" ||
+                        phone == null || phone == "" ||
+                        password == null || password == "" ||
+                        gender == null || gender == "" ||
+                        idCard == null || idCard == "" ||
+                        mobile == null || mobile == "" ||
+                        orgNum == null || orgNum == "") {
+                    y = i + 1;
+                    result.append("第" + y +"条数据信息不完整").append("\r\n");
+                    isExist = true;
+                    continue;
                 }
-                 if (users.size() > 7){
-                     if (null == users.get(7) || users.get(7).equals("")) {
-                         tempUserDB.setPassword(DigestUtils.md5DigestAsHex(Constant.DEFAULT_PASSWORD.getBytes(StandardCharsets.UTF_8)));
-                         userEntity.setPassword(Constant.DEFAULT_PASSWORD);
-                     } else {
-                         tempUserDB.setPassword(DigestUtils.md5DigestAsHex(users.get(7).toString().getBytes(StandardCharsets.UTF_8)));
-                         userEntity.setPassword(users.get(7).toString());
-                     }
-                 }else {
-                     tempUserDB.setPassword(DigestUtils.md5DigestAsHex(Constant.DEFAULT_PASSWORD.getBytes(StandardCharsets.UTF_8)));
-                     userEntity.setPassword(Constant.DEFAULT_PASSWORD);
-                 }
-
-//                tempUserDB.setPhone(getPinyin(users.get(1).toString()));
-                tempUserDB.setInstitutionNo(institutionNo);
-                tempUserDB.setUserStatus("2");
-                userEntity.setInstitutionNo(institutionNo);
-                userEntity.setUserStatus("2");
-                //设置组id,未分组时组id为0
-                if (defaultGroupId == null) {
-                    GroupEntity groupByInstitutionNoAndName = this.groupInfoService.findGroupByInstitutionNoAndName(tempUserDB.getInstitutionNo(), Constant.DEFAULT_GROUP_NAME);
-                    if (groupByInstitutionNoAndName == null) {
-                        GroupEntity groupEntity = new GroupEntity();
-                        groupEntity.setGroupName(Constant.DEFAULT_GROUP_NAME);
-                        groupEntity.setInstitutionNo(tempUserDB.getInstitutionNo());
-                        groupEntity = this.groupInfoService.addGroup(groupEntity);
-                        //创建权限
-                        List<InstitutionAuthEntity> institutionAuthEntityList = this.institutionAuthService.getByInstitutionNo(tempUserDB.getInstitutionNo());
-                        for (int mi = 0; mi < institutionAuthEntityList.size(); mi++) {
-                            InstitutionAuthEntity institutionAuthEntity = new InstitutionAuthEntity();
-                            GroupAuthEntity groupAuthEntity = new GroupAuthEntity();
-                            groupAuthEntity.setBId(institutionAuthEntity.getBId());
-                            groupAuthEntity.setGroupId(groupEntity.getId());
-                            groupAuthEntity.setType(institutionAuthEntity.getType());
-                            this.groupAuthService.addGroupAuth(groupAuthEntity);
-                        }
-                        defaultGroupId = groupEntity.getId();
-                    } else {
-                        defaultGroupId = groupByInstitutionNoAndName.getId();
-                    }
+                if (petName.toString().length() > 18 || petName.toString().contains(" ")){
+                    y = i + 1;
+                    result.append("第" + y +"条数据姓名长度大于18位或有空格").append("\r\n");
+                    isExist = true;
+                    continue;
+                }
+                if (phone.toString().length() > 18 || phone.toString().length() < 3 || phone.toString().contains(" ")){
+                    y = i + 1;
+                    result.append("第" + y +"条数据账号长度未在3~18位之间或有空格").append("\r\n");
+                    isExist = true;
+                    continue;
                 }
-                tempUserDB.setGId(defaultGroupId);
-                tempUserDB.setModel("0");
+                if (password.toString().length() < 6 || password.toString().length() > 18 || password.toString().contains(" ")){
+                    y = i + 1;
+                    result.append("第" + y +"条数据密码长度未在6~18位之间或有空格").append("\r\n");
+                    isExist = true;
+                    continue;
+                }
+                //插入数据库的信息
+                UserEntity tempUserDB = new UserEntity();
+                //设置组id,未分组时组id为0
+                InstitutionEntity institutionEntity = this.institutionService.findByInstitutionNo(institutionNo);
+                tempUserDB.setInstitutionName(institutionEntity.getInstitutionName());
+                //姓名、账号、密码格式未效验
+                tempUserDB.setPetName(petName.toString());
+                tempUserDB.setPhone(phone.toString());
+                tempUserDB.setPassword(DigestUtils.md5DigestAsHex(password.toString().getBytes(StandardCharsets.UTF_8)));
+                tempUserDB.setGender(gender.toString());
+                tempUserDB.setInstitutionNo(institutionNo);
+                tempUserDB.setUserStatus(Constant.USER_STATUS_NORMAL);
+                tempUserDB.setGId(orgNum.toString());
+                tempUserDB.setModel(mobile.toString());
                 tempUserDB.setRoleType(UserRole.COMMON.getType());
-                userEntity.setGId(defaultGroupId);
-                userEntity.setModel("0");
-                userEntity.setRoleType(UserRole.COMMON.getType());
-
+                String idCardStr = idCard.toString();
+                tempUserDB.setBirthday(idCardStr.substring(6,10)+"-"+idCardStr.substring(10,12)+"-"+idCardStr.substring(12,14));
+                tempUserDB.setIdCard(idCardStr);
                 //查看当前用户是否已经在数据库存在
-                UserEntity phoneAndInstitutionNo = userService.findPhoneAndInstitutionNo(tempUserDB.getPhone(), institutionNo);
+                UserEntity phoneAndInstitutionNo = userService.findPhoneAndInstitutionNoAndRoleType(tempUserDB.getPhone(), institutionNo,Constant.DEFAULT_VALUE_ONE);
                 if (phoneAndInstitutionNo != null) {
-                    result.append(phoneAndInstitutionNo.getPhone()).append(" ");
+                    y = i + 1;
+                    result.append("第" + y +"条数据账号" + phoneAndInstitutionNo.getPhone() + "已存在").append("\r\n");
                     isExist = true;
                     continue;
                 }
                 this.userService.save(tempUserDB);
-                userListDB.add(tempUserDB);
-                userLists.add(userEntity);
-
-            }
-            if (OSUtil.isLinux()) {
-                filePath = "./userImport/" + institutionNo + "/" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "/";
-            } else {
-                filePath = "./userImport/" + institutionNo + "/" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "/";
             }
-            ExcelUtil.createExcelFileForPublic(UserEntity.class, userLists, null, new ExcelClass().userExportExcel(), fileName, filePath);
             if (isExist) {
-                result.append("已存在,跳过该账号。(请检查账号信息)");
-                return success(filePath + fileName, result.toString());
+                result.append(",跳过该信息。(请检查该信息)");
+                return success("", result.toString());
             } else {
-                return success(filePath + fileName, "批量导入成功");
+                return success("", "批量导入成功");
             }
         } catch (Exception exception) {
-
             exception.printStackTrace();
             return fail("导入失败,请联系管理员");
         }

+ 0 - 35
src/main/java/com/rf/psychological/user/dao/model/UserRepeatNameNumEntity.java

@@ -1,35 +0,0 @@
-package com.rf.psychological.user.dao.model;
-
-import com.rf.psychological.base.model.BaseEntity;
-import lombok.*;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午3:21
- */
-
-@EqualsAndHashCode(callSuper = true)
-@Entity
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@Table(name = "t_repeat_username")
-@org.hibernate.annotations.Table(appliesTo = "t_repeat_username", comment = "机构下姓名拼音重复表")
-public class UserRepeatNameNumEntity extends BaseEntity {
-
-    @Column(name = "name_pinyin", columnDefinition = "varchar(40) not null comment '姓名拼音'")
-    private String namePinyin;
-
-    @Column(name = "institution_no", columnDefinition = "varchar(50) comment '所属机构编码'")
-    private String institutionNo;
-
-    @Column(name = "num", columnDefinition = "int(11)  default 1 comment '拼音重复次数'")
-    private int num;
-
-
-}

+ 0 - 28
src/main/java/com/rf/psychological/user/dao/repository/UserRepeatNameNumRepository.java

@@ -1,28 +0,0 @@
-package com.rf.psychological.user.dao.repository;
-
-import com.rf.psychological.base.repository.BaseRepository;
-import com.rf.psychological.user.dao.model.UserRepeatNameNumEntity;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午4:35
- */
-public interface UserRepeatNameNumRepository extends BaseRepository<UserRepeatNameNumEntity, String> {
-
-    List<UserRepeatNameNumEntity> findAllByInstitutionNo(String institutionNo);
-
-    UserRepeatNameNumEntity findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(String namePinyin, String institutionNo);
-
-    @Transactional
-    @Modifying(clearAutomatically = true)
-    @Query(value = "update t_repeat_username set num = ?3 where name_pinyin=?1 and institution_no=?2", nativeQuery = true)
-    int updateNum(String namePinyin, String institutionNo, int num);
-
-
-}

+ 4 - 137
src/main/java/com/rf/psychological/user/rest/UserController.java

@@ -2,17 +2,10 @@ package com.rf.psychological.user.rest;
 
 import com.alibaba.fastjson.JSONObject;
 import com.rf.psychological.base.rest.BaseController;
-import com.rf.psychological.group.dao.dto.GroupAuthSubjectNameDto;
 import com.rf.psychological.enums.UserStatus;
-import com.rf.psychological.group.rest.GroupInfoController;
-import com.rf.psychological.group.dao.model.GroupAuthEntity;
 import com.rf.psychological.group.dao.model.GroupEntity;
-import com.rf.psychological.group.service.GroupAuthService;
+import com.rf.psychological.group.rest.GroupInfoController;
 import com.rf.psychological.group.service.GroupInfoService;
-import com.rf.psychological.institution.model.InstitutionAuthEntity;
-import com.rf.psychological.institution.model.InstitutionEntity;
-import com.rf.psychological.institution.service.InstitutionAuthService;
-import com.rf.psychological.institution.service.InstitutionService;
 import com.rf.psychological.opLog.annotation.OperationLogAnnotation;
 import com.rf.psychological.plan.service.PlanGroupService;
 import com.rf.psychological.plan.service.TestPlanUserService;
@@ -20,16 +13,16 @@ import com.rf.psychological.security.AesEncryptUtils;
 import com.rf.psychological.security.SafetyProcess;
 import com.rf.psychological.user.dao.model.UserEntity;
 import com.rf.psychological.user.service.UserService;
-import com.rf.psychological.utils.*;
+import com.rf.psychological.utils.Constant;
+import com.rf.psychological.utils.JWTUtil;
+import com.rf.psychological.utils.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
 import org.springframework.util.DigestUtils;
 import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
 
 import javax.servlet.http.HttpSession;
 import java.nio.charset.StandardCharsets;
@@ -51,17 +44,8 @@ public class UserController extends BaseController {
     @Autowired
     private UserService userService;
 
-    @Autowired
-    private InstitutionService institutionService;
-
-    @Autowired
-    private InstitutionAuthService institutionAuthService;
-
     @Autowired
     private GroupInfoService groupInfoService;
-    @Autowired
-    private GroupAuthService groupAuthService;
-
 
     @Autowired
     private PlanGroupService planGroupService;
@@ -69,74 +53,6 @@ public class UserController extends BaseController {
     @Autowired
     private TestPlanUserService planUserService;
 
-    /**
-     * 用户登录
-     *
-     * @param json
-     * @return
-     * @throws Exception
-     */
-    @SafetyProcess
-    @PostMapping("/login1")
-    @Deprecated
-    @OperationLogAnnotation
-    @ApiOperation(value = "用户登录")
-    public Result UserLogin(@RequestBody String json, 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("institutionNo")) {
-            return fail("", "账号或密码或所属机构不能为空");
-        }
-        String password = (String) jsonObject.get("password");
-        String phone = (String) jsonObject.get("phone");
-        String institutionNo = (String) jsonObject.get("institutionNo");
-        if (password.equals("") || phone.equals("")) {
-            return fail("", "账号或密码不能为空");
-        }
-        UserEntity userEntity = this.userService.findPhoneAndInstitutionNo(phone, institutionNo);
-        if (userEntity != null) {
-            //生成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("model", userEntity.getModel());
-            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("type", userEntity.getRoleType());
-            String userStatus = userEntity.getUserStatus();
-            if ( UserStatus.PASS.getType().equals(userStatus) || UserStatus.UPDATE.getType().equals(userStatus)) {
-                if (userEntity.getPassword().equals(password)) {
-                    //当用户状态变为重置密码状态时,再重新登录后变为正常使用状态
-                    if (UserStatus.UPDATE.getType().equals(userStatus)) {
-                        userService.updateUserStatus(UserStatus.PASS.getType(), userEntity.getId());
-                    }
-                    resultJson.put("token", token);
-                    session.setAttribute("user", userEntity);
-                    return success(resultJson);
-                } else {
-                    return fail(resultJson, "账号或密码错误");
-                }
-            } else {
-                return fail(resultJson, "用户未审核,请联系管理员");
-            }
-        } else {
-            return fail("", "机构编号或账号错误");
-        }
-
-    }
 
     /**
      * 修改密码
@@ -280,55 +196,6 @@ public class UserController extends BaseController {
     }
 
 
-    @SafetyProcess
-    @Deprecated
-    @PostMapping("/saveUserV21")
-    @ApiOperation("注册用户V2")
-    public Result nerVersionUserSave(@RequestBody String json) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonUserEntity = JSONObject.parseObject(data).getJSONObject("data");
-        UserEntity userEntity = jsonUserEntity.toJavaObject(UserEntity.class);
-        System.out.println(userEntity);
-        userEntity.setGId("0");
-        userEntity.setModel("0");
-        //判断机构编号是否存在
-        InstitutionEntity institutionEntity = this.institutionService.findByInstitutionNo(userEntity.getInstitutionNo());
-        if (institutionEntity == null) {
-            return fail("", "机构编号不存在!");
-        }
-        //默认分组
-        GroupEntity entity = this.groupInfoService.findGroupByInstitutionNoAndName(userEntity.getInstitutionNo(), Constant.DEFAULT_GROUP_NAME);
-        if (entity == null) {
-            //create group
-            entity = new GroupEntity();
-            entity.setGroupName(Constant.DEFAULT_GROUP_NAME);
-            entity.setInstitutionNo(userEntity.getInstitutionNo());
-            entity = this.groupInfoService.addGroup(entity);
-
-        }
-        userEntity.setGId(entity.getId());
-        //创建权限
-        //查看默认分组下是否已经分配权限
-        Page<GroupAuthSubjectNameDto> groupAuth = this.groupAuthService.findGroupAuth(entity.getId(), 1, 10, "");
-        if (groupAuth.getTotalElements() == 0) {
-            List<InstitutionAuthEntity> institutionAuthEntityList = this.institutionAuthService.getByInstitutionNo(userEntity.getInstitutionNo());
-            institutionAuthEntityList.forEach(institutionAuthEntity -> {
-                GroupAuthEntity groupAuthEntity = new GroupAuthEntity();
-                groupAuthEntity.setBId(institutionAuthEntity.getBId());
-                groupAuthEntity.setGroupId(userEntity.getGId());
-                groupAuthEntity.setType(institutionAuthEntity.getType());
-                this.groupAuthService.addGroupAuth(groupAuthEntity);
-            });
-        }
-        UserEntity userInfo = this.userService.findPhoneAndInstitutionNo(userEntity.getPhone(), userEntity.getInstitutionNo());
-        if (userInfo == null) {
-            this.userService.save(userEntity);
-            return success();
-        } else {
-            return fail("", "账号已注册");
-        }
-    }
-
     @SafetyProcess
     @PostMapping("/delete/{userId}")
     @OperationLogAnnotation

+ 0 - 30
src/main/java/com/rf/psychological/user/service/UserRepeatNameNumService.java

@@ -1,30 +0,0 @@
-package com.rf.psychological.user.service;
-
-import com.rf.psychological.user.dao.model.UserRepeatNameNumEntity;
-
-import java.util.List;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午7:20
- */
-public interface UserRepeatNameNumService {
-
-    List<UserRepeatNameNumEntity> findAllByInstitutionNo(String institutionNo);
-
-    UserRepeatNameNumEntity findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(String namePinyin, String institutionNo);
-
-    int updateNum(String namePinyin, String institutionNo, int num);
-
-    UserRepeatNameNumEntity save(UserRepeatNameNumEntity userRepeatNameNumEntity);
-
-    /**
-     * 检查同机构下存在同拼音的人的人数
-     * @param institutionNo
-     * @param namePinyin
-     * @return 同拼音的人的人数
-     */
-    int testOrNotNamePinyin(String institutionNo, String namePinyin);
-
-}

+ 0 - 53
src/main/java/com/rf/psychological/user/service/impl/UserRepeatNameNumServiceImpl.java

@@ -1,53 +0,0 @@
-package com.rf.psychological.user.service.impl;
-
-import com.rf.psychological.user.dao.model.UserRepeatNameNumEntity;
-import com.rf.psychological.user.dao.repository.UserRepeatNameNumRepository;
-import com.rf.psychological.user.service.UserRepeatNameNumService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * @author lpf
- * @description:
- * @date 17/12/2021下午7:22
- */
-@Service
-public class UserRepeatNameNumServiceImpl implements UserRepeatNameNumService {
-
-    @Autowired
-    private UserRepeatNameNumRepository userRepeatNameNumRepository;
-
-    @Override
-    public List<UserRepeatNameNumEntity> findAllByInstitutionNo(String institutionNo) {
-        return userRepeatNameNumRepository.findAllByInstitutionNo(institutionNo);
-    }
-
-    @Override
-    public UserRepeatNameNumEntity findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(String namePinyin, String institutionNo) {
-        return userRepeatNameNumRepository.findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(namePinyin, institutionNo);
-    }
-
-    @Override
-    public int updateNum(String namePinyin, String institutionNo, int num) {
-        return userRepeatNameNumRepository.updateNum(namePinyin, institutionNo, num);
-    }
-
-    @Override
-    public UserRepeatNameNumEntity save(UserRepeatNameNumEntity userRepeatNameNumEntity) {
-        return userRepeatNameNumRepository.save(userRepeatNameNumEntity);
-    }
-
-    @Override
-    public int testOrNotNamePinyin(String institutionNo, String namePinyin) {
-        UserRepeatNameNumEntity userRepeatNameNumEntityByNamePinyinAndInstitutionNo = userRepeatNameNumRepository.findUserRepeatNameNumEntityByNamePinyinAndInstitutionNo(namePinyin, institutionNo);
-        if (userRepeatNameNumEntityByNamePinyinAndInstitutionNo == null) {
-            userRepeatNameNumRepository.save(new UserRepeatNameNumEntity(namePinyin, institutionNo, 0));
-            return 0;
-        } else {
-            userRepeatNameNumRepository.updateNum(namePinyin, institutionNo, userRepeatNameNumEntityByNamePinyinAndInstitutionNo.getNum() + 1);
-            return userRepeatNameNumEntityByNamePinyinAndInstitutionNo.getNum();
-        }
-    }
-}

+ 4 - 21
src/main/java/com/rf/psychological/utils/Constant.java

@@ -25,30 +25,13 @@ public class Constant {
      */
     public static final String WEB_INSTITUTION_CODE ="PUB001";
 
-    /**
-     * 公网版机构名称
-     */
-    public static final String WEB_INSTITUTION_NAME ="公网版机构";
-
-    /**
-     * 局域网版机构编号
-     */
-    public static final String LAN_INSTITUTION_CODE ="LAN001";
 
-    /**
-     * 局域网版机构名称
-     */
-    public static final String LAN_INSTITUTION_NAME ="局域网版机构";
 
     /**
      * 部分字段默认值
      */
     public static final String DEFAULT_VALUE_ZERO ="0";
 
-    /**
-     * 公网版配置文件名称
-     */
-    public static final String PROFILE_PUBLIC = "public";
 
 
     /**
@@ -89,6 +72,9 @@ public class Constant {
      */
     public static final String USER_STATUS_NORMAL = "2";
 
+
+    public static final String DEFAULT_VALUE_ONE = "1";
+
     /**
      * 短信相关
      */
@@ -102,10 +88,7 @@ public class Constant {
      * 默认密码
      */
     public static final String DEFAULT_PASSWORD = "123456";
-/**测试类型 匹茨堡睡眠质量指数**/
-//public static final String QUEST_TYPE_PSQI="PSQI";
-/**测试类型 心境状态量表POMS**/
-//public static final String QUEST_TYPE_POMS = "POMS";
+
     /**
      * 测试类型症状自评量表(SCL-90)
      **/