초기소스
This commit is contained in:
@@ -163,7 +163,7 @@ public class MngrLoginController {
|
|||||||
model.addAttribute("shopInfo", shopInfo);
|
model.addAttribute("shopInfo", shopInfo);
|
||||||
|
|
||||||
//디바이스 타입에 따라 조절
|
//디바이스 타입에 따라 조절
|
||||||
return "MO".equals(request.getAttribute("env"))?"login/login-MNGRM":"login/login-MNGR";
|
return "login/login-MNGR";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.wb.domainserver.domain.mngr.main.controller;
|
package com.wb.domainserver.domain.mngr.main.controller;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
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.store.sopmal.vo.BOMaSopmalVO;
|
||||||
import com.wb.domainserver.domain.gcone.main.service.BOMainService;
|
import com.wb.domainserver.domain.gcone.main.service.BOMainService;
|
||||||
|
import com.wb.domainserver.domain.mngr.main.vo.MainVO;
|
||||||
import com.wb.domainserver.realm.RealmContextHolder;
|
import com.wb.domainserver.realm.RealmContextHolder;
|
||||||
import com.wb.domainserver.response.WnbtResponse;
|
import com.wb.domainserver.response.WnbtResponse;
|
||||||
import com.wb.domainserver.response.WnbtResponseBody;
|
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.AnonymousUser;
|
||||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||||
@@ -15,14 +18,12 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.CookieValue;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.util.UriUtils;
|
import org.springframework.web.util.UriUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -41,6 +42,9 @@ public class MngrMainController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BOMaSopmalService maSopmalService;
|
private BOMaSopmalService maSopmalService;
|
||||||
|
|
||||||
|
/** WebClient 호출을 위한 wrapper */
|
||||||
|
@Autowired
|
||||||
|
private WnbtWebClientResponseHandler responseHandler;
|
||||||
|
|
||||||
@Policy(AuthPolicy.PUBLIC)
|
@Policy(AuthPolicy.PUBLIC)
|
||||||
@GetMapping(value="")
|
@GetMapping(value="")
|
||||||
@@ -78,13 +82,14 @@ public class MngrMainController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Policy(AuthPolicy.RESTRICTED)
|
@Policy(AuthPolicy.RESTRICTED)
|
||||||
@RequestMapping(value="/selectMngrMainChart1Inqire")
|
@RequestMapping(value="/selectMngrMainChart1Inqire", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResponseEntity<WnbtResponse> selectMngrMainChart1Inqire() {
|
@ResponseBody
|
||||||
|
public ResponseEntity<WnbtResponse> selectMngrMainChart1Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
||||||
|
|
||||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
mainvo.setSopmalCd(authSopmalCd);
|
||||||
DataMap vo = new DataMap();
|
|
||||||
|
|
||||||
vo.put("sopmalCd", user.getSopmalCd());
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
DataMap vo = objectMapper.convertValue(mainvo, DataMap.class);
|
||||||
|
|
||||||
// 응답 메세지 객체
|
// 응답 메세지 객체
|
||||||
List<DataMap> content = service.selectBOMngrMainChart1Inqire(vo);
|
List<DataMap> content = service.selectBOMngrMainChart1Inqire(vo);
|
||||||
@@ -93,7 +98,6 @@ public class MngrMainController {
|
|||||||
.resBody(new WnbtResponseBody(content))
|
.resBody(new WnbtResponseBody(content))
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,8 +105,13 @@ public class MngrMainController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Policy(AuthPolicy.RESTRICTED)
|
@Policy(AuthPolicy.RESTRICTED)
|
||||||
@RequestMapping(value="/selectMngrMainChart2Inqire")
|
@RequestMapping(value="/selectMngrMainChart2Inqire", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResponseEntity<WnbtResponse> selectMngrMainChart2Inqire(DataMap vo) {
|
public ResponseEntity<WnbtResponse> selectMngrMainChart2Inqire(@CookieValue(value = "authSopmalCd") String authSopmalCd, MainVO mainvo) {
|
||||||
|
|
||||||
|
mainvo.setSopmalCd(authSopmalCd);
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
DataMap vo = objectMapper.convertValue(mainvo, DataMap.class);
|
||||||
|
|
||||||
// 응답 메세지 객체
|
// 응답 메세지 객체
|
||||||
List<DataMap> content = service.selectBOMngrMainChart2Inqire(vo);
|
List<DataMap> content = service.selectBOMngrMainChart2Inqire(vo);
|
||||||
return ResponseEntity.ok(
|
return ResponseEntity.ok(
|
||||||
@@ -110,6 +119,7 @@ public class MngrMainController {
|
|||||||
.resBody(new WnbtResponseBody(content))
|
.resBody(new WnbtResponseBody(content))
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -118,7 +128,7 @@ public class MngrMainController {
|
|||||||
* @return map
|
* @return map
|
||||||
*/
|
*/
|
||||||
@Policy(AuthPolicy.PUBLIC)
|
@Policy(AuthPolicy.PUBLIC)
|
||||||
@RequestMapping(value = "/getPcUrl")
|
@RequestMapping(value = "/getPcUrl", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity<WnbtResponse> getPcUrl(BOMaSopmalVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
|
public ResponseEntity<WnbtResponse> getPcUrl(BOMaSopmalVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
|
||||||
vo.setSopmalCd(authSopmalCd);
|
vo.setSopmalCd(authSopmalCd);
|
||||||
@@ -133,6 +143,7 @@ public class MngrMainController {
|
|||||||
|
|
||||||
DataMap content = new DataMap();
|
DataMap content = new DataMap();
|
||||||
content.put("sopmalInfo", sopmalInfo);
|
content.put("sopmalInfo", sopmalInfo);
|
||||||
|
|
||||||
return ResponseEntity.ok(
|
return ResponseEntity.ok(
|
||||||
WnbtResponse.builder()
|
WnbtResponse.builder()
|
||||||
.resBody(new WnbtResponseBody(content))
|
.resBody(new WnbtResponseBody(content))
|
||||||
|
|||||||
@@ -1,23 +1,43 @@
|
|||||||
package com.wb.domainserver.response;
|
package com.wb.domainserver.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import com.wb.domainserver.exception.WnbtException;
|
import com.wb.domainserver.exception.WnbtException;
|
||||||
import com.wb.domainserver.exception.WnbtRestException;
|
import com.wb.domainserver.exception.WnbtRestException;
|
||||||
|
import com.wb.domainserver.exception.code.ErrorCode;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class WnbtResponseBody {
|
public class WnbtResponseBody {
|
||||||
private String resultCode;
|
private String resultCode;
|
||||||
private String message;
|
private String message;
|
||||||
private Object result;
|
private Object result;
|
||||||
|
|
||||||
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper().registerModule(new JavaTimeModule()) // LocalDateTime 지원
|
||||||
|
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) // ISO 형식
|
||||||
|
.setSerializationInclusion(JsonInclude.Include.NON_NULL); // null 값 제외
|
||||||
|
|
||||||
public WnbtResponseBody(Object result) {
|
public WnbtResponseBody(Object result) {
|
||||||
this.result = result;
|
|
||||||
|
try{
|
||||||
|
this.result = OBJECT_MAPPER.writeValueAsString(result);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new WnbtRestException(ErrorCode.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public WnbtResponseBody(WnbtException ex){
|
public WnbtResponseBody(WnbtException ex){
|
||||||
this.resultCode = Optional.ofNullable(ex.getCode()).orElse("FAIL");
|
this.resultCode = Optional.ofNullable(ex.getCode()).orElse("FAIL");
|
||||||
this.message = ex.getMessage();
|
this.message = ex.getMessage();
|
||||||
|
|||||||
Reference in New Issue
Block a user