1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| * @author vincent */ @RestController @RequestMapping(value = "/server") @Slf4j public class ServerSimulatorController { @RequestMapping(value = "/token", method = RequestMethod.GET) public AuthServerDto getAccessToken(@RequestParam("grant_type") String grantType, @RequestParam("client_id") String clientId, @RequestParam("client_secret") String clientSecret) { log.info("GetAccessToken method request parameters -> grant_type: {}, client_id: {},client_secret: {} ...", grantType, clientId, clientSecret); AuthServerDto authDto = new AuthServerDto(); authDto.setAccessToken(UUID.randomUUID().toString()); authDto.setTokenType("bearer"); authDto.setExpiresIn(3 * 60 * 1000); return authDto; }
@GetMapping(value = "/user/get") public ResponseDto<TpUserDto> getUserDto(@RequestParam("accessToken") String accessToken, @RequestParam("userId") String userId) { log.info("GetUserDto method request parameters -> accessToken: [{}], userId: [{}] ...", accessToken, userId); TpUserDto userDto = new TpUserDto(); userDto.setUserId(userId); userDto.setUserCode("USERCODE_VINCENT"); userDto.setUserName("Vincent"); return ResponseDto.success(userDto); }
@PostMapping(value = "/department/list") public ResponseDto<List<TpDepartmentDto>> getDepartmentDtos(@RequestParam("accessToken") String accessToken, @RequestBody TpDepartmentQueryDto queryDto) { log.info("GetDepartmentDtos method request parameters -> accessToken: [{}], queryDto: [{}] ...", accessToken, queryDto); return ResponseDto.success(Lists.newArrayList( new TpDepartmentDto(19000L, "xxx公司", "xxx_company", 1L, queryDto.getPosition(), 1L), new TpDepartmentDto(19580L, "人事部", "personnel_department", 19000L, queryDto.getPosition(), 23L), new TpDepartmentDto(19581L, "财务部", "finance_department", 19000L, queryDto.getPosition(), 24L), new TpDepartmentDto(19582L, "技术部", "technology_department", 19000L, queryDto.getPosition(), 25L) )); } }
|