|
@@ -360,53 +360,6 @@ public class ServerController extends BaseController {
|
|
|
return success(jsonObject);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 征冰心理健康测评消息推送
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("push/message/{phone}")
|
|
|
- @ApiOperation(value = "心理健康测评消息推送")
|
|
|
- public Result pushMessage(@PathVariable String phone) throws InterruptedException {
|
|
|
- String url = "ws://127.0.0.1:54378/ws";
|
|
|
- MyClient myClient = new MyClient(url);
|
|
|
- myClient.connectBlocking();
|
|
|
- JSONObject dataJson = new JSONObject();
|
|
|
- dataJson.put("flag","begin");
|
|
|
- dataJson.put("date", LocalDateTime.now().toString());
|
|
|
- myClient.send(dataJson.toString());
|
|
|
- Thread.sleep(500);
|
|
|
- myClient.close();
|
|
|
- this.TASK_STATUS.put(phone,"1");
|
|
|
- return success();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 征冰心理健康测评状态查询
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("push/status/{phoneNumber}")
|
|
|
- @ApiOperation(value = "征冰心理健康测评状态查询")
|
|
|
- public Result pushStatus(@PathVariable String phoneNumber) {
|
|
|
- return success(this.TASK_STATUS.get(phoneNumber) == null?"0":this.TASK_STATUS.get(phoneNumber));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户查询靶向神经振荡评估与训练记录
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @SafetyProcess
|
|
|
- @GetMapping("RHYTHM/{phone}/{institutionNo}/{testPlanId}")
|
|
|
- @ApiOperation(value = "用户查询靶向神经振荡评估与训练记录")
|
|
|
- public Result RHYTHM(@PathVariable String phone, @PathVariable String institutionNo, @PathVariable String testPlanId) {
|
|
|
- UserRecordEntity userRecordEntity = this.userRecordService.getRHYTHM(phone, institutionNo, testPlanId);
|
|
|
- if (userRecordEntity != null && userRecordEntity.getImg() != null) {
|
|
|
- return success(userRecordEntity.getImg());
|
|
|
- }
|
|
|
- return success("");
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 删除机构自定义量表
|
|
@@ -437,31 +390,7 @@ public class ServerController extends BaseController {
|
|
|
return success();
|
|
|
}
|
|
|
|
|
|
- @PostMapping("subjectInfo/update")
|
|
|
- public Result updateSubjectInfo(@RequestBody JSONObject jsonObject) {
|
|
|
- JSONArray categoryList = jsonObject.getJSONArray("type");
|
|
|
- String flag = jsonObject.getString("flag");
|
|
|
- String scaleLimit = jsonObject.getString("scaleLimit");
|
|
|
- /*String men = jsonObject.getString("people");
|
|
|
- men = men.replace("[","").replace("]","");
|
|
|
- if(men.contains("0")){
|
|
|
- men = "0";
|
|
|
- }*/
|
|
|
- this.categorySubjectService.deleteCategorySubjectByFlag(flag);
|
|
|
- for (Object obj : categoryList) {
|
|
|
- CategorySubjectEntity categorySubjectEntity = new CategorySubjectEntity();
|
|
|
- categorySubjectEntity.setFlag(flag);
|
|
|
- categorySubjectEntity.setEname((String) obj);
|
|
|
- this.categorySubjectService.save(categorySubjectEntity);
|
|
|
- }
|
|
|
- SubjectEntity subjectEntity = this.subjectService.getSubjectEntityByFlag(flag);
|
|
|
- if (subjectEntity != null) {
|
|
|
- subjectEntity.setScaleLimit(scaleLimit);
|
|
|
- //subjectEntity.setMen(men.replace(" ",""));
|
|
|
- this.subjectService.save(subjectEntity);
|
|
|
- }
|
|
|
- return success();
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 量表上传需要接口
|
|
@@ -1131,23 +1060,6 @@ public class ServerController extends BaseController {
|
|
|
return success(jsonObject);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户查询枪林弹雨
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @SafetyProcess
|
|
|
- @GetMapping("GUNSBULLETS/{userId}")
|
|
|
- @ApiOperation(value = "用户查询枪林弹雨记录")
|
|
|
- public Result GUNSBULLETS(@PathVariable String userId) {
|
|
|
- UserEntity one = this.userService.getOne(userId);
|
|
|
- List<UserRecordEntity> gunsbullets = this.userRecordService.getGUNSBULLETS(one.getPhone(), one.getInstitutionNo());
|
|
|
- return success(gunsbullets);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 根据id查询测试详细信息
|
|
|
*
|
|
@@ -1496,161 +1408,6 @@ public class ServerController extends BaseController {
|
|
|
return success();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /* V1版本,暂时保留
|
|
|
- @ApiOperation(value = "用户导入")
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- @PostMapping("userImport")
|
|
|
- public Result userImport(String institutionNo, MultipartFile file, HttpServletResponse response) throws Exception {
|
|
|
- if (file == null) {
|
|
|
- return fail("文件为空");
|
|
|
- }
|
|
|
- if (institutionNo == null) {
|
|
|
- return fail("机构编号为空");
|
|
|
- }
|
|
|
- //String message = "提交成功";
|
|
|
- String filePath = "";//用户信息上传之后生成的用户名密码文件保存路径
|
|
|
- String fileName = file.getOriginalFilename();
|
|
|
- List<List<Object>> datas = ExcelUtil.getBankListByExcelForUserImport(file.getInputStream(), fileName);
|
|
|
- if(datas.size() <= 0){
|
|
|
- return fail("内容为空");
|
|
|
- }
|
|
|
- //插入数据库信息
|
|
|
- List<UserEntity> userListDB = new ArrayList<>();
|
|
|
- //生成导入后用户信息
|
|
|
- List<UserEntity> userLists = new ArrayList<>();
|
|
|
-
|
|
|
- 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);
|
|
|
- if (users.get(0) == null || users.get(0) == "" || users.get(1) == null || users.get(1) == "" || users.get(2) == null || users.get(2) == ""
|
|
|
- || users.get(3) == null || users.get(3) == "" || users.get(4) == null || users.get(4) == "" || users.get(5) == null || users.get(5) == "") {
|
|
|
- y = i + 1;
|
|
|
- result.append("第" + y +"条数据信息不完整").append("\r\n");
|
|
|
- isExist = true;
|
|
|
- continue;
|
|
|
- }
|
|
|
- //北京师范大学亚太实验学校, 陈亚浩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");
|
|
|
- }
|
|
|
- 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("")) {
|
|
|
- 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);
|
|
|
- }
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
- tempUserDB.setGId(defaultGroupId);
|
|
|
- tempUserDB.setModelPhone("0");
|
|
|
- tempUserDB.setRoleType(UserRole.COMMON.getType());
|
|
|
- userEntity.setGId(defaultGroupId);
|
|
|
- userEntity.setModelPhone("0");
|
|
|
- userEntity.setRoleType(UserRole.COMMON.getType());
|
|
|
-
|
|
|
- //查看当前用户是否已经在数据库存在
|
|
|
- UserEntity phoneAndInstitutionNo = userService.findPhoneAndInstitutionNo(tempUserDB.getPhone(), institutionNo);
|
|
|
- if (phoneAndInstitutionNo != null) {
|
|
|
- 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());
|
|
|
- } else {
|
|
|
- return success(filePath + fileName, "批量导入成功");
|
|
|
- }
|
|
|
- } catch (Exception exception) {
|
|
|
-
|
|
|
- exception.printStackTrace();
|
|
|
- return fail("导入失败,请联系管理员");
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
@ApiOperation(value = "用户导入")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@PostMapping("userImport")
|