From 8694e21d0c1f10c4f49cd9c181e1df240d2fcaa7 Mon Sep 17 00:00:00 2001 From: hylee Date: Fri, 2 Aug 2024 16:49:16 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=B8=EC=9E=90=20agent=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 9 + .../client/two/mapper/AgentCTwoMapper.java | 27 ++ .../client/two/mapper/domain/AgentCTwoVO.java | 38 ++ .../client/two/service/AgentCTwoService.java | 16 + .../service/impl/AgentCTwoServiceImpl.java | 133 ++++++ .../client/two/web/AgentCTwoController.java | 39 ++ .../two/web/AgentCTwoRestController.java | 46 ++ .../agent/server/mapper/AgentSMapper.java | 24 + .../agent/server/mapper/domain/AgentSVO.java | 83 ++++ .../agent/server/service/AgentSService.java | 14 + .../service/impl/AgentSServiceImpl.java | 41 ++ .../agent/server/web/AgentSController.java | 18 + .../server/web/AgentSRestController.java | 41 ++ .../config/MjonAgentCTwoDatabaseConfig.java | 48 ++ .../cmn/config/MjonAgentSDatabaseConfig.java | 48 ++ src/main/resources/application.properties | 28 +- src/main/resources/mapper-config.xml | 17 - .../agent/client/two/AgentCTwoMapper.xml | 39 ++ .../mapper/agent/server/AgentSMapper.xml | 32 ++ src/main/resources/mybatis-config.xml | 19 + .../resources/static/cmn/js/agent/init.js | 54 +++ .../static/cmn/js/agent/timerForOneC.js | 159 +++++++ .../static/cmn/js/agent/timerForTwoC.js | 252 +++++++++++ src/main/resources/templates/agent/view.html | 427 ++++++++++++++++++ .../resources/templates/fragments/header.html | 7 +- .../templates/fragments/mainsidebar.html | 19 + 26 files changed, 1657 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/itn/admin/agent/client/two/mapper/AgentCTwoMapper.java create mode 100644 src/main/java/com/itn/admin/agent/client/two/mapper/domain/AgentCTwoVO.java create mode 100644 src/main/java/com/itn/admin/agent/client/two/service/AgentCTwoService.java create mode 100644 src/main/java/com/itn/admin/agent/client/two/service/impl/AgentCTwoServiceImpl.java create mode 100644 src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoController.java create mode 100644 src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoRestController.java create mode 100644 src/main/java/com/itn/admin/agent/server/mapper/AgentSMapper.java create mode 100644 src/main/java/com/itn/admin/agent/server/mapper/domain/AgentSVO.java create mode 100644 src/main/java/com/itn/admin/agent/server/service/AgentSService.java create mode 100644 src/main/java/com/itn/admin/agent/server/service/impl/AgentSServiceImpl.java create mode 100644 src/main/java/com/itn/admin/agent/server/web/AgentSController.java create mode 100644 src/main/java/com/itn/admin/agent/server/web/AgentSRestController.java create mode 100644 src/main/java/com/itn/admin/cmn/config/MjonAgentCTwoDatabaseConfig.java create mode 100644 src/main/java/com/itn/admin/cmn/config/MjonAgentSDatabaseConfig.java delete mode 100644 src/main/resources/mapper-config.xml create mode 100644 src/main/resources/mapper/agent/client/two/AgentCTwoMapper.xml create mode 100644 src/main/resources/mapper/agent/server/AgentSMapper.xml create mode 100644 src/main/resources/static/cmn/js/agent/init.js create mode 100644 src/main/resources/static/cmn/js/agent/timerForOneC.js create mode 100644 src/main/resources/static/cmn/js/agent/timerForTwoC.js create mode 100644 src/main/resources/templates/agent/view.html diff --git a/pom.xml b/pom.xml index 20c440d..a0cce9a 100644 --- a/pom.xml +++ b/pom.xml @@ -152,6 +152,15 @@ org.springframework.boot spring-boot-starter-validation + + + + org.openkoreantext + open-korean-text + 2.3.1 + + + diff --git a/src/main/java/com/itn/admin/agent/client/two/mapper/AgentCTwoMapper.java b/src/main/java/com/itn/admin/agent/client/two/mapper/AgentCTwoMapper.java new file mode 100644 index 0000000..4c5c3ef --- /dev/null +++ b/src/main/java/com/itn/admin/agent/client/two/mapper/AgentCTwoMapper.java @@ -0,0 +1,27 @@ +package com.itn.admin.agent.client.two.mapper; + +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * packageName : com.itn.admin.agent.mapper + * fileName : AgentMapper + * author : hylee + * date : 2024-07-31 + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2024-07-31 hylee 최초 생성 + */ +@Mapper +public interface AgentCTwoMapper { + + List findAll(AgentCTwoVO agentCTwoVO); + + void insertAgents(List agentCTwoVO); + + int countBySendStatusNotAndMsgType(AgentCTwoVO agentCTwoVO); +} diff --git a/src/main/java/com/itn/admin/agent/client/two/mapper/domain/AgentCTwoVO.java b/src/main/java/com/itn/admin/agent/client/two/mapper/domain/AgentCTwoVO.java new file mode 100644 index 0000000..3cc15c5 --- /dev/null +++ b/src/main/java/com/itn/admin/agent/client/two/mapper/domain/AgentCTwoVO.java @@ -0,0 +1,38 @@ +package com.itn.admin.agent.client.two.mapper.domain; + +import lombok.*; + +import java.io.Serializable; + +/** + * packageName : com.itn.admin.agent.mapper.domain + * fileName : AgentVO + * author : hylee + * date : 2024-07-31 + * description : 에이젼트 테스트발송 + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-05-09 hylee 최초 생성 + */ +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@Setter +@ToString +public class AgentCTwoVO implements Serializable { + + private static final long serialVersionUID = 1L; + private String msgType; + private String sendStatus; + private String requestSate; + private String recvPhone; + private String sendPhone; + private String message; + private String sendCnt; + + private String cnt; + + +} diff --git a/src/main/java/com/itn/admin/agent/client/two/service/AgentCTwoService.java b/src/main/java/com/itn/admin/agent/client/two/service/AgentCTwoService.java new file mode 100644 index 0000000..3d90de9 --- /dev/null +++ b/src/main/java/com/itn/admin/agent/client/two/service/AgentCTwoService.java @@ -0,0 +1,16 @@ +package com.itn.admin.agent.client.two.service; + +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import com.itn.admin.cmn.msg.RestResponse; + + +public interface AgentCTwoService { + + + + RestResponse send(AgentCTwoVO agentCTwoVO); + + RestResponse findByInsertCnt(AgentCTwoVO agentCTwoVO); + +// RestResponse findByReportCnt(AgentCTwoVO agentCTwoVO); +} diff --git a/src/main/java/com/itn/admin/agent/client/two/service/impl/AgentCTwoServiceImpl.java b/src/main/java/com/itn/admin/agent/client/two/service/impl/AgentCTwoServiceImpl.java new file mode 100644 index 0000000..51746a5 --- /dev/null +++ b/src/main/java/com/itn/admin/agent/client/two/service/impl/AgentCTwoServiceImpl.java @@ -0,0 +1,133 @@ +package com.itn.admin.agent.client.two.service.impl; + +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import com.itn.admin.agent.client.two.service.AgentCTwoService; +import com.itn.admin.agent.client.two.mapper.AgentCTwoMapper; +import com.itn.admin.cmn.msg.RestResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + + +@Slf4j +@Service +public class AgentCTwoServiceImpl implements AgentCTwoService { + + + @Autowired + AgentCTwoMapper agentCTwoMapper; + +// private SqlSession sqlSession; + private static final int BATCH_SIZE = 10000; // 배치 크기 설정 + + @Override + public RestResponse send(AgentCTwoVO agentCTwoVO) { + + System.out.println("t : "+ agentCTwoVO.toString()); + List agentCTwoVOL = new ArrayList<>(); + + String sendCntStr = agentCTwoVO.getSendCnt(); + int sendCnt; + + try { + sendCnt = (sendCntStr != null && !sendCntStr.isEmpty()) ? Integer.parseInt(sendCntStr) : 0; + } catch (NumberFormatException e) { + // 변환에 실패하면 기본값으로 설정 + sendCnt = 0; + } + + + for (int i = 0; i < sendCnt; i++) { + // 새 AgentVO 객체 생성 + AgentCTwoVO newAgentCTwoVO = new AgentCTwoVO(); + + // msgType, sendStatus, requestDate 등의 기존 값을 복사 + newAgentCTwoVO.setMsgType(agentCTwoVO.getMsgType()); + newAgentCTwoVO.setSendStatus(agentCTwoVO.getSendStatus()); + + // 수신번호, 발신번호, 메시지 수정 + String newRecvPhone = modifyPhoneNumber(agentCTwoVO.getRecvPhone(), i); + String newSendPhone = modifyPhoneNumber(agentCTwoVO.getSendPhone(), i); + String newMessage = agentCTwoVO.getMessage() + " " + (i + 1); + + newAgentCTwoVO.setRecvPhone(newRecvPhone); + newAgentCTwoVO.setSendPhone(newSendPhone); + newAgentCTwoVO.setMessage(newMessage); + + // 리스트에 추가 + agentCTwoVOL.add(newAgentCTwoVO); + } + + // SqlSession 초기화 +// sqlSession = MyBatisUtil.getSqlSession(); +// AgentMapper agentMapper = sqlSession.getMapper(AgentMapper.class); + + int totalSize = agentCTwoVOL.size(); + // 시작 시간 기록 (초 단위) + long startTime = System.currentTimeMillis() / 1000; + // 총 배치 수 계산 + int totalBatches = (int) Math.ceil((double) totalSize / BATCH_SIZE); + for (int i = 0; i < totalSize; i += BATCH_SIZE) { + // 배치 단위로 데이터를 나눠서 처리 + int end = Math.min(totalSize, i + BATCH_SIZE); + List batchList = agentCTwoVOL.subList(i, end); + + // 배치 삽입 + agentCTwoMapper.insertAgents(batchList); + + // 캐시 초기화 및 세션 커밋 +// sqlSession.clearCache(); +// sqlSession.commit(); + + // 현재 처리된 배치 번호 + int currentBatch = (i / BATCH_SIZE) + 1; + + // 진행 상태 출력 + log.info("현재 처리 중인 배치: [{}]", currentBatch + "/" + totalBatches); + log.info("남은 배치 수: [{}]", (totalBatches - currentBatch)); + } + + // 종료 시간 기록 (초 단위) + long endTime = System.currentTimeMillis() / 1000; + // 총 소요 시간 계산 + long totalTime = endTime - startTime; + + log.info("insert 시간 : [{}]", totalTime); + return new RestResponse(HttpStatus.OK,"데이터를 정상적으로 입력했습니다.", totalTime+"초"); + } + + @Override + public RestResponse findByInsertCnt(AgentCTwoVO agentCTwoVO) { + + int cnt = agentCTwoMapper.countBySendStatusNotAndMsgType(agentCTwoVO); + + return new RestResponse(HttpStatus.OK,"", cnt); + } +// +// @Override +// public RestResponse findByReportCnt(AgentCTwoVO agentCTwoVO) { +// int cnt = agentCTwoMapper.countBySendStatusNotAndMsgType(agentCTwoVO); +// +// return new RestResponse(HttpStatus.OK,"", cnt); +// } + + + private String modifyPhoneNumber(String phone, int index) { + // 휴대폰 번호는 010-XXXX-YYYY 형식으로 가정 + String prefix = phone.substring(0, 4); // "010-" 부분 + String middle = phone.substring(4, 8); // "XXXX" 부분 + String suffix = phone.substring(8); // "YYYY" 부분 + + // 중간 부분 숫자 수정 + int middleNumber = Integer.parseInt(middle); + middleNumber = (middleNumber + index) % 10000; // 0000~9999 사이의 값으로 제한 + middle = String.format("%04d", middleNumber); // 네 자리 숫자로 포맷 + + return prefix + middle + suffix; + } + +} diff --git a/src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoController.java b/src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoController.java new file mode 100644 index 0000000..25dac1f --- /dev/null +++ b/src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoController.java @@ -0,0 +1,39 @@ +package com.itn.admin.agent.client.two.web; + +import com.itn.admin.agent.client.two.service.AgentCTwoService; +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; + +@Controller +public class AgentCTwoController { + + private AgentCTwoService agentCTwoService; + + @Value("${spring.mjagent.client.one.userid}") + private String ONE_USER_ID; + + @Value("${spring.mjagent.client.two.userid}") + private String TOW_USER_ID; + + + @Autowired + public void setCommuteService(AgentCTwoService agentCTwoService) { + this.agentCTwoService = agentCTwoService; + } + + @GetMapping(value = "/agent/view") + public String list(@ModelAttribute("agentVO") AgentCTwoVO agentCTwoVO, Model model) { + + + model.addAttribute("oneUserId", ONE_USER_ID); + model.addAttribute("twoUserId", TOW_USER_ID); + + return "agent/view"; + } + +} diff --git a/src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoRestController.java b/src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoRestController.java new file mode 100644 index 0000000..89b378d --- /dev/null +++ b/src/main/java/com/itn/admin/agent/client/two/web/AgentCTwoRestController.java @@ -0,0 +1,46 @@ +package com.itn.admin.agent.client.two.web; + +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import com.itn.admin.agent.client.two.service.AgentCTwoService; +import com.itn.admin.cmn.msg.RestResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +@RestController +public class AgentCTwoRestController { + + private AgentCTwoService agentCTwoService; + + + + @Autowired + public void setAgentService(AgentCTwoService agentCTwoService) { + this.agentCTwoService = agentCTwoService; + } + + /* + * client db에 insert + * */ + @PostMapping("/agent/two/send") + public ResponseEntity send(@RequestBody AgentCTwoVO agentCTwoVO) throws Exception { + return ResponseEntity.ok().body(agentCTwoService.send(agentCTwoVO)); + } + + /* + * client db에 insert 됐는지 확인 count + * */ + @PostMapping("/agent/two/findByInsertCnt") + public ResponseEntity findByInsertCnt(@RequestBody AgentCTwoVO agentCTwoVO) throws Exception { + return ResponseEntity.ok().body(agentCTwoService.findByInsertCnt(agentCTwoVO)); + } + + /* + * client db에 insert 됐는지 확인 count + * */ +// @PostMapping("/agent/two/findByReportCnt") +// public ResponseEntity findByReportCnt(@RequestBody AgentCTwoVO agentCTwoVO) throws Exception { +// return ResponseEntity.ok().body(agentCTwoService.findByReportCnt(agentCTwoVO)); +// } +} diff --git a/src/main/java/com/itn/admin/agent/server/mapper/AgentSMapper.java b/src/main/java/com/itn/admin/agent/server/mapper/AgentSMapper.java new file mode 100644 index 0000000..16bd1f3 --- /dev/null +++ b/src/main/java/com/itn/admin/agent/server/mapper/AgentSMapper.java @@ -0,0 +1,24 @@ +package com.itn.admin.agent.server.mapper; + +import com.itn.admin.agent.server.mapper.domain.AgentSVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * packageName : com.itn.admin.agent.mapper + * fileName : AgentMapper + * author : hylee + * date : 2024-07-31 + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2024-07-31 hylee 최초 생성 + */ +@Mapper +public interface AgentSMapper { + int countByCurStateAndUserId(AgentSVO agentSVO); + + int updatetwoReport(AgentSVO agentSVO); +} diff --git a/src/main/java/com/itn/admin/agent/server/mapper/domain/AgentSVO.java b/src/main/java/com/itn/admin/agent/server/mapper/domain/AgentSVO.java new file mode 100644 index 0000000..0b0bdf7 --- /dev/null +++ b/src/main/java/com/itn/admin/agent/server/mapper/domain/AgentSVO.java @@ -0,0 +1,83 @@ +package com.itn.admin.agent.server.mapper.domain; + +import lombok.*; + +import java.io.Serializable; +import java.util.Date; + +/** + * packageName : com.itn.admin.agent.server.mapper.domain + * fileName : AgentSVO + * author : hylee + * date : 2024-07-31 + * description : 에이젼트 테스트발송 + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-05-09 hylee 최초 생성 + */ +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@Setter +@ToString +public class AgentSVO implements Serializable { + + private static final long serialVersionUID = 1L; + + + private String msgId; // 문자ID + private String userId; // 문자온 일반회원ID + private Integer userdata; // 사용자 정의 코드 + private Long msgSeq; // 메시지의 고유번호 + private String agentMsgId; // 고객전송 문자ID + private Integer curState; // 상태 값 + private Date sentDate; // 메시지를 전송한 시각 + private Date rsltDate; // 핸드폰에 전달된 시간 + private Date reportDate; // 레포트 처리한 시간 + private Date reqDate; // 예약일시 + private Integer rsltCode; // 결과처리코드 + private String rsltCode2; // 결과처리 상세코드 + private String rsltNet; // 결과처리 통신사 + private String callTo; // 수신번호 + private String callFrom; // 발신번호 + private String subject; // MMS경우 제목 + private String smsTxt; // SMS용 메시지본문 + private String msgType; // 메시지의 종류 + private String msgPayCode; // 최종전송콘텐트 종류 저장 + private Integer contSeq; // MMS의 콘텐츠 Key + private Integer msgTypeResend; // 재전송할 문자 타입 + private Integer centerSeqResend; // 재전송할 센터 + private String msgNoticetalkSenderKey; // 카카오 알림톡에 등록된 사용자 고유키 + private String msgNoticetalkTmpKey; // 카카오 알림톡에 등록된 문자 템플릿 고유키 + private Integer msgResendCount; // 재전송한 카운트 + private Date msgResendDate; // 재전송된 시간 + private Date sentDatePre; // 이전 메시지를 전송한 시각 + private Date rsltDatePre; // 이전 핸드폰에 전달된 시간 + private Date reportDatePre; // 이전 레포트 처리한 시간 + private Integer rsltCodePre; // 이전 결과처리코드 + private String rsltCode2Pre; // 이전 결과처리 상세코드 + private String rsltNetPre; // 이전 결과처리 통신사 + private String conectMthd; // 접속한 기기 + private String agentCode; // 전송사 + private String delFlag; // 사용자 삭제여부 + private Integer fileCnt; // 첨부파일 갯수 + private String filePath1; // 첨부파일 1 경로 + private String filePath2; // 첨부파일 2 경로 + private String filePath3; // 첨부파일 3 경로 + private String msgGroupId; // 문자그룹ID + private String neoType; // NEO MMS메세지 타입 + private String reserveCYn; // 예약 취소 유무 + private String refundYn; // 문자발송 실패의 환불처리 유무 + private Date resultLogUpdtPnttm; // LOG 테이블의 결과를 업데이트한 시간 + private String resellerCode; // 발송사업자 식별코드 정의 + private String bizKakaoResendType; // 카카오 재전송 type + private String bizKakaoResendData; // 카카오 재전송 내용 + private String bizKakaoJsonFile; // 카카오 json 첨부파일 + private String bizKakaoResendYn; // 카카오 재전송 여부 + private String bizKakaoTitle; // 카카오 강조유형 타이틀 + private String bizUmid; // 비즈뿌리오 서버에서 정의한 ID + + +} diff --git a/src/main/java/com/itn/admin/agent/server/service/AgentSService.java b/src/main/java/com/itn/admin/agent/server/service/AgentSService.java new file mode 100644 index 0000000..cd956dc --- /dev/null +++ b/src/main/java/com/itn/admin/agent/server/service/AgentSService.java @@ -0,0 +1,14 @@ +package com.itn.admin.agent.server.service; + +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import com.itn.admin.agent.server.mapper.domain.AgentSVO; +import com.itn.admin.cmn.msg.RestResponse; + + +public interface AgentSService { + + + RestResponse findByTransferCnt(AgentSVO agentSVO); + + RestResponse twoReport(AgentSVO agentSVO); +} diff --git a/src/main/java/com/itn/admin/agent/server/service/impl/AgentSServiceImpl.java b/src/main/java/com/itn/admin/agent/server/service/impl/AgentSServiceImpl.java new file mode 100644 index 0000000..fe9acd3 --- /dev/null +++ b/src/main/java/com/itn/admin/agent/server/service/impl/AgentSServiceImpl.java @@ -0,0 +1,41 @@ +package com.itn.admin.agent.server.service.impl; + +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import com.itn.admin.agent.server.mapper.AgentSMapper; +import com.itn.admin.agent.server.mapper.domain.AgentSVO; +import com.itn.admin.agent.server.service.AgentSService; +import com.itn.admin.cmn.msg.RestResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + + +@Slf4j +@Service +public class AgentSServiceImpl implements AgentSService { + + + @Autowired + AgentSMapper agentSMapper; + + @Override + public RestResponse findByTransferCnt(AgentSVO agentSVO) { + +// if("one".equals(agentSVO.getUserId())){} +// if("two".equals(agentSVO.getUserId())){} + int cnt = agentSMapper.countByCurStateAndUserId(agentSVO); + + return new RestResponse(HttpStatus.OK,"", cnt); + } + + @Override + public RestResponse twoReport(AgentSVO agentSVO) { + int cnt = agentSMapper.updatetwoReport(agentSVO); + return new RestResponse(HttpStatus.OK,"report를 시작합니다.", cnt); + } +} diff --git a/src/main/java/com/itn/admin/agent/server/web/AgentSController.java b/src/main/java/com/itn/admin/agent/server/web/AgentSController.java new file mode 100644 index 0000000..4189246 --- /dev/null +++ b/src/main/java/com/itn/admin/agent/server/web/AgentSController.java @@ -0,0 +1,18 @@ +package com.itn.admin.agent.server.web; + +import com.itn.admin.agent.client.two.service.AgentCTwoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; + +@Controller +public class AgentSController { + + private AgentCTwoService agentCTwoService; + + @Autowired + public void setCommuteService(AgentCTwoService agentCTwoService) { + this.agentCTwoService = agentCTwoService; + } + + +} diff --git a/src/main/java/com/itn/admin/agent/server/web/AgentSRestController.java b/src/main/java/com/itn/admin/agent/server/web/AgentSRestController.java new file mode 100644 index 0000000..7af951b --- /dev/null +++ b/src/main/java/com/itn/admin/agent/server/web/AgentSRestController.java @@ -0,0 +1,41 @@ +package com.itn.admin.agent.server.web; + +import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO; +import com.itn.admin.agent.server.mapper.domain.AgentSVO; +import com.itn.admin.agent.server.service.AgentSService; +import com.itn.admin.cmn.msg.RestResponse; +import org.springframework.beans.factory.annotation.Autowired; +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.RestController; + +@RestController +public class AgentSRestController { + + private AgentSService agentSService; + + @Autowired + public void setAgentService(AgentSService agentSService) { + this.agentSService = agentSService; + } + + /* + * + * */ + @PostMapping("/agent/server/findByTransferCnt") + public ResponseEntity findByTransferCnt(@RequestBody AgentSVO agentSVO) throws Exception { + return ResponseEntity.ok().body(agentSService.findByTransferCnt(agentSVO)); + } + + /* + * 전송사가 리턴해준것처럼 + * server DB에 update 함 + * @@ 대량 없뎃 + * */ + @PostMapping("/agent/server/two/report") + public ResponseEntity twoReport(@RequestBody AgentSVO agentSVO) throws Exception { + return ResponseEntity.ok().body(agentSService.twoReport(agentSVO)); + } + +} diff --git a/src/main/java/com/itn/admin/cmn/config/MjonAgentCTwoDatabaseConfig.java b/src/main/java/com/itn/admin/cmn/config/MjonAgentCTwoDatabaseConfig.java new file mode 100644 index 0000000..deddb75 --- /dev/null +++ b/src/main/java/com/itn/admin/cmn/config/MjonAgentCTwoDatabaseConfig.java @@ -0,0 +1,48 @@ +package com.itn.admin.cmn.config; + +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; + +import javax.sql.DataSource; + + +@Configuration +@MapperScan(value = "com.itn.admin.agent.client.two.mapper", sqlSessionFactoryRef = "factory3") +class MjonAgentCTwoDatabaseConfig { + + private final String COMMUTE_DATA_SOURCE = "MjagentClienTwoDatabase"; + + // A database DataSource + @Bean(COMMUTE_DATA_SOURCE) + @ConfigurationProperties(prefix = "spring.mjagent.client.two.datasource") + public DataSource CommuteDataSource() { + return DataSourceBuilder.create() +// .type(HikariDataSource.class) + .build(); + } + + // SqlSessionTemplate 에서 사용할 SqlSession 을 생성하는 Factory + @Bean(name = "factory3") + public SqlSessionFactory MjonAgentCTwoSqlSessionFactory(@Qualifier(COMMUTE_DATA_SOURCE) DataSource dataSource) throws Exception { + SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean(); + sqlSessionFactory.setDataSource(dataSource); + sqlSessionFactory.setTypeAliasesPackage("com.itn.admin.agent.client.two.*"); + sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/agent/client/two/*Mapper.xml")); + sqlSessionFactory.setConfigLocation(new PathMatchingResourcePatternResolver().getResource("classpath:mybatis-config.xml")); + return sqlSessionFactory.getObject(); + } + + // DataSource 에서 Transaction 관리를 위한 Manager 클래스 등록 + @Bean(name = "sqlSession3") + public SqlSessionTemplate sqlSession(SqlSessionFactory sqlSessionFactory) { + return new SqlSessionTemplate(sqlSessionFactory); + } +} \ No newline at end of file diff --git a/src/main/java/com/itn/admin/cmn/config/MjonAgentSDatabaseConfig.java b/src/main/java/com/itn/admin/cmn/config/MjonAgentSDatabaseConfig.java new file mode 100644 index 0000000..6821f99 --- /dev/null +++ b/src/main/java/com/itn/admin/cmn/config/MjonAgentSDatabaseConfig.java @@ -0,0 +1,48 @@ +package com.itn.admin.cmn.config; + +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; + +import javax.sql.DataSource; + + +@Configuration +@MapperScan(value = "com.itn.admin.agent.server.mapper", sqlSessionFactoryRef = "factory4") +class MjonAgentSDatabaseConfig { + + private final String AGENT_S_DATA_SOURCE = "MjagentServerDatabase"; + + // A database DataSource + @Bean(AGENT_S_DATA_SOURCE) + @ConfigurationProperties(prefix = "spring.mjagent.server.datasource") + public DataSource CommuteDataSource() { + return DataSourceBuilder.create() +// .type(HikariDataSource.class) + .build(); + } + + // SqlSessionTemplate 에서 사용할 SqlSession 을 생성하는 Factory + @Bean(name = "factory4") + public SqlSessionFactory MjonAgentSSqlSessionFactory(@Qualifier(AGENT_S_DATA_SOURCE) DataSource dataSource) throws Exception { + SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean(); + sqlSessionFactory.setDataSource(dataSource); + sqlSessionFactory.setTypeAliasesPackage("com.itn.admin.agent.server.*"); + sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/agent/server/*Mapper.xml")); + sqlSessionFactory.setConfigLocation(new PathMatchingResourcePatternResolver().getResource("classpath:mybatis-config.xml")); + return sqlSessionFactory.getObject(); + } + + // DataSource 에서 Transaction 관리를 위한 Manager 클래스 등록 + @Bean(name = "sqlSession4") + public SqlSessionTemplate sqlSession(SqlSessionFactory sqlSessionFactory) { + return new SqlSessionTemplate(sqlSessionFactory); + } +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0501964..9d7ccac 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -21,18 +21,40 @@ spring.thymeleaf.suffix=.html spring.thymeleaf.cache=false -# DB INFO +# itn_admin spring.main.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy spring.main.datasource.jdbc-url=jdbc:log4jdbc:mysql://119.193.215.98:3306/itn_admin?serverTimezone=Asia/Seoul spring.main.datasource.username=itnAdmin spring.main.datasource.password=itntest123 - -# DB INFO +# spring.commute.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy spring.commute.datasource.jdbc-url=jdbc:log4jdbc:mysql://192.168.0.200:3312/biostar2_ac?serverTimezone=Asia/Seoul spring.commute.datasource.username=root spring.commute.datasource.password=itntest! +# agent client 1 +spring.mjagent.client.one.userid=daltex +spring.mjagent.client.one.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy +spring.mjagent.client.one.datasource.jdbc-url=jdbc:log4jdbc:mysql://192.168.0.125:3306/mjonUr_agent?serverTimezone=Asia/Seoul +spring.mjagent.client.one.datasource.username=mjonUr_agent +spring.mjagent.client.one.datasource.password=mjagent123$ + +# agent client 2 +spring.mjagent.client.two.userid=006star +spring.mjagent.client.two.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy +spring.mjagent.client.two.datasource.jdbc-url=jdbc:log4jdbc:mysql://192.168.0.30:3306/mjonUr_agent?serverTimezone=Asia/Seoul +spring.mjagent.client.two.datasource.username=mjonAgentUr +spring.mjagent.client.two.datasource.password=mjonAgentUr!@#$ + +# agent server +spring.mjagent.server.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy +spring.mjagent.server.datasource.jdbc-url=jdbc:log4jdbc:mysql://119.193.215.98:3306/mjon_agent_back?serverTimezone=Asia/Seoul +spring.mjagent.server.datasource.username=mjonUr_agent +spring.mjagent.server.datasource.password=mjagent123$ + + + + logging.config=classpath:logback-spring.xml \ No newline at end of file diff --git a/src/main/resources/mapper-config.xml b/src/main/resources/mapper-config.xml deleted file mode 100644 index ff6292d..0000000 --- a/src/main/resources/mapper-config.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/agent/client/two/AgentCTwoMapper.xml b/src/main/resources/mapper/agent/client/two/AgentCTwoMapper.xml new file mode 100644 index 0000000..b4f7082 --- /dev/null +++ b/src/main/resources/mapper/agent/client/two/AgentCTwoMapper.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + INSERT INTO MUNJAON_MSG (MSG_TYPE, SEND_STATUS, REQUEST_DATE, RECV_PHONE, SEND_PHONE, MESSAGE) + VALUES + + (#{item.msgType}, #{item.sendStatus}, now(), #{item.recvPhone}, #{item.sendPhone}, #{item.message}) + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/agent/server/AgentSMapper.xml b/src/main/resources/mapper/agent/server/AgentSMapper.xml new file mode 100644 index 0000000..e1ac1aa --- /dev/null +++ b/src/main/resources/mapper/agent/server/AgentSMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + UPDATE mj_msg_data SET + CUR_STATE = 3, + SENT_DATE = NOW(), + RSLT_DATE = NOW(), + RSLT_CODE = 1000, + RSLT_NET = 'SKT' + WHERE CUR_STATE 3 + AND USER_ID = #{userId} + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index 2432410..fdcb435 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -17,7 +17,26 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/cmn/js/agent/init.js b/src/main/resources/static/cmn/js/agent/init.js new file mode 100644 index 0000000..40c0bb2 --- /dev/null +++ b/src/main/resources/static/cmn/js/agent/init.js @@ -0,0 +1,54 @@ + +$(function () { + + // 슬라이더 초기화 + $("#divTwoSms #slider").slider({ + range: "max", + min: 1, + max: 1000000, + value: 1, + slide: function (event, ui) { + $("#divTwoSms #sendCnt").val(ui.value); // 슬라이더 이동 시 input 값 업데이트 + } + }); + + // 슬라이더의 초기 값을 input에 설정 + $("#divTwoSms #sendCnt").val($("#divTwoSms #slider").slider("value")); + + // input 변경 시 슬라이더 값 업데이트 (실시간) + $("#divTwoSms #sendCnt").on("input", function () { + var value = $(this).val(); + // 숫자 범위 확인 후 슬라이더 값 업데이트 + if ($.isNumeric(value) && value >= 1 && value <= 1000000) { + $("#divTwoSms #slider").slider("value", value); + } + }); + + $("form").on("reset", function () { + setTimeout(function () { + $("#divTwoSms #sendCnt").val(1); // 건수 필드 값을 1로 설정 + $("#divTwoSms #slider").slider("value", 1); // 슬라이더 값도 1로 설정 + }, 0); // setTimeout 사용 이유: reset 이벤트 후에 값 설정 + }); + + /* + * 예시 버튼 + * */ + $("#divTwoSms #examBtn").on("click", function () { + $('#divTwoSms #recvPhone').val('01012345678') + $('#divTwoSms #sendPhone').val('01043219876') + // 메시지 필드에 값 설정 + $('#divTwoSms #message').val('message test ' + getNowDate()); + }); + + $('#toggle-info-btn').on('click', function() { + var $hiddenInfo = $('#hidden-info'); + $hiddenInfo.slideToggle(); // 애니메이션 효과를 추가하여 더 부드럽게 보이도록 함 + var icon = $(this).find('i'); + if ($hiddenInfo.is(':visible')) { + icon.removeClass('fa-info-circle').addClass('fa-times-circle'); + } else { + icon.removeClass('fa-times-circle').addClass('fa-info-circle'); + } + }); +}); \ No newline at end of file diff --git a/src/main/resources/static/cmn/js/agent/timerForOneC.js b/src/main/resources/static/cmn/js/agent/timerForOneC.js new file mode 100644 index 0000000..0de1537 --- /dev/null +++ b/src/main/resources/static/cmn/js/agent/timerForOneC.js @@ -0,0 +1,159 @@ +/* + +// 타이머 ID 저장을 위한 변수 +let insertCntIntervalId; +let transferCntIntervalId; +// insert 타이머 +let intervalId_insertSeconds; +// 이관 타이머 +let intervalId_transferSeconds; + +function startInsertTimer() { + console.log(' :: startInsertTimer :: '); + let startTime = Date.now(); + startInsertCntTimer(); + intervalId_insertSeconds = setInterval(function() { + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환 + document.getElementById('insertSeconds').innerText = elapsedTime.toFixed(3) + ' 초'; + }, 1); +} + +function startInsertCntTimer() { + // 1초마다 fn_insertCntAndTime 함수를 호출 + insertCntIntervalId = setInterval(fn_insertCntAndTime, 1000); +} + +function stopInsertTimer() { + clearInterval(intervalId_insertSeconds); + clearInterval(insertCntIntervalId); + console.log("insert 타이머가 멈췄습니다."); +} + + + +function fn_insertCntAndTime(){ + + + // 폼 데이터를 수집 + var formData = new FormData($("#divSmsTwo #sendForm")[0]); + + var jsonObject = {}; + formData.forEach((value, key) => { + jsonObject[key] = value; + }); + + $.ajax({ + type: "POST", + url: "/agent/two/findByInsertCnt", + data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송 + dataType: 'json', + contentType: 'application/json', + // async: true, + success: function (data) { + console.log('insert data : ', data); + + if (data.status == 'OK') { + var cnt = data.data; + + $('#divSmsTwoCard #insertCnt').text(cnt); + let text = $('#divSmsTwoCard #sendCntTxt').text(); + let numberOnly = text.match(/\d+/)[0]; + console.log('numberOnly :', numberOnly); + console.log('cnt >= numberOnly :', cnt >= numberOnly); + if(cnt >= numberOnly){ + stopInsertTimer(); + } + } + else { + alert("오류 알림 : :: "+data.msg); + } + }, + error: function (e) { + alert("조회에 실패하였습니다."); + console.log("ERROR : " + JSON.stringify(e)); + }, + beforeSend : function(xmlHttpRequest) { + }, + complete : function(xhr, textStatus) { + //로딩창 hide + } + }); +} + + + +function startTransferTimer(userId) { + console.log(' :: startTransferTimer :: '); + let startTime = Date.now(); + startTransferCntTimer(userId) + intervalId_transferSeconds = setInterval(function() { + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환 + document.getElementById('transferSeconds').innerText = elapsedTime.toFixed(3) + ' 초'; + }, 1); +} + +function startTransferCntTimer(userId) { + // 1초마다 fn_tranferCntAndTime 함수를 호출 + transferCntIntervalId = setInterval(function() { + fn_tranferCntAndTime(userId); + }, 1000); +} + + +function stopTransferTimer() { + clearInterval(intervalId_transferSeconds); + clearInterval(transferCntIntervalId); + console.log("이관 타이머가 멈췄습니다."); +} + + + +function fn_tranferCntAndTime(userId){ + + // 폼 데이터를 수집 + var formData = new FormData($("#divSmsTwo #sendForm")[0]); + + var jsonObject = {}; + formData.forEach((value, key) => { + jsonObject[key] = value; + }); + jsonObject['userId'] = userId; + console.log('jsonObject : ', jsonObject); + + $.ajax({ + type: "POST", + url: "/agent/server/findByTransferCnt", + data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송 + dataType: 'json', + contentType: 'application/json', + // async: true, + success: function (data) { + console.log('tranfer data : ', data); + + if (data.status == 'OK') { + var cnt = data.data; + + $('#divSmsTwoCard #trensferCnt').text(cnt); + let text = $('#divSmsTwoCard #insertCnt').text(); + let numberOnly = text.match(/\d+/)[0]; + if(cnt >= numberOnly){ + stopTransferTimer(); + } + } + else { + alert("오류 알림 : :: "+data.msg); + } + }, + error: function (e) { + alert("이관 조회에 실패하였습니다."); + console.log("ERROR : " + JSON.stringify(e)); + }, + beforeSend : function(xmlHttpRequest) { + }, + complete : function(xhr, textStatus) { + //로딩창 hide + } + }); +}*/ diff --git a/src/main/resources/static/cmn/js/agent/timerForTwoC.js b/src/main/resources/static/cmn/js/agent/timerForTwoC.js new file mode 100644 index 0000000..2b8b591 --- /dev/null +++ b/src/main/resources/static/cmn/js/agent/timerForTwoC.js @@ -0,0 +1,252 @@ + +// 타이머 ID 저장을 위한 변수 +let towInsertCntIntervalId; +let towTransferCntIntervalId; +let towReporingCntIntervalId; +// insert 타이머 +let twoIntervalId_insertSeconds; +// 이관 타이머 +let twoIntervalId_transferSeconds; +// 이관 타이머 +let twoIntervalId_reporingSeconds; + + + +function fn_twoScriptStart(){ + // 건수를 현황확인으로 이동 + $('#divTwoSmsCard #sendCntTxt').text('('+$('#divTwoSms #sendCnt').val()+'건)'); + twoStartInsertTimer(); // insert 타임어택 시작 + twoStartTransferTimer($('#twoUserId').val()); // 이관 카운트 +} + + +function fn_twoReportScriptStart(){ + twoStartReportTimer($('#twoUserId').val()); // report 타임어택 시작 +} + + + + +function twoStartInsertTimer() { + console.log(' :: startInsertTimer :: '); + let startTime = Date.now(); + twoStartInsertCntTimer(); + twoIntervalId_insertSeconds = setInterval(function() { + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환 + document.querySelector('#divTwoSmsCard #insertSeconds').innerText = elapsedTime.toFixed(3) + ' 초'; + }, 1); +} + +function twoStartInsertCntTimer() { + // 1초마다 fn_insertCntAndTime 함수를 호출 + towInsertCntIntervalId = setInterval(fn_twoInsertCntAndTime, 1000); +} + +function twoStopInsertTimer() { + clearInterval(twoIntervalId_insertSeconds); + clearInterval(towInsertCntIntervalId); + console.log("insert 타이머가 멈췄습니다."); +} + + + + +function fn_twoInsertCntAndTime(){ + + // 폼 데이터를 수집 + var formData = new FormData($("#divTwoSms #sendForm")[0]); + + var jsonObject = {}; + formData.forEach((value, key) => { + jsonObject[key] = value; + }); + + $.ajax({ + type: "POST", + url: "/agent/two/findByInsertCnt", + data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송 + dataType: 'json', + contentType: 'application/json', + // async: true, + success: function (data) { + console.log('insert data : ', data); + + if (data.status == 'OK') { + var cnt = data.data; + + $('#divTwoSmsCard #insertCnt').text(cnt); + let text = $('#divTwoSmsCard #sendCntTxt').text(); + let numberOnly = text.match(/\d+/)[0]; + console.log('numberOnly :', numberOnly); + console.log('cnt >= numberOnly :', cnt >= numberOnly); + if(cnt >= numberOnly){ + twoStopInsertTimer(); + } + } + else { + alert("오류 알림 : :: "+data.msg); + } + }, + error: function (e) { + alert("조회에 실패하였습니다."); + console.log("ERROR : " + JSON.stringify(e)); + }, + beforeSend : function(xmlHttpRequest) { + }, + complete : function(xhr, textStatus) { + //로딩창 hide + } + }); +} + + + +function twoStartTransferTimer(userId) { + console.log(' :: startTransferTimer :: '); + let startTime = Date.now(); + twoStartTransferCntTimer(userId) + twoIntervalId_transferSeconds = setInterval(function() { + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환 + document.getElementById('transferSeconds').innerText = elapsedTime.toFixed(3) + ' 초'; + }, 1); +} + +function twoStartTransferCntTimer(userId) { + // 1초마다 fn_tranferCntAndTime 함수를 호출 + towTransferCntIntervalId = setInterval(function() { + fn_twoTranferCntAndTime(userId); + }, 1000); +} + + +function twoStopTransferTimer() { + clearInterval(twoIntervalId_transferSeconds); + clearInterval(towTransferCntIntervalId); + console.log("이관 타이머가 멈췄습니다."); +} + + + +function fn_twoTranferCntAndTime(userId){ + + // 폼 데이터를 수집 + var formData = new FormData($("#divTwoSms #sendForm")[0]); + + var jsonObject = {}; + formData.forEach((value, key) => { + jsonObject[key] = value; + }); + jsonObject['userId'] = userId; + console.log('jsonObject : ', jsonObject); + + $.ajax({ + type: "POST", + url: "/agent/server/findByTransferCnt", + data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송 + dataType: 'json', + contentType: 'application/json', + // async: true, + success: function (data) { + console.log('tranfer data : ', data); + + if (data.status == 'OK') { + var cnt = data.data; + + $('#divTwoSmsCard #transferCnt').text(cnt); + let text = $('#divTwoSmsCard #insertCnt').text(); + let numberOnly = text.match(/\d+/)[0]; + if(cnt >= numberOnly){ + twoStopTransferTimer(); + } + } + else { + alert("오류 알림 : :: "+data.msg); + } + }, + error: function (e) { + alert("이관 조회에 실패하였습니다."); + console.log("ERROR : " + JSON.stringify(e)); + }, + beforeSend : function(xmlHttpRequest) { + }, + complete : function(xhr, textStatus) { + //로딩창 hide + } + }); +} + +// 리포트 영역 +// 리포트 영역 +// 리포트 영역 +function twoStartReportTimer(userId) { + console.log(' :: startReportTimer :: '); + let startTime = Date.now(); + twoStartReporingCntTimer(userId); + twoIntervalId_reporingSeconds = setInterval(function() { + let currentTime = Date.now(); + let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환 + document.querySelector('#divTwoSmsCard #reportSeconds').innerText = elapsedTime.toFixed(3) + ' 초'; + }, 1); +} + +function twoStartReporingCntTimer(userId) { + // 1초마다 fn_twoReportCntAndTime 함수를 호출 + towReporingCntIntervalId = setInterval(function() { + fn_twoReportCntAndTime(userId); + }, 1000); +} + +function twoStopReporingTimer() { + clearInterval(twoIntervalId_reporingSeconds); + clearInterval(towReporingCntIntervalId); + console.log("report 타이머가 멈췄습니다."); +} + + +function fn_twoReportCntAndTime(userId){ + + // 폼 데이터를 수집 + var formData = new FormData($("#divTwoSms #sendForm")[0]); + + var jsonObject = {}; + formData.forEach((value, key) => { + jsonObject[key] = value; + }); + jsonObject['userId'] = userId; + + $.ajax({ + type: "POST", + url: "/agent/two/findByInsertCnt", + data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송 + dataType: 'json', + contentType: 'application/json', + // async: true, + success: function (data) { + console.log('tranfer data : ', data); + + if (data.status == 'OK') { + var cnt = data.data; + + $('#divTwoSmsCard #reportSndCnt').text(cnt); + if(cnt == 0){ + twoStopReporingTimer(); + } + } + else { + alert("오류 알림 : :: "+data.msg); + } + }, + error: function (e) { + alert("report 조회에 실패하였습니다."); + console.log("ERROR : " + JSON.stringify(e)); + }, + beforeSend : function(xmlHttpRequest) { + + }, + complete : function(xhr, textStatus) { + //로딩창 hide + } + }); +} diff --git a/src/main/resources/templates/agent/view.html b/src/main/resources/templates/agent/view.html new file mode 100644 index 0000000..aed9775 --- /dev/null +++ b/src/main/resources/templates/agent/view.html @@ -0,0 +1,427 @@ + + + + + + agent 발송 테스트 + + + + + + + + + + + + + +
+
+ + + + + +
+ +
+
+
+
+

AGENT 발송 테스트

+
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+

Client 2 SMS

+
+ + +
+
+ + + +
+
+ + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + + + + +
+ +
+ +
+ +
+ +
+
+
+

현황확인

+ + +
+
+
+
+
+
+ +
+ 클라이언트 insert +
+ 0 + 건수 +
+
+
+
+ + 0초 + +
+
+
+ +
+
+ +
+ 데이터 이관 시간 (client -> server) +
+ 0 + 건수 +
+
+
+
+ + 0초 + +
+
+
+ +
+
+ +
+ 클라이언트 report +
+ 0 + + 0 + 건수 +
+
+
+
+ + 0초 + +
+
+
+ + +
+ +
+
+ +
+
+
+
+ + +
+ +
+ +
+ +
+ + +
+ + + + +
+
+ + + + +
+ + + + + + + + + + + diff --git a/src/main/resources/templates/fragments/header.html b/src/main/resources/templates/fragments/header.html index 5a2f992..4749e8f 100644 --- a/src/main/resources/templates/fragments/header.html +++ b/src/main/resources/templates/fragments/header.html @@ -12,7 +12,12 @@ - + + + + + + diff --git a/src/main/resources/templates/fragments/mainsidebar.html b/src/main/resources/templates/fragments/mainsidebar.html index 2a59b50..6e7f7ba 100644 --- a/src/main/resources/templates/fragments/mainsidebar.html +++ b/src/main/resources/templates/fragments/mainsidebar.html @@ -78,6 +78,25 @@ +