jdk 1.8 -> 17, @Component("...") 추가, 사용자 아이디 관련 변경

master
mjkhan21 1 year ago
parent a8bd23921e
commit 8e6422c562

@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
@ -120,8 +120,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

@ -49,7 +49,6 @@ public abstract class GenericUser extends User {
}
private String
key,
passwordHint,
passwordHintAnswer,
gender,
@ -62,7 +61,6 @@ public abstract class GenericUser extends User {
faxNo,
mobilePhoneNo,
groupID,
locked,
status;
private int lockCount;
private String lockedDate;
@ -72,20 +70,6 @@ public abstract class GenericUser extends User {
*/
public abstract String getType();
/** ID .
* @return ID
*/
public String getKey() {
return key;
}
/** ID .
* @param key ID
*/
public void setKey(String key) {
this.key = key;
}
/** .
* @return
*/
@ -255,20 +239,6 @@ public abstract class GenericUser extends User {
this.groupID = groupID;
}
/** .
* @return
*/
public String getLocked() {
return Assert.ifEmpty(locked, "N");
}
/** .
* @param locked
*/
public void setLocked(String locked) {
this.locked = locked;
}
/** .
* @return
*/

@ -12,7 +12,6 @@ public class ManagedUser extends GenericUser {
deptCode,
birthday,
positionName,
institute,
certificateDn;
@Override
@ -104,20 +103,6 @@ public class ManagedUser extends GenericUser {
this.positionName = positionName;
}
/** .
* @return
*/
public String getInstitute() {
return institute;
}
/** .
* @param insititute
*/
public void setInstitute(String insititute) {
this.institute = insititute;
}
/** DN .
* @return DN
*/

@ -57,6 +57,31 @@ public interface UserMapper extends AbstractMapper {
return !users.isEmpty() ? users.get(0) : null;
}
/** .
* @param params
* <pre><code>{
* "account": ,
* "institute":
* }</code></pre>
* @return
*/
<T extends User> T getUser(Map<String, Object> params);
/** .
* @param account
* @param institute
* @return
*/
default <T extends User> T getUser(String account, String institute) {
notEmpty(account, "사용자 계정");
notEmpty(institute, "소속 기관 코드");
return getUser(
params()
.set("account", account)
.set("institute", institute)
);
}
/** .
* @param user
* @return

@ -59,6 +59,14 @@ public interface UserService {
*/
<T extends User> T getUser(String userID);
/** .
* @param <T>
* @param account
* @param institute
* @return
*/
<T extends User> T getUser(String account, String institute);
/** . {@link cokr.xit.foundation.util.CharsEncoder } .
* @param user
* @return

@ -30,7 +30,7 @@ public class UserBean extends AbstractComponent {
*/
public List<DataObject> getUserList(UserQuery req) {
switch (ifEmpty(req.getBy(), () -> "")) {
case "userID": req.setBy("USER_ID"); break;
case "userAccount": req.setBy("USER_ACNT"); break;
default: req.setBy("USER_NM"); break;
}
req.setOrderBy(req.getBy());
@ -63,6 +63,16 @@ public class UserBean extends AbstractComponent {
return userMapper.getUser(userID);
}
/** .
* @param <T>
* @param account
* @param institute
* @return
*/
public <T extends User> T getUser(String account, String institute) {
return userMapper.getUser(account, institute);
}
/** . {@link cokr.xit.foundation.util.CharsEncoder } .
* @param user
* @return
@ -73,8 +83,7 @@ public class UserBean extends AbstractComponent {
public boolean create(User user) {
if (user == null) return false;
String userID = notEmpty(user.getId(), "user.id");
User existing = getUser(userID);
User existing = getExistingUser(user);
if (existing != null)
throw applicationException(null)
.setMessage(message("duplicate.object", "사용자"));
@ -85,6 +94,12 @@ public class UserBean extends AbstractComponent {
return userMapper.insertUser(user) > 0;
}
private User getExistingUser(User user) {
String account = user.getAccount(),
institute = user.getInstitute();
return getUser(account, institute);
}
/** .
* @param user
* @return
@ -95,6 +110,11 @@ public class UserBean extends AbstractComponent {
public boolean update(User user) {
if (user == null) return false;
User existing = getExistingUser(user);
if (existing != null && !equals(user.getId(), existing.getId()))
throw applicationException(null)
.setMessage(message("duplicate.object", "사용자"));
user.setModifiedBy(currentUser().getId());
return userMapper.updateUser(user) > 0;
}

@ -42,6 +42,11 @@ public class UserServiceBean extends AbstractServiceBean implements UserService
return userBean.getUser(userID);
}
@Override
public <T extends User> T getUser(String account, String institute) {
return userBean.getUser(account, institute);
}
@Override
public boolean create(User user) {
return userBean.create(user);

@ -68,16 +68,17 @@ public class UserController<U extends User> extends AbstractController {
return mav.addObject("userList", toJson(list));
}
/** .
* @param userID
/** .
* @param account
* @param institute
* @return jsonView
* <pre><code> {
* "duplicate": true, false
* }</code></pre>
*/
@RequestMapping(name="중복 확인", value="/duplicate.do")
public ModelAndView isDuplicate(String userID) {
U user = userService.getUser(userID);
public ModelAndView isDuplicate(String account, String institute) {
U user = userService.getUser(account, institute);
return new ModelAndView("jsonView")
.addObject("duplicate", user != null);
}

Loading…
Cancel
Save