|
@@ -43,68 +43,13 @@ import java.util.List;
|
|
|
@RequestMapping("/institution")
|
|
|
@Api(tags = "机构模块")
|
|
|
public class InstitutionController extends BaseController {
|
|
|
-
|
|
|
@Autowired
|
|
|
private InstitutionService institutionService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private UserRecordService userRecordService;
|
|
|
|
|
|
- @SafetyProcess
|
|
|
-@OperationLogAnnotation
|
|
|
- @PostMapping("/loginV2")
|
|
|
- @ApiOperation(value = "机构管理员登录")
|
|
|
- public Result AdminUserLoginV2(@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("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("") || institutionNo.equals("")) {
|
|
|
- return fail("", "用户名或密码或机构名不能为空");
|
|
|
- }
|
|
|
- UserEntity institutionUserEntity = this.userService.findPhoneAndInstitutionNo(phone,institutionNo);
|
|
|
- if (institutionUserEntity != null) {
|
|
|
- //生成token
|
|
|
- HashMap<String, String> payload = new HashMap<>();
|
|
|
- payload.put("userPhone", institutionUserEntity.getPhone());
|
|
|
- payload.put("userId", institutionUserEntity.getId());
|
|
|
- payload.put("petName", institutionUserEntity.getPetName());
|
|
|
- payload.put("institutionNo", institutionUserEntity.getInstitutionNo());
|
|
|
- payload.put("type", "admin");
|
|
|
- String token = JWTUtil.getToken(payload);
|
|
|
- // 创建返回的json对象
|
|
|
- JSONObject resultJson = new JSONObject();
|
|
|
- resultJson.put("institutionEntity", institutionUserEntity);
|
|
|
- resultJson.put("type", "admin");
|
|
|
- if (password.equals(institutionUserEntity.getPassword())) {
|
|
|
- if (UserStatus.PASS.getType().equals(institutionUserEntity.getUserStatus()) ||
|
|
|
- UserStatus.UPDATE.getType().equals(institutionUserEntity.getUserStatus())) {
|
|
|
- //当用户状态变为重置密码状态时,再重新登录后变为正常使用状态
|
|
|
- if (UserStatus.UPDATE.getType().equals(institutionUserEntity.getUserStatus())) {
|
|
|
- userService.updateUserStatusByPhone(phone, UserStatus.PASS.getType(), institutionNo);
|
|
|
- }
|
|
|
- resultJson.put("token", token);
|
|
|
- return success(resultJson);
|
|
|
- } else
|
|
|
- return fail(resultJson, "用户未通过审核");
|
|
|
- } else {
|
|
|
- return fail(resultJson, "用户名或密码错误");
|
|
|
- }
|
|
|
- } else {
|
|
|
- return fail("", "不存在此用户");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 获取机构列表
|
|
|
*
|
|
@@ -119,9 +64,7 @@ public class InstitutionController extends BaseController {
|
|
|
if (pageSize == 0) {
|
|
|
pageSize = 20;
|
|
|
}
|
|
|
- // List<InstitutionEntity> allInstitutionByName = this.institutionService.findAllInstitutionByName(pageNum, pageSize, searchKey);
|
|
|
Page<InstitutionEntity> institutionEntities = this.institutionService.findAllInstitution(pageNum,pageSize,searchKey);
|
|
|
- //long total = institutionEntities.getTotalElements();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("data", institutionEntities.getContent());
|
|
|
jsonObject.put("allNum", institutionEntities.getTotalElements());
|
|
@@ -143,7 +86,6 @@ public class InstitutionController extends BaseController {
|
|
|
pageSize = 20;
|
|
|
}
|
|
|
Page<UserEntity> userEntities = userService.findUserByPhoneOrInstitutionName(pageNum,pageSize,searchKey);
|
|
|
- // List<InstitutionUserEntity> allByName = institutionUserService.findAllByName(pageNum, pageSize, searchKey);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("institutionUserList", userEntities.getContent());
|
|
|
jsonObject.put("allNum", userEntities.getTotalElements());
|
|
@@ -165,7 +107,6 @@ public class InstitutionController extends BaseController {
|
|
|
pageSize = 20;
|
|
|
}
|
|
|
Page<UserEntity> userEntities = userService.findUserByPhoneOrNameInInstitutionNo(pageNum,pageSize,institutionNo,searchKey, UserRole.ADMIN);
|
|
|
- //List<InstitutionUserEntity> allByName = institutionUserService.findAllInAdminByInNo(pageNum, pageSize, institutionNo, searchKey);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("institutionUserList", userEntities.getContent());
|
|
|
jsonObject.put("allNum", userEntities.getTotalElements());
|
|
@@ -265,21 +206,6 @@ public class InstitutionController extends BaseController {
|
|
|
pageSize = 20;
|
|
|
}
|
|
|
String beginFormat = "", endFormat = "";
|
|
|
- /*log.info("开始时间:" + beginTime);
|
|
|
- log.info("结束时间:" + endTime);
|
|
|
- if (!beginTime.equals("") && !endTime.equals("")) {
|
|
|
- beginTime = beginTime + " " + "00:00:00";
|
|
|
- endTime = endTime + " " + "24:00:00";
|
|
|
- //格式化为数据库的时间样式
|
|
|
- SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒");
|
|
|
- Date beginDate = simpleDateFormat1.parse(beginTime);
|
|
|
- Date endDate = simpleDateFormat1.parse(endTime);
|
|
|
- beginFormat = simpleDateFormat2.format(beginDate);
|
|
|
- endFormat = simpleDateFormat2.format(endDate);
|
|
|
- }
|
|
|
- log.info("格式化后为beginFormat:" + beginFormat);
|
|
|
- log.info("格式化后为endFormat:" + endFormat);*/
|
|
|
int num;
|
|
|
List<InstitutionRecordingDTO> institutionUserRecordingList = this.userRecordService.getInstitutionUserRecording(pageNum, pageSize, type, institutionNo, searchKey, beginFormat, endFormat);
|
|
|
num = this.userRecordService.allCountByInstitutionNo(institutionNo, type, searchKey, "", "");
|