admin 사용자 추가시 gw id 자동으로 등록추가
This commit is contained in:
parent
82bda62e3f
commit
c0334268f5
@ -1,6 +1,5 @@
|
||||
package com.itn.admin.gw.holiday.mapper;
|
||||
|
||||
import com.itn.admin.commute.mapper.domain.CommuteVO;
|
||||
import com.itn.admin.gw.holiday.mapper.domain.HolidayVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -21,4 +20,6 @@ import java.util.List;
|
||||
public interface HolidayMapper {
|
||||
|
||||
List<HolidayVO> selectHolidaysByDateRange(String targetDate);
|
||||
|
||||
String findByUserIdFromUsrGlobalWhereName(String userName);
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.itn.admin.commute.mapper.CommuteMapper;
|
||||
import com.itn.admin.commute.mapper.domain.CommuteVO;
|
||||
import com.itn.admin.commute.mapper.domain.UserEnum;
|
||||
import com.itn.admin.commute.service.CommuteService;
|
||||
import com.itn.admin.gw.holiday.mapper.HolidayMapper;
|
||||
import com.itn.admin.itn.user.mapper.UserMapper;
|
||||
import com.itn.admin.itn.user.mapper.domain.Role;
|
||||
import com.itn.admin.itn.user.mapper.domain.UserVO;
|
||||
@ -36,6 +37,9 @@ public class UserServiceImpl implements UserService {
|
||||
@Autowired
|
||||
TCodeUtils tCodeUtils;
|
||||
|
||||
@Autowired
|
||||
HolidayMapper holidayMapper;
|
||||
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@ -166,6 +170,21 @@ public class UserServiceImpl implements UserService {
|
||||
userVO.setUniqId("ITN_"+ UUID.randomUUID().toString().replace("-", "").substring(0, 10));
|
||||
userVO.setPassword(passwordEncoder.encode("itn123")); // 초기 비밀번호
|
||||
userVO.setRole(Role.ROLE_GUEST);
|
||||
|
||||
String gwUserId ="";
|
||||
try {
|
||||
gwUserId = holidayMapper.findByUserIdFromUsrGlobalWhereName(userVO.getUserName());
|
||||
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return RestResponse.builder()
|
||||
.status(HttpStatus.BAD_REQUEST) // 실패
|
||||
.data(userVO.getUserName())
|
||||
.msg("실패하였습니다.")
|
||||
.build();
|
||||
}
|
||||
userVO.setGwId(gwUserId);
|
||||
|
||||
log.info("userVO : [{}]", userVO);
|
||||
userMapper.insertUser(userVO);
|
||||
return RestResponse.builder()
|
||||
|
||||
@ -41,4 +41,16 @@
|
||||
AND appr_stat = '2' -- 결제 완료 2
|
||||
ORDER BY INS_DATE DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 특정 날짜가 범위 내에 있는 휴가 목록 조회 -->
|
||||
<select id="findByUserIdFromUsrGlobalWhereName" parameterType="string" resultType="string">
|
||||
SELECT
|
||||
USER_ID
|
||||
FROM INTRAWARE.USR_GLOBAL
|
||||
WHERE NAME = #{userName}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -572,9 +572,13 @@
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
data: JSON.stringify(formData),
|
||||
success: function(response) {
|
||||
$('#regUserInfoModal').modal('hide');
|
||||
fn_successAlert("등록 완료", response.data + "님 등록됨");
|
||||
location.reload();
|
||||
if(response.status === "OK") {
|
||||
$('#regUserInfoModal').modal('hide');
|
||||
fn_successAlert("등록 완료", response.data + "님 등록됨");
|
||||
location.reload();
|
||||
}else{
|
||||
fn_successAlert(response.msg);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
alert("등록 실패");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user