mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-12 01:34:19 +09:00
로그인 관련 / 메뉴 링크 추가 / 홈페이지 로그인 적용
This commit is contained in:
@@ -15,6 +15,9 @@ import kr.co.uplus.ez.api.channelMgt.dto.TmpltListResDto;
|
||||
import kr.co.uplus.ez.common.components.ValidComponents;
|
||||
import kr.co.uplus.ez.common.data.ApiResponseCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -49,7 +52,10 @@ public class ChannelMgtController {
|
||||
return new TmpltListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
|
||||
}
|
||||
|
||||
return channelService.tmpltList(tmpltListReqDto);
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
String userId = auth.getName();
|
||||
|
||||
return channelService.tmpltList(tmpltListReqDto, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +76,9 @@ public class ChannelMgtController {
|
||||
return new TmpltListExcelResDto(ApiResponseCode.CM_PARAMETER_ERROR);
|
||||
}
|
||||
|
||||
return channelService.tmpltListExcel(tmpltListExcelReqDto);
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
String userId = auth.getName();
|
||||
|
||||
return channelService.tmpltListExcel(tmpltListExcelReqDto, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,4 +16,6 @@ public interface ChannelMgtMapper {
|
||||
List<TmpltInfo> selectTmpltList(TmpltListReqDto tmpltListReqDto);
|
||||
|
||||
List<TmpltInfo> selectTmpltListExcel(TmpltListExcelReqDto tmpltListExcelReqDto);
|
||||
|
||||
String selectChannelAuthMenuNo(String targetUserId);
|
||||
}
|
||||
|
||||
@@ -33,11 +33,15 @@ public class ChannelMgtService {
|
||||
* @param tmpltListReqDto
|
||||
* @return
|
||||
*/
|
||||
public TmpltListResDto tmpltList(TmpltListReqDto tmpltListReqDto) {
|
||||
public TmpltListResDto tmpltList(TmpltListReqDto tmpltListReqDto, String targetUserId) {
|
||||
ChannelMgtMapper channelMgtMapper = sqlSessionSlave.getMapper(ChannelMgtMapper.class);
|
||||
String nowPage = String.valueOf(tmpltListReqDto.getPage());
|
||||
int totalCnt = channelMgtMapper.selectTmpltTotalCnt(tmpltListReqDto);
|
||||
|
||||
String channelAuthMenuNo = channelMgtMapper.selectChannelAuthMenuNo(targetUserId);
|
||||
tmpltListReqDto.setChannelAuthMenuNo(channelAuthMenuNo);
|
||||
tmpltListReqDto.setUserId(targetUserId);
|
||||
|
||||
int totalCnt = channelMgtMapper.selectTmpltTotalCnt(tmpltListReqDto);
|
||||
|
||||
if(totalCnt == 0) {
|
||||
Paging paging = new Paging();
|
||||
@@ -68,36 +72,16 @@ public class ChannelMgtService {
|
||||
}
|
||||
|
||||
//
|
||||
public TmpltListExcelResDto tmpltListExcel(TmpltListExcelReqDto tmpltListExcelReqDto) {
|
||||
public TmpltListExcelResDto tmpltListExcel(TmpltListExcelReqDto tmpltListExcelReqDto, String targetUserId) {
|
||||
ChannelMgtMapper channelMgtMapper = sqlSessionSlave.getMapper(ChannelMgtMapper.class);
|
||||
//String nowPage = String.valueOf(tmpltListReqDto.getPage());
|
||||
// int totalCnt = channelMgtMapper.selectTmpltTotalCnt(tmpltListReqDto);
|
||||
//
|
||||
//
|
||||
// if(totalCnt == 0) {
|
||||
// Paging paging = new Paging();
|
||||
// paging.setPage(nowPage);
|
||||
// paging.setTotalCnt(String.valueOf(totalCnt));
|
||||
// TmpltListRes tmpltListRes = new TmpltListRes();
|
||||
// tmpltListRes.setList(new ArrayList<>());
|
||||
// tmpltListRes.setPaging(paging);
|
||||
// return new TmpltListResDto(ApiResponseCode.CM_NOT_FOUND, tmpltListRes);
|
||||
// }
|
||||
// logger.info("perPage : "+tmpltListReqDto.getPagePerRows());
|
||||
// int page = tmpltListReqDto.getPage();
|
||||
// int pagePerRows = tmpltListReqDto.getPagePerRows();
|
||||
// page = (page -1) * pagePerRows;
|
||||
// tmpltListReqDto.setPage(page);
|
||||
String channelAuthMenuNo = channelMgtMapper.selectChannelAuthMenuNo(targetUserId);
|
||||
tmpltListExcelReqDto.setChannelAuthMenuNo(channelAuthMenuNo);
|
||||
tmpltListExcelReqDto.setUserId(targetUserId);
|
||||
|
||||
List<TmpltInfo> tmpltInfos = channelMgtMapper.selectTmpltListExcel(tmpltListExcelReqDto);
|
||||
|
||||
// Paging paging = new Paging();
|
||||
// paging.setPage(nowPage);
|
||||
// paging.setTotalCnt(String.valueOf(totalCnt));
|
||||
//
|
||||
TmpltListRes tmpltListRes = new TmpltListRes();
|
||||
tmpltListRes.setList(tmpltInfos);
|
||||
// tmpltListRes.setPaging(paging);
|
||||
|
||||
return new TmpltListExcelResDto(ApiResponseCode.SUCCESS, tmpltListRes);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,7 @@ public class TmpltListExcelReqDto implements Serializable {
|
||||
@ApiModelProperty(example = "검색어(입력)", name = "검색어(입력)", dataType = "String")
|
||||
private String searchText1;
|
||||
|
||||
private String channelAuthMenuNo;
|
||||
private String userId;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,4 +25,7 @@ public class TmpltListReqDto implements Serializable {
|
||||
@NotNull
|
||||
@ApiModelProperty(example = "현재 페이지", name = "현재 페이지", dataType = "int")
|
||||
private int page;
|
||||
|
||||
private String channelAuthMenuNo;
|
||||
private String userId;
|
||||
}
|
||||
|
||||
@@ -1,35 +1,12 @@
|
||||
package kr.co.uplus.ez.api.custMgt;
|
||||
|
||||
import kr.co.uplus.ez.api.custMgt.dto.*;
|
||||
import kr.co.uplus.ez.common.data.ImUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import kr.co.uplus.ez.api.custMgt.dto.AllMemoList;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.AllMemoListReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.CarryOver;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.CarryOverListReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.CustInfo;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.DeleteUserReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.InsertUserReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.MemberAdminDetailReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.MemberAdminDetailRes;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.MemberDetail;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.MemberDetailReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.MemberDetailRes;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.MemberList;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.MemberListReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.SubsDetail;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.SubsDetailReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.SubsInfo;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.SubsList;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.SubsListExcelReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.SubsListReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.SvcUserInfo;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.UpdateAdminInfoTotalReqDto;
|
||||
import kr.co.uplus.ez.api.custMgt.dto.UpdateUserReqDto;
|
||||
import kr.co.uplus.ez.common.data.ImUser;
|
||||
|
||||
@Mapper
|
||||
public interface CustMgtMapper {
|
||||
|
||||
@@ -94,12 +71,19 @@ public interface CustMgtMapper {
|
||||
String selectAdminId(String adminId);
|
||||
|
||||
int updateAdminInfoTotal(UpdateAdminInfoTotalReqDto updateAdminInfoTotalReqDto);
|
||||
|
||||
|
||||
int insertMemo(UpdateAdminInfoTotalReqDto updateAdminInfoTotalReqDto);
|
||||
|
||||
|
||||
int updateAdminSendingLimit(Map<String, Object> paramMap);
|
||||
|
||||
|
||||
Map<String, Object> selectAdminSendingLimt(Map<String, Object> paramMap);
|
||||
|
||||
SvcUserInfo selectSvcUserInfo(String userId);
|
||||
|
||||
String selectApiAuthToken(String apiApplicationId);
|
||||
|
||||
String getSubId();
|
||||
|
||||
String getEntrNo();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package kr.co.uplus.ez.api.custMgt;
|
||||
|
||||
import kr.co.uplus.ez.api.custMgt.dto.*;
|
||||
import kr.co.uplus.ez.common.components.HubeasyApiComponents;
|
||||
import kr.co.uplus.ez.common.data.*;
|
||||
import kr.co.uplus.ez.common.utils.EncryptionUtil;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
@@ -31,6 +32,9 @@ public class CustMgtService {
|
||||
@Qualifier("sqlSessionTemplateDb2")
|
||||
private SqlSessionTemplate sqlSessionSlave;
|
||||
|
||||
@Autowired
|
||||
private HubeasyApiComponents hubeasyApi;
|
||||
|
||||
/** 요금제. */
|
||||
@Value("${testId.prodCd}")
|
||||
private String prodCd;
|
||||
@@ -62,6 +66,18 @@ public class CustMgtService {
|
||||
@Value("${testId.custTyCd}")
|
||||
private String custTyCd;
|
||||
|
||||
@Value("${msghubez.homepage-url:https://mhez.uplus.co.kr}")
|
||||
private String mailTempleteHomeUrl;
|
||||
|
||||
@Value("${msghubez.applicationId:EZ_ADMIN}")
|
||||
private String apiApplicationId;
|
||||
|
||||
@Value("${mail.from:msghubez@lguplus.co.kr}")
|
||||
private String fromEmail;
|
||||
|
||||
@Value("${mail.templeteCode:E0005}")
|
||||
private String templeteCode;
|
||||
|
||||
/**
|
||||
* date : 2022. 4. 25. auth : ckr desc : 청약 고객 정보 목록 조회
|
||||
*
|
||||
@@ -408,10 +424,10 @@ public class CustMgtService {
|
||||
|
||||
// 3. 청약정보 등록
|
||||
SubsInfo subsInfo = new SubsInfo();
|
||||
// TODO 향후 수정 필요.
|
||||
subsInfo.setSubsId("");
|
||||
// TODO 향후 수정 필요.
|
||||
subsInfo.setUqvSbscNo("");
|
||||
String subId = custMgtMapper.getSubId();
|
||||
subsInfo.setSubsId(subId);
|
||||
String entrNo =custMgtMapper.getEntrNo();
|
||||
subsInfo.setEntrNo(entrNo);
|
||||
subsInfo.setUserSeq(userSeq);
|
||||
subsInfo.setCustSeq(custSeq);
|
||||
subsInfo.setSubsSttusCd(Const.SUBS_STTUS_CD_NORMAL);
|
||||
@@ -493,12 +509,13 @@ public class CustMgtService {
|
||||
*/
|
||||
public InsertUserResDto insertUser(InsertUserReqDto insertUserReqDto) {
|
||||
CustMgtMapper custMgtMapper = sqlSessionMaster.getMapper(CustMgtMapper.class);
|
||||
Map<Object,Object> mailReqMap = new HashMap<Object,Object>();
|
||||
Map<Object,Object> mailResultMap = new HashMap<Object,Object>();
|
||||
|
||||
// 임시패스워드 평문 생성
|
||||
String imsiPw = RandomStringUtils.randomAlphanumeric(10);
|
||||
|
||||
String userId = insertUserReqDto.getUserId();
|
||||
String encPwd = "";
|
||||
int userCnt = 0;
|
||||
|
||||
try {
|
||||
@@ -506,18 +523,49 @@ public class CustMgtService {
|
||||
if(userCnt > 0) {
|
||||
return new InsertUserResDto(ApiResponseCode.CE_DUPLICATE_ID);
|
||||
}
|
||||
|
||||
|
||||
// 패스워드 암호화
|
||||
encPwd = EncryptionUtil.getCustomSHA512(userId, imsiPw);
|
||||
String encPwd = EncryptionUtil.getCustomSHA512(userId, imsiPw);
|
||||
insertUserReqDto.setUserPw(encPwd);
|
||||
|
||||
// 사용자 정보 등록
|
||||
custMgtMapper.insertUserInfo(insertUserReqDto);
|
||||
|
||||
// API authToken 조회
|
||||
String apiAuthToken = custMgtMapper.selectApiAuthToken(apiApplicationId);
|
||||
|
||||
// 임시패스워드(평문) 이메일 발송처리
|
||||
// TODO: 임시패스워드(평문) 이메일 발송처리
|
||||
mailReqMap.put("applicationId", apiApplicationId);
|
||||
mailReqMap.put("authToken", apiAuthToken);
|
||||
mailReqMap.put("userId", userId);
|
||||
mailReqMap.put("tmpPwd", imsiPw);
|
||||
mailReqMap.put("toEmail", insertUserReqDto.getUserEmail());
|
||||
mailReqMap.put("fromEmail", fromEmail);
|
||||
mailReqMap.put("templeteCode", templeteCode);
|
||||
mailReqMap.put("homeUrl", mailTempleteHomeUrl);
|
||||
|
||||
logger.debug("############## [Email Send Start] ###############");
|
||||
logger.debug("[Email Send Request - applicationId : {}]", mailReqMap.get("applicationId"));
|
||||
logger.debug("[Email Send Request - authToken : {}]", mailReqMap.get("authToken"));
|
||||
logger.debug("[Email Send Request - userId : {}]", mailReqMap.get("userId"));
|
||||
logger.debug("[Email Send Request - tmpPwd : {}]", mailReqMap.get("tmpPwd"));
|
||||
logger.debug("[Email Send Request - toEmail : {}]", mailReqMap.get("toEmail"));
|
||||
logger.debug("[Email Send Request - fromEmail : {}]", mailReqMap.get("fromEmail"));
|
||||
logger.debug("[Email Send Request - templeteCode : {}]", mailReqMap.get("templeteCode"));
|
||||
logger.debug("[Email Send Request - homeUrl : {}]", mailReqMap.get("homeUrl"));
|
||||
|
||||
mailResultMap = hubeasyApi.sendTemplateMailApi(mailReqMap);
|
||||
|
||||
if(mailResultMap != null) {
|
||||
logger.debug("[Email Send API RESULT : {}]", mailResultMap.get("API_RSLT"));
|
||||
if("F".equals(mailResultMap.get("API_RSLT"))) {
|
||||
logger.debug("[Email Send API ERROR : {}]", mailResultMap.get("API_RSLT_MSG"));
|
||||
}
|
||||
}
|
||||
logger.debug("############## [Email Send End] ###############");
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
return new InsertUserResDto(ApiResponseCode.CM_DB_QUERY_ERR);
|
||||
}
|
||||
|
||||
@@ -545,8 +593,6 @@ public class CustMgtService {
|
||||
// 사용자 정보 수정
|
||||
custMgtMapper.updateUserInfo(updateUserReqDto);
|
||||
|
||||
// 임시패스워드(평문) 이메일 발송처리
|
||||
// TODO: 임시패스워드(평문) 이메일 발송처리
|
||||
|
||||
} catch (Exception e) {
|
||||
return new UpdateUserResDto(ApiResponseCode.CM_DB_QUERY_ERR);
|
||||
@@ -591,6 +637,11 @@ public class CustMgtService {
|
||||
}
|
||||
}
|
||||
|
||||
// 이메일발송 API 사용을 위한 authToken 조회
|
||||
String apiAuthToken = custMgtMapper.selectApiAuthToken(apiApplicationId);
|
||||
Map<Object, Object> mailReqMap = new HashMap<Object, Object>();
|
||||
Map<Object, Object> mailResultMap = new HashMap<Object, Object>();
|
||||
|
||||
InsertMassUserRes insertMassUserRes = new InsertMassUserRes();
|
||||
int successCnt = 0;
|
||||
for (int j = 0; j < insertMassUsers.size(); j++) {
|
||||
@@ -619,9 +670,43 @@ public class CustMgtService {
|
||||
svcUserInfo2.setRegId(userId);
|
||||
svcUserInfo2.setChgId(userId);
|
||||
|
||||
custMgtMapper.insertSvcUserInfo(svcUserInfo2);
|
||||
custMgtMapper.insertSvcUserInfo(svcUserInfo2);
|
||||
|
||||
successCnt++;
|
||||
|
||||
// 임시비밀번호 이메일발송
|
||||
mailReqMap = new HashMap<Object, Object>();
|
||||
mailResultMap = new HashMap<Object, Object>();
|
||||
|
||||
mailReqMap.put("applicationId", apiApplicationId);
|
||||
mailReqMap.put("authToken", apiAuthToken);
|
||||
mailReqMap.put("userId", userId);
|
||||
mailReqMap.put("tmpPwd", imsiPw);
|
||||
mailReqMap.put("toEmail", insertMassUsers.get(j).getEmail());
|
||||
mailReqMap.put("fromEmail", fromEmail);
|
||||
mailReqMap.put("templeteCode", templeteCode);
|
||||
mailReqMap.put("homeUrl", mailTempleteHomeUrl);
|
||||
|
||||
logger.debug("############## [Email Send Start] ###############");
|
||||
logger.debug("[Email Send Request - applicationId : {}]", mailReqMap.get("applicationId"));
|
||||
logger.debug("[Email Send Request - authToken : {}]", mailReqMap.get("authToken"));
|
||||
logger.debug("[Email Send Request - userId : {}]", mailReqMap.get("userId"));
|
||||
logger.debug("[Email Send Request - tmpPwd : {}]", mailReqMap.get("tmpPwd"));
|
||||
logger.debug("[Email Send Request - toEmail : {}]", mailReqMap.get("toEmail"));
|
||||
logger.debug("[Email Send Request - fromEmail : {}]", mailReqMap.get("fromEmail"));
|
||||
logger.debug("[Email Send Request - templeteCode : {}]", mailReqMap.get("templeteCode"));
|
||||
logger.debug("[Email Send Request - homeUrl : {}]", mailReqMap.get("homeUrl"));
|
||||
|
||||
mailResultMap = hubeasyApi.sendTemplateMailApi(mailReqMap);
|
||||
|
||||
if(mailResultMap != null) {
|
||||
logger.debug("[Email Send API RESULT : {}]", mailResultMap.get("API_RSLT"));
|
||||
if("F".equals(mailResultMap.get("API_RSLT"))) {
|
||||
logger.debug("[Email Send API ERROR : {}]", mailResultMap.get("API_RSLT_MSG"));
|
||||
}
|
||||
}
|
||||
logger.debug("############## [Email Send End] ###############");
|
||||
|
||||
} catch (Exception e) {
|
||||
errInsertMassUsers.add(insertMassUsers.get(j));
|
||||
}
|
||||
@@ -692,49 +777,49 @@ public class CustMgtService {
|
||||
* @
|
||||
*/
|
||||
public UpdateAdminInfoTotalResDto updateAdminInfoTotal(UpdateAdminInfoTotalReqDto updateAdminInfoTotalReqDto) {
|
||||
|
||||
|
||||
CustMgtMapper custMgtMapper = sqlSessionMaster.getMapper(CustMgtMapper.class);
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
Map<String, Object> rstAmtMap = new HashMap<String, Object>();
|
||||
try {
|
||||
// 1. 사용자 정보 update
|
||||
// 1. 사용자 정보 update
|
||||
custMgtMapper.updateAdminInfoTotal(updateAdminInfoTotalReqDto);
|
||||
|
||||
|
||||
// 2. 메모정보 insert
|
||||
custMgtMapper.insertMemo(updateAdminInfoTotalReqDto);
|
||||
|
||||
// 3. 발송 한도 update
|
||||
|
||||
// 3. 발송 한도 update
|
||||
if(updateAdminInfoTotalReqDto.getSendingLimit() != null) {
|
||||
BigDecimal sendingLimitAmt = new BigDecimal(updateAdminInfoTotalReqDto.getSendingLimit());
|
||||
|
||||
|
||||
paramMap.put("userId", updateAdminInfoTotalReqDto.getUserId());
|
||||
// 3-1. 기존 정액한도금액 조회
|
||||
rstAmtMap = custMgtMapper.selectAdminSendingLimt(paramMap);
|
||||
if(rstAmtMap.get("fxLmtAmt") != null) {
|
||||
String stFxLmtAmt = rstAmtMap.get("fxLmtAmt").toString();
|
||||
BigDecimal fxLmtAmt = new BigDecimal(stFxLmtAmt);
|
||||
|
||||
|
||||
BigDecimal targetMrtLmtAmt = new BigDecimal(0);
|
||||
|
||||
|
||||
// 변동요청발송한도금액이 기존정액한도금액보다 작으면 한도금액 변경 불가 실패처리
|
||||
if(sendingLimitAmt.compareTo(fxLmtAmt) < 0) {
|
||||
return new UpdateAdminInfoTotalResDto(ApiResponseCode.CE_SENDINGLIMT_ERROR);
|
||||
}
|
||||
|
||||
|
||||
// 3-2. 발송한도금액 수정(종량 한도금액 UPDATE)
|
||||
// 변동요청발송한도금액 - 기존정액한도금액 = 변경할 종량한도금액
|
||||
targetMrtLmtAmt = sendingLimitAmt.subtract(fxLmtAmt);
|
||||
paramMap.put("sendingLimit", targetMrtLmtAmt);
|
||||
|
||||
custMgtMapper.updateAdminSendingLimit(paramMap);
|
||||
}
|
||||
targetMrtLmtAmt = sendingLimitAmt.subtract(fxLmtAmt);
|
||||
paramMap.put("sendingLimit", targetMrtLmtAmt);
|
||||
|
||||
custMgtMapper.updateAdminSendingLimit(paramMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
return new UpdateAdminInfoTotalResDto(ApiResponseCode.CM_DB_QUERY_ERR);
|
||||
}
|
||||
|
||||
|
||||
return new UpdateAdminInfoTotalResDto(ApiResponseCode.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,4 +19,6 @@ public class CarryOver implements Serializable {
|
||||
private String krrrAmount;
|
||||
@ApiModelProperty(example = "소멸금액", name = "소멸금액", dataType = "String")
|
||||
private String extshAmount;
|
||||
|
||||
private String colecTms;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package kr.co.uplus.ez.api.custMgt.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
public class SubsInfo implements Serializable{
|
||||
@@ -11,7 +11,7 @@ public class SubsInfo implements Serializable{
|
||||
/** 청약_ID . */
|
||||
private String subsId;
|
||||
/** 유큐브_가입_번호 */
|
||||
private String uqvSbscNo;
|
||||
private String entrNo;
|
||||
/** 관리자_일련번호. */
|
||||
private String userSeq;
|
||||
/** 고객_일련번호 . */
|
||||
|
||||
@@ -142,7 +142,13 @@ public class LoginController {
|
||||
|
||||
String nextUrl = getReturnUrl(request, response);
|
||||
logger.debug("login SUCCESS - nextUrl = [{}]", nextUrl);
|
||||
ChkAuthNumResDto result = new ChkAuthNumResDto(ApiResponseCode.SUCCESS, new LoginRes(SecurityConfig.LOGIN_SUCC_URL));
|
||||
AuthUser authUser = loginService.getUser(authentication.getName());
|
||||
|
||||
LoginRes loginRes = new LoginRes(SecurityConfig.LOGIN_SUCC_URL);
|
||||
loginRes.setUserId(authUser.getOprtrId());
|
||||
loginRes.setUserNm(authUser.getOprtrNm());
|
||||
|
||||
ChkAuthNumResDto result = new ChkAuthNumResDto(ApiResponseCode.SUCCESS, loginRes);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -159,7 +165,13 @@ public class LoginController {
|
||||
|
||||
String nextUrl = getReturnUrl(request, response);
|
||||
logger.debug("login SUCCESS - nextUrl = [{}]", nextUrl);
|
||||
ChkAuthNumResDto result = new ChkAuthNumResDto(rCode, new LoginRes(SecurityConfig.LOGIN_SUCC_URL));
|
||||
AuthUser authUser = loginService.getUser(authentication.getName());
|
||||
|
||||
LoginRes loginRes = new LoginRes(SecurityConfig.LOGIN_SUCC_URL);
|
||||
loginRes.setUserId(authUser.getOprtrId());
|
||||
loginRes.setUserNm(authUser.getOprtrNm());
|
||||
|
||||
ChkAuthNumResDto result = new ChkAuthNumResDto(rCode, loginRes);
|
||||
return result;
|
||||
}else {
|
||||
ChkAuthNumResDto result = new ChkAuthNumResDto(rCode);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package kr.co.uplus.ez.api.login;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import kr.co.uplus.ez.api.login.dto.AuthNum;
|
||||
import kr.co.uplus.ez.api.login.dto.AuthUser;
|
||||
import kr.co.uplus.ez.api.login.dto.SendMsgDto;
|
||||
import kr.co.uplus.ez.api.login.dto.SmsAuthNum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface LoginMapper {
|
||||
@@ -30,4 +30,6 @@ public interface LoginMapper {
|
||||
|
||||
// 관리자 정보 수정.
|
||||
int updateAdmUser(AuthUser authUser);
|
||||
|
||||
void insertSendMsg(SendMsgDto sendMsgDto);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package kr.co.uplus.ez.api.login;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kr.co.uplus.ez.api.login.dto.*;
|
||||
import kr.co.uplus.ez.common.data.ApiResponseCode;
|
||||
import kr.co.uplus.ez.common.data.Const;
|
||||
import kr.co.uplus.ez.common.utils.DateUtils;
|
||||
import kr.co.uplus.ez.common.utils.EncryptionUtil;
|
||||
import kr.co.uplus.ez.common.utils.TextUtils;
|
||||
import kr.co.uplus.ez.config.SecurityConfig;
|
||||
import org.apache.commons.codec.binary.StringUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
@@ -12,23 +17,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import kr.co.uplus.ez.api.login.dto.AuthNum;
|
||||
import kr.co.uplus.ez.api.login.dto.AuthNumReqDto;
|
||||
import kr.co.uplus.ez.api.login.dto.AuthNumResDto;
|
||||
import kr.co.uplus.ez.api.login.dto.AuthUser;
|
||||
import kr.co.uplus.ez.api.login.dto.ChkAuthNumReqDto;
|
||||
import kr.co.uplus.ez.api.login.dto.LoginReqDto;
|
||||
import kr.co.uplus.ez.api.login.dto.LoginRes;
|
||||
import kr.co.uplus.ez.api.login.dto.LoginResDto;
|
||||
import kr.co.uplus.ez.api.login.dto.ResetPasswordReqDto;
|
||||
import kr.co.uplus.ez.api.login.dto.ResetPasswordResDto;
|
||||
import kr.co.uplus.ez.api.login.dto.UpdatePasswordReqDto;
|
||||
import kr.co.uplus.ez.api.login.dto.UpdatePasswordResDto;
|
||||
import kr.co.uplus.ez.common.data.ApiResponseCode;
|
||||
import kr.co.uplus.ez.common.data.Const;
|
||||
import kr.co.uplus.ez.common.utils.EncryptionUtil;
|
||||
import kr.co.uplus.ez.common.utils.TextUtils;
|
||||
import kr.co.uplus.ez.config.SecurityConfig;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class LoginService {
|
||||
@@ -160,7 +149,13 @@ public class LoginService {
|
||||
loginMapper.addAuthNum(anum);
|
||||
|
||||
// 문자발송
|
||||
// TODO -> hubez_send.EZ_MSG_REAL 등록 필요.
|
||||
String clientKey = DateUtils.date2strYMDHMS() + "AD" + RandomStringUtils.randomAlphanumeric(8);
|
||||
SendMsgDto sendMsgDto = new SendMsgDto();
|
||||
sendMsgDto.setClientKey(clientKey);
|
||||
sendMsgDto.setMsg("인증 번호는 [" + authNum + "] 입니다.");
|
||||
sendMsgDto.setPhone(user.getHpNo());
|
||||
|
||||
loginMapper.insertSendMsg(sendMsgDto);
|
||||
|
||||
return new AuthNumResDto();
|
||||
|
||||
@@ -254,7 +249,13 @@ public class LoginService {
|
||||
}
|
||||
|
||||
// 4. 임시 비밀번호 문자발송
|
||||
// TODO -> hubez_send.EZ_MSG_REAL 등록 필요.
|
||||
String clientKey = DateUtils.date2strYMDHMS() + "AD" + RandomStringUtils.randomAlphanumeric(8);
|
||||
SendMsgDto sendMsgDto = new SendMsgDto();
|
||||
sendMsgDto.setClientKey(clientKey);
|
||||
sendMsgDto.setMsg("[U+메시지허브이지] \n임시 비밀번호 안내 : " + randomPw + "\n로그인 후, 비밀번호 변경해주세요.\n");
|
||||
sendMsgDto.setPhone(user.getHpNo());
|
||||
|
||||
loginMapper.insertSendMsg(sendMsgDto);
|
||||
|
||||
return new ResetPasswordResDto();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package kr.co.uplus.ez.api.login.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@Data
|
||||
public class LoginRes implements Serializable {
|
||||
@@ -12,6 +12,12 @@ public class LoginRes implements Serializable {
|
||||
@ApiModelProperty(name = "메인 URL", example = "메인 URL", dataType = "String")
|
||||
private String nextUrl;
|
||||
|
||||
@ApiModelProperty(name = "사용자ID", example = "사용자ID", dataType = "String")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(name = "사용자명", example = "사용자명", dataType = "String")
|
||||
private String userNm;
|
||||
|
||||
|
||||
public LoginRes(String nextUrl) {
|
||||
super();
|
||||
|
||||
12
src/main/java/kr/co/uplus/ez/api/login/dto/SendMsgDto.java
Normal file
12
src/main/java/kr/co/uplus/ez/api/login/dto/SendMsgDto.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package kr.co.uplus.ez.api.login.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
// 인증문자
|
||||
@Data
|
||||
public class SendMsgDto {
|
||||
|
||||
private String clientKey; // 클라이언트키
|
||||
private String msg; // 발송 메시지
|
||||
private String phone; // 수신번호
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package kr.co.uplus.ez.common.components;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.client.MultipartBodyBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
@Component
|
||||
public class HubeasyApiComponents {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(HubeasyApiComponents.class);
|
||||
|
||||
@Autowired
|
||||
private WebClientRequestService clientRequestService;
|
||||
|
||||
@Value("${msghubez.api-url:http://localhost:7070}")
|
||||
private String apiDomain;
|
||||
|
||||
@Value("${msghubez.uri.sendTemplateMail:/api/v1/fo/sendTemplateMail}")
|
||||
private String apiSendTemplateMail;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<Object, Object> sendTemplateMailApi(Map<Object, Object> apiReqMap) {
|
||||
|
||||
Map<Object, Object> apiResultMap = new HashMap<Object, Object>();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
String callUrl = apiDomain + apiSendTemplateMail;
|
||||
String applicationId = (String) apiReqMap.get("applicationId");
|
||||
String authToken = (String) apiReqMap.get("authToken");
|
||||
|
||||
jsonObject.put("userId", apiReqMap.get("userId"));
|
||||
jsonObject.put("tmpPwd", apiReqMap.get("tmpPwd"));
|
||||
jsonObject.put("homeUrl", apiReqMap.get("homeUrl"));
|
||||
|
||||
String jsonString = jsonObject.toString();
|
||||
|
||||
MultipartBodyBuilder builder = new MultipartBodyBuilder();
|
||||
builder.part("fromEmail", apiReqMap.get("fromEmail"));
|
||||
builder.part("toEmail", apiReqMap.get("toEmail"));
|
||||
builder.part("templeteCode", apiReqMap.get("templeteCode"));
|
||||
builder.part("templeteReplace", jsonString);
|
||||
|
||||
MultiValueMap<String, HttpEntity<?>> parts = builder.build();
|
||||
|
||||
try {
|
||||
|
||||
apiResultMap = (Map<Object, Object>) clientRequestService.callBySyncPostWithTokenMultipart(callUrl, applicationId, authToken, parts);
|
||||
|
||||
if(apiResultMap == null) {
|
||||
apiResultMap.put("API_RSLT", "F");
|
||||
apiResultMap.put("API_RSLT_MSG", "API Result Recive null error");
|
||||
} else {
|
||||
if("0000".equals(apiResultMap.get("retCode"))) {
|
||||
apiResultMap.put("API_RSLT", "S");
|
||||
} else {
|
||||
apiResultMap.put("API_RSLT", "F");
|
||||
apiResultMap.put("API_RSLT_MSG", apiResultMap.get("retMsg"));
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
apiResultMap.put("API_RSLT", "F");
|
||||
apiResultMap.put("API_RSLT_MSG", e.getMessage());
|
||||
}
|
||||
|
||||
return apiResultMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
@@ -40,6 +41,34 @@ public class WebClientRequestService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object callBySyncPostWithToken(String uri, String applicationId, String token, Object param) {
|
||||
LinkedMultiValueMap<Object, Object> reqHearderMap = new LinkedMultiValueMap<Object, Object>();
|
||||
reqHearderMap.add("ApplicationId", applicationId);
|
||||
reqHearderMap.add("AuthToken", token);
|
||||
Date startTime = new Date();
|
||||
log.info(param.toString());
|
||||
Object result = webClient.mutate().defaultHeaders(this.setHttpHeader(reqHearderMap)).build().post().uri(uri)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.bodyValue(param).retrieve()
|
||||
.bodyToMono(Object.class).block();
|
||||
log.info("callBySyncPostWithToken duration Time : {}", (new Date().getTime() - startTime.getTime()) / 1000f);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Object callBySyncPostWithTokenMultipart(String uri, String applicationId, String token, Object param) {
|
||||
LinkedMultiValueMap<Object, Object> reqHearderMap = new LinkedMultiValueMap<Object, Object>();
|
||||
reqHearderMap.add("ApplicationId", applicationId);
|
||||
reqHearderMap.add("AuthToken", token);
|
||||
Date startTime = new Date();
|
||||
log.info(param.toString());
|
||||
Object result = webClient.mutate().defaultHeaders(this.setHttpHeader(reqHearderMap)).build().post().uri(uri)
|
||||
.contentType(MediaType.MULTIPART_FORM_DATA)
|
||||
.bodyValue(param).retrieve()
|
||||
.bodyToMono(Object.class).block();
|
||||
log.info("callBySyncPostWithToken duration Time : {}", (new Date().getTime() - startTime.getTime()) / 1000f);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 헤더 추가.
|
||||
|
||||
Reference in New Issue
Block a user