fo bo 머지작업(mngr)

This commit is contained in:
jazz
2025-11-13 10:54:24 +09:00
parent 7c2b0162f5
commit 5b2f542b68
12 changed files with 2515 additions and 533 deletions

View File

@@ -1,20 +1,39 @@
package com.wb.domainserver.domain.mngr.mngrstr.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wb.domainserver.common.msg.GconeMessageSource;
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
import com.wb.domainserver.common.prop.PaginationProperties;
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
import com.wb.domainserver.domain.admin.store.sopmal.vo.BOMaSopmalVO;
import com.wb.domainserver.domain.admin.user.mngr.service.BOJobUserService;
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
import com.wb.domainserver.domain.gcone.common.vo.BOCommonVO;
import com.wb.domainserver.domain.gcone.mbr.mbr.service.BOMbrService;
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOMbrVO;
import com.wb.domainserver.domain.gcone.mngrstr.service.BOMngrStrService;
import com.wb.domainserver.domain.gcone.mngrstr.vo.BOMngrStrVO;
import com.wb.domainserver.domain.mngr.mbr.vo.MbrVO;
import com.wb.domainserver.domain.mngr.mngrstr.vo.MngrStrVO;
import com.wb.domainserver.exception.WnbtRestException;
import com.wb.domainserver.exception.code.ErrorCode;
import com.wb.domainserver.response.WnbtResponse;
import com.wb.domainserver.response.WnbtResponseBody;
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
import com.wb.domainserver.security.authentication.AnonymousUser;
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
import com.wb.domainserver.security.authorization.annotation.Policy;
import com.wb.domainserver.util.communicate.*;
import com.wb.domainserver.util.dataaccess.DataMap;
import com.wb.domainserver.util.excel.ExcelDownloadUtil;
import com.wb.domainserver.util.file.service.FileStorageService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@@ -54,6 +73,20 @@ public class MngrStrController {
@Autowired
private GconeMessageSource gconeMessageSource;
@Autowired
private BOMngrStrService service;
@Autowired
private BOCommonService commonService;
@Autowired
private BOMaSopmalService maSopmalservice;
@Autowired
private PaginationProperties paginationProperties;
@Autowired
private BOMbrService boMbrService;
/**
* 매장 목록 검색 화면
* @param model
@@ -62,21 +95,60 @@ public class MngrStrController {
*/
@Policy(AuthPolicy.RESTRICTED)
@RequestMapping(value = "/selectMngrStrListRForm")
public String selectStrListRForm(ModelMap model, MngrStrVO vo) {
// BO 매장 목록 조회 호출
public String selectStrListRForm(ModelMap model, BOMngrStrVO vo) {
Map<String, Object> content = new HashMap<>();
//페이징 처리를 위한 pagination 객체 생성
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(vo.getPageIndex());
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
paginationInfo.setPageSize(paginationProperties.getPageSize());
vo.setPaginationInfo(paginationInfo);
//페이징 처리를 위한 값 설정
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
vo.setLastIndex(paginationInfo.getLastRecordIndex());
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
//페이징정보
content.put("paginationInfo", vo.getPaginationInfo());
content.put("BOMngrStrVO", vo);
//관리법인
content.put("manageCpr", service.selectBOMngrStrComnCd("MANAGE_CPR"));
//대표 브랜드
content.put("reprsntBrand", service.selectBOMngrStrComnCd("REPRSNT_BRAND"));
//취급 브랜드
content.put("trtmntBrand", service.selectBOMngrStrComnCd("TRTMNT_BRAND"));
try {
responseHandler.handleResponse(
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrListInqireForm", vo),
model,
"resultListMap"
);
// model.addAttribute("mngrStrVO", vo);
} catch (WnbtRestException wre){
throw new WnbtRestException(wre.getMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
ObjectMapper objectMapper = new ObjectMapper();
String trtmntBrandJson = objectMapper.writeValueAsString(service.selectBOMngrStrComnCd("TRTMNT_BRAND"));
content.put("trtmntBrandJson", trtmntBrandJson);
}catch(JsonProcessingException jpe){
log.error(jpe.getMessage());
throw new WnbtRestException(ErrorCode.JACKSON_PROCESS_ERROR);
}catch(Exception e){
log.error(e.getMessage());
throw new WnbtRestException(ErrorCode.INTERNAL_SERVER_ERROR);
}
//매장개설구분
content.put("strEstblDvCd", service.selectBOMngrStrComnCd("STR_ESTBL_DV"));
//매장운영구분
content.put("strOperDv", service.selectBOMngrStrComnCd("STR_DV"));
//상태
content.put("tentSttus", service.selectBOMngrStrComnCd("TENT_STTUS"));
//포스코드-구분값
content.put("posCdDvVal", service.selectBOMngrStrComnCd("POS_HDQRTRS"));
model.addAttribute("resultListMap", content);
// responseHandler.handleResponse(
// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrListInqireForm", vo),
// model,
// "resultListMap"
// );
return "mngr/mngrstr/StoreListRForm";
}
@@ -88,20 +160,34 @@ public class MngrStrController {
*/
@Policy(AuthPolicy.RESTRICTED)
@RequestMapping(value = "/selectMngrStrList")
public String selectStrList(ModelMap model, MngrStrVO vo) {
// BO 매장 목록 조회 호출
try {
responseHandler.handleResponse(
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrListInqire", vo),
model,
"resultListMap"
);
model.addAttribute("mngrStrVO", vo);
} catch (WnbtRestException wre){
throw new WnbtRestException(wre.getMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
}
public String selectStrList(ModelMap model, BOMngrStrVO vo) {
Map<String, Object> content = new HashMap<>();
//페이징 처리를 위한 pagination 객체 생성
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(vo.getPageIndex());
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
paginationInfo.setPageSize(paginationProperties.getPageSize());
vo.setPaginationInfo(paginationInfo);
//페이징 처리를 위한 값 설정
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
vo.setLastIndex(paginationInfo.getLastRecordIndex());
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
//매장 목록 조회 결과 및 페이징정보
content.put("paginationInfo", vo.getPaginationInfo());
content.put("boCtrlMap", service.selectBOMngrStrListInqire(vo));
content.put("BOMngrStrVO", vo);
model.addAttribute("resultListMap", content);
// responseHandler.handleResponse(
// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrListInqire", vo),
// model,
// "resultListMap"
// );
model.addAttribute("mngrStrVO", vo);
return "mngr/mngrstr/StoreListR";
}
@@ -113,18 +199,37 @@ public class MngrStrController {
*/
@Policy(AuthPolicy.RESTRICTED)
@RequestMapping(value = "/selectMngrStrListExcelDwld")
public void selectMngrStrListExcelDwld(MngrStrVO vo, HttpServletResponse response) {
public void selectMngrStrListExcelDwld(BOMngrStrVO vo, HttpServletResponse response) {
//10000건까지 엑셀 출력
vo.setPageIndex(1);
vo.setPageUnit(10000);
Map<String,Object> resultMap = responseHandler.handleResponseAsMap(
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrListInqire", vo)
);
Map<String, Object> content = new HashMap<>();
//페이징 처리를 위한 pagination 객체 생성
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(vo.getPageIndex());
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
paginationInfo.setPageSize(paginationProperties.getPageSize());
vo.setPaginationInfo(paginationInfo);
//페이징 처리를 위한 값 설정
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
vo.setLastIndex(paginationInfo.getLastRecordIndex());
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
//매장 목록 조회 결과 및 페이징정보
content.put("paginationInfo", vo.getPaginationInfo());
content.put("boCtrlMap", service.selectBOMngrStrListInqire(vo));
content.put("BOMngrStrVO", vo);
// Map<String,Object> resultMap = responseHandler.handleResponseAsMap(
// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrListInqire", vo)
// );
List<Map<String, Object>> resultMapList = new ArrayList<>();
if(resultMap != null) {
resultMapList = (List<Map<String, Object>>) resultMap.get("boCtrlMap");
if(content != null) {
resultMapList = (List<Map<String, Object>>) content.get("boCtrlMap");
}
List<Map<String, Object>> dataList = new ArrayList<>();
@@ -181,6 +286,10 @@ public class MngrStrController {
try {
ExcelDownloadUtil.createExcel("mngr_str_list" + str, headerMap, dataList, response);
}catch(IOException ioe) {
log.error(ioe.getMessage());
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
}catch(Exception e){
log.error(e.getMessage());
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
}
}
@@ -212,18 +321,40 @@ public class MngrStrController {
*/
@Policy(AuthPolicy.RESTRICTED)
@RequestMapping(value = "/selectMngrStrDtlU")
public String selectStrDtlU(ModelMap model, MngrStrVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
public String selectStrDtlU(ModelMap model, BOMngrStrVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
vo.setSopmalCd(authSopmalCd);
// BO 매장 목록 조회 호출
try {
Map<String, Object> resultMap = responseHandler.handleResponseAsMap(
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrDtlInqire", vo)
);
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
if("01".equals(user.getSysDvCd())){
vo.setSopmalCd(user.getSopmalCd());
}
Map<String, Object> content = new HashMap<>();
//매장 상세 조회 결과
DataMap boCtrlMap = service.selectBOMngrStrDtlInqire(vo);
content.put("boCtrlMap", boCtrlMap);
content.put("BOMngrStrVO", vo);
//쇼핑몰 상세 조회(쇼핑몰 도메인 조회용)
BOMaSopmalVO boMaSopmalVO = new BOMaSopmalVO();
boMaSopmalVO.setSopmalCd((String) boCtrlMap.get("reprsntBrandCd"));
content.put("sopmalDetail", maSopmalservice.selectBOSopmalUpdtForm(boMaSopmalVO));
//대표 브랜드
ObjectMapper objectMapper = new ObjectMapper();
String reprsntBrandJson = objectMapper.writeValueAsString(service.selectBOMngrStrComnCd("REPRSNT_BRAND"));
content.put("reprsntBrandJson", reprsntBrandJson);
// Map<String, Object> resultMap = responseHandler.handleResponseAsMap(
// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOMngrStrDtlInqire", vo)
// );
String kakaoKey = "";
if(resultMap.containsKey("BOMngrStrVO")){
Map<String, Object> paramVO = (Map<String, Object>) resultMap.get("BOMngrStrVO");
if(content.containsKey("BOMngrStrVO")){
Map<String, Object> paramVO = (Map<String, Object>) content.get("BOMngrStrVO");
if(!ObjectUtils.isEmpty(paramVO.get("sopmalCd"))){
kakaoKey = kakaoProperties.getKeyForDomain(paramVO.get("sopmalCd").toString());
@@ -231,12 +362,14 @@ public class MngrStrController {
}
model.addAttribute("kakaoKey", kakaoKey);
model.addAttribute("resultMap", resultMap);
model.addAttribute("resultMap", content);
// model.addAttribute("MngrStrVO", vo);
} catch (WnbtRestException wre){
throw new WnbtRestException(wre.getMessage());
log.error(wre.getMessage());
throw wre;
} catch (Exception e) {
log.error(e.getMessage(), e);
log.error(e.getMessage());
throw new WnbtRestException(ErrorCode.INTERNAL_SERVER_ERROR);
}
return "mngr/mngrstr/StoreDtlU";
@@ -247,12 +380,26 @@ public class MngrStrController {
* @return
*/
@Policy(AuthPolicy.PUBLIC)
@RequestMapping(value="/selectIdDplctCnfirm")
public ResponseEntity<WnbtResponse> selectIdDplctCnfirm(MngrStrVO vo, BindingResult bindingResult){
return responseHandler.handleResponse(
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOIdDplctCnfirm", vo),
ReplyFromResrc::getReply
@RequestMapping(value="/selectIdDplctCnfirm", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<WnbtResponse> selectIdDplctCnfirm(BOMbrVO vo, BindingResult bindingResult){
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
if("01".equals(user.getSysDvCd())){
vo.setSopmalCd(user.getSopmalCd());
}
vo.setMbrDvCd(boMbrService.selectBOMbrDvCd(vo));
DataMap content = new DataMap();
content = boMbrService.selectBOIdDplctCnfirm(vo);
return ResponseEntity.ok(
WnbtResponse.builder()
.resBody(new WnbtResponseBody(content))
.build()
);
// return responseHandler.handleResponse(
// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOIdDplctCnfirm", vo),
// ReplyFromResrc::getReply
// );
}
/**
@@ -262,8 +409,8 @@ public class MngrStrController {
* @return ResponseEntity<WnbtResponse>
*/
@Policy(AuthPolicy.RESTRICTED)
@RequestMapping(value = "/updateMngrStrDtlU", method = RequestMethod.POST)
public ResponseEntity<WnbtResponse> updateMngrStrDtlU(@Validated MngrStrVO vo, HttpServletRequest request, BindingResult bindingResult, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
@RequestMapping(value = "/updateMngrStrDtlU", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<WnbtResponse> updateMngrStrDtlU(@Validated BOMngrStrVO vo, HttpServletRequest request, BindingResult bindingResult, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
vo.setSopmalCd(authSopmalCd);
if(bindingResult.hasErrors()) {
@@ -300,10 +447,65 @@ public class MngrStrController {
ulpladFileMap = filestore.fileUpload(request);
vo.setFileInfo(ulpladFileMap);
return responseHandler.handleResponse(
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/updateBOMngrStrDtlU", vo),
ReplyFromResrc::getReply
//사용자 정보 추출 및 적용
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
if("01".equals(user.getSysDvCd())){
vo.setSopmalCd(user.getSopmalCd());
}
vo.setUpdusr(user.getUserInnb());
if(vo.getChangePasswordAt().equals("Y")){
BOCommonVO commVO = new BOCommonVO();
commVO.setPass(vo.getNewPassword()); // 변경할 비밀번호
commVO.setEncptKeyDvCd("03"); // 매장
commVO.setIdntfcInnb(String.valueOf(vo.getStrInnb())); // 회원고유번호
//변경할 비밀번호 암호화
String newPwd = commonService.generateKey(commVO);
vo.setNewPassword(newPwd);
}
List<HashMap<String, Object>> fileInfoList = vo.getFileInfo();
int fileIndex = 0;
// 매장 대표이미지
// 파일 업로드를 통해 대표이미지를 추가했을 때
if (vo.getStrReprsntImg() != null && vo.getStrReprsntImg().equals("1")) {
fileIndex = 1;
if (!fileInfoList.isEmpty()) {
String filePath = fileInfoList.get(0).get("filePath").toString().replace("\\", "/");
String fileId = fileInfoList.get(0).get("fileId").toString();
vo.setStrReprsntImg(filePath + "/" + fileId);
}
}
// 매장 상세이미지
String strDtlImg = vo.getStrDtlImg();
for (; fileIndex < fileInfoList.size(); fileIndex++) {
Map<String, Object> fileInfo = fileInfoList.get(fileIndex);
String filePath = fileInfo.get("filePath").toString().replace("\\", "/");
String fileId = fileInfo.get("fileId").toString();
if (strDtlImg.isEmpty()) {
strDtlImg = filePath + "/" + fileId;
} else {
strDtlImg += "|" + filePath + "/" + fileId;
}
}
vo.setStrDtlImg(strDtlImg);
Map<String, Object> message = new HashMap<>();
message = service.updateBOMngrStrDtlU(vo);
return ResponseEntity.ok(
WnbtResponse.builder()
.resBody(new WnbtResponseBody(message))
.build()
);
// return responseHandler.handleResponse(
// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/updateBOMngrStrDtlU", vo),
// ReplyFromResrc::getReply
// );
}
@@ -332,16 +534,35 @@ public class MngrStrController {
*/
@Policy(AuthPolicy.RESTRICTED)
@RequestMapping(value = "/selectPosJoinMbrUrlList")
public String selectPosJoinMbrUrlList(MbrVO vo, ModelMap model, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
public String selectPosJoinMbrUrlList(BOMbrVO vo, ModelMap model, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
vo.setSopmalCd(authSopmalCd);
// BO 회원 목록조회 API 호출
responseHandler.handleResponse(
sendToResrc.ofPost(RESRC.GCONEBO,"/gcone/mbr/mbr/selectBOPosJoinMbrUrl", vo)
, model
,"resultMap"
);
DataMap content = new DataMap();
List<DataMap> resultList = new ArrayList<>();
// 페이징 객체 생성 & 페이징정보 할당
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(vo.getPageIndex());
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
paginationInfo.setPageSize(paginationProperties.getPageSize());
vo.setPaginationInfo(paginationInfo);
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
vo.setLastIndex(paginationInfo.getLastRecordIndex());
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
vo.setSecretKey(commonService.selectSecretkey());
resultList = boMbrService.selectBOPosJoinMbrUrl(vo);
content.put("list", resultList);
content.put("vo", vo);
content.put("paginationInfo", vo.getPaginationInfo());
model.addAttribute("resultMap", content);
// responseHandler.handleResponse(
// sendToResrc.ofPost(RESRC.GCONEBO,"/gcone/mbr/mbr/selectBOPosJoinMbrUrl", vo)
// , model
// ,"resultMap"
// );
return "mngr/mngrstr/StorePosJoinMbrListR";
}