package itn.com.api.web; import java.time.LocalDateTime; import javax.annotation.Resource; import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; import itn.com.cmm.LoginVO; import itn.com.cmm.RestResponse; import itn.com.utl.fcc.service.EgovStringUtil; import itn.let.mjo.msgdata.service.MjonMsgDataService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import itn.let.kakao.admin.kakaoAt.service.MjonKakaoAtStatVO; import itn.let.kakao.admin.statistics.service.KakaoStatisticsService; import itn.let.mail.service.StatusResponse; import itn.let.mjo.msg.service.MjonMsgService; import itn.let.mjo.msg.service.MjonMsgStatVO; /** * * @author : 이호영 * @fileName : ApiRestController.java * @date : 2023.01.05 * @description : * =========================================================== * DATE AUTHOR NOTE * ----------------------------------------------------------- * * 2023.01.05 이호영 최초 생성 * * * */ @RestController public class ApiRestController { private static final Logger log = LoggerFactory.getLogger(ApiRestController.class); @Resource(name = "mjonMsgService") private MjonMsgService mjonMsgService; @Resource(name = "KakaoStatisticsService") private KakaoStatisticsService kakaoStatisticsService; @Resource(name = "MjonMsgDataService") private MjonMsgDataService mjonMsgDataService; /** * @methodName : mailSendItnContactUs * @author : 이호영 * @date : 2023.01.05 * @description : * @param mjonMsgStatVO * @return * @throws Exception */ @GetMapping(value = "/web/api/insertAgentSmsCountStatApi.do") public ResponseEntity insertAgentSmsCountStatApi(MjonMsgStatVO mjonMsgStatVO) throws Exception { try { mjonMsgService.insertAgentSmsCountStat(mjonMsgStatVO); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); return ResponseEntity.ok().body(new StatusResponse(HttpStatus.OK, "문자 발송건수 통계 생성을 실패하였습니다.", LocalDateTime.now())); } return ResponseEntity.ok().body(new StatusResponse(HttpStatus.OK, "문자 발송건수 통계 생성을 성공적으로 마쳤습니다.", LocalDateTime.now())); } /** * @methodName : insertKakaoAtCountStatApi * @author : 안주영 * @date : 2023.03.23 * @description : * @param kakaoAtStatVO * @return * @throws Exception */ @GetMapping(value = "/web/api/insertKakaoAtCountStatApi.do") public ResponseEntity insertKakaoAtCountStatApi(MjonKakaoAtStatVO kakaoAtStatVO) throws Exception { try { kakaoStatisticsService.insertKakaoAtCountStat(kakaoAtStatVO); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); return ResponseEntity.ok().body(new StatusResponse(HttpStatus.OK, "알림톡 발송건수 통계 생성을 실패하였습니다.", LocalDateTime.now())); } return ResponseEntity.ok().body(new StatusResponse(HttpStatus.OK, "알림톡 발송건수 통계 생성을 성공적으로 마쳤습니다.", LocalDateTime.now())); } /** * @methodName : findByIdQuatMgmtAjax * @author : 이호영 * @date : 2026.03.31 * @description : 갱신된 금액 가져오는 ajax * @return * @throws Exception */ @RequestMapping(value="/web/api/getBeforeCashDataAjax.do") public ResponseEntity getBeforeCashDataAjax() throws Exception { //로그인 권한정보 불러오기 LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()? (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser():null; String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); if(StringUtils.isEmpty(userId)) { return ResponseEntity.ok( RestResponse.builder() .status(HttpStatus.UNAUTHORIZED) // 401 권한 인증 에러 .msg("로그인을 하셔야 이용 가능합니다.") .build() ); } return ResponseEntity.ok(mjonMsgDataService.getBeforeCashDataAjax(userId)); } }