초기소스
This commit is contained in:
@@ -0,0 +1,348 @@
|
||||
package com.wb.domainserver.domain.mngr.mngrstr.controller;
|
||||
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
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.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
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.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.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.CookieValue;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequestMapping("/mngr/mngrstr")
|
||||
public class MngrStrController {
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
@Autowired
|
||||
private KakaoProperties kakaoProperties;
|
||||
|
||||
@Autowired
|
||||
private FileStorageService filestore;
|
||||
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
|
||||
/**
|
||||
* 매장 목록 검색 화면
|
||||
* @param model
|
||||
* @param vo
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectMngrStrListRForm")
|
||||
public String selectStrListRForm(ModelMap model, MngrStrVO vo) {
|
||||
// BO 매장 목록 조회 호출
|
||||
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);
|
||||
}
|
||||
|
||||
return "mngr/mngrstr/StoreListRForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 매장 목록 조회
|
||||
* @param model
|
||||
* @param vo
|
||||
* @return String
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
return "mngr/mngrstr/StoreListR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 매장 목록 - 엑셀 다운로드
|
||||
* @param vo
|
||||
* @param response
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectMngrStrListExcelDwld")
|
||||
public void selectMngrStrListExcelDwld(MngrStrVO vo, HttpServletResponse response) {
|
||||
//10000건까지 엑셀 출력
|
||||
vo.setPageIndex(1);
|
||||
vo.setPageUnit(10000);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
//엑셀 다운로드 다운로드 시간
|
||||
Date date = new Date();
|
||||
SimpleDateFormat excelFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String str = excelFormat.format(date);
|
||||
//엑셀 항목에 출력될 내용 설정
|
||||
if(resultMapList != null && !resultMapList.isEmpty()) {
|
||||
for (int i = 0; i < resultMapList.size(); i++) {
|
||||
Map<String, Object> row = resultMapList.get(i);
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
|
||||
int caculateSize = calculateSize(resultMapList.size(), i);
|
||||
String manageCpr = getSafeString(row, "manageCpr");
|
||||
String reprsntBrand = getSafeString(row, "reprsntBrand");
|
||||
String tentSttus = row.get("tentSttus") != null ? row.get("tentSttus").toString() : "";
|
||||
String opbizDe = row.get("opbizDe") != null ? row.get("opbizDe").toString() : "";
|
||||
String clstrDe = row.get("clstrDe") != null ? row.get("clstrDe").toString() : "";
|
||||
String posCdDvVal = row.get("posCdDvVal") != null ? row.get("posCdDvVal").toString() : "";
|
||||
String posCdPassivInputVal = row.get("posCdPassivInputVal") != null ? row.get("posCdPassivInputVal").toString() : "";
|
||||
|
||||
dataMap.put("rnum", caculateSize); //번호 역순 출력
|
||||
dataMap.put("manageCpr/reprsntBrand", manageCpr+" / "+reprsntBrand);
|
||||
dataMap.put("trtmntBrand", row.get("trtmntBrand"));
|
||||
dataMap.put("strOperDv", row.get("strOperDv"));
|
||||
dataMap.put("tentSttus", tentSttus +
|
||||
(
|
||||
row.get("tentSttusCd").equals("02")
|
||||
? "(" + opbizDe + ")"
|
||||
: row.get("tentSttusCd").equals("03")
|
||||
? "(" + clstrDe + ")"
|
||||
: ""
|
||||
)
|
||||
);
|
||||
dataMap.put("posCd", posCdDvVal + posCdPassivInputVal);
|
||||
dataMap.put("tentcpnId", row.get("tentcpnId"));
|
||||
dataMap.put("tentcpnNm", row.get("tentcpnNm"));
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
}
|
||||
|
||||
//엑셀 항목별 제목에 출력될 내용 설정
|
||||
LinkedHashMap<String, String> headerMap = new LinkedHashMap<String, String>();
|
||||
headerMap.put("rnum", "번호");
|
||||
headerMap.put("manageCpr/reprsntBrand", "관리법인/대표브랜드");
|
||||
headerMap.put("trtmntBrand", "취급브랜드");
|
||||
headerMap.put("strOperDv", "매장운영구분");
|
||||
headerMap.put("tentSttus", "상태");
|
||||
headerMap.put("posCd", "포스코드");
|
||||
headerMap.put("tentcpnId", "ID");
|
||||
headerMap.put("tentcpnNm", "매장명");
|
||||
|
||||
try {
|
||||
ExcelDownloadUtil.createExcel("mngr_str_list" + str, headerMap, dataList, response);
|
||||
}catch(IOException ioe) {
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 안전하게 계산 처리 메소드
|
||||
* @param size
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
private int calculateSize(int size, int index) {
|
||||
return size - index;
|
||||
}
|
||||
|
||||
/**
|
||||
* 안전하게 계산 처리 메소드
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public String getSafeString(Map<String, Object> row, String input) {
|
||||
return row.get(input) != null ? row.get(input).toString() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 매장 상세
|
||||
* @param model
|
||||
* @param vo
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectMngrStrDtlU")
|
||||
public String selectStrDtlU(ModelMap model, MngrStrVO 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)
|
||||
);
|
||||
|
||||
String kakaoKey = "";
|
||||
if(resultMap.containsKey("BOMngrStrVO")){
|
||||
Map<String, Object> paramVO = (Map<String, Object>) resultMap.get("BOMngrStrVO");
|
||||
|
||||
if(!ObjectUtils.isEmpty(paramVO.get("sopmalCd"))){
|
||||
kakaoKey = kakaoProperties.getKeyForDomain(paramVO.get("sopmalCd").toString());
|
||||
}
|
||||
}
|
||||
|
||||
model.addAttribute("kakaoKey", kakaoKey);
|
||||
model.addAttribute("resultMap", resultMap);
|
||||
// model.addAttribute("MngrStrVO", vo);
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return "mngr/mngrstr/StoreDtlU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 매장 아이디 중복 확인
|
||||
* @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
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 매장 상세 수정
|
||||
* @param vo
|
||||
* @param bindingResult 바인딩 및 정합성 점검결과 객체
|
||||
* @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) {
|
||||
vo.setSopmalCd(authSopmalCd);
|
||||
|
||||
if(bindingResult.hasErrors()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convert(bindingResult, gconeMessageSource));
|
||||
}
|
||||
|
||||
if(vo.getChangePasswordAt().equals("Y")){
|
||||
/*1 비밀번호 변경 시 현재 비밀번호 확인*/
|
||||
Map<String, Object> resultMap = responseHandler.handleResponseAsMap(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/selectBOPasswordCnfirm", vo)
|
||||
);
|
||||
if ((int) resultMap.get("result") == 0) {
|
||||
throw new WnbtRestException("관리자 비밀번호가 일치하지 않습니다");
|
||||
}
|
||||
|
||||
/*2 비밀번호 정규 표현식 확인*/
|
||||
String password = vo.getNewPassword();
|
||||
String pwPattern = "^(?=.*[a-zA-Z])(?=.*\\d)(?=.*\\W)?[a-zA-Z\\d\\W]{10,20}$|^(?=.*[a-zA-Z])(?=.*\\W)(?=.*\\d)?[a-zA-Z\\W\\d]{10,20}$|^(?=.*\\d)(?=.*\\W)(?=.*[a-zA-Z])?[a-zA-Z\\d\\W]{10,20}$";
|
||||
Matcher matcher = Pattern.compile(pwPattern).matcher(password);
|
||||
|
||||
if (!matcher.matches()) {
|
||||
throw new WnbtRestException("비밀번호는 영문 대소문자/숫자/특수문자 중 2가지 이상 조합한 10~20자로 입력해주세요.");
|
||||
}
|
||||
|
||||
/*3 변경 비밀번호 확인*/
|
||||
if (!password.equals(vo.getNewPasswordChk())) {
|
||||
throw new WnbtRestException("비밀번호가 일치하지 않습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
List<HashMap<String, Object>> ulpladFileMap = new ArrayList<HashMap<String, Object>>();
|
||||
request.setAttribute("shopCd", vo.getSopmalCd());
|
||||
request.setAttribute("pathGubun", "STOR");
|
||||
ulpladFileMap = filestore.fileUpload(request);
|
||||
vo.setFileInfo(ulpladFileMap);
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/mngrstr/updateBOMngrStrDtlU", vo),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 포스 회원가입 URL 조회
|
||||
*
|
||||
* @param vo
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectPosJoinMbrUrl")
|
||||
public String selectPosJoinMbrUrl(MbrVO vo, ModelMap model,@CookieValue(value = "authSopmalCd") String authSopmalCd) {
|
||||
|
||||
vo.setSopmalCd(authSopmalCd);
|
||||
|
||||
model.addAttribute("vo",vo);
|
||||
|
||||
return "mngr/mngrstr/StorePosJoinMbrListRForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 포스 회원가입 URL 조회
|
||||
*
|
||||
* @param vo
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectPosJoinMbrUrlList")
|
||||
public String selectPosJoinMbrUrlList(MbrVO 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"
|
||||
);
|
||||
|
||||
return "mngr/mngrstr/StorePosJoinMbrListR";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.wb.domainserver.domain.mngr.mngrstr.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MngrStrVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
|
||||
/** 쇼핑몰 고유번호 */
|
||||
private String strInnb;
|
||||
|
||||
/**
|
||||
* 매장/가맹점 검색 조건
|
||||
*/
|
||||
|
||||
/** 관리법인 */
|
||||
/* GC_CODE:MANAGE_CPR */
|
||||
private String manageCpr;
|
||||
|
||||
/** 대표브랜드 */
|
||||
/* GC_CODE:REPRSNT_BRAND */
|
||||
private String reprsntBrand;
|
||||
|
||||
/** 취급브랜드 */
|
||||
/* GC_CODE-BRAND:TRTMNT_BRAND */
|
||||
private List<String> trtmntBrand;
|
||||
|
||||
/** 매장개설구분 */
|
||||
/* GC_CODE-BRAN0D:STR_ESTBL_DV */
|
||||
private List<String> strEstblDvCd;
|
||||
|
||||
/** 매장운영구분 */
|
||||
/* GC_CODE:STR_DV */
|
||||
private List<String> strOperDv;
|
||||
|
||||
/** 상태 */
|
||||
/* GC_CODE:TENT_STTUS */
|
||||
private List<String> tentSttus;
|
||||
|
||||
/** 포스코드-구분값 */
|
||||
/* GC_CODE:POS_HDQRTRS */
|
||||
private String posCdDvVal;
|
||||
|
||||
/** 포스코드-수동입력값 */
|
||||
private String posCdPassivInputVal;
|
||||
|
||||
/** 매장명 */
|
||||
private String tentcpnNm;
|
||||
|
||||
/** 정렬 기준 */
|
||||
private String sortDv;
|
||||
|
||||
|
||||
/**
|
||||
* 상세보기(수정)
|
||||
*/
|
||||
|
||||
/** 사이트 노출여부 */
|
||||
private String siteExpsrAt;
|
||||
/** 폐점시 로그인 및 SMS발송 사용여부 */
|
||||
private String awLoginAt;
|
||||
|
||||
/** 아이디 변경여부 */
|
||||
private String changeIdAt;
|
||||
/** 입점사 아이디 */
|
||||
private String tentcpnId;
|
||||
|
||||
/** 비밀번호 변경여부 */
|
||||
private String changePasswordAt;
|
||||
/** 기존 비밀번호 */
|
||||
private String tentcpnPassword;
|
||||
/** 신규 비밀번호 */
|
||||
private String newPassword;
|
||||
/** 신규 비밀번호 확인 */
|
||||
private String newPasswordChk;
|
||||
|
||||
/** 문자 발신번호 */
|
||||
private String chrDsptchNb;
|
||||
|
||||
/** 휴무일 */
|
||||
private String hvofDe;
|
||||
/** 휴무일 추가 */
|
||||
private String hvofDeAdit;
|
||||
|
||||
/** 영업시간 */
|
||||
/* 구분자(|) 영업시간
|
||||
* 구분자(/) 영업시간 추가 */
|
||||
private String bsnTme;
|
||||
|
||||
/** 매장 대표이미지 */
|
||||
private String strReprsntImg;
|
||||
|
||||
/** 매장 상세이미지 */
|
||||
/* 구분자(|) */
|
||||
private String strDtlImg;
|
||||
|
||||
/** 파일 정보 */
|
||||
private List<HashMap<String, Object>> fileInfo;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user