(139) - User Overview/ user add/archive
parent
325198dcd3
commit
1fc23e2723
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright (c) 2015 MONKEYK Information Technology Co. Ltd
|
||||
* www.monkeyk.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of
|
||||
* MONKEYK Information Technology Co. Ltd ("Confidential Information").
|
||||
* You shall not disclose such Confidential Information and shall use
|
||||
* it only in accordance with the terms of the license agreement you
|
||||
* entered into with MONKEYK Information Technology Co. Ltd.
|
||||
*/
|
||||
package com.monkeyk.sos.domain.dto;
|
||||
|
||||
import com.monkeyk.sos.domain.user.Privilege;
|
||||
import com.monkeyk.sos.domain.user.User;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 2016/3/12
|
||||
*
|
||||
* @author Shengzhao Li
|
||||
*/
|
||||
public class UserDto implements Serializable {
|
||||
private static final long serialVersionUID = -2502329463915439215L;
|
||||
|
||||
|
||||
private String guid;
|
||||
|
||||
private String username;
|
||||
|
||||
private String phone;
|
||||
private String email;
|
||||
|
||||
private String createTime;
|
||||
|
||||
private List<Privilege> privileges = new ArrayList<>();
|
||||
|
||||
|
||||
public UserDto() {
|
||||
}
|
||||
|
||||
|
||||
public UserDto(User user) {
|
||||
this.guid = user.guid();
|
||||
this.username = user.username();
|
||||
this.phone = user.phone();
|
||||
this.email = user.email();
|
||||
|
||||
this.privileges = user.privileges();
|
||||
this.createTime = user.createTime().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
public void setGuid(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public List<Privilege> getPrivileges() {
|
||||
return privileges;
|
||||
}
|
||||
|
||||
public void setPrivileges(List<Privilege> privileges) {
|
||||
this.privileges = privileges;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2015 MONKEYK Information Technology Co. Ltd
|
||||
* www.monkeyk.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of
|
||||
* MONKEYK Information Technology Co. Ltd ("Confidential Information").
|
||||
* You shall not disclose such Confidential Information and shall use
|
||||
* it only in accordance with the terms of the license agreement you
|
||||
* entered into with MONKEYK Information Technology Co. Ltd.
|
||||
*/
|
||||
package com.monkeyk.sos.domain.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 2016/3/12
|
||||
*
|
||||
* @author Shengzhao Li
|
||||
*/
|
||||
public class UserOverviewDto implements Serializable {
|
||||
private static final long serialVersionUID = 2023379587030489248L;
|
||||
|
||||
|
||||
private String username;
|
||||
|
||||
|
||||
private List<UserDto> userDtos = new ArrayList<>();
|
||||
|
||||
|
||||
public UserOverviewDto() {
|
||||
}
|
||||
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public List<UserDto> getUserDtos() {
|
||||
return userDtos;
|
||||
}
|
||||
|
||||
public void setUserDtos(List<UserDto> userDtos) {
|
||||
this.userDtos = userDtos;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.monkeyk.sos.service;
|
||||
|
||||
import com.monkeyk.sos.domain.dto.UserJsonDto;
|
||||
import com.monkeyk.sos.domain.dto.UserOverviewDto;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
|
||||
/**
|
||||
|
@ -9,4 +10,6 @@ import org.springframework.security.core.userdetails.UserDetailsService;
|
|||
public interface UserService extends UserDetailsService {
|
||||
|
||||
UserJsonDto loadCurrentUserJsonDto();
|
||||
|
||||
UserOverviewDto loadUserOverviewDto(UserOverviewDto overviewDto);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.monkeyk.sos.service.impl;
|
||||
|
||||
import com.monkeyk.sos.domain.dto.UserJsonDto;
|
||||
import com.monkeyk.sos.domain.dto.UserOverviewDto;
|
||||
import com.monkeyk.sos.domain.shared.security.WdcyUserDetails;
|
||||
import com.monkeyk.sos.domain.user.User;
|
||||
import com.monkeyk.sos.domain.user.UserRepository;
|
||||
|
@ -49,6 +50,12 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserOverviewDto loadUserOverviewDto(UserOverviewDto overviewDto) {
|
||||
|
||||
return overviewDto;
|
||||
}
|
||||
|
||||
|
||||
private UserJsonDto loadOauthUserJsonDto(OAuth2Authentication oAuth2Authentication) {
|
||||
UserJsonDto userJsonDto = new UserJsonDto();
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.monkeyk.sos.web.controller;
|
||||
|
||||
import com.monkeyk.sos.domain.dto.UserOverviewDto;
|
||||
import com.monkeyk.sos.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
|
@ -11,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
public class UserController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* Just forward to page
|
||||
|
@ -18,7 +24,9 @@ public class UserController {
|
|||
* @return View page
|
||||
*/
|
||||
@RequestMapping("overview")
|
||||
public String overview() {
|
||||
public String overview(UserOverviewDto overviewDto, Model model) {
|
||||
overviewDto = userService.loadUserOverviewDto(overviewDto);
|
||||
model.addAttribute("overviewDto", overviewDto);
|
||||
return "user_overview";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue