초기소스
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.wb.domainserver.domain.gcone.alarm.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.alarm.service.BOAlarmService;
|
||||
import com.wb.domainserver.domain.gcone.alarm.vo.BOAlarmVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping(value ="/gcone/alarm")
|
||||
public class BOAlarmController {
|
||||
|
||||
@Autowired
|
||||
private BOAlarmService service;
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/selectAlarmCount")
|
||||
public ResponseEntity<String> selectAlarmCount (@RequestBody BOAlarmVO vo) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
List<DataMap> answerList = service.selectAnswerCount(vo);
|
||||
|
||||
List<DataMap> refundList = service.selectRefundCount(vo);
|
||||
|
||||
content.put("refundList", refundList);
|
||||
content.put("answerList", answerList);
|
||||
content.put("status","success");
|
||||
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK,HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.wb.domainserver.domain.gcone.alarm.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.alarm.vo.BOAlarmVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface BOAlarmMapper {
|
||||
|
||||
|
||||
public List<DataMap> selectRefundCount (BOAlarmVO vo);
|
||||
|
||||
public List<DataMap> selectAnswerCount (BOAlarmVO vo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.wb.domainserver.domain.gcone.alarm.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.alarm.mapper.BOAlarmMapper;
|
||||
import com.wb.domainserver.domain.gcone.alarm.vo.BOAlarmVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class BOAlarmService {
|
||||
|
||||
@Autowired
|
||||
private BOAlarmMapper mapper;
|
||||
|
||||
|
||||
public List<DataMap> selectRefundCount (BOAlarmVO vo) {
|
||||
|
||||
List <DataMap> list = mapper.selectRefundCount(vo);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<DataMap> selectAnswerCount (BOAlarmVO vo) {
|
||||
|
||||
List <DataMap> list = mapper.selectAnswerCount(vo);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.wb.domainserver.domain.gcone.alarm.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOAlarmVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String sopmalCd;
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.wb.domainserver.domain.gcone.analytics.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.gcone.analytics.service.BOAnalyticsService;
|
||||
import com.wb.domainserver.domain.gcone.analytics.vo.BOAnanlyticsErpGoodsSrchVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/analytics")
|
||||
public class BOAnalyticsController {
|
||||
|
||||
@Autowired
|
||||
private BOAnalyticsService service;
|
||||
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/sales-journal")
|
||||
public ResponseEntity<String> selectSummary() {
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/erp-goods")
|
||||
public ResponseEntity<String> selectErpGoodsList(@RequestBody BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug(" 검색 파라미터 확인 리스트 검색조건 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
List<DataMap> sopmalList = service.selectSopmalCd();
|
||||
|
||||
content.put("sopmalList",sopmalList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/erp-goodsR")
|
||||
public ResponseEntity<String> selectErpGoodsListR(@RequestBody BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug(" 검색 파라미터 확인 리스트 검색조건 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
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());
|
||||
|
||||
List<DataMap> list = new ArrayList<>();
|
||||
list = service.selectErpGoodsList(vo);
|
||||
|
||||
log.debug("asdsadasdsa" + vo.getPaginationInfo().getTotalRecordCount());
|
||||
|
||||
content.put("list", list);
|
||||
content.put("BOAnanlyticsErpGoodsSrchVO", vo);
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/erp-set-goods")
|
||||
public ResponseEntity<String> selectErpSetGoodsList(@RequestBody BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug(" 검색 파라미터 확인 리스트 검색조건 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
List<DataMap> sopmalList = service.selectSopmalCd();
|
||||
|
||||
content.put("sopmalList",sopmalList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/erp-set-goodsR")
|
||||
public ResponseEntity<String> selectErpSetGoodsListR(@RequestBody BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug(" 검색 파라미터 확인 리스트 검색조건 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
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());
|
||||
|
||||
List<DataMap> list = new ArrayList<>();
|
||||
list = service.selectErpSetGoodsList(vo);
|
||||
|
||||
log.debug("asdsadasdsa" + vo.getPaginationInfo().getTotalRecordCount());
|
||||
|
||||
content.put("list", list);
|
||||
content.put("BOAnanlyticsErpGoodsSrchVO", vo);
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/update/erp-goods")
|
||||
public ResponseEntity<String> updateErpGoodsList(@RequestBody List<Map<String,Object>> jsonData) {
|
||||
|
||||
log.debug("파라미터당 " + jsonData);
|
||||
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
DataMap content = new DataMap();
|
||||
service.updateErpGoods(jsonData);
|
||||
content.put("status", "success");
|
||||
content.put("message", "제상품 정보가 성공적으로 업데이트 되었습니다.");
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonResult = "";
|
||||
|
||||
try {
|
||||
jsonResult = objectMapper.writeValueAsString(content);
|
||||
} catch(Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(jsonResult, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/order-history")
|
||||
public ResponseEntity<String> selectOrderHistoryList(@RequestBody BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug(" 검색 파라미터 확인 리스트 검색조건 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
List<DataMap> sopmalList = service.selectSopmalCd();
|
||||
|
||||
content.put("sopmalList",sopmalList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/order-historyR")
|
||||
public ResponseEntity<String> selectOrderHistoryR(@RequestBody BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug(" 검색 파라미터 확인 리스트 검색조건 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
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());
|
||||
|
||||
List<DataMap> list = new ArrayList<>();
|
||||
list = service.selectOrderhistoryList(vo);
|
||||
|
||||
log.debug("asdsadasdsa" + vo.getPaginationInfo().getTotalRecordCount());
|
||||
|
||||
content.put("list", list);
|
||||
content.put("BOAnanlyticsErpGoodsSrchVO", vo);
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.wb.domainserver.domain.gcone.analytics.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.analytics.vo.BOAnanlyticsErpGoodsSrchVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOAnalyticsMapper {
|
||||
|
||||
public List<DataMap> selectSopmalCd ();
|
||||
|
||||
public List<DataMap> selectErpGoodsList (BOAnanlyticsErpGoodsSrchVO boAnanlyticsErpGoodsSrchVO);
|
||||
|
||||
public int selectErpGoodsListCnt (BOAnanlyticsErpGoodsSrchVO boAnanlyticsErpGoodsSrchVO);
|
||||
|
||||
public List<DataMap> selectErpSetGoodsList (BOAnanlyticsErpGoodsSrchVO boAnanlyticsErpGoodsSrchVO);
|
||||
|
||||
public int selectErpSetGoodsListCnt (BOAnanlyticsErpGoodsSrchVO boAnanlyticsErpGoodsSrchVO);
|
||||
|
||||
public void updateErpGoods (List<Map<String,Object>> jsonData);
|
||||
|
||||
public List<DataMap> selectOrderHistoryList (BOAnanlyticsErpGoodsSrchVO boAnanlyticsErpGoodsSrchVO);
|
||||
|
||||
public int selectOrderHistoryListCnt (BOAnanlyticsErpGoodsSrchVO boAnanlyticsErpGoodsSrchVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.wb.domainserver.domain.gcone.analytics.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.analytics.mapper.BOAnalyticsMapper;
|
||||
import com.wb.domainserver.domain.gcone.analytics.vo.BOAnanlyticsErpGoodsSrchVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class BOAnalyticsService {
|
||||
|
||||
@Autowired
|
||||
private BOAnalyticsMapper mapper;
|
||||
|
||||
public List<DataMap> selectSopmalCd() {
|
||||
|
||||
List<DataMap> dataMaps = new ArrayList<DataMap>();
|
||||
dataMaps = mapper.selectSopmalCd();
|
||||
|
||||
return dataMaps;
|
||||
}
|
||||
|
||||
public List<DataMap> selectErpGoodsList (BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
List<DataMap> resultList = new ArrayList<>();
|
||||
|
||||
|
||||
int totCnt = mapper.selectErpGoodsListCnt(vo);
|
||||
|
||||
vo.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
if(totCnt > 0){
|
||||
resultList = mapper.selectErpGoodsList(vo);
|
||||
}
|
||||
return resultList;
|
||||
|
||||
}
|
||||
|
||||
public List<DataMap> selectErpSetGoodsList (BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
List<DataMap> resultList = new ArrayList<>();
|
||||
|
||||
int totCnt = mapper.selectErpSetGoodsListCnt(vo);
|
||||
|
||||
vo.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
if(totCnt > 0){
|
||||
resultList = mapper.selectErpSetGoodsList(vo);
|
||||
}
|
||||
return resultList;
|
||||
|
||||
}
|
||||
|
||||
public List<DataMap> selectOrderhistoryList (BOAnanlyticsErpGoodsSrchVO vo) {
|
||||
|
||||
List<DataMap> resultList = new ArrayList<>();
|
||||
|
||||
int totCnt = mapper.selectOrderHistoryListCnt(vo);
|
||||
|
||||
vo.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
if(totCnt > 0){
|
||||
resultList = mapper.selectOrderHistoryList(vo);
|
||||
}
|
||||
return resultList;
|
||||
|
||||
}
|
||||
|
||||
public void updateErpGoods (List<Map<String,Object>> jsonData) {
|
||||
|
||||
mapper.updateErpGoods(jsonData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.wb.domainserver.domain.gcone.analytics.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOAnanlyticsErpGoodsSrchVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String sopmalCd;
|
||||
|
||||
private String brandCd;
|
||||
|
||||
private String barcode;
|
||||
|
||||
private String goodsName;
|
||||
|
||||
private String setCode;
|
||||
|
||||
private String setGoodsName;
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.wb.domainserver.domain.gcone.api.controller;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.domain.gcone.api.service.BOApiService;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
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.HttpRequest;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/api")
|
||||
public class BOApiController {
|
||||
|
||||
@Autowired
|
||||
private BOApiService service;
|
||||
|
||||
@Autowired
|
||||
private BOCommonService commonService;
|
||||
|
||||
private final String AES_KEY = "aMZV6RjCtE1iyuH8WyE+Hg==";
|
||||
|
||||
private final String DATA_ENCRYPT_AES_KEY = "Z8zKbHyMKn+iwD3O0PLT9g==";
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/select/selectOrderList")
|
||||
public ResponseEntity<String> selectOrderList(@RequestBody Map<String, Object> requestBody, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
// 1. 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
requestBody.put("sopmalCd", user.getSopmalCd());
|
||||
}
|
||||
|
||||
String hashEqual = "";
|
||||
String csvString = "";
|
||||
String clearData = "";
|
||||
DataMap paramMap = new DataMap();
|
||||
paramMap.put("aesKey", AES_KEY);
|
||||
paramMap.put("timeStamp", requestBody.get("timeStamp"));
|
||||
paramMap.put("data", requestBody.get("data"));
|
||||
paramMap.put("hashData", requestBody.get("hash"));
|
||||
paramMap.put("dataAesKey", DATA_ENCRYPT_AES_KEY);
|
||||
|
||||
log.debug("파라미터 총 체크 : {}", paramMap);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
List<DataMap> list = new ArrayList<>();
|
||||
|
||||
// 2. 타임스탬프 검증
|
||||
try {
|
||||
service.isValidTimestamp((String) requestBody.get("timeStamp"));
|
||||
} catch (RuntimeException e) {
|
||||
log.warn("⛔ 타임스탬프 검증 실패: {}", e.getMessage(), e);
|
||||
service.insertMngrApiAccessLog(request,response,"N",e.getMessage());
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "요청 시간이 유효하지 않습니다.", e);
|
||||
}
|
||||
|
||||
// 3. 파라미터 복호화
|
||||
String param = service.aesParamDecrypt(paramMap);
|
||||
log.debug("📦 디코딩된 API 파라미터: {}", param);
|
||||
|
||||
// 4. 해시값 검증
|
||||
try {
|
||||
hashEqual = service.isValidHash(paramMap);
|
||||
log.debug("✅ 해쉬코드 검증 완료: {}", hashEqual);
|
||||
} catch (RuntimeException e) {
|
||||
log.debug("client hash: {}", paramMap.get("hashData"));
|
||||
log.debug("server hash: {}", e.getMessage());
|
||||
log.warn("⛔ 해쉬 코드 검증 실패: {}", e.getMessage(), e);
|
||||
service.insertMngrApiAccessLog(request,response,"N",e.getMessage());
|
||||
|
||||
content.put("result", "FAIL");
|
||||
content.put("message", "해쉬값 불일치");
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "해쉬값 불일치", e);
|
||||
}
|
||||
|
||||
// 5. 복호화된 파라미터 파싱 및 리스트 조회
|
||||
int totalSize = 0;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
map = objectMapper.readValue(param, new TypeReference<Map<String, Object>>() {});
|
||||
|
||||
} catch (Exception e) {
|
||||
service.insertMngrApiAccessLog(request,response,"N",e.getMessage());
|
||||
log.warn("⛔ 파라미터 파싱 또는 리스트 조회 중 오류 발생", e);
|
||||
map = new HashMap<>();
|
||||
}
|
||||
log.debug("복호화 파라미터 : " + map);
|
||||
map.put("secretkey",commonService.selectSecretkey());
|
||||
// total 사이즈
|
||||
totalSize = service.selectTableTotalSize(map);
|
||||
|
||||
int pageSize = 10000;
|
||||
int pageIndex = 1;
|
||||
try {
|
||||
pageIndex = Integer.parseInt((String) map.get("pageIndex"));
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("pageIndex 파싱 실패, 기본값 사용: {}", pageIndex);
|
||||
pageIndex = 1;
|
||||
}
|
||||
|
||||
int offset = (pageIndex - 1) * pageSize;
|
||||
int lastPageIndex = (int) Math.ceil((double) totalSize / pageSize);
|
||||
lastPageIndex = Math.max(1, lastPageIndex);
|
||||
|
||||
if (offset >= totalSize) {
|
||||
pageIndex = lastPageIndex;
|
||||
offset = (pageIndex - 1) * pageSize;
|
||||
}
|
||||
|
||||
if (totalSize <= pageSize) {
|
||||
offset = 0;
|
||||
map.put("limit", pageSize);
|
||||
}
|
||||
map.put("limit", pageSize);
|
||||
map.put("offset", offset);
|
||||
map.put("totalSize", totalSize);
|
||||
long queryStart = System.currentTimeMillis();
|
||||
list = service.selectTableList(map);
|
||||
long queryEnd = System.currentTimeMillis();
|
||||
System.out.println("쿼리 실행 시간(ms): " + (queryEnd - queryStart)/ 1000.0 + "초");
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", list);
|
||||
result.put("pageIndex", pageIndex);
|
||||
result.put("lastPageIndex", lastPageIndex);
|
||||
result.put("totalSize", totalSize);
|
||||
long start = System.currentTimeMillis();
|
||||
clearData = list.toString();
|
||||
// 6. 응답 구성
|
||||
csvString = service.convertCsv(result);
|
||||
long afterConvert = System.currentTimeMillis();
|
||||
log.debug("CSV 변환 시간: " + (afterConvert - start)/ 1000.0 + "초");
|
||||
paramMap.put("csvString", csvString);
|
||||
|
||||
// csv text -> AES 암호화 전송
|
||||
csvString = service.encryptCsv(paramMap);
|
||||
long afterEncrypt = System.currentTimeMillis();
|
||||
log.debug("CSV 암호화 시간: " + (afterEncrypt - afterConvert)/ 1000.0 + "초");
|
||||
|
||||
|
||||
/*content.put("totalSize", totalSize);
|
||||
content.put("pageIndex", pageIndex);
|
||||
content.put("lastPageIndex", lastPageIndex);*/
|
||||
log.debug("총 후처리 시간: " + (afterEncrypt - start)/ 1000.0 + "초");
|
||||
|
||||
content.put("list", csvString);
|
||||
content.put("clearData", clearData);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.wb.domainserver.domain.gcone.api.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.analytics.vo.BOAnanlyticsErpGoodsSrchVO;
|
||||
import com.wb.domainserver.domain.gcone.api.vo.BOApiVO;
|
||||
import com.wb.domainserver.domain.gcone.sms.vo.BOSmsBillingVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface BOApiMapper {
|
||||
|
||||
public List<DataMap> selectOrderList(Map<String,Object> map);
|
||||
|
||||
public int selectOrderListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectOrderItemList(Map<String,Object> map);
|
||||
|
||||
public int selectOrderItemListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectOrderItemOptionList(Map<String,Object> map);
|
||||
|
||||
public int selectOrderItemOptionListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectMemberList(Map<String,Object> map);
|
||||
|
||||
public int selectMemberListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectMemberSiteList(Map<String,Object> map);
|
||||
|
||||
public int selectMemberSiteListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectExtrlMemberList(Map<String,Object> map);
|
||||
|
||||
public int selectExtrlMemberListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectOrreOptionStatList(Map<String,Object> map);
|
||||
|
||||
public int selectOrreOptionStatListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectOrreStatList(Map<String,Object> map);
|
||||
|
||||
public int selectOrreStatListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectCouponList(Map<String,Object> map);
|
||||
|
||||
public int selectCouponListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectAnalysisErpGoodsList(Map<String,Object> map);
|
||||
|
||||
public int selectAnalysisErpGoodsListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectAnalysisErpSetGoodsList(Map<String,Object> map);
|
||||
|
||||
public int selectAnalysisErpSetGoodsListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectErpTotalStatisticsList(Map<String,Object> map);
|
||||
|
||||
public int selectErpTotalStatisticsListCnt (Map<String,Object> map);
|
||||
|
||||
public void insertMngrApiAccessLog (DataMap dataMap);
|
||||
|
||||
public List<DataMap> selectAccessStatList(Map<String,Object> map);
|
||||
|
||||
public int selectAccessStatListCnt (Map<String,Object> map);
|
||||
|
||||
public List<DataMap> selectAccessLogList(Map<String,Object> map);
|
||||
|
||||
public int selectAccessLogListCnt (Map<String,Object> map);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
package com.wb.domainserver.domain.gcone.api.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.api.mapper.BOApiMapper;
|
||||
import com.wb.domainserver.domain.gcone.sms.mapper.BOSmsBillingMapper;
|
||||
import com.wb.domainserver.domain.sure.mapper.SureMapper;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class BOApiService {
|
||||
|
||||
@Autowired
|
||||
private BOApiMapper mapper;
|
||||
|
||||
public List<DataMap> selectTableList(Map<String, Object> map) {
|
||||
|
||||
String table = "";
|
||||
List<DataMap> resultList = new ArrayList<>();
|
||||
|
||||
table = (String) map.get("tableNm");
|
||||
|
||||
int totCnt = (map.get("totalSize") != null) ? (Integer) map.get("totalSize") : 0;
|
||||
long queryStart = System.currentTimeMillis();
|
||||
if (totCnt > 0) {
|
||||
switch (table) {
|
||||
case "GC_ORDER":
|
||||
resultList = mapper.selectOrderList(map);
|
||||
break;
|
||||
case "GC_ORDER_ITEM":
|
||||
resultList = mapper.selectOrderItemList(map);
|
||||
break;
|
||||
case "GC_ORDER_ITEM_OPTION":
|
||||
resultList = mapper.selectOrderItemOptionList(map);
|
||||
break;
|
||||
case "GC_MEMBER":
|
||||
resultList = mapper.selectMemberList(map);
|
||||
break;
|
||||
case "GC_MEMBER_SITE":
|
||||
resultList = mapper.selectMemberSiteList(map);
|
||||
break;
|
||||
case "GC_EXTRL_MEMBER":
|
||||
resultList = mapper.selectExtrlMemberList(map);
|
||||
break;
|
||||
case "GC_ORRE_GOPTN_STAT":
|
||||
resultList = mapper.selectOrreOptionStatList(map);
|
||||
break;
|
||||
case "GC_ORRE_STAT":
|
||||
resultList = mapper.selectOrreStatList(map);
|
||||
break;
|
||||
case "GC_COUPON":
|
||||
resultList = mapper.selectCouponList(map);
|
||||
break;
|
||||
case "GC_ANALYSIS_ERP_GOODS":
|
||||
resultList = mapper.selectAnalysisErpGoodsList(map);
|
||||
break;
|
||||
case "GC_ANALYSIS_ERP_SET_GOODS":
|
||||
resultList = mapper.selectAnalysisErpSetGoodsList(map);
|
||||
break;
|
||||
case "GC_ERP_TOTAL_STATISTICS":
|
||||
resultList = mapper.selectErpTotalStatisticsList(map);
|
||||
break;
|
||||
case "GC_ACCESS_STAT":
|
||||
resultList = mapper.selectAccessStatList(map);
|
||||
break;
|
||||
case "GC_ACCESS_LOG":
|
||||
resultList = mapper.selectAccessLogList(map);
|
||||
break;
|
||||
}
|
||||
}
|
||||
long queryEnd = System.currentTimeMillis();
|
||||
System.out.println("쿼리 실제의 실행 시간(ms): " + (queryEnd - queryStart)/ 1000.0 + "초");
|
||||
return resultList;
|
||||
|
||||
}
|
||||
|
||||
public int selectTableTotalSize(Map<String, Object> map) {
|
||||
|
||||
int totCnt = 0;
|
||||
String table = "";
|
||||
table = (String) map.get("tableNm");
|
||||
|
||||
switch (table) {
|
||||
case "GC_ORDER":
|
||||
totCnt = mapper.selectOrderListCnt(map);
|
||||
break;
|
||||
case "GC_ORDER_ITEM":
|
||||
totCnt = mapper.selectOrderItemListCnt(map);
|
||||
break;
|
||||
case "GC_ORDER_ITEM_OPTION":
|
||||
totCnt = mapper.selectOrderItemOptionListCnt(map);
|
||||
break;
|
||||
case "GC_MEMBER":
|
||||
totCnt = mapper.selectMemberListCnt(map);
|
||||
break;
|
||||
case "GC_MEMBER_SITE":
|
||||
totCnt = mapper.selectMemberSiteListCnt(map);
|
||||
break;
|
||||
case "GC_EXTRL_MEMBER":
|
||||
totCnt = mapper.selectExtrlMemberListCnt(map);
|
||||
break;
|
||||
case "GC_ORRE_GOPTN_STAT":
|
||||
totCnt = mapper.selectOrreOptionStatListCnt(map);
|
||||
break;
|
||||
case "GC_ORRE_STAT":
|
||||
totCnt = mapper.selectOrreStatListCnt(map);
|
||||
break;
|
||||
case "GC_COUPON":
|
||||
totCnt = mapper.selectCouponListCnt(map);
|
||||
break;
|
||||
case "GC_ANALYSIS_ERP_GOODS":
|
||||
totCnt = mapper.selectAnalysisErpGoodsListCnt(map);
|
||||
break;
|
||||
case "GC_ANALYSIS_ERP_SET_GOODS":
|
||||
totCnt = mapper.selectAnalysisErpSetGoodsListCnt(map);
|
||||
break;
|
||||
case "GC_ERP_TOTAL_STATISTICS":
|
||||
totCnt = mapper.selectErpTotalStatisticsListCnt(map);
|
||||
break;
|
||||
case "GC_ACCESS_STAT":
|
||||
totCnt = mapper.selectAccessStatListCnt(map);
|
||||
break;
|
||||
case "GC_ACCESS_LOG":
|
||||
totCnt = mapper.selectAccessLogListCnt(map);
|
||||
break;
|
||||
}
|
||||
|
||||
return totCnt;
|
||||
}
|
||||
|
||||
public String aesParamDecrypt(DataMap dataMap) {
|
||||
try {
|
||||
String encryptedBase64Data = (String) dataMap.get("data");
|
||||
String aesKey = (String) dataMap.get("aesKey");
|
||||
|
||||
log.debug("디코딩전 파라미터 : " + encryptedBase64Data);
|
||||
|
||||
byte[] keyBytes = Base64.getDecoder().decode(aesKey);
|
||||
SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
|
||||
|
||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||
cipher.init(Cipher.DECRYPT_MODE, secretKey);
|
||||
|
||||
byte[] encryptedBytes = Base64.getDecoder().decode(encryptedBase64Data);
|
||||
byte[] decryptedBytes = cipher.doFinal(encryptedBytes);
|
||||
|
||||
return new String(decryptedBytes, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void isValidTimestamp(String timestamp) {
|
||||
|
||||
long clientTimestamp = Long.parseLong(timestamp);
|
||||
long serverTimestamp = System.currentTimeMillis();
|
||||
|
||||
long diff = clientTimestamp - serverTimestamp;
|
||||
long max = 1 * 60 * 1000;
|
||||
|
||||
if (diff > max) {
|
||||
throw new RuntimeException("타임스탬프 유효하지않음");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String isValidHash(DataMap paramMap) {
|
||||
|
||||
String hash = (String) paramMap.get("hashData");
|
||||
String clientTimestamp = (String) paramMap.get("timeStamp");
|
||||
String encryptedData = aesParamDecrypt(paramMap);
|
||||
|
||||
String hashEqualCode = clientTimestamp + "GC_ONE" + encryptedData;
|
||||
|
||||
String decodeHash = hashSHA256(hashEqualCode);
|
||||
|
||||
if (hash.equals(decodeHash)) {
|
||||
return decodeHash;
|
||||
} else {
|
||||
throw new RuntimeException(decodeHash);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String hashSHA256(String hashEqualCode) {
|
||||
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
byte[] hash = digest.digest(hashEqualCode.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64.getEncoder().encodeToString(hash);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String convertCsv(Map<String, Object> map) {
|
||||
|
||||
if (map == null || map.isEmpty()) return "";
|
||||
|
||||
StringBuilder csvBuilder = new StringBuilder();
|
||||
List<DataMap> list = (List<DataMap>) map.get("list");
|
||||
|
||||
if (list == null || list.isEmpty()) return "";
|
||||
|
||||
Integer pageIndex = (Integer) map.get("pageIndex");
|
||||
Integer lastPageIndex = (Integer) map.get("lastPageIndex");
|
||||
Integer totalSize = (Integer) map.get("totalSize");
|
||||
|
||||
csvBuilder.append("pageIndex,").append(pageIndex).append("\n");
|
||||
csvBuilder.append("lastPageIndex,").append(lastPageIndex).append("\n");
|
||||
csvBuilder.append("totalSize,").append(totalSize).append("\n\n");
|
||||
|
||||
DataMap firstRow = list.get(0);
|
||||
List<String> header = firstRow.keySet().stream()
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
csvBuilder.append(String.join(",", header)).append('\n');
|
||||
|
||||
for (DataMap dataMap : list) {
|
||||
|
||||
List<String> rowValues = new ArrayList<>();
|
||||
for (String key : header) {
|
||||
Object value = dataMap.get(key);
|
||||
String stringValue = "";
|
||||
|
||||
if (value != null) {
|
||||
stringValue = value.toString().replace("\"", "\"\"");
|
||||
if (stringValue.contains(",") || stringValue.contains("\n")) {
|
||||
stringValue = "\"" + stringValue + "\"";
|
||||
}
|
||||
}
|
||||
rowValues.add(stringValue);
|
||||
}
|
||||
csvBuilder.append(String.join(",", rowValues)).append("\n");
|
||||
}
|
||||
return csvBuilder.toString();
|
||||
}
|
||||
|
||||
public String encryptCsv(DataMap dataMap) {
|
||||
try {
|
||||
byte[] keyBytes = Base64.getDecoder().decode(dataMap.get("dataAesKey").toString());
|
||||
SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
|
||||
|
||||
Cipher cipher = Cipher.getInstance("AES");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
||||
|
||||
byte[] encryptedBytes = cipher.doFinal(dataMap.get("csvString").toString().getBytes());
|
||||
return Base64.getEncoder().encodeToString(encryptedBytes);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("CSV 암호화 실패", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void insertMngrApiAccessLog(HttpServletRequest request, HttpServletResponse response, String successFlag, String failMsg) {
|
||||
|
||||
String sessionId = request.getHeader("session_id");
|
||||
String userAgent = request.getHeader("User-Agent");
|
||||
String clientIp = request.getHeader("X-Forwarded-For");
|
||||
String agentId = "";
|
||||
String authSopmalCd = "";
|
||||
DataMap dataMap = new DataMap();
|
||||
|
||||
// 호출된 메소드 이름
|
||||
String methodName = "selectOrderList";
|
||||
|
||||
// 요청 URL
|
||||
String url = request.getRequestURI();
|
||||
|
||||
// 요청 파라미터
|
||||
String postParam = "";
|
||||
|
||||
if ("POST".equalsIgnoreCase(request.getMethod())) {
|
||||
if ("application/json".equalsIgnoreCase(request.getContentType())) {
|
||||
try {
|
||||
postParam = new String(request.getInputStream().readAllBytes(), request.getCharacterEncoding());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// agentId 가져오기
|
||||
if (request.getCookies() != null) {
|
||||
Cookie[] cookies = request.getCookies();
|
||||
for (Cookie cookie : cookies) {
|
||||
if (cookie.getName().equals("agent_id")) {
|
||||
agentId = cookie.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//접속환경
|
||||
String env;
|
||||
String upperUseAgent = userAgent.toUpperCase();
|
||||
if (upperUseAgent.contains("MOBILE") || upperUseAgent.contains("ANDROID") || upperUseAgent.contains("IPHONE")) {
|
||||
env = "MO";
|
||||
} else if (upperUseAgent.contains("TABLET") || upperUseAgent.contains("IPAD")) {
|
||||
env = "MO";
|
||||
} else {
|
||||
env = "PC";
|
||||
}
|
||||
|
||||
//ip 분리
|
||||
if (!StringUtil.isEmpty(clientIp) && clientIp.contains(",")) {
|
||||
clientIp = clientIp.split(",")[0];
|
||||
}
|
||||
|
||||
if (request.getCookies() != null) {
|
||||
for (Cookie cookie : request.getCookies()) {
|
||||
if (cookie.getName().equals("authSopmalCd")) {
|
||||
authSopmalCd = cookie.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//sessionId 정보
|
||||
String jSessionId = "";
|
||||
if (request.getCookies() != null) {
|
||||
for (Cookie cookie : request.getCookies()) {
|
||||
if (cookie.getName().equals("JSESSIONID")) {
|
||||
jSessionId = cookie.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("clientIp :: {}", clientIp);
|
||||
|
||||
dataMap.put("sesionId", sessionId);
|
||||
dataMap.put("reqstMth", methodName);
|
||||
dataMap.put("agentId",agentId);
|
||||
dataMap.put("ip",clientIp);
|
||||
dataMap.put("conectEnvrnDv", env);
|
||||
dataMap.put("reqstData", postParam);
|
||||
dataMap.put("sopmalCd", authSopmalCd);
|
||||
dataMap.put("conectUrl",url);
|
||||
dataMap.put("jSessionId", jSessionId);
|
||||
dataMap.put("successYn", successFlag);
|
||||
dataMap.put("errorCode",failMsg);
|
||||
|
||||
mapper.insertMngrApiAccessLog(dataMap);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.wb.domainserver.domain.gcone.api.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOApiVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String sopmalCd;
|
||||
|
||||
private String timeStamp;
|
||||
|
||||
private String data;
|
||||
|
||||
private String hash;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.wb.domainserver.domain.gcone.app.controller;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.gcone.app.service.BOAppService;
|
||||
import com.wb.domainserver.domain.gcone.app.service.BOFCMNotificationService;
|
||||
import com.wb.domainserver.domain.gcone.app.vo.BOAppMbrDvcVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrPushVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.SendToResrc;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 앱기능 처리 BO Controller
|
||||
*
|
||||
* @author 이훈영
|
||||
* @since 2024-11-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------/mngr/bnft/sttus
|
||||
* 2024-11-26 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class BOAppController {
|
||||
|
||||
@Autowired
|
||||
private BOAppService service;
|
||||
|
||||
@Autowired
|
||||
private BOFCMNotificationService fcmservice;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
|
||||
/**
|
||||
* 앱디바이스 정보 입력/수정
|
||||
*
|
||||
* @param vo
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/gcone/app/insertBOAppDeviceInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<?> insertBOAppDeviceInfo(@RequestBody BOAppMbrDvcVO vo) throws UnknownHostException {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
//log.debug("@@@@@@@@@@ BOAppMbrDvcVO ::: {}", vo);
|
||||
|
||||
Integer dplct = service.selectBOAppMbrDvcDplct(vo);
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
if(dplct < 1) {
|
||||
message = service.insertBOAppDeviceInfo(vo);
|
||||
} else {
|
||||
// 중복된 deviceId가 있을 경우, 디바이스정보를 update한다.
|
||||
message = service.updateBOAppDeviceInfo(vo);
|
||||
}
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 앱 로그인시 디바이스-회원정보 정보 입력/수정
|
||||
*
|
||||
* @param vo
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/gcone/app/insertBOAppMbrDvcInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<?> insertBOMbrDvcInfo(@RequestBody BOAppMbrDvcVO vo) throws UnknownHostException {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
if (user.getUserInnb() > 0) {
|
||||
vo.setMbrInnb(Long.valueOf(user.getUserInnb()));
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
vo.setMbrId(user.getMbrId());
|
||||
}
|
||||
//log.debug("@@@@@@@@@@ BOAppMbrDvcVO ::: {}", vo);
|
||||
|
||||
Integer dplct = service.selectBOAppMbrDvcDplct(vo);
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
if(dplct < 1) {
|
||||
message = service.insertBOAppMbrDvcInfo(vo);
|
||||
} else {
|
||||
// 중복된 deviceId가 있을 경우, 디바이스 및 회원정보를 update한다.
|
||||
message = service.updateBOAppMbrDvcInfo(vo);
|
||||
}
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 푸시 발송
|
||||
*
|
||||
* @param vo
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/gcone/app/procPushNotification", method = RequestMethod.POST)
|
||||
public ResponseEntity<?> procPushNotification(@RequestBody BOBnftMngrPushVO vo) throws UnknownHostException {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
Long[] arrMbrDeviceInnb = vo.getArrMbrDeviceInnb();
|
||||
String[] arrFcmToken = vo.getArrFcmToken();
|
||||
|
||||
log.debug("@@@@@@@@@@ BOBnftMngrPushVO ::: {}", vo);
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
for (int i = 0; i < arrFcmToken.length; i++) {
|
||||
Long mbrDeviceInnb = arrMbrDeviceInnb[i];
|
||||
vo.setFcmToken(arrFcmToken[i]);
|
||||
|
||||
// FCM 전송 로직
|
||||
String resultCode = fcmservice.sendPush(vo);
|
||||
|
||||
message.put(mbrDeviceInnb.toString(), resultCode);
|
||||
message.put("result", "success");
|
||||
}
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 푸시 발송 임시
|
||||
*
|
||||
* @param vo
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/gcone/app/procPushNotificationImsi", method = RequestMethod.POST)
|
||||
public ResponseEntity<?> procPushNotificationImsi(@RequestBody BOBnftMngrPushVO vo) throws UnknownHostException {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
//Long[] arrMbrDeviceInnb = vo.getArrMbrDeviceInnb();
|
||||
String[] arrFcmToken = vo.getArrFcmToken();
|
||||
|
||||
log.debug("@@@@@@@@@@ BOBnftMngrPushVO ::: {}", vo);
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
for (int i = 0; i < arrFcmToken.length; i++) {
|
||||
//Long mbrDeviceInnb = arrMbrDeviceInnb[i];
|
||||
vo.setFcmToken(arrFcmToken[i]);
|
||||
|
||||
// FCM 전송 로직
|
||||
String resultCode = fcmservice.sendPush(vo);
|
||||
|
||||
//result.put(mbrDeviceInnb.toString(), resultCode);
|
||||
message.put("result", resultCode);
|
||||
}
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.wb.domainserver.domain.gcone.app.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.app.vo.BOAppMbrDvcVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* 앱기능 처리 BOAppMapper
|
||||
* @author 이훈영
|
||||
* @since 2024-11-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-11-26 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOAppMapper {
|
||||
|
||||
/** 앱 실행시 디바이스 정보 등록 */
|
||||
public void insertBOAppDeviceInfo(BOAppMbrDvcVO vo);
|
||||
/** 앱 실행시 디바이스 정보 수정 */
|
||||
public void updateBOAppDeviceInfo(BOAppMbrDvcVO vo);
|
||||
/** 앱 로그인시 회원-디바이스 정보 등록 */
|
||||
public void insertBOAppMbrDvcInfo(BOAppMbrDvcVO vo);
|
||||
/** 앱 로그인시 회원-디바이스 정보 수정 */
|
||||
public void updateBOAppMbrDvcInfo(BOAppMbrDvcVO vo);
|
||||
/** 앱 알림동의 선택시 수정 */
|
||||
public void updateBOAppMbrDvcPushAgre(BOAppMbrDvcVO vo);
|
||||
/** 앱 신체활동접근동의 선택시 수정 */
|
||||
public void updateBOAppMbrDvcPhacAgre(BOAppMbrDvcVO vo);
|
||||
|
||||
/** 디바이스 정보 조회 */
|
||||
public List<DataMap> selectBOAppMbrDvcInfo(BOAppMbrDvcVO vo);
|
||||
/** 디바이스 정보 중복 조회 */
|
||||
public Integer selectBOAppMbrDvcDplct(BOAppMbrDvcVO vo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.wb.domainserver.domain.gcone.app.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.app.mapper.BOAppMapper;
|
||||
import com.wb.domainserver.domain.gcone.app.vo.BOAppMbrDvcVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
|
||||
|
||||
/**
|
||||
*
|
||||
* 앱기능 처리 Service
|
||||
* @author 이훈영
|
||||
* @since 2024-11-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-11-26 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class BOAppService {
|
||||
|
||||
@Autowired
|
||||
private BOAppMapper mapper;
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
/**
|
||||
* 조회
|
||||
* @param BOAppMbrDvcVO vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
//public List<DataMap> selectBOAppMbrDvcListInqire(BOAppMbrDvcVO vo) {
|
||||
// List<DataMap> resultList = mapper.selectBOBnftRwdList(vo);
|
||||
|
||||
// return resultList;
|
||||
//}
|
||||
|
||||
/**
|
||||
* 앱 실행시 디바이스 정보 등록
|
||||
* @param vo
|
||||
* @return Map
|
||||
*/
|
||||
public Map<String, Object> insertBOAppDeviceInfo(BOAppMbrDvcVO vo) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
mapper.insertBOAppDeviceInfo(vo);
|
||||
|
||||
message.put("deviceId", vo.getDeviceId());
|
||||
message.put("result", "success");
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 앱 실행시 디바이스 정보 수정
|
||||
* @param vo
|
||||
* @return Map
|
||||
*/
|
||||
public Map<String, Object> updateBOAppDeviceInfo(BOAppMbrDvcVO vo) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
mapper.updateBOAppDeviceInfo(vo);
|
||||
|
||||
message.put("deviceId", vo.getDeviceId());
|
||||
message.put("result", "success");
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 앱 로그인시 디바이스-회원정보 정보 등록
|
||||
* @param vo
|
||||
* @return Map
|
||||
*/
|
||||
public Map<String, Object> insertBOAppMbrDvcInfo(BOAppMbrDvcVO vo) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
mapper.insertBOAppMbrDvcInfo(vo);
|
||||
|
||||
message.put("deviceId", vo.getDeviceId());
|
||||
message.put("mbrId", vo.getMbrId());
|
||||
message.put("result", "success");
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 앱 로그인시 디바이스-회원정보 정보 수정
|
||||
* @param vo
|
||||
* @return Map
|
||||
*/
|
||||
public Map<String, Object> updateBOAppMbrDvcInfo(BOAppMbrDvcVO vo) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
mapper.updateBOAppMbrDvcInfo(vo);
|
||||
|
||||
message.put("deviceId", vo.getDeviceId());
|
||||
message.put("mbrId", vo.getMbrId());
|
||||
message.put("result", "success");
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 디바이스 정보 중복 조회
|
||||
* @param vo
|
||||
* @return Integer
|
||||
*/
|
||||
public Integer selectBOAppMbrDvcDplct(BOAppMbrDvcVO vo) {
|
||||
return mapper.selectBOAppMbrDvcDplct(vo);
|
||||
}
|
||||
|
||||
//@Scheduled(cron = "*/10 * * * * *") // 10초 : */10 * * * * *
|
||||
//@SchedulerLock(name = "BOAppService.processTask", lockAtLeastFor = "4s", lockAtMostFor = "8s")
|
||||
public void processTask() {
|
||||
// 현재 활성화된 프로파일을 확인
|
||||
String[] activeProfiles = environment.getActiveProfiles();
|
||||
String currentProfile = "Unknown Profile";
|
||||
|
||||
if (activeProfiles.length > 0) {
|
||||
currentProfile = activeProfiles[0]; // 첫 번째 활성 프로파일 사용
|
||||
}
|
||||
|
||||
// 현재 시간을 "yyyy-MM-dd HH:mm:ss" 형식으로 변환
|
||||
String formattedTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
System.out.println("@@@@@@@@@@@@ 실행시간 : " + formattedTime + ", Profile : " + currentProfile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.wb.domainserver.domain.gcone.app.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
import com.google.firebase.messaging.FirebaseMessagingException;
|
||||
import com.google.firebase.messaging.Message;
|
||||
import com.google.firebase.messaging.Notification;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrPushVO;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 출석체크 관리 Service
|
||||
* @author 이훈영
|
||||
* @since 2024-12-02
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-12-02 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class BOFCMNotificationService {
|
||||
|
||||
@Qualifier("NCFirebaseMessaging")
|
||||
@Autowired
|
||||
private FirebaseMessaging ncFirebaseMessaging;
|
||||
|
||||
@Qualifier("DTFirebaseMessaging")
|
||||
@Autowired
|
||||
private FirebaseMessaging dtFirebaseMessaging;
|
||||
|
||||
public String sendPush(@RequestBody BOBnftMngrPushVO vo) {
|
||||
String resultCode = "";
|
||||
|
||||
String sopmalCd = vo.getSopmalCd();
|
||||
String pushKey = vo.getFcmToken();
|
||||
String title = vo.getPushSj();
|
||||
String body = vo.getPushCn();
|
||||
String pushType = vo.getPushType();
|
||||
String data = vo.getPushData();
|
||||
String imgsrc = vo.getImgFilCours();
|
||||
|
||||
// FirebaseMessaging 객체 선택
|
||||
FirebaseMessaging selectedMessaging;
|
||||
if ("NC".equals(sopmalCd)) {
|
||||
selectedMessaging = ncFirebaseMessaging;
|
||||
} else if ("DT".equals(sopmalCd)) {
|
||||
selectedMessaging = dtFirebaseMessaging;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid sopmalCd: " + sopmalCd);
|
||||
}
|
||||
|
||||
// Notification 생성
|
||||
Notification notification = Notification.builder()
|
||||
.setTitle(title)
|
||||
.setBody(body)
|
||||
.setImage(imgsrc)
|
||||
.build();
|
||||
|
||||
// Message 생성
|
||||
Message message = Message.builder()
|
||||
.setToken(pushKey)
|
||||
.setNotification(notification)
|
||||
.putData("pushType", pushType)
|
||||
.putData("data", data)
|
||||
.build();
|
||||
|
||||
try {
|
||||
// 선택된 FirebaseMessaging으로 메시지 전송
|
||||
String response = selectedMessaging.send(message);
|
||||
resultCode = "200";
|
||||
} catch (FirebaseMessagingException fe) {
|
||||
fe.printStackTrace();
|
||||
resultCode = "-1";
|
||||
}
|
||||
|
||||
return resultCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.wb.domainserver.domain.gcone.app.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 회원 디바이스정보 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-11-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용----------------------------혜택 통계
|
||||
* ------- -------- ---------------------------/mngr/bnft/sttus
|
||||
* 2024-11-26 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOAppMbrDvcVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 회원 디바이스 고유번호 */
|
||||
private Long mbrDeviceInnb;
|
||||
/** 회원 고유번호 */
|
||||
private Long mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 회원 ID */
|
||||
private String mbrId;
|
||||
/** FCM 토큰 */
|
||||
private String fcmToken;
|
||||
/** 알림 동의 여부 */
|
||||
private String pushAgreAt;
|
||||
/** 신체활동접근 동의 여부 */
|
||||
private String phacAgreAt;
|
||||
/** 디바이스 고유 ID */
|
||||
private String deviceId;
|
||||
/** 운영체제 이름 */
|
||||
private String deviceOsNm;
|
||||
/** 운영체제 버전 */
|
||||
private String deviceOsVer;
|
||||
/** 앱 버전 */
|
||||
private String deviceAppVer;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,543 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.bbs.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.service.BOBbsService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.vo.BOBbsSetupVO;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.vo.BOBbsVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtToken;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BOBbsController Class (back)
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2023-12-12
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-12 최범식 최초 생성
|
||||
* 2024-04-25 추지훈 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bbs/bbs")
|
||||
public class BOBbsController {
|
||||
|
||||
@Autowired
|
||||
private BOBbsService service;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
/**
|
||||
* 게시판 목록 화면
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbsListInqireFrom")
|
||||
public ResponseEntity<String> selectBOBbsListInqireFrom(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug(" 검색 파라미터 확인 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
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());
|
||||
|
||||
List<DataMap> formList = new ArrayList<>();
|
||||
DataMap fromMap = new DataMap();
|
||||
fromMap = service.selectBOBbsListInqireFrom(vo);
|
||||
formList.add(fromMap);
|
||||
|
||||
List<DataMap> srchList = new ArrayList<>();
|
||||
DataMap srchData = new DataMap();
|
||||
srchData.put("srchWord", vo.getSrchWord());
|
||||
srchData.put("srchBbsTyCd", vo.getSrchBbsTyCd());
|
||||
srchData.put("srchSknTyCd", vo.getSrchSknTyCd());
|
||||
srchData.put("pageUnit", vo.getPageUnit());
|
||||
srchData.put("pageIndex", vo.getPageIndex());
|
||||
srchData.put("pageDv", vo.getPageDv());
|
||||
srchList.add(srchData);
|
||||
|
||||
content.put("srchList", srchList);
|
||||
content.put("formList", formList);
|
||||
content.put("boBbsVo", vo);
|
||||
//content.put("paginationInfo", vo.getPaginationInfo());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 목록 조회
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbsListInqire")
|
||||
public ResponseEntity<String> selectBOBbsListInqire(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
// 쇼핑몰코드
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
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());
|
||||
|
||||
DataMap srchMap = new DataMap();
|
||||
if (!ObjectUtils.isEmpty(vo.getSrchSknTyCdArr())) {
|
||||
srchMap.put("srchSknTyCd", String.join(",", vo.getSrchSknTyCdArr()));
|
||||
} else {
|
||||
srchMap.put("srchSknTyCd", "");
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(vo.getSrchBbsTyCdArr())) {
|
||||
srchMap.put("srchBbsTyCd", String.join(",", vo.getSrchBbsTyCdArr()));
|
||||
} else {
|
||||
srchMap.put("srchBbsTyCd", "");
|
||||
}
|
||||
if (!StringUtil.isEmpty(vo.getSrchWord())) {
|
||||
srchMap.put("srchWord", vo.getSrchWord());
|
||||
} else {
|
||||
srchMap.put("srchWord", "");
|
||||
}
|
||||
List<DataMap> srchList = new ArrayList<>();
|
||||
srchList.add(srchMap);
|
||||
content.put("srchList", srchList);
|
||||
|
||||
List<DataMap> bbsList = new ArrayList<>();
|
||||
bbsList = service.selectBOBbsListInqire(vo);
|
||||
content.put("bbsList", bbsList);
|
||||
content.put("boBbsVo", vo);
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 게시판 비속어 설정 가져오기
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOSlangDftSetupPopupForm")
|
||||
public ResponseEntity<String> selectBOSlangDftSetupPopupForm(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
|
||||
DataMap content = new DataMap();
|
||||
BOBbsSetupVO stVo = new BOBbsSetupVO();
|
||||
|
||||
stVo = service.selectBOSlangDftSetupPopupForm(vo);
|
||||
content.put("boBbsSetupVo", stVo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 게시판 비속어 수정
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)@RequestMapping(value = "/updateBOSlangSetupRegist")
|
||||
public ResponseEntity<String> updateBOSlangSetupRegist(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
String message = service.updateBOSlangSetupRegist(vo);
|
||||
BOBbsSetupVO stVo = new BOBbsSetupVO();
|
||||
stVo = service.selectBOSlangDftSetupPopupForm(vo);
|
||||
content.put("boBbsSetupVo", stVo);
|
||||
content.put("message", message);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 게시판 등록화면
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbsRegistForm")
|
||||
public ResponseEntity<String> selectBOBbsRegistForm(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
// 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap codeMap = new DataMap();
|
||||
codeMap = service.selectCommonCode();
|
||||
|
||||
List<DataMap> codeList = new ArrayList<>();
|
||||
codeList.add(codeMap);
|
||||
List<DataMap> mbrGradList = new ArrayList<>();
|
||||
|
||||
vo.setMbrGradGroupInnb("1");
|
||||
mbrGradList = service.selectBOBbsRegistForm(vo);
|
||||
|
||||
List<DataMap> updBbsList = new ArrayList<>();
|
||||
updBbsList = service.selectUpdBbsList(vo);
|
||||
|
||||
List<DataMap> messageList = new ArrayList<>();
|
||||
DataMap sms = new DataMap();
|
||||
sms = service.selectBOBbsSmsFormList(vo);
|
||||
|
||||
DataMap kakao = new DataMap();
|
||||
kakao = service.selectBOBbsKakaoFormList(vo);
|
||||
|
||||
List<DataMap> srchList = new ArrayList<>();
|
||||
DataMap srchData = new DataMap();
|
||||
srchData.put("pageIndex", vo.getPageIndex());
|
||||
srchData.put("pageUnit", vo.getPageUnit());
|
||||
srchData.put("srchWord", vo.getSrchWord());
|
||||
srchData.put("srchSknTyCd", vo.getSrchSknTyCd());
|
||||
srchData.put("srchBbsTyCd", vo.getSrchBbsTyCd());
|
||||
srchList.add(srchData);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content.put("mbrGradList", mbrGradList);
|
||||
content.put("codeContent", codeList);
|
||||
content.put("bOBbsVo", vo);
|
||||
content.put("srchList", srchList);
|
||||
content.put("updBbsList", updBbsList);
|
||||
content.put("sms", sms);
|
||||
content.put("kakao", kakao);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
|
||||
}
|
||||
/**
|
||||
* 게시판 등록
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/insertBOBbsRegist")
|
||||
public ResponseEntity<String> insertBOBbsRegist(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}// 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content = service.insertBOBbsRegist(vo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 아이디 중복확인
|
||||
* @param BbsmngrVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbsIdDplctCnfirm")
|
||||
public ResponseEntity<String> selectBOBbsIdDplctCnfirm(@RequestBody BOBbsVO vo) {
|
||||
|
||||
String result = service.selectBOBbsIdDplctCnfirm(vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content.put("paramVO", vo);
|
||||
content.put("message", result);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 게시판 수정 화면 | 상세 조회
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbsDtlUpdtForm")
|
||||
public ResponseEntity<String> selectBOBbsDtlUpdtForm(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap codeMap = new DataMap();
|
||||
codeMap = service.selectCommonCode(); // 공통 코드
|
||||
|
||||
List<DataMap> codeList = new ArrayList<>();
|
||||
codeList.add(codeMap);
|
||||
|
||||
List<DataMap> mbrGradList = new ArrayList<>();
|
||||
mbrGradList = service.selectBOBbsRegistForm(vo); //해당 쇼핑몰 회원 등급 조회
|
||||
|
||||
List<DataMap> updBbsList = new ArrayList<>();
|
||||
updBbsList = service.selectUpdBbsList(vo); // 해당 쇼핑몰 게시판 목록 조회
|
||||
|
||||
List<DataMap> messageList = new ArrayList<>();
|
||||
DataMap sms = new DataMap();
|
||||
sms = service.selectBOBbsSmsFormList(vo); // 메시지 폼
|
||||
|
||||
DataMap kakao = new DataMap();
|
||||
kakao = service.selectBOBbsKakaoFormList(vo); // 카카오 폼
|
||||
|
||||
List<DataMap> srchList = new ArrayList<>();
|
||||
DataMap srchData = new DataMap();
|
||||
srchData.put("srchWord", vo.getSrchWord());
|
||||
srchData.put("srchBbsTyCd", vo.getSrchBbsTyCd());
|
||||
srchData.put("srchSknTyCd", vo.getSrchSknTyCd());
|
||||
srchData.put("pageUnit", vo.getPageUnit());
|
||||
srchData.put("pageIndex", vo.getPageIndex());
|
||||
srchData.put("pageDv", vo.getPageDv());
|
||||
srchList.add(srchData);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content = service.selectBOBbsDtlUpdtInqire(vo); // 게시판 상세 조회
|
||||
content.put("mbrGradList", mbrGradList);
|
||||
content.put("codeContent", codeList);
|
||||
content.put("srchList", srchList);
|
||||
content.put("updBbsList", updBbsList);
|
||||
content.put("sms", sms);
|
||||
content.put("kakao", kakao);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 (게시글 설정 정보)
|
||||
*
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbscttSetupInfo")
|
||||
public ResponseEntity<String> selectBOBbscttSetupInfo(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content = service.selectBOBbsSetupInfo(vo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 수정
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOBbsUpdt")
|
||||
public ResponseEntity<String> updateBOBbsUpdt(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}// 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
log.debug(" 게시판 수정 파라미터 확인 : {}", vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content = service.updateBOBbsUpdt(vo);
|
||||
|
||||
List<DataMap> srchList = new ArrayList<>();
|
||||
DataMap srchData = new DataMap();
|
||||
srchData.put("srchWord", vo.getSrchWord());
|
||||
srchData.put("srchBbsTyCd", vo.getSrchBbsTyCd());
|
||||
srchData.put("srchSknTyCd", vo.getSrchSknTyCd());
|
||||
srchData.put("pageUnit", vo.getPageUnit());
|
||||
srchData.put("pageIndex", vo.getPageIndex());
|
||||
srchData.put("pageDv", vo.getPageDv());
|
||||
srchList.add(srchData);
|
||||
content.put("srchList", srchList);
|
||||
content.put("vo", vo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 게시판 삭제
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOBbsDel")
|
||||
public ResponseEntity<String> updateBOBbsDel(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
String result = service.updateBOBbsDel(vo);
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content.put("paramVO", vo);
|
||||
content.put("message", result);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시글 대시보드 조회폼
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbscttDshboardInqireForm")
|
||||
public ResponseEntity<String> selectBOBbscttDshboardInqireForm(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
// 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content = service.selectBOBbscttDshboardInqireForm(vo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 게시글 대시보드 조회
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbscttDshboardInqire")
|
||||
public ResponseEntity<String> selectBOBbscttDshboardInqire(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content = service.selectBOBbscttDshboardInqire(vo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 주요 게시판 설정 팝업
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOMainBbsExpsrSetupPopupForm")
|
||||
public ResponseEntity<String> selectBOMainBbsExpsrSetupPopupForm(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
content = service.selectBOMainBbsExpsrSetupPopupForm(vo);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 주요 게시판 설정 수정
|
||||
* @param BOBbsVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOMainBbsExpsrSetupUpdt")
|
||||
public ResponseEntity<String> updateBOMainBbsExpsrSetupUpdt(@RequestBody BOBbsVO vo) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
content = service.updateBOMainBbsExpsrSetupUpdt(vo);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.bbs.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.vo.BOBbsSetupVO;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.vo.BOBbsVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
/**
|
||||
* BOBbsMapper interface (back)
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2023-12-12
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-12 최범식 최초 생성
|
||||
* 2024-04-25 추지훈 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOBbsMapper {
|
||||
|
||||
/** 게시판 목록 조회 */
|
||||
public List<DataMap> selectBOBbsListInqire(BOBbsVO vo);
|
||||
/** 게시판 목록 페이징처리를 위한 총 개수 */
|
||||
public int selectBOBbsListCnt(BOBbsVO vo);
|
||||
/** 비속어 게시판 설정 정보 조회 */
|
||||
public BOBbsSetupVO selectBOSlangDftSetupPopupForm(BOBbsSetupVO vo);
|
||||
/** 비속어 사용 필터 조회 */
|
||||
public List<String> selectBOSlangUseAt(BOBbsVO vo);
|
||||
/** 게시판 등록|상세 화면 이동 셀랙트 리스트 조회 */
|
||||
public List<DataMap> selectBOBbsUpdListInqire(BOBbsVO vo);
|
||||
/** 게시판 상세 조회 */
|
||||
public BOBbsVO selectBOBbsDtlUpdtInqire(BOBbsVO vo);
|
||||
/** 게시판 자주쓰는 답변 조회 */
|
||||
public List<DataMap> selectBOBbscttRpusAnswInqire(DataMap vo);
|
||||
/** 입력 항목 정보 조회 */
|
||||
public List<DataMap> selectBOInputAditInqire(DataMap vo);
|
||||
/** 별점 관리 항복 정보 조회 */
|
||||
public List<DataMap> selectBOrvwInputInqire(DataMap vo);
|
||||
/** 점수 표시 정보 조회 */
|
||||
public DataMap selectBOScoreIndictInqire(DataMap vo);
|
||||
/** 입력 추가 문항 항목 조회 */
|
||||
public List<DataMap> selectBOInputItmAditString(String qesitmInnb);
|
||||
public List<DataMap> selectBOInputItmAditInqire(String qesitmInnb);
|
||||
/*리뷰 점수 표시 수정*/
|
||||
public Integer updateBOStarEvlForm(BOBbsVO bbsVO);
|
||||
/** 기능 권한 조회 */
|
||||
public DataMap selectBOBbsAuthInqire(BOBbsVO bbsVO);
|
||||
/** 운영사이트 표시 항목 조회 */
|
||||
public List<DataMap> selectBOBDesignItmInqire(String bbsId);
|
||||
public String selectBOBDesignItmString(String bbsId);
|
||||
|
||||
/** sms 조회 */
|
||||
public List<DataMap> selectBOBSmsItmInqire(BOBbsVO vo);
|
||||
/** 게시판 알림톡 내용 */
|
||||
public List<DataMap> selectBOBbsKakaoFormList(DataMap dm);
|
||||
/** 게시판 알림톡 치환 코드 */
|
||||
public List<DataMap> selectBOBbsKakaoSubstList(DataMap dm);
|
||||
/** 게시판 문자 내용 */
|
||||
public List<DataMap> selectBOBbsSmsFormList(DataMap dm);
|
||||
/** 게시판 문자 치환 코드 */
|
||||
public List<DataMap> selectBOBbsSmsSubstList(DataMap dm);
|
||||
|
||||
|
||||
/** 게시판 아이디 중복확인 */
|
||||
public int selectBOBbsIdDplctCnfirm(String bbsId);
|
||||
/** 비속어 게시판 설정 정보 등록 */
|
||||
public int insertBOSlangSetupRegist(BOBbsSetupVO vo);
|
||||
/** 게시판 등록 */
|
||||
public int insertBOBbsRegist(BOBbsVO vo);
|
||||
/** 게시판 디자인 등록 */
|
||||
public int insertBOBbsDesignRegist(BOBbsVO vo);
|
||||
/** 게시판 자주쓰는 답변 등록 */
|
||||
public int insertBOBbsRpusAnsw(BOBbsVO vo);
|
||||
/** 게시판 추가 문항 등록 */
|
||||
public int insertBOBbsAditQesitm(DataMap dm);
|
||||
|
||||
/**
|
||||
* 게시판 별점 등록 : 파라미터 - bbsVO
|
||||
* @param vo
|
||||
*/
|
||||
public void insertBOBbsAditQesitmParamIsBbsVO(BOBbsVO vo);
|
||||
|
||||
/** 게시판 추가 문항 항목 등록 */
|
||||
public int insertBOBbsAditQesitmForm(BOBbsVO vo);
|
||||
/** 게시판 목록 표시 항목 등록 */
|
||||
public int insertBOBbsDesignItmRegist(DataMap dm);
|
||||
/** 게시판 기능권한 등록 */
|
||||
public int insertBOBbsAuth(BOBbsVO vo);
|
||||
/** 게시판 SMS 발송 등록 */
|
||||
public int insertBOBbsSmsSndngRegist(BOBbsVO vo);
|
||||
/** 리뷰 게시판일 경우 마일리지 자동지급 */
|
||||
public int insertBOBbsMileageRegist(BOBbsVO vo);
|
||||
|
||||
/** 비속어 게시판 설정 정보 수정 */
|
||||
public int updateBOSlangSetupRegist(BOBbsVO vo);
|
||||
/** 게시판 수정 */
|
||||
public int updateBOBbsUpdt(BOBbsVO vo);
|
||||
public void updateBOBbsMlgNullUpdt(BOBbsVO vo);
|
||||
/** 게시판 추가 문항 수정 */
|
||||
public int updateBOBbsAditQesitm(DataMap dm);
|
||||
/** 게시판 추가 문항 항목 수정 */
|
||||
public int updateBOBbsAditQesitmForm(BOBbsVO vo);
|
||||
|
||||
public void updateBOBbsAditQesitmDelForm(BOBbsVO vo);
|
||||
public void updateBOBbsAditQesitmDelFormStar(BOBbsVO vo);
|
||||
|
||||
public void updateBOBbsAditItmDelForm(BOBbsVO vo);
|
||||
/** 게시글 기능권한 수정 */
|
||||
public int updateBOBbsAuth(BOBbsVO boBbsVo);
|
||||
/** 자주쓰는 답변 수정 */
|
||||
public int updateBOBbsRpusAnsw(BOBbsVO vo);
|
||||
|
||||
/** 자주쓰는 답변 전체 삭제*/
|
||||
public int deleteBOBbsRpuseAnsw(BOBbsVO vo);
|
||||
|
||||
/** 게시판 목룍 표시 항목 수정 */
|
||||
public int updateBOBbsDesignItmUpdt(BOBbsVO vo);
|
||||
/** 게시판 디자인 수정 */
|
||||
public int updateBOBBsDesignUpdt(BOBbsVO vo);
|
||||
/** 게시판 SMS 발송 수정 */
|
||||
public int updateBOBbsSmsSndngRegist(DataMap dm);
|
||||
/** 게시판 SMS 발송 삭제 */
|
||||
public int deleteBOBbsSmsSndngDel(BOBbsVO vo);
|
||||
/** 게시판 목록표시항목 삭제 */
|
||||
public int deleteBOBbsDesignItmDel(String bbsId);
|
||||
/** 게시판 기능권한 삭제 */
|
||||
public int deleteBOBbsAuthDel(String bbsId);
|
||||
/** 게시판 삭제 */
|
||||
public int updateBOBbsDel(BOBbsVO bbsVO);
|
||||
|
||||
/** 그룹 맴버 조회 */
|
||||
public List<DataMap> selectMbrGradGroupList(BOBbsVO vo);
|
||||
|
||||
/** 게시판 대시보드 목록 조회 */
|
||||
public List<DataMap> selectBOBbsDshboardInqire(DataMap dm);
|
||||
/** 게시판 대시보드 (게시글 조회) */
|
||||
public List<DataMap> selectBOBbsttListInqire(BOBbsVO vo);
|
||||
/** 게시판 대시보드 (게시판 기준 게시글 수) */
|
||||
public int selectBOBbsttListCount(DataMap vo);
|
||||
/** 게시판 대시보드 > 주요 게시판 설정 수정 */
|
||||
public int updateBOMainBbsExpsrSetupUpdt(DataMap dm);
|
||||
|
||||
/** 게시판 목록 게시글 수 count 20240308추가 > 게시글 목록 조회*/
|
||||
public List<DataMap> selectBOBbsListCntInqire(BOBbsVO bbsVO);
|
||||
|
||||
/** 게시판 설정 정보 조회 20240308추가*/
|
||||
public DataMap selectBOBbsSetupInfo(BOBbsVO bbsVO);
|
||||
/** 쇼핑몰 별 이벤트 게시판 조회 */
|
||||
public List<DataMap> selectBOEvtBbsList(BOBbsVO bbsVO);
|
||||
|
||||
/* 게시판 설정 마일리지 조회*/
|
||||
public BOBbsVO selectBOBbsMilInqire(BOBbsVO bbsvo);
|
||||
/* 상품 상세 리뷰, qna 설정 정보 조회 */
|
||||
public DataMap selectBOGoodsDtlBbsInfo(BOBbsVO bbsvo);
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.bbs.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* BOBbsSetupVO Class (back)
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2023-12-12
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-12 최범식 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class BOBbsSetupVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** fm_board_setup_info */
|
||||
/** 설정정보고유번호 */
|
||||
private String setupInfoInnb;
|
||||
/** 마스킹비속어 */
|
||||
private String mskgSlang;
|
||||
/** 허용도메인 */
|
||||
private String permDomn;
|
||||
/** 허용파일확장자 */
|
||||
private String permFilExtsn;
|
||||
/** 허용이미지확장자 */
|
||||
private String permImgExtsn;
|
||||
|
||||
private String sopmalCd;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.bbs.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* BOBbsVO Class (back)
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2023-12-12
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-12 최범식 최초 생성
|
||||
* 2024-04-25 추지훈 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class BOBbsVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 게시판 게시판 번호 */
|
||||
private String rnum;
|
||||
/** 게시판 게시판 ID */
|
||||
private String bbsId;
|
||||
/** 게시판 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 게시판 설정정보 고유번호 */
|
||||
private String setupInfoInnb;
|
||||
/** 게시판 게시판명 */
|
||||
private String bbsNm;
|
||||
/** 게시판 게시판 유형 */
|
||||
private String bbsTyCd;
|
||||
/** 게시판 게시판 유형명 */
|
||||
private String bbsTyNm;
|
||||
/** 게시판 스킨 (리스트형, 갤러리형, 아코디언형) */
|
||||
private String sknTyCd;
|
||||
/** 게시판 읽기 사용여부 */
|
||||
private String bbscttRedngUseAt;
|
||||
/** 게시판 읽기 전체 | 회원 | 관리자 */
|
||||
private String bbscttRedngAuthorDvCd;
|
||||
/** 게시판 쓰기 사용여부 */
|
||||
private String bbscttRegistUseAt;
|
||||
/** 게시판 쓰기 전체 | 회원 | 관리자 */
|
||||
private String bbscttRegistAuthorDvCd;
|
||||
/** 게시판 답글 사용여부 */
|
||||
private String answRegistUseAt;
|
||||
/** 게시판 답글 전체 | 회원 | 관리자 */
|
||||
private String answRegistAuthorDvCd;
|
||||
/** 게시판 댓글 사용여부 */
|
||||
private String cmRegistUseAt;
|
||||
/** 게시판 댓글 전체 | 회원 | 관리자 */
|
||||
private String cmRegistAuthorDvCd;
|
||||
/** 게시판 게시글평가사용여부 */
|
||||
private String bbscttEvlUseAt;
|
||||
/** 게시판 추천/비추천, 추천 */
|
||||
private String bbscttEvlRecomendStep;
|
||||
/** 게시판 댓글평가사용여부 */
|
||||
private String cmEvlUseAt;
|
||||
/** 게시판 추천/비추천, 추천 */
|
||||
private String cmEvlRecomendStep;
|
||||
/** 게시판 기본내용사용여부 */
|
||||
private String dftCnUseAt;
|
||||
/** 게시판 기본내용 */
|
||||
private String dftCn;
|
||||
/** 게시판 모바일기본내용사용여부 */
|
||||
private String mblDftCnUseAt;
|
||||
/** 게시판 모바일기본내용 */
|
||||
private String mblDftCn;
|
||||
/** 게시판 비밀글사용여부 */
|
||||
private String secretBbscttUseAt;
|
||||
/** 게시판 자동등록방지사용여부 */
|
||||
private String atmcRegistPrvnUseAt;
|
||||
/** 게시판 파일첨부사용여부 */
|
||||
private String filAtchUseAt;
|
||||
/** 게시판 댓글설정사용여부 */
|
||||
private String cmSetupUseAt;
|
||||
/** 게시판 추천상품노출여부 */
|
||||
private String recomendGoodsExpsrAt;
|
||||
/** 게시판 비속어 개별 | 통합 */
|
||||
private String slangFlterUseAt;
|
||||
/** 게시판 페이지세로건수 */
|
||||
private String pgeVtcCnt;
|
||||
/** 게시판 페이지가로건수 */
|
||||
private String pgeWthCnt;
|
||||
/** 게시판 아이디(등급),아이디, 이름(등급),이름,이름(아이디,등급),이름(아이디) */
|
||||
private String wrterIndictTyCd;
|
||||
/** 게시판 관리자명 */
|
||||
private String mngrNm;
|
||||
/** 게시판 게시글발송방식코드 */
|
||||
private String bbscttSndngMthCd;
|
||||
/** 게시판노출여부 */
|
||||
private String bbsExpsrAt;
|
||||
/** 게시판 상품상세페이지 노출건수 */
|
||||
private String goodsDtlPgeExpsrCnt;
|
||||
/** 게시판 신규게시물기준일수 */
|
||||
private String newNttStdrDeCnt;
|
||||
/** 게시판 인기게시물기준조회건수 */
|
||||
private String popularNttStdrInqireCnt;
|
||||
/** 리스트표시여부_번호 */
|
||||
private String innbYn;
|
||||
/** 리스트표시여부_제목 */
|
||||
private String sjYn;
|
||||
/** 리스트표시여부_내용 */
|
||||
private String cnYn;
|
||||
/** 리스트표시여부_작성자 */
|
||||
private String regusrNmYn;
|
||||
/** 리스트표시여부_등록일 */
|
||||
private String registDtYn;
|
||||
/** 리스트표시여부_공지기간 */
|
||||
private String ntcDeYn;
|
||||
/** 리스트표시여부_조회수 */
|
||||
private String inqireCntYn;
|
||||
|
||||
|
||||
/** 게시판 마일리지 */
|
||||
/** 게시판 작성글자수 */
|
||||
private String writngChrCnt;
|
||||
|
||||
/** 게시판 일반후기마일리지적립금액 */
|
||||
private String gnrlRvwMlgAccmlmnyAmt;
|
||||
private BigDecimal gnrlRvwMlgAccmlmnyAmtDeci;
|
||||
|
||||
/** 게시판 일반후기마일리지유효월수 */
|
||||
private String gnrlRvwMlgValidMtCnt;
|
||||
|
||||
/** 게시판 포토후기마일리지적립금액 */
|
||||
private String photoRvwMlgAccmlmnyAmt;
|
||||
private BigDecimal photoRvwMlgAccmlmnyAmtDeci;
|
||||
|
||||
/** 게시판 포토후기마일리지유효월수 */
|
||||
private String photoRvwMlgValidMtCnt;
|
||||
|
||||
/** 게시판 추가마일리지지급시작일자 */
|
||||
private String aditMlgPymntBgnDe;
|
||||
|
||||
/** 게시판 추가마일리지지급종료일자 */
|
||||
private String aditMlgPymntEndDe;
|
||||
|
||||
/** 게시판 추가지급마일리지적립금액 */
|
||||
private String aditPymntMlgAccmlmnyAmt;
|
||||
private BigDecimal aditPymntMlgAccmlmnyAmtDeci;
|
||||
|
||||
/** 게시판 추가지급마일리지유효월수 */
|
||||
private String aditPymntMlgValidMtCnt;
|
||||
|
||||
/** 게시판 마일리지 자동 지급 여부 */
|
||||
private String goodsRvwMlgPymntAt;
|
||||
|
||||
/** 게시판 주문 설정 유효기간 > 게시판 0으로 되어 있을 시 주문설정의 유효기간 따라감*/
|
||||
private String sopmalSetupValidPd;
|
||||
|
||||
/** 게시판 주요게시판여부 */
|
||||
private String mainBbsAt;
|
||||
/** 게시판 주요게시판노출순서 */
|
||||
private String mainBbsExpsrOrdr;
|
||||
|
||||
/** 게시판 전체 | 회원 */
|
||||
private String[] redngAuthorDvCdArr;
|
||||
private String[] registAuthorDvCdArr;
|
||||
private String[] answRegistAuthorDvCdArr;
|
||||
private String[] cmRegistAuthorDvCdArrArr;
|
||||
private String[] bbscttRedngAuthorDvCd_c;
|
||||
private String[] bbscttRegistAuthorDvCd_c;
|
||||
private String[] answRegistAuthorDvCd_c;
|
||||
private String[] cmRegistAuthorDvCd_c;
|
||||
|
||||
/** 게시판 기능 권한 [] 값 */
|
||||
private String bbscttRedngAuthorDvCdNm;
|
||||
private String bbscttRegistAuthorDvCdNm;
|
||||
private String answRegistAuthorDvCdNm;
|
||||
private String cmRegistAuthorDvCdNm;
|
||||
|
||||
/** 게시판읽기 권한 회원 _ 전체여부 */
|
||||
private String bbscttRedngAuthorDvCd_c_all;
|
||||
/** 게시판쓰기 권한 회원 _ 전체여부 */
|
||||
private String bbscttRegistAuthorDvCd_c_all;
|
||||
/** 답변쓰기 권한 회원 _ 전체여부 */
|
||||
private String answRegistAuthorDvCd_c_all;
|
||||
/** 댓글쓰기 권한 회원 _ 전체여부 */
|
||||
private String cmRegistAuthorDvCd_c_all;
|
||||
|
||||
/** 게시판 검색어 */
|
||||
private String srchWord;
|
||||
/** 게시판 타입 검색어 */
|
||||
private String[] srchBbsTyCdArr;
|
||||
private String srchBbsTyCd;
|
||||
/** 게시판 스킨 검색어 */
|
||||
private String[] srchSknTyCdArr;
|
||||
private String srchSknTyCd;
|
||||
private String pageDv;
|
||||
|
||||
/** boardform */
|
||||
/** 문항 고유번호 */
|
||||
private String qesitmInnb;
|
||||
/** 문항 고유번호 "분류" */
|
||||
private String inputDvInnb;
|
||||
/** 문항 고유번호 "별점관리" */
|
||||
private String scoreInnb;
|
||||
/** 점수 표시 */
|
||||
private String qesitmInnb_s;
|
||||
/** 분류명 */
|
||||
private String oldDvQesitmInnbs;
|
||||
/** 입력항목 */
|
||||
private String oldIpQesitmInnbs;
|
||||
/** 분류명 */
|
||||
private String[] qesitmInnb_d;
|
||||
/** 입력항목 */
|
||||
private String[] qesitmInnb_i;
|
||||
|
||||
/** 문항명 */
|
||||
private String qesitmNm;
|
||||
/** 입력항목 */
|
||||
private String[] qesitmNm_i;
|
||||
/** 분류명 */
|
||||
private String[] qesitmNm_d;
|
||||
/** 문항설명 */
|
||||
private String qesitmDc;
|
||||
private String[] qesitmDc_i;
|
||||
|
||||
private String starDelList;
|
||||
|
||||
/** 추가입력, 추가평가, 분류관리, 별점 */
|
||||
private String aditItmDvCd;
|
||||
/** 입력항목 */
|
||||
private String[] aditItmDv_i;
|
||||
|
||||
/** 문항필수여부 */
|
||||
private String qesitmEssntlAt;
|
||||
private String[] qesitmEssntlAt_i;
|
||||
|
||||
/** 문항사용여부 */
|
||||
private String qesitmUseAt;
|
||||
private String[] qesitmUseAt_i;
|
||||
|
||||
/** 라디오,셀렉트,체크,텍스트,이미지, 점수 */
|
||||
private String itmTyCd;
|
||||
private String itmTyCdNm;
|
||||
/** 입력항목|공지|이벤트 */
|
||||
private String[] itmTy_i;
|
||||
|
||||
/** 문항순서 */
|
||||
private String qesitmOrdr;
|
||||
/** 이미지, 점수 (항목구분 : 별점평가 인 경우만 입력) */
|
||||
private String scoreIndictMthCd;
|
||||
|
||||
/** boardform_itm */
|
||||
/** 항목 고유번호 */
|
||||
private String itmInnb;
|
||||
private String[] oldItmInnbs;
|
||||
private String olddvItmInnbs;
|
||||
private String[] itmInnb_i;
|
||||
/** 항목 내용 */
|
||||
private String itmCn;
|
||||
private String[] itmCn_i;
|
||||
/** 항목 순서 */
|
||||
private String itmOrdr;
|
||||
|
||||
|
||||
/** board_rpus_answ */
|
||||
/** 게시판 자주쓰는답변 고유번호 */
|
||||
private String rpuseAnswInnb;
|
||||
private String[] rpuseAnswInnbArr;
|
||||
private String oldRpusInnbs;
|
||||
/** 게시판 내용 */
|
||||
private String cn;
|
||||
private List<String> cnArr;
|
||||
/** 게시판 정렬순서 */
|
||||
private String sortOrdr;
|
||||
|
||||
/** board_auth */
|
||||
//어떤권한체크인지(게시글 읽기인지, 등록인지, 댓글 등록인지 REDNG,REGIST,CM)
|
||||
private String AuthDv;
|
||||
|
||||
/** board_design_item */
|
||||
/** 게시판 표시항목 고유번호 */
|
||||
private String indictItmInnb;
|
||||
/** 게시판 항목명 */
|
||||
private String itmNm;
|
||||
private String[] itmNmArr;
|
||||
|
||||
/** board_setup_info */
|
||||
/** 게시판 마스킹비속어 */
|
||||
private String mskgSlang;
|
||||
/** 게시판 허용도메인 */
|
||||
private String permDomn;
|
||||
/** 게시판 허용파일확장자 */
|
||||
private String filPermFilExtsn;
|
||||
/** 게시판 허용이미지확장자 */
|
||||
private String permImgExtsn;
|
||||
|
||||
/** board_sms */
|
||||
/** SMS 게시글발송구분코드 */
|
||||
private String bbscttSndngDvCd;
|
||||
private String[] sndngDvCdArr;
|
||||
/** SMS 알림톡 발송양식 고유번호 */
|
||||
private String ntcntalkSndngFormInnb;
|
||||
private String[] ntcntalkSndngFormInnbArr;
|
||||
/** SMS 내용 */
|
||||
private String smsCn;
|
||||
private String[] smsCnArr;
|
||||
/** SMS 알림발송고유번호 */
|
||||
private String ntcnSndngInnb;
|
||||
private String[] ntcnSndngInnbArr;
|
||||
|
||||
/** 게시판 기능권한 */
|
||||
private List<Map<String, Object>> authorList;
|
||||
/** 게시판 추가 문항 + 항목 */
|
||||
private DataMap addItems;
|
||||
/** 게시판 분류 항목 */
|
||||
private DataMap divItems;
|
||||
/** 게시판 자주쓰는 질문 */
|
||||
private List<DataMap> rpusAnsList;
|
||||
/** 게시판 디자인 + 운영 사이트 표시항목 */
|
||||
private DataMap design;
|
||||
/** 게시판 메시지 발송 */
|
||||
private DataMap smsSndng;
|
||||
|
||||
/** 주요 게시판 > 비노출 */
|
||||
private String[] nonExpArr;
|
||||
/** 주요 게시판 > 노출 */
|
||||
private String[] expArr;
|
||||
|
||||
private String bbscttInnb;
|
||||
|
||||
private String mbrGradGroupInnb;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.bbscttAjax.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.service.BOGnrlbbscttService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.vo.BOGnrlbbscttVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 게시글 ajax
|
||||
*
|
||||
* @author 김혜지
|
||||
* @version 1.0
|
||||
* @see <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-09-05 김혜인 최초 생성
|
||||
* </pre>
|
||||
* @since 2024-01-05
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/ajax/bbscttAjax")
|
||||
public class BOBbscttAjaxController {
|
||||
|
||||
@Autowired
|
||||
private BOGnrlbbscttService service;
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
/**
|
||||
* 게시글 내용조회
|
||||
* @param bbsctt 파라미터VO
|
||||
* @return List<DataMap> 전체 목록
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBbscttCnAjax")
|
||||
public ResponseEntity<?> selectBOBbscttCnAjax(@RequestBody BOGnrlbbscttVO bbsctt) {
|
||||
Map<String,Object> content = new HashMap<>();
|
||||
DataMap result = service.selectBOBbscttCn(bbsctt);
|
||||
if(result != null){
|
||||
content.put("result",result);
|
||||
}else{
|
||||
content.put("result","none");
|
||||
}
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cm.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.service.BOBbsService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.vo.BOBbsVO;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cm.service.BOCmService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cm.vo.BOCmVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 댓글 관리 Controller
|
||||
*
|
||||
* @author 김혜지
|
||||
* @since 2024-01-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-26 김혜지 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bbs/cm")
|
||||
public class BOCmController {
|
||||
|
||||
@Autowired
|
||||
private BOCmService service;
|
||||
@Autowired
|
||||
private BOBbsService bbsService;
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
/**
|
||||
* 댓글 등록
|
||||
* @param cm 댓글 파라미터VO
|
||||
* @return ResponseEntity<?> 등록 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/insertBOCmRegist")
|
||||
public ResponseEntity<?> insertBOCmRegist(@RequestBody BOCmVO cm) {
|
||||
DataMap content = new DataMap();
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cm.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
//쇼핑몰 코드
|
||||
if (user.getUserInnb() > 0) {//회원 or 관리자
|
||||
cm.setRegusr(user.getUserInnb());//등록자 고유번호
|
||||
cm.setUpdusr(user.getUserInnb());//수정자 공유번호
|
||||
if ("mngr".equals(cm.getServerDv())) {//등록자 구분 코드
|
||||
cm.setRegusrDvCd("02"); //관리자
|
||||
} else {
|
||||
cm.setRegusrDvCd("01"); //회원
|
||||
}
|
||||
cm.setRegusrNm(user.getMbrNm());
|
||||
cm.setRegusrId(user.getMbrId());
|
||||
} else {//비회원
|
||||
cm.setRegusr(0);
|
||||
cm.setUpdusr(0);
|
||||
cm.setRegusrDvCd("99"); //비회원
|
||||
}
|
||||
//TODO::작성자 정보 추출
|
||||
DataMap map = new DataMap();
|
||||
map = service.insertBOCmRegist(cm);
|
||||
content.put("map", map);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 댓글 조회
|
||||
* @param cm
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOCmList")
|
||||
public ResponseEntity<?> selectBOCmList(@RequestBody BOCmVO cm){
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cm.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
//쇼핑몰 코드
|
||||
cm.setMbrDvCd(user.getMbrDvCd());
|
||||
Map<String,Object> content = new HashMap<String, Object>();
|
||||
|
||||
// pagination
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(cm.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(cm.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
|
||||
cm.setPaginationInfo(paginationInfo);
|
||||
cm.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
cm.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
cm.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
if(user.getUserInnb() > 0){
|
||||
cm.setRegusr(user.getUserInnb());
|
||||
if ("mngr".equals(cm.getReqPageDv())) {
|
||||
cm.setRegusrDvCd("02"); //관리자
|
||||
} else {
|
||||
cm.setRegusrDvCd("01"); //회원
|
||||
cm.setRegusrNm(user.getMbrNm());
|
||||
}
|
||||
}else{
|
||||
cm.setRegusr(0);
|
||||
cm.setRegusrDvCd("99");//비회원
|
||||
}
|
||||
|
||||
//작성자 정보
|
||||
BOCmVO regusrInfo = new BOCmVO();
|
||||
regusrInfo.setRegusrNm(user.getMbrNm());
|
||||
regusrInfo.setRegusrId(user.getMbrId());
|
||||
|
||||
//게시판 설정 정보 조회
|
||||
// bbsVO에 쇼핑몰코드, 해당 게시판 set
|
||||
BOBbsVO bbsVO = new BOBbsVO();
|
||||
bbsVO.setSopmalCd(cm.getSopmalCd());
|
||||
bbsVO.setBbsId(cm.getBbsId());
|
||||
|
||||
// 게시판 설정 정보 조회
|
||||
DataMap bbsInfo = new DataMap();
|
||||
bbsInfo = bbsService.selectBOBbsSetupInfo(bbsVO);
|
||||
|
||||
// 댓글 목록 조회, 건수, 작성자 정보 조회
|
||||
Map<String,Object> cmList = service.selectBOCmList(cm);
|
||||
|
||||
content.put("cmList", cmList);
|
||||
content.put("bbsInfo", bbsInfo);
|
||||
content.put("regusrInfo", regusrInfo);
|
||||
content.put("cmVO", cm);
|
||||
content.put("paginationInfo", cm.getPaginationInfo());
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 > 댓글 crud 여부 판단
|
||||
*
|
||||
* @param bbsctt 게시글 파라미터VO
|
||||
* @return ResponseEntity<?> 목록조회 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOCmRegusrCnfirm")
|
||||
public ResponseEntity<?> selectBOCmRegusrCnfirm(@RequestBody BOCmVO cm) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
cm.setSopmalCd(user.getSopmalCd());
|
||||
cm.setMbrInnb(user.getUserInnb());
|
||||
DataMap result = new DataMap();
|
||||
if (!"Y".equals(cm.getPwCnfirmAt())) {
|
||||
result = service.selectBOCmRegusrCnfirm(cm);
|
||||
}
|
||||
DataMap content = new DataMap();
|
||||
content.put("result", result);
|
||||
content.put("vo", cm);
|
||||
/*비밀번호 확인이 되었거나 */
|
||||
if ("Y".equals(cm.getPwCnfirmAt()) || "YES".equals(result.get("moveAt"))) {
|
||||
DataMap dtl = service.selectBOCmCn(cm);
|
||||
content.put("dtl", dtl);
|
||||
}
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 댓글 수정
|
||||
* @param cm 댓글 파라미터VO
|
||||
* @return ResponseEntity<?> 수정 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOCmUpdt")
|
||||
public ResponseEntity<?> updateBOCmUpdt(@RequestBody BOCmVO cm) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cm.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
;
|
||||
if (user.getUserInnb() > 0) {//회원 or 관리자
|
||||
cm.setUpdusr(user.getUserInnb());
|
||||
} else {//비회원
|
||||
cm.setUpdusr(0);
|
||||
}
|
||||
|
||||
DataMap content = new DataMap();
|
||||
DataMap map = new DataMap();
|
||||
|
||||
map = service.updateBOCmUpdt(cm);
|
||||
content.put("map", map);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 댓글 삭제
|
||||
* @param cm 댓글 파라미터VO
|
||||
* @return ResponseEntity<?> 수정 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/deleteBOCmDel")
|
||||
public ResponseEntity<?> deleteBOCmDel(@RequestBody BOCmVO cm) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cm.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
if (user.getUserInnb() > 0) {//회원 or 관리자
|
||||
cm.setUpdusr(user.getUserInnb());
|
||||
} else {//비회원
|
||||
cm.setUpdusr(0);
|
||||
}
|
||||
|
||||
DataMap content = new DataMap();
|
||||
DataMap map = new DataMap();
|
||||
|
||||
map = service.updateBOCmDel(cm);
|
||||
content.put("map", map);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 댓글 비밀번호 확인
|
||||
* @param cm 댓글 파라미터VO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOComparPassword")
|
||||
public ResponseEntity<?> selectBOComparPassword(@RequestBody BOCmVO cm) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
cm.setSopmalCd(user.getSopmalCd());
|
||||
|
||||
DataMap content = new DataMap();
|
||||
log.info("댓글 고유번호 확인{}",cm.getCmInnb());
|
||||
Integer pw = service.selectBOComparPassword(cm);
|
||||
content.put("pw", pw);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 댓글 추천 비추천
|
||||
* @param cm 댓글 파라미터VO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOCmRecomendUpdt")
|
||||
public ResponseEntity<?> updateBOCmRecomendUpdt(@RequestBody BOCmVO cm) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
cm.setSopmalCd(user.getSopmalCd());
|
||||
|
||||
DataMap content = new DataMap();
|
||||
content = service.updateBOCmRecomendUpdt(cm);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cm.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.cm.vo.BOCmVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
|
||||
/**
|
||||
* 댓글 관리 Mapper
|
||||
*
|
||||
* @author 김혜지
|
||||
* @since 2024-01-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-26 김혜지 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOCmMapper {
|
||||
|
||||
/** 댓글 목록 건수 조회 */
|
||||
public int selectBOBCmListCnt(BOCmVO cm);
|
||||
/** 댓글 목록 조회 */
|
||||
public List<DataMap> selectBOCmListInqire(BOCmVO cm);
|
||||
/** 대댓글 목록 조회 */
|
||||
public List<DataMap> selectBOCmAnswListInqire(BOCmVO cm);
|
||||
/*댓글 사용자 여부*/
|
||||
DataMap selectBOCmRegusrCnfirm(BOCmVO vo);
|
||||
/*댓글 내용 조회*/
|
||||
public DataMap selectBOCmCn(BOCmVO vo);
|
||||
/** 댓글 작성자 정보 조회*/
|
||||
public DataMap selectBOCmWrter(BOCmVO cm);
|
||||
/** 댓글 등록 */
|
||||
public Integer insertBOCmRegist(BOCmVO cm);
|
||||
/** 댓글 답변 등록 */
|
||||
public void insertBOCmAnswRegist(BOCmVO cm);
|
||||
/** 댓글 수정 */
|
||||
public Integer updateBOCmUpdt(BOCmVO cm);
|
||||
/** 댓글 논리 삭제 */
|
||||
public Integer updateBOCmDel(DataMap map);
|
||||
/** 댓글 비밀번호 확인*/
|
||||
public Integer selectBOComparPassword(BOCmVO cm);
|
||||
/** 댓글 추천 비추천 업데이트*/
|
||||
public void updateBOCmRecomendUpdt(BOCmVO cm);
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cm.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.service.BOBbsService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.vo.BOBbsSetupVO;
|
||||
import com.wb.domainserver.domain.gcone.bbs.bbs.vo.BOBbsVO;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cm.mapper.BOCmMapper;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cm.vo.BOCmVO;
|
||||
import com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.service.BOGnrlbbscttService;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 댓글 관리 Service
|
||||
*
|
||||
* @author 김혜지
|
||||
* @since 2024-01-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-26 김혜지 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BOCmService {
|
||||
|
||||
@Autowired
|
||||
private BOCmMapper mapper;
|
||||
@Autowired
|
||||
private BOGnrlbbscttService boGnrlbbscttService;
|
||||
@Autowired
|
||||
private BOBbsService bbsService;
|
||||
/**
|
||||
* 댓글 목록 조회
|
||||
* @param cm 파라미터VO
|
||||
* @return totCnt 목록 건수
|
||||
*/
|
||||
public Map<String,Object> selectBOCmList(BOCmVO cm){
|
||||
Map<String,Object> map = new HashMap<String, Object>();
|
||||
List<DataMap> resultList = new ArrayList<>();
|
||||
List<DataMap> cmAnswList = new ArrayList<>();
|
||||
Integer totCnt;
|
||||
totCnt = mapper.selectBOBCmListCnt(cm);
|
||||
cm.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
//댓글 조회
|
||||
if (totCnt > 0) {
|
||||
resultList = mapper.selectBOCmListInqire(cm);
|
||||
/*비속어 필터*/
|
||||
BOBbsVO boBbsVO = new BOBbsVO();
|
||||
boBbsVO.setSopmalCd(cm.getSopmalCd());
|
||||
BOBbsSetupVO setupInfo = bbsService.selectBOSlangDftSetupPopupForm(boBbsVO);
|
||||
String mskgSlang = setupInfo.getMskgSlang(); //setup정보에서 마스킹언어 get
|
||||
log.debug("확인 {} ",cm.getSlangFlterUseAt());
|
||||
if ("Y".equals(cm.getSlangFlterUseAt())) {
|
||||
if (resultList != null) {
|
||||
for (DataMap data : resultList) {
|
||||
if (data.containsKey("cn")) { //사용자 아코디언형 내용 마스킹 필터링
|
||||
String cn = boGnrlbbscttService.selectBOFilterSlang(String.valueOf(data.get("cn")), mskgSlang);
|
||||
data.put("cn", cn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*대댓글 조회*/
|
||||
if(resultList != null) {
|
||||
List<BigInteger> cmInnbList = new ArrayList<>();
|
||||
for (int i = 0; resultList.size() > i; i++) {
|
||||
BigInteger cmInnb = ((BigInteger) resultList.get(i).get("cmInnb"));
|
||||
cmInnbList.add(cmInnb);
|
||||
}
|
||||
cm.setCmInnbArr(cmInnbList);
|
||||
cmAnswList = mapper.selectBOCmAnswListInqire(cm);
|
||||
/*비속어 필터*/
|
||||
if ("Y".equals(cm.getSlangFlterUseAt())) {
|
||||
if (cmAnswList != null) {
|
||||
for (DataMap data : cmAnswList) {
|
||||
if (data.containsKey("cn")) { //사용자 아코디언형 내용 마스킹 필터링
|
||||
String cn = boGnrlbbscttService.selectBOFilterSlang(String.valueOf(data.get("cn")), mskgSlang);
|
||||
data.put("cn", cn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//댓글 개수(댓글 개수 + 대댓글 개수)
|
||||
int cmCnt = (CollectionUtils.isEmpty(cmAnswList)) ? 0 : cmAnswList.size();
|
||||
cmCnt = cmCnt + totCnt;
|
||||
map.put("cmCnt",cmCnt);
|
||||
map.put("cmList",resultList);
|
||||
map.put("cmAnswList",cmAnswList);
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 댓글 내용 조회
|
||||
* @param cm
|
||||
* @return Datamap
|
||||
*/
|
||||
public DataMap selectBOCmRegusrCnfirm(BOCmVO cm){
|
||||
return mapper.selectBOCmRegusrCnfirm(cm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 댓글 내용 조회
|
||||
* @param cm
|
||||
* @return Datamap
|
||||
*/
|
||||
public DataMap selectBOCmCn(BOCmVO cm){
|
||||
DataMap cn = new DataMap();
|
||||
cn = mapper.selectBOCmCn(cm);
|
||||
return cn;
|
||||
}
|
||||
/**
|
||||
* 댓글 등록
|
||||
* @param cm 파라미터VO
|
||||
* @return Integer 등록결과
|
||||
*/
|
||||
public DataMap insertBOCmRegist(BOCmVO cm){
|
||||
DataMap message = new DataMap();
|
||||
try {
|
||||
//댓글 구분(댓글 or 대댓글)
|
||||
if(StringUtil.isEmpty(cm.getCmInnb())) {
|
||||
cm.setDepth(0);
|
||||
} else {
|
||||
cm.setParntsCmInnb(cm.getCmInnb());
|
||||
cm.setDepth(1);
|
||||
}
|
||||
mapper.insertBOCmRegist(cm);
|
||||
message.put("result","success");
|
||||
} catch (WnbtRestException wre) {
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 댓글 수정
|
||||
* @param cm 파라미터VO
|
||||
* @return Integer 수정결과
|
||||
*/
|
||||
public DataMap updateBOCmUpdt(BOCmVO cm){
|
||||
DataMap message = new DataMap();
|
||||
try {
|
||||
mapper.updateBOCmUpdt(cm);
|
||||
message.put("result", "success");
|
||||
} catch (WnbtRestException wre) {
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 댓글 논리 삭제
|
||||
* @param cm 파라미터VO
|
||||
* @return Integer 삭제결과
|
||||
*/
|
||||
public DataMap updateBOCmDel(BOCmVO cm){
|
||||
DataMap message = new DataMap();
|
||||
try {
|
||||
String[] delCmInnb = cm.getDelCmInnbArr();
|
||||
DataMap map = new DataMap();
|
||||
map.put("bbsId", cm.getBbsId());
|
||||
map.put("bbscttInnb", cm.getBbscttInnb());
|
||||
map.put("sopmalCd", cm.getSopmalCd());
|
||||
map.put("useAt", "N");
|
||||
map.put("updusr", cm.getUpdusr());
|
||||
for (int i = 0; i < delCmInnb.length; i++) {
|
||||
map.put("cmInnb", delCmInnb[i]);
|
||||
mapper.updateBOCmDel(map);
|
||||
}
|
||||
message.put("result", "성공");
|
||||
} catch (WnbtRestException wre) {
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
/**
|
||||
* 댓글 비밀번호 확인
|
||||
* @param cm 파라미터VO
|
||||
* @return Integer 비교결과
|
||||
*/
|
||||
public Integer selectBOComparPassword(BOCmVO cm) {
|
||||
Integer pw;
|
||||
pw = mapper.selectBOComparPassword(cm);
|
||||
return pw;
|
||||
}
|
||||
/**
|
||||
* 댓글 추천 비추천
|
||||
* @param cm 파라미터VO
|
||||
* @return Integer 비교결과
|
||||
*/
|
||||
public DataMap updateBOCmRecomendUpdt(BOCmVO cm) {
|
||||
DataMap content = new DataMap();
|
||||
try {
|
||||
mapper.updateBOCmRecomendUpdt(cm);
|
||||
content.put("result", mapper.selectBOCmCn(cm));
|
||||
} catch (WnbtRestException wre) {
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new WnbtRestException(e.getMessage());
|
||||
}
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cm.vo;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOCmVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*회원고유번호*/
|
||||
private Integer mbrInnb;
|
||||
/**
|
||||
* 댓글고유번호
|
||||
*/
|
||||
private String cmInnb;
|
||||
private List<BigInteger> cmInnbArr;
|
||||
/**
|
||||
* 게시글고유번호
|
||||
*/
|
||||
private String bbscttInnb;
|
||||
/**
|
||||
* 게시판ID
|
||||
*/
|
||||
private String bbsId;
|
||||
/**
|
||||
* 부모댓글고유번호
|
||||
*/
|
||||
private String parntsCmInnb;
|
||||
/**
|
||||
* 작성자ID
|
||||
*/
|
||||
private String regusrId;
|
||||
/**
|
||||
* 작성자명
|
||||
*/
|
||||
private String regusrNm;
|
||||
/**
|
||||
* DEPTH
|
||||
*/
|
||||
private Integer depth;
|
||||
/**
|
||||
* 내용
|
||||
*/
|
||||
private String cn;
|
||||
/**
|
||||
* 비밀번호
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 비밀댓글여부
|
||||
*/
|
||||
private String secretBbscttAt;
|
||||
/**
|
||||
* IP
|
||||
*/
|
||||
private String ip;
|
||||
/**
|
||||
* AGENT_ID
|
||||
*/
|
||||
private String agentId;
|
||||
/**
|
||||
* 사용여부
|
||||
*/
|
||||
private String useAt;
|
||||
/**
|
||||
* 삭제작업자
|
||||
*/
|
||||
private Integer delusr;
|
||||
/**
|
||||
* 작성자 구분 코드
|
||||
*/
|
||||
private String regusrDvCd;
|
||||
/**
|
||||
* 쇼핑몰코드
|
||||
*/
|
||||
private String sopmalCd;
|
||||
/**
|
||||
* 신규댓글
|
||||
*/
|
||||
private String newAt;
|
||||
/**
|
||||
* 댓글삭제리스트
|
||||
*/
|
||||
private String[] delCmInnbArr;
|
||||
/*추천비추천구분*/
|
||||
private String recomendDv;
|
||||
/**
|
||||
* 게시판 설정
|
||||
*/
|
||||
/**
|
||||
* 설정고유번호
|
||||
*/
|
||||
private String setupInfoInnb;
|
||||
/**
|
||||
* 비속어필터사용여부
|
||||
*/
|
||||
private String slangFlterUseAt;
|
||||
/**
|
||||
* 마스킹비속어
|
||||
*/
|
||||
private String mskgSlang;
|
||||
/*회원 구분 코드*/
|
||||
private String mbrDvCd;
|
||||
/*요청페이지 구분*/
|
||||
private String reqPageDv;
|
||||
/*관리자, 사용자 서버 구분*/
|
||||
private String serverDv;
|
||||
/*비밀번호 확인 여부*/
|
||||
private String pwCnfirmAt;
|
||||
/*댓글 idx*/
|
||||
private String cmIdx;
|
||||
/*대댓글 idx*/
|
||||
private String answCmIdx;
|
||||
/*댓글 권한*/
|
||||
private String authResult;
|
||||
|
||||
/*crud 행위 구분*/
|
||||
private String crudDv;
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cnslt.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cnslt.service.BOCnsltService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cnslt.vo.BOCnsltVO;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.service.BOMbrService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOMbrVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bbs/cnslt")
|
||||
public class BOCnsltController {
|
||||
|
||||
@Autowired
|
||||
private BOCnsltService service;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
@Autowired
|
||||
private BOCommonService boCommonService;
|
||||
|
||||
@Autowired
|
||||
private BOMbrService boMbrService;
|
||||
|
||||
/**
|
||||
* 고객상담 통합게시판 목록 폼 이동 & CRM 상담 내역 이동
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOCstmrCnsltUnityBbscttListInqireForm")
|
||||
public ResponseEntity<?> selectBOCstmrCnsltUnityBbscttListInqireForm(@RequestBody BOCnsltVO cnsltVO) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
// 공통코드 호출
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("COUNSEL_PROCS_STTUS"); // 상담처리상태
|
||||
List<?> procsSttusCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
// 공통코드와 리스트를 넣어줌
|
||||
content.put("paramVO", cnsltVO);
|
||||
content.put("procsSttusCdList", procsSttusCdList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 고객상담 통합게시판 목록 조회 & CRM 상담 내역 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOCstmrCnsltUnityBbscttListInqire")
|
||||
public ResponseEntity<?> selectBOCstmrCnsltUnityBbscttListInqire(@RequestBody BOCnsltVO cnsltVO) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cnsltVO.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
// 페이징 객체 생성 & 페이징정보 할당
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(cnsltVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(cnsltVO.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
cnsltVO.setPaginationInfo(paginationInfo);
|
||||
|
||||
cnsltVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
cnsltVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
cnsltVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
// 공통코드 호출
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("COUNSEL_PROCS_STTUS"); // 상담처리상태
|
||||
List<?> procsSttusCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
cnsltVO.setSecretKey(boCommonService.selectSecretkey());
|
||||
List<DataMap> resultList = service.selectBOCstmrCnsltUnityBbscttListInqire(cnsltVO);
|
||||
|
||||
// 맵에 페이징 정보와 리스트를 넣어줌
|
||||
content.put("paramVO", cnsltVO);
|
||||
content.put("resultList", resultList);
|
||||
content.put("paginationInfo", cnsltVO.getPaginationInfo());
|
||||
content.put("procsSttusCdList", procsSttusCdList); // 상담처리상태
|
||||
|
||||
log.debug("paramVO is {}", cnsltVO);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 상담 상세 수정 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOCnsltDtlUpdtInqirePopup")
|
||||
public ResponseEntity<?> selectBOCnsltDtlUpdtInqirePopup(@RequestBody BOCnsltVO cnsltVO) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cnsltVO.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
// 공통코드 호출
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("COUNSEL_PROCS_STTUS"); // 상담처리상태
|
||||
List<?> procsSttusCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("TELNB_DV"); // 인콜/아웃콜
|
||||
List<?> telnbDvCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
//시크릿키 set
|
||||
cnsltVO.setSecretKey(boCommonService.selectSecretkey());
|
||||
DataMap result = new DataMap();
|
||||
result = service.selectBOCnsltDtlUpdtInqirePopup(cnsltVO);
|
||||
|
||||
content.put("cnsltVO", result);
|
||||
content.put("procsSttusCdList", procsSttusCdList);
|
||||
content.put("telnbDvCdList", telnbDvCdList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 상담 수정
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOCnsltUpdt")
|
||||
public ResponseEntity<?> updateBOCnsltUpdt(@RequestBody BOCnsltVO cnsltVO) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cnsltVO.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
cnsltVO.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message = service.updateBOCnsltUpdt(cnsltVO);
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CRM 상담 내역 목록 이동
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOCnsltListInqireForm")
|
||||
public ResponseEntity<?> selectBOCnsltListInqireForm() {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 상담 등록
|
||||
*
|
||||
* @param cnsltVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/insertBOCnsltRegist")
|
||||
public ResponseEntity<?> insertBOCnsltRegist(@RequestBody BOCnsltVO cnsltVO) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cnsltVO.setSopmalCd(user.getSopmalCd());
|
||||
} // 쇼핑몰코드
|
||||
cnsltVO.setRegusr(user.getUserInnb()); //등록자
|
||||
cnsltVO.setUpdusr(user.getUserInnb()); // 수정자
|
||||
cnsltVO.setMngrInnb(String.valueOf(user.getUserInnb()));//관리자고유번호
|
||||
|
||||
String secretKey = boCommonService.selectSecretkey();
|
||||
cnsltVO.setSecretKey(secretKey);
|
||||
|
||||
// 상담 등록 로직
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message = service.insertBOCnsltRegist(cnsltVO);
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 상담 등록 팝업 CRM 우측 영역
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOCnsltRegistPopupForm")
|
||||
public ResponseEntity<?> selectBOCnsltRegistPopupForm(@RequestBody BOCnsltVO cnsltVO) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cnsltVO.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
cnsltVO.setRegusr(user.getUserInnb()); // 등록자
|
||||
cnsltVO.setUpdusr(user.getUserInnb()); // 수정자
|
||||
cnsltVO.setMbrNm(user.getMbrNm()); // 상담자명
|
||||
|
||||
// 공통코드 호출
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("COUNSEL_PROCS_STTUS"); // 상담처리상태
|
||||
List<?> procsSttusCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("TELNB_DV"); // 인콜/아웃콜
|
||||
List<?> telnbDvCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("LRGE_CL"); // 대분류
|
||||
List<?> lrgeClCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
// Map객체에 필요 정보 할당
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("cnsltVO", cnsltVO);
|
||||
content.put("procsSttusCdList", procsSttusCdList);
|
||||
content.put("telnbDvCdList", telnbDvCdList);
|
||||
content.put("lrgeClCdList", lrgeClCdList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 상담 등록 팝업 셀렉트박스 공통 코드
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOCnsltRegistPopupFormCmmnCdArray")
|
||||
public ResponseEntity<?> selectBOCnsltRegistPopupFormCmmnCdArray(@RequestBody BOCnsltVO cnsltVO) {
|
||||
// 작성자 정보 할당
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
cnsltVO.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
cnsltVO.setRegusr(user.getUserInnb()); // 등록자
|
||||
cnsltVO.setUpdusr(user.getUserInnb()); // 수정자
|
||||
|
||||
// 공통코드 호출
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("LRGE_CL"); // 대분류
|
||||
List<?> lrgeClCdList = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_1"); // 중분류1
|
||||
List<?> middlClCdList1 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_2"); // 중분류2
|
||||
List<?> middlClCdList2 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_3"); // 중분류3
|
||||
List<?> middlClCdList3 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_4"); // 중분류4
|
||||
List<?> middlClCdList4 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_5"); // 중분류5
|
||||
List<?> middlClCdList5 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_6"); // 중분류6
|
||||
List<?> middlClCdList6 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_7"); // 중분류7
|
||||
List<?> middlClCdList7 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
bOMaComncdVO.setGroupCd("MIDDL_CL_8"); // 중분류8
|
||||
List<?> middlClCdList8 = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
// Map객체에 필요 정보 할당
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("cnsltVO", cnsltVO);
|
||||
content.put("lrgeClCdList", lrgeClCdList);
|
||||
content.put("middlClCdList01", middlClCdList1);
|
||||
content.put("middlClCdList02", middlClCdList2);
|
||||
content.put("middlClCdList03", middlClCdList3);
|
||||
content.put("middlClCdList04", middlClCdList4);
|
||||
content.put("middlClCdList05", middlClCdList5);
|
||||
content.put("middlClCdList06", middlClCdList6);
|
||||
content.put("middlClCdList07", middlClCdList7);
|
||||
content.put("middlClCdList08", middlClCdList8);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cnslt.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.cnslt.vo.BOCnsltVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* 상담 조회 BOCnsltMapper
|
||||
* @author 추지훈
|
||||
* @since 2024-01-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-26 추지훈 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOCnsltMapper {
|
||||
|
||||
|
||||
/** 고객상담 통합게시판 목록 건수 */
|
||||
public Integer selectBOCnsltListCnt(BOCnsltVO cnsltVO);
|
||||
|
||||
|
||||
/** 고객상담 통합게시판 목록 조회 */
|
||||
public List<DataMap> selectBOCnsltListInqire(BOCnsltVO cnsltVO);
|
||||
|
||||
|
||||
/** 상담 내역 상세 조회 */
|
||||
public DataMap selectBOCnsltDtlUpdtInqirePopup(BOCnsltVO cnsltVO);
|
||||
|
||||
|
||||
/**
|
||||
* 상담 수정
|
||||
* @param cnsltVO
|
||||
*/
|
||||
public void updateBOCnsltUpdt(BOCnsltVO cnsltVO);
|
||||
|
||||
|
||||
/**
|
||||
* 상담 등록
|
||||
* @param cnsltVO
|
||||
*/
|
||||
public void insertBOCnsltRegist(BOCnsltVO cnsltVO);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cnslt.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.mapper.BOMaSopmalMapper;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.vo.BOMaSopmalVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cnslt.mapper.BOCnsltMapper;
|
||||
import com.wb.domainserver.domain.gcone.bbs.cnslt.vo.BOCnsltVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BOCnsltService {
|
||||
|
||||
@Autowired
|
||||
private BOCnsltMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private BOMaSopmalMapper boMaSopmalMapper;
|
||||
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
|
||||
/**
|
||||
* 통합게시판, CRM 상담 목록 조회
|
||||
* @param cnsltVO
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOCstmrCnsltUnityBbscttListInqire(BOCnsltVO cnsltVO) {
|
||||
log.debug("BOCouponVO is {}", cnsltVO);
|
||||
// 상담 목록
|
||||
List<DataMap> resultList = null;
|
||||
// 목록 건수 조회
|
||||
Integer totCnt = mapper.selectBOCnsltListCnt(cnsltVO);
|
||||
// 상담 정보와 페이징 정보
|
||||
cnsltVO.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
if(totCnt > 0 ) {
|
||||
// 상담 목록 조회
|
||||
resultList = mapper.selectBOCnsltListInqire(cnsltVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 상담 내역 상세 조회
|
||||
* @param cnsltVO
|
||||
* @return
|
||||
*/
|
||||
public DataMap selectBOCnsltDtlUpdtInqirePopup(BOCnsltVO cnsltVO) {
|
||||
DataMap result = new DataMap();
|
||||
result = mapper.selectBOCnsltDtlUpdtInqirePopup(cnsltVO);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 상담 수정
|
||||
* @param cnsltVO
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> updateBOCnsltUpdt(BOCnsltVO cnsltVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
try {
|
||||
mapper.updateBOCnsltUpdt(cnsltVO);
|
||||
message.put("result", "success");
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch(Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 상담 등록
|
||||
* @param cnsltVO
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> insertBOCnsltRegist(BOCnsltVO cnsltVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
//mbrDvCd가 비어있을경우 조회하여 넣어줌(비회원일 경우 해당 정보없음)
|
||||
//sopmalCd의 값을 참고하여 현재 상담중인 쇼핑몰을 조회 후 넣어줌
|
||||
if(!StringUtils.hasText(cnsltVO.getMbrDvCd())){
|
||||
|
||||
BOMaSopmalVO vo = new BOMaSopmalVO();
|
||||
vo.setSopmalCd(cnsltVO.getSopmalCd());
|
||||
//쇼핑몰 정보 조회
|
||||
List<DataMap> result = boMaSopmalMapper.selectBOSopmalUpdtForm(vo);
|
||||
|
||||
for(DataMap data :result){
|
||||
//통합몰일 경우 GC 세팅
|
||||
if("01".equals(data.get("sopmalTyCd"))){
|
||||
cnsltVO.setMbrDvCd("GC");
|
||||
}else{
|
||||
//개별쇼핑몰 세팅
|
||||
cnsltVO.setMbrDvCd(cnsltVO.getSopmalCd());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// mapper 호출
|
||||
mapper.insertBOCnsltRegist(cnsltVO);
|
||||
message.put("cnsltDtlsInnb", cnsltVO.getCnsltDtlsInnb());
|
||||
message.put("result", "success");
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.cnslt.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 관리자 - 상담 VO
|
||||
* @author 추지훈
|
||||
* @since 2024-01-26
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-26 추지훈. 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOCnsltVO extends AbstractVO{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 상담 컬럼
|
||||
*/
|
||||
|
||||
/** 상담내역고유번호 */
|
||||
private Integer cnsltDtlsInnb;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/* CRM > 비회원번호*/
|
||||
private String mbtlnb;
|
||||
/* CRM > 회원 구분*/
|
||||
private String mbrTyCd;
|
||||
/** 회원고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 회원 아이디 */
|
||||
private String mbrid;
|
||||
/** 회원명 */
|
||||
private String mbrNm;
|
||||
/** 회원구분코드 */
|
||||
private String mbrDvCd;
|
||||
/** 관리자 고유번호 */
|
||||
private String mngrInnb;
|
||||
/** 관리자이름 */
|
||||
private String mngrNm;
|
||||
/** 상담분류 */
|
||||
private String cnsltCl;
|
||||
/** 관련주문번호 */
|
||||
private String ordrNb;
|
||||
/** 출고코드 */
|
||||
private String dlivyInnb;
|
||||
/** 반품코드 */
|
||||
private String rtngudCdNb;
|
||||
/** 환불코드 */
|
||||
private String refndCdNb;
|
||||
/** 관련상품문의 */
|
||||
private String goodsInqryBbscttNb;
|
||||
/** 관련상담번호 */
|
||||
private String goodsRvwBbscttNb;
|
||||
/** 처리상태 */
|
||||
private String procsSttusCd;
|
||||
/** 처리일시 */
|
||||
private String procsDt;
|
||||
/** 상담내용 */
|
||||
private String cnsltCn;
|
||||
/** 전화구분코드 */
|
||||
private String telnbDvCd;
|
||||
/** 대분류 */
|
||||
private String lrgeCl;
|
||||
/** 중분류 */
|
||||
private String middlCl;
|
||||
/** 소분류 */
|
||||
private String smllCl;
|
||||
/** 녹취 key */
|
||||
private String recrdKy;
|
||||
/** 전화번호 */
|
||||
private String telnb;
|
||||
|
||||
|
||||
/**
|
||||
* 검색
|
||||
*/
|
||||
|
||||
/** 검색_검색어 구분 */
|
||||
private String srchKeywordDv;
|
||||
/** 검색_검색어 */
|
||||
private String srchKeyword;
|
||||
/** 검색_등록일 구분 */
|
||||
private String srchDtDv;
|
||||
/** 검색_시작일 */
|
||||
private String srchStartDate;
|
||||
/** 검색_종료일 */
|
||||
private String srchEndDate;
|
||||
/** 검색_상담자 */
|
||||
private String srchMngrNm;
|
||||
/** 검색_처리 여부 */
|
||||
private String[] srchProcsSttusCd;
|
||||
/** 검색_관련번호 구분 */
|
||||
private String srchRelateDv;
|
||||
/** 검색_관련번호 */
|
||||
private String srchRelateNm;
|
||||
/** 검색_상담내용 */
|
||||
private String srchCnsltCn;
|
||||
|
||||
|
||||
|
||||
|
||||
private String record_key;
|
||||
|
||||
/** 저장될 녹취 key */
|
||||
private String customer_record_key;
|
||||
|
||||
/*암호화키*/
|
||||
private String secretKey;
|
||||
|
||||
/*crm인지, 통합게시판인지 판단 => bo join에 씀*/
|
||||
private String crmAt;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,255 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.vo.BOGnrlbbscttVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
/**
|
||||
* 일반게시글 관리 Mapper
|
||||
*
|
||||
* @author 김혜지
|
||||
* @since 2024-01-05
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-05 김혜지 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOGnrlbbscttMapper {
|
||||
/********************************************************
|
||||
* 게시판별 목록 조회
|
||||
********************************************************/
|
||||
/**********일반게시글**********/
|
||||
/*일반게시글 건수 조회*/
|
||||
public BOGnrlbbscttVO selectBOGnrlBbscttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*일반게시글 목록 조회*/
|
||||
public List<DataMap> selectBOGnrlBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/**********공지사항 OK**********/
|
||||
/*공지사항 건수 조회*/
|
||||
public BOGnrlbbscttVO selectBObNoticeBbscttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*공지사항 목록 조회*/
|
||||
public List<DataMap> selectBONoticeBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/**********이벤트 OK**********/
|
||||
/*이벤트 건수 조회*/
|
||||
public Integer selectBOEvtBbscttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*이벤트 목록 조회*/
|
||||
public List<DataMap> selectBOEvtBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/**********FAQ OK**********/
|
||||
/*FAQ 건수 조회*/
|
||||
public Integer selectBOFaqBbscttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*FAQ 목록 조회*/
|
||||
public List<DataMap> selectBOFaqBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/**********상품QnA**********/
|
||||
/*상품QnA 건수 조회*/
|
||||
public Integer selectBOQnaBbscttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*상품QnA 목록 조회*/
|
||||
public List<DataMap> selectBOQnaBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/**********리뷰**********/
|
||||
/*리뷰 건수 조회*/
|
||||
public BOGnrlbbscttVO selectBORvwBbscttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*리뷰 목록 조회*/
|
||||
public List<DataMap> selectBORvwBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/**********매거진 OK**********/
|
||||
/*매거진 건수 조회*/
|
||||
public BOGnrlbbscttVO selectBOBbsMgzncttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*매거진 목록 조회*/
|
||||
public List<DataMap> selectBOMgznBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/**********이용안내**********/
|
||||
/*이용안내 건수 조회*/
|
||||
public Integer selectBOuseGuidanceBbscttListCnt(BOGnrlbbscttVO bbsctt);
|
||||
/*이용안내 목록 조회*/
|
||||
public List<DataMap> selectBOuseGuidanceBbscttListInqire(BOGnrlbbscttVO bbsctt);
|
||||
/*사용자 > 이용안내 조회*/
|
||||
public List<DataMap> selectUseGuidanceCn(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*******************
|
||||
* 게시글 상세 조회
|
||||
*******************/
|
||||
/*게시글 상세 이동 가능 여부 판단*/
|
||||
DataMap selectBbscttDtlMovePosblAt(BOGnrlbbscttVO bbsctt);
|
||||
/** 게시글 상세조회 */
|
||||
public DataMap selectBOBbscttDtlInqirePopup(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시글 상세조회 */
|
||||
public DataMap selectBOBbscttDtlSopmalInqirePopup(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 아코디언 형 내용 상세 조회 */
|
||||
public DataMap selectBOBbscttCn(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시글 답변 상세조회 */
|
||||
public DataMap selectBOAnswInfoInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*****************************************
|
||||
게시글 등록, 수정, 논리 삭제
|
||||
*********************************************>
|
||||
/** 게시글 등록 */
|
||||
public int insertBOBbscttRegist(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시글 수정 */
|
||||
public int updateBOBbscttUpdt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시글 논리 삭제 */
|
||||
public Integer updateBOBbscttDel(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/****************************************
|
||||
게시글 기능
|
||||
********************************************/
|
||||
/** 조회수 증가 */
|
||||
public Integer updateBOBbscttRdcntUpdt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시글 노출여부 수정 */
|
||||
public void updateBOBbscttExpsrAt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 리뷰 베스트여부 수정 */
|
||||
public void updateBORvwBstAt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 리뷰 메인노츨 수정 */
|
||||
public Integer updateBORvwMainExpsrAt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*비밀번호 비교*/
|
||||
public Integer selectBOBbscttComparPassword(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*추천,비추천 업데이트*/
|
||||
public void updateBOBbscttRecomendUpdt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*추천, 비추천 수정 후 결과 값 조회*/
|
||||
public DataMap selectBOrecomendNonrecomend(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/****************************************
|
||||
문항 관련
|
||||
********************************************/
|
||||
/** 게시글추가문항답변 등록 */
|
||||
public Integer insertBOBbscttQesitmAnsw(DataMap map);
|
||||
|
||||
/** 게시글추가문항답변 등록 */
|
||||
public Integer insertBONpayBbscttQesitmAnsw(DataMap map);
|
||||
|
||||
/** 게시판추가문항 조회 */
|
||||
public List<DataMap> selectBOBbscttQesitmInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시판 분류 조회*/
|
||||
public List<DataMap> selectBOBbscttItmInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 리뷰 문항 조회*/
|
||||
public List<DataMap> selectBORvwQesitmInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시판추가문항항목 조회 */
|
||||
public List<DataMap> selectItmCn(DataMap map);
|
||||
|
||||
/** 게시글추가문항답변 조회 */
|
||||
public List<DataMap> selectBOBbscttQesitmAnswInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시글추가문항답변 삭제 */
|
||||
public Integer deleteBOAditQesitmPhysiclDel(BOGnrlbbscttVO bbsctt);
|
||||
/** 게시글추가문항답변 삭제 */
|
||||
public Integer deleteBOAditQesitmLogicDel(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*****************************************
|
||||
게시글 첨부 파일
|
||||
********************************************/
|
||||
/** 파일 등록 */
|
||||
public int insertBOBbscttFileUpload(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 파일 조회 */
|
||||
public List<DataMap> selectBOFileInfo(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 파일 삭제 */
|
||||
public void deleteBOBbscttFileUpload(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*********************************************************************
|
||||
* 게시글 연관 상품
|
||||
********************************************************************/
|
||||
/** 게시글 연관 상품 등록 */
|
||||
public void insertBOBbscttGoods(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시글 상세조회(연관상품목록) */
|
||||
public List<DataMap> selectBOBbscttDtlGoods(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/** 게시판 연관상품 삭제*/
|
||||
public void deleteBOBbscttGoods(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*******************************************************************
|
||||
* 사용자 > 마이페이지 > 작성 가능한 리뷰
|
||||
*******************************************************************/
|
||||
/*작성 가능 리뷰 건수 조회*/
|
||||
public Integer selectBOWritPosblRvwCnt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*작성 가능 리뷰 조회*/
|
||||
public List<DataMap> selectBOWritPosblRvw(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*회원 사이트 정보 리뷰작성수 update*/
|
||||
Integer updateBORvwWritngCnt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*리뷰 등록 상품 조회*/
|
||||
public DataMap selectBORvwGoods(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*리뷰 작성 가능 검증*/
|
||||
public String selectRvwWritngPosblVrify(BOGnrlbbscttVO bbsctt);
|
||||
/*******************************************************************
|
||||
* 사용자 > 마이페이지 > 나의 리뷰
|
||||
*******************************************************************/
|
||||
/*나의리뷰 리뷰 게시글 건수*/
|
||||
Integer selectBOMyRvwListCnt(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*나의리뷰 리뷰 게시글 조회*/
|
||||
List<DataMap> selectBOMyRvwListInqire(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
|
||||
/*****************************************
|
||||
사용자 > 마이페이지 > 반품
|
||||
*********************************************/
|
||||
/*상품qna 등록 상품 조회 (모달 상품qna에 사용)*/
|
||||
public DataMap selectBOTargetGoodsInfo(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*****************************************
|
||||
사용자 > 상품 상세
|
||||
*******************************************/
|
||||
/***************** 상품상세 > 리뷰 관련*****************/
|
||||
/*상품 리뷰 평가 정보 (상품 평균 평점, 전체 리뷰 수 , 평점 비율)*/
|
||||
public DataMap selectBOGoodsRvwEvlInfo(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*게시판 마일리지 적립 금액 정보*/
|
||||
public DataMap selectBORvwBnefInfo(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*상품 리뷰 추가 평가 비율 정보*/
|
||||
|
||||
/*상품 리뷰 목록*/
|
||||
public List<DataMap> selectBOQesitmNm(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*상품 리뷰 건수*/
|
||||
public Integer selectBOGoodsRvwTot(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*상품 리뷰 목록*/
|
||||
public List<DataMap> selectBOGoodsRvwList(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*상품 리뷰 평가 항목 통계 조회*/
|
||||
public List<DataMap> selectBOItmStats(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*****************상품상세 > 상품Q&A 관련*****************/
|
||||
/*상품 Q&A 건수*/
|
||||
public Integer selectBOGoodsQnaTot(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
/*상품 Q&A 목록*/
|
||||
public List<DataMap> selectBOGoodsQnaList(BOGnrlbbscttVO bbsctt);
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBbsFormItmVO extends AbstractVO{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8087305150158091337L;
|
||||
/** 문항 번호*/
|
||||
private String qesitmInnb;
|
||||
/** 항목고유 id*/
|
||||
private String itmInnb;
|
||||
/** 항목내용*/
|
||||
private String itmCn;
|
||||
/** 항목순서*/
|
||||
private Integer itmOrdr;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.vo;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBbsFormVO extends AbstractVO{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1607485104712731512L;
|
||||
/** 게시판 문항 고유번호*/
|
||||
private String qesitmInnb;
|
||||
/** 게시판 id*/
|
||||
private String bbsInnb;
|
||||
/** 추가항목구분 */
|
||||
private String aditItmDv;
|
||||
/** 문항명 */
|
||||
private String qesitmNm;
|
||||
/** 문항설명 */
|
||||
private String qesitmDc;
|
||||
/** 문항유형 */
|
||||
private String itmTy;
|
||||
/** 문항순서 */
|
||||
private Integer qesitmOrdr;
|
||||
/** 사용여부 */
|
||||
private String useAt;
|
||||
|
||||
/** 게시판 문항의 요소들*/
|
||||
private List<BOBbsFormItmVO> bbsFormItmList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.vo;
|
||||
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BODelInfoVO{
|
||||
/**
|
||||
* 삭제 회원 구분 코드
|
||||
*/
|
||||
private String mbrDvCd;
|
||||
|
||||
/**
|
||||
* 삭제 회원 고유번호
|
||||
*/
|
||||
private String regusrDvCd;
|
||||
|
||||
/**
|
||||
* 삭제 회원 고유번호
|
||||
*/
|
||||
private Integer regusr;
|
||||
|
||||
/**
|
||||
* 상품 고유번호
|
||||
*/
|
||||
private Integer goodsInnb;
|
||||
|
||||
/**
|
||||
* 게시글 고유번호
|
||||
*/
|
||||
private Integer bbscttInnb;
|
||||
|
||||
/*회수 금액*/
|
||||
private BigDecimal rtrvlMlgAmt;
|
||||
}
|
||||
@@ -0,0 +1,399 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOGnrlbbscttVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
//게시판 검색 조건 쇼핑몰 코드
|
||||
private String sopmalCd;
|
||||
/**
|
||||
* 게시글 정보
|
||||
*/
|
||||
|
||||
/** 게시글고유번호 */
|
||||
private BigInteger bbscttInnb;
|
||||
/*게시글 고유번호 (옛날 게시글 고유번호)*/
|
||||
private BigInteger seq;
|
||||
/*게시글고유번호배열*/
|
||||
private List<BigInteger> bbscttInnbArr;
|
||||
/** 선택삭제 게시글리스트 */
|
||||
private BigInteger[] delBbscttInnbArr;
|
||||
/** 부모게시글고유번호 */
|
||||
private BigInteger parntsBbscttInnb;
|
||||
/** 게시판ID */
|
||||
private String bbsId;
|
||||
|
||||
/** 회원고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** DEPTH */
|
||||
private Integer depth;
|
||||
/** 회원구분코드 ? */
|
||||
private String mbrDvCd;
|
||||
/** 등록자구분코드 */
|
||||
private String regusrDvCd;
|
||||
/** 등록자ID */
|
||||
private String regusrId;
|
||||
/** 등록자명 */
|
||||
private String regusrNm;
|
||||
/*관리자 명*/
|
||||
private String mngrNm;
|
||||
/** 비밀번호 */
|
||||
private String password;
|
||||
/** 제목 */
|
||||
private String sj;
|
||||
/** 내용 */
|
||||
private String cn;
|
||||
/** 조회건수 */
|
||||
private Integer inqireCnt;
|
||||
/** 댓글사용여부 */
|
||||
private String cmUseAt;
|
||||
/*추천,비추천 구분*/
|
||||
private String recomendDv;
|
||||
/** 추천건수 */
|
||||
private Integer recomendCnt;
|
||||
/** 비추천건수 */
|
||||
private Integer nonrecomendCnt;
|
||||
/** 정렬순서 */
|
||||
private Integer sortOrdr;
|
||||
/*대표이미지 원본파일명*/
|
||||
private String reprsntImgOrginlFilNm;
|
||||
/*대표이미지 시스템파일명*/
|
||||
private String reprsntImgSysFilNm;
|
||||
/** 비밀글여부 */
|
||||
private String secretBbscttAt;
|
||||
/** 공지여부 */
|
||||
private String ntcAt;
|
||||
/** 노출여부 */
|
||||
private String expsrAt;
|
||||
/** 온라인여부 */
|
||||
private String onlineAt;
|
||||
/** 오프라인여부 */
|
||||
private String oflneAt;
|
||||
/** 게시기간설정여부 */
|
||||
private String ntcePdSetupAt;
|
||||
/** 게시시작일자 */
|
||||
private String ntceBgnDe;
|
||||
/** 게시종료일자 */
|
||||
private String ntceEndDe;
|
||||
/** 공지기간설정여부 */
|
||||
private String ntcPdSetupAt;
|
||||
/** 공지시작일자 */
|
||||
private String ntcBgnDe;
|
||||
/** 공지종료일자 */
|
||||
private String ntcEndDe;
|
||||
/** 이벤트기간설정여부 */
|
||||
private String evtPdSetupAt;
|
||||
/** 이벤트시작일자 */
|
||||
private String evtBgnDe;
|
||||
/** 이벤트종료일자 */
|
||||
private String evtEndDe;
|
||||
/** 메인노출여부 */
|
||||
private String mainExpsrAt;
|
||||
/** 베스트여부 */
|
||||
private String bstAt;
|
||||
/** 포토리뷰여부 */
|
||||
private String photoRvwAt;
|
||||
/** NPay 게시글 일련번호 */
|
||||
private String npayBbscttSnb;
|
||||
/** NPay 답변 전송여부*/
|
||||
private String npayAnswTrnsmisAt;
|
||||
/** NPay 답변번호*/
|
||||
private String npayAnswNb;
|
||||
/** NPay 상품주문번호*/
|
||||
private String npayGoodsOrdrnb;
|
||||
/** NPay 리뷰유형코드*/
|
||||
private String npayRvwTyCd;
|
||||
/** IP */
|
||||
private String ip;
|
||||
/** agentId */
|
||||
private String agentId;
|
||||
/** 사용여부 */
|
||||
private String useAt;
|
||||
/** 삭제작업자 */
|
||||
private Integer delusr;
|
||||
/** 삭제일시 */
|
||||
private Date delDt;
|
||||
|
||||
|
||||
/**
|
||||
* 검색조건
|
||||
*/
|
||||
/** 검색구분 */
|
||||
private String srchDv;
|
||||
/** 검색어 */
|
||||
private String srchKeyword;
|
||||
/*검색어 배열*/
|
||||
private String[] srchKeywordArr;
|
||||
/** 검색 시작일 */
|
||||
private String srchStartDt;
|
||||
/** 검색 종료일 */
|
||||
private String srchEndDt;
|
||||
/** 게시판 이름 코드 */
|
||||
private String bbsTyCd;
|
||||
/** 답변 상태 */
|
||||
private String answSttus;
|
||||
/** 분류명 */
|
||||
private String srchitmInnb;
|
||||
/** 네이버페이 후기 여부*/
|
||||
private String npayAt;
|
||||
/** 주문번호 후기 여부*/
|
||||
private String srchOrdrInnb;
|
||||
/** 댓글 여부*/
|
||||
private String srchCmAt;
|
||||
/** 기간 */
|
||||
private String datePeriod;
|
||||
/** 순번 */
|
||||
private Integer rnum;
|
||||
/** 대시보드 구분 */
|
||||
private String dashAt;
|
||||
/** 항목내용 */
|
||||
private String itmCn;
|
||||
/* 사용자 > 상품 상세 > 리뷰 정렬*/
|
||||
private String sortDv;
|
||||
/**
|
||||
* 게시글추가문항답변
|
||||
*/
|
||||
|
||||
/** 문항답변고유번호 */
|
||||
private String qesitmAnswInnb;
|
||||
/** 문항고유번호 */
|
||||
private String qesitmInnb;
|
||||
/** 문항필수여부 */
|
||||
private String qesitmEssntlAt;
|
||||
/** 문항사용여부 */
|
||||
private String qesitmUseAt;
|
||||
/** 문항순서 */
|
||||
private String qesitmOrdr;
|
||||
/** 항목고유번호 */
|
||||
private String itmInnb;
|
||||
/** 답변내용 */
|
||||
private String answCn;
|
||||
/** 평가점수 */
|
||||
private String evlScore;
|
||||
/** 문항필수여부(배열) */
|
||||
private String[] qesitmEssntlAtArr;
|
||||
/** 문항고유번호(배열) */
|
||||
private String[] qesitmInnbArr;
|
||||
/** 문항 명(배열) */
|
||||
private String[] qesitmNmArr;
|
||||
/** 항목고유번호(배열) */
|
||||
private String[] itmInnbArr;
|
||||
/** 답변내용(배열) */
|
||||
private String[] answCnArr;
|
||||
/**
|
||||
* 첨부파일 정보
|
||||
*/
|
||||
/** 파일정보 */
|
||||
private List<HashMap<String, Object>> fileInfo;
|
||||
/** 대표이미지 파일 정보*/
|
||||
private HashMap<String, Object> represntFileInfo;
|
||||
/* 파일 고유번호 */
|
||||
private String bbscttAtchmnfilInnb;
|
||||
/** 원본파일명 */
|
||||
private String orginlFilNm;
|
||||
/** 변환파일명 */
|
||||
private String sysFilNm;
|
||||
/** 파일타입 */
|
||||
private String filTy;
|
||||
/** 파일크기 */
|
||||
private String filMg;
|
||||
/** 파일경로 */
|
||||
private String filCours;
|
||||
/**현존파일정보 */
|
||||
private String extFiles;
|
||||
/*기존파일정보*/
|
||||
private String filesInfo;
|
||||
/*파일 존재여부*/
|
||||
private String filExtAt;
|
||||
/*대표이미지 첨부 구분*/
|
||||
private String represntFilAt;
|
||||
/*파일 수정여부*/
|
||||
private String filChangeAt;
|
||||
/*기존 파일 변화 여부*/
|
||||
private String extFilChangeAt;
|
||||
/*파일 구분*/
|
||||
private String filDvCd;
|
||||
|
||||
/** 댓글 리스트 */
|
||||
private String[] cmList;
|
||||
private String boardAnswInnb;
|
||||
private String oldFileName;
|
||||
private String bbsNm;
|
||||
|
||||
/** 항목고유번호 리스트 */
|
||||
private String[] itmInnbAns;
|
||||
/** 답변내용 리스트 */
|
||||
private String[] answCnAns;
|
||||
private String[] qesitmInnbAns;
|
||||
/** 항목고유번호 (분류) */
|
||||
private String itmInnbDiv;
|
||||
/** 답변내용 (분류) */
|
||||
private String answCnDiv;
|
||||
|
||||
private String qesitmInnbDiv;
|
||||
/** 타입 코드 */
|
||||
private String[]itmTyCdArr;
|
||||
/** 리뷰 문항 필수 여부 배열*/
|
||||
private String[] rvwQesitmEssntlAtArr;
|
||||
/** 리뷰 문항 명 배열*/
|
||||
private String[] rvwQesitmNmArr;
|
||||
/** 리뷰 답변 여부 배열*/
|
||||
private String[] rvwQesitmAtArr;
|
||||
/** 리뷰 문항고유번호 배열*/
|
||||
private String[] rvwQesitmInnbArr;
|
||||
/** 리뷰 평점 배열*/
|
||||
private String[] evlScoreArr;
|
||||
/** 리뷰 항목고유번호 배열*/
|
||||
private String[] rvwItmInnbArr;
|
||||
|
||||
/*
|
||||
* 게시글 연관상품
|
||||
*/
|
||||
/*상품고유번호*/
|
||||
private String goodsInnb;
|
||||
/*상품고유번호*/
|
||||
private String reOrderAt;
|
||||
/*주문고유번호*/
|
||||
private BigInteger ordrInnb;
|
||||
/*상품고유번호배열*/
|
||||
private List<String> goodsInnbArr;
|
||||
/*주문상품옵션고유번호*/
|
||||
private String ordrGoodsOptnInnb;
|
||||
/*주문상품옵션고유번호 배열*/
|
||||
private List<String> ordrGoodsOptnInnbArr;
|
||||
/*추천상품고유번호*/
|
||||
private Integer recomendGoodsInnb;
|
||||
/*재구매여부*/
|
||||
private List<String> reOrderAtArr;
|
||||
/*
|
||||
* 메시지 발송
|
||||
*/
|
||||
/*답변 휴대폰번호*/
|
||||
private String answMbtlnb;
|
||||
/*답변수신여부*/
|
||||
private String answSmsRecptn;
|
||||
/*답변 타겟 작성자 아이디*/
|
||||
private String answRegusrId;
|
||||
/*답변 타겟 작성자 이름*/
|
||||
private String answRegusrNm;
|
||||
/*답변 타겟 작성자 고유번호*/
|
||||
private Integer answRegusr;
|
||||
/**
|
||||
* 게시판 설정
|
||||
*/
|
||||
/** 설정고유번호 */
|
||||
private String setupInfoInnb;
|
||||
/** 비속어필터사용여부 */
|
||||
private String slangFlterUseAt;
|
||||
/** 마스킹비속어 */
|
||||
private String mskgSlang;
|
||||
/*스킨타입코드*/
|
||||
private String sknTyCd;
|
||||
/*추천상품노출여부*/
|
||||
private String recomendGoodsExpsrAt;
|
||||
/* 갤러리형 목록 조회 행 개수*/
|
||||
private String pgeVtcCnt;
|
||||
/* 갤러리형 목록 조회 열 개수*/
|
||||
private String pgeWthCnt;
|
||||
/*이전글다음글 조회 여부*/
|
||||
private String prevNext;
|
||||
/* 상품후기마일리지지급여부 */
|
||||
private String goodsRvwMlgPymntAt;
|
||||
/* 일반후기마일리지적립금액*/
|
||||
private String gnrlRvwMlgAccmlmnyAmt;
|
||||
/* 일반후기마일리지유효월수*/
|
||||
private String gnrlRvwMlgValidMt;
|
||||
/*포토후기마일리지적립금액*/
|
||||
private String photoRvwMlgAccmlmnyAmt;
|
||||
/* 포토후기마일리지유효월수*/
|
||||
private String photoRvwMlgValidMt;
|
||||
/* 추가지급마일리지적립금액*/
|
||||
private String aditPymntMlgAccmlmnyAmt;
|
||||
/* 추가지급마일리지유효월수*/
|
||||
private String aditPymntMlgValidMt;
|
||||
/*게시글발송방식코드*/
|
||||
private String bbscttSndngMthCd;
|
||||
|
||||
/*sms 관련*/
|
||||
private String bbscttSndngDvCd;
|
||||
|
||||
/**
|
||||
* 리뷰
|
||||
*/
|
||||
// 추가항목 정보(FM_BOARD_ADDITM)
|
||||
private List<BOBbsFormVO> bbsFormVoList;
|
||||
/**
|
||||
* 권한
|
||||
*/
|
||||
//권한 구분 (REDNG : 읽기권한, REGIST: 쓰기권한, CM: 댓글등록권한)
|
||||
private String authDv;
|
||||
//권한 결과값
|
||||
private String authResult;
|
||||
/*
|
||||
* 요청
|
||||
*/
|
||||
/*
|
||||
* 요청 값
|
||||
*/
|
||||
/*요청 페이지 구분(고객센터=>csc , 서브페이지=>subPage, 이용안내 => useGudiance, crm => crm)*/
|
||||
private String reqUrl;
|
||||
|
||||
/* 서버 구분 sopmal or mngr*/
|
||||
private String serverDv;
|
||||
|
||||
/*상세 구분*/
|
||||
private String dtlAt;
|
||||
|
||||
/*사용자 등록,수정시 목록이동 or 등록,수정폼 유지*/
|
||||
private String listAt;
|
||||
|
||||
/*리뷰,게시글 구분*/
|
||||
private String rvwBbscttDv;
|
||||
|
||||
/*사용자 > 상품q&a 상품 조회 , 등록 팝업 이동시 요청페이지 구분*/
|
||||
private String reqDv;
|
||||
|
||||
/*모바일 pc 구분*/
|
||||
private String diviceDv;
|
||||
|
||||
/*비밀번호 확인 여부*/
|
||||
private String pwCnfirmAt;
|
||||
|
||||
/*crud 행위 구분*/
|
||||
private String crudDv;
|
||||
|
||||
/*사용자 > 나의리뷰 화면 제어 필요*/
|
||||
private String divDv;
|
||||
|
||||
/*페이징 관련*/
|
||||
/*공지여부 'Y' 개수(공지사항,매거진,일반)*/
|
||||
private Integer ntcCnt;
|
||||
/*베스트여부 'Y'개수 (리뷰)*/
|
||||
private Integer bstCnt;
|
||||
/*총 건수*/
|
||||
private Integer totCnt;
|
||||
/*비밀번호 변경 여부*/
|
||||
private String passwordChngAt;
|
||||
|
||||
/*게시글 삭제 관련*/
|
||||
/*회수 마일리지 관련 정보*/
|
||||
private List<BODelInfoVO> delInfoArr;
|
||||
/*마일리지 수동 회수 여부*/
|
||||
private String mlgPassivRtrvlAt;
|
||||
/*시크릿키*/
|
||||
private String secretKey;
|
||||
/*스크립트 내용*/
|
||||
private String cnScript;
|
||||
/*서브페이지 고객센터 표시 여부*/
|
||||
private String cscAt;
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.prom.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.prom.service.BOPromService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.prom.vo.BOPromVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.service.BOMlgService;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.service.BOCouponService;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.vo.BODwldCouponVO;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 Controller
|
||||
*
|
||||
* @author 개발자
|
||||
* @version 1.0
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bbs/prom")
|
||||
public class BOPromController {
|
||||
|
||||
@Autowired
|
||||
private BOPromService promService;
|
||||
|
||||
@Autowired
|
||||
private BOMlgService bomlgService;
|
||||
|
||||
@Autowired
|
||||
private BOCouponService couponService;
|
||||
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여/조회 통합 API
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping("/promJoin")
|
||||
public ResponseEntity<?> promJoin(@RequestBody BOPromVO promVO) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if (user.getUserInnb() > 0) {
|
||||
|
||||
// 1. 이벤트 정보 조회 및 유효성 체크
|
||||
DataMap promInfo = promService.selectPromInfo(promVO);
|
||||
boolean isActive = promService.isPromActive(promInfo);
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
if (!isActive) {
|
||||
content.put("eventActive", false);
|
||||
content.put("message", "이벤트 기간이 아닙니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.OK);
|
||||
}
|
||||
|
||||
// 2. 참여 이력 조회
|
||||
// promVO에 mbrInnb 설정
|
||||
promVO.setMbrInnb((long) user.getUserInnb());
|
||||
|
||||
// daily 룰일 때만 오늘 날짜 세팅
|
||||
if ("daily".equals((String)promInfo.get("promRule"))) {
|
||||
promVO.setJoinDt(LocalDate.now());
|
||||
}
|
||||
if(!user.getSopmalCd().equals((String) promInfo.get("sopmalCd"))){
|
||||
content.put("alreadySpun", true);
|
||||
content.put("message", "해당 쇼핑몰 이벤트가 아닙니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.OK);
|
||||
}
|
||||
|
||||
DataMap joinInfo = promService.selectPromJoinInfo(promVO);
|
||||
if (joinInfo != null) {
|
||||
// 이미 참여한 경우
|
||||
content.put("alreadySpun", true);
|
||||
Object sortOrdrObj = joinInfo.get("sortOrdr");
|
||||
if (sortOrdrObj != null) {
|
||||
int selected = (sortOrdrObj instanceof Number) ? ((Number) sortOrdrObj).intValue() : Integer.parseInt(sortOrdrObj.toString());
|
||||
content.put("selected", selected);
|
||||
}
|
||||
content.put("message", "이미 참여하셨습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.OK);
|
||||
}
|
||||
|
||||
// 3. 추첨 및 지급 로직 (미참여자)
|
||||
int totalJoinCount = promService.countPromJoin(promVO);
|
||||
List<DataMap> rewardList = promService.selectPromRewardList(promVO);
|
||||
Map<Integer, Integer> rewardWinCount = promService.countRewardWinners(promVO);
|
||||
log.info("rewardWinCount 전체 데이터: {}", rewardWinCount);
|
||||
log.info("totalJoinCount: {}", totalJoinCount);
|
||||
double[] probabilities = new double[rewardList.size()];
|
||||
for (int i = 0; i < rewardList.size(); i++) {
|
||||
double baseProb = ((BigDecimal) rewardList.get(i).get("probability")).doubleValue();
|
||||
Object sortOrdrObj = rewardList.get(i).get("sortOrdr");
|
||||
int sortOrdr = (sortOrdrObj instanceof Number) ? ((Number) sortOrdrObj).intValue() : Integer.parseInt(sortOrdrObj.toString());
|
||||
double actualRate = 0.0;
|
||||
if (totalJoinCount > 0 && rewardWinCount.containsKey(sortOrdr)) {
|
||||
actualRate = (double) rewardWinCount.get(sortOrdr) / totalJoinCount * 100.0;
|
||||
}
|
||||
if (totalJoinCount > 100) {
|
||||
double diff = baseProb - actualRate;
|
||||
probabilities[i] = baseProb + diff * 0.8;
|
||||
if (probabilities[i] < 0) probabilities[i] = 0;
|
||||
log.info("확률 보정 - baseProb: {}, actualRate: {}, diff: {}, 보정 후: {}", baseProb, actualRate, diff, probabilities[i]);
|
||||
} else {
|
||||
probabilities[i] = baseProb;
|
||||
log.info("확률 보정 - baseProb: {}, actualRate: {}, diff: {}, 보정 후: {}", baseProb, actualRate, 0.0, probabilities[i]);
|
||||
}
|
||||
}
|
||||
|
||||
double rand = Math.random() * 100;
|
||||
double acc = 0;
|
||||
int selectedIdx = 0;
|
||||
for (int i = 0; i < probabilities.length; i++) {
|
||||
acc += probabilities[i];
|
||||
if (rand < acc) {
|
||||
selectedIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
DataMap selectedReward = rewardList.get(selectedIdx);
|
||||
|
||||
log.info("추첨 결과 - rand: {}, selectedIdx: {}, selectedReward: {}", rand, selectedIdx, selectedReward);
|
||||
|
||||
// 보상 정보 추출
|
||||
|
||||
Object sortOrdrObj = selectedReward.get("sortOrdr");
|
||||
int sortOrdr = (sortOrdrObj instanceof Number) ? ((Number) sortOrdrObj).intValue() : Integer.parseInt(sortOrdrObj.toString());
|
||||
String rewardTy = (String) selectedReward.get("rewardTy");
|
||||
BigDecimal accmlmnyAmt = (BigDecimal) selectedReward.get("accmlmnyAmt");
|
||||
String mlgApplcResn = (String) selectedReward.get("mlgApplcResn");
|
||||
log.info("원본 mlgApplcResn: {}", mlgApplcResn);
|
||||
// 마일리지 소멸일자 세팅
|
||||
String mlgExpireDt = String.valueOf(selectedReward.get("expireDt"));
|
||||
Date exPireDate = new Date();
|
||||
if (!"null".equals(mlgExpireDt)) {
|
||||
int expireDays = Integer.parseInt(mlgExpireDt);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, expireDays);
|
||||
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
|
||||
exPireDate = calendar.getTime();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Long couponInnb = selectedReward.get("couponInnb") != null ? Long.valueOf(selectedReward.get("couponInnb").toString()) : null;
|
||||
Long couponSndngInnb = selectedReward.get("couponSndngInnb") != null ? Long.valueOf(selectedReward.get("couponSndngInnb").toString()) : null;
|
||||
String rewardDc = (String) selectedReward.get("rewardDc");
|
||||
|
||||
boolean rewardSuccess = false;
|
||||
DataMap result = null;
|
||||
if ("coupon".equals(rewardTy)) {
|
||||
// 쿠폰 발급 로직
|
||||
try {
|
||||
BODwldCouponVO dwldCouponVO = new BODwldCouponVO();
|
||||
dwldCouponVO.setSopmalCd(user.getSopmalCd());
|
||||
dwldCouponVO.setMbrInnb(user.getUserInnb());
|
||||
dwldCouponVO.setMbrDvCd(user.getMbrDvCd());
|
||||
dwldCouponVO.setCouponSndngInnb(couponSndngInnb.intValue()); // Long → Integer 변환 필요
|
||||
dwldCouponVO.setEventYn("Y");
|
||||
dwldCouponVO.setCouponSndngTy("01");
|
||||
// 필요시 추가 필드 세팅
|
||||
log.info("VO: {}", dwldCouponVO);
|
||||
Map<String, Object> couponResult = couponService.insertBOBnfCouponRegist(dwldCouponVO);
|
||||
|
||||
if ("success".equals(couponResult.get("result"))) {
|
||||
rewardSuccess = true;
|
||||
log.info("쿠폰 발급 성공: {}", couponResult);
|
||||
} else {
|
||||
rewardSuccess = false;
|
||||
log.error("쿠폰 발급 실패: {}", couponResult.get("message"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rewardSuccess = false;
|
||||
log.error("쿠폰 발급 예외: {}", e.getMessage(), e);
|
||||
}
|
||||
} else if ("mileage".equals(rewardTy)) {
|
||||
|
||||
// null 체크를 더 엄격하게
|
||||
if (mlgApplcResn == null || mlgApplcResn.trim().isEmpty()) {
|
||||
mlgApplcResn = "이벤트 마일리지 지급";
|
||||
log.info("기본값 사용: {}", mlgApplcResn);
|
||||
} else {
|
||||
log.info("DB 값 사용: {}", mlgApplcResn);
|
||||
}
|
||||
|
||||
// 마일리지 VO 설정
|
||||
BOMlgVO mlgVO = new BOMlgVO();
|
||||
|
||||
// 회원 고유번호 설정
|
||||
mlgVO.setMbrInnb(String.valueOf(user.getUserInnb()));
|
||||
|
||||
// 등록자 설정
|
||||
mlgVO.setRegusr(user.getUserInnb());
|
||||
|
||||
// 회원구분코드 설정
|
||||
mlgVO.setMbrDvCd(user.getMbrDvCd());
|
||||
|
||||
// 쇼핑몰코드 설정
|
||||
mlgVO.setSopmalCd(user.getSopmalCd());
|
||||
|
||||
// 등록자구분코드 설정 (01: 회원)
|
||||
mlgVO.setRegusrDvCd("01");
|
||||
|
||||
//마일리지 적립 구분 설정
|
||||
mlgVO.setMlgAccmlDvCd("add");
|
||||
|
||||
// 이벤트 보상 마일리지 적용 구분 설정
|
||||
mlgVO.setMlgApplcDvCd("07"); // 이벤트 보상 마일리지
|
||||
|
||||
// 온라인 오프라인 구분 설정
|
||||
mlgVO.setOnlineOflneDvCd("01");
|
||||
|
||||
// 마일리지 적립 처리 구분 설정
|
||||
mlgVO.setMlgApplcDvCd("07");
|
||||
|
||||
// 이벤트 보상 마일리지 적용 사유 설정
|
||||
mlgVO.setMlgApplcResn(mlgApplcResn);
|
||||
|
||||
// 이벤트 보상 마일리지 금액 설정
|
||||
mlgVO.setAccmlmnyAmt(accmlmnyAmt);
|
||||
|
||||
// 마일리지 유효기간 설정
|
||||
if (!"null".equals(mlgExpireDt)) {
|
||||
mlgVO.setUsePosblEndDt(exPireDate);
|
||||
mlgVO.setMlgValidPd(0);
|
||||
}
|
||||
|
||||
mlgVO.setMlgValidPdAt("Y");
|
||||
|
||||
|
||||
// 마일리지 적립 처리 전 로그
|
||||
log.info("마일리지 적립 시작 - mlgVO: {}", mlgVO);
|
||||
|
||||
// 마일리지 적립 처리
|
||||
result = bomlgService.insertBOMlgAdd(mlgVO);
|
||||
|
||||
// 마일리지 적립 처리 후 로그
|
||||
log.info("마일리지 적립 결과: {}", result);
|
||||
|
||||
rewardSuccess = "success".equals(result.get("result")) || "Y".equals(result.get("success"));
|
||||
|
||||
log.debug("mlgVO 확인 {}", mlgVO);
|
||||
log.info("마일리지 지급 결과: {}", result);
|
||||
}
|
||||
if (rewardSuccess) {
|
||||
// 참여 이력 저장 전에 필수 데이터 설정
|
||||
promVO.setMbrInnb((long) user.getUserInnb()); // 회원 고유번호
|
||||
promVO.setSopmalCd(user.getSopmalCd()); // 쇼핑몰코드
|
||||
// 보상 정보 설정
|
||||
promVO.setPromInnb(promVO.getPromInnb());
|
||||
promVO.setSortOrdr(sortOrdr);
|
||||
promVO.setRewardTy(rewardTy);
|
||||
promVO.setAccmlmnyAmt(accmlmnyAmt);
|
||||
promVO.setCouponInnb(couponInnb);
|
||||
promVO.setCouponSndngInnb(couponSndngInnb);
|
||||
promVO.setRewardDc(rewardDc);
|
||||
|
||||
// 참여 이력 저장 전에 로그 추가
|
||||
log.info("참여 이력 저장 시작 - promVO: {}", promVO);
|
||||
|
||||
try {
|
||||
Map<String, String> insertResult = promService.insertPromJoin(promVO);
|
||||
log.info("참여 이력 저장 결과 전체: {}", insertResult);
|
||||
|
||||
if ("Y".equals(insertResult.get("success"))) { // "result" → "success"로 변경
|
||||
log.info("참여 이력 저장 성공");
|
||||
} else {
|
||||
log.error("참여 이력 저장 실패 - success: {}", insertResult.get("success"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("참여 이력 저장 예외 발생: {}", e.getMessage(), e);
|
||||
content.put("message", "참여 이력 저장에 실패했습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.INTERNAL_SERVER_ERROR, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("result", "success");
|
||||
//response.put("message", "이벤트에 참여되었습니다!");
|
||||
response.put("selected", sortOrdr);
|
||||
response.put("selectedReward", selectedReward);
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
} else {
|
||||
content.put("message", "보상 지급에 실패했습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.INTERNAL_SERVER_ERROR, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// 여기에 추가 (if 블록 밖으로)
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("message", "로그인이 필요합니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.UNAUTHORIZED, HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.prom.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.prom.vo.BOPromVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 Mapper
|
||||
*
|
||||
* @author 개발자
|
||||
* @version 1.0
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface BOPromMapper {
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 목록 조회
|
||||
*/
|
||||
List<DataMap> selectPromList(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 목록 총 개수
|
||||
*/
|
||||
int selectPromListCount(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 상세 조회
|
||||
*/
|
||||
DataMap selectPromDetail(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 등록
|
||||
*/
|
||||
int insertProm(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 수정
|
||||
*/
|
||||
int updateProm(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 삭제
|
||||
*/
|
||||
int deleteProm(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 목록 조회
|
||||
*/
|
||||
List<DataMap> selectPromJoinList(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 목록 총 개수
|
||||
*/
|
||||
int selectPromJoinListCount(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 상세 조회
|
||||
*/
|
||||
DataMap selectPromJoinDetail(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 등록
|
||||
*/
|
||||
int insertPromJoin(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 수정
|
||||
*/
|
||||
int updatePromJoin(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 삭제
|
||||
*/
|
||||
int deletePromJoin(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 목록 조회
|
||||
*/
|
||||
List<DataMap> selectPromRewardList(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 상세 조회
|
||||
*/
|
||||
DataMap selectPromRewardDetail(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 등록
|
||||
*/
|
||||
int insertPromReward(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 수정
|
||||
*/
|
||||
int updatePromReward(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 삭제
|
||||
*/
|
||||
int deletePromReward(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 이벤트 활성화 상태 확인
|
||||
*/
|
||||
DataMap selectPromInfo(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 회원 참여 이력 조회
|
||||
*/
|
||||
DataMap selectPromJoinInfo(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 보상 정보 조회
|
||||
*/
|
||||
List<DataMap> selectPromRewardInfo(DataMap promVO);
|
||||
|
||||
/**
|
||||
* 이벤트 통계 조회
|
||||
*/
|
||||
DataMap selectPromStatistics(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 프로모션 참여자 수 조회
|
||||
*/
|
||||
int countPromJoin(BOPromVO promVO);
|
||||
|
||||
/**
|
||||
* 보상별 당첨자 수 조회
|
||||
*/
|
||||
List<DataMap> countRewardWinners(BOPromVO promVO);
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.prom.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bbs.prom.mapper.BOPromMapper;
|
||||
import com.wb.domainserver.domain.gcone.bbs.prom.vo.BOPromVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 Service
|
||||
*
|
||||
* @author 개발자
|
||||
* @version 1.0
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BOPromService {
|
||||
|
||||
@Autowired
|
||||
private BOPromMapper promMapper;
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 목록 조회
|
||||
*/
|
||||
public List<DataMap> selectPromList(BOPromVO promVO) {
|
||||
return promMapper.selectPromList(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 목록 총 개수
|
||||
*/
|
||||
public int selectPromListCount(BOPromVO promVO) {
|
||||
return promMapper.selectPromListCount(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 상세 조회
|
||||
*/
|
||||
public DataMap selectPromDetail(BOPromVO promVO) {
|
||||
return promMapper.selectPromDetail(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 등록
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> insertProm(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
promVO.setRegistDt(LocalDateTime.now());
|
||||
promVO.setUpdtDt(LocalDateTime.now());
|
||||
|
||||
int insertCount = promMapper.insertProm(promVO);
|
||||
|
||||
if (insertCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트가 등록되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 등록에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 등록 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 수정
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> updateProm(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
promVO.setUpdtDt(LocalDateTime.now());
|
||||
|
||||
int updateCount = promMapper.updateProm(promVO);
|
||||
|
||||
if (updateCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트가 수정되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 수정에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 수정 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 삭제
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> deleteProm(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int deleteCount = promMapper.deleteProm(promVO);
|
||||
|
||||
if (deleteCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트가 삭제되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 삭제에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 삭제 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 목록 조회
|
||||
*/
|
||||
public List<DataMap> selectPromJoinList(BOPromVO promVO) {
|
||||
return promMapper.selectPromJoinList(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 목록 총 개수
|
||||
*/
|
||||
public int selectPromJoinListCount(BOPromVO promVO) {
|
||||
return promMapper.selectPromJoinListCount(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 상세 조회
|
||||
*/
|
||||
public DataMap selectPromJoinDetail(BOPromVO promVO) {
|
||||
return promMapper.selectPromJoinDetail(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 등록
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> insertPromJoin(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
promVO.setRegistDt(LocalDateTime.now());
|
||||
promVO.setUpdtDt(LocalDateTime.now());
|
||||
|
||||
int insertCount = promMapper.insertPromJoin(promVO);
|
||||
|
||||
if (insertCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트 참여가 등록되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 참여 등록에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 참여 등록 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 수정
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> updatePromJoin(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
promVO.setUpdtDt(LocalDateTime.now());
|
||||
|
||||
int updateCount = promMapper.updatePromJoin(promVO);
|
||||
|
||||
if (updateCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트 참여가 수정되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 참여 수정에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 참여 수정 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 참여 삭제
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> deletePromJoin(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int deleteCount = promMapper.deletePromJoin(promVO);
|
||||
|
||||
if (deleteCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트 참여가 삭제되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 참여 삭제에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 참여 삭제 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 목록 조회
|
||||
*/
|
||||
public List<DataMap> selectPromRewardList(BOPromVO promVO) {
|
||||
return promMapper.selectPromRewardList(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 상세 조회
|
||||
*/
|
||||
public DataMap selectPromRewardDetail(BOPromVO promVO) {
|
||||
return promMapper.selectPromRewardDetail(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 상세 조회 (보상 고유번호로)
|
||||
*/
|
||||
public DataMap selectPromRewardDetail(Long promRewardInnb) {
|
||||
BOPromVO vo = new BOPromVO();
|
||||
vo.setPromRewardInnb(promRewardInnb);
|
||||
return selectPromRewardDetail(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 등록
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> insertPromReward(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int insertCount = promMapper.insertPromReward(promVO);
|
||||
|
||||
if (insertCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트 보상이 등록되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 보상 등록에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 보상 등록 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 수정
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> updatePromReward(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int updateCount = promMapper.updatePromReward(promVO);
|
||||
|
||||
if (updateCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트 보상이 수정되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 보상 수정에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 보상 수정 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 보상 삭제
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, String> deletePromReward(BOPromVO promVO) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int deleteCount = promMapper.deletePromReward(promVO);
|
||||
|
||||
if (deleteCount > 0) {
|
||||
result.put("success", "Y");
|
||||
result.put("message", "프로모션 이벤트 보상이 삭제되었습니다.");
|
||||
} else {
|
||||
result.put("success", "N");
|
||||
result.put("message", "프로모션 이벤트 보상 삭제에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("프로모션 이벤트 보상 삭제 중 오류 발생", e);
|
||||
result.put("success", "N");
|
||||
result.put("message", "처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이벤트 활성화 상태 확인
|
||||
*/
|
||||
public DataMap selectPromInfo(BOPromVO promVO) {
|
||||
return promMapper.selectPromInfo(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 참여 이력 조회
|
||||
*/
|
||||
public DataMap selectPromJoinInfo(BOPromVO promVO) {
|
||||
return promMapper.selectPromJoinInfo(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이벤트 활성화 여부 확인
|
||||
*/
|
||||
public boolean isPromActive(DataMap promInfo) {
|
||||
if (promInfo == null) {
|
||||
return false;
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime bgnDt = (LocalDateTime) promInfo.get("bgnDt");
|
||||
LocalDateTime endDt = (LocalDateTime) promInfo.get("endDt");
|
||||
String useAt = (String) promInfo.get("useAt");
|
||||
log.info("now: {}, bgnDt: {}, endDt: {}, useAt: {}", now, bgnDt, endDt, useAt);
|
||||
return "Y".equals(useAt) &&
|
||||
bgnDt != null && (now.isEqual(bgnDt) || now.isAfter(bgnDt)) &&
|
||||
endDt != null && (now.isBefore(endDt) || now.isEqual(endDt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로모션 참여자 수 조회
|
||||
*/
|
||||
public int countPromJoin(BOPromVO promVO) {
|
||||
return promMapper.countPromJoin(promVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 보상별 당첨자 수 조회
|
||||
*/
|
||||
public Map<Integer, Integer> countRewardWinners(BOPromVO promVO) {
|
||||
List<DataMap> result = promMapper.countRewardWinners(promVO);
|
||||
Map<Integer, Integer> rewardWinCount = new HashMap<>();
|
||||
|
||||
for (DataMap item : result) {
|
||||
Object sortOrdrObj = item.get("sortOrdr");
|
||||
Object countObj = item.get("winnerCount");
|
||||
Integer sortOrdr = null;
|
||||
Integer count = null;
|
||||
if (sortOrdrObj instanceof Number) {
|
||||
sortOrdr = ((Number) sortOrdrObj).intValue();
|
||||
} else if (sortOrdrObj != null) {
|
||||
sortOrdr = Integer.parseInt(sortOrdrObj.toString());
|
||||
}
|
||||
if (countObj instanceof Number) {
|
||||
count = ((Number) countObj).intValue();
|
||||
} else if (countObj != null) {
|
||||
count = Integer.parseInt(countObj.toString());
|
||||
}
|
||||
if (sortOrdr != null && count != null) {
|
||||
rewardWinCount.put(sortOrdr, count);
|
||||
}
|
||||
}
|
||||
|
||||
return rewardWinCount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.wb.domainserver.domain.gcone.bbs.prom.vo;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 프로모션 이벤트 VO
|
||||
*
|
||||
* @author 개발자
|
||||
* @version 1.0
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOPromVO {
|
||||
|
||||
// GC_PROM 테이블
|
||||
private Long promInnb; // 게시판 이벤트 고유번호
|
||||
private String sopmalCd; // 쇼핑몰코드
|
||||
private String promNm; // 이벤트 제목
|
||||
private String promDesc; // 이벤트 설명
|
||||
private String promType; // 이벤트 유형 (복권, 룰렛 등)
|
||||
private String promRule; // 참여 룰 (once, daily)
|
||||
private String bbsId; // 게시판 아이디
|
||||
private Long bbscttInnb; // 게시글 고유번호
|
||||
private LocalDateTime bgnDt; // 시작일
|
||||
private LocalDateTime endDt; // 종료일
|
||||
private String useAt; // 사용 여부 (Y/N)
|
||||
private LocalDateTime registDt; // 등록일시
|
||||
private LocalDateTime updtDt; // 수정일시
|
||||
|
||||
// GC_PROM_JOIN 테이블
|
||||
private Long promJoinInnb; // 게시판 이벤트 당첨 고유번호
|
||||
private Long mbrInnb; // 회원고유번호
|
||||
private LocalDate joinDt; // 참여날짜
|
||||
private Integer sortOrdr; // 룰렛 UI에서 표시할 순서 정렬용
|
||||
private String rewardTy; // 보상 유형 (coupon, mileage)
|
||||
private BigDecimal accmlmnyAmt; // 적립금액
|
||||
private Long couponInnb; // 쿠폰발송 고유번호
|
||||
private Long couponSndngInnb; // 쿠폰발송 고유번호
|
||||
private String rewardDc; // 보상 설명
|
||||
|
||||
// GC_PROM_REWARD 테이블
|
||||
private Long promRewardInnb; // 게시판 이벤트 보상 고유번호
|
||||
private BigDecimal probability; // 지급 확률 (%)
|
||||
|
||||
// 조인 정보
|
||||
private String mbrNm; // 회원명
|
||||
private String mbrId; // 회원ID
|
||||
|
||||
// 검색 조건
|
||||
private String searchKeyword; // 검색 키워드
|
||||
private String searchType; // 검색 타입 (제목, 설명, 회원명, 회원ID)
|
||||
private String dateType; // 날짜 검색 타입 (등록일, 시작일, 종료일)
|
||||
private LocalDateTime startDate; // 검색 시작일
|
||||
private LocalDateTime endDate; // 검색 종료일
|
||||
private String rewardType; // 보상 타입 필터
|
||||
|
||||
// 통계 정보
|
||||
private Integer totalJoinCount; // 총 참여 수
|
||||
private Integer rewardCount; // 보상 지급 수
|
||||
private BigDecimal actualRate; // 실제 지급률
|
||||
|
||||
// 페이징
|
||||
private int pageIndex = 1; // 현재 페이지
|
||||
private int pageUnit = 10; // 페이지당 레코드 수
|
||||
private int firstIndex; // 첫 번째 인덱스
|
||||
private int lastIndex; // 마지막 인덱스
|
||||
private int recordCountPerPage; // 페이지당 레코드 수
|
||||
private PaginationInfo paginationInfo; // 페이징 정보
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.atend.controller;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.atend.service.BOAtendService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.atend.vo.BOAtendVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
public class BOAtendController {
|
||||
|
||||
@Autowired
|
||||
private BOAtendService service;
|
||||
|
||||
/**
|
||||
* 혜택 화면 설정 정보 조회
|
||||
*
|
||||
* @param vo 혜택 화면 설정 조회 조건을 담고 있는 VO
|
||||
* @return 혜택 화면 설정 정보를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBenefitScreenInfo")
|
||||
public ResponseEntity<String> selectBOBenefitScreenInfo(@RequestBody BOAtendVO vo) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectBOBenefitScreenInfo BOBenefitVO chk ::: {}", vo);
|
||||
|
||||
List<DataMap> screenInfo = service.selectBOBenefitScreenInfo(vo);
|
||||
|
||||
List<List<DataMap>> allRewardInfo = new ArrayList<>();
|
||||
|
||||
for (DataMap screenItem : screenInfo) {
|
||||
BigInteger bnfInnbBigInt = (BigInteger) screenItem.get("bnfInnb");
|
||||
String bnfInnb = bnfInnbBigInt.toString();
|
||||
// vo 객체에 bnfInnb 값 설정
|
||||
vo.setBnfInnb(bnfInnb);
|
||||
|
||||
// 출석 보상 정보 조회
|
||||
List<DataMap> rewardInfo = service.selectAttendanceRewardInfo(vo);
|
||||
|
||||
// 조회된 rewardInfo를 allRewardInfo에 추가
|
||||
allRewardInfo.add(rewardInfo);
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("screenInfo", screenInfo);
|
||||
content.put("rewardInfo", allRewardInfo);
|
||||
|
||||
log.debug("selectBOBenefitScreenInfo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 출석체크 참여
|
||||
*
|
||||
* @param vo 출석체크 참여 정보를 담고 있는 VO
|
||||
* @return 참여 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/participateAttendanceCheck")
|
||||
public ResponseEntity<String> participateAttendanceCheck(@RequestBody BOAtendVO vo) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("participateAttendanceCheck BOAtendVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.participateAttendanceCheck(vo);
|
||||
|
||||
log.debug("participateAttendanceCheck result chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 이번 달 출석 횟수 및 현황 조회
|
||||
*
|
||||
* @param vo 출석 정보 조회 조건을 담고 있는 VO
|
||||
* @return 출석 횟수와 현황을 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/selectCurrentMonthAttendanceInfo")
|
||||
public ResponseEntity<String> selectCurrentMonthAttendanceInfo(@RequestBody BOAtendVO vo) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectCurrentMonthAttendanceInfo BOAtendVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.selectCurrentMonthAttendanceInfo(vo);
|
||||
|
||||
log.debug("selectCurrentMonthAttendanceInfo content chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 누적 출석 마일리지 조회
|
||||
*
|
||||
* @param vo 누적 출석 마일리지 조회 조건을 담고 있는 VO
|
||||
* @return 누적 출석 마일리지를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/selectTotalAttendanceMileage")
|
||||
public ResponseEntity<String> selectTotalAttendanceMileage(@RequestBody BOAtendVO vo) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectTotalAttendanceMileage BOBenefitVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.selectTotalAttendanceMileage(vo);
|
||||
|
||||
log.debug("selectTotalAttendanceMileage content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림 상태 조회
|
||||
*
|
||||
* @param vo 알림 상태 조회 조건을 담고 있는 VO
|
||||
* @return 알림 상태를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/getNotificationStatus")
|
||||
public ResponseEntity<String> getNotificationStatus(@RequestBody BOAtendVO vo) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getNotificationStatus BOAtendVO chk ::: {}", vo);
|
||||
|
||||
boolean status = service.getNotificationStatus(vo);
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("notificationStatus", status);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림 신청
|
||||
*
|
||||
* @param vo 알림 신청 정보를 담고 있는 VO
|
||||
* @return 알림 신청 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/saveAtendAlarmSettings")
|
||||
public ResponseEntity<String> saveAlarmSettings(@RequestBody BOAtendVO vo) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("applyNotification BOAtendVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> result = service.saveAlarmSettings(vo);
|
||||
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.atend.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.atend.vo.BOAtendVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
/**
|
||||
* 혜택 관리 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOAtendMapper {
|
||||
|
||||
/** 혜택 화면 설정 정보 조회 */
|
||||
List<DataMap> selectBOBenefitScreenInfo(BOAtendVO vo);
|
||||
|
||||
/** 출석 보상 정보 조회 */
|
||||
List<DataMap> selectAttendanceRewardInfo(BOAtendVO vo);
|
||||
|
||||
/** 월간 출석 현황 조회 */
|
||||
List<DataMap> selectMonthlyAttendance(BOAtendVO vo);
|
||||
|
||||
/** 일일 출석 보상 정보 조회 */
|
||||
DataMap selectDailyAttendanceReward(BOAtendVO vo);
|
||||
|
||||
/** 누적 출석 보상 정보 조회 */
|
||||
List<DataMap> selectCumulativeAttendanceReward(BOAtendVO vo);
|
||||
|
||||
/** 출석체크 참여 */
|
||||
int participateAttendanceCheck(BOAtendVO vo);
|
||||
|
||||
/** 마일리지 적립 */
|
||||
int insertMileageReceipt(BOAtendVO vo);
|
||||
|
||||
/** 이번 달 출석 횟수 조회 */
|
||||
DataMap selectCurrentMonthAttendanceCount(BOAtendVO vo);
|
||||
|
||||
/** 누적 출석 마일리지 조회 */
|
||||
DataMap selectTotalAttendanceMileage(BOAtendVO vo);
|
||||
|
||||
/** 오늘 출석체크 참여 정보 조회 */
|
||||
DataMap selectTodayAttendance(BOAtendVO vo);
|
||||
|
||||
/** 알림 상태 조회 */
|
||||
DataMap selectNotificationStatus(BOAtendVO vo);
|
||||
|
||||
/** 알림 신청 */
|
||||
int insertNotification(BOAtendVO vo);
|
||||
|
||||
/** 알림 취소 */
|
||||
int updateAtendNotification(BOAtendVO vo);
|
||||
|
||||
/** 초록잎 지급 개수 조회 */
|
||||
DataMap selectLeafCounts(BOAtendVO vo);
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.atend.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.atend.mapper.BOAtendMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.atend.vo.BOAtendVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.vo.BODwldCouponVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 출석체크 관련 혜택 서비스
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BOAtendService {
|
||||
|
||||
private final BOAtendMapper mapper;
|
||||
private final BenefitRewardService benefitRewardService;
|
||||
|
||||
/**
|
||||
* 혜택 화면 설정 정보를 조회하는 메서드
|
||||
* @param vo 출석체크 VO
|
||||
* @return 화면 설정 정보 목록
|
||||
*/
|
||||
public List<DataMap> selectBOBenefitScreenInfo(BOAtendVO vo) {
|
||||
return mapper.selectBOBenefitScreenInfo(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 출석 보상 정보를 조회하는 메서드
|
||||
* @param vo 출석체크 VO
|
||||
* @return 출석 보상 정보 목록
|
||||
*/
|
||||
public List<DataMap> selectAttendanceRewardInfo(BOAtendVO vo) {
|
||||
return mapper.selectAttendanceRewardInfo(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 출석체크 참여 처리 메서드
|
||||
* @param vo 출석체크 VO
|
||||
* @return 처리 결과 맵
|
||||
*/
|
||||
@Transactional
|
||||
public DataMap participateAttendanceCheck(BOAtendVO vo) {
|
||||
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 1. 오늘 출석체크 여부 확인
|
||||
DataMap todayAttendance = mapper.selectTodayAttendance(vo);
|
||||
if (todayAttendance != null) {
|
||||
|
||||
result.put("success", false);
|
||||
result.put("message", "이미 오늘 출석체크를 하셨습니다.");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 2. 초록잎 지급 처리
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
int paidLeafCnt = 0;
|
||||
int specialLeafCnt = 0;
|
||||
int totalLeafCnt = 0;
|
||||
|
||||
if (leafCounts != null) {
|
||||
paidLeafCnt = leafCounts.get("pymntCnt") != null ? ((Number) leafCounts.get("pymntCnt")).intValue() : 0;
|
||||
specialLeafCnt = leafCounts.get("specialCnt") != null ? ((Number) leafCounts.get("specialCnt")).intValue() : 0;
|
||||
totalLeafCnt = paidLeafCnt + specialLeafCnt;
|
||||
}
|
||||
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
|
||||
// 3. 출석체크 참여 정보 저장
|
||||
int insertResult = mapper.participateAttendanceCheck(vo);
|
||||
if (insertResult <= 0) {
|
||||
|
||||
result.put("success", false);
|
||||
result.put("message", "출석체크 참여에 실패했습니다.");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 4. 일일 출석 보상 지급 처리
|
||||
DataMap dailyReward = mapper.selectDailyAttendanceReward(vo);
|
||||
if (dailyReward != null) {
|
||||
processSingleReward(vo, dailyReward);
|
||||
}
|
||||
|
||||
// 5. 누적 출석 보상 확인 및 지급
|
||||
DataMap attendanceCount = mapper.selectCurrentMonthAttendanceCount(vo);
|
||||
int currentCount = ((Number) attendanceCount.get("currentMonthAttendanceCount")).intValue();
|
||||
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "출석체크가 완료되었습니다.");
|
||||
result.put("currentAttendanceCount", currentCount);
|
||||
|
||||
// 10회, 20회, 또는 월말 마지막 날인 경우에만 누적 보상 체크
|
||||
if (currentCount == 10 || currentCount == 20 ||
|
||||
(currentCount == getDaysInCurrentMonth() && isLastDayOfMonth())) {
|
||||
List<DataMap> cumulativeRewards = mapper.selectCumulativeAttendanceReward(vo);
|
||||
List<Map<String, Object>> receivedRewards = processCumulativeRewards(vo, currentCount, cumulativeRewards);
|
||||
|
||||
if (!receivedRewards.isEmpty()) {
|
||||
result.put("receivedRewards", receivedRewards);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 월의 총 일수를 계산하는 메서드
|
||||
* @return 현재 월의 총 일수
|
||||
*/
|
||||
private int getDaysInCurrentMonth() {
|
||||
LocalDate now = LocalDate.now();
|
||||
return now.lengthOfMonth();
|
||||
}
|
||||
|
||||
/**
|
||||
* 월말 체크 helper 메서드
|
||||
* @return 오늘이 월말인지 여부
|
||||
*/
|
||||
private boolean isLastDayOfMonth() {
|
||||
LocalDate now = LocalDate.now();
|
||||
return now.getDayOfMonth() == now.lengthOfMonth();
|
||||
}
|
||||
|
||||
/**
|
||||
* 이번 달 출석 횟수 및 현황을 조회하는 메서드
|
||||
* @param vo 출석체크 VO
|
||||
* @return 출석 정보가 담긴 DataMap
|
||||
*/
|
||||
public DataMap selectCurrentMonthAttendanceInfo(BOAtendVO vo) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 1. 이번 달 석 횟수 조회
|
||||
DataMap attendanceCount = mapper.selectCurrentMonthAttendanceCount(vo);
|
||||
result.put("attendanceCount", attendanceCount.get("currentMonthAttendanceCount"));
|
||||
|
||||
// 2. 월간 출석 현황 조회
|
||||
List<DataMap> monthlyAttendance = mapper.selectMonthlyAttendance(vo);
|
||||
result.put("monthlyAttendance", monthlyAttendance);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 누적 출석 마일리지를 조회하는 메서드
|
||||
* @param vo 출석체크 VO
|
||||
* @return 누적 마일리지 정보
|
||||
*/
|
||||
public DataMap selectTotalAttendanceMileage(BOAtendVO vo) {
|
||||
return mapper.selectTotalAttendanceMileage(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림 상태를 조회하는 메서드
|
||||
* @param vo 출석체크 VO
|
||||
* @return 알림 동의 여부
|
||||
*/
|
||||
public boolean getNotificationStatus(BOAtendVO vo) {
|
||||
DataMap result = mapper.selectNotificationStatus(vo);
|
||||
return result != null && "Y".equals(result.get("agreAt"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 개별 알람 설정을 저장하는 메서드
|
||||
* @param vo 출석체크 VO (알람 설정 정보 포함)
|
||||
* @return 저장 결과 맵
|
||||
*/
|
||||
public Map<String, Object> saveAlarmSettings(BOAtendVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 1. 기존 알람 설정 조회
|
||||
DataMap existingRecord = mapper.selectNotificationStatus(vo);
|
||||
|
||||
boolean success;
|
||||
if (existingRecord != null) {
|
||||
// 2. 기존 데이터가 있는 경우 Y/N 토글
|
||||
String currentStatus = (String) existingRecord.get("agreAt");
|
||||
vo.setAgreAt("Y".equals(currentStatus) ? "N" : "Y");
|
||||
|
||||
int updatedCount = mapper.updateAtendNotification(vo);
|
||||
success = updatedCount > 0;
|
||||
result.put("message", success ?
|
||||
("Y".equals(vo.getAgreAt()) ? "알림이 설정되었습니다." : "알림이 해제되었습니다.") :
|
||||
"알림 설정 변경에 실패했습니다.");
|
||||
} else {
|
||||
// 3. 기존 데이터가 없는 경우에만 신규 등록 (최초 동의는 Y로 설정)
|
||||
vo.setAgreAt("Y");
|
||||
int insertedCount = mapper.insertNotification(vo);
|
||||
success = insertedCount > 0;
|
||||
result.put("message", success ? "알림이 설정되었습니다." : "알림 설정에 실패했습니다.");
|
||||
}
|
||||
|
||||
result.put("success", success);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to save alarm setting", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "알림 설정 중 오류가 발생했습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 누적 보상 처리 로직
|
||||
* @param vo 출석체크 VO
|
||||
* @param currentCount 현재 출석 횟수
|
||||
* @param cumulativeRewards 누적 보상 목록
|
||||
* @return 지급된 보상 정보 목록
|
||||
*/
|
||||
private List<Map<String, Object>> processCumulativeRewards(BOAtendVO vo, int currentCount, List<DataMap> cumulativeRewards) {
|
||||
List<Map<String, Object>> receivedRewards = new ArrayList<>();
|
||||
|
||||
for (DataMap reward : cumulativeRewards) {
|
||||
String bnfRwdCateDvCd = (String) reward.get("bnfRwdCateDvCd");
|
||||
|
||||
if ((bnfRwdCateDvCd.equals("01020") && currentCount == 10) || // 10회 보상
|
||||
(bnfRwdCateDvCd.equals("01030") && currentCount == 20) || // 20회 보상
|
||||
(bnfRwdCateDvCd.equals("01040") && currentCount == getDaysInCurrentMonth())) { // 100% 출석
|
||||
|
||||
processSingleReward(vo, reward);
|
||||
|
||||
// 지급된 보상 정보 수집
|
||||
Map<String, Object> rewardInfo = new HashMap<>();
|
||||
|
||||
// 보상 유형 설정
|
||||
String rewardType = "";
|
||||
if (bnfRwdCateDvCd.equals("01020")) {
|
||||
rewardType = "10회 누적 보상";
|
||||
} else if (bnfRwdCateDvCd.equals("01030")) {
|
||||
rewardType = "20회 누적 보상";
|
||||
} else if (bnfRwdCateDvCd.equals("01040")) {
|
||||
rewardType = "100% 출석 보상";
|
||||
}
|
||||
rewardInfo.put("rewardType", rewardType);
|
||||
|
||||
// 마일리지 보상 정보
|
||||
Object mlgRwdAmt = reward.get("mlgRwdAmt");
|
||||
if (mlgRwdAmt != null && ((Number) mlgRwdAmt).doubleValue() > 0) {
|
||||
rewardInfo.put("mileageAmount", ((Number) mlgRwdAmt).doubleValue());
|
||||
}
|
||||
|
||||
// 쿠폰 보상 정보
|
||||
Object couponInnb = reward.get("couponInnb");
|
||||
Object itmNm = reward.get("itmNm");
|
||||
if (couponInnb != null && itmNm != null) {
|
||||
rewardInfo.put("couponId", ((Number) couponInnb).longValue());
|
||||
rewardInfo.put("couponName", (String) itmNm);
|
||||
}
|
||||
|
||||
receivedRewards.add(rewardInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return receivedRewards;
|
||||
}
|
||||
|
||||
/**
|
||||
* 단일 보상 처리 로직 (일일 보상, 누적 보상 공통)
|
||||
* @param originalVo 원본 출석체크 VO
|
||||
* @param reward 보상 정보
|
||||
*/
|
||||
private void processSingleReward(BOAtendVO originalVo, DataMap reward) {
|
||||
// VO 복사본 생성 (원본 데이터 보호)
|
||||
BOAtendVO rewardVo = createRewardVO(originalVo, reward);
|
||||
|
||||
// 마일리지 보상이 있는 경우
|
||||
Object mlgRwdAmt = reward.get("mlgRwdAmt");
|
||||
if (mlgRwdAmt != null) {
|
||||
rewardVo.setMlgRwdAmt((BigDecimal) mlgRwdAmt);
|
||||
}
|
||||
|
||||
// 쿠폰 보상이 있는 경우
|
||||
Object couponInnb = reward.get("couponInnb");
|
||||
if (couponInnb != null) {
|
||||
rewardVo.setCouponInnb((BigInteger) couponInnb);
|
||||
}
|
||||
|
||||
// 마일리지나 쿠폰 중 하나라도 있는 경우에만 처리
|
||||
if (mlgRwdAmt != null || couponInnb != null) {
|
||||
// 혜택 보상 영수증 저장
|
||||
mapper.insertMileageReceipt(rewardVo);
|
||||
|
||||
// 마일리지 실제 등록 처리
|
||||
if (mlgRwdAmt != null && ((Number) mlgRwdAmt).doubleValue() > 0) {
|
||||
registerMileage(rewardVo);
|
||||
}
|
||||
|
||||
// 쿠폰 실제 등록 처리
|
||||
if (couponInnb != null) {
|
||||
registerCoupon(rewardVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 보상용 VO 생성
|
||||
* @param originalVo 원본 VO
|
||||
* @param reward 보상 정보
|
||||
* @return 보상용 VO
|
||||
*/
|
||||
private BOAtendVO createRewardVO(BOAtendVO originalVo, DataMap reward) {
|
||||
BOAtendVO rewardVo = new BOAtendVO();
|
||||
|
||||
// 기본 정보 복사
|
||||
rewardVo.setSopmalCd(originalVo.getSopmalCd());
|
||||
rewardVo.setMbrInnb(originalVo.getMbrInnb());
|
||||
rewardVo.setMbrDvCd(originalVo.getMbrDvCd());
|
||||
rewardVo.setBnfInnb(originalVo.getBnfInnb());
|
||||
rewardVo.setBnfPrtInnb(originalVo.getBnfPrtInnb());
|
||||
rewardVo.setRegusr(originalVo.getRegusr());
|
||||
|
||||
// 보상 정보 설정
|
||||
rewardVo.setBnfRwdCateDvCd((String) reward.get("bnfRwdCateDvCd"));
|
||||
rewardVo.setBnfRwdGodsDvCd((String) reward.get("bnfRwdGodsDvCd"));
|
||||
|
||||
return rewardVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 출석체크 VO
|
||||
*/
|
||||
private void registerMileage(BOAtendVO vo) {
|
||||
try {
|
||||
BOMlgVO mlgVo = new BOMlgVO();
|
||||
mlgVo.setSopmalCd(vo.getSopmalCd());
|
||||
mlgVo.setMbrInnb(String.valueOf(vo.getMbrInnb()));
|
||||
mlgVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
mlgVo.setAccmlmnyAmt(vo.getMlgRwdAmt());
|
||||
mlgVo.setBnfRcvInnb(String.valueOf(vo.getBnfRcvInnb()));
|
||||
|
||||
// 마일리지 적용 구분 코드 및 사유 설정
|
||||
mlgVo.setMlgApplcDvCd("07");
|
||||
mlgVo.setMlgApplcResn("출석체크 보상");
|
||||
|
||||
boolean success = benefitRewardService.issueMileage(mlgVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("출석체크 마일리지 등록 요청 성공: {}", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
log.error("출석체크 마일리지 등록 요청 실패: {}", vo.getMlgRwdAmt());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerMileage 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 쿠폰 실제 등록 처리(수정)
|
||||
* @param vo 출석체크 VO
|
||||
*/
|
||||
private void registerCoupon(BOAtendVO vo) {
|
||||
try {
|
||||
BODwldCouponVO couponVo = new BODwldCouponVO();
|
||||
couponVo.setSopmalCd(vo.getSopmalCd());
|
||||
couponVo.setMbrInnb(vo.getMbrInnb());
|
||||
couponVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
|
||||
// BigInteger를 Integer로 안전하게 변환
|
||||
if (vo.getCouponInnb() != null) {
|
||||
couponVo.setCouponSndngInnb(vo.getCouponInnb().intValue());
|
||||
}
|
||||
|
||||
couponVo.setBnfRcvInnb(vo.getBnfRcvInnb());
|
||||
|
||||
boolean success = benefitRewardService.issueCoupon(couponVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("출석체크 쿠폰 등록 요청 성공: {}", vo.getCouponInnb());
|
||||
} else {
|
||||
log.error("출석체크 쿠폰 등록 요청 실패: {}", vo.getCouponInnb());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerCoupon 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.atend.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOAtendVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private String bnfInnb;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 사용 여부 */
|
||||
private String useAt;
|
||||
/** 진행기간 시작일시 */
|
||||
private String bnfBgnDt;
|
||||
/** 진행기간 종료일시 */
|
||||
private String bnfEndDt;
|
||||
/** 충전 필요 금액 */
|
||||
private String amtForChg;
|
||||
/** 회원 고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 등록자 */
|
||||
private int regUsr;
|
||||
/** 등록일시 */
|
||||
private Date registDt;
|
||||
/** 수정자 */
|
||||
private int updusr;
|
||||
/** 수정일시 */
|
||||
private Date updtDt;
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 보상수령 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
/** 혜택 참여 일시 */
|
||||
private String bnfPrtDt;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 참여 내용 1 */
|
||||
private String prtCont1;
|
||||
/** 참여 내용 2 */
|
||||
private String prtCont2;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 요청 페이지 구분 */
|
||||
private String reqPageDv;
|
||||
/** 출석 횟수 */
|
||||
private Integer currentMonthAttendanceCount;
|
||||
/** 누적 출석 마일리지 */
|
||||
private Double totalAttendanceMileage;
|
||||
/** 대표 이미지 */
|
||||
private String reprsntImg;
|
||||
/** 대표 링크 URL */
|
||||
private String reprsntLinkUrl;
|
||||
/** 보상 이미지 */
|
||||
private String rewardImg;
|
||||
/** 보상 링크 URL */
|
||||
private String rewardLinkUrl;
|
||||
/** 혜택 문구 */
|
||||
private String bnfWordsCn;
|
||||
/** 출석 일자 목록 */
|
||||
private String attendanceDays;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 보상 상품 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
/** 마일리지 */
|
||||
private BigDecimal mlgRwdAmt;
|
||||
/** 쿠폰 고유번호 */
|
||||
private BigInteger couponInnb;
|
||||
/** 혜택 동의 고유번호 */
|
||||
private Long bnfAgreInnb;
|
||||
/** 동의 여부 */
|
||||
private String agreAt;
|
||||
/** 초록잎 지급량 */
|
||||
private Integer paidLeafCnt;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftMain.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftMain.vo.BOBnftMainVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.intakchl.vo.BOIntakchlVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftMain.service.BOBnftMainService;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
@RequiredArgsConstructor
|
||||
public class BOBnftMainController {
|
||||
|
||||
private final BOBnftMainService service;
|
||||
|
||||
/**
|
||||
* 혜택 메인 페이지 정보 가져오는 메소드
|
||||
*
|
||||
* @param vo 혜택 메인 페이지 조회 정보를 담고있는 VO
|
||||
* @return 혜택 메인페이지 정보 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/bnftMainInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> bnftMainInfo(@RequestBody BOBnftMainVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("bnftMainInfo BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> result = service.bnftMainInfo(vo);
|
||||
|
||||
log.debug("bnftMainInfo result chk ::: {}", result);
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* QR 이벤트 보상 처리
|
||||
*
|
||||
* @param vo QR 이벤트 처리를 위한 VO
|
||||
* @return QR 이벤트 처리 결과 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/qrevnt/rewardProc", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> qrEventRewardProc(@RequestBody BOBnftMainVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("qrEventRewardProc VO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> result = service.processQrEventReward(vo);
|
||||
|
||||
log.debug("qrEventRewardProc result chk ::: {}", result);
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 디바이스 권한 조회
|
||||
*
|
||||
* @param vo 디바이스 권한 조회를 위한 VO
|
||||
* @return 디바이스 권한 정보
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/devicePermission", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> devicePermission(@RequestBody BOBnftMainVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
return ApiResponse.of(service.selectDevicePermission(vo)).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftMain.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftMain.vo.BOBnftMainVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BOBnftMainMapper {
|
||||
|
||||
/** 혜택 메인 목록 조회 */
|
||||
List<DataMap> selectBnftMainList(BOBnftMainVO vo);
|
||||
|
||||
/** 배너 목록 조회 */
|
||||
List<DataMap> selectBannerList(BOBnftMainVO vo);
|
||||
|
||||
/** 현재 라이브 쇼핑 조회 */
|
||||
DataMap selectCurrentLiveShopping(BOBnftMainVO vo);
|
||||
|
||||
/** 새 이벤트 조회 */
|
||||
List<DataMap> selectNewEvents(BOBnftMainVO vo);
|
||||
|
||||
/** 참여한 이벤트 조회 */
|
||||
List<DataMap> selectParticipatedEvents(BOBnftMainVO vo);
|
||||
|
||||
/** QR 이벤트 혜택 설정 조회 */
|
||||
DataMap selectQrEventBenefit(BOBnftMainVO vo);
|
||||
|
||||
/** QR 이벤트 참여 정보 저장 */
|
||||
int insertQrEventParticipation(BOBnftMainVO vo);
|
||||
|
||||
/** QR 이벤트 보상 정보 조회 */
|
||||
DataMap selectQrEventReward(BOBnftMainVO vo);
|
||||
|
||||
/** QR 이벤트 보상 영수증 저장 */
|
||||
int insertQrEventRewardReceipt(BOBnftMainVO vo);
|
||||
|
||||
/** 마케팅동의 여부 조회 */
|
||||
DataMap selectMbrMarktAgreeAt(BOBnftMainVO vo);
|
||||
|
||||
/** 디바이스 권한 조회 */
|
||||
DataMap selectDevicePermission(BOBnftMainVO vo);
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftMain.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftMain.mapper.BOBnftMainMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftMain.vo.BOBnftMainVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 혜택 메인 서비스
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BOBnftMainService {
|
||||
|
||||
private final BOBnftMainMapper mapper;
|
||||
|
||||
/**
|
||||
* 혜택 메인 목록 조회
|
||||
*
|
||||
* @return List<DataMap> 혜택 메인 목록 조회
|
||||
*/
|
||||
public Map<String, Object> bnftMainInfo(BOBnftMainVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 메인 메뉴 목록
|
||||
List<DataMap> mainList = mapper.selectBnftMainList(vo);
|
||||
result.put("mainList", mainList);
|
||||
|
||||
// 배너 목록
|
||||
List<DataMap> bannerList = mapper.selectBannerList(vo);
|
||||
result.put("bannerList", bannerList);
|
||||
|
||||
// 현재 라이브 쇼핑
|
||||
DataMap currentLiveShopping = mapper.selectCurrentLiveShopping(vo);
|
||||
result.put("currentLiveShopping", currentLiveShopping);
|
||||
|
||||
// 새 이벤트
|
||||
List<DataMap> newEvents = mapper.selectNewEvents(vo);
|
||||
result.put("newEvents", newEvents);
|
||||
|
||||
// 참여한 이벤트
|
||||
List<DataMap> participatedEvents = mapper.selectParticipatedEvents(vo);
|
||||
result.put("participatedEvents", participatedEvents);
|
||||
|
||||
// 마케팅동의 여부
|
||||
DataMap mbrMarktAgreeAt = mapper.selectMbrMarktAgreeAt(vo);
|
||||
result.put("mbrMarktAgreeAt", mbrMarktAgreeAt);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* QR 이벤트 보상 처리
|
||||
*
|
||||
* @param vo QR 이벤트 처리를 위한 VO
|
||||
* @return 처리 결과 Map
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> processQrEventReward(BOBnftMainVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
log.info("=== QR 이벤트 보상 처리 시작 ===");
|
||||
log.info("요청 파라미터: {}", vo);
|
||||
|
||||
// 1. QR 이벤트 혜택 설정 조회
|
||||
DataMap qrEventBenefit = mapper.selectQrEventBenefit(vo);
|
||||
if (qrEventBenefit == null) {
|
||||
result.put("success", false);
|
||||
result.put("message", "QR 이벤트 설정을 찾을 수 없습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 혜택 고유번호 설정
|
||||
vo.setBnfInnb((String) qrEventBenefit.get("bnfInnb"));
|
||||
|
||||
// 2. QR 이벤트 참여 정보 저장
|
||||
int participationResult = mapper.insertQrEventParticipation(vo);
|
||||
if (participationResult <= 0) {
|
||||
result.put("success", false);
|
||||
result.put("message", "QR 이벤트 참여 처리에 실패했습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 3. QR 이벤트 보상 정보 조회 및 지급
|
||||
DataMap qrEventReward = mapper.selectQrEventReward(vo);
|
||||
if (qrEventReward != null) {
|
||||
processQrEventRewardReceipt(vo, qrEventReward);
|
||||
|
||||
// 결과에 보상 정보 추가
|
||||
String rewardType = (String) qrEventReward.get("bnfRwdGodsDvCd");
|
||||
Object mileageAmount = qrEventReward.get("mlgRwdAmt");
|
||||
Object couponId = qrEventReward.get("couponInnb");
|
||||
Object couponName = qrEventReward.get("itmNm");
|
||||
|
||||
result.put("rewardType", rewardType);
|
||||
if (mileageAmount != null) {
|
||||
result.put("mileageAmount", ((Number) mileageAmount).doubleValue());
|
||||
}
|
||||
if (couponId != null) {
|
||||
result.put("couponId", ((Number) couponId).longValue());
|
||||
}
|
||||
if (couponName != null) {
|
||||
result.put("couponName", couponName.toString());
|
||||
}
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "QR 이벤트 보상이 지급되었습니다.");
|
||||
result.put("storeId", vo.getStrInnb());
|
||||
|
||||
log.info("=== QR 이벤트 보상 처리 완료 ===");
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("QR 이벤트 보상 처리 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "QR 이벤트 처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* QR 이벤트 보상 영수증 처리
|
||||
*
|
||||
* @param vo QR 이벤트 처리를 위한 VO
|
||||
* @param qrEventReward 보상 정보
|
||||
*/
|
||||
private void processQrEventRewardReceipt(BOBnftMainVO vo, DataMap qrEventReward) {
|
||||
// 보상 영수증 데이터 설정
|
||||
vo.setBnfRwdCateDvCd((String) qrEventReward.get("bnfRwdCateDvCd"));
|
||||
vo.setBnfRwdGodsDvCd((String) qrEventReward.get("bnfRwdGodsDvCd"));
|
||||
|
||||
if (qrEventReward.get("mlgRwdAmt") != null) {
|
||||
vo.setMlgRwdAmt(((Number) qrEventReward.get("mlgRwdAmt")).doubleValue());
|
||||
}
|
||||
|
||||
if (qrEventReward.get("couponInnb") != null) {
|
||||
vo.setCouponInnb(((Number) qrEventReward.get("couponInnb")).longValue());
|
||||
}
|
||||
|
||||
// 보상 영수증 저장
|
||||
mapper.insertQrEventRewardReceipt(vo);
|
||||
|
||||
log.info("QR 이벤트 보상 영수증 처리 완료 - 참여번호: {}, 보상타입: {}",
|
||||
vo.getBnfPrtInnb(), vo.getBnfRwdGodsDvCd());
|
||||
}
|
||||
|
||||
/**
|
||||
* 디바이스 권한 조회
|
||||
*
|
||||
* @param vo 디바이스 권한 조회를 위한 VO
|
||||
* @return 디바이스 권한 정보
|
||||
*/
|
||||
public DataMap selectDevicePermission(BOBnftMainVO vo) {
|
||||
return mapper.selectDevicePermission(vo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftMain.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMainVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private String bnfInnb;
|
||||
/** 회원 고유번호 */
|
||||
private int mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/**쇼핑몰코드*/
|
||||
private String sopmalCd;
|
||||
/** 디바이스 아이디 */
|
||||
private String deviceId;
|
||||
/** 혜택 제목 */
|
||||
private String bnfSj;
|
||||
/** 사용 여부 */
|
||||
private String useAt;
|
||||
/** 화면 대표 이미지 */
|
||||
private String scrReprsntImg;
|
||||
/** 화면 대표 링크 URL */
|
||||
private String scrReprsntLinkUrl;
|
||||
/** 혜택 안내 */
|
||||
private String bnfWordsCn;
|
||||
/** 내용 제목 */
|
||||
private String cnSj;
|
||||
/** 내용 설명 */
|
||||
private String cnDc;
|
||||
/** 라이브 여부 (라이브쇼핑 참여일 경우만) */
|
||||
private String isLive;
|
||||
|
||||
// === QR 이벤트 관련 필드 추가 ===
|
||||
/** 매장 고유번호 */
|
||||
private String strInnb;
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 수령 고유번호 */
|
||||
private Long bnfRcvInnb;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 보상 상품 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
/** 마일리지 보상 금액 */
|
||||
private Double mlgRwdAmt;
|
||||
/** 쿠폰 고유 번호 */
|
||||
private Long couponInnb;
|
||||
/** 보상 항목명 */
|
||||
private String itmNm;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,264 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrBannerVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrCpslVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrGdccVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrIntrstVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrMenuVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrPrtRcvVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrPushEvtVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrPushVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrQuizVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrRecptLogVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrRewardVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrSttusVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo.BOBnftMngrVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 관리 BOBnftMngrMapper
|
||||
* @author 이훈영
|
||||
* @since 2024-06-18
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-06-18 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOBnftMngrMapper {
|
||||
|
||||
/** 혜택 목록 건수 */
|
||||
public Integer selectBOBnftListCnt(BOBnftMngrVO vo);
|
||||
/** 혜택 목록 */
|
||||
public List<DataMap> selectBOBnftListInqire(BOBnftMngrVO vo);
|
||||
|
||||
/** 혜택 알림메세지 목록 건수 */
|
||||
public Integer selectBOBnftPushListCnt(BOBnftMngrPushVO vo);
|
||||
/** 혜택 알림메세지 목록 */
|
||||
public List<DataMap> selectBOBnftPushListInqire(BOBnftMngrPushVO vo);
|
||||
|
||||
/** 혜택 종료일 경과건 미사용 처리 */
|
||||
public void updateBOBnftUseAt();
|
||||
|
||||
/** 혜택 정보 조회 */
|
||||
public DataMap selectBOBnftInfo(BOBnftMngrVO vo);
|
||||
/** 혜택 보상정보 조회 */
|
||||
public List<DataMap> selectBOBnftRwdList(BOBnftMngrVO vo);
|
||||
/** 혜택 보상정보 잔여수량 조회 */
|
||||
public List<DataMap> selectBOBnftRwdRemainQyList(BOBnftMngrVO vo);
|
||||
/** 혜택 관심분야정보 조회 */
|
||||
public List<DataMap> selectBOBnftIntrstList(BOBnftMngrVO vo);
|
||||
/** 혜택 안내문정보 조회 */
|
||||
public DataMap selectBOBnftGdccInfo(BOBnftMngrGdccVO vo);
|
||||
/** 혜택 OX퀴즈정보 조회 */
|
||||
public List<DataMap> selectBOBnftQuizList(BOBnftMngrVO vo);
|
||||
/** 혜택 초록잎설정 조회 */
|
||||
public List<DataMap> selectBOBnftCpslLeafList(BOBnftMngrCpslVO vo);
|
||||
/** 혜택 진행일시 중복건수 조회 */
|
||||
public Integer selectBOBnftDtOvlCnt(BOBnftMngrVO vo);
|
||||
|
||||
/** 혜택 배너목록 조회 */
|
||||
public List<DataMap> selectBOBnftBannerList(BOBnftMngrBannerVO vo);
|
||||
/** 혜택 메뉴목록 조회 */
|
||||
public List<DataMap> selectBOBnftMngMenuList(BOBnftMngrMenuVO vo);
|
||||
|
||||
/** 혜택 이벤트별 알림설정 조회 */
|
||||
public List<DataMap> selectBOBnftPushEvtList(BOBnftMngrPushEvtVO vo);
|
||||
/** 혜택 알림메세지 정보 조회 */
|
||||
public DataMap selectBOBnftPushInfo(BOBnftMngrPushVO vo);
|
||||
/** 알림메세지 혜택별 대상건수 조회 */
|
||||
public DataMap selectBOBnftPushTrgetCnt(BOBnftMngrPushVO vo);
|
||||
/** 알림메세지 테스트 발송대상 조회 */
|
||||
public List<DataMap> selectBOBnftPushTesterList(BOBnftMngrPushVO vo);
|
||||
/** 혜택 알림설정 정보 조회 */
|
||||
public DataMap selectBOBnftPushSetup(BOBnftMngrPushVO vo);
|
||||
|
||||
/** 혜택 정보 등록 */
|
||||
public void insertBOBnftInfo(BOBnftMngrVO vo);
|
||||
/** 혜택 정보 수정 */
|
||||
public void updateBOBnftInfo(BOBnftMngrVO vo);
|
||||
|
||||
/** 혜택 내용정보 등록 */
|
||||
public void insertBOBnftContent(BOBnftMngrVO vo);
|
||||
/** 혜택 내용정보 수정 */
|
||||
public void updateBOBnftContent(BOBnftMngrVO vo);
|
||||
|
||||
/** 혜택 보상정보 등록 */
|
||||
public void insertBOBnftReward(BOBnftMngrRewardVO vo);
|
||||
/** 혜택 보상정보 수정 */
|
||||
public void updateBOBnftReward(BOBnftMngrRewardVO vo);
|
||||
|
||||
/** 혜택 안내문정보 등록 */
|
||||
public void insertBOBnftGdcc(BOBnftMngrGdccVO vo);
|
||||
/** 혜택 안내문정보 수정 */
|
||||
public void updateBOBnftGdcc(BOBnftMngrGdccVO vo);
|
||||
|
||||
/** 혜택 관심분야정보 등록/수정 */
|
||||
public void insertBOBnftIntrst(BOBnftMngrIntrstVO vo);
|
||||
/** 혜택 관심분야정보 등록/수정 */
|
||||
public void updateBOBnftIntrst(BOBnftMngrIntrstVO vo);
|
||||
|
||||
/** 혜택 퀴즈정보 등록 */
|
||||
public void insertBOBnftQuiz(BOBnftMngrQuizVO vo);
|
||||
/** 혜택 퀴즈정보 수정 */
|
||||
public void updateBOBnftQuiz(BOBnftMngrQuizVO vo);
|
||||
|
||||
/** 혜택 초록잎설정 등록 */
|
||||
public void insupdBOBnftCpslLeaf(BOBnftMngrCpslVO vo);
|
||||
|
||||
/** 혜택 배너 등록 */
|
||||
public void insertBOBnftMngBanner(BOBnftMngrBannerVO vo);
|
||||
/** 혜택 배너 수정 */
|
||||
public void updateBOBnftMngBanner(BOBnftMngrBannerVO vo);
|
||||
/** 혜택 메뉴 등록/수정 */
|
||||
public void insupdBOBnftMngMenu(BOBnftMngrMenuVO vo);
|
||||
|
||||
/** 혜택 이벤트별 알림설정 등록 */
|
||||
public void insertBOBnftPushEvt(BOBnftMngrPushEvtVO vo);
|
||||
/** 혜택 이벤트별 알림설정 수정 */
|
||||
public void updateBOBnftPushEvt(BOBnftMngrPushEvtVO vo);
|
||||
|
||||
/** 혜택 알림메세지 등록 */
|
||||
public void insertBOBnftPushInfo(BOBnftMngrPushVO vo);
|
||||
/** 혜택 알림메세지 수정 */
|
||||
public void updateBOBnftPushInfo(BOBnftMngrPushVO vo);
|
||||
/** 혜택 알림메세지 삭제 */
|
||||
public void deleteBOBnftPushInfo(BOBnftMngrPushVO vo);
|
||||
/** 혜택 알림메세지 발송내역 등록 */
|
||||
public void insertBOBnftPushSndngDtls(BOBnftMngrPushVO vo);
|
||||
/** 혜택 알림메세지 발송내역 수정 */
|
||||
public void updateBOBnftPushSndngDtls(BOBnftMngrPushVO vo);
|
||||
|
||||
/** 혜택 알림설정 등록 */
|
||||
public void insertBOBnftPushSetup(BOBnftMngrPushVO vo);
|
||||
/** 혜택 알림설정 수정 */
|
||||
public void updateBOBnftPushSetup(BOBnftMngrPushVO vo);
|
||||
|
||||
/** 혜택 고유번호 조회 */
|
||||
public BOBnftMngrVO selectBOBnftInnb(BOBnftMngrVO vo);
|
||||
|
||||
/** 혜택 구매확정시 수신정보 등록 */
|
||||
public void insertBOBnftPurchsRcvLog(BOBnftMngrPrtRcvVO vo);
|
||||
|
||||
/** 혜택 보상 통합몰 연계로그 등록 */
|
||||
public void insertBOBnftRecptLog(BOBnftMngrRecptLogVO vo);
|
||||
|
||||
/** 혜택 기회충전설정 정보 조회 */
|
||||
public DataMap selectBOBnftChargeInqire(BOBnftMngrPrtRcvVO vo);
|
||||
/** 혜택 기회충전설정 등록 */
|
||||
public void insupdBOBnftChargeInfo(BOBnftMngrPrtRcvVO vo);
|
||||
|
||||
|
||||
/** 혜택 회원별내역 목록 건수 - 출석, 만보기 */
|
||||
public Integer selectBOBnftMbrSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 회원별내역 목록 - 출석, 만보기 */
|
||||
public List<DataMap> selectBOBnftMbrSttusList(BOBnftMngrSttusVO vo);
|
||||
|
||||
/** 혜택 출석 기간별내역 현재월 요약 */
|
||||
public DataMap selectBOBnftAttedPdSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 출석 기간별내역 지난월 요약 */
|
||||
public DataMap selectBOBnftAttedPdPrevMonSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 출석 기간별내역 월별내역 목록 */
|
||||
public List<DataMap> selectBOBnftAttedPdSttusList(BOBnftMngrSttusVO vo);
|
||||
|
||||
/** 혜택 만보기 기간별내역 현재월 요약 */
|
||||
public DataMap selectBOBnftStepcntPdSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 만보기 기간별내역 지난월 요약 */
|
||||
public DataMap selectBOBnftStepcntPdPrevMonSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 만보기 기간별내역 월별내역 목록 */
|
||||
public List<DataMap> selectBOBnftStepcntPdSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 행운복권 당첨내역 요약 */
|
||||
public DataMap selectBOBnftLucklottSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 룰렛게임 당첨내역 요약 */
|
||||
public DataMap selectBOBnftRougameSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 당첨내역 목록 건수 - 행운복권, 룰렛게임 */
|
||||
public Integer selectBOBnftPrzwinSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 당첨내역 목록 - 행운복권, 룰렛게임 */
|
||||
public List<DataMap> selectBOBnftPrzwinSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 캡슐만들기 참여현황 요약 */
|
||||
public DataMap selectBOBnftCpslmknSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 캡슐만들기 참여현황 목록 건수 */
|
||||
public Integer selectBOBnftCpslmknSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 캡슐만들기 참여현황 목록 */
|
||||
public List<DataMap> selectBOBnftCpslmknSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 캡슐만들기 참여현황 상세 조회 */
|
||||
public DataMap selectBOBnftCpslmknSttusDtls(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 이벤트보기 참여현황 건수/마일리지합계 조회 */
|
||||
public DataMap selectBOBnftEvntviewSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 이벤트보기 참여현황 목록 건수 */
|
||||
public Integer selectBOBnftEvntviewSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 이벤트보기 참여현황 목록 */
|
||||
public List<DataMap> selectBOBnftEvntviewSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 라이브쇼핑 참여현황 목록 건수 */
|
||||
public Integer selectBOBnftLvshopSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 라이브쇼핑 참여현황 목록 */
|
||||
public List<DataMap> selectBOBnftLvshopSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 베스트리뷰 참여현황 건수/마일리지합계 조회 */
|
||||
public DataMap selectBOBnftConrevSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 베스트리뷰 참여현황 목록 건수 */
|
||||
public Integer selectBOBnftConrevSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 베스트리뷰 참여현황 목록 */
|
||||
public List<DataMap> selectBOBnftConrevSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 섭취챌린지 참여현황 목록 건수 */
|
||||
public Integer selectBOBnftIntakchlSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 섭취챌린지 참여현황 목록 */
|
||||
public List<DataMap> selectBOBnftIntakchlSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 섭취챌린지 참여현황 상세 조회 */
|
||||
public DataMap selectBOBnftIntakchlSttusDtlsData(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 섭취챌린지 참여현황 상세 대상제품 목록 */
|
||||
public List<DataMap> selectBOBnftIntakchlSttusDtlsGoodsList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 OX퀴즈 참여현황 목록 건수 */
|
||||
public Integer selectBOBnftOxquizSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 OX퀴즈 참여현황 목록 */
|
||||
public List<DataMap> selectBOBnftOxquizSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 OX퀴즈 참여현황 상세 조회 */
|
||||
public DataMap selectBOBnftOxquizSttusDtlsData(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 OX퀴즈 참여현황 문항별 목록 */
|
||||
public List<DataMap> selectBOBnftOxquizSttusDtlsQuizList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 관심분야 요약 */
|
||||
public DataMap selectBOBnftHlthsetSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 관심분야 월별내역 목록 */
|
||||
public List<DataMap> selectBOBnftHlthsetMonSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 관심분야 설정현황 목록 */
|
||||
public List<DataMap> selectBOBnftHlthsetSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 모바일스탬프 스탬프 요약 */
|
||||
public DataMap selectBOBnftStmpSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 모바일스탬프 적립카드 요약 */
|
||||
public DataMap selectBOBnftStmpExtkSttusSumry(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 모바일스탬프 월별 내역 목록 */
|
||||
public List<DataMap> selectBOBnftStmpPdSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 모바일스탬프 일별 내역 목록 */
|
||||
public List<DataMap> selectBOBnftStmpPdSttusDtlsList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 모바일스탬프 매장 조회 */
|
||||
public List<DataMap> selectBOBnftStmpStoreList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 모바일스탬프 매장별 내역 목록 */
|
||||
public List<DataMap> selectBOBnftStmpStrSumryList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 QR코드이벤트 참여현황 목록 건수 */
|
||||
public Integer selectBOBnftQrevntSttusListCnt(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 QR코드이벤트 참여현황 목록 */
|
||||
public List<DataMap> selectBOBnftQrevntSttusList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 QR코드이벤트 참여현황 상세 조회 */
|
||||
public DataMap selectBOBnftQrevntSttusDtlsData(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 QR코드이벤트 매장 조회 */
|
||||
public List<DataMap> selectBOBnftQrevntStoreList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 QR코드이벤트 날짜별 내역 목록 */
|
||||
public List<DataMap> selectBOBnftQrevntSttusDtlsDayList(BOBnftMngrSttusVO vo);
|
||||
/** 혜택 QR코드이벤트 매장별 내역 목록 */
|
||||
public List<DataMap> selectBOBnftQrevntSttusDtlsStrList(BOBnftMngrSttusVO vo);
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,69 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 배너 관리 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-09-08
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-09-08 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrBannerVO extends AbstractVO {
|
||||
|
||||
/** 혜택 배너 고유번호 */
|
||||
private Long bnfBannerInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 배너 제목 */
|
||||
private String bannerSj;
|
||||
/** 링크 */
|
||||
private String linkUrl;
|
||||
/** 이미지파일경로 */
|
||||
private String imgFilCours;
|
||||
/** 이미지파일명 */
|
||||
private String imgFilNm;
|
||||
/** 정렬순서 */
|
||||
private Integer sortOrdr;
|
||||
/** 사용여부 */
|
||||
private String useAt;
|
||||
/** 삭제여부 */
|
||||
private String delAt;
|
||||
/** 항목Index */
|
||||
private Integer divIdx;
|
||||
|
||||
/** 이미지 파일 업로드 */
|
||||
private List<HashMap<String, Object>> fileInfo;
|
||||
|
||||
/** 배너항목 배열선언 */
|
||||
private Long[] arrBnfBannerInnb;
|
||||
private String[] arrBannerSj;
|
||||
private String[] arrLinkUrl;
|
||||
private String[] arrImgFilCours;
|
||||
private String[] arrImgFilNm;
|
||||
private Integer[] arrSortOrdr;
|
||||
private String[] arrUseAt;
|
||||
private String[] arrDelAt;
|
||||
private Integer[] arrDivIdx;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 초록잎설정 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-09-03
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-09-03 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrCpslVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 구분코드 */
|
||||
private String bnfDvCd;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 화면표시여부 */
|
||||
private String indictAt;
|
||||
/** 스페셜 여부 */
|
||||
private String specialAt;
|
||||
/** 지급 개수 */
|
||||
private Integer pymntCnt;
|
||||
/** 스페셜 개수 */
|
||||
private Integer specialCnt;
|
||||
|
||||
/** 배열선언 */
|
||||
private String[] arrBnfDvCd;
|
||||
private String[] arrIndictAt;
|
||||
private String[] arrSpecialAt;
|
||||
private Integer[] arrPymntCnt;
|
||||
private Integer[] arrSpecialCnt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 안내문 정보 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-09-04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-09-04 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrGdccVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 안내문 고유번호 */
|
||||
private Long bnfGdccInnb;
|
||||
/** 혜택 구분코드 */
|
||||
private String bnfDvCd;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
|
||||
/** 안내문1 */
|
||||
private String wordsCn1;
|
||||
/** 안내문2 */
|
||||
private String wordsCn2;
|
||||
/** 안내문3 */
|
||||
private String wordsCn3;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 관심분야 관리 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-07-28
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-07-28 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrIntrstVO extends AbstractVO {
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
|
||||
/** 혜택 관심분야 고유번호 */
|
||||
private Long bnfIntrstInnb;
|
||||
/** 관심분야명 */
|
||||
private String intrstNm;
|
||||
/** 관심분야 선택전 이미지파일경로 */
|
||||
private String bfeImgFilCours;
|
||||
/** 관심분야 선택전 이미지파일명 */
|
||||
private String bfeImgFilNm;
|
||||
/** 관심분야 선택후 이미지파일경로 */
|
||||
private String aftImgFilCours;
|
||||
/** 관심분야 선택후 이미지파일명 */
|
||||
private String aftImgFilNm;
|
||||
/** 관심분야 정렬순서 */
|
||||
private Integer sortOrdr;
|
||||
/** 관심분야 사용여부 */
|
||||
private String useAt;
|
||||
/** 관심분야 삭제여부 */
|
||||
private String delAt;
|
||||
/** 관심분야 항목Index */
|
||||
private Integer divIdx;
|
||||
|
||||
/** 관심분야항목 배열선언 */
|
||||
private Long[] arrBnfIntrstInnb;
|
||||
private String[] arrIntrstNm;
|
||||
private String[] arrBfeImgFilCours;
|
||||
private String[] arrBfeImgFilNm;
|
||||
private Integer[] arrSortOrdr;
|
||||
private String[] arrUseAt;
|
||||
private String[] arrDelAt;
|
||||
private Integer[] arrDivIdx;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 메뉴 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-09-08
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-09-08 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrMenuVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 구분코드 */
|
||||
private String bnfDvCd;
|
||||
/** 혜택 구분명 */
|
||||
private String bnfDvNm;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 화면표시여부 */
|
||||
private String indictAt;
|
||||
/** 메뉴 제목 1 */
|
||||
private String menuSj1;
|
||||
/** 메뉴 제목 2 */
|
||||
private String menuSj2;
|
||||
/** 정렬순서 */
|
||||
private Integer sortOrdr;
|
||||
|
||||
/** 배열선언 */
|
||||
private String[] arrBnfDvCd;
|
||||
private String[] arrIndictAt;
|
||||
private String[] arrMenuSj1;
|
||||
private String[] arrMenuSj2;
|
||||
private Integer[] arrSortOrdr;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 참여/보상 관리 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-07-28
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-07-28 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrPrtRcvVO extends AbstractVO {
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 혜택 구분 코드명 */
|
||||
private String bnfDvCdNm;
|
||||
|
||||
/// 혜택 참여 정보
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 참여일시 */
|
||||
private String bnfPrtDt;
|
||||
/** 회원고유번호 */
|
||||
private Long mbrInnb;
|
||||
/** 회원구분코드 */
|
||||
private String mbrDvCd;
|
||||
/** 회원구분코드명 */
|
||||
private String mbrDvCdNm;
|
||||
/** 회원ID */
|
||||
private Long mbrId;
|
||||
/** 회원명 */
|
||||
private Long mbrNm;
|
||||
/** 회원 휴대폰번호 */
|
||||
private Long mbrCellNo;
|
||||
|
||||
/// 혜택 보상수령 내역
|
||||
/** 혜택 보상수령 고유번호 */
|
||||
private Long bnfRcvInnb;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 보상 항목 구분 코드명 */
|
||||
private String bnfRwdCateDvCdNm;
|
||||
/** 보상 상품 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
/** 보상 상품 구분 코드명 */
|
||||
private String bnfRwdGodsDvCdNm;
|
||||
/** 보상 마일리지 금액 */
|
||||
private Double mlgRwdAmt;
|
||||
/** 보상 쿠폰고유번호 */
|
||||
private Long couponInnb;
|
||||
/** 보상 쿠폰명 */
|
||||
private Long couponName;
|
||||
|
||||
/** 혜택 구매확정 수신 로그 고유번호 */
|
||||
private Long bnfPurchsRcvLogInnb;
|
||||
|
||||
// 참여기회 충전내역
|
||||
/** 혜택 참여기회 충전 고유번호 */
|
||||
private Long bnfChgInnb;
|
||||
/** 구매식별 고유번호 */
|
||||
private Long purchsInnb;
|
||||
/** 구매금액 */
|
||||
private Double purchsAmt;
|
||||
/** 충전수 */
|
||||
private int chgCnt;
|
||||
|
||||
/** 충전필요금액 */
|
||||
private Double amtForChg;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 알림관리 이벤트별알림 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-09-19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-09-19 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrPushEvtVO extends AbstractVO {
|
||||
|
||||
/** 혜택 알림 이벤트별 설정 고유번호 */
|
||||
private Long bnfPushEvtSetupInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 알림 조건 구분 코드 */
|
||||
private String bnfPushCndDvCd;
|
||||
/** 알림 조건 구분 명 */
|
||||
private String bnfPushCndDvNm;
|
||||
/** 알림 제목 */
|
||||
private String pushSj;
|
||||
/** 알림 내용 */
|
||||
private String pushCn;
|
||||
/** 알림 시간 */
|
||||
private String pushTme;
|
||||
/** 알림 주기 구분 */
|
||||
private String pushCycleDv;
|
||||
/** 알림 제한 횟수 */
|
||||
private Integer pushLmttCnt;
|
||||
/** 사용여부 */
|
||||
private String useAt;
|
||||
|
||||
/** 항목 배열선언 */
|
||||
private Long[] arrBnfPushEvtSetupInnb;
|
||||
private String[] arrBnfPushCndDvCd;
|
||||
private String[] arrBnfPushCndDvNm;
|
||||
private String[] arrPushSj;
|
||||
private String[] arrPushCn;
|
||||
private String[] arrPushTme;
|
||||
private String[] arrPushCycleDv;
|
||||
private Integer[] arrPushLmttCnt;
|
||||
private String[] arrUseAt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 알림관리 알림메세지 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-09-23
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-09-23 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrPushVO extends AbstractVO {
|
||||
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
|
||||
// 알림 내용 항목
|
||||
/** 혜택 알림 정보 고유번호 */
|
||||
private Long bnfPushInfoInnb;
|
||||
/** 알림 대상 구분 코드 */
|
||||
private String bnfPushTrgetDvCd;
|
||||
/** 알림 대상 구분 명 */
|
||||
private String bnfPushTrgetDvNm;
|
||||
/** 알림 대상 구분 */
|
||||
private String trgetDv;
|
||||
/** 알림 대상 전체수 */
|
||||
private Integer trgetAllCnt;
|
||||
/** 알림 제목 */
|
||||
private String pushSj;
|
||||
/** 알림 내용 */
|
||||
private String pushCn;
|
||||
/** 알림 내용 - 개행처리 */
|
||||
private String pushCnRpl;
|
||||
/** 알림 발송 일시 */
|
||||
private String pushSendDt;
|
||||
/** 알림 발송 일자 */
|
||||
private String pushSendDe;
|
||||
/** 알림 발송 시간 */
|
||||
private String pushSendTme;
|
||||
/** 이미지파일경로 */
|
||||
private String imgFilCours;
|
||||
/** 이미지파일명 */
|
||||
private String imgFilNm;
|
||||
/** 예약 여부 */
|
||||
private String resveAt;
|
||||
/** 예약 상태 */
|
||||
private String resveSttus;
|
||||
/** 삭제 여부 */
|
||||
private String delAt;
|
||||
|
||||
/** 알림 유형 */
|
||||
private String pushType;
|
||||
/** callback 데이터 */
|
||||
private String pushData;
|
||||
/** callback 데이터 - url */
|
||||
private String dataUrl;
|
||||
/** callback 데이터 - key */
|
||||
private String dataKey;
|
||||
/** callback 데이터 - ext */
|
||||
private String dataExt;
|
||||
|
||||
// 알림 발송 항목
|
||||
/** 혜택 알림 발송내역 고유번호 */
|
||||
private Long bnfPushSndngDtlsInnb;
|
||||
/** 혜택 알림 이벤트별 설정 고유번호 */
|
||||
private Long bnfPushEvtSetupInnb;
|
||||
/** 발송 여부 */
|
||||
private String sndngAt;
|
||||
/** 발송 상태 */
|
||||
private String sndngSttus;
|
||||
/** 발송 대상수 */
|
||||
private Integer sndngTrgetCnt;
|
||||
/** 발송 성공수 */
|
||||
private Integer sndngSuccesCnt;
|
||||
/** 발송 실패수 */
|
||||
private Integer sndngFailrCnt;
|
||||
|
||||
// 알림 설정
|
||||
/** 테스트 대상 회원ID 문자열 */
|
||||
private String trgetMbrIds;
|
||||
/** 발송제한 시작 시간1 */
|
||||
private String lmttBgnTme1;
|
||||
/** 발송제한 종료 시간1 */
|
||||
private String lmttEndTme1;
|
||||
/** 발송제한 시작 시간2 */
|
||||
private String lmttBgnTme2;
|
||||
/** 발송제한 종료 시간2 */
|
||||
private String lmttEndTme2;
|
||||
|
||||
// 대상 회원 항목
|
||||
/** 회원 디바이스 고유번호 */
|
||||
private Long mbrDeviceInnb;
|
||||
/** 회원 디바이스 고유번호 배열 */
|
||||
private Long[] arrMbrDeviceInnb;
|
||||
/** 회원고유번호 */
|
||||
private Long mbrInnb;
|
||||
/** 회원구분코드 */
|
||||
private String mbrDvCd;
|
||||
/** 회원ID */
|
||||
private String mbrId;
|
||||
/** 회원명 */
|
||||
private String mbrNm;
|
||||
/** FCM 토큰 */
|
||||
private String fcmToken;
|
||||
/** FCM 토큰 배열 */
|
||||
private String[] arrFcmToken;
|
||||
/** 알림 동의 여부 */
|
||||
private String pushAgreAt;
|
||||
/** 디바이스 고유ID */
|
||||
private String deviceId;
|
||||
/** 운영체제 이름 */
|
||||
private String deviceOsNm;
|
||||
/** 운영체제 버전 */
|
||||
private String deviceOsVer;
|
||||
/** 앱 버전 */
|
||||
private String deviceAppVer;
|
||||
|
||||
// 혜택별 동의 항목
|
||||
/** 혜택 동의 고유번호 */
|
||||
private Long bnfAgreInnb;
|
||||
/** 혜택 구분코드 */
|
||||
private String bnfDvCd;
|
||||
/** 혜택 동의 구분코드 */
|
||||
private String bnfAgreDvCd;
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 동의여부 */
|
||||
private String agreAt;
|
||||
|
||||
/** 이미지 파일 업로드 */
|
||||
private List<HashMap<String, Object>> fileInfo;
|
||||
/** CDN URL */
|
||||
private String imgCdnurl;
|
||||
|
||||
// 검색 조건
|
||||
/** 검색구분 */
|
||||
private String srchDv;
|
||||
/** 검색_검색어 */
|
||||
private String srchKeyword;
|
||||
/** 검색_날짜_구분 */
|
||||
private String srchPdDv;
|
||||
/** 검색_상태_구분 */
|
||||
private String srchSttDv;
|
||||
/** 검색_사용여부_구분 */
|
||||
private String srchUseAt;
|
||||
/** 검색_시작일 */
|
||||
private String srchStartDt;
|
||||
/** 검색_종료일 */
|
||||
private String srchEndDt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 퀴즈 관리 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-07-28
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-07-28 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrQuizVO extends AbstractVO {
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
|
||||
/** 혜택 퀴즈 고유번호 */
|
||||
private Long bnfQuizInnb;
|
||||
/** 퀴즈 내용 */
|
||||
private String quizCn;
|
||||
/** 퀴즈 정답 */
|
||||
private String quizCnsr;
|
||||
/** 힌트보기 링크 */
|
||||
private String hintUrl;
|
||||
/** 퀴즈 삭제여부 */
|
||||
private String delAt;
|
||||
|
||||
/** 관심분항목 배열선언 */
|
||||
private Long[] arrBnfQuizInnb;
|
||||
private String[] arrQuizCn;
|
||||
private String[] arrQuizCnsr;
|
||||
private String[] arrHintUrl;
|
||||
private String[] arrDelAt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 관리 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-06-18
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-06-18 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrRecptLogVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 회원 고유번호 */
|
||||
private Long mbrInnb;
|
||||
/** 회원구분코드 */
|
||||
private String mbrDvCd;
|
||||
|
||||
/** 혜택 보상수령 고유번호 */
|
||||
private String bnfRcvInnb;
|
||||
/** 혜택 보상수령 내용 */
|
||||
private String bnfRcvCn;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 보상 상품 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
|
||||
/** 마일리지구분 : 01 지급, 02 차감*/
|
||||
private String mlgDvCd;
|
||||
/** 마일리지적립구분 : add 적립, dn 차감, exp 소멸, up 지급, use 사용*/
|
||||
private String mlgAccmlDvCd;
|
||||
/** 마일리지적용구분 : 01 상품구매,02 상품구매 취소,03 일반리뷰,04 한달리뷰,05 포토리뷰,06 리뷰삭제,07 이벤트,08 기간만료,09 주문환불,10 결제취소 */
|
||||
private String mlgApplcDvCd;
|
||||
/** 마일리지적용사유 */
|
||||
private String mlgApplcResn;
|
||||
/** 적립금액 */
|
||||
private BigDecimal accmlmnyAmt;
|
||||
/** 마일리지 유효개월수 */
|
||||
private Integer mlgValidPd;
|
||||
|
||||
/** 쿠폰 고유번호 */
|
||||
private Integer couponInnb;
|
||||
/** 쿠폰 발송 고유번호 */
|
||||
private Integer couponSndngInnb;
|
||||
/** 쿠폰 발송 유형코드 : 01 직접발급,02 다운로드,03 인증번호 */
|
||||
private String couponSndngTyCd;
|
||||
|
||||
/** 구매식별 고유번호 */
|
||||
private Long purchsInnb;
|
||||
/** 구매금액 */
|
||||
private Double purchsAmt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 보상 관리 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-06-18
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-06-18 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrRewardVO extends AbstractVO {
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 보상 항목 구분 코드명 */
|
||||
private String bnfRwdCateDvCdNm;
|
||||
/** 보상 상품 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
/** 보상 상품 구분 코드명 */
|
||||
private String bnfRwdGodsDvCdNm;
|
||||
/** 보상 마일리지 금액 */
|
||||
private Double mlgRwdAmt;
|
||||
/** 보상 쿠폰고유번호 */
|
||||
private Long couponInnb;
|
||||
/** 보상 쿠폰명 */
|
||||
private Long couponName;
|
||||
/** 보상 표시명 */
|
||||
private String itmNm;
|
||||
/** 보상 당첨수량 */
|
||||
private int przwinQy;
|
||||
/** 보상 당첨확률 */
|
||||
private Float przwinPrc;
|
||||
/** 보상 조건횟수 */
|
||||
private Integer rwdCndCnt;
|
||||
|
||||
/** 보상항목 배열선언 */
|
||||
private String[] arrBnfRwdCateDvCd;
|
||||
private String[] arrBnfRwdGodsDvCd;
|
||||
private Double[] arrMlgRwdAmt;
|
||||
private Long[] arrCouponInnb;
|
||||
private String[] arrItmNm;
|
||||
private int[] arrPrzwinQy;
|
||||
private Float[] arrPrzwinPrc;
|
||||
private Integer[] arrRwdCndCnt;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 현황내역 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-10-16
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-10-16 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrSttusVO extends AbstractVO {
|
||||
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 혜택구분코드 */
|
||||
private String bnfDvCd;
|
||||
/** 혜택고유번호 */
|
||||
private String bnfInnb;
|
||||
/** 혜택 관심분야 고유번호 */
|
||||
private String bnfIntrstInnb;
|
||||
|
||||
// 회원별 내역
|
||||
/** 회원 고유번호 */
|
||||
private String mbrInnb;
|
||||
/** 회원구분코드 */
|
||||
private String mbrDvCd;
|
||||
/** 회원ID */
|
||||
private String mbrId;
|
||||
/** 회원명 */
|
||||
private String mbrNm;
|
||||
/** 최종참여일시 */
|
||||
private String lastPrtDt;
|
||||
/** 참여횟수 */
|
||||
private Integer prtCnt;
|
||||
/** 보상횟수1 */
|
||||
private Integer rwdCnt1;
|
||||
/** 보상횟수2 */
|
||||
private Integer rwdCnt2;
|
||||
/** 참여보상 마일리지 합계 */
|
||||
private Double sumMlgAmt;
|
||||
|
||||
|
||||
// 검색 조건
|
||||
/** 검색구분 */
|
||||
private String srchDv;
|
||||
/** 검색_검색어 */
|
||||
private String srchKeyword;
|
||||
/** 검색_부분 */
|
||||
private String srchPart;
|
||||
/** 검색_숫자 */
|
||||
private Integer srchNum;
|
||||
/** 검색_숫자범위 */
|
||||
private String srchNumRng;
|
||||
/** 검색_년 */
|
||||
private String srchYear;
|
||||
/** 검색_월 */
|
||||
private String srchMonth;
|
||||
/** 검색_시작년 */
|
||||
private String srchSttYear;
|
||||
/** 검색_시작월 */
|
||||
private String srchSttMonth;
|
||||
/** 검색_종료년 */
|
||||
private String srchEndYear;
|
||||
/** 검색_종료월 */
|
||||
private String srchEndMonth;
|
||||
/** 검색_시작일 */
|
||||
private String srchStartDt;
|
||||
/** 검색_종료일 */
|
||||
private String srchEndDt;
|
||||
/** 검색_일시 */
|
||||
private String srchCurrDt;
|
||||
/** 검색_보상구분코드 */
|
||||
private String[] srchRwdCateDv;
|
||||
/** 검색_상태_구분 */
|
||||
private String srchSttDv;
|
||||
/** 검색_매장 */
|
||||
private String srchStrInnb;
|
||||
/** 검색_정렬 */
|
||||
private String srchOrder;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.bnftmngr.vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* 혜택 관리 VO
|
||||
* @author 이훈영
|
||||
* @since 2024-06-18
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-06-18 이훈영 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBnftMngrVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/// 혜택 기본 정보
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 혜택 구분 코드명 */
|
||||
private String bnfDvCdNm;
|
||||
/** 혜택 제목 */
|
||||
private String bnfSj;
|
||||
/** 사용여부 */
|
||||
//private String useAt;
|
||||
/** 진행기간 시작일시 */
|
||||
private String bnfBgnDt;
|
||||
/** 진행기간 종료일시 */
|
||||
private String bnfEndDt;
|
||||
/** 진행기간 시작일자 */
|
||||
private String bnfBgnDe;
|
||||
/** 진행기간 종료일자 */
|
||||
private String bnfEndDe;
|
||||
/** 진행기간 시작시간 */
|
||||
private String bnfBgnTme;
|
||||
/** 진행기간 종료시간 */
|
||||
private String bnfEndTme;
|
||||
/** 충전필요금액 */
|
||||
private Double amtForChg;
|
||||
/** 화면 대표 이미지 */
|
||||
private String scrReprsntImg;
|
||||
/** 화면 대표 이미지명 */
|
||||
private String scrReprsntImgNm;
|
||||
/** 화면 대표 링크 URL */
|
||||
private String scrReprsntLinkUrl;
|
||||
/** 화면 보상 이미지 */
|
||||
private String scrRwdImg;
|
||||
/** 화면 보상 이미지명 */
|
||||
private String scrRwdImgNm;
|
||||
/** 화면 보상 링크 URL */
|
||||
private String scrRwdLinkUrl;
|
||||
/** 혜택 안내 */
|
||||
private String bnfWordsCn;
|
||||
|
||||
///혜택 내용설정 정보
|
||||
/** 내용 제목 */
|
||||
private String cnSj;
|
||||
/** 내용 설명 */
|
||||
private String cnDc;
|
||||
/** 링크 */
|
||||
private String linkUrl;
|
||||
/** 이미지파일경로 */
|
||||
private String imgFilCours;
|
||||
/** 이미지파일명 */
|
||||
private String imgFilNm;
|
||||
/** 시작일시 */
|
||||
private String cnBgnDt;
|
||||
/** 종료일시 */
|
||||
private String cnEndDt;
|
||||
/** 시작일자 */
|
||||
private String cnBgnDe;
|
||||
/** 종료일자 */
|
||||
private String cnEndDe;
|
||||
/** 시작시간 */
|
||||
private String cnBgnTme;
|
||||
/** 종료시간 */
|
||||
private String cnEndTme;
|
||||
/** 유효일시 */
|
||||
private String validDt;
|
||||
/** 시간(초) */
|
||||
private int tmeSecnd;
|
||||
/** 안내내용 */
|
||||
private String wordsCn;
|
||||
/** 회원명 */
|
||||
private String mbrNm;
|
||||
/** 할인구분코드 */
|
||||
private String dscntUnitDvCd;
|
||||
/** 할인구분코드명 */
|
||||
private String dscntUnitDvCdNm;
|
||||
/** 할인금액 */
|
||||
private Float dscntAmt;
|
||||
/** 할인율 */
|
||||
private Double dscntRt;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long befBnfInnb;
|
||||
|
||||
/** 이미지 파일 업로드 */
|
||||
private List<HashMap<String, Object>> fileInfo;
|
||||
private List<HashMap<String, Object>> fileInfo2;
|
||||
|
||||
/// 혜택 동의 내역 -- 필요??
|
||||
/** 혜택 동의 고유번호 */
|
||||
private Long bnfAgreInnb;
|
||||
/** 혜택 동의 구분코드 */
|
||||
private String bnfAgreDvCd;
|
||||
/** 혜택 동의 구분코드명 */
|
||||
private String bnfAgreDvCdNm;
|
||||
/** 동의여부 */
|
||||
private String agreAt;
|
||||
|
||||
// 검색 조건
|
||||
/** 검색구분 */
|
||||
private String srchDv;
|
||||
/** 검색_검색어 */
|
||||
private String srchKeyword;
|
||||
/** 검색_날짜_구분 */
|
||||
private String srchPdDv;
|
||||
/** 검색_상태_구분 */
|
||||
private String srchSttDv;
|
||||
/** 검색_사용여부_구분 */
|
||||
private String srchUseAt;
|
||||
/** 검색_시작일 */
|
||||
private String srchStartDt;
|
||||
/** 검색_종료일 */
|
||||
private String srchEndDt;
|
||||
|
||||
/// 혜택 보상 VO
|
||||
private BOBnftMngrRewardVO rwdVO;
|
||||
|
||||
/// 혜택 관심분야 VO
|
||||
private BOBnftMngrIntrstVO intrstVO;
|
||||
|
||||
/// 혜택 퀴즈 VO
|
||||
private BOBnftMngrQuizVO quizVO;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.common.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.service.BOMlgService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.service.BOOrdrService;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrdrVO;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.service.BOCouponService;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.vo.BODwldCouponVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 혜택 보상(리워드) 관련 공통 서비스
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BenefitRewardService {
|
||||
|
||||
private final BOMlgService boMlgService;
|
||||
private final BOCouponService boCouponService;
|
||||
private final BOOrdrService boOrdrService;
|
||||
|
||||
/**
|
||||
* 공통 마일리지 지급 처리
|
||||
* @param mlgVo 마일리지 정보 VO
|
||||
* @return 처리 성공 여부
|
||||
*/
|
||||
public boolean issueMileage(BOMlgVO mlgVo) {
|
||||
try {
|
||||
boMlgService.insertBOMlgAdd(mlgVo);
|
||||
log.info("마일리지 지급 성공. 회원 고유번호: {}, 적용 사유: {}, 적립 금액: {}", mlgVo.getMbrInnb(), mlgVo.getMlgApplcResn(), mlgVo.getAccmlmnyAmt());
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("마일리지 지급 처리 중 오류 발생. mlgVo: {}", mlgVo.toString(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 쿠폰 지급 처리
|
||||
* @param couponVo 쿠폰 정보 VO
|
||||
* @return 처리 성공 여부
|
||||
*/
|
||||
public boolean issueCoupon(BODwldCouponVO couponVo) {
|
||||
try {
|
||||
boCouponService.insertBOBnfCouponRegist(couponVo);
|
||||
log.info("쿠폰 지급 성공. 회원 고유번호: {}, 쿠폰 발송 고유번호: {}", couponVo.getMbrInnb(), couponVo.getCouponSndngInnb());
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("쿠폰 지급 처리 중 오류 발생. couponVo: {}", couponVo.toString(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 구매확정 금액 조회 (기간 지정)
|
||||
* @param sopmalCd 쇼핑몰 코드
|
||||
* @param mbrInnb 회원 고유번호
|
||||
* @param mbrDvCd 회원 구분코드
|
||||
* @param srchBgnDt 조회 시작일시 (YYYY-MM-DD 형식)
|
||||
* @param srchEndDt 조회 종료일시 (YYYY-MM-DD 형식, 빈 문자열이면 오늘까지)
|
||||
* @return 구매확정 금액
|
||||
*/
|
||||
public Double getPurchaseConfirmedAmount(String sopmalCd, Integer mbrInnb, String mbrDvCd, String srchBgnDt, String srchEndDt) {
|
||||
try {
|
||||
BOOrdrVO ordrVO = new BOOrdrVO();
|
||||
ordrVO.setSopmalCd(sopmalCd);
|
||||
ordrVO.setMbrInnb(mbrInnb);
|
||||
ordrVO.setMbrDvCd(mbrDvCd);
|
||||
ordrVO.setSrchBgnDt(srchBgnDt);
|
||||
ordrVO.setSrchEndDt(srchEndDt);
|
||||
|
||||
DataMap response = boOrdrService.selectBOOrdrConfAmtTot(ordrVO);
|
||||
|
||||
log.debug("구매확정 금액 조회 응답 (기간: {} ~ {}): {}", srchBgnDt, srchEndDt, response);
|
||||
|
||||
Double purchaseAmount = 0.0;
|
||||
|
||||
if (response != null && response.get("totAmt") != null) {
|
||||
purchaseAmount = Double.parseDouble(response.get("totAmt").toString());
|
||||
}
|
||||
|
||||
log.debug("사용자 구매확정 금액 (기간: {} ~ {}): {}", srchBgnDt, srchEndDt, purchaseAmount);
|
||||
|
||||
return purchaseAmount;
|
||||
} catch (Exception e) {
|
||||
log.error("구매확정 금액 조회 중 오류 발생. sopmalCd: {}, mbrInnb: {}, mbrDvCd: {}, srchBgnDt: {}, srchEndDt: {}",
|
||||
sopmalCd, mbrInnb, mbrDvCd, srchBgnDt, srchEndDt, e);
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 구매확정 금액 조회 (기존 메서드 - 하위 호환성 유지)
|
||||
* @param sopmalCd 쇼핑몰 코드
|
||||
* @param mbrInnb 회원 고유번호
|
||||
* @param mbrDvCd 회원 구분코드
|
||||
* @return 구매확정 금액
|
||||
*/
|
||||
public Double getPurchaseConfirmedAmount(String sopmalCd, Integer mbrInnb, String mbrDvCd) {
|
||||
return getPurchaseConfirmedAmount(sopmalCd, mbrInnb, mbrDvCd, "", "");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.conrev.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.conrev.service.BOConrevService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.conrev.vo.BOConrevVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft/")
|
||||
@RequiredArgsConstructor
|
||||
public class BOConrevController {
|
||||
|
||||
private final BOConrevService service;
|
||||
|
||||
/**
|
||||
* 베스트 리뷰 목록 조회
|
||||
*
|
||||
* @param vo 베스트 리뷰 목록 조회 조건을 담고 있는 VO
|
||||
* @return 베스트 리뷰 목록을 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBestReviewList", method = RequestMethod.POST)
|
||||
public ResponseEntity<Map<String, Object>> selectBestReviewList(@RequestBody BOConrevVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectBestReviewList BOConrevVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("result", service.selectBestReviewList(vo));
|
||||
content.put("guidance", service.getBestReviewGuidance(vo));
|
||||
|
||||
log.debug("selectBestReviewList content chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 리뷰상세 조회
|
||||
* @param vo 리뷰상세 조회 조건을 담고 있는 VO
|
||||
* @return 리뷰상세 정보를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectReviewDetail", method = RequestMethod.POST)
|
||||
public ResponseEntity<Map<String, Object>> selectReviewDetail(@RequestBody BOConrevVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectReviewDetail BOConrevVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.selectReviewDetail(vo);
|
||||
|
||||
log.debug("selectReviewDetail reviewDetail chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(Map.of("reviewDetail", content)).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 마일리지 적립
|
||||
*
|
||||
* @param vo 마일리지 적립 정보를 담고 있는 VO
|
||||
* @return 마일리지 적립 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/awardConrevMileage", method = RequestMethod.POST)
|
||||
public ResponseEntity<Map<String, Object>> awardConrevMileage(@RequestBody BOConrevVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectBestReviewList BOConrevVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> serviceResult = service.awardConrevMileage(vo);
|
||||
|
||||
log.debug("selectBestReviewList serviceResult chk ::: {}", serviceResult);
|
||||
|
||||
return ApiResponse.of(serviceResult).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 리뷰시간조회
|
||||
*
|
||||
* @param vo 리뷰시간 조회 조건을 담고 있는 VO
|
||||
* @return 리뷰시간 정보를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/getReviewTime", method = RequestMethod.POST)
|
||||
public ResponseEntity<Map<String, Object>> getReviewTime(@RequestBody BOConrevVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getReviewTime BOConrevVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.getReviewTime(vo);
|
||||
|
||||
log.debug("getReviewTime content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 보상 정보 조회
|
||||
*
|
||||
* @param vo 마일리지 보상 정보 조회 조건을 담고 있는 VO
|
||||
* @return 마일리지 보상 정보를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/getRewardInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<Map<String, Object>> getRewardInfo(@RequestBody BOConrevVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getRewardInfo BOConrevVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.getRewardInfo(vo);
|
||||
|
||||
log.debug("getRewardInfo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.conrev.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.conrev.vo.BOConrevVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BOConrevMapper {
|
||||
|
||||
/** 베스트 리뷰 목록 조회 */
|
||||
List<DataMap> selectBestReviewList(BOConrevVO vo);
|
||||
|
||||
/** 리뷰 상세 정보 조회 */
|
||||
DataMap selectReviewDetail(BOConrevVO vo);
|
||||
|
||||
/** 마일리지 적립 정보 삽입 */
|
||||
int insertMileageAccumulation(BOConrevVO vo);
|
||||
|
||||
/** 리뷰 보기 참여 정보 삽입 */
|
||||
int insertReviewParticipation(BOConrevVO vo);
|
||||
|
||||
/** 베스트 리뷰 목록 조회 */
|
||||
int checkConrevMileageAccumulation(BOConrevVO vo);
|
||||
|
||||
/** 베스트 리뷰 보기 보상 정보 조회 */
|
||||
Integer selectConrevRewardInfo(BOConrevVO vo);
|
||||
|
||||
/** 리뷰보기 시간 조회 */
|
||||
Integer selectReviewTime(BOConrevVO vo);
|
||||
|
||||
/** 초록잎 지급 개수 조회 */
|
||||
DataMap selectLeafCounts(BOConrevVO vo);
|
||||
|
||||
/** 베스트리뷰 안내문 조회 */
|
||||
DataMap selectBestReviewGuidance(BOConrevVO vo);
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.conrev.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.conrev.mapper.BOConrevMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.conrev.vo.BOConrevVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BOConrevService {
|
||||
|
||||
@Autowired
|
||||
private BOConrevMapper mapper;
|
||||
private final WebClient webClient;
|
||||
|
||||
@Autowired
|
||||
private BenefitRewardService benefitRewardService;
|
||||
|
||||
// 베스트 리뷰 목록 조회
|
||||
public List<DataMap> selectBestReviewList(BOConrevVO vo) {
|
||||
// 베스트 리뷰 정보 조회 시 사용 여부 및 기간 체크도 포함
|
||||
return mapper.selectBestReviewList(vo);
|
||||
}
|
||||
|
||||
// 리뷰 상세 정보 조회
|
||||
public DataMap selectReviewDetail(BOConrevVO vo) {
|
||||
return mapper.selectReviewDetail(vo);
|
||||
}
|
||||
|
||||
// 마일리지 적립 처리
|
||||
public Map<String, Object> awardConrevMileage(BOConrevVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
int paidLeafCnt = 0;
|
||||
int specialLeafCnt = 0;
|
||||
|
||||
if (leafCounts != null) {
|
||||
paidLeafCnt = leafCounts.get("pymntCnt") != null ? ((Number) leafCounts.get("pymntCnt")).intValue() : 0;
|
||||
specialLeafCnt = leafCounts.get("specialCnt") != null ? ((Number) leafCounts.get("specialCnt")).intValue() : 0;
|
||||
}
|
||||
|
||||
int totalLeafCnt = paidLeafCnt + specialLeafCnt;
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
|
||||
// 마일리지 적립 여부 확인
|
||||
int checkResult = mapper.checkConrevMileageAccumulation(vo);
|
||||
if (checkResult > 0) {
|
||||
result.put("result", false);
|
||||
result.put("errorCode", "ALREADY_ACCUMULATED");
|
||||
result.put("message", "이미 마일리지가 적립되었습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 마일리지 보상 정보 조회
|
||||
Integer rewardInfo = mapper
|
||||
.selectConrevRewardInfo(vo);
|
||||
if (rewardInfo == null) {
|
||||
result.put("result", false);
|
||||
result.put("errorCode", "REWARD_INFO_NOT_FOUND");
|
||||
result.put("message", "마일리지 보상 정보를 찾을 수 없습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 참여 정보 삽입
|
||||
int participationResult = mapper.insertReviewParticipation(vo);
|
||||
if (participationResult <= 0) {
|
||||
result.put("result", false);
|
||||
result.put("errorCode", "PARTICIPATION_INSERT_FAILED");
|
||||
result.put("message", "참여 정보 등록에 실패했습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 마일리지 적립 정보 삽입
|
||||
vo.setMlgRwdAmt(BigDecimal.valueOf(rewardInfo));
|
||||
int mileageResult = mapper.insertMileageAccumulation(vo);
|
||||
if (mileageResult <= 0) {
|
||||
result.put("result", false);
|
||||
result.put("errorCode", "MILEAGE_INSERT_FAILED");
|
||||
result.put("message", "마일리지 적립에 실패했습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// WebClient를 사용하여 마일리지 실제 등록 처리
|
||||
registerMileage(vo);
|
||||
|
||||
result.put("result", true);
|
||||
result.put("message", "마일리지가 성공적으로 적립되었습니다.");
|
||||
result.put("accumulatedMileage", rewardInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 리뷰 VO
|
||||
*/
|
||||
private void registerMileage(BOConrevVO vo) {
|
||||
try {
|
||||
BOMlgVO mlgVo = new BOMlgVO();
|
||||
mlgVo.setSopmalCd(vo.getSopmalCd());
|
||||
mlgVo.setMbrInnb(String.valueOf(vo.getMbrInnb()));
|
||||
mlgVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
mlgVo.setAccmlmnyAmt(vo.getMlgRwdAmt());
|
||||
mlgVo.setBnfRcvInnb(String.valueOf(vo.getBnfRcvInnb()));
|
||||
|
||||
// 마일리지 적용 구분 코드 및 사유 설정
|
||||
mlgVo.setMlgApplcDvCd("07");
|
||||
mlgVo.setMlgApplcResn("리뷰보기 보상");
|
||||
|
||||
boolean success = benefitRewardService.issueMileage(mlgVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("출석체크 마일리지 등록 요청 성공: {}", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
log.error("출석체크 마일리지 등록 요청 실패: {}", vo.getMlgRwdAmt());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerMileage 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 리뷰 시간 조회 (기존 메소드에서 selectConrevRewardInfo 분리)
|
||||
public Map<String, Object> getReviewTime(BOConrevVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Integer tmeSecnd = mapper.selectReviewTime(vo);
|
||||
|
||||
if (tmeSecnd != null) {
|
||||
result.put("success", true);
|
||||
result.put("tmeSecnd", tmeSecnd);
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "리뷰 시간 정보를 찾을 수 없습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 마일리지 보상 정보 조회 (새로 추가된 메소드)
|
||||
public Map<String, Object> getRewardInfo(BOConrevVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Integer mlgRwdAmt = mapper.selectConrevRewardInfo(vo);
|
||||
|
||||
if (mlgRwdAmt != null) {
|
||||
result.put("success", true);
|
||||
result.put("mlgRwdAmt", mlgRwdAmt);
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "마일리지 보상 정보를 찾을 수 없습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 베스트리뷰 안내문 조회
|
||||
public Map<String, Object> getBestReviewGuidance(BOConrevVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
DataMap guidance = mapper.selectBestReviewGuidance(vo);
|
||||
|
||||
if (guidance != null) {
|
||||
result.put("success", true);
|
||||
result.put("guidance", guidance);
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "베스트리뷰 안내문 정보를 찾을 수 없습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.conrev.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOConrevVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 회원 고유 번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 페이지 크기 */
|
||||
private int pageSize;
|
||||
/** 오프셋 */
|
||||
private int offset;
|
||||
/** 마일리지 보상 금액 */
|
||||
private BigDecimal mlgRwdAmt;
|
||||
/** 리뷰 내용 */
|
||||
private String reviewContent;
|
||||
/** 리뷰 링크 */
|
||||
private String reviewLink;
|
||||
/** 이미지 파일 경로 */
|
||||
private String imgFilCours;
|
||||
/** 이미지 파일명 */
|
||||
private String imgFilNm;
|
||||
/** 열람 시간(초) */
|
||||
private Integer tmeSecnd;
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 참여대상 고유번호 */
|
||||
private Long prtTargetInnb;
|
||||
/** 참여대상 내용 */
|
||||
private String prtTargetCn;
|
||||
/** 초록잎 지급량 */
|
||||
private Integer paidLeafCnt;
|
||||
/** 쿠폰 발송 고유번호 */
|
||||
private BigInteger couponInnb;
|
||||
/** 혜택 보상 내역 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.cpslmkn.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.cpslmkn.service.BOCpslmknService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.cpslmkn.vo.BOCpslmknVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
public class BOCpslmknController {
|
||||
@Autowired
|
||||
private BOCpslmknService service;
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 보상 제품 목록과 안내사항 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/rewardProductInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getRewardProductInfo(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap content = service.getRewardProductInfo(vo);
|
||||
|
||||
// 현재 진행 상태 추가 조회 입니다.
|
||||
DataMap progressInfo = service.getCurrentProgressInfo(vo);
|
||||
if (progressInfo != null) {
|
||||
content.put("progressInfo", progressInfo);
|
||||
}
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 게임 데이터 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/gameData", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getCpslmknGameData(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap content = service.getCpslmknGameData(vo);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 초록잎 사용하여 게임 진행
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/useLeaf", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> useLeaf(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap content = service.useLeaf(vo);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 진행 상태와 보상 정보 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/currentProgress", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getCurrentProgress(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap content = service.getCurrentProgressInfo(vo);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 알림 설정 변경
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED) // 로그인 사용자만 접근 가능하도록 변경 고려
|
||||
@PostMapping("/notification")
|
||||
public ResponseEntity<String> updateNotificationSetting(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap content = service.updateNotificationSettings(vo);
|
||||
boolean success = (boolean) content.getOrDefault("success", false);
|
||||
return ApiResponse.of(content).ifPresentOrElse(success ? HttpStatus.OK : HttpStatus.INTERNAL_SERVER_ERROR, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 알림 설정 안내문 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/importantNotice", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getImportantNotice(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
return ApiResponse.of(service.getImportantNotice(vo)).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 알림 설정 정보 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/notificationSettings", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getNotificationSettings(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
return ApiResponse.of(service.getNotificationSettings(vo)).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 초록잎 보유 현황과 사용/획득 내역 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/leafStatusAndHistory", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getLeafStatusAndHistory(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.info("getLeafStatusAndHistory vo: {}", vo);
|
||||
|
||||
DataMap content = service.getLeafStatusAndHistory(vo);
|
||||
|
||||
log.info("content: {}", content);
|
||||
|
||||
return ApiResponse.of(service.getLeafStatusAndHistory(vo)).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 게임 안내 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/capsuleGameInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getCapsuleGameInfo(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.info("getCapsuleGameInfo vo: {}", vo);
|
||||
|
||||
DataMap content = service.getCapsuleGameInfo(vo);
|
||||
|
||||
log.info("content: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 게임 리셋
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/resetCapsule", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> capsuleGameReset(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
return ApiResponse.of(service.capsuleGameReset(vo)).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 초록잎을 받을 수 있는 이벤트 목록 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/leafEventList", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getLeafEventList(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());;
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
HashMap<String, Object> content = new HashMap<>();
|
||||
|
||||
// 초록잎을 받을 수 있는 이벤트 목록 조회
|
||||
List<DataMap> leafEventList = service.getLeafEventList(vo);
|
||||
|
||||
// 보유 초록잎 개수 조회
|
||||
int ownedLeafCount = service.getOwnedLeafCount(vo);
|
||||
|
||||
// 총 지급 개수 조회
|
||||
int totalLeafEventPaymentCount = service.getTotalLeafEventPaymentCount(vo);
|
||||
|
||||
content.put("leafEventList", leafEventList);
|
||||
content.put("ownedLeafCount", ownedLeafCount);
|
||||
content.put("totalLeafCnt", totalLeafEventPaymentCount);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/** sopmalCd 조회 */
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/sopmalCd", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getSopmalCd(@RequestBody BOCpslmknVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap result = new DataMap();
|
||||
result.put("sopmalCd", vo.getSopmalCd());
|
||||
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.cpslmkn.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.cpslmkn.vo.BOCpslmknVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 캡슐만들기 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOCpslmknMapper {
|
||||
|
||||
/** 최종 보상으로 선택할 수 있는 제품 목록 조회 */
|
||||
List<DataMap> selectRewardProductList(BOCpslmknVO vo);
|
||||
|
||||
/** 선물 선택과 받는 방법에 대한 중요사항 안내 조회 */
|
||||
DataMap selectImportantNotice(BOCpslmknVO vo);
|
||||
|
||||
/** 보유 초록잎 조회 */
|
||||
int selectOwnedLeafCount(BOCpslmknVO vo);
|
||||
|
||||
/** 초록잎 사용 내역 저장 */
|
||||
int insertLeafUsage(BOCpslmknVO vo);
|
||||
|
||||
/** 현재 진행 상태와 선택한 보상 확인 */
|
||||
DataMap selectCurrentProgress(BOCpslmknVO vo);
|
||||
|
||||
/** 진행 내역 삭제 */
|
||||
int deleteProgress(BOCpslmknVO vo);
|
||||
|
||||
/** 알림 설정 저장 */
|
||||
int upsertNotificationSetting(BOCpslmknVO vo);
|
||||
|
||||
/** 초록잎 생성, 사용 내역 조회 (최근 6개월) */
|
||||
List<DataMap> selectLeafHistory(BOCpslmknVO vo);
|
||||
|
||||
/** 진행 상황 확인 */
|
||||
DataMap checkPreviousProgress(BOCpslmknVO vo);
|
||||
|
||||
/** 캡슐 만들기 게임 상태 조회 */
|
||||
DataMap selectCpslmknGameStatus(BOCpslmknVO vo);
|
||||
|
||||
/** 진행 상태 업데이트 */
|
||||
int updateProgressStatus(BOCpslmknVO vo);
|
||||
|
||||
/** 진행 상태 삽입 */
|
||||
void insertProgressStatus(BOCpslmknVO vo);
|
||||
|
||||
DataMap selectProductInfo(BOCpslmknVO vo);
|
||||
|
||||
/** 모달에 표시할 진행 상태 데이터 조회 */
|
||||
DataMap selectProgressModalData(BOCpslmknVO vo);
|
||||
|
||||
/** 캡슐 만들기 설정 정보 조회 */
|
||||
DataMap selectCpslmknSettingsInfo(BOCpslmknVO vo);
|
||||
|
||||
/** 캡슐 만들기 리스트 화면 데이터 조회 */
|
||||
List<DataMap> selectCpslmknEventList(BOCpslmknVO vo);
|
||||
|
||||
/** 오늘 날짜의 참여 정보 조회 */
|
||||
DataMap selectTodayParticipation(BOCpslmknVO vo);
|
||||
|
||||
/** 참여 정보 업데이트 (초록잎 추가) */
|
||||
int updateBenefitParticipation(BOCpslmknVO vo);
|
||||
|
||||
/** 새 참여 정보 삽입 */
|
||||
int insertBenefitParticipation(BOCpslmknVO vo);
|
||||
|
||||
/** 보상 정보 조회 */
|
||||
DataMap selectRewardInfo(BOCpslmknVO vo);
|
||||
|
||||
/** 보상 수령 정보 입력 */
|
||||
int insertBenefitReceipt(BOCpslmknVO vo);
|
||||
|
||||
/** 캡슐만들기 완료 시 혜택 참여 정보 기록 */
|
||||
int insertBenefitParticipationOnCompletion(BOCpslmknVO vo);
|
||||
|
||||
/** 캡슐만들기 게임 안내 조회 */
|
||||
DataMap selectCapsuleGameInfo(BOCpslmknVO vo);
|
||||
|
||||
/** 캡슐 만들기 게임 리셋 */
|
||||
int resetCapsuleGame(BOCpslmknVO vo);
|
||||
|
||||
/** 전체 이벤트 목록 조회 (스페셜 포함) */
|
||||
List<DataMap> selectLeafEventList(BOCpslmknVO vo);
|
||||
|
||||
/** 오늘의 스페셜 이벤트 조회 */
|
||||
List<DataMap> selectTodaySpecialEvents(BOCpslmknVO vo);
|
||||
|
||||
/** 초록잎 이벤트 총 지급 개수 조회 */
|
||||
int selectTotalLeafEventPaymentCount(BOCpslmknVO vo);
|
||||
|
||||
/** 캡슐 게임 완료 처리*/
|
||||
int completeGame(BOCpslmknVO boCpslmknVO);
|
||||
|
||||
/** 완료된 게임 확인 (새 게임 시작 가능 여부 판단용) */
|
||||
DataMap checkCompletedGame(BOCpslmknVO vo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,749 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.cpslmkn.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.cpslmkn.mapper.BOCpslmknMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.cpslmkn.vo.BOCpslmknVO;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.vo.BODwldCouponVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BOCpslmknService {
|
||||
|
||||
@Autowired
|
||||
private BOCpslmknMapper boCpslmknMapper;
|
||||
|
||||
private final WebClient webClient;
|
||||
|
||||
@Autowired
|
||||
private BenefitRewardService benefitRewardService;
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 보상 제품 목록과 중요 안내사항을 조회합니다.
|
||||
*
|
||||
* @param vo 쇼핑몰 코드 등 조회 조건
|
||||
* @return 제품 목록과 안내사항이 포함된 응답 객체
|
||||
*/
|
||||
public DataMap getRewardProductInfo(BOCpslmknVO vo) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 1. 보상 제품 목록 조회 (썸네일, 제품명, 소개, 필요 초록잎 개수 등)
|
||||
List<DataMap> productList = boCpslmknMapper.selectRewardProductList(vo);
|
||||
|
||||
// 2. 중요 안내사항 조회
|
||||
DataMap importantNotice = boCpslmknMapper.selectImportantNotice(vo);
|
||||
|
||||
result.put("productList", productList);
|
||||
result.put("importantNotice", importantNotice);
|
||||
result.put("sopmalCd", vo.getSopmalCd());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 게임의 현재 상태 데이터를 조회합니다.
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보와 게임 진행 정보가 담긴 VO
|
||||
* @return 게임 진행 상태, 보유 초록잎, 진행률 등이 포함된 응답 객체
|
||||
*/
|
||||
public DataMap getCpslmknGameData(BOCpslmknVO boCpslmknVO) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 1. 이전 진행 상황 체크 (진행 중인 게임만)
|
||||
DataMap previousProgress = boCpslmknMapper.checkPreviousProgress(boCpslmknVO);
|
||||
|
||||
if (previousProgress != null) {
|
||||
// 진행 중인 게임이 있는 경우
|
||||
boCpslmknVO.setBnfInnb(Long.valueOf(String.valueOf(previousProgress.get("bnfInnb"))));
|
||||
boCpslmknVO.setBnfSttusInnb(Long.valueOf(String.valueOf(previousProgress.get("bnfSttusInnb"))));
|
||||
log.debug("기존 게임 연결 - 혜택번호: {}, 상태번호: {}",
|
||||
boCpslmknVO.getBnfInnb(), boCpslmknVO.getBnfSttusInnb());
|
||||
} else if (boCpslmknVO.getBnfInnb() != null) {
|
||||
// 진행 중인 게임이 없는 경우, 완료된 게임 확인
|
||||
DataMap completedGame = boCpslmknMapper.checkCompletedGame(boCpslmknVO);
|
||||
|
||||
if (completedGame != null && "N".equals(completedGame.get("progrsAt"))) {
|
||||
// 완료된 게임이 있는 경우 - 새 게임 시작 가능
|
||||
log.debug("완료된 게임 존재, 새 게임 시작 가능");
|
||||
}
|
||||
|
||||
// 새 게임 시작
|
||||
boCpslmknVO.setProgrsStep(1);
|
||||
boCpslmknVO.setTotUseLeafCnt(0);
|
||||
boCpslmknMapper.insertProgressStatus(boCpslmknVO);
|
||||
|
||||
// 새로 생성된 게임 정보 조회
|
||||
previousProgress = boCpslmknMapper.checkPreviousProgress(boCpslmknVO);
|
||||
if (previousProgress != null) {
|
||||
boCpslmknVO.setBnfSttusInnb(Long.valueOf(String.valueOf(previousProgress.get("bnfSttusInnb"))));
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 현재 캡슐만들기 진행 상황 조회
|
||||
DataMap currentStatus = boCpslmknMapper.selectCpslmknGameStatus(boCpslmknVO);
|
||||
if (currentStatus != null) {
|
||||
// Integer로 형변환
|
||||
result.put("progrsStep", Integer.valueOf(String.valueOf(currentStatus.get("progrsStep"))));
|
||||
result.put("totUseLeafCnt", Integer.valueOf(String.valueOf(currentStatus.get("totUseLeafCnt"))));
|
||||
}
|
||||
|
||||
// 3. 현재 보유 초록잎 조회
|
||||
int ownedLeafCount = Integer.valueOf(String.valueOf(boCpslmknMapper.selectOwnedLeafCount(boCpslmknVO)));
|
||||
result.put("ownedLeafCount", ownedLeafCount);
|
||||
|
||||
// 4. 초록잎 사용 로직 (필요 시)
|
||||
if (boCpslmknVO.getUseLeafCnt() != null && boCpslmknVO.getUseLeafCnt() > 0) {
|
||||
result.put("leafUsage", boCpslmknVO.getUseLeafCnt());
|
||||
}
|
||||
|
||||
// 5. 단계별 초록잎 분할 및 퍼센트 계산 로직
|
||||
DataMap productInfo = boCpslmknMapper.selectProductInfo(boCpslmknVO);
|
||||
int totalLeafNeeded = productInfo != null ?
|
||||
Integer.valueOf(String.valueOf(productInfo.get("rwdCndCnt"))) : 100;
|
||||
int leafPerStep = totalLeafNeeded / 5;
|
||||
int currentLeafUsed = currentStatus != null ?
|
||||
Integer.valueOf(String.valueOf(currentStatus.get("totUseLeafCnt"))) : 0;
|
||||
|
||||
// 진행률 계산
|
||||
double progressPercentage = (double) currentLeafUsed / totalLeafNeeded * 100.0;
|
||||
result.put("progressPercentage", progressPercentage);
|
||||
result.put("totalLeafNeeded", totalLeafNeeded);
|
||||
result.put("leafPerStep", leafPerStep);
|
||||
|
||||
// 현재 단계 계산 (1부터 시작)
|
||||
int currentStep;
|
||||
if (currentLeafUsed == 0) {
|
||||
currentStep = 1; // 초기 단계
|
||||
} else {
|
||||
// 완료된 단계 계산
|
||||
currentStep = (currentLeafUsed - 1) / leafPerStep + 1;
|
||||
// 최대 5단계로 제한
|
||||
currentStep = Math.min(currentStep, 5);
|
||||
}
|
||||
|
||||
// 현재 단계에서의 진행률 계산 추가
|
||||
int previousLeafUsed = (currentStep - 1) * leafPerStep; // 이전 단계까지 사용된 초록잎
|
||||
int leafInCurrentStep = currentLeafUsed - previousLeafUsed; // 현재 단계에서 사용한 초록잎
|
||||
double stepProgressPercentage;
|
||||
|
||||
if (leafInCurrentStep >= leafPerStep) {
|
||||
stepProgressPercentage = 100.0;
|
||||
} else {
|
||||
stepProgressPercentage = ((double) leafInCurrentStep / leafPerStep) * 100;
|
||||
}
|
||||
|
||||
// 결과에 추가 정보 설정
|
||||
result.put("currentStep", currentStep);
|
||||
result.put("stepProgressPercentage", stepProgressPercentage);
|
||||
result.put("leafInCurrentStep", leafInCurrentStep);
|
||||
|
||||
// bnfSttusInnb 추가
|
||||
result.put("bnfSttusInnb", boCpslmknVO.getBnfSttusInnb());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 초록잎을 사용하여 캡슐 만들기 게임을 진행합니다.
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보와 사용할 초록잎 개수가 담긴 VO
|
||||
* @return 초록잎 사용 후 갱신된 게임 상태 정보
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DataMap useLeaf(BOCpslmknVO boCpslmknVO) {
|
||||
DataMap result = new DataMap();
|
||||
log.debug("=== 초록잎 사용 시작 ===");
|
||||
|
||||
//변수 스코프 수정: 메소드 시작 부분에서 선언
|
||||
int updateResult = 0;
|
||||
int newTotalLeaf = 0;
|
||||
|
||||
try {
|
||||
// 1. 초록잎 사용 전 보유량 먼저 조회
|
||||
int originalOwnedLeaf = boCpslmknMapper.selectOwnedLeafCount(boCpslmknVO);
|
||||
log.debug("초록잎 사용 전 보유량: {}", originalOwnedLeaf);
|
||||
|
||||
// 2. 제품 정보 조회하여 총 필요 초록잎 계산
|
||||
log.debug("1. 제품 정보 조회 시작");
|
||||
DataMap productInfo = boCpslmknMapper.selectProductInfo(boCpslmknVO);
|
||||
log.debug("제품 정보 조회 결과: {}", productInfo);
|
||||
|
||||
int totalLeafNeeded = productInfo != null ?
|
||||
Integer.valueOf(String.valueOf(productInfo.get("rwdCndCnt"))) : 100;
|
||||
log.debug("총 필요 초록잎 개수: {}", totalLeafNeeded);
|
||||
|
||||
// 3. 현재까지 사용된 초록잎 계산
|
||||
log.debug("2. 현재 게임 상태 조회 시작");
|
||||
DataMap currentStatus = boCpslmknMapper.selectCpslmknGameStatus(boCpslmknVO);
|
||||
log.debug("현재 게임 상태 조회 결과: {}", currentStatus);
|
||||
|
||||
int currentTotalLeaf = currentStatus != null ?
|
||||
Integer.valueOf(String.valueOf(currentStatus.get("totUseLeafCnt"))) : 0;
|
||||
log.debug("현재까지 사용된 초록잎: {}", currentTotalLeaf);
|
||||
|
||||
//핵심 수정: 기존 상태가 있으면 그 PK 사용, 없으면 새로 생성
|
||||
boolean isExistingGame = false;
|
||||
if (currentStatus != null && currentStatus.get("bnfSttusInnb") != null) {
|
||||
Long existingBnfSttusInnb = Long.valueOf(String.valueOf(currentStatus.get("bnfSttusInnb")));
|
||||
boCpslmknVO.setBnfSttusInnb(existingBnfSttusInnb);
|
||||
isExistingGame = true;
|
||||
log.debug("기존 게임 상태번호 사용: {}", existingBnfSttusInnb);
|
||||
}
|
||||
|
||||
newTotalLeaf = currentTotalLeaf + boCpslmknVO.getUseLeafCnt();
|
||||
log.debug("새로 사용 후 총 초록잎: {} (기존: {} + 신규: {})",
|
||||
newTotalLeaf, currentTotalLeaf, boCpslmknVO.getUseLeafCnt());
|
||||
|
||||
// 4. 단계별 초록잎 계산
|
||||
log.debug("3. 단계별 계산 시작");
|
||||
int leafPerStep = totalLeafNeeded / 5; // 각 단계별 필요한 초록잎
|
||||
log.debug("단계별 필요 초록잎: {}", leafPerStep);
|
||||
|
||||
// 현재 단계 계산 (1부터 시작)
|
||||
int currentStep;
|
||||
if (newTotalLeaf == 0) {
|
||||
currentStep = 1; // 초기 단계
|
||||
log.debug("초기 단계로 설정: {}", currentStep);
|
||||
} else {
|
||||
// 완료된 단계 계산
|
||||
currentStep = (newTotalLeaf - 1) / leafPerStep + 1;
|
||||
log.debug("계산된 단계: {} (공식: ({} - 1) / {} + 1)", currentStep, newTotalLeaf, leafPerStep);
|
||||
// 최대 5단계로 제한
|
||||
currentStep = Math.min(currentStep, 5);
|
||||
log.debug("최대 5단계 제한 후 현재 단계: {}", currentStep);
|
||||
}
|
||||
|
||||
// 5. 현재 단계에서의 진행률 계산
|
||||
log.debug("4. 현재 단계 진행률 계산 시작");
|
||||
int previousLeafUsed = (currentStep - 1) * leafPerStep; // 이전 단계까지 사용된 초록잎
|
||||
log.debug("이전 단계까지 사용된 초록잎: {} (({} - 1) * {})",
|
||||
previousLeafUsed, currentStep, leafPerStep);
|
||||
|
||||
int leafInCurrentStep = newTotalLeaf - previousLeafUsed; // 현재 단계에서 사용한 초록잎
|
||||
log.debug("현재 단계에서 사용한 초록잎: {} ({} - {})",
|
||||
leafInCurrentStep, newTotalLeaf, previousLeafUsed);
|
||||
|
||||
double stepProgressPercentage;
|
||||
if (leafInCurrentStep >= leafPerStep) {
|
||||
stepProgressPercentage = 100.0;
|
||||
log.debug("현재 단계 완료: 진행률 100%");
|
||||
} else {
|
||||
stepProgressPercentage = ((double) leafInCurrentStep / leafPerStep) * 100;
|
||||
log.debug("현재 단계 진행률: {}% ({} / {} * 100)",
|
||||
stepProgressPercentage, leafInCurrentStep, leafPerStep);
|
||||
}
|
||||
|
||||
// 6. VO에 계산된 값 설정
|
||||
log.debug("5. VO에 계산된 값 설정");
|
||||
boCpslmknVO.setProgrsStep(currentStep);
|
||||
boCpslmknVO.setTotUseLeafCnt(newTotalLeaf);
|
||||
log.debug("VO 설정 완료 - 진행단계: {}, 총사용초록잎: {}", currentStep, newTotalLeaf);
|
||||
|
||||
// 7.수정: 새 게임인 경우에만 INSERT
|
||||
if (!isExistingGame) {
|
||||
log.debug("새 게임 생성 시작");
|
||||
boCpslmknMapper.insertProgressStatus(boCpslmknVO);
|
||||
log.debug("새 게임 생성 완료");
|
||||
|
||||
//새로 생성된 경우 다시 조회하여 BNF_STTUS_INNB 설정
|
||||
DataMap newProgress = boCpslmknMapper.checkPreviousProgress(boCpslmknVO);
|
||||
if (newProgress != null) {
|
||||
boCpslmknVO.setBnfSttusInnb(Long.valueOf(String.valueOf(newProgress.get("bnfSttusInnb"))));
|
||||
log.debug("새로 생성된 게임의 상태번호 설정: {}", boCpslmknVO.getBnfSttusInnb());
|
||||
}
|
||||
}
|
||||
|
||||
// 8. 초록잎 사용 로직
|
||||
log.debug("7. 초록잎 사용 로직 시작");
|
||||
if (boCpslmknVO.getUseLeafCnt() != null && boCpslmknVO.getUseLeafCnt() > 0) {
|
||||
// 초록잎 보유량 검증 추가
|
||||
if (boCpslmknVO.getUseLeafCnt() > originalOwnedLeaf) {
|
||||
log.warn("초록잎 부족 - 요청: {}, 보유: {}", boCpslmknVO.getUseLeafCnt(), originalOwnedLeaf);
|
||||
result.put("leafUsageSuccess", false);
|
||||
result.put("errorMessage", "보유한 초록잎이 부족합니다.");
|
||||
result.put("errorCode", "INSUFFICIENT_LEAF");
|
||||
result.put("ownedLeafCount", originalOwnedLeaf);
|
||||
result.put("requestedLeafCount", boCpslmknVO.getUseLeafCnt());
|
||||
return result;
|
||||
}
|
||||
|
||||
// BNF_STTUS_INNB가 설정되었는지 확인
|
||||
if (boCpslmknVO.getBnfSttusInnb() == null) {
|
||||
log.error("BNF_STTUS_INNB가 설정되지 않았습니다!");
|
||||
throw new RuntimeException("게임 상태 번호가 설정되지 않았습니다.");
|
||||
}
|
||||
|
||||
log.debug("초록잎 사용 처리 - 사용량: {}, 게임상태번호: {}",
|
||||
boCpslmknVO.getUseLeafCnt(), boCpslmknVO.getBnfSttusInnb());
|
||||
|
||||
// 초록잎 사용 기록
|
||||
log.debug("초록잎 사용 기록 삽입 시작");
|
||||
int insertResult = boCpslmknMapper.insertLeafUsage(boCpslmknVO);
|
||||
log.debug("초록잎 사용 기록 삽입 결과: {} rows affected", insertResult);
|
||||
|
||||
//수정: 진행 상태 업데이트 (이제 올바른 PK 사용)
|
||||
log.debug("진행 상태 업데이트 시작 - 게임상태번호: {}", boCpslmknVO.getBnfSttusInnb());
|
||||
updateResult = boCpslmknMapper.updateProgressStatus(boCpslmknVO);
|
||||
log.debug("진행 상태 업데이트 완료 - 영향받은 행 수: {}", updateResult);
|
||||
|
||||
//추가: 업데이트 실패 시 즉시 예외 처리
|
||||
if (updateResult == 0) {
|
||||
log.error("진행 상태 업데이트 실패 - 영향받은 행 수: 0, PK: {}", boCpslmknVO.getBnfSttusInnb());
|
||||
throw new RuntimeException("게임 진행 상태 업데이트 실패: 해당 게임을 찾을 수 없습니다.");
|
||||
}
|
||||
|
||||
// 전체 완성 여부 확인
|
||||
boolean isCompleted = newTotalLeaf >= totalLeafNeeded;
|
||||
log.debug("전체 완성 여부: {} ({} >= {})", isCompleted, newTotalLeaf, totalLeafNeeded);
|
||||
|
||||
// 완료 조건 체크 후 완료 처리
|
||||
if (isCompleted && currentStep >= 5) {
|
||||
// 게임 완료 상태 - 완료 처리 및 완료 데이터 제공
|
||||
log.debug("게임 완료 처리 시작 - 5단계 달성");
|
||||
|
||||
// 게임 완료 처리
|
||||
DataMap completeResult = completeGame(boCpslmknVO);
|
||||
log.debug("게임 완료 처리 결과: {}", completeResult);
|
||||
|
||||
//추가: 보상 정보 조회 및 지급 처리
|
||||
DataMap rewardInfo = boCpslmknMapper.selectRewardInfo(boCpslmknVO);
|
||||
if (rewardInfo != null) {
|
||||
log.debug("보상 정보 조회 성공: {}", rewardInfo);
|
||||
|
||||
// 1. 먼저 혜택 참여 기록 생성하여 bnfPrtInnb 획득
|
||||
boCpslmknMapper.insertBenefitParticipationOnCompletion(boCpslmknVO);
|
||||
log.debug("혜택 참여 기록 생성 완료 - bnfPrtInnb: {}", boCpslmknVO.getBnfPrtInnb());
|
||||
|
||||
// 2. 보상 수령 기록 생성을 위한 데이터 설정 (null 체크 강화)
|
||||
String bnfRwdCateDvCd = rewardInfo.get("bnfRwdCateDvCd") != null ?
|
||||
String.valueOf(rewardInfo.get("bnfRwdCateDvCd")) : null;
|
||||
String bnfRwdGodsDvCd = rewardInfo.get("bnfRwdGodsDvCd") != null ?
|
||||
String.valueOf(rewardInfo.get("bnfRwdGodsDvCd")) : null;
|
||||
Object couponInnb = rewardInfo.get("couponInnb") != null ?
|
||||
Long.valueOf(String.valueOf(rewardInfo.get("couponInnb"))) : null;
|
||||
|
||||
boCpslmknVO.setBnfRwdCateDvCd(bnfRwdCateDvCd);
|
||||
boCpslmknVO.setBnfRwdGodsDvCd(bnfRwdGodsDvCd);
|
||||
boCpslmknVO.setCouponInnb((BigInteger) couponInnb);
|
||||
|
||||
// 3. 보상 수령 기록 생성 (bnfPrtInnb 사용)
|
||||
boCpslmknMapper.insertBenefitReceipt(boCpslmknVO);
|
||||
log.debug("보상 수령 기록 생성 완료 - bnfRcvInnb: {}", boCpslmknVO.getBnfRcvInnb());
|
||||
|
||||
// 4. 쿠폰 지급 처리 (020: 쿠폰, 030: 마일리지+쿠폰, 050: 쿠폰+상품)
|
||||
if (bnfRwdGodsDvCd != null && couponInnb != null &&
|
||||
("020".equals(bnfRwdGodsDvCd) || "030".equals(bnfRwdGodsDvCd) || "050".equals(bnfRwdGodsDvCd))) {
|
||||
try {
|
||||
registerCoupon(boCpslmknVO);
|
||||
log.debug("쿠폰 지급 완료: 쿠폰번호 {}", couponInnb);
|
||||
} catch (Exception e) {
|
||||
log.error("쿠폰 지급 실패: 쿠폰번호 {}, 오류: {}", couponInnb, e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
log.debug("쿠폰 지급 조건 불충족 - 보상구분: {}, 쿠폰번호: {}", bnfRwdGodsDvCd, couponInnb);
|
||||
}
|
||||
} else {
|
||||
log.warn("보상 정보 조회 실패 - 혜택번호: {}", boCpslmknVO.getBnfInnb());
|
||||
}
|
||||
|
||||
// 완료 후 보유 초록잎 계산
|
||||
int correctedOwnedLeaf = originalOwnedLeaf - boCpslmknVO.getUseLeafCnt();
|
||||
|
||||
// 완료 상태 응답 데이터 구성
|
||||
result.put("gameCompleted", true);
|
||||
result.put("currentStep", 5);
|
||||
result.put("totalLeafNeeded", totalLeafNeeded);
|
||||
result.put("progressPercentage", 100.0);
|
||||
result.put("stepProgressPercentage", 100.0);
|
||||
result.put("ownedLeafCount", correctedOwnedLeaf);
|
||||
result.put("message", "캡슐만들기가 완료되었습니다!");
|
||||
|
||||
// 완료된 보상 정보도 포함
|
||||
DataMap rewardInfoForResponse = getCompletionRewardInfo(boCpslmknVO);
|
||||
result.putAll(rewardInfoForResponse);
|
||||
|
||||
log.debug("게임 완료 응답 데이터 구성 완료: {}", result);
|
||||
} else {
|
||||
// 미완료 상태 - 계산된 값들로 응답 구성
|
||||
log.debug("미완료 상태 - 계산된 값들로 응답 구성");
|
||||
|
||||
// 초록잎 사용 후 정확한 보유량 계산
|
||||
int correctedOwnedLeaf = originalOwnedLeaf - boCpslmknVO.getUseLeafCnt();
|
||||
|
||||
// 전체 진행률 계산
|
||||
double progressPercentage = (double) newTotalLeaf / totalLeafNeeded * 100.0;
|
||||
|
||||
// 응답 데이터 직접 구성
|
||||
result.put("progrsStep", currentStep);
|
||||
result.put("totUseLeafCnt", newTotalLeaf);
|
||||
result.put("ownedLeafCount", correctedOwnedLeaf);
|
||||
result.put("leafUsage", boCpslmknVO.getUseLeafCnt());
|
||||
result.put("progressPercentage", progressPercentage);
|
||||
result.put("totalLeafNeeded", totalLeafNeeded);
|
||||
result.put("leafPerStep", leafPerStep);
|
||||
result.put("currentStep", currentStep);
|
||||
result.put("stepProgressPercentage", stepProgressPercentage);
|
||||
result.put("leafInCurrentStep", leafInCurrentStep);
|
||||
result.put("bnfSttusInnb", boCpslmknVO.getBnfSttusInnb());
|
||||
|
||||
log.debug("계산된 응답 데이터: totUseLeafCnt={}, progressPercentage={}",
|
||||
newTotalLeaf, progressPercentage);
|
||||
}
|
||||
} else {
|
||||
log.debug("초록잎 사용량이 0이거나 null - 사용 처리 건너뜀");
|
||||
}
|
||||
|
||||
//수정: 최종 검증 로직 개선 (updateResult > 0일 때만)
|
||||
if (updateResult > 0) {
|
||||
log.debug("최종 DB 상태 검증 시작");
|
||||
DataMap finalStatus = boCpslmknMapper.selectCpslmknGameStatus(boCpslmknVO);
|
||||
int finalTotalLeaf = finalStatus != null ?
|
||||
Integer.valueOf(String.valueOf(finalStatus.get("totUseLeafCnt"))) : 0;
|
||||
|
||||
if (finalTotalLeaf != newTotalLeaf) {
|
||||
log.error("DB 업데이트 불일치 - 예상: {}, 실제: {}", newTotalLeaf, finalTotalLeaf);
|
||||
throw new RuntimeException("게임 상태 동기화 실패");
|
||||
}
|
||||
|
||||
log.debug("DB 상태 검증 완료 - 총 사용 초록잎: {}", finalTotalLeaf);
|
||||
}
|
||||
|
||||
log.debug("=== 초록잎 사용 성공 완료 ===");
|
||||
log.debug("최종 결과 데이터: {}", result);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("=== 초록잎 사용 중 오류 발생 ===");
|
||||
log.error("오류 메시지: {}", e.getMessage());
|
||||
log.error("오류 클래스: {}", e.getClass().getName());
|
||||
log.error("오류 스택 트레이스: ", e);
|
||||
|
||||
result.put("leafUsageSuccess", false);
|
||||
result.put("errorMessage", "초록잎 사용 중 오류가 발생했습니다: " + e.getMessage());
|
||||
result.put("errorCode", "LEAF_USAGE_ERROR");
|
||||
|
||||
if (e.getCause() != null) {
|
||||
log.error("오류 원인: {}", e.getCause().getMessage());
|
||||
result.put("errorCause", e.getCause().getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 진행 상태와 보상 정보를 조회합니다.
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보와 혜택 정보가 담긴 VO
|
||||
* @return 진행 상태와 보상 정보가 포함된 응답 객체
|
||||
*/
|
||||
public DataMap getCurrentProgressInfo(BOCpslmknVO boCpslmknVO) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 1. 현재 진행 상태와 선택한 보상 정보 조회
|
||||
DataMap progressInfo = boCpslmknMapper.selectCurrentProgress(boCpslmknVO);
|
||||
|
||||
if (progressInfo != null) {
|
||||
// 진행 단계 정보
|
||||
result.put("progrsStep", Integer.valueOf(String.valueOf(progressInfo.get("progrsStep"))));
|
||||
result.put("totUseLeafCnt", Integer.valueOf(String.valueOf(progressInfo.get("totUseLeafCnt"))));
|
||||
|
||||
// 선택한 보상 제품 정보
|
||||
result.put("productName", progressInfo.get("cnSj"));
|
||||
result.put("productDesc", progressInfo.get("cnDc"));
|
||||
result.put("rewardType", progressInfo.get("bnfRwdGodsDvCd"));
|
||||
result.put("notice", progressInfo.get("bnfWordsCn"));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 완성 시 보상 정보를 조회합니다.
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보와 혜택 정보가 담긴 VO
|
||||
* @return 완성된 보상 정보가 포함된 응답 객체
|
||||
*/
|
||||
public DataMap getCompletionRewardInfo(BOCpslmknVO boCpslmknVO) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 모달에 표시할 완성 정보 조회
|
||||
DataMap modalData = boCpslmknMapper.selectProgressModalData(boCpslmknVO);
|
||||
|
||||
if (modalData != null) {
|
||||
result.put("productName", modalData.get("cnSj"));
|
||||
result.put("productDesc", modalData.get("cnDc"));
|
||||
result.put("imageUrl", modalData.get("imgFilCours"));
|
||||
result.put("notice", modalData.get("bnfWordsCn"));
|
||||
result.put("totalLeafUsed", modalData.get("totUseLeafCnt"));
|
||||
result.put("requiredLeaf", modalData.get("rwdCndCnt"));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 진행 중인 캡슐 만들기를 취소합니다.
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보와 혜택 정보가 담긴 VO
|
||||
* @return 취소 처리 결과
|
||||
*/
|
||||
public boolean cancelProgress(BOCpslmknVO boCpslmknVO) {
|
||||
// 진행 상태 확인
|
||||
DataMap progressInfo = boCpslmknMapper.checkPreviousProgress(boCpslmknVO);
|
||||
|
||||
if (progressInfo != null) {
|
||||
// 진행 상태 고유번호 설정
|
||||
boCpslmknVO.setBnfSttusInnb(Long.valueOf(String.valueOf(progressInfo.get("bnfSttusInnb"))));
|
||||
|
||||
// 진행 내역 삭제
|
||||
boCpslmknMapper.deleteProgress(boCpslmknVO);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 알림 설정을 변경합니다.
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보와 알림 동의 여부(agreAt), 쇼핑몰 코드(sopmalCd)가 담긴 VO
|
||||
* @return 설정 변경 성공 여부 및 메시지
|
||||
*/
|
||||
public DataMap updateNotificationSettings(BOCpslmknVO boCpslmknVO) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
try {
|
||||
// 1. 현재 알림 설정 정보 조회
|
||||
DataMap currentSettings = boCpslmknMapper.selectCpslmknSettingsInfo(boCpslmknVO);
|
||||
|
||||
// 2. 알림 설정 저장 또는 업데이트
|
||||
// agreAt 값이 전달되지 않은 경우 기본값으로 'Y' 설정
|
||||
if (boCpslmknVO.getAgreAt() == null || boCpslmknVO.getAgreAt().isEmpty()) {
|
||||
boCpslmknVO.setAgreAt("Y");
|
||||
}
|
||||
|
||||
// 혜택 설정 고유번호가 없는 경우, 기본값 설정 (캡슐만들기)
|
||||
if (boCpslmknVO.getBnfInnb() == null) {
|
||||
// 혜택 정보가 존재하는 경우 기존 값 사용, 없으면 null 값으로 진행
|
||||
if (currentSettings != null && currentSettings.get("bnfInnb") != null) {
|
||||
boCpslmknVO.setBnfInnb(Long.valueOf(String.valueOf(currentSettings.get("bnfInnb"))));
|
||||
}
|
||||
}
|
||||
|
||||
// 알림 설정 저장
|
||||
boCpslmknMapper.upsertNotificationSetting(boCpslmknVO);
|
||||
|
||||
// 3. 변경된 설정 정보 조회
|
||||
DataMap updatedSettings = boCpslmknMapper.selectCpslmknSettingsInfo(boCpslmknVO);
|
||||
|
||||
// 결과 설정
|
||||
result.put("success", true);
|
||||
result.put("message", "알림 설정이 성공적으로 변경되었습니다.");
|
||||
result.put("settings", updatedSettings);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("알림 설정 변경 중 오류 발생: {}", e.getMessage(), e);
|
||||
result.put("success", false);
|
||||
result.put("message", "알림 설정 변경 중 오류가 발생했습니다: " + e.getMessage());
|
||||
result.put("errorCode", "NOTIFICATION_SETTINGS_ERROR");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 초록잎 보유 현황과 사용/획득 내역을 조회합니다.
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보가 담긴 VO (페이징 정보 포함)
|
||||
* @return 보유 초록잎 개수와 내역이 포함된 응답 객체
|
||||
*/
|
||||
public DataMap getLeafStatusAndHistory(BOCpslmknVO boCpslmknVO) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 1. 현재 보유 초록잎 개수 조회
|
||||
int ownedLeafCount = boCpslmknMapper.selectOwnedLeafCount(boCpslmknVO);
|
||||
result.put("ownedLeafCount", ownedLeafCount);
|
||||
|
||||
// 2. 최근 6개월간의 초록잎 생성/사용 내역 조회 (페이징 처리)
|
||||
List<DataMap> history = boCpslmknMapper.selectLeafHistory(boCpslmknVO);
|
||||
result.put("history", history);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 알림 설정 안내문 조회
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 안내문 조회 결과
|
||||
*/
|
||||
public DataMap getImportantNotice(BOCpslmknVO vo) {
|
||||
return boCpslmknMapper.selectImportantNotice(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 알림 설정 정보 조회
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 알림 설정 정보
|
||||
*/
|
||||
public DataMap getNotificationSettings(BOCpslmknVO vo) {
|
||||
return boCpslmknMapper.selectCpslmknSettingsInfo(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 게임 알림 조회
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 게임 안내 정보
|
||||
*/
|
||||
public DataMap getCapsuleGameInfo(BOCpslmknVO vo) {
|
||||
return boCpslmknMapper.selectCapsuleGameInfo(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 게임 리셋
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 게임 리셋 결과
|
||||
*/
|
||||
public DataMap capsuleGameReset(BOCpslmknVO vo) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 1. 게임 리셋
|
||||
int resetResult = boCpslmknMapper.resetCapsuleGame(vo);
|
||||
|
||||
if (resetResult > 0) {
|
||||
result.put("success", true);
|
||||
result.put("message", "게임이 성공적으로 리셋되었습니다.");
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "게임 리셋 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 오늘의 스페셜 이벤트 조회
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 오늘의 스페셜 이벤트 정보
|
||||
*/
|
||||
public List<DataMap> getTodaySpecialEvents(BOCpslmknVO vo) {
|
||||
return boCpslmknMapper.selectTodaySpecialEvents(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 이벤트 목록 조회 (스페셜 포함)
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 전체 이벤트 목록
|
||||
*/
|
||||
public List<DataMap> getLeafEventList(BOCpslmknVO vo) {
|
||||
return boCpslmknMapper.selectLeafEventList(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 보유 초록잎 개수 조회
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 보유 초록잎 개수
|
||||
*/
|
||||
public int getOwnedLeafCount(BOCpslmknVO vo) {
|
||||
return boCpslmknMapper.selectOwnedLeafCount(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 초록잎 이벤트 총 지급 개수 조회
|
||||
*
|
||||
* @param vo 회원 정보가 담긴 VO
|
||||
* @return 총 지급 개수
|
||||
*/
|
||||
public int getTotalLeafEventPaymentCount(BOCpslmknVO vo) {
|
||||
return boCpslmknMapper.selectTotalLeafEventPaymentCount(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 쿠폰 실제 등록 처리
|
||||
* @param vo 캡슐만들기 VO
|
||||
*/
|
||||
private void registerCoupon(BOCpslmknVO vo) {
|
||||
try {
|
||||
BODwldCouponVO couponVo = new BODwldCouponVO();
|
||||
couponVo.setSopmalCd(vo.getSopmalCd());
|
||||
couponVo.setMbrInnb(vo.getMbrInnb());
|
||||
couponVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
// BigInteger를 Integer로 안전하게 변환
|
||||
if (vo.getCouponInnb() != null) {
|
||||
couponVo.setCouponSndngInnb(vo.getCouponInnb().intValue());
|
||||
}
|
||||
couponVo.setBnfRcvInnb(vo.getBnfRcvInnb());
|
||||
|
||||
boolean success = benefitRewardService.issueCoupon(couponVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("캡슐만들기 쿠폰 등록 요청 성공: {}", vo.getCouponInnb());
|
||||
} else {
|
||||
log.error("캡슐만들기 쿠폰 등록 요청 실패: {}", vo.getCouponInnb());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerCoupon 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 캡슐 만들기 게임 완료 처리 (5단계 완료 시에만 사용)
|
||||
*
|
||||
* @param boCpslmknVO 회원 정보와 혜택 정보가 담긴 VO
|
||||
* @return 완료 처리 결과
|
||||
*/
|
||||
public DataMap completeGame(BOCpslmknVO boCpslmknVO) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
try {
|
||||
log.debug("=== 게임 완료 처리 시작 ===");
|
||||
log.debug("회원번호: {}, 혜택번호: {}, 상태번호: {}",
|
||||
boCpslmknVO.getMbrInnb(), boCpslmknVO.getBnfInnb(), boCpslmknVO.getBnfSttusInnb());
|
||||
|
||||
// 완료 처리 실행
|
||||
int updateResult = boCpslmknMapper.completeGame(boCpslmknVO);
|
||||
|
||||
if (updateResult > 0) {
|
||||
result.put("success", true);
|
||||
result.put("message", "게임이 성공적으로 완료되었습니다.");
|
||||
log.debug("게임 완료 처리 성공 - 영향받은 행 수: {}", updateResult);
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "게임 완료 처리 중 오류가 발생했습니다. (조건 불일치)");
|
||||
log.warn("게임 완료 처리 실패 - 영향받은 행 수: 0 (조건 불일치)");
|
||||
}
|
||||
|
||||
log.debug("=== 게임 완료 처리 종료 ===");
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("게임 완료 처리 중 오류 발생: {}", e.getMessage(), e);
|
||||
result.put("success", false);
|
||||
result.put("message", "게임 완료 처리 중 시스템 오류가 발생했습니다.");
|
||||
result.put("errorCode", "GAME_COMPLETE_ERROR");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.cpslmkn.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BOCpslmknVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 혜택 초록잎 사용내역 고유번호 */
|
||||
private Long bnfSttusInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 회원 고유번호 */
|
||||
private int mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 진행 여부 */
|
||||
private String progrsAt;
|
||||
/** 진행 단계 */
|
||||
private Integer progrsStep;
|
||||
/** 총 사용 초록잎 개수 */
|
||||
private Integer totUseLeafCnt;
|
||||
/** 사용 초록잎 개수 */
|
||||
private Integer useLeafCnt;
|
||||
/** 상품 고유번호 */
|
||||
private Long goodsInnb;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 보상 상품 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
/** 마일리지 금액 */
|
||||
private Double mlgRwdAmt;
|
||||
/** 쿠폰 고유번호 */
|
||||
private BigInteger couponInnb;
|
||||
/** 화면표시여부 */
|
||||
private String indictAt;
|
||||
/** 스페셜 여부 */
|
||||
private String specialAt;
|
||||
/** 지급 개수 */
|
||||
private Integer pymntCnt;
|
||||
/** 스페셜 개수 */
|
||||
private Integer specialCnt;
|
||||
/** 동의 여부 */
|
||||
private String agreAt;
|
||||
/** 혜택 초록잎 사용내역 고유번호 */
|
||||
private int bnfUseleafInnb;
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 보상 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
/** 페이징 - 오프셋 */
|
||||
private Integer offset;
|
||||
/** 페이징 - 리미트 */
|
||||
private Integer limit;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.discshar.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.discshar.service.BODiscsharService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.discshar.vo.BODiscsharVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
public class BODiscsharController {
|
||||
|
||||
@Autowired
|
||||
private BODiscsharService service;
|
||||
|
||||
/**
|
||||
* 할인소식 공유 혜택 정<><ECA095><EFBFBD> 조회
|
||||
*
|
||||
* @param vo BODiscSharVO 객체
|
||||
* @return ResponseEntity<Map<String, Object>> 응답 엔티티
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectDiscsharBenefitInfo")
|
||||
public ResponseEntity<Map<String, Object>> selectDiscSharBenefitInfo(@RequestBody BODiscsharVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(String.valueOf(user.getUserInnb()));
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectDiscSharBenefitInfo BODiscSharVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.selectDiscsharBenefitInfo(vo);
|
||||
log.debug("selectDiscSharBenefitInfo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 할인소식 링크 복사
|
||||
*
|
||||
* @param vo BODiscSharVO 객체
|
||||
* @return ResponseEntity<Map<String, Object>> 응답 엔티티
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/copyDiscsharLink")
|
||||
public ResponseEntity<Map<String, Object>> copyDiscsharLink(@RequestBody BODiscsharVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(String.valueOf(user.getUserInnb()));
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("copyDiscsharLink BODiscSharVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.copyDiscsharLink(vo);
|
||||
log.debug("copyDiscsharLink content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 할인소식 공유 결과 확인
|
||||
*
|
||||
* @param vo BODiscSharVO 객체
|
||||
* @return ResponseEntity<Map<String, Object>> 응답 엔티티
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/checkDiscsharResult")
|
||||
public ResponseEntity<Map<String, Object>> checkDiscsharResult(@RequestBody BODiscsharVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(String.valueOf(user.getUserInnb()));
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("checkDiscsharResult BODiscSharVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.checkDiscsharResult(vo);
|
||||
log.debug("checkDiscsharResult content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.discshar.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.discshar.vo.BODiscsharVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BODiscsharMapper {
|
||||
|
||||
/**
|
||||
* 할인소식 공유 혜택 정보를 조회합니다.
|
||||
*
|
||||
* @param vo 할인소식 공유 VO
|
||||
* @return 할인소식 공유 혜택 정보 리스트
|
||||
*/
|
||||
List<DataMap> selectDiscsharBenefitInfo(BODiscsharVO vo);
|
||||
|
||||
/**
|
||||
* 할인소식 공유 링크 정보를 조회합니다.
|
||||
*
|
||||
* @param bnfInnb 혜택 설정 고유번호
|
||||
* @return 할인소식 공유 링크 정보
|
||||
*/
|
||||
List<DataMap> getDiscsharLinkInfo(BODiscsharVO vo);
|
||||
|
||||
/**
|
||||
* 할인소식 공유 링크의 만료 날짜를 조회합니다.
|
||||
*
|
||||
* @param bnfInnb 혜택 설정 고유번호
|
||||
* @return 할인소식 공유 링크 만료 날짜
|
||||
*/
|
||||
String getDiscsharExpiryDate(Long bnfInnb);
|
||||
|
||||
/**
|
||||
* 할인소식 공유로 인한 구매 여부를 확인합니다.
|
||||
*
|
||||
* @param vo 할인소식 공유 VO
|
||||
* @return 구매 건수
|
||||
*/
|
||||
int checkDiscsharPurchase(BODiscsharVO vo);
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.discshar.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.discshar.mapper.BODiscsharMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.discshar.vo.BODiscsharVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BODiscsharService {
|
||||
|
||||
@Autowired
|
||||
private BODiscsharMapper mapper;
|
||||
private final WebClient webClient;
|
||||
|
||||
// @Value("${url.resource.server.product}")
|
||||
private String productServerUrl;
|
||||
|
||||
/**
|
||||
* 할인소식 공유 혜택 정보를 조회합니다.
|
||||
*
|
||||
* @param vo 할인소식 공유 VO
|
||||
* @return 할인소식 공유 혜택 정보를 포함한 Map
|
||||
*/
|
||||
public Map<String, Object> selectDiscsharBenefitInfo(BODiscsharVO vo) {
|
||||
List<DataMap> list = mapper.selectDiscsharBenefitInfo(vo);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", list);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 할인소식 공유 링크를 복사합니다.
|
||||
*
|
||||
* @param vo 할인소식 공유 VO
|
||||
* @return 링크 복사 결과를 포함한 Map
|
||||
*/
|
||||
public Map<String, Object> copyDiscsharLink(BODiscsharVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
List<Map<String, Object>> processedLinks = new ArrayList<>();
|
||||
|
||||
try {
|
||||
List<DataMap> linkInfoList = mapper.getDiscsharLinkInfo(vo);
|
||||
log.debug("Retrieved {} link info records", linkInfoList.size());
|
||||
|
||||
if (linkInfoList.isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "No link information found");
|
||||
return result;
|
||||
}
|
||||
|
||||
for (DataMap linkInfo : linkInfoList) {
|
||||
Map<String, Object> processedLink = new HashMap<>();
|
||||
|
||||
// 알려진 키들을 사용하여 DataMap의 데이터를 새 Map으로 복사
|
||||
processedLink.put("bnfInnb", linkInfo.get("bnfInnb"));
|
||||
processedLink.put("linkUrl", linkInfo.get("linkUrl"));
|
||||
processedLink.put("validDt", linkInfo.get("validDt"));
|
||||
processedLink.put("dscntRt", linkInfo.get("dscntRt"));
|
||||
processedLink.put("dscntAmt", linkInfo.get("dscntAmt"));
|
||||
processedLink.put("mlgRwdAmt", linkInfo.get("mlgRwdAmt"));
|
||||
|
||||
String baseUrl = (String) linkInfo.get("linkUrl");
|
||||
if (baseUrl == null) {
|
||||
log.warn("Base URL is null for link info: {}", linkInfo);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!baseUrl.endsWith("?")) {
|
||||
baseUrl += "?";
|
||||
}
|
||||
|
||||
StringBuilder urlBuilder = new StringBuilder(baseUrl);
|
||||
urlBuilder.append("bnf=").append(linkInfo.get("bnfInnb"));
|
||||
urlBuilder.append("&sharer=").append(vo.getMbrInnb());
|
||||
|
||||
// 유효기간 추가 (있을 경우에만)
|
||||
if (linkInfo.get("validDt") != null) {
|
||||
urlBuilder.append("&valid=").append(linkInfo.get("validDt"));
|
||||
}
|
||||
|
||||
// 할인 정보 추가
|
||||
if (linkInfo.get("dscntRt") != null) {
|
||||
urlBuilder.append("&discountRate=").append(linkInfo.get("dscntRt"));
|
||||
}
|
||||
if (linkInfo.get("dscntAmt") != null) {
|
||||
urlBuilder.append("&discountAmount=").append(linkInfo.get("dscntAmt"));
|
||||
}
|
||||
|
||||
// 보상 정보 추가
|
||||
if (linkInfo.get("mlgRwdAmt") != null) {
|
||||
urlBuilder.append("&reward=").append(linkInfo.get("mlgRwdAmt"));
|
||||
}
|
||||
|
||||
processedLink.put("uniqueUrl", urlBuilder.toString());
|
||||
processedLinks.add(processedLink);
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("links", processedLinks);
|
||||
} catch (Exception e) {
|
||||
log.error("Error in copyDiscsharLink", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "Error processing link information: " + e.getMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 할인소식 공유 결과를 확인합니다.
|
||||
*
|
||||
* @param vo 할인소식 공유 VO
|
||||
* @return 공유 결과를 포함한 Map
|
||||
*/
|
||||
public Map<String, Object> checkDiscsharResult(BODiscsharVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
boolean hasPurchase = mapper.checkDiscsharPurchase(vo) > 0;
|
||||
result.put("hasPurchase", hasPurchase);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 할인소식 공유 VO
|
||||
*/
|
||||
private void registerMileage(BODiscsharVO vo) {
|
||||
try {
|
||||
// bnfRcvInnb가 없으면 처리하지 않음
|
||||
if (vo.getBnfRcvInnb() == null) {
|
||||
log.error("마일리지 등록 실패: bnfRcvInnb 값이 필요합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Object> mlgParams = new HashMap<>();
|
||||
mlgParams.put("sopmalCd", vo.getSopmalCd());
|
||||
mlgParams.put("mbrInnb", vo.getMbrInnb());
|
||||
mlgParams.put("mbrDvCd", vo.getMbrDvCd());
|
||||
mlgParams.put("mlgApplcDvCd", "07"); // 무조건 "07" 코드 사용
|
||||
mlgParams.put("mlgApplcResn", "할인소식 공유 보상");
|
||||
mlgParams.put("accmlmnyAmt", vo.getMlgRwdAmt());
|
||||
mlgParams.put("mlgValidPdAt", "Y"); // 유효기간 제한 여부
|
||||
mlgParams.put("mlgValidPd", 36); // 36개월 유효기간
|
||||
mlgParams.put("usePosblEndDt", ""); // 사용가능 종료일시 (공백은 기본값 사용)
|
||||
mlgParams.put("bnfRcvInnb", vo.getBnfRcvInnb()); // 혜택 보상 내역 고유번호
|
||||
|
||||
webClient.post()
|
||||
.uri(productServerUrl + "/gcone/mbr/mlg/insertBOMlgAdd")
|
||||
.bodyValue(mlgParams)
|
||||
.retrieve()
|
||||
.bodyToMono(Map.class)
|
||||
.block();
|
||||
|
||||
log.debug("마일리지 등록 완료: {}", vo.getMlgRwdAmt());
|
||||
} catch (Exception e) {
|
||||
log.error("마일리지 등록 실패", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 쿠폰 실제 등록 처리
|
||||
* @param vo 할인소식 공유 VO
|
||||
*/
|
||||
private void registerCoupon(BODiscsharVO vo) {
|
||||
try {
|
||||
// bnfRcvInnb가 없으면 처리하지 않음
|
||||
if (vo.getBnfRcvInnb() == null) {
|
||||
log.error("쿠폰 등록 실패: bnfRcvInnb 값이 필요합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Object> couponParams = new HashMap<>();
|
||||
couponParams.put("sopmalCd", vo.getSopmalCd());
|
||||
couponParams.put("mbrInnb", vo.getMbrInnb());
|
||||
couponParams.put("mbrDvCd", vo.getMbrDvCd());
|
||||
couponParams.put("couponSndngInnb", vo.getCouponInnb()); // 쿠폰 발송 고유번호
|
||||
couponParams.put("bnfRcvInnb", vo.getBnfRcvInnb()); // 혜택 보상 내역 고유번호
|
||||
|
||||
webClient.post()
|
||||
.uri(productServerUrl + "/gcone/promtn/coupon/insertBOBnfCouponReg")
|
||||
.bodyValue(couponParams)
|
||||
.retrieve()
|
||||
.bodyToMono(Map.class)
|
||||
.block();
|
||||
|
||||
log.debug("쿠폰 등록 완료: {}", vo.getCouponInnb());
|
||||
} catch (Exception e) {
|
||||
log.error("쿠폰 등록 실패", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.discshar.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BODiscsharVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 혜택 제목 */
|
||||
private String bnfSj;
|
||||
/** 진행기간 시작일시 */
|
||||
private Date bnfBgnDt;
|
||||
/** 진행기간 종료일시 */
|
||||
private Date bnfEndDt;
|
||||
/** 화면 대표 이미지 */
|
||||
private String scrReprsntImg;
|
||||
/** 화면 대표 링크 URL */
|
||||
private String scrReprsntLinkUrl;
|
||||
/** 혜택 안내 */
|
||||
private String bnfWordsCn;
|
||||
/** 내용 제목 */
|
||||
private String cnSj;
|
||||
/** 내용 설명 */
|
||||
private String cnDc;
|
||||
/** 링크 */
|
||||
private String linkUrl;
|
||||
/** 이미지파일경로 */
|
||||
private String imgFilCours;
|
||||
/** 이미지파일명 */
|
||||
private String imgFilNm;
|
||||
/** 유효일시 */
|
||||
private Date validDt;
|
||||
/** 시간(초) */
|
||||
private Integer tmeSecnd;
|
||||
/** 할인구분코드 */
|
||||
private String dscntUnitDvCd;
|
||||
/** 할인금액 */
|
||||
private Double dscntAmt;
|
||||
/** 할인율 */
|
||||
private Double dscntRt;
|
||||
/** 회원 고유번호 */
|
||||
private String mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 마일리지 금액 */
|
||||
private String mlgRwdAmt;
|
||||
/** 혜택 보상 내역 고유번호 */
|
||||
private Long bnfRcvInnb;
|
||||
/** 쿠폰 발송 고유번호 */
|
||||
private Long couponInnb;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.evntview.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.evntview.service.BOEvntViewService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.evntview.vo.BOEvntViewVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
public class BOEvntViewController {
|
||||
|
||||
@Autowired
|
||||
private BOEvntViewService service;
|
||||
|
||||
/**
|
||||
* 이벤트 보기 혜택 상세 정보 조회
|
||||
*
|
||||
* @param vo 이벤트 보기 VO(수정)
|
||||
* @return 이벤트 정보 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/getEventDetail", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getEventDetail(@RequestBody BOEvntViewVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getEventDetail BOEvntViewVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.getEventViewBenefitDetail(vo);
|
||||
|
||||
log.debug("getEventDetail content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이벤트 참여 및 마일리지 적립 처리 작업
|
||||
*
|
||||
* @param vo 이벤트 보기 VO
|
||||
* @return 참여 결과 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/participateEvent", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> participateEvent(@RequestBody BOEvntViewVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("participateEvent BOEvntViewVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.participateEventAndAccumulateMileage(vo);
|
||||
|
||||
log.debug("participateEvent content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이벤트 참여 가능 여부 확인
|
||||
*
|
||||
* @param vo 이벤트 보기 VO
|
||||
* @return 참여 가능 여부 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/checkParticipationAvailable", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> checkParticipationAvailable(@RequestBody BOEvntViewVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("checkParticipationAvailable BOEvntViewVO chk ::: {}", vo);
|
||||
|
||||
boolean isAvailable = service.isEventParticipationAvailable(vo);
|
||||
|
||||
Map<String, Object> content = Map.of("available", isAvailable);
|
||||
|
||||
log.debug("checkParticipationAvailable content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.evntview.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.atend.vo.BOAtendVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.evntview.vo.BOEvntViewVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BOEvntViewMapper {
|
||||
|
||||
/** 이벤트 보기 혜택 기본 정보 조회 */
|
||||
List<DataMap> selectEventViewBenefitInfoAndContent(BOEvntViewVO params);
|
||||
|
||||
/** 이벤트 보기 혜택 참여 정보 삽입 */
|
||||
int insertEventViewBenefitParticipation(BOEvntViewVO params);
|
||||
|
||||
/** 이벤트 보기 혜택 보상 정보 조회 */
|
||||
DataMap selectEventViewBenefitRewards(BOEvntViewVO params);
|
||||
|
||||
/** 이벤트 보기 마일리지 적립 여부 확인 */
|
||||
int checkMileageAccumulation(BOEvntViewVO params);
|
||||
|
||||
/** 이벤트 보기 마일리지 적립 정보 삽입 */
|
||||
int insertEventViewMileageAccumulation(BOEvntViewVO params);
|
||||
|
||||
/** 초록잎 지급 개수 조회 */
|
||||
DataMap selectLeafCounts(BOEvntViewVO vo);
|
||||
|
||||
/** 이벤트 유효성 검증 (날짜 체크) */
|
||||
int checkEventValidation(BOEvntViewVO params);
|
||||
|
||||
/** 이벤트 보기 안내문 조회 */
|
||||
DataMap selectEventViewInstruction(BOEvntViewVO params);
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.evntview.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.evntview.mapper.BOEvntViewMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.evntview.vo.BOEvntViewVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.vo.BODwldCouponVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BOEvntViewService {
|
||||
|
||||
@Autowired
|
||||
private BOEvntViewMapper mapper;
|
||||
|
||||
private final WebClient webClient;
|
||||
|
||||
@Autowired
|
||||
private BenefitRewardService benefitRewardService;
|
||||
|
||||
/**
|
||||
* 이벤트 보기 혜택 상세 정보 조회
|
||||
* 이벤트 기본 정보와 보상 정보를 함께 조회
|
||||
*/
|
||||
public Map<String, Object> getEventViewBenefitDetail(BOEvntViewVO vo) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
// 이벤트 보기 혜택 기본 정보 조회
|
||||
List<DataMap> benefitInfo = mapper.selectEventViewBenefitInfoAndContent(vo);
|
||||
resultMap.put("benefitInfo", benefitInfo);
|
||||
|
||||
// 이벤트 보기 안내문 조회
|
||||
DataMap instruction = mapper.selectEventViewInstruction(vo);
|
||||
resultMap.put("instruction", instruction);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이벤트 보기 참여 및 마일리지 적립 처리
|
||||
* 중복 참여 체크 후 마일리지 적립 처리
|
||||
*/
|
||||
public Map<String, Object> participateEventAndAccumulateMileage(BOEvntViewVO vo) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
boolean isSuccess = false;
|
||||
String message = "";
|
||||
|
||||
try {
|
||||
// 1. 이벤트 유효성 검증 (날짜 체크)
|
||||
int validEventCount = mapper.checkEventValidation(vo);
|
||||
if (validEventCount == 0) {
|
||||
message = "종료된 이벤트이거나 진행 중이지 않은 이벤트입니다.";
|
||||
resultMap.put("success", isSuccess);
|
||||
resultMap.put("message", message);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
// 2. 중복 참여 체크
|
||||
int alreadyParticipated = mapper.checkMileageAccumulation(vo);
|
||||
|
||||
if (alreadyParticipated > 0) {
|
||||
message = "이미 참여한 이벤트입니다.";
|
||||
} else {
|
||||
|
||||
// 초록잎 지급 처리
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
int paidLeafCnt = 0;
|
||||
int specialLeafCnt = 0;
|
||||
int totalLeafCnt = 0;
|
||||
|
||||
if (leafCounts != null) {
|
||||
paidLeafCnt = leafCounts.get("pymntCnt") != null ? ((Number) leafCounts.get("pymntCnt")).intValue() : 0;
|
||||
specialLeafCnt = leafCounts.get("specialCnt") != null ? ((Number) leafCounts.get("specialCnt")).intValue() : 0;
|
||||
totalLeafCnt = paidLeafCnt + specialLeafCnt;
|
||||
} else {
|
||||
log.warn("초록잎 개수 조회 결과가 null입니다. 기본값 0으로 설정합니다.");
|
||||
}
|
||||
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
|
||||
// 이벤트 참여 정보 등록
|
||||
mapper.insertEventViewBenefitParticipation(vo);
|
||||
|
||||
// 이벤트 보상 정보 조회
|
||||
DataMap rewardInfo = mapper.selectEventViewBenefitRewards(vo);
|
||||
|
||||
if (rewardInfo != null) {
|
||||
// 마일리지 적립 금액 설정
|
||||
// BigDecimal로 타입 변환하여 ClassCastException 방지
|
||||
Object mlgRwdAmtObj = rewardInfo.get("mlgRwdAmt");
|
||||
if (mlgRwdAmtObj instanceof BigDecimal) {
|
||||
vo.setMlgRwdAmt((BigDecimal) mlgRwdAmtObj);
|
||||
} else {
|
||||
vo.setMlgRwdAmt((BigDecimal) mlgRwdAmtObj);
|
||||
}
|
||||
|
||||
log.debug("bnfPrtInnb : {}", vo.getBnfPrtInnb());
|
||||
|
||||
// 마일리지 적립 정보 등록
|
||||
mapper.insertEventViewMileageAccumulation(vo);
|
||||
|
||||
log.debug("bnfRcvInnb : {}", vo.getBnfRcvInnb());
|
||||
|
||||
// WebClient를 통한 마일리지 실제 등록 처리
|
||||
registerMileage(vo);
|
||||
|
||||
isSuccess = true;
|
||||
message = "마일리지가 적립되었습니다.";
|
||||
} else {
|
||||
message = "마일리지 적립 정보가 없습니다.";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("마일리지 적립 중 오류 발생: ", e);
|
||||
message = "마일리지 적립 중 오류가 발생했습니다: " + e.getMessage();
|
||||
}
|
||||
|
||||
resultMap.put("success", isSuccess);
|
||||
resultMap.put("message", message);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이벤트 참여 가능 여부 확인
|
||||
*/
|
||||
public boolean isEventParticipationAvailable(BOEvntViewVO vo) {
|
||||
int count = mapper.checkMileageAccumulation(vo);
|
||||
return count == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 이벤트 보기 VO
|
||||
*/
|
||||
private void registerMileage(BOEvntViewVO vo) {
|
||||
try {
|
||||
BOMlgVO mlgVo = new BOMlgVO();
|
||||
mlgVo.setSopmalCd(vo.getSopmalCd());
|
||||
mlgVo.setMbrInnb(String.valueOf(vo.getMbrInnb()));
|
||||
mlgVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
mlgVo.setAccmlmnyAmt(vo.getMlgRwdAmt());
|
||||
mlgVo.setBnfRcvInnb(String.valueOf(vo.getBnfRcvInnb()));
|
||||
|
||||
// 마일리지 적용 구분 코드 및 사유 설정
|
||||
mlgVo.setMlgApplcDvCd("07");
|
||||
mlgVo.setMlgApplcResn("이벤트보기 보상");
|
||||
|
||||
boolean success = benefitRewardService.issueMileage(mlgVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("이벤트보기 마일리지 등록 요청 성공: {}", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
log.error("이벤트보기 마일리지 등록 요청 실패: {}", vo.getMlgRwdAmt());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerMileage 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.evntview.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOEvntViewVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 혜택 제목 */
|
||||
private String bnfSj;
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 진행기간 시작일시 */
|
||||
private Date bnfBgnDt;
|
||||
/** 진행기간 종료일시 */
|
||||
private Date bnfEndDt;
|
||||
/** 화면 대표 이미지 */
|
||||
private String scrReprsntImg;
|
||||
/** 화면 대표 링크 URL */
|
||||
private String scrReprsntLinkUrl;
|
||||
/** 혜택 안내 */
|
||||
private String bnfWordsCn;
|
||||
/** 내용 제목 */
|
||||
private String cnSj;
|
||||
/** 내용 설명 */
|
||||
private String cnDc;
|
||||
/** 링크 */
|
||||
private String linkUrl;
|
||||
/** 이미지파일경로 */
|
||||
private String imgFilCours;
|
||||
/** 이미지파일명 */
|
||||
private String imgFilNm;
|
||||
/** 유효일시 */
|
||||
private Date validDt;
|
||||
/** 시간(초) */
|
||||
private Integer tmeSecnd;
|
||||
/** 안내내용 */
|
||||
private String wordsCn;
|
||||
/** 사용여부 */
|
||||
private String useAt;
|
||||
/** 회원 고유번호 */
|
||||
private int mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 클라이언트에서 측정한 이벤트 지속 시간 (초) */
|
||||
private Long duration;
|
||||
/** 서버에서 측정한 이벤트 지속 시간 (초) */
|
||||
private Long serverDuration;
|
||||
/** 마일리지 금액 */
|
||||
private BigDecimal mlgRwdAmt;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 리워드 항목 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
/** 초록잎 지급량 */
|
||||
private Integer paidLeafCnt;
|
||||
/** 혜택 보상 내역 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
/** 쿠폰 발송 고유번호 */
|
||||
private Integer couponInnb;
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.hlthset.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.hlthset.service.BOHlthsetService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.hlthset.vo.BOHlthsetVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
public class BOHlthsetController {
|
||||
|
||||
@Autowired
|
||||
private BOHlthsetService service;
|
||||
|
||||
/**
|
||||
* 관심건강분야 설정 정보 조회
|
||||
*
|
||||
* @return 관심건강분야 설정 정보를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectHealthInterestInfo")
|
||||
public ResponseEntity<ApiResponse> selectHealthInterestInfo(@RequestBody BOHlthsetVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectHealthInterestInfo BOHlthsetVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.selectHealthInterestInfo(vo);
|
||||
|
||||
log.debug("selectHealthInterestInfo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 관심분야 저장
|
||||
*
|
||||
* @param vo 사용자 관심분야 정보를 담고 있는 VO
|
||||
* @return 저장 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/saveUserInterests")
|
||||
public ResponseEntity<ApiResponse> saveUserInterests(@RequestBody BOHlthsetVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("saveUserInterests BOHlthsetVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.saveUserInterests(vo);
|
||||
|
||||
log.debug("saveUserInterests content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 관심분야 조회
|
||||
*
|
||||
* @param vo
|
||||
* @return 사용자 관심분야 목록을 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectUserInterests")
|
||||
public ResponseEntity<ApiResponse> selectUserInterests(@RequestBody BOHlthsetVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectUserInterests BOHlthsetVO chk ::: {}", vo);
|
||||
|
||||
List<DataMap> userInterests = service.selectUserInterests(vo);
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("interestAreas", userInterests);
|
||||
|
||||
log.debug("selectUserInterests content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 관심분야 삭제
|
||||
*
|
||||
* @param vo 관심건강분야 설정 VO
|
||||
* @return ResponseEntity<String> 삭제 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/deleteUserInterests")
|
||||
public ResponseEntity<String> deleteUserInterests(@RequestBody BOHlthsetVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("deleteUserInterests BOHlthsetVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.deleteUserInterests(vo);
|
||||
|
||||
log.debug("deleteUserInterests content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 관심분야 저장 상태 및 마일리지 적립 여부 조회
|
||||
*
|
||||
* @param vo 관심건강분야 설정 VO
|
||||
* @return ResponseEntity<DataMap>
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectUserInterestSaveStatus")
|
||||
public ResponseEntity<DataMap> selectUserInterestSaveStatus(@RequestBody BOHlthsetVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectUserInterestSaveStatus BOHlthsetVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.selectUserInterestSaveStatus(vo);
|
||||
|
||||
log.debug("selectUserInterestSaveStatus content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.hlthset.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.hlthset.vo.BOHlthsetVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BOHlthsetMapper {
|
||||
|
||||
/** 관심건강분야 설정 기본 정보 조회 */
|
||||
DataMap selectHealthInterestBasicInfo(BOHlthsetVO vo);
|
||||
|
||||
/** 관심분야 목록 조회 */
|
||||
List<DataMap> selectInterestAreas(BOHlthsetVO vo);
|
||||
|
||||
/** 사용자 기존 관심분야 삭제 */
|
||||
int deleteUserInterestAreas(BOHlthsetVO vo);
|
||||
|
||||
/** 새로운 사용자 관심분야 저장 */
|
||||
void insertUserInterestAreas(List<BOHlthsetVO.InterestArea> interestAreas);
|
||||
|
||||
/** 혜택 참여 정보 삽입 */
|
||||
int insertBenefitParticipation(BOHlthsetVO vo);
|
||||
|
||||
/** 사용자 관심분야 정보 수신 동의 저장 */
|
||||
int insertUserInterestAgreement(BOHlthsetVO vo);
|
||||
|
||||
/** 마일리지 적립 내역 저장 */
|
||||
int insertMileageReward(BOHlthsetVO vo);
|
||||
|
||||
/** 사용자 관심분야 조회 */
|
||||
List<DataMap> selectUserInterests(BOHlthsetVO vo);
|
||||
|
||||
/** 해당 월에 마일리지 보상을 받았는지 확인 */
|
||||
boolean hasMonthlyMileageReward(BOHlthsetVO vo);
|
||||
|
||||
/** 사용자 관심분야 저장 상태 및 마일리지 적립 여부 조회 */
|
||||
DataMap selectUserInterestSaveStatus(BOHlthsetVO vo);
|
||||
|
||||
/** 초록잎 지급 개수 조회 */
|
||||
DataMap selectLeafCounts(BOHlthsetVO vo);
|
||||
|
||||
/** 마지막 관심분야 참여 월 조회 */
|
||||
DataMap selectLastInterestParticipationMonth(BOHlthsetVO vo);
|
||||
|
||||
/** 월별 관심분야 초기화 */
|
||||
void resetMonthlyInterestAreas(BOHlthsetVO vo);
|
||||
|
||||
/** 현재 월 참여 정보 조회 */
|
||||
DataMap selectCurrentMonthParticipation(BOHlthsetVO vo);
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.hlthset.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.hlthset.mapper.BOHlthsetMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.hlthset.vo.BOHlthsetVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BOHlthsetService {
|
||||
|
||||
@Autowired
|
||||
private BOHlthsetMapper mapper;
|
||||
private final WebClient webClient;
|
||||
|
||||
@Autowired
|
||||
private BenefitRewardService benefitRewardService;
|
||||
|
||||
/**
|
||||
* 관심건강분야 설정 정보 조회 (기본 정보 + 목록)
|
||||
*
|
||||
* @return DataMap 관심건강분야 설정 정보
|
||||
*/
|
||||
public DataMap selectHealthInterestInfo(BOHlthsetVO vo) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
// 월별 관심분야 초기화 체크 제거 - 더 이상 삭제하지 않음
|
||||
// checkAndResetMonthlyInterest(vo);
|
||||
|
||||
DataMap basicInfo = mapper.selectHealthInterestBasicInfo(vo);
|
||||
|
||||
result.put("basicInfo", basicInfo);
|
||||
Object bnfInnbObj = basicInfo.get("bnfInnb");
|
||||
if (bnfInnbObj instanceof Number) {
|
||||
vo.setBnfInnb(((Number) bnfInnbObj).longValue());
|
||||
}
|
||||
|
||||
result.put("interestAreas", mapper.selectInterestAreas(vo));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 월별 관심분야 초기화 체크 및 실행
|
||||
* 마지막 참여 월과 현재 월을 비교하여 월이 다르면 관심분야만 초기화
|
||||
*
|
||||
* @param vo 관심건강분야 설정 VO
|
||||
*/
|
||||
private void checkAndResetMonthlyInterest(BOHlthsetVO vo) {
|
||||
try {
|
||||
// 기본 정보에서 bnfInnb 설정
|
||||
DataMap basicInfo = mapper.selectHealthInterestBasicInfo(vo);
|
||||
Object bnfInnbObj = basicInfo.get("bnfInnb");
|
||||
if (bnfInnbObj instanceof Number) {
|
||||
vo.setBnfInnb(((Number) bnfInnbObj).longValue());
|
||||
}
|
||||
|
||||
// 마지막 관심분야 참여 월 조회
|
||||
DataMap lastParticipationData = mapper.selectLastInterestParticipationMonth(vo);
|
||||
String lastParticipationMonth = null;
|
||||
if (lastParticipationData != null && lastParticipationData.get("lastMonth") != null) {
|
||||
lastParticipationMonth = lastParticipationData.get("lastMonth").toString();
|
||||
}
|
||||
|
||||
String currentMonth = java.time.LocalDate.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
|
||||
// 마지막 참여 월과 현재 월이 다르면 관심분야 초기화
|
||||
if (lastParticipationMonth != null && !lastParticipationMonth.equals(currentMonth)) {
|
||||
log.info("월별 관심분야 초기화 실행 - 사용자: {}, 마지막 참여월: {}, 현재월: {}",
|
||||
vo.getMbrInnb(), lastParticipationMonth, currentMonth);
|
||||
|
||||
// 관심분야 데이터만 삭제 (마일리지 적립 내역은 유지)
|
||||
mapper.resetMonthlyInterestAreas(vo);
|
||||
|
||||
log.info("월별 관심분야 초기화 완료 - 사용자: {}", vo.getMbrInnb());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("월별 관심분야 초기화 처리 중 오류 발생", e);
|
||||
// 초기화 실패해도 메인 로직에는 영향 없도록 예외 처리
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 관심분야 저장 또는 수정
|
||||
* 신규/수정 구분하여 처리, 이번달 최초시에만 마일리지/초록잎 지급
|
||||
*
|
||||
* @param vo 관심건강분야 설정 VO
|
||||
* @return Map<String, Object> 저장 결과
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> saveUserInterests(BOHlthsetVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 기본 정보에서 마일리지 금액 조회
|
||||
DataMap basicInfo = mapper.selectHealthInterestBasicInfo(vo);
|
||||
vo.setMlgRwdAmt((BigDecimal) basicInfo.get("mlgRwdAmt"));
|
||||
|
||||
Object bnfInnbObj = basicInfo.get("bnfInnb");
|
||||
if (bnfInnbObj instanceof Number) {
|
||||
vo.setBnfInnb(((Number) bnfInnbObj).longValue());
|
||||
}
|
||||
|
||||
// 이번달 기존 참여 정보 확인
|
||||
DataMap monthlyParticipation = mapper.selectCurrentMonthParticipation(vo);
|
||||
boolean isFirstTimeThisMonth = (monthlyParticipation == null || monthlyParticipation.isEmpty());
|
||||
|
||||
if (isFirstTimeThisMonth) {
|
||||
// 이번달 최초 등록/수정 - 새로운 참여 정보 생성
|
||||
|
||||
// 초록잎 지급
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
int paidLeafCnt = 0;
|
||||
int specialLeafCnt = 0;
|
||||
|
||||
if (leafCounts != null) {
|
||||
Object pymntCntObj = leafCounts.get("pymntCnt");
|
||||
if (pymntCntObj != null) {
|
||||
paidLeafCnt = ((Number) pymntCntObj).intValue();
|
||||
}
|
||||
|
||||
Object specialCntObj = leafCounts.get("specialCnt");
|
||||
if (specialCntObj != null) {
|
||||
specialLeafCnt = ((Number) specialCntObj).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
int totalLeafCnt = paidLeafCnt + specialLeafCnt;
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
|
||||
// 혜택 참여 정보 삽입
|
||||
mapper.insertBenefitParticipation(vo);
|
||||
|
||||
// 마일리지 적립 (이번달 최초)
|
||||
mapper.insertMileageReward(vo);
|
||||
|
||||
// 마일리지 실제 등록 처리
|
||||
registerMileage(vo);
|
||||
|
||||
result.put("mileageAccumulated", true);
|
||||
} else {
|
||||
// 이번달 기존 참여 정보 사용
|
||||
Object bnfPrtInnbObj = monthlyParticipation.get("bnfPrtInnb");
|
||||
if (bnfPrtInnbObj instanceof Number) {
|
||||
vo.setBnfPrtInnb(((Number) bnfPrtInnbObj).longValue());
|
||||
}
|
||||
|
||||
// 기존 관심분야만 삭제 (참여 정보는 유지)
|
||||
mapper.deleteUserInterestAreas(vo);
|
||||
|
||||
result.put("mileageAccumulated", false);
|
||||
}
|
||||
|
||||
// 사용자 관심분야 정보 삽입
|
||||
List<BOHlthsetVO.InterestArea> interestAreas = vo.getInterestAreas();
|
||||
for (BOHlthsetVO.InterestArea area : interestAreas) {
|
||||
area.setBnfPrtInnb(vo.getBnfPrtInnb());
|
||||
}
|
||||
mapper.insertUserInterestAreas(interestAreas);
|
||||
|
||||
// 동의 정보 저장 (필요한 경우)
|
||||
if (vo.getAgreAt() != null && !vo.getAgreAt().isEmpty()) {
|
||||
mapper.insertUserInterestAgreement(vo);
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "관심분야 설정이 완료되었습니다.");
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "관심분야 설정 중 오류가 발생했습니다.");
|
||||
log.error("Error in saveUserInterests", e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 사용자 관심분야 조회 */
|
||||
public List<DataMap> selectUserInterests(BOHlthsetVO vo) {
|
||||
return mapper.selectUserInterests(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 관심분야 삭제
|
||||
*
|
||||
* @param vo 관심건강분야 설정 VO
|
||||
* @return Map<String, Object> 삭제 결과
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> deleteUserInterests(BOHlthsetVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int deletedCount = mapper.deleteUserInterestAreas(vo);
|
||||
|
||||
if (deletedCount > 0) {
|
||||
result.put("success", true);
|
||||
result.put("message", "관심분야가 성공적으로 삭제되었습니다.");
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "삭제할 관심분야가 없습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "관심분야 삭제 중 오류가 발생했습니다.");
|
||||
log.error("Error in deleteUserInterests", e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 관심분야 저장 상태 및 마일리지 적립 여부 조회
|
||||
*
|
||||
* @param vo 관심건강분야 설정 VO
|
||||
* @return 저장 상태 및 마일리지 적립 여부
|
||||
*/
|
||||
public DataMap selectUserInterestSaveStatus(BOHlthsetVO vo) {
|
||||
return mapper.selectUserInterestSaveStatus(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 관심건강분야 설정 VO
|
||||
*/
|
||||
private void registerMileage(BOHlthsetVO vo) {
|
||||
try {
|
||||
BOMlgVO mlgVo = new BOMlgVO();
|
||||
mlgVo.setSopmalCd(vo.getSopmalCd());
|
||||
mlgVo.setMbrInnb(String.valueOf(vo.getMbrInnb()));
|
||||
mlgVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
mlgVo.setAccmlmnyAmt(vo.getMlgRwdAmt());
|
||||
mlgVo.setBnfRcvInnb(String.valueOf(vo.getBnfRcvInnb()));
|
||||
|
||||
// 마일리지 적용 구분 코드 및 사유 설정
|
||||
mlgVo.setMlgApplcDvCd("07");
|
||||
mlgVo.setMlgApplcResn("관심건강분야 보상");
|
||||
|
||||
boolean success = benefitRewardService.issueMileage(mlgVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("관심건강분야 마일리지 등록 요청 성공: {}", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
log.error("관심건강분야 마일리지 등록 요청 실패: {}", vo.getMlgRwdAmt());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerMileage 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.hlthset.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOHlthsetVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 회원 고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 보상수령 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
/** 마일리지 보상 금액 */
|
||||
private BigDecimal mlgRwdAmt;
|
||||
/** 동의 여부 */
|
||||
private String agreAt;
|
||||
/** 선택된 관심분야 목록 */
|
||||
private List<InterestArea> interestAreas;
|
||||
/** 초록잎 지급량 */
|
||||
private Integer paidLeafCnt;
|
||||
/** 쿠폰 발송 고유번호 */
|
||||
private BigInteger couponInnb;
|
||||
|
||||
@Data
|
||||
public static class InterestArea {
|
||||
private Long bnfIntrstInnb;
|
||||
private Long bnfPrtInnb;
|
||||
private boolean selected;
|
||||
// 필요한 경우 추가 필드
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,493 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.intakchl.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.service.BOGnrlbbscttService;
|
||||
import com.wb.domainserver.domain.gcone.bbs.gnrlbbsctt.vo.BOGnrlbbscttVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.atend.vo.BOAtendVO;
|
||||
import com.wb.domainserver.domain.gcone.bnft.intakchl.service.BOIntakchlService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.intakchl.vo.BOIntakchlVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.service.BOMbrService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOWishVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
@RequiredArgsConstructor
|
||||
public class BOIntakchlController {
|
||||
|
||||
@Autowired
|
||||
private final BOIntakchlService service;
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 정보 조회
|
||||
*
|
||||
* @param vo 섭취 챌린지 정보 조회 조건을 담고 있는 VO
|
||||
* @return 섭취 챌린지 정보를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectIntakchlInfo")
|
||||
public ResponseEntity<String> selectIntakchlInfo(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectIntakchlInfo BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
// 섭취 챌린지 화면 정보 조회
|
||||
List<DataMap> resultList = null;
|
||||
|
||||
resultList = service.selectIntakchlScreenInfo(vo);
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("resultList", resultList);
|
||||
|
||||
log.debug("selectIntakchlInfo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 상품 추가
|
||||
*
|
||||
* @param vo 삼품추가 조건을 담고 있는 VO
|
||||
* @return 상품추가 성공 여부 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/addSelectedProducts", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> addSelectedProducts(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("addSelectedProducts BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.addSelectedProducts(vo);
|
||||
|
||||
log.debug("addSelectedProducts content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 챌린지 중인 제품 목록 조회
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return 챌린지 중인 제품 목록을 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectCurrentChallengeProducts", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> selectCurrentChallengeProducts(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectCurrentChallengeProducts BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.selectCurrentChallengeProducts(vo);
|
||||
|
||||
log.debug("selectCurrentChallengeProducts content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회 입니다
|
||||
*
|
||||
* @param vo 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회 조건을 담고 있는 VO
|
||||
* @return 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectDailyTotalIntakeRecord", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> selectDailyTotalIntakeRecord(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectDailyTotalIntakeRecord BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.selectDailyTotalIntakeRecord(vo);
|
||||
|
||||
log.debug("selectDailyTotalIntakeRecord content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회
|
||||
*
|
||||
* @param vo 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회 조건을 담고 있는 VO
|
||||
* @return 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectDailyIntakeRecordsDetail", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> selectDailyIntakeRecordsDetail(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectDailyIntakeRecordsDetail BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.selectDailyTotalIntakeRecord(vo);
|
||||
|
||||
log.debug("selectDailyIntakeRecordsDetail content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 상태 업데이트
|
||||
*
|
||||
* @param vo 섭취 상태 업데이트 조건을 담고 있는 VO
|
||||
* @return 섭취 상태 업데이트 조회 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateIntakeStatus", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> updateIntakeStatus(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("updateIntakeStatus BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.updateIntakeStatus(vo);
|
||||
|
||||
log.debug("updateIntakeStatus content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 상태 업데이트
|
||||
*
|
||||
* @param vo 섭취 챌린지 마일리지 적립 조건을 담고 있는 VO
|
||||
* @return 섭취 챌린지 마일리지 적립 업데이트 조회 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/awardIntakeChallengesMileage", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> awardIntakeChallengesMileage(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("awardIntakeChallengesMileage BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.awardIntakeChallengesMileage(vo);
|
||||
|
||||
log.debug("awardIntakeChallengesMileage content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 종합 대시보드 정보 조회
|
||||
* - 챌린지 진행상태 (중단/진행중/성공)
|
||||
* - 연속 성공 기간 정보 (시작일, 종료일, 연속일수)
|
||||
* - 30일 기준 남은 날짜 및 완료일 정보
|
||||
* - 누적 보상 정보 (일별/30일 연속 보상 구분)
|
||||
* - 현재 챌린지 중인 제품 목록 (시작일 순)
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return ResponseEntity<String> 종합 대시보드 정보를 포함한 응답
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/getIntakechallengeDashboard", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getIntakechallengeDashboard(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getIntakechallengeDashboard BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.getIntakeChallengeDashboard(vo);
|
||||
|
||||
log.debug("getIntakechallengeDashboard content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 날짜별 상태 정보 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/getStatsDateClasses", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getStatsDateClasses(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getStatsDateClasses BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.getStatsDateClasses(vo);
|
||||
|
||||
log.debug("getStatsDateClasses content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 제품관리 정보 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/getIntakeChallengeProductManagement", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getIntakeChallengeProductManagement(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getIntakeChallengeProductManagement BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.getIntakeChallengeProductManagement(vo);
|
||||
|
||||
log.debug("getIntakeChallengeProductManagement content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 제품 상세 정보 조회
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectIntakeChallengeProductDetail", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> selectIntakeChallengeProductDetail(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectIntakeChallengeProductDetail BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.selectIntakeChallengeProductDetail(vo);
|
||||
|
||||
log.debug("selectIntakeChallengeProductDetail content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 일일 섭취 횟수 및 메모 업데이트
|
||||
*
|
||||
* @param vo 섭취 상태 업데이트 조건을 담고 있는 VO
|
||||
* @return 섭취 상태 업데이트 조회 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateDailyIntakeAndMemo", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> updateDailyIntakeAndMemo(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("updateDailyIntakeAndMemo BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.updateDailyIntakeAndMemo(vo);
|
||||
|
||||
log.debug("updateDailyIntakeAndMemo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택된 제품 삭제
|
||||
*
|
||||
* @param vo 섭취 상태 삭제 조건을 담고 있는 VO
|
||||
* @return 섭취 상태 삭제 조회 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/deleteIntakeChallengeProduct", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> deleteIntakeChallengeProduct(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("deleteIntakeChallengeProduct BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.deleteIntakeChallengeProduct(vo);
|
||||
|
||||
log.debug("deleteIntakeChallengeProduct content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 알림설정 조회
|
||||
* - 사용자별 섭취시간 알림 3개 조회
|
||||
* - 미완료 알림 설정 조회
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return 알림설정 정보 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/getIntakeChallengeNotificationSettings", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getIntakeChallengeNotificationSettings(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getIntakeChallengeNotificationSettings BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.getIntakeChallengeNotificationSettings(vo);
|
||||
|
||||
log.debug("getIntakeChallengeNotificationSettings content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취시간 알림설정 업데이트
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return 업데이트 결과 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateIntakeChallengeNotification", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> updateIntakeChallengeNotification(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("updateIntakeChallengeNotification BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.updateIntakeChallengeNotification(vo);
|
||||
|
||||
log.debug("updateIntakeChallengeNotification content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 미완료 알림설정 업데이트
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return 업데이트 결과 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateIntakeChallengeIncompleteNotification", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> updateIntakeChallengeIncompleteNotification(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("updateIntakeChallengeIncompleteNotification BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.updateIntakeChallengeIncompleteNotification(vo);
|
||||
|
||||
log.debug("updateIntakeChallengeIncompleteNotification content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본 알림시간 재설정
|
||||
* - 현재 설정된 알림시간 삭제 후 기본 알림시간으로 재설정
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return 재설정 결과 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/resetDefaultNotificationTimes", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> resetDefaultNotificationTimes(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("resetDefaultNotificationTimes BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.resetDefaultNotificationTimes(vo);
|
||||
|
||||
log.debug("resetDefaultNotificationTimes content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 개별 알림 설정 삭제
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return 삭제 결과 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/deleteNotification", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> deleteNotification(@RequestBody BOIntakchlVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("deleteNotification BOIntakchlVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.deleteNotification(vo);
|
||||
|
||||
log.debug("deleteNotification content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.intakchl.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.intakchl.vo.BOIntakchlVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface BOIntakchlMapper {
|
||||
|
||||
/** 혜택 화면 설정 정보 조회 */
|
||||
List<DataMap> selectIntakchlScreenInfo(BOIntakchlVO vo);
|
||||
|
||||
/** 선택된 제품 추가 */
|
||||
int insertSelectedProducts(BOIntakchlVO vo);
|
||||
|
||||
/** 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회 */
|
||||
DataMap selectDailyTotalIntakeRecord(BOIntakchlVO vo);
|
||||
|
||||
/** 선택한 날짜의 섭취 기록 상세 조회 (제품별) */
|
||||
List<DataMap> selectDailyIntakeRecordsDetail(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취 상태 업데이트 (기존 - 더 이상 사용 안함) */
|
||||
int updateIntakeStatus(BOIntakchlVO vo);
|
||||
|
||||
/** 오늘 참여기록 확인 */
|
||||
DataMap selectTodayParticipation(BOIntakchlVO vo);
|
||||
|
||||
/** 오늘 참여기록 생성 (첫 참여시에만) */
|
||||
int insertTodayParticipation(BOIntakchlVO vo);
|
||||
|
||||
/** 개별 섭취 기록 추가 */
|
||||
int insertIntakeRecord(BOIntakchlVO vo);
|
||||
|
||||
/** 오늘 보상 지급 여부 확인 */
|
||||
boolean checkTodayRewardAwarded(BOIntakchlVO vo);
|
||||
|
||||
/** 오늘 보상 업데이트 (마일리지 + 초록잎) */
|
||||
int updateTodayRewards(BOIntakchlVO vo);
|
||||
|
||||
/** 일일 섭취 목표 달성 여부 확인 */
|
||||
boolean checkDailyGoalAchievement(BOIntakchlVO vo);
|
||||
|
||||
/** 마일리지 보상 금액 조회 */
|
||||
Double getMileageRewardAmount(BOIntakchlVO vo);
|
||||
|
||||
/** 마일리지 적립 처리 */
|
||||
int awardIntakeChallengesMileage(BOIntakchlVO vo);
|
||||
|
||||
/** 챌린지 성공 연속일 조회 */
|
||||
DataMap selectConsecutiveSuccessDays(BOIntakchlVO vo);
|
||||
|
||||
/** 누적 보상 정보 조회 */
|
||||
DataMap selectAccumulatedRewards(BOIntakchlVO vo);
|
||||
|
||||
/** 월간 챌린지 현황 조회 */
|
||||
List<DataMap> selectMonthlyChallengeSummary(BOIntakchlVO vo);
|
||||
|
||||
/** 날짜별 상태 정보 조회 */
|
||||
List<DataMap> selectStatsDateClasses(BOIntakchlVO vo);
|
||||
|
||||
/** 날짜별 상태 정보 조회 */
|
||||
int selectDaysUntilBonus(BOIntakchlVO vo);
|
||||
|
||||
/** 현재 챌린지 중인 제품을 조회 */
|
||||
List<DataMap> selectCurrentChallengeProducts(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 전체 현황 조회 (상태별 개수) */
|
||||
DataMap selectIntakeChallengeOverview(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 제품 목록 조회 */
|
||||
List<DataMap> selectIntakeChallengeProducts(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 제품 상세 정보 조회 */
|
||||
DataMap selectIntakeChallengeProductDetail(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 제품 삭제 */
|
||||
int deleteIntakeChallengeProduct(BOIntakchlVO vo);
|
||||
|
||||
/** 사용자별 섭취 챌린지 알림 설정 업데이트 */
|
||||
int updateIntakeChallengeNotification(BOIntakchlVO vo);
|
||||
|
||||
/** 마일리지 적립 여부 확인 */
|
||||
boolean checkMileageAlreadyAwarded(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 정보 추가/업데이트 */
|
||||
int upsertIntakeChallengeInfo(BOIntakchlVO vo);
|
||||
|
||||
/** 모든 상태의 섭취챌린지 제품 목록 조회 (최근 추가순) */
|
||||
List<DataMap> selectAllIntakeChallengeProducts(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 전체 현황 조회 (상태별 개수) */
|
||||
DataMap selectIntakeChallengeCount(BOIntakchlVO vo);
|
||||
|
||||
/** 현재 챌린지 상태 조회 */
|
||||
DataMap selectChallengeStatus(BOIntakchlVO vo);
|
||||
|
||||
/** 누적 보상 정보 조회 (일별/30일 연속 구분) */
|
||||
DataMap selectCumulativeRewards(BOIntakchlVO vo);
|
||||
|
||||
/** 사용자의 알림 설정 존재 여부 확인 */
|
||||
boolean checkUserNotificationSettings(BOIntakchlVO vo);
|
||||
|
||||
/** 기본 알림 설정 생성 */
|
||||
int insertDefaultNotificationTimes(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 알림설정 조회 */
|
||||
List<DataMap> selectIntakeChallengeNotifications(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 미완료 알림 설정 조회 */
|
||||
DataMap selectIntakeChallengeIncompleteNotification(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 미완료 알림 설정 업데이트 */
|
||||
int updateIntakeChallengeIncompleteNotification(BOIntakchlVO vo);
|
||||
|
||||
/** 섭취챌린지 알림 시간 설정 삭제 */
|
||||
int deleteAllNotifications(BOIntakchlVO vo);
|
||||
|
||||
/** 특정 알림 설정 삭제 */
|
||||
int deleteNotification(BOIntakchlVO vo);
|
||||
|
||||
/** 초록잎 지급 개수 조회 */
|
||||
DataMap selectLeafCounts(BOIntakchlVO vo);
|
||||
|
||||
/** 초록잎 지급 여부 확인 */
|
||||
boolean checkLeafAlreadyAwarded(BOIntakchlVO vo);
|
||||
}
|
||||
@@ -0,0 +1,751 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.intakchl.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.intakchl.mapper.BOIntakchlMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.intakchl.vo.BOIntakchlVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 서비스
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BOIntakchlService {
|
||||
|
||||
@Autowired
|
||||
private BOIntakchlMapper mapper;
|
||||
private final WebClient webClient;
|
||||
|
||||
@Autowired
|
||||
private BenefitRewardService benefitRewardService;
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 설정 정보 조회
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return DataMap 섭취 챌린지 설정 정보
|
||||
*/
|
||||
public List<DataMap> selectIntakchlScreenInfo(BOIntakchlVO vo) {
|
||||
|
||||
List<DataMap> resultList = null;
|
||||
|
||||
resultList = mapper.selectIntakchlScreenInfo(vo);
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 상품 추가
|
||||
*
|
||||
* @return Map<String, Object> 상품추가 성공 여부
|
||||
*/
|
||||
public Map<String, Object> addSelectedProducts(BOIntakchlVO vo) {
|
||||
int insertCount = mapper.insertSelectedProducts(vo);
|
||||
boolean success = insertCount > 0;
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", success);
|
||||
result.put("message", success ? "제품이 성공적으로 추가되었습니다." : "제품 추가에 실패했습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 섭취 챌린지 선택한 날짜의 전체 섭취 기록 및 총 섭취율 조회
|
||||
*/
|
||||
public Map<String, Object> selectDailyTotalIntakeRecord(BOIntakchlVO vo) {
|
||||
DataMap dailyTotalIntakeRecord = mapper.selectDailyTotalIntakeRecord(vo);
|
||||
List<DataMap> dailyIntakeRecordsDetail = mapper.selectDailyIntakeRecordsDetail(vo);
|
||||
Double rewardInfo = mapper.getMileageRewardAmount(vo);
|
||||
|
||||
// 마일리지 적립 여부 확인 추가
|
||||
boolean mileageAlreadyAwarded = mapper.checkMileageAlreadyAwarded(vo);
|
||||
|
||||
// 섭취율 계산
|
||||
int intakeRate = 0;
|
||||
if (dailyTotalIntakeRecord != null) {
|
||||
intakeRate = Integer.parseInt(String.valueOf(dailyTotalIntakeRecord.get("overallIntakeRatePercentage")));
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
result.put("success", true);
|
||||
result.put("dailyTotalIntakeRecord", dailyTotalIntakeRecord);
|
||||
result.put("dailyIntakeRecordsDetail", dailyIntakeRecordsDetail);
|
||||
result.put("rewardInfo", rewardInfo);
|
||||
result.put("mileageAlreadyAwarded", mileageAlreadyAwarded); // 마일리지 적립 여부 추가
|
||||
result.put("intakeRate", intakeRate); // 섭취율 추가
|
||||
|
||||
log.debug("selectDailyTotalIntakeRecord result: {}", result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 상태 업데이트 (개선된 로직)
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 업데이트 결과
|
||||
*/
|
||||
public Map<String, Object> updateIntakeStatus(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
int totalLeafCnt = 0;
|
||||
|
||||
try {
|
||||
// 1. 오늘 날짜 참여기록 확인
|
||||
DataMap todayParticipation = mapper.selectTodayParticipation(vo);
|
||||
|
||||
if (todayParticipation == null) {
|
||||
// 2. 첫 참여시에만 참여기록 생성
|
||||
mapper.insertTodayParticipation(vo);
|
||||
todayParticipation = mapper.selectTodayParticipation(vo);
|
||||
}
|
||||
|
||||
// 3. 참여기록 ID 설정 (BigInteger 처리)
|
||||
Object bnfPrtInnbObj = todayParticipation.get("bnfPrtInnb");
|
||||
Long bnfPrtInnb = null;
|
||||
if (bnfPrtInnbObj instanceof Number) {
|
||||
bnfPrtInnb = ((Number) bnfPrtInnbObj).longValue();
|
||||
}
|
||||
vo.setBnfPrtInnb(bnfPrtInnb);
|
||||
|
||||
// 4. 개별 섭취 기록 추가
|
||||
mapper.insertIntakeRecord(vo);
|
||||
|
||||
// 5. 업데이트 후 최신 일일 섭취율 정보 조회
|
||||
DataMap dailyTotalIntakeRecord = mapper.selectDailyTotalIntakeRecord(vo);
|
||||
|
||||
// 6. 마일리지 적립 여부 확인 (처음 확인한 값을 저장)
|
||||
boolean wasAlreadyAwarded = mapper.checkMileageAlreadyAwarded(vo);
|
||||
boolean mileageAwarded = wasAlreadyAwarded;
|
||||
Double mileageAmount = null;
|
||||
|
||||
// 7. 섭취율 확인 및 보상 처리
|
||||
int intakeRate = 0;
|
||||
boolean leafAwarded = false;
|
||||
|
||||
if (dailyTotalIntakeRecord != null) {
|
||||
intakeRate = Integer.parseInt(String.valueOf(dailyTotalIntakeRecord.get("overallIntakeRatePercentage")));
|
||||
|
||||
// 8. 섭취율이 100% 이상이면 보상 처리 (한번만)
|
||||
if (intakeRate >= 100) {
|
||||
// 오늘 보상 지급 여부 확인
|
||||
boolean todayRewardAwarded = mapper.checkTodayRewardAwarded(vo);
|
||||
|
||||
if (!todayRewardAwarded) {
|
||||
// 마일리지 지급 처리
|
||||
if (!mileageAwarded) {
|
||||
mileageAmount = mapper.getMileageRewardAmount(vo);
|
||||
vo.setMlgRwdAmt(BigDecimal.valueOf(mileageAmount));
|
||||
mapper.awardIntakeChallengesMileage(vo);
|
||||
mileageAwarded = true;
|
||||
|
||||
// 마일리지 실제 등록 처리
|
||||
registerMileage(vo);
|
||||
}
|
||||
|
||||
// 초록잎 지급 정보 조회 및 처리
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
|
||||
if (leafCounts == null) {
|
||||
leafCounts = new DataMap();
|
||||
}
|
||||
|
||||
int paidLeafCnt = leafCounts.get("pymntCnt") != null ? ((Number) leafCounts.get("pymntCnt")).intValue() : 0;
|
||||
int specialLeafCnt = leafCounts.get("specialCnt") != null ? ((Number) leafCounts.get("specialCnt")).intValue() : 0;
|
||||
totalLeafCnt = paidLeafCnt + specialLeafCnt;
|
||||
|
||||
if (totalLeafCnt > 0) {
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
mapper.updateTodayRewards(vo); // 참여기록에 초록잎 업데이트
|
||||
leafAwarded = true;
|
||||
}
|
||||
} else {
|
||||
// 이미 보상이 지급된 경우
|
||||
leafAwarded = true;
|
||||
mileageAmount = mapper.getMileageRewardAmount(vo);
|
||||
|
||||
// prtLeafCnt도 안전하게 처리
|
||||
Object prtLeafCntObj = todayParticipation.get("prtLeafCnt");
|
||||
if (prtLeafCntObj instanceof Number) {
|
||||
totalLeafCnt = ((Number) prtLeafCntObj).intValue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 100% 미달성시 마일리지 금액만 조회
|
||||
mileageAmount = mapper.getMileageRewardAmount(vo);
|
||||
}
|
||||
}
|
||||
|
||||
// 9. 결과 세팅
|
||||
result.put("success", true);
|
||||
|
||||
// 마일리지 지급 상태에 따른 메시지 설정
|
||||
if (intakeRate >= 100 && mileageAwarded) {
|
||||
if (wasAlreadyAwarded) {
|
||||
result.put("message", "섭취 기록이 성공적으로 추가되었습니다. 오늘은 이미 마일리지가 적립되었습니다.");
|
||||
} else {
|
||||
result.put("message", "섭취 기록이 성공적으로 추가되었습니다. 마일리지가 지급되었습니다.");
|
||||
}
|
||||
} else {
|
||||
result.put("message", "섭취 기록이 성공적으로 추가되었습니다.");
|
||||
}
|
||||
|
||||
// 섭취율 정보 추가
|
||||
result.put("newTotalIntakeRate", intakeRate);
|
||||
if (dailyTotalIntakeRecord != null) {
|
||||
result.put("totalActualIntake", dailyTotalIntakeRecord.get("totalActualIntake"));
|
||||
result.put("totalTargetIntake", dailyTotalIntakeRecord.get("totalTargetIntake"));
|
||||
}
|
||||
|
||||
// 보상 정보 추가
|
||||
result.put("mileageAwarded", mileageAwarded);
|
||||
result.put("amount", mileageAmount);
|
||||
result.put("leafAwarded", leafAwarded);
|
||||
result.put("leafCount", leafAwarded ? totalLeafCnt : 0);
|
||||
|
||||
// 마일리지 적립 상태에 대한 추가 정보
|
||||
if (intakeRate >= 100) {
|
||||
result.put("mileageAlreadyAwarded", wasAlreadyAwarded);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error updating intake status", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "섭취 상태 업데이트에 실패했습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 마일리지 적립
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 적립 결과
|
||||
*/
|
||||
public Map<String, Object> awardIntakeChallengesMileage(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 1. 일일 목표 달성 여부 확인
|
||||
boolean goalAchieved = mapper.checkDailyGoalAchievement(vo);
|
||||
|
||||
if (goalAchieved) {
|
||||
// 2. 마일리지 보상 금액 조회
|
||||
Object mileageAmount = mapper.getMileageRewardAmount(vo);
|
||||
vo.setMlgRwdAmt((BigDecimal) mileageAmount);
|
||||
|
||||
// 3. 마일리지 적립 처리
|
||||
int awardedCount = mapper.awardIntakeChallengesMileage(vo);
|
||||
|
||||
if (awardedCount > 0) {
|
||||
// 마일리지 실제 등록 처리
|
||||
registerMileage(vo);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", String.format("마일리지 %.2f원이 성공적으로 지급되었습니다.", mileageAmount));
|
||||
result.put("awardedAmount", mileageAmount);
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "오늘 이미 마일리지가 지급되었습니다.");
|
||||
}
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "일일 섭취 목표를 달성하지 못했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "마일리지 지급 중 오류가 발생했습니다: " + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 누적 보상 정보 조회
|
||||
* @param vo BOIntakchlVO 객체
|
||||
* @return 누적 보상 정보
|
||||
*/
|
||||
public DataMap getAccumulatedRewards(BOIntakchlVO vo) {
|
||||
return mapper.selectAccumulatedRewards(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 월간 챌린지 현황 조회
|
||||
* @param vo BOIntakchlVO 객체
|
||||
* @return 월간 챌린지 현황 리스트
|
||||
*/
|
||||
public List<DataMap> getMonthlyChallengeSummary(BOIntakchlVO vo) {
|
||||
return mapper.selectMonthlyChallengeSummary(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 종합 대시보드 정보 조회
|
||||
* - 챌린지 진행상태 (중단/진행중/성공)
|
||||
* - 연속 성공 기간 정보 (시작일, 종료일, 연속일수)
|
||||
* - 30일 기준 남은 날짜 및 완료일 정보
|
||||
* - 누적 보상 정보 (일별/30일 연속 보상 구분)
|
||||
* - 현재 챌린지 중인 제품 목록 (시작일 순)
|
||||
*
|
||||
* @param vo BOIntakchlVO 객체
|
||||
* @return 종합 대시보드 정보
|
||||
*/
|
||||
public Map<String, Object> getIntakeChallengeDashboard(BOIntakchlVO vo) {
|
||||
Map<String, Object> dashboard = new HashMap<>();
|
||||
|
||||
try {
|
||||
// 1. 현재 챌린지 상태 조회
|
||||
DataMap challengeStatus = mapper.selectChallengeStatus(vo);
|
||||
dashboard.put("challengeStatus", challengeStatus);
|
||||
|
||||
// 2. 연속 성공 기간 정보 조회
|
||||
DataMap consecutiveInfo = mapper.selectConsecutiveSuccessDays(vo);
|
||||
dashboard.put("consecutiveInfo", consecutiveInfo);
|
||||
|
||||
// 3. 날짜별 상태 정보 조회 (캘린더 표시용)
|
||||
List<DataMap> dateClasses = mapper.selectStatsDateClasses(vo);
|
||||
dashboard.put("dateClasses", dateClasses);
|
||||
|
||||
// 4. 누적 보상 정보 조회 (일별/30일 연속 구분)
|
||||
DataMap cumulativeRewards = mapper.selectCumulativeRewards(vo);
|
||||
dashboard.put("cumulativeRewards", cumulativeRewards);
|
||||
|
||||
// 5. 현재 챌린지 중인 제품 목록 조회 (시작일 순)
|
||||
List<DataMap> currentProducts = mapper.selectCurrentChallengeProducts(vo);
|
||||
|
||||
// 각 제품에 대한 섭취 상태 배열 생성
|
||||
for (DataMap product : currentProducts) {
|
||||
int dailyCount = Integer.parseInt(String.valueOf(product.get("dailyIntakeCount"))); // 목표 섭취 횟수
|
||||
int todayCount = Integer.parseInt(String.valueOf(product.get("todayIntakeCount"))); // 오늘 실제 섭취 횟수
|
||||
|
||||
// 상태 배열 생성
|
||||
List<Boolean> intakeStatuses = new ArrayList<>();
|
||||
for (int i = 0; i < dailyCount; i++) {
|
||||
intakeStatuses.add(i < todayCount); // 섭취한 만큼 true, 나머지는 false
|
||||
}
|
||||
|
||||
product.put("intakeStatuses", intakeStatuses);
|
||||
}
|
||||
|
||||
dashboard.put("currentProducts", currentProducts);
|
||||
|
||||
// 6. 섭취챌린지 전체 현황 조회 (상태별 개수)
|
||||
DataMap productCounts = mapper.selectIntakeChallengeCount(vo);
|
||||
dashboard.put("productCounts", productCounts);
|
||||
|
||||
// 7. 추가 정보 계산
|
||||
if (consecutiveInfo != null) {
|
||||
// 7-1. 30일 기준 남은 날짜 계산
|
||||
int currentCycleDays = Integer.parseInt(String.valueOf(consecutiveInfo.get("current_cycle_days")));
|
||||
int daysRemaining = 30 - currentCycleDays;
|
||||
dashboard.put("daysRemaining", daysRemaining);
|
||||
|
||||
// 7-2. 챌린지 성공 여부 확인
|
||||
boolean isTodayCompleted = "Y".equals(consecutiveInfo.get("is_today_completion"));
|
||||
dashboard.put("isTodayCompleted", isTodayCompleted);
|
||||
|
||||
// 7-3. 30일 달성 여부 확인
|
||||
boolean is30DaysCompleted = "Y".equals(consecutiveInfo.get("is_30days_completed"));
|
||||
dashboard.put("is30DaysCompleted", is30DaysCompleted);
|
||||
|
||||
// 7-4. 완료된 사이클 수
|
||||
int completedCycles = Integer.parseInt(String.valueOf(consecutiveInfo.get("completed_cycles")));
|
||||
dashboard.put("completedCycles", completedCycles);
|
||||
}
|
||||
|
||||
dashboard.put("success", true);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("섭취 챌린지 종합 대시보드 조회 중 오류 발생", e);
|
||||
dashboard.put("success", false);
|
||||
dashboard.put("errorMessage", "섭취 챌린지 정보 조회 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return dashboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* 날짜별 상태 정보 조회
|
||||
*/
|
||||
public Map<String, Object> getStatsDateClasses(BOIntakchlVO vo) {
|
||||
List<DataMap> statsDateList = mapper.selectStatsDateClasses(vo);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("success", true);
|
||||
Map<String, String> data = new HashMap<>();
|
||||
|
||||
for (DataMap dataMap : statsDateList) {
|
||||
String date = dataMap.get("date").toString();
|
||||
String status = dataMap.get("status").toString();
|
||||
data.put(date, status);
|
||||
}
|
||||
|
||||
result.put("data", data);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 보너스까지 남은 일수
|
||||
*/
|
||||
public int selectDaysUntilBonus(BOIntakchlVO vo) {
|
||||
return mapper.selectDaysUntilBonus(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 챌린지 중인 제품을 조회
|
||||
*/
|
||||
public Map<String, Object> selectCurrentChallengeProducts(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
log.debug("Selecting current challenge products for VO: {}", vo);
|
||||
List<DataMap> currentChallengeProductsList = mapper.selectCurrentChallengeProducts(vo);
|
||||
|
||||
// 각 제품에 대한 섭취 상태 배열 생성
|
||||
for (DataMap product : currentChallengeProductsList) {
|
||||
int dailyCount = Integer.parseInt(String.valueOf(product.get("dailyIntakeCount"))); // 목표 섭취 횟수
|
||||
int todayCount = Integer.parseInt(String.valueOf(product.get("todayIntakeCount"))); // 오늘 실제 섭취 횟수
|
||||
|
||||
// 상태 배열 생성
|
||||
List<Boolean> intakeStatuses = new ArrayList<>();
|
||||
for (int i = 0; i < dailyCount; i++) {
|
||||
intakeStatuses.add(i < todayCount); // 섭취한 만큼 true, 나머지는 false
|
||||
}
|
||||
|
||||
product.put("intakeStatuses", intakeStatuses);
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("currentChallengeProducts", currentChallengeProductsList);
|
||||
log.debug("Successfully retrieved current challenge products: {}", currentChallengeProductsList);
|
||||
} catch (Exception e) {
|
||||
log.error("Error selecting current challenge products", e);
|
||||
result.put("success", false);
|
||||
result.put("error", e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 전체 현황 조회 (상태별 개수)
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return DataMap 섭취챌린지 전체 현황
|
||||
*/
|
||||
public DataMap getIntakeChallengeOverview(BOIntakchlVO vo) {
|
||||
return mapper.selectIntakeChallengeOverview(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 제품 목록 조회
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return List<DataMap> 섭취챌린지 제품 목록
|
||||
*/
|
||||
public List<DataMap> getIntakeChallengeProducts(BOIntakchlVO vo) {
|
||||
return mapper.selectIntakeChallengeProducts(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취 챌린지 제품관리 정보 조회
|
||||
* @param vo BOIntakchlVO 객체
|
||||
* @return 제품관리 정보를 포함한 Map
|
||||
*/
|
||||
public Map<String, Object> getIntakeChallengeProductManagement(BOIntakchlVO vo) {
|
||||
Map<String, Object> productManagement = new HashMap<>();
|
||||
|
||||
// 모든 상태의 섭취챌린지 제품 목록 조회 (최근 추가순)
|
||||
List<DataMap> allProducts = mapper.selectAllIntakeChallengeProducts(vo);
|
||||
|
||||
// 섭취챌린지 전체 현황 조회 (상태별 개수)
|
||||
DataMap productCounts = mapper.selectIntakeChallengeCount(vo);
|
||||
|
||||
productManagement.put("success", true);
|
||||
productManagement.put("challengeProducts", allProducts);
|
||||
productManagement.put("statistics", productCounts);
|
||||
|
||||
return productManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 제품 상세 정보 조회
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return DataMap 섭취챌린지 제품 상세 정보 조회
|
||||
*/
|
||||
public Map<String, Object> selectIntakeChallengeProductDetail(BOIntakchlVO vo) {
|
||||
|
||||
DataMap selectIntakeChallengeProductDetail = mapper.selectIntakeChallengeProductDetail(vo);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("challengeProductDetail", selectIntakeChallengeProductDetail);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 일일 섭취 횟수 및 메모 업데이트
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 업데이트 결과
|
||||
*/
|
||||
public Map<String, Object> updateDailyIntakeAndMemo(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 1. 현재 저장된 상태 확인
|
||||
DataMap currentData = mapper.selectIntakeChallengeProductDetail(vo);
|
||||
|
||||
// 2. 이미 종료 상태인지 확인
|
||||
if (currentData != null && "030".equals(currentData.get("bnfNtkSttusDvCd"))) {
|
||||
// 이미 종료 상태인 경우 수정 거부
|
||||
result.put("success", false);
|
||||
result.put("resultCode", "ALREADY_TERMINATED");
|
||||
result.put("message", "이미 종료된 챌린지는 수정할 수 없습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 3. 현재 요청이 종료 상태인지 확인 (030 = 종료 상태)
|
||||
boolean isTerminationRequest = "030".equals(vo.getBnfNtkSttusDvCd());
|
||||
|
||||
// 4. 정상 업데이트 처리
|
||||
int updatedCount = mapper.upsertIntakeChallengeInfo(vo);
|
||||
boolean success = updatedCount > 0;
|
||||
result.put("success", success);
|
||||
|
||||
if (success) {
|
||||
result.put("resultCode", "0000");
|
||||
if (isTerminationRequest) {
|
||||
result.put("message", "챌린지가 종료되었습니다. 이후 수정이 불가합니다.");
|
||||
result.put("isTerminated", true);
|
||||
} else {
|
||||
result.put("message", "섭취 횟수 및 메모가 성공적으로 업데이트되었습니다.");
|
||||
result.put("isTerminated", false);
|
||||
}
|
||||
} else {
|
||||
result.put("resultCode", "9999");
|
||||
result.put("message", "섭취 횟수 및 메모 업데이트에 실패했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택된 제품 삭제
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 업데이트 결과
|
||||
*/
|
||||
public Map<String, Object> deleteIntakeChallengeProduct(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
int updatedCount = mapper.deleteIntakeChallengeProduct(vo);
|
||||
boolean success = updatedCount > 0;
|
||||
result.put("success", success);
|
||||
if (success) {
|
||||
result.put("message", "삭제가 정상적으로 되었습니다.");
|
||||
} else {
|
||||
result.put("message", "삭제에 실패했습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취챌린지 알림설정 조회
|
||||
* - 사용자별 섭취시간 알림 3개 조회
|
||||
* - 기본값 없을 경우 기본 알림시간 생성
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 알림설정 정보
|
||||
*/
|
||||
public Map<String, Object> getIntakeChallengeNotificationSettings(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
// 알림 설정 존재 여부 확인
|
||||
boolean hasNotificationSettings = mapper.checkUserNotificationSettings(vo);
|
||||
|
||||
// 알림 설정이 없으면 기본 설정 생성
|
||||
if (!hasNotificationSettings) {
|
||||
mapper.insertDefaultNotificationTimes(vo);
|
||||
}
|
||||
|
||||
// 섭취시간 알림 설정 조회
|
||||
List<DataMap> notifications = mapper.selectIntakeChallengeNotifications(vo);
|
||||
|
||||
// 미완료 알림 설정 조회
|
||||
DataMap incompleteNotification = mapper.selectIntakeChallengeIncompleteNotification(vo);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("timeNotifications", notifications);
|
||||
result.put("incompleteNotification", incompleteNotification);
|
||||
} catch (Exception e) {
|
||||
log.error("섭취챌린지 알림설정 조회 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("errorMessage", "알림설정 정보 조회 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섭취시간 알림설정 업데이트 입니다
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 업데이트 결과
|
||||
*/
|
||||
public Map<String, Object> updateIntakeChallengeNotification(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int updatedCount = mapper.updateIntakeChallengeNotification(vo);
|
||||
boolean success = updatedCount > 0;
|
||||
|
||||
result.put("success", success);
|
||||
if (success) {
|
||||
result.put("message", "알림 설정이 성공적으로 업데이트되었습니다.");
|
||||
} else {
|
||||
result.put("message", "알림 설정 업데이트에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("섭취시간 알림설정 업데이트 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("errorMessage", "알림설정 업데이트 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 미완료 알림설정 업데이트
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 업데이트 결과
|
||||
*/
|
||||
public Map<String, Object> updateIntakeChallengeIncompleteNotification(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int updatedCount = mapper.updateIntakeChallengeIncompleteNotification(vo);
|
||||
boolean success = updatedCount > 0;
|
||||
|
||||
result.put("success", success);
|
||||
if (success) {
|
||||
result.put("message", "미완료 알림 설정이 성공적으로 업데이트되었습니다.");
|
||||
} else {
|
||||
result.put("message", "미완료 알림 설정 업데이트에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("섭취챌린지 미완료 알림설정 업데이트 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("errorMessage", "미완료 알림설정 업데이트 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본 알림시간 재설정
|
||||
* - 현재 설정된 알림시간 삭제 후 기본 알림시간으로 재설정
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 재설정 결과
|
||||
*/
|
||||
public Map<String, Object> resetDefaultNotificationTimes(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
// 1. 현재 알림 설정 삭제
|
||||
mapper.deleteAllNotifications(vo);
|
||||
|
||||
// 2. 기본 알림 시간 새로 생성
|
||||
mapper.insertDefaultNotificationTimes(vo);
|
||||
|
||||
// 3. 새로 생성된 알림 설정 조회
|
||||
List<DataMap> notifications = mapper.selectIntakeChallengeNotifications(vo);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "알림 설정이 기본값으로 초기화되었습니다.");
|
||||
result.put("timeNotifications", notifications);
|
||||
} catch (Exception e) {
|
||||
log.error("섭취챌린지 알림설정 초기화 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("errorMessage", "알림설정 초기화 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 개별 알림 설정 삭제
|
||||
*
|
||||
* @param vo 섭취 챌린지 VO
|
||||
* @return Map<String, Object> 삭제 결과
|
||||
*/
|
||||
public Map<String, Object> deleteNotification(BOIntakchlVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
try {
|
||||
int deletedCount = mapper.deleteNotification(vo);
|
||||
boolean success = deletedCount > 0;
|
||||
|
||||
result.put("success", success);
|
||||
if (success) {
|
||||
result.put("message", "알림 설정이 성공적으로 삭제되었습니다.");
|
||||
} else {
|
||||
result.put("message", "알림 설정 삭제에 실패했습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("섭취챌린지 알림설정 삭제 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("errorMessage", "알림설정 삭제 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 섭취 챌린지 VO
|
||||
*/
|
||||
private void registerMileage(BOIntakchlVO vo) {
|
||||
try {
|
||||
BOMlgVO mlgVo = new BOMlgVO();
|
||||
mlgVo.setSopmalCd(vo.getSopmalCd());
|
||||
mlgVo.setMbrInnb(String.valueOf(vo.getMbrInnb()));
|
||||
mlgVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
mlgVo.setAccmlmnyAmt(vo.getMlgRwdAmt());
|
||||
mlgVo.setBnfRcvInnb(String.valueOf(vo.getBnfRcvInnb()));
|
||||
|
||||
// 마일리지 적용 구분 코드 및 사유 설정
|
||||
mlgVo.setMlgApplcDvCd("07");
|
||||
mlgVo.setMlgApplcResn("섭취 챌린지 보상");
|
||||
|
||||
boolean success = benefitRewardService.issueMileage(mlgVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("섭취 챌린지 마일리지 등록 요청 성공: {}", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
log.error("섭취 챌린지 마일리지 등록 요청 실패: {}", vo.getMlgRwdAmt());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerMileage 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.intakchl.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOIntakchlVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 혜택 섭취챌린지 고유번호 */
|
||||
private Long bnfNtkInnb;
|
||||
/** 회원 고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 섭취 상품 고유번호 */
|
||||
private Long goodsInnb;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 섭취 상태 구분 코드 */
|
||||
private String bnfNtkSttusDvCd;
|
||||
/** 섭취 횟수 */
|
||||
private Integer ntkCnt;
|
||||
/** 메모 */
|
||||
private String memo;
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 참여 일시 */
|
||||
private Date bnfPrtDt;
|
||||
/** 혜택 보상수령 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
/** 마일리지 금액 */
|
||||
private BigDecimal mlgRwdAmt;
|
||||
/** 상품 고유번호 리스트 */
|
||||
private List<ProductVO> products;
|
||||
/** 선택된 날짜 */
|
||||
private String selectedDate;
|
||||
/** 섭취 상태 */
|
||||
private String intakeStatus;
|
||||
/** 보너스까지 남은 일수 */
|
||||
private int daysUntilBonus;
|
||||
/** 동의여부 */
|
||||
private String agreeYn;
|
||||
/** 남은 시간 */
|
||||
private String ntcnTme;
|
||||
/** 사용여부 */
|
||||
private String useAt;
|
||||
/** 고유번호 */
|
||||
private String bnfNtkNtcnInnb;
|
||||
/** 상품번호 */
|
||||
private int productId;
|
||||
/** 제품 섭취 날짜 */
|
||||
private String intakeDate;
|
||||
/** 섭취 시작일자 */
|
||||
private Date startDate;
|
||||
/** 혜택 알림 이벤트별 설정 고유번호 */
|
||||
private Long bnfPushEvtSetupInnb;
|
||||
/** 초록잎 지급량 */
|
||||
private Integer paidLeafCnt;
|
||||
/** 쿠폰 발송 고유번호 */
|
||||
private BigInteger couponInnb;
|
||||
/** 혜택 참여 섭취챌린지 고유번호 */
|
||||
private Long bnfPrtNtkInnb;
|
||||
|
||||
@Data
|
||||
public static class ProductVO {
|
||||
private Long goodsInnb;
|
||||
private String sopmalCd;
|
||||
private String originDvCd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lucklott.controller;
|
||||
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.lucklott.service.BOLucklottService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.lucklott.vo.BOLucklottVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
public class BOLucklottController {
|
||||
|
||||
@Autowired
|
||||
private BOLucklottService service;
|
||||
|
||||
/**
|
||||
* 행운복권 혜택 기본 정보 조회
|
||||
*
|
||||
* @param vo 혜택 조회 조건을 담고 있는 VO
|
||||
* @return 혜택 기본 정보를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectLucklottBenefitInfo")
|
||||
public ResponseEntity<String> selectLucklottBenefitInfo(@RequestBody BOLucklottVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
DataMap result = new DataMap();
|
||||
|
||||
log.debug("selectLucklottBenefitInfo BOBnftLucklottVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.selectLucklottBenefitInfo(vo);
|
||||
|
||||
log.debug("selectLucklottBenefitInfo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 참여
|
||||
*
|
||||
* @param vo 행운복권 참여 정보를 담고 있는 VO
|
||||
* @return 참여 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/participateLuckyLottery")
|
||||
public ResponseEntity<String> participateLuckyLottery(@RequestBody BOLucklottVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("participateLuckyLottery BOBnftLucklottVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.participateLuckyLottery(vo);
|
||||
|
||||
log.debug("participateLuckyLottery content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 참여
|
||||
*
|
||||
* @param vo 행운복권 참여 정보를 담고 있는 VO
|
||||
* @return 참여 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/checkLucklottEligibility")
|
||||
public ResponseEntity<String> checkLucklottEligibility(@RequestBody BOLucklottVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("checkParticipationEligibility BOBnftLucklottVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.checkLucklottEligibility(vo);
|
||||
|
||||
log.debug("checkParticipationEligibility content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 당첨 결과 미리보기
|
||||
*
|
||||
* @param requestData 행운복권 미리보기 정보를 담고 있는 VO
|
||||
* @return 미리보기 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/previewLuckyLotteryResult")
|
||||
public ResponseEntity<String> previewLuckyLotteryResult(@RequestBody Map<String, Object> requestData) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
BOLucklottVO vo = new BOLucklottVO();
|
||||
|
||||
// 안전한 타입 변환
|
||||
Object bnfInnbObj = requestData.get("bnfInnb");
|
||||
if (bnfInnbObj != null) {
|
||||
if (bnfInnbObj instanceof String) {
|
||||
try {
|
||||
vo.setBnfInnb(Long.parseLong((String) bnfInnbObj));
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("bnfInnb 변환 오류: {}", bnfInnbObj, e);
|
||||
DataMap errorResult = new DataMap();
|
||||
errorResult.put("success", false);
|
||||
errorResult.put("message", "잘못된 혜택 번호입니다.");
|
||||
return ApiResponse.of(errorResult).ifPresentOrElse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
} else if (bnfInnbObj instanceof Number) {
|
||||
vo.setBnfInnb(((Number) bnfInnbObj).longValue());
|
||||
} else {
|
||||
log.error("bnfInnb 타입 오류: {}, type: {}", bnfInnbObj, bnfInnbObj.getClass().getSimpleName());
|
||||
DataMap errorResult = new DataMap();
|
||||
errorResult.put("success", false);
|
||||
errorResult.put("message", "잘못된 혜택 번호 형식입니다.");
|
||||
return ApiResponse.of(errorResult).ifPresentOrElse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
} else {
|
||||
log.error("bnfInnb 값이 null입니다.");
|
||||
DataMap errorResult = new DataMap();
|
||||
errorResult.put("success", false);
|
||||
errorResult.put("message", "혜택 번호가 필요합니다.");
|
||||
return ApiResponse.of(errorResult).ifPresentOrElse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
vo.setMbrInnb(user.getUserInnb());
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("previewLuckyLotteryResult BOLucklottVO chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.previewLuckyLotteryResult(vo);
|
||||
|
||||
log.debug("previewLuckyLotteryResult content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 실제 참여 확정
|
||||
*
|
||||
* @param requestData 행운복권 참여 확정 정보를 담고 있는 데이터
|
||||
* @return 참여 확정 결과를 포함한 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/confirmLuckyLotteryParticipation")
|
||||
public ResponseEntity<String> confirmLuckyLotteryParticipation(@RequestBody Map<String, Object> requestData) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
BOLucklottVO vo = new BOLucklottVO();
|
||||
|
||||
// 안전한 타입 변환
|
||||
Object bnfInnbObj = requestData.get("bnfInnb");
|
||||
if (bnfInnbObj != null) {
|
||||
if (bnfInnbObj instanceof String) {
|
||||
try {
|
||||
vo.setBnfInnb(Long.parseLong((String) bnfInnbObj));
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("bnfInnb 변환 오류: {}", bnfInnbObj, e);
|
||||
DataMap errorResult = new DataMap();
|
||||
errorResult.put("success", false);
|
||||
errorResult.put("message", "잘못된 혜택 번호입니다.");
|
||||
return ApiResponse.of(errorResult).ifPresentOrElse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
} else if (bnfInnbObj instanceof Number) {
|
||||
vo.setBnfInnb(((Number) bnfInnbObj).longValue());
|
||||
} else {
|
||||
log.error("bnfInnb 타입 오류: {}, type: {}", bnfInnbObj, bnfInnbObj.getClass().getSimpleName());
|
||||
DataMap errorResult = new DataMap();
|
||||
errorResult.put("success", false);
|
||||
errorResult.put("message", "잘못된 혜택 번호 형식입니다.");
|
||||
return ApiResponse.of(errorResult).ifPresentOrElse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
} else {
|
||||
log.error("bnfInnb 값이 null입니다.");
|
||||
DataMap errorResult = new DataMap();
|
||||
errorResult.put("success", false);
|
||||
errorResult.put("message", "혜택 번호가 필요합니다.");
|
||||
return ApiResponse.of(errorResult).ifPresentOrElse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
vo.setMbrInnb(user.getUserInnb());
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
// 미리보기 결과 추출 및 안전한 변환
|
||||
DataMap previewResult = new DataMap();
|
||||
Object previewObj = requestData.get("previewResult");
|
||||
if (previewObj instanceof Map) {
|
||||
previewResult.putAll((Map<String, Object>) previewObj);
|
||||
} else {
|
||||
log.error("previewResult 타입 오류: {}", previewObj != null ? previewObj.getClass().getSimpleName() : "null");
|
||||
DataMap errorResult = new DataMap();
|
||||
errorResult.put("success", false);
|
||||
errorResult.put("message", "미리보기 결과가 올바르지 않습니다.");
|
||||
return ApiResponse.of(errorResult).ifPresentOrElse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
log.debug("confirmLuckyLotteryParticipation BOLucklottVO chk ::: {}", vo);
|
||||
log.debug("previewResult chk ::: {}", previewResult);
|
||||
|
||||
DataMap content = service.confirmLuckyLotteryParticipation(vo, previewResult);
|
||||
|
||||
log.debug("confirmLuckyLotteryParticipation content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 남은 수량 조회
|
||||
*
|
||||
* @param vo
|
||||
* @return ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/checkRemainingGoodsQuantity")
|
||||
public ResponseEntity<String> checkRemainingGoodsQuantity(@RequestBody BOLucklottVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("checkRemainingGoodsQuantity requestData chk ::: {}", vo);
|
||||
|
||||
DataMap content = service.checkStockStatusForAjax(vo);
|
||||
|
||||
log.debug("checkRemainingGoodsQuantity content chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lucklott.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.lucklott.vo.BOLucklottVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
/**
|
||||
* 행운복권 혜택 관리 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOLucklottMapper {
|
||||
|
||||
|
||||
/** 행운복권 혜택 기본 정보 조회 */
|
||||
DataMap selectLucklottBenefitInfo(BOLucklottVO vo);
|
||||
|
||||
/** 행운복권 혜택 보상 정보 조회 */
|
||||
List<DataMap> selectLucklottBenefitRewards(BOLucklottVO vo);
|
||||
|
||||
/** 행운복권 혜택 참여 정보 삽입 */
|
||||
Integer insertLucklottBenefitParticipation(BOLucklottVO vo);
|
||||
|
||||
/** 행운복권 혜택 보상 수령 정보 삽입 */
|
||||
Integer insertLucklottBenefitReceipt(BOLucklottVO vo);
|
||||
|
||||
/** 특정 상품의 당첨된 수량 조회 */
|
||||
int selectIssuedGoodsQuantity(BOLucklottVO vo);
|
||||
|
||||
/** 특정 상품의 남은 수량 조회 */
|
||||
int selectRemainingGoodsQuantity(BOLucklottVO vo);
|
||||
|
||||
/** 오늘 이미 참여했는지 확인 */
|
||||
int selectTodayParticipationCount(BOLucklottVO vo);
|
||||
|
||||
/** 행운복권 혜택 보상 및 쿠폰 정보 조회 */
|
||||
List<DataMap> selectLucklottBenefitRewardsAndCoupons(BOLucklottVO vo);
|
||||
|
||||
/** 초록잎 지급 개수 조회 */
|
||||
DataMap selectLeafCounts(BOLucklottVO vo);
|
||||
|
||||
/** 모든 등수 상품의 수량 체크 */
|
||||
List<DataMap> selectAllRewardsQuantityStatus(BOLucklottVO vo);
|
||||
|
||||
/** 보상 수량 감소 메소드 제거 */
|
||||
// int updateRewardQuantity(BOLucklottVO vo);
|
||||
}
|
||||
@@ -0,0 +1,741 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lucklott.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.vo.BODwldCouponVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.lucklott.mapper.BOLucklottMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.lucklott.vo.BOLucklottVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
/**
|
||||
* 행운복권 서비스
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BOLucklottService {
|
||||
|
||||
@Autowired
|
||||
private BOLucklottMapper mapper;
|
||||
private final WebClient webClient;
|
||||
|
||||
@Autowired
|
||||
private BenefitRewardService benefitRewardService;
|
||||
|
||||
/**
|
||||
* 행운복권 화면 설정 정보 조회
|
||||
* @param vo
|
||||
* @return DataMap 행운복권 화면 설정 정보
|
||||
*/
|
||||
public DataMap selectLucklottBenefitInfo(BOLucklottVO vo) {
|
||||
|
||||
DataMap result = new DataMap();
|
||||
result.put("benefitInfo", mapper.selectLucklottBenefitInfo(vo));
|
||||
result.put("rewardsAndCoupons", mapper.selectLucklottBenefitRewardsAndCoupons(vo));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 참여
|
||||
* @param vo
|
||||
* @return DataMap 참여 결과
|
||||
*/
|
||||
@Transactional
|
||||
public DataMap participateLuckyLottery(BOLucklottVO vo) {
|
||||
// 오늘 이미 참여했는지 확인
|
||||
int todayParticipationCount = mapper.selectTodayParticipationCount(vo);
|
||||
if (todayParticipationCount > 0) {
|
||||
DataMap result = new DataMap();
|
||||
result.put("success", false);
|
||||
result.put("message", "이미 오늘 참여하셨습니다. 내일 다시 도전해주세요.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 초록잎 지급 개수 조회
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
int paidLeafCnt = 0;
|
||||
int specialLeafCnt = 0;
|
||||
|
||||
if (leafCounts != null) {
|
||||
Object pymntCntObj = leafCounts.get("pymntCnt");
|
||||
if (pymntCntObj != null) {
|
||||
paidLeafCnt = ((Number) pymntCntObj).intValue();
|
||||
}
|
||||
|
||||
Object specialCntObj = leafCounts.get("specialCnt");
|
||||
if (specialCntObj != null) {
|
||||
specialLeafCnt = ((Number) specialCntObj).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
int totalLeafCnt = paidLeafCnt + specialLeafCnt;
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
|
||||
// 행운복권 참여 정보 저장 (초록잎 포함)
|
||||
Integer participationResult = mapper.insertLucklottBenefitParticipation(vo);
|
||||
|
||||
if (participationResult == null || participationResult == 0) {
|
||||
DataMap result = new DataMap();
|
||||
result.put("success", false);
|
||||
result.put("message", "참여 처리 중 오류가 발생했습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 보상 결정 및 지급
|
||||
DataMap rewardData = determineAndGiveReward(vo);
|
||||
|
||||
// 초록잎 적립 정보 추가
|
||||
rewardData.put("leafCount", totalLeafCnt);
|
||||
rewardData.put("leafMessage", totalLeafCnt > 0 ?
|
||||
"초록잎 " + totalLeafCnt + "개가 적립되었습니다!" : "");
|
||||
|
||||
return rewardData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 보상 결정 및 지급
|
||||
* @param vo
|
||||
*/
|
||||
private DataMap determineAndGiveReward(BOLucklottVO vo) {
|
||||
// 당첨 확률 정보 조회
|
||||
List<DataMap> rewardList = mapper.selectLucklottBenefitRewards(vo);
|
||||
if (rewardList == null || rewardList.isEmpty()) {
|
||||
throw new IllegalStateException("보상 정보가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
// 먼저 모든 상품 수량 확인
|
||||
DataMap quantityStatus = checkAllRewardsQuantityStatus(vo);
|
||||
boolean hasAnyStock = (Boolean) quantityStatus.get("hasAnyStock");
|
||||
|
||||
// 모든 상품이 품절된 경우
|
||||
if (!hasAnyStock) {
|
||||
DataMap noStockResult = new DataMap();
|
||||
noStockResult.put("rank", -1);
|
||||
noStockResult.put("success", false);
|
||||
noStockResult.put("message", "현재 모든 상품이 품절되었습니다. 잠시 후 다시 시도해주세요.");
|
||||
return noStockResult;
|
||||
}
|
||||
|
||||
// 최대 재추첨 횟수 설정 (무한 루프 방지)
|
||||
int maxRedrawAttempts = 10;
|
||||
int redrawAttempts = 0;
|
||||
|
||||
while (redrawAttempts < maxRedrawAttempts) {
|
||||
// 난수를 통해 당첨 인덱스 결정
|
||||
int selectedIndex = determinePrizeRank(rewardList);
|
||||
|
||||
// 당첨되지 않은 경우 재추첨
|
||||
if (selectedIndex == -1) {
|
||||
redrawAttempts++;
|
||||
log.debug("당첨되지 않아 재추첨 진행 ({}회차)", redrawAttempts);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 결정된 인덱스에 해당하는 보상 정보 조회
|
||||
BOLucklottVO rewardVO = getRewardByRank(rewardList, selectedIndex);
|
||||
if (rewardVO == null) {
|
||||
redrawAttempts++;
|
||||
log.debug("보상 정보 없음으로 재추첨 진행 ({}회차)", redrawAttempts);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 실제 등수 계산 (행운상인지 확인)
|
||||
String rewardCategory = rewardVO.getBnfRwdCateDvCd();
|
||||
int displayRank;
|
||||
if ("03040".equals(rewardCategory)) {
|
||||
displayRank = 0; // 행운상
|
||||
} else if ("03010".equals(rewardCategory)) {
|
||||
displayRank = 1; // 1등
|
||||
} else if ("03020".equals(rewardCategory)) {
|
||||
displayRank = 2; // 2등
|
||||
} else if ("03030".equals(rewardCategory)) {
|
||||
displayRank = 3; // 3등
|
||||
} else {
|
||||
displayRank = -1; // 알 수 없음
|
||||
}
|
||||
|
||||
// 행운상인 경우 수량 제한 없음
|
||||
if (displayRank == 0) {
|
||||
giveReward(rewardVO, vo);
|
||||
DataMap result = new DataMap();
|
||||
result.put("rank", 0);
|
||||
result.put("success", true);
|
||||
result.put("bnfRwdCateDvCd", rewardVO.getBnfRwdCateDvCd());
|
||||
result.put("mileageAmount", rewardVO.getMlgRwdAmt() != null ? rewardVO.getMlgRwdAmt().intValue() : 0);
|
||||
result.put("mileageMessage", rewardVO.getMlgRwdAmt() != null && rewardVO.getMlgRwdAmt().compareTo(BigDecimal.ZERO) > 0 ?
|
||||
"마일리지 " + rewardVO.getMlgRwdAmt().intValue() + "점이 적립되었습니다!" : "");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 1,2,3등 상품의 경우 수량 확인
|
||||
int remainingGoodsQuantity = mapper.selectRemainingGoodsQuantity(rewardVO);
|
||||
|
||||
if (remainingGoodsQuantity > 0) {
|
||||
// 수량이 있는 경우 최종 확인 후 지급
|
||||
int finalCheck = mapper.selectRemainingGoodsQuantity(rewardVO);
|
||||
if (finalCheck > 0) {
|
||||
giveReward(rewardVO, vo);
|
||||
DataMap result = new DataMap();
|
||||
result.put("rank", displayRank);
|
||||
result.put("success", true);
|
||||
result.put("bnfRwdCateDvCd", rewardVO.getBnfRwdCateDvCd());
|
||||
result.put("bnfRwdGodsDvCd", rewardVO.getBnfRwdGodsDvCd());
|
||||
result.put("mileageAmount", rewardVO.getMlgRwdAmt() != null ? rewardVO.getMlgRwdAmt().intValue() : 0);
|
||||
result.put("mileageMessage", rewardVO.getMlgRwdAmt() != null && rewardVO.getMlgRwdAmt().compareTo(BigDecimal.ZERO) > 0 ?
|
||||
"마일리지 " + rewardVO.getMlgRwdAmt().intValue() + "점이 적립되었습니다!" : "");
|
||||
result.put("couponInnb", rewardVO.getCouponInnb());
|
||||
result.put("couponName", rewardVO.getCouponName());
|
||||
result.put("couponDescription", rewardVO.getCouponDescription());
|
||||
result.put("remainingGoodsQuantity", finalCheck - 1);
|
||||
result.put("redrawAttempts", redrawAttempts); // 재추첨 횟수 정보 추가
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// 수량이 없는 경우 재추첨
|
||||
redrawAttempts++;
|
||||
log.debug("{}등 상품 수량 부족으로 재추첨 진행 ({}회차)", displayRank, redrawAttempts);
|
||||
}
|
||||
|
||||
// 최대 재추첨 횟수를 초과한 경우
|
||||
DataMap maxAttemptsResult = new DataMap();
|
||||
maxAttemptsResult.put("rank", -2);
|
||||
maxAttemptsResult.put("success", false);
|
||||
maxAttemptsResult.put("message", "재추첨 한계 초과로 참여가 완료되지 않았습니다. 잠시 후 다시 시도해주세요.");
|
||||
return maxAttemptsResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 난수를 통해 등수 결정
|
||||
* @param rewardList 실제 조회된 보상 목록 (수량이 있는 것만)
|
||||
* @return 실제 rewardList의 인덱스
|
||||
*/
|
||||
public static int determinePrizeRank(List<DataMap> rewardList) {
|
||||
if (rewardList == null || rewardList.isEmpty()) {
|
||||
throw new IllegalStateException("조회된 보상이 없습니다.");
|
||||
}
|
||||
|
||||
// 먼저 전체 확률의 합을 계산
|
||||
BigDecimal totalProbability = BigDecimal.ZERO;
|
||||
for (DataMap reward : rewardList) {
|
||||
if (reward == null) continue;
|
||||
|
||||
Object prizeProbabilityObj = reward.get("przwinPrc");
|
||||
if (prizeProbabilityObj == null) continue;
|
||||
|
||||
double prizeProbability = ((Number) prizeProbabilityObj).doubleValue();
|
||||
BigDecimal roundedPrizeProbability = BigDecimal.valueOf(prizeProbability).setScale(2, RoundingMode.HALF_UP);
|
||||
totalProbability = totalProbability.add(roundedPrizeProbability);
|
||||
}
|
||||
|
||||
// 전체 확률이 0이면 첫 번째 보상 반환
|
||||
if (totalProbability.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0.0에서 전체확률 사이의 난수 생성 (100이 아닌 실제 확률 합계 사용)
|
||||
double randomValue = new Random().nextDouble() * totalProbability.doubleValue();
|
||||
BigDecimal roundedRandomValue = BigDecimal.valueOf(randomValue).setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
BigDecimal cumulativeProbability = BigDecimal.ZERO;
|
||||
|
||||
// rewardList를 순회하며 각 확률을 처리
|
||||
for (int i = 0; i < rewardList.size(); i++) {
|
||||
DataMap reward = rewardList.get(i);
|
||||
if (reward == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object prizeProbabilityObj = reward.get("przwinPrc");
|
||||
if (prizeProbabilityObj == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double prizeProbability = ((Number) prizeProbabilityObj).doubleValue();
|
||||
BigDecimal roundedPrizeProbability = BigDecimal.valueOf(prizeProbability).setScale(2, RoundingMode.HALF_UP);
|
||||
cumulativeProbability = cumulativeProbability.add(roundedPrizeProbability);
|
||||
|
||||
if (roundedRandomValue.compareTo(cumulativeProbability) <= 0) {
|
||||
return i; // 실제 rewardList의 인덱스 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 여기까지 왔다면 마지막 보상을 반환 (100% 보장)
|
||||
return rewardList.size() - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 인덱스에 따른 보상 정보 조회
|
||||
* @param rewardList
|
||||
* @param index rewardList의 인덱스 (-1인 경우 당첨되지 않음)
|
||||
* @return BOLucklottVO 보상 정보
|
||||
*/
|
||||
private BOLucklottVO getRewardByRank(List<DataMap> rewardList, int index) {
|
||||
if (index == -1 || index >= rewardList.size()) {
|
||||
return null; // 당첨되지 않음 또는 잘못된 인덱스
|
||||
}
|
||||
|
||||
BOLucklottVO rewardVO = new BOLucklottVO();
|
||||
DataMap reward = rewardList.get(index);
|
||||
|
||||
// 보상 정보 설정
|
||||
rewardVO.setBnfRwdCateDvCd((String) reward.get("bnfRwdCateDvCd"));
|
||||
rewardVO.setBnfRwdGodsDvCd((String) reward.get("bnfRwdGodsDvCd"));
|
||||
rewardVO.setMlgRwdAmt(reward.get("mlgRwdAmt") != null ? (BigDecimal) reward.get("mlgRwdAmt") : null);
|
||||
|
||||
// BigInteger를 Integer로 안전하게 변환
|
||||
Object couponInnb = reward.get("couponInnb");
|
||||
|
||||
rewardVO.setCouponInnb((BigInteger) couponInnb);
|
||||
|
||||
// 쿠폰 이름과 설명 추가
|
||||
rewardVO.setCouponName((String) reward.get("coupNm"));
|
||||
rewardVO.setCouponDescription((String) reward.get("couponDc"));
|
||||
|
||||
return rewardVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 보상 지급
|
||||
* @param rewardVO 보상 정보
|
||||
* @param originalVO 원본 요청 정보
|
||||
*/
|
||||
private void giveReward(BOLucklottVO rewardVO, BOLucklottVO originalVO) {
|
||||
// 원본 요청의 사용자 정보를 보상 정보에 복사
|
||||
rewardVO.setMbrInnb(originalVO.getMbrInnb());
|
||||
rewardVO.setRegusr(originalVO.getRegusr());
|
||||
rewardVO.setUpdusr(originalVO.getUpdusr());
|
||||
rewardVO.setMbrDvCd(originalVO.getMbrDvCd());
|
||||
rewardVO.setSopmalCd(originalVO.getSopmalCd());
|
||||
rewardVO.setBnfPrtInnb(originalVO.getBnfPrtInnb());
|
||||
|
||||
// 행운상이 아닌 경우 최종 수량 재확인 (동시성 처리)
|
||||
if (!"03040".equals(rewardVO.getBnfRwdCateDvCd())) {
|
||||
int finalCheck = mapper.selectRemainingGoodsQuantity(rewardVO);
|
||||
if (finalCheck <= 0) {
|
||||
log.warn("상품이 품절되었습니다 - 당첨 처리 중단: {}", rewardVO);
|
||||
throw new RuntimeException("상품이 품절되었습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
// 혜택 영수증 저장 (실제 당첨 기록)
|
||||
mapper.insertLucklottBenefitReceipt(rewardVO);
|
||||
|
||||
// 차감 방식 제거 - 이제 계산 방식으로만 수량 관리
|
||||
// int updateResult = mapper.updateRewardQuantity(rewardVO);
|
||||
// if (updateResult == 0) {
|
||||
// log.warn("보상 수량 감소 실패 - 이미 품절되었을 수 있음: {}", rewardVO);
|
||||
// }
|
||||
|
||||
// 마일리지가 있는 경우 마일리지 등록
|
||||
if (rewardVO.getMlgRwdAmt() != null && rewardVO.getMlgRwdAmt().compareTo(BigDecimal.ZERO) > 0) {
|
||||
registerMileage(rewardVO);
|
||||
}
|
||||
|
||||
// 쿠폰이 있는 경우 쿠폰 등록
|
||||
if (rewardVO.getCouponInnb() != null) {
|
||||
registerCoupon(rewardVO);
|
||||
}
|
||||
|
||||
log.info("보상 지급 완료 - 계산 방식으로 수량 관리: {}", rewardVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 참여 가능 여부 확인
|
||||
* @param vo
|
||||
* @return DataMap 참여 가능 여부 정보
|
||||
*/
|
||||
public DataMap checkLucklottEligibility(BOLucklottVO vo) {
|
||||
log.debug("checkLucklottEligibility BOLucklottVO chk ::: {}", vo);
|
||||
|
||||
DataMap result = new DataMap();
|
||||
|
||||
try {
|
||||
// 오늘 날짜의 참여 횟수를 조회
|
||||
int participationCount = mapper.selectTodayParticipationCount(vo);
|
||||
|
||||
// 참여 횟수가 0이면 참여 가능
|
||||
boolean canParticipate = (participationCount == 0);
|
||||
|
||||
result.put("canParticipate", canParticipate);
|
||||
result.put("participationCount", participationCount);
|
||||
|
||||
if (canParticipate) {
|
||||
result.put("message", "오늘 행운복권에 참여 가능합니다.");
|
||||
} else {
|
||||
result.put("message", "오늘 이미 행운복권에 참여하셨습니다.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error in checkLucklottEligibility: ", e);
|
||||
result.put("canParticipate", false);
|
||||
result.put("message", "참여 가능 여부 확인 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
log.debug("checkLucklottEligibility result chk ::: {}", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 행운복권 VO
|
||||
*/
|
||||
private void registerMileage(BOLucklottVO vo) {
|
||||
try {
|
||||
BOMlgVO mlgVo = new BOMlgVO();
|
||||
mlgVo.setSopmalCd(vo.getSopmalCd());
|
||||
mlgVo.setMbrInnb(String.valueOf(vo.getMbrInnb()));
|
||||
mlgVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
mlgVo.setAccmlmnyAmt(vo.getMlgRwdAmt());
|
||||
mlgVo.setBnfRcvInnb(String.valueOf(vo.getBnfRcvInnb()));
|
||||
|
||||
// 마일리지 적용 구분 코드 및 사유 설정
|
||||
mlgVo.setMlgApplcDvCd("07");
|
||||
mlgVo.setMlgApplcResn("행운복권 보상");
|
||||
|
||||
boolean success = benefitRewardService.issueMileage(mlgVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("행운복권 마일리지 등록 요청 성공: {}", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
log.error("행운복권 마일리지 등록 요청 실패: {}", vo.getMlgRwdAmt());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerMileage 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 쿠폰 실제 등록 처리
|
||||
* @param vo 행운복권 VO
|
||||
*/
|
||||
private void registerCoupon(BOLucklottVO vo) {
|
||||
try {
|
||||
BODwldCouponVO couponVo = new BODwldCouponVO();
|
||||
couponVo.setSopmalCd(vo.getSopmalCd());
|
||||
couponVo.setMbrInnb(vo.getMbrInnb());
|
||||
couponVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
|
||||
// BigInteger를 Integer로 안전하게 변환
|
||||
if (vo.getCouponInnb() != null) {
|
||||
couponVo.setCouponSndngInnb(vo.getCouponInnb().intValue());
|
||||
}
|
||||
|
||||
couponVo.setBnfRcvInnb(vo.getBnfRcvInnb());
|
||||
|
||||
boolean success = benefitRewardService.issueCoupon(couponVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("행운복권 쿠폰 등록 요청 성공: {}", vo.getCouponInnb());
|
||||
} else {
|
||||
log.error("행운복권 쿠폰 등록 요청 실패: {}", vo.getCouponInnb());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerCoupon 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 행운복권 당첨 결과 미리보기 (실제 참여 없이 당첨 여부만 결정)
|
||||
* @param vo
|
||||
* @return DataMap 당첨 결과 (참여 저장 안함)
|
||||
*/
|
||||
public DataMap previewLuckyLotteryResult(BOLucklottVO vo) {
|
||||
// 오늘 이미 참여했는지 확인
|
||||
int todayParticipationCount = mapper.selectTodayParticipationCount(vo);
|
||||
if (todayParticipationCount > 0) {
|
||||
DataMap result = new DataMap();
|
||||
result.put("success", false);
|
||||
result.put("message", "이미 오늘 참여하셨습니다. 내일 다시 도전해주세요.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 보상 결정만 수행 (실제 참여 저장 안함)
|
||||
DataMap rewardData = determineRewardOnly(vo);
|
||||
return rewardData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 보상 결정만 수행 (실제 지급 안함)
|
||||
* @param vo
|
||||
*/
|
||||
private DataMap determineRewardOnly(BOLucklottVO vo) {
|
||||
// 당첨 확률 정보 조회
|
||||
List<DataMap> rewardList = mapper.selectLucklottBenefitRewards(vo);
|
||||
if (rewardList == null || rewardList.isEmpty()) {
|
||||
throw new IllegalStateException("보상 정보가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
// 난수를 통해 당첨 등수 결정
|
||||
int rank = determinePrizeRank(rewardList);
|
||||
|
||||
// 결정된 등수에 해당하는 보상 정보 조회
|
||||
BOLucklottVO rewardVO = getRewardByRank(rewardList, rank);
|
||||
|
||||
// null 체크 추가
|
||||
if (rewardVO == null) {
|
||||
// 당첨되지 않은 경우 처리
|
||||
DataMap noWinResult = new DataMap();
|
||||
noWinResult.put("rank", -1);
|
||||
noWinResult.put("success", false);
|
||||
noWinResult.put("message", "당첨되지 않았습니다.");
|
||||
return noWinResult;
|
||||
}
|
||||
|
||||
// 실제 등수 계산 (행운상인지 확인)
|
||||
String rewardCategory = rewardVO.getBnfRwdCateDvCd();
|
||||
int displayRank;
|
||||
if ("03040".equals(rewardCategory)) {
|
||||
displayRank = 0; // 행운상
|
||||
} else if ("03010".equals(rewardCategory)) {
|
||||
displayRank = 1; // 1등
|
||||
} else if ("03020".equals(rewardCategory)) {
|
||||
displayRank = 2; // 2등
|
||||
} else if ("03030".equals(rewardCategory)) {
|
||||
displayRank = 3; // 3등
|
||||
} else {
|
||||
displayRank = -1; // 알 수 없음
|
||||
}
|
||||
|
||||
// 응답 데이터 구성 (실제 지급은 안함)
|
||||
DataMap result = new DataMap();
|
||||
result.put("rank", displayRank); // rank 대신 displayRank 사용
|
||||
result.put("success", true);
|
||||
result.put("bnfRwdCateDvCd", rewardVO.getBnfRwdCateDvCd());
|
||||
result.put("bnfRwdGodsDvCd", rewardVO.getBnfRwdGodsDvCd());
|
||||
result.put("mileageAmount", rewardVO.getMlgRwdAmt() != null ? rewardVO.getMlgRwdAmt().intValue() : 0);
|
||||
result.put("couponInnb", rewardVO.getCouponInnb());
|
||||
result.put("couponName", rewardVO.getCouponName());
|
||||
result.put("couponDescription", rewardVO.getCouponDescription());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 실제 게임 참여 처리 (이미 결정된 당첨 결과로)
|
||||
* @param vo
|
||||
* @param previewResult 미리 결정된 당첨 결과
|
||||
* @return DataMap 실제 참여 결과
|
||||
*/
|
||||
@Transactional
|
||||
public DataMap confirmLuckyLotteryParticipation(BOLucklottVO vo, DataMap previewResult) {
|
||||
// 다시 한번 오늘 참여 여부 확인
|
||||
int todayParticipationCount = mapper.selectTodayParticipationCount(vo);
|
||||
if (todayParticipationCount > 0) {
|
||||
DataMap result = new DataMap();
|
||||
result.put("success", false);
|
||||
result.put("message", "이미 오늘 참여하셨습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 초록잎 지급 개수 조회
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
int paidLeafCnt = 0;
|
||||
int specialLeafCnt = 0;
|
||||
|
||||
if (leafCounts != null) {
|
||||
Object pymntCntObj = leafCounts.get("pymntCnt");
|
||||
if (pymntCntObj != null) {
|
||||
paidLeafCnt = ((Number) pymntCntObj).intValue();
|
||||
}
|
||||
|
||||
Object specialCntObj = leafCounts.get("specialCnt");
|
||||
if (specialCntObj != null) {
|
||||
specialLeafCnt = ((Number) specialCntObj).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
int totalLeafCnt = paidLeafCnt + specialLeafCnt;
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
|
||||
// 행운복권 참여 정보 저장
|
||||
Integer participationResult = mapper.insertLucklottBenefitParticipation(vo);
|
||||
|
||||
if (participationResult == null || participationResult == 0) {
|
||||
DataMap result = new DataMap();
|
||||
result.put("success", false);
|
||||
result.put("message", "참여 처리 중 오류가 발생했습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 미리 결정된 당첨 결과로 실제 보상 지급
|
||||
giveRewardFromPreview(vo, previewResult);
|
||||
|
||||
// 결과에 초록잎 정보 추가
|
||||
previewResult.put("leafCount", totalLeafCnt);
|
||||
previewResult.put("leafMessage", totalLeafCnt > 0 ?
|
||||
"초록잎 " + totalLeafCnt + "개가 적립되었습니다!" : "");
|
||||
|
||||
return previewResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 미리 결정된 당첨 결과로 실제 보상 지급
|
||||
*/
|
||||
private void giveRewardFromPreview(BOLucklottVO vo, DataMap previewResult) {
|
||||
// 미리보기 결과를 바탕으로 보상 VO 구성
|
||||
BOLucklottVO rewardVO = new BOLucklottVO();
|
||||
rewardVO.setBnfInnb(vo.getBnfInnb());
|
||||
rewardVO.setMbrInnb(vo.getMbrInnb());
|
||||
rewardVO.setRegusr(vo.getRegusr());
|
||||
rewardVO.setUpdusr(vo.getUpdusr());
|
||||
rewardVO.setMbrDvCd(vo.getMbrDvCd());
|
||||
rewardVO.setSopmalCd(vo.getSopmalCd());
|
||||
rewardVO.setBnfPrtInnb(vo.getBnfPrtInnb());
|
||||
|
||||
rewardVO.setBnfRwdCateDvCd((String) previewResult.get("bnfRwdCateDvCd"));
|
||||
rewardVO.setBnfRwdGodsDvCd((String) previewResult.get("bnfRwdGodsDvCd"));
|
||||
|
||||
// Integer를 BigDecimal로 안전하게 변환
|
||||
Object mileageAmountObj = previewResult.get("mileageAmount");
|
||||
BigDecimal mlgRwdAmt = null;
|
||||
if (mileageAmountObj != null) {
|
||||
if (mileageAmountObj instanceof Integer) {
|
||||
mlgRwdAmt = BigDecimal.valueOf((Integer) mileageAmountObj);
|
||||
} else if (mileageAmountObj instanceof BigDecimal) {
|
||||
mlgRwdAmt = (BigDecimal) mileageAmountObj;
|
||||
} else if (mileageAmountObj instanceof Number) {
|
||||
mlgRwdAmt = BigDecimal.valueOf(((Number) mileageAmountObj).longValue());
|
||||
}
|
||||
}
|
||||
rewardVO.setMlgRwdAmt(mlgRwdAmt);
|
||||
|
||||
// couponInnb를 안전하게 변환
|
||||
Object couponInnbObj = previewResult.get("couponInnb");
|
||||
BigInteger couponInnb = null;
|
||||
if (couponInnbObj != null) {
|
||||
if (couponInnbObj instanceof BigInteger) {
|
||||
couponInnb = (BigInteger) couponInnbObj;
|
||||
} else if (couponInnbObj instanceof Integer) {
|
||||
couponInnb = BigInteger.valueOf((Integer) couponInnbObj);
|
||||
} else if (couponInnbObj instanceof Long) {
|
||||
couponInnb = BigInteger.valueOf((Long) couponInnbObj);
|
||||
} else if (couponInnbObj instanceof Number) {
|
||||
couponInnb = BigInteger.valueOf(((Number) couponInnbObj).longValue());
|
||||
}
|
||||
}
|
||||
rewardVO.setCouponInnb(couponInnb);
|
||||
|
||||
rewardVO.setCouponName((String) previewResult.get("couponName"));
|
||||
rewardVO.setCouponDescription((String) previewResult.get("couponDescription"));
|
||||
|
||||
// 실제 보상 지급
|
||||
giveReward(rewardVO, vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 모든 등수 상품 수량 상태 확인
|
||||
* @param vo
|
||||
* @return DataMap 수량 상태 정보
|
||||
*/
|
||||
public DataMap checkAllRewardsQuantityStatus(BOLucklottVO vo) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
try {
|
||||
List<DataMap> quantityStatus = mapper.selectAllRewardsQuantityStatus(vo);
|
||||
|
||||
boolean hasAnyStock = false;
|
||||
int totalRewards = 0;
|
||||
int outOfStockRewards = 0;
|
||||
|
||||
for (DataMap reward : quantityStatus) {
|
||||
totalRewards++;
|
||||
String hasStock = (String) reward.get("hasStock");
|
||||
if ("Y".equals(hasStock)) {
|
||||
hasAnyStock = true;
|
||||
} else {
|
||||
outOfStockRewards++;
|
||||
}
|
||||
}
|
||||
|
||||
result.put("hasAnyStock", hasAnyStock);
|
||||
result.put("totalRewards", totalRewards);
|
||||
result.put("outOfStockRewards", outOfStockRewards);
|
||||
result.put("quantityDetails", quantityStatus);
|
||||
|
||||
if (!hasAnyStock && totalRewards > 0) {
|
||||
result.put("message", "현재 모든 상품이 품절되었습니다. 잠시 후 다시 시도해주세요.");
|
||||
} else if (outOfStockRewards > 0) {
|
||||
result.put("message", "일부 상품이 품절되었지만 참여 가능합니다.");
|
||||
} else {
|
||||
result.put("message", "모든 상품 재고가 충분합니다.");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error in checkAllRewardsQuantityStatus: ", e);
|
||||
result.put("hasAnyStock", false);
|
||||
result.put("message", "상품 수량 확인 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX용 상품 재고 상태 간단 체크
|
||||
* @param vo
|
||||
* @return DataMap 간단한 재고 상태 정보
|
||||
*/
|
||||
public DataMap checkStockStatusForAjax(BOLucklottVO vo) {
|
||||
DataMap result = new DataMap();
|
||||
|
||||
try {
|
||||
List<DataMap> quantityStatus = mapper.selectAllRewardsQuantityStatus(vo);
|
||||
|
||||
boolean hasAnyStock = false;
|
||||
int totalRewards = 0;
|
||||
int availableRewards = 0;
|
||||
|
||||
for (DataMap reward : quantityStatus) {
|
||||
totalRewards++;
|
||||
String hasStock = (String) reward.get("hasStock");
|
||||
if ("Y".equals(hasStock)) {
|
||||
hasAnyStock = true;
|
||||
availableRewards++;
|
||||
}
|
||||
}
|
||||
|
||||
result.put("hasAnyStock", hasAnyStock);
|
||||
result.put("totalRewards", totalRewards);
|
||||
result.put("availableRewards", availableRewards);
|
||||
result.put("outOfStockRewards", totalRewards - availableRewards);
|
||||
|
||||
// 상태별 메시지
|
||||
if (!hasAnyStock && totalRewards > 0) {
|
||||
result.put("status", "ALL_SOLD_OUT");
|
||||
result.put("message", "현재 모든 상품이 품절되었습니다.");
|
||||
result.put("canParticipate", false);
|
||||
}
|
||||
|
||||
// 상세 정보는 필요시에만 포함 (옵션)
|
||||
result.put("details", quantityStatus);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error in checkStockStatusForAjax: ", e);
|
||||
result.put("hasAnyStock", false);
|
||||
result.put("status", "ERROR");
|
||||
result.put("message", "상품 재고 확인 중 오류가 발생했습니다.");
|
||||
result.put("canParticipate", false);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lucklott.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOLucklottVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 사용 여부 */
|
||||
private String useAt;
|
||||
/** 진행기간 시작일시 */
|
||||
private String bnfBgnDt;
|
||||
/** 진행기간 종료일시 */
|
||||
private String bnfEndDt;
|
||||
/** 충전 필요 금액 */
|
||||
private String amtForChg;
|
||||
/** 등록자 */
|
||||
private int regusr;
|
||||
/** 등록일시 */
|
||||
private Date registDt;
|
||||
/** 수정자 */
|
||||
private int updusr;
|
||||
/** 수정일시 */
|
||||
private Date updtDt;
|
||||
/** 회원 고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 보상수령 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
/** 혜택 참여 일시 */
|
||||
private String bnfPrtDt;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 참여 내용 1 */
|
||||
private String prtCont1;
|
||||
/** 참여 내용 2 */
|
||||
private String prtCont2;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 요청 페이지 구분 */
|
||||
private String reqPageDv;
|
||||
/** 참여 횟수 */
|
||||
private Integer currentMonthParticipationCount;
|
||||
/** 누적 참여 마일리지 */
|
||||
private Double totalParticipationMileage;
|
||||
/** 대표 이미지 */
|
||||
private String reprsntImg;
|
||||
/** 대표 링크 URL */
|
||||
private String reprsntLinkUrl;
|
||||
/** 보상 이미지 */
|
||||
private String rewardImg;
|
||||
/** 보상 링크 URL */
|
||||
private String rewardLinkUrl;
|
||||
/** 혜택 문구 */
|
||||
private String bnfWordsCn;
|
||||
/** 참여 일자 목록 */
|
||||
private String participationDays;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 보상 상품 구분 코드 */
|
||||
private String bnfRwdGodsDvCd;
|
||||
/** 마일리지 */
|
||||
private BigDecimal mlgRwdAmt;
|
||||
/** 쿠폰 고유번호 */
|
||||
private BigInteger couponInnb;
|
||||
/** 상품 고유번호 */
|
||||
private Long goodsInnb;
|
||||
/** 상품 고유번호 */
|
||||
private Long przwinQy;
|
||||
/** 남은 당첨 수량 */
|
||||
private Long remaininggoodsquantity;
|
||||
/** 등록자 */
|
||||
private Long regUsr;
|
||||
/** 초록잎 지급량 */
|
||||
private Integer paidLeafCnt;
|
||||
/** 쿠폰명 */
|
||||
private String couponName;
|
||||
/** 쿠폰설명 */
|
||||
private String couponDescription;
|
||||
|
||||
public String getCouponName() { return couponName; }
|
||||
public void setCouponName(String couponName) { this.couponName = couponName; }
|
||||
|
||||
public String getCouponDescription() { return couponDescription; }
|
||||
public void setCouponDescription(String couponDescription) { this.couponDescription = couponDescription; }
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lvshop.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.lvshop.service.BOLvshopService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.lvshop.vo.BOLvshopVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
public class BOLvshopController {
|
||||
|
||||
@Autowired
|
||||
private BOLvshopService service;
|
||||
|
||||
/**
|
||||
* 라이브 쇼핑 메인 정보 조회
|
||||
* - 현재 진행중 라이브 정보, 다음 방송 예고 목록
|
||||
* @param vo 쇼핑몰코드(sopmalCd) 포함, 회원의 경우 mbrInnb, mbrDvCd 전달
|
||||
* @return 라이브 쇼핑 정보 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED) // 회원/비회원 모두 접근 가능
|
||||
@RequestMapping(value = "/getLiveShoppingInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> getLiveShoppingInfo(@RequestBody BOLvshopVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("getLiveShoppingInfo BOLvshopVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.getLiveShoppingInfo(vo);
|
||||
log.debug("getLiveShoppingInfo content chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 라이브 쇼핑 알림 신청/취소 토글
|
||||
* @param vo 회원정보, 쇼핑몰코드, 혜택고유번호, 동의여부(agreeYn) 포함
|
||||
* @return 알림 상태 변경 결과 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED) // 회원만 접근 가능
|
||||
@RequestMapping(value = "/toggleLiveShoppingNotification", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> toggleLiveShoppingNotification(@RequestBody BOLvshopVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("toggleLiveShoppingNotification BOLvshopVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.toggleLiveShoppingNotification(vo);
|
||||
log.debug("toggleLiveShoppingNotification content chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 라이브쇼핑 혜택 참여 정보 기록 (시청 시작 시)
|
||||
* @param vo 회원정보, 쇼핑몰코드, 혜택고유번호(bnfInnb) 포함
|
||||
* @return 참여 기록 결과 응답 ResponseEntity
|
||||
*/
|
||||
// @Policy(AuthPolicy.RESTRICTED) // 회원만 접근 가능
|
||||
// @RequestMapping(value = "/recordLiveShoppingParticipation", method = RequestMethod.POST)
|
||||
// public ResponseEntity<String> recordLiveShoppingParticipation(@RequestBody BOLvshopVO vo) {
|
||||
// AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
// vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
// vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
// vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
// vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
// if("01".equals(user.getSysDvCd())) {
|
||||
// vo.setSopmalCd(user.getSopmalCd());
|
||||
// }
|
||||
//
|
||||
// log.debug("recordLiveShoppingParticipation BOLvshopVO chk ::: {}", vo);
|
||||
// Map<String, Object> content = service.recordParticipation(vo);
|
||||
// log.debug("recordLiveShoppingParticipation content chk ::: {}", content);
|
||||
//
|
||||
// return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 라이브쇼핑 마일리지 보상 지급 (필수 시청 시간 충족 후)
|
||||
* @param vo 혜택참여고유번호(bnfPrtInnb), 마일리지금액(mlgRwdAmt) 포함
|
||||
* @return 마일리지 지급 결과 응답 ResponseEntity
|
||||
*/
|
||||
// @Policy(AuthPolicy.RESTRICTED) // 회원만 접근 가능
|
||||
// @RequestMapping(value = "/awardLiveShoppingReward", method = RequestMethod.POST)
|
||||
// public ResponseEntity<String> awardLiveShoppingReward(@RequestBody BOLvshopVO vo) {
|
||||
// AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
// vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
// vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
// vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
// vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
// if("01".equals(user.getSysDvCd())) {
|
||||
// vo.setSopmalCd(user.getSopmalCd());
|
||||
// }
|
||||
//
|
||||
// log.debug("awardLiveShoppingReward BOLvshopVO chk ::: {}", vo);
|
||||
// Map<String, Object> content = service.awardLiveShoppingReward(vo);
|
||||
// log.debug("awardLiveShoppingReward content chk ::: {}", content);
|
||||
//
|
||||
// return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 라이브쇼핑 참여 기록 및 마일리지 보상 지급 통합 API
|
||||
* @param vo 회원정보, 쇼핑몰코드, 혜택고유번호(bnfInnb), 마일리지금액(mlgRwdAmt) 포함
|
||||
* @return 참여 기록 및 마일리지 지급 결과 응답 ResponseEntity
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED) // 회원만 접근 가능
|
||||
@RequestMapping(value = "/recordAndRewardLiveShopping", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> recordAndRewardLiveShopping(@RequestBody BOLvshopVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("recordAndRewardLiveShopping BOLvshopVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.recordParticipationAndAwardReward(vo);
|
||||
log.debug("recordAndRewardLiveShopping content chk ::: {}", content);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lvshop.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.lvshop.vo.BOLvshopVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 라이브 쇼핑 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOLvshopMapper {
|
||||
|
||||
/** 현재 진행중인 라이브 쇼핑 정보 조회 */
|
||||
DataMap selectCurrentLiveShoppingInfo(BOLvshopVO vo);
|
||||
|
||||
/** 다음 방송 예고 목록 조회 */
|
||||
List<DataMap> selectUpcomingLiveShoppingList(String sopmalCd);
|
||||
|
||||
/** 라이브 쇼핑 알림 신청 상태 조회 */
|
||||
String selectLiveShoppingNotificationStatus(BOLvshopVO vo);
|
||||
|
||||
/** 라이브 쇼핑 알림 신청 정보 삽입 */
|
||||
int insertLiveShoppingNotification(BOLvshopVO vo);
|
||||
|
||||
/** 라이브 쇼핑 알림 신청 상태 업데이트 */
|
||||
int updateLiveShoppingNotificationStatus(BOLvshopVO vo);
|
||||
|
||||
/** 라이브쇼핑 혜택 참여 정보 삽입 */
|
||||
int insertLvshopBenefitParticipation(BOLvshopVO vo);
|
||||
|
||||
/** 라이브쇼핑 마일리지 적립 여부 확인 */
|
||||
int checkLiveShoppingRewardReceived(BOLvshopVO vo);
|
||||
|
||||
/** 라이브쇼핑 마일리지 적립 정보 삽입 */
|
||||
int insertLiveShoppingRewardReceipt(BOLvshopVO vo);
|
||||
|
||||
/** 초록잎 지급 개수 조회 */
|
||||
DataMap selectLeafCounts(BOLvshopVO vo);
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lvshop.service;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.common.service.BenefitRewardService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.lvshop.mapper.BOLvshopMapper;
|
||||
import com.wb.domainserver.domain.gcone.bnft.lvshop.vo.BOLvshopVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 라이브쇼핑 서비스
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class BOLvshopService {
|
||||
|
||||
@Autowired
|
||||
private BOLvshopMapper mapper;
|
||||
private final WebClient webClient;
|
||||
|
||||
@Autowired
|
||||
private BenefitRewardService benefitRewardService;
|
||||
|
||||
/**
|
||||
* 라이브 쇼핑 메인 화면 정보 조회
|
||||
* - 현재 진행중인 라이브 정보
|
||||
* - 다음 방송 예고 목록 (알림 신청 상태 포함)
|
||||
*
|
||||
* @param vo 회원정보(mbrInnb, mbrDvCd), 쇼핑몰코드(sopmalCd) 포함
|
||||
* @return Map<String, Object> 라이브 쇼핑 정보
|
||||
*/
|
||||
public Map<String, Object> getLiveShoppingInfo(BOLvshopVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 1. 현재 진행중인 라이브 쇼핑 정보 조회
|
||||
DataMap currentLiveInfo = mapper.selectCurrentLiveShoppingInfo(vo);
|
||||
result.put("currentLiveInfo", currentLiveInfo);
|
||||
|
||||
|
||||
String notificationStatus = mapper.selectLiveShoppingNotificationStatus(vo);
|
||||
result.put("notificationStatus", StringUtils.hasText(notificationStatus) ? notificationStatus : "N"); // 없으면 N
|
||||
|
||||
// 2. 다음 방송 예고 목록 조회
|
||||
List<DataMap> upcomingList = mapper.selectUpcomingLiveShoppingList(vo.getSopmalCd());
|
||||
|
||||
// 3. 각 예고 방송에 대한 알림 신청 상태 조회 및 추가
|
||||
if (vo.getMbrInnb() > 0) { // 회원 정보가 있을 경우에만 조회
|
||||
for (DataMap upcoming : upcomingList) {
|
||||
BOLvshopVO checkVo = new BOLvshopVO();
|
||||
checkVo.setSopmalCd(vo.getSopmalCd());
|
||||
checkVo.setMbrInnb(vo.getMbrInnb());
|
||||
checkVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
checkVo.setBnfInnb(Long.parseLong(String.valueOf(upcoming.get("bnfInnb")))); // DataMap에서 bnfInnb 가져오기
|
||||
}
|
||||
} else {
|
||||
// 비회원인 경우 모든 예고의 알림 상태를 'N'으로 설정
|
||||
for (DataMap upcoming : upcomingList) {
|
||||
upcoming.put("notificationStatus", "N");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result.put("upcomingList", upcomingList);
|
||||
result.put("success", true);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("라이브 쇼핑 정보 조회 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "라이브 쇼핑 정보 조회 중 오류가 발생했습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 라이브 쇼핑 알림 신청/취소 토글
|
||||
*
|
||||
* @param vo 회원정보, 쇼핑몰코드, 혜택고유번호, 동의여부(agreeYn - 'Y' 또는 'N') 포함
|
||||
* @return Map<String, Object> 처리 결과 및 최종 상태
|
||||
*/
|
||||
public Map<String, Object> toggleLiveShoppingNotification(BOLvshopVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
|
||||
int affectedRows;
|
||||
|
||||
// 알림 신청 상태 변경
|
||||
affectedRows = mapper.insertLiveShoppingNotification(vo);
|
||||
|
||||
boolean success = affectedRows > 0;
|
||||
result.put("success", success);
|
||||
if (success) {
|
||||
result.put("message", "알림 신청 상태가 변경되었습니다.");
|
||||
result.put("newStatus", vo.getUseAt()); // 요청된 상태를 반환
|
||||
} else {
|
||||
result.put("message", "알림 신청 상태 변경에 실패했습니다.");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("라이브 쇼핑 알림 상태 변경 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "알림 신청 상태 변경 중 오류가 발생했습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 라이브쇼핑 참여 기록 및 보상 지급 통합 메소드
|
||||
* (라이브 시청 시작 시 호출하여 참여 기록 및 마일리지 보상 처리)
|
||||
*
|
||||
* @param vo 회원정보, 쇼핑몰코드, 혜택고유번호, 마일리지금액(mlgRwdAmt) 포함
|
||||
* @return Map<String, Object> 참여 기록 및 보상 지급 결과
|
||||
*/
|
||||
public Map<String, Object> recordParticipationAndAwardReward(BOLvshopVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 1. 마일리지 적립 여부 먼저 확인
|
||||
int rewardCount = mapper.checkLiveShoppingRewardReceived(vo);
|
||||
|
||||
if (rewardCount > 0) {
|
||||
result.put("success", true);
|
||||
result.put("message", "이미 마일리지 보상을 받으셨습니다.");
|
||||
result.put("alreadyAwarded", true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 2. 마일리지 금액 유효성 검사
|
||||
if (vo.getMlgRwdAmt() == null || vo.getMlgRwdAmt().isNaN() || vo.getMlgRwdAmt() <= 0) {
|
||||
result.put("success", false);
|
||||
result.put("message", "마일리지 보상 금액 정보가 없습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 3. 초록잎 지급 처리 (마일리지 보상을 지급할 때만)
|
||||
DataMap leafCounts = mapper.selectLeafCounts(vo);
|
||||
int totalLeafCnt = 0;
|
||||
|
||||
if (leafCounts != null) {
|
||||
int paidLeafCnt = ((Number) leafCounts.get("pymntCnt")).intValue();
|
||||
int specialLeafCnt = leafCounts.get("specialCnt") != null ? ((Number) leafCounts.get("specialCnt")).intValue() : 0;
|
||||
totalLeafCnt = paidLeafCnt + (specialLeafCnt == 0 ? 0 : specialLeafCnt);
|
||||
}
|
||||
|
||||
vo.setPaidLeafCnt(totalLeafCnt);
|
||||
|
||||
// 4. 참여 정보 기록
|
||||
int insertCount = mapper.insertLvshopBenefitParticipation(vo);
|
||||
boolean participationSuccess = insertCount > 0 && vo.getBnfPrtInnb() != null;
|
||||
|
||||
if (!participationSuccess) {
|
||||
result.put("success", false);
|
||||
result.put("message", "라이브 쇼핑 참여 기록에 실패했습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 5. 마일리지 적립 정보 삽입
|
||||
int rewardInsertCount = mapper.insertLiveShoppingRewardReceipt(vo);
|
||||
boolean rewardSuccess = rewardInsertCount > 0;
|
||||
|
||||
if (rewardSuccess) {
|
||||
// 6. 마일리지 실제 등록 처리
|
||||
registerMileage(vo);
|
||||
|
||||
result.put("message", String.format("라이브 쇼핑 참여 기록 및 마일리지 %.0f원이 적립되었습니다.", vo.getMlgRwdAmt()));
|
||||
result.put("awardedAmount", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
result.put("message", "참여는 기록되었으나, 마일리지 적립에 실패했습니다.");
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("bnfPrtInnb", vo.getBnfPrtInnb());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("라이브 쇼핑 참여 기록 및 보상 지급 중 오류 발생", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "참여 기록 및 보상 지급 중 오류가 발생했습니다.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 실제 등록 처리
|
||||
* @param vo 라이브쇼핑 VO
|
||||
*/
|
||||
private void registerMileage(BOLvshopVO vo) {
|
||||
try {
|
||||
BOMlgVO mlgVo = new BOMlgVO();
|
||||
mlgVo.setSopmalCd(vo.getSopmalCd());
|
||||
mlgVo.setMbrInnb(String.valueOf(vo.getMbrInnb()));
|
||||
mlgVo.setMbrDvCd(vo.getMbrDvCd());
|
||||
mlgVo.setAccmlmnyAmt(BigDecimal.valueOf(vo.getMlgRwdAmt()));
|
||||
mlgVo.setBnfRcvInnb(String.valueOf(vo.getBnfRcvInnb()));
|
||||
|
||||
// 마일리지 적용 구분 코드 및 사유 설정
|
||||
mlgVo.setMlgApplcDvCd("07");
|
||||
mlgVo.setMlgApplcResn("라이브쇼핑 보상");
|
||||
|
||||
boolean success = benefitRewardService.issueMileage(mlgVo);
|
||||
|
||||
if (success) {
|
||||
log.debug("라이브쇼핑 마일리지 등록 요청 성공: {}", vo.getMlgRwdAmt());
|
||||
} else {
|
||||
log.error("라이브쇼핑 마일리지 등록 요청 실패: {}", vo.getMlgRwdAmt());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("registerMileage 메서드 실행 중 예외 발생", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.lvshop.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOLvshopVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 혜택 참여 고유번호 */
|
||||
private Long bnfPrtInnb;
|
||||
/** 혜택 설정 고유번호 */
|
||||
private Long bnfInnb;
|
||||
/** 혜택 제목 */
|
||||
private String bnfSj;
|
||||
/** 혜택 구분 코드 */
|
||||
private String bnfDvCd;
|
||||
/** 진행기간 시작일시 */
|
||||
private Date bnfBgnDt;
|
||||
/** 진행기간 종료일시 */
|
||||
private Date bnfEndDt;
|
||||
/** 혜택 동의 구분 코드 */
|
||||
private String bnfAgreDvCd;
|
||||
/** 화면 대표 이미지 */
|
||||
private String scrReprsntImg;
|
||||
/** 화면 대표 링크 URL */
|
||||
private String scrReprsntLinkUrl;
|
||||
/** 혜택 안내 */
|
||||
private String bnfWordsCn;
|
||||
/** 내용 제목 (방송명) */
|
||||
private String cnSj;
|
||||
/** 내용 설명 */
|
||||
private String cnDc;
|
||||
/** 링크 (방송링크URL) */
|
||||
private String linkUrl;
|
||||
/** 이미지파일경로 (방송썸네일파일 경로) */
|
||||
private String imgFilCours;
|
||||
/** 이미지파일명 (방송썸네일파일 명) */
|
||||
private String imgFilNm;
|
||||
/** 유효일시 (방송일시) */
|
||||
private Date validDt;
|
||||
/** 시간(초) (필수열람시간) */
|
||||
private Integer tmeSecnd;
|
||||
/** 안내내용 (방송소개) */
|
||||
private String wordsCn;
|
||||
/** 보상 항목 구분 코드 */
|
||||
private String bnfRwdCateDvCd;
|
||||
/** 회원 고유번호 */
|
||||
private int mbrInnb;
|
||||
/** 회원 구분 코드 */
|
||||
private String mbrDvCd;
|
||||
/** 마일리지 금액 */
|
||||
private Double mlgRwdAmt;
|
||||
/** 서버에서 측정한 이벤트 지속 시간 (초) */
|
||||
private Long serverDuration;
|
||||
/** 동의 여부 */
|
||||
private String agreAt;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 초록잎 지급량 */
|
||||
private Integer paidLeafCnt;
|
||||
/** 쿠폰 발송 고유번호 */
|
||||
private BigInteger couponInnb;
|
||||
/** 혜택 보상 내역 고유번호 */
|
||||
private BigInteger bnfRcvInnb;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.wb.domainserver.domain.gcone.bnft.oxquiz.controller;
|
||||
|
||||
import com.wb.domainserver.domain.gcone.bnft.oxquiz.service.BOOxquizService;
|
||||
import com.wb.domainserver.domain.gcone.bnft.oxquiz.vo.BOOxquizVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* OX 퀴즈 컨트롤러
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gcone/bnft")
|
||||
@RequiredArgsConstructor
|
||||
public class BOOxquizController {
|
||||
|
||||
private final BOOxquizService service;
|
||||
|
||||
/**
|
||||
* OX 퀴즈 정보 조회
|
||||
*
|
||||
* @param vo OX 퀴즈 VO
|
||||
* @return OX 퀴즈 정보
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectOxquizInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> selectOxquizInfo(@RequestBody BOOxquizVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectOxquizInfo BOOxquizVO chk ::: {}", vo);
|
||||
|
||||
Map<String, Object> content = service.selectOxquizInfoWithUserParticipation(vo);
|
||||
|
||||
log.debug("selectOxquizInfo result chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* OX 퀴즈 참여
|
||||
*
|
||||
* @param vo OX 퀴즈 VO
|
||||
* @return 참여 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/participateOxquiz", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> participateOxquiz(@RequestBody BOOxquizVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setRegusr(user.getUserInnb()); // 등록자 설정
|
||||
vo.setUpdusr(user.getUserInnb()); // 수정자 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("participateOxquiz BOOxquizVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.participateOxquiz(vo);
|
||||
|
||||
log.debug("participateOxquiz content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 다음 퀴즈 정보 조회
|
||||
*
|
||||
* @param vo OX 퀴즈 VO
|
||||
* @return 다음 퀴즈 정보
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectNextQuizInfo", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> selectNextQuizInfo(@RequestBody BOOxquizVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectNextQuizInfo BOOxquizVO chk ::: {}", vo);
|
||||
Map<String, Object> content = service.selectNextQuizInfo(vo);
|
||||
|
||||
log.debug("selectNextQuizInfo content chk ::: {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림 상태 조회
|
||||
*
|
||||
* @param vo OX 퀴즈 VO
|
||||
* @return 알림 상태
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/getoxquizNotificationStatus", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> selectNotificationStatus(@RequestBody BOOxquizVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb()); // 회원 고유번호 설정
|
||||
vo.setMbrDvCd(user.getMbrDvCd()); // 회원 구분 코드 설정
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("selectNotificationStatus BOOxquizVO chk ::: {}", vo);
|
||||
|
||||
boolean status = service.selectNotificationStatus(vo);
|
||||
|
||||
log.debug("selectNotificationStatus status chk ::: {}", status);
|
||||
return ApiResponse.of(Map.of("notificationStatus", status)).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림 상태 변경
|
||||
*
|
||||
* @param vo OX 퀴즈 VO
|
||||
* @return 변경 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateoxquizNotificationStatus", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> updateNotificationStatus(@RequestBody BOOxquizVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setMbrInnb(user.getUserInnb());
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
vo.setMbrDvCd(user.getMbrDvCd());
|
||||
if("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("updateNotificationStatus BOOxquizVO chk ::: {}", vo);
|
||||
Map<String, Object> result = service.updateNotificationStatus(vo);
|
||||
|
||||
log.debug("updateNotificationStatus result chk ::: {}", result);
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user