1.添加验证医院客户账号接口

master
x_z 2 years ago
parent 2a5ccbabcf
commit f23ac75a8e

@ -8,6 +8,7 @@ import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.entity.info.PlatformEntity;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity;
import com.glxp.udi.admin.req.info.PlatformLinkRequest;
import com.glxp.udi.admin.req.info.PlatformUserInfoRequest;
import com.glxp.udi.admin.res.PageSimpleResponse;
import com.glxp.udi.admin.res.info.PlatformLinkResponse;
import com.glxp.udi.admin.service.info.PlatformService;
@ -64,6 +65,44 @@ public class PlatformController {
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/udims/platform/testUserInfo")
public BaseResponse testUserInfo(@RequestBody PlatformUserInfoRequest platformUserInfoRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
PlatformEntity platformEntity = platformService.getPlatformById(platformUserInfoRequest.getPlatformId());
if (null == platformEntity || StrUtil.isBlank(platformEntity.getHost())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
String url = platformEntity.getHost() + "/verify";
Map<String, Object> map = new HashMap<>();
map.put("username", platformUserInfoRequest.getUsername());
map.put("password", platformUserInfoRequest.getPassword());
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<String> request = new HttpEntity<>(JSON.toJSONString(map), headers);
RestTemplate restTemplate = new RestTemplate();
log.error(url);
String result = restTemplate.postForObject(url, request, String.class, map);
log.error(result);
Map<String, Object> object = JSON.parseObject(result, Map.class);
if (!String.valueOf(object.get("code")).equals("20000")) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, String.valueOf(object.get("message")));
}
return ResultVOUtils.success();
}
@AuthRuleAnnotation("")
@PostMapping("/udims/platform/link")
public BaseResponse update(@RequestBody UnitMaintainEntity unitMaintainEntity) {

@ -11,8 +11,14 @@ public class PlatformEntity {
@TableId
private String id;
private String name; //平台名称
/**
*
*/
private String name;
private String host; //平台地址
/**
*
*/
private String host;
}

@ -0,0 +1,27 @@
package com.glxp.udi.admin.req.info;
import lombok.Data;
/**
*
*/
@Data
public class PlatformUserInfoRequest {
/**
*
*/
private String platformId;
/**
*
*/
private String username;
/**
*
*/
private String password;
}

@ -208,4 +208,14 @@ public class PlatformService {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
}
/**
* ID
*
* @param platformId
* @return
*/
public PlatformEntity getPlatformById(String platformId) {
return platformDao.selectById(platformId);
}
}

Loading…
Cancel
Save