문자 agent 테스트 페이지
This commit is contained in:
parent
a7fb4db3bc
commit
8694e21d0c
9
pom.xml
9
pom.xml
@ -152,6 +152,15 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.openkoreantext/open-korean-text -->
|
||||
<dependency>
|
||||
<groupId>org.openkoreantext</groupId>
|
||||
<artifactId>open-korean-text</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -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<AgentCTwoVO> findAll(AgentCTwoVO agentCTwoVO);
|
||||
|
||||
void insertAgents(List<AgentCTwoVO> agentCTwoVO);
|
||||
|
||||
int countBySendStatusNotAndMsgType(AgentCTwoVO agentCTwoVO);
|
||||
}
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -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<AgentCTwoVO> 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<AgentCTwoVO> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<RestResponse> send(@RequestBody AgentCTwoVO agentCTwoVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentCTwoService.send(agentCTwoVO));
|
||||
}
|
||||
|
||||
/*
|
||||
* client db에 insert 됐는지 확인 count
|
||||
* */
|
||||
@PostMapping("/agent/two/findByInsertCnt")
|
||||
public ResponseEntity<RestResponse> findByInsertCnt(@RequestBody AgentCTwoVO agentCTwoVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentCTwoService.findByInsertCnt(agentCTwoVO));
|
||||
}
|
||||
|
||||
/*
|
||||
* client db에 insert 됐는지 확인 count
|
||||
* */
|
||||
// @PostMapping("/agent/two/findByReportCnt")
|
||||
// public ResponseEntity<RestResponse> findByReportCnt(@RequestBody AgentCTwoVO agentCTwoVO) throws Exception {
|
||||
// return ResponseEntity.ok().body(agentCTwoService.findByReportCnt(agentCTwoVO));
|
||||
// }
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -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
|
||||
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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<RestResponse> findByTransferCnt(@RequestBody AgentSVO agentSVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentSService.findByTransferCnt(agentSVO));
|
||||
}
|
||||
|
||||
/*
|
||||
* 전송사가 리턴해준것처럼
|
||||
* server DB에 update 함
|
||||
* @@ 대량 없뎃
|
||||
* */
|
||||
@PostMapping("/agent/server/two/report")
|
||||
public ResponseEntity<RestResponse> twoReport(@RequestBody AgentSVO agentSVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentSService.twoReport(agentSVO));
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<!--Mybatis 설정 -->
|
||||
<settings>
|
||||
<!-- 전통적인 데이터베이스 컬럼명 형태인 A_COLUMN을 CamelCase형태의 자바 프로퍼티명 형태인 aColumn으로 자동으로 매핑하도록 함 -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"></setting>
|
||||
<!-- 파라미터에 Null 값이 있을 경우 에러 처리 -->
|
||||
<setting name="jdbcTypeForNull" value="VARCHAR"></setting>
|
||||
</settings>
|
||||
|
||||
<!-- Type Aliases 설정-->
|
||||
<typeAliases>
|
||||
<typeAlias alias="dictionaryVO" type="com.itn.admin.itn.dict.mapper.domain.DictionaryVO" />
|
||||
</typeAliases>
|
||||
</configuration>
|
||||
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.itn.admin.agent.client.two.mapper.AgentCTwoMapper">
|
||||
|
||||
<select id="findAll" resultType="agentCTwoVO" parameterType="agentCTwoVO">
|
||||
SELECT
|
||||
MSG_TYPE
|
||||
, SEND_STATUS
|
||||
, REQUEST_DATE
|
||||
, RECV_PHONE
|
||||
, SEND_PHONE
|
||||
, MESSAGE
|
||||
from MUNJAON_MSG
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 대량의 데이터를 삽입하는 쿼리 -->
|
||||
<insert id="insertAgents" parameterType="java.util.List">
|
||||
INSERT INTO MUNJAON_MSG (MSG_TYPE, SEND_STATUS, REQUEST_DATE, RECV_PHONE, SEND_PHONE, MESSAGE)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.msgType}, #{item.sendStatus}, now(), #{item.recvPhone}, #{item.sendPhone}, #{item.message})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="countBySendStatusNotAndMsgType" resultType="Integer" parameterType="agentCTwoVO">
|
||||
SELECT
|
||||
count(*) as cnt
|
||||
FROM
|
||||
MUNJAON_MSG
|
||||
WHERE SEND_STATUS != 1000
|
||||
and MSG_TYPE = #{msgType}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
32
src/main/resources/mapper/agent/server/AgentSMapper.xml
Normal file
32
src/main/resources/mapper/agent/server/AgentSMapper.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.itn.admin.agent.server.mapper.AgentSMapper">
|
||||
|
||||
|
||||
<select id="countByCurStateAndUserId" resultType="Integer" parameterType="agentSVO">
|
||||
SELECT
|
||||
count(*)
|
||||
FROM
|
||||
mj_msg_data
|
||||
WHERE
|
||||
CUR_STATE <![CDATA[ < ]]>3
|
||||
AND USER_ID = #{userId}
|
||||
</select>
|
||||
|
||||
<update id="updatetwoReport" parameterType="agentSVO">
|
||||
UPDATE mj_msg_data SET
|
||||
CUR_STATE = 3,
|
||||
SENT_DATE = NOW(),
|
||||
RSLT_DATE = NOW(),
|
||||
RSLT_CODE = 1000,
|
||||
RSLT_NET = 'SKT'
|
||||
WHERE CUR_STATE <![CDATA[ < ]]>3
|
||||
AND USER_ID = #{userId}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -17,7 +17,26 @@
|
||||
<typeAlias type="com.itn.admin.commute.mapper.domain.CommuteVO" alias="commuteVO"/>
|
||||
<typeAlias type="com.itn.admin.itn.dict.mapper.domain.DictionaryVO" alias="dictionaryVO"/>
|
||||
<typeAlias type="com.itn.admin.itn.user.mapper.domain.UserVO" alias="userVO"/>
|
||||
<typeAlias type="com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO" alias="agentCTwoVO"/>
|
||||
<typeAlias type="com.itn.admin.agent.server.mapper.domain.AgentSVO" alias="agentSVO"/>
|
||||
|
||||
</typeAliases>
|
||||
|
||||
<!-- <environments default="development">-->
|
||||
<!-- <environment id="development">-->
|
||||
<!-- <transactionManager type="JDBC">-->
|
||||
<!-- <property name="..." value="..."/>-->
|
||||
<!-- </transactionManager>-->
|
||||
<!-- <dataSource type="POOLED">-->
|
||||
<!-- <property name="driver" value="net.sf.log4jdbc.sql.jdbcapi.DriverSpy"/>-->
|
||||
<!-- <property name="url" value="jdbc:log4jdbc:mysql://192.168.0.30:3306/mjonUr_agent?serverTimezone=Asia/Seoul"/>-->
|
||||
<!-- <property name="username" value="mjonAgentUr"/>-->
|
||||
<!-- <property name="password" value="mjonAgentUr!@#$"/>-->
|
||||
<!-- </dataSource>-->
|
||||
<!-- </environment>-->
|
||||
<!-- </environments>-->
|
||||
<!-- <mappers>-->
|
||||
<!-- <mapper resource="mapper/agent/AgentCTwoMapper.xml"/>-->
|
||||
<!-- </mappers>-->
|
||||
|
||||
</configuration>
|
||||
54
src/main/resources/static/cmn/js/agent/init.js
Normal file
54
src/main/resources/static/cmn/js/agent/init.js
Normal file
@ -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');
|
||||
}
|
||||
});
|
||||
});
|
||||
159
src/main/resources/static/cmn/js/agent/timerForOneC.js
Normal file
159
src/main/resources/static/cmn/js/agent/timerForOneC.js
Normal file
@ -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
|
||||
}
|
||||
});
|
||||
}*/
|
||||
252
src/main/resources/static/cmn/js/agent/timerForTwoC.js
Normal file
252
src/main/resources/static/cmn/js/agent/timerForTwoC.js
Normal file
@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
427
src/main/resources/templates/agent/view.html
Normal file
427
src/main/resources/templates/agent/view.html
Normal file
@ -0,0 +1,427 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- 관련 Namespace 선언 및 layout:decorate 추가 -->
|
||||
<html lang="en"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="layout">
|
||||
<head>
|
||||
<!-- layout.html 에 들어간 head 부분을 제외하고 개별 파일에만 적용되는 head 부분 추가 -->
|
||||
<title>agent 발송 테스트</title>
|
||||
|
||||
<!-- 필요하다면 개별 파일에 사용될 css/js 선언 -->
|
||||
|
||||
<link rel="stylesheet" th:href="@{/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/plugins/datatables-responsive/css/responsive.bootstrap4.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/plugins/datatables-buttons/css/buttons.bootstrap4.min.css}">
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<style>
|
||||
.example-button {
|
||||
border-radius: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.input-group .example-button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.slider {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#hidden-info {
|
||||
background-color: #f9f9f9;
|
||||
border-top: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
|
||||
.info-section {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
margin: 0;
|
||||
padding-left: 10px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
#toggle-info-btn i {
|
||||
transition: transform 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
#toggle-info-btn.rotate i {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body layout:fragment="body">
|
||||
|
||||
<div class="wrapper">
|
||||
<div th:replace="~{fragments/top_nav :: topFragment}"/>
|
||||
|
||||
<!-- Main Sidebar Container -->
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4"
|
||||
th:insert="~{fragments/mainsidebar :: sidebarFragment}">
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">AGENT 발송 테스트</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">AGENT 발송 테스트</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<!-- /.card -->
|
||||
|
||||
<div class="col-md-6" id="divTwoSms">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Client 2 SMS</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse">
|
||||
<i class="fas fa-minus"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-tool" id="toggle-info-btn">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div id="hidden-info" class="p-3" style="display: none;">
|
||||
<div class="info-section">
|
||||
<p class="section-title">사용자ID</p>
|
||||
<p class="info-item">- 006star</p>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<p class="section-title">DB정보</p>
|
||||
<p class="info-item">- 192.168.0.30:3306</p>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<p class="section-title">msg 발송 TB</p>
|
||||
<p class="info-item">- MUNJAON_MSG</p>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<p class="section-title">msg 리포팅 TB</p>
|
||||
<p class="info-item">- MUNJAON_MSG_LOG</p>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<p class="section-title">서버위치</p>
|
||||
<p class="info-item">- 192.168.0.78</p>
|
||||
<p class="info-item">- /home/mjon_client_agent_2</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<form id="sendForm">
|
||||
<input type="hidden" name="msgType" value="S">
|
||||
<input type="hidden" name="sendStatus" value="0">
|
||||
<input type="hidden" id="oneUserId" th:value="${oneUserId}">
|
||||
<input type="hidden" id="twoUserId" th:value="${twoUserId}">
|
||||
<div class="form-group">
|
||||
<label for="recvPhone">수신번호</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="recvPhone" name="recvPhone" placeholder="수신번호 - RECV_PHONE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sendPhone">회신번호</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="sendPhone" name="sendPhone" placeholder="회신번호 - SEND_PHONE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sendPhone">메세지</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="message" name="message" placeholder="메세지 - MESSAGE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="slider">건수 (max 1000000)</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control sliderValue" id="sendCnt" name="sendCnt" placeholder="건수" >
|
||||
<div class="slider mt-2" id="slider"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary w-20" id="sendBtn">발송</button>
|
||||
<button type="button" class="btn btn-info w-40" id="examBtn">예시입력</button>
|
||||
<button type="reset" class="btn btn-secondary w-30">Reset</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
|
||||
<div class="card" id="divTwoSmsCard">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-start align-items-center">
|
||||
<h3 class="card-title mb-0">현황확인</h3>
|
||||
<span class="text-primary font-weight-bold h4 ml-2" id="sendCntTxt"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row"><!-- 클라이언트 insert -->
|
||||
<div class="col-md-4 col-sm-6 col-12">
|
||||
<div class="info-box bg-light">
|
||||
<span class="info-box-icon bg-gray"><i class="fas fa-upload"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">클라이언트 insert</span>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="info-box-number" id="insertCnt">0</span>
|
||||
<span class="info-box-unit font-weight-bold">건수</span>
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" style="width: 100%"></div>
|
||||
</div>
|
||||
<span class="progress-description" id="insertSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 데이터 이관 시간 -->
|
||||
<div class="col-md-4 col-sm-6 col-12">
|
||||
<div class="info-box bg-light">
|
||||
<span class="info-box-icon bg-gray"><i class="fas fa-clock"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">데이터 이관 시간 (client -> server)</span>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="info-box-number" id="transferCnt">0</span>
|
||||
<span class="info-box-unit font-weight-bold">건수</span>
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" style="width: 100%"></div>
|
||||
</div>
|
||||
<span class="progress-description" id="transferSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 클라이언트 report -->
|
||||
<div class="col-md-4 col-sm-6 col-12">
|
||||
<div class="info-box bg-light">
|
||||
<span class="info-box-icon bg-gray"><i class="fas fa-chart-line"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">클라이언트 report</span>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="info-box-number" id="reportStartCnt">0</span>
|
||||
<span class="info-box-number mx-2">→</span>
|
||||
<span class="info-box-number" id="reportSndCnt">0</span>
|
||||
<span class="info-box-unit font-weight-bold ml-2">건수</span>
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" style="width: 100%"></div>
|
||||
</div>
|
||||
<span class="progress-description" id="reportSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- Reporting start 버튼 -->
|
||||
<div class="row">
|
||||
<div class="col-12 text-left">
|
||||
<button class="btn btn-primary" id="reportingStartBtn" data-tagid="twoUserId">Reporting start</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
</section>
|
||||
<!-- /Main content -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- /.content-wrapper -->
|
||||
<footer class="main-footer"
|
||||
th:insert="~{fragments/footer :: footerFragment}">
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Control sidebar content goes here -->
|
||||
</aside>
|
||||
<!-- /.control-sidebar -->
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
<script th:src="@{/cmn/js/agent/init.js}"></script>
|
||||
<script th:src="@{/cmn/js/agent/timerForOneC.js}"></script>
|
||||
<script th:src="@{/cmn/js/agent/timerForTwoC.js}"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
|
||||
/*
|
||||
* client_2 msg insert
|
||||
* */
|
||||
$("#divTwoSms #sendBtn").on("click", function () {
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divTwoSms #sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
jsonObject[key] = value;
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/agent/two/send",
|
||||
data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
// async: true,
|
||||
success: function (data) {
|
||||
console.log('data : ', data);
|
||||
|
||||
if (data.status == 'OK') {
|
||||
fn_successAlert('경과시간 : '+data.data, data.msg);
|
||||
// fn_successAlert(data, message)
|
||||
}
|
||||
else {
|
||||
alert("오류 알림 : :: "+data.msg);
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
alert("저장에 실패하였습니다.");
|
||||
console.log("ERROR : " + JSON.stringify(e));
|
||||
},
|
||||
beforeSend : function(xmlHttpRequest) {
|
||||
fn_twoScriptStart();
|
||||
|
||||
},
|
||||
complete : function(xhr, textStatus) {
|
||||
twoStopInsertTimer();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* client_2 reporting 버튼
|
||||
* */
|
||||
$("#divTwoSmsCard #reportingStartBtn").on("click", function () {
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divTwoSms #sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
jsonObject[key] = value;
|
||||
});
|
||||
var usertagId = '#'+$(this).data('tagid');
|
||||
var userId = $(usertagId).val();
|
||||
jsonObject['userId'] = userId;
|
||||
|
||||
console.log('jsonObject : ', jsonObject);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/agent/server/two/report",
|
||||
data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
// async: true,
|
||||
success: function (data) {
|
||||
console.log('data : ', data);
|
||||
|
||||
if (data.status == 'OK') {
|
||||
$("#divTwoSmsCard #reportStartCnt").text(data.data);
|
||||
fn_successAlert(data.data+'건', data.msg);
|
||||
}
|
||||
else {
|
||||
alert("오류 알림 : :: "+data.msg);
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
alert("저장에 실패하였습니다.");
|
||||
console.log("ERROR : " + JSON.stringify(e));
|
||||
},
|
||||
beforeSend : function(xmlHttpRequest) {
|
||||
// 건수를 현황확인으로 이동
|
||||
fn_twoReportScriptStart();
|
||||
|
||||
},
|
||||
complete : function(xhr, textStatus) {
|
||||
twoStopInsertTimer();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function getNowDate(){
|
||||
|
||||
// 현재 날짜와 시간을 가져와서 포맷팅
|
||||
var now = new Date();
|
||||
var year = String(now.getFullYear()).substring(2); // 년도 마지막 두 자리
|
||||
var month = ('0' + (now.getMonth() + 1)).slice(-2); // 월 (0부터 시작하므로 +1 필요)
|
||||
var day = ('0' + now.getDate()).slice(-2); // 일
|
||||
var hours = ('0' + now.getHours()).slice(-2); // 시
|
||||
var minutes = ('0' + now.getMinutes()).slice(-2); // 분
|
||||
|
||||
return year + month + day + '|' + hours + ':' + minutes;
|
||||
}
|
||||
|
||||
function fn_successAlert(title, msg){
|
||||
$(document).Toasts('create', {
|
||||
class: 'bg-info',
|
||||
title: title,
|
||||
subtitle: '',
|
||||
autohide : true,
|
||||
delay: 6000,
|
||||
body: msg
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
</html>
|
||||
@ -12,7 +12,12 @@
|
||||
<!-- <link rel="stylesheet" th:href="@{/css/fontawesome/all.min.css}">-->
|
||||
<!-- Ionicons -->
|
||||
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
||||
<!-- Tempusdominus Bootstrap 4 -->
|
||||
<!-- Ion Slider -->
|
||||
<link rel="stylesheet" th:href="@{/plugins/ion-rangeslider/css/ion.rangeSlider.min.css}">
|
||||
<!-- bootstrap slider -->
|
||||
<link rel="stylesheet" th:href="@{/plugins/bootstrap-slider/css/bootstrap-slider.min.css}">
|
||||
|
||||
|
||||
<link rel="stylesheet" th:href="@{/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css}">
|
||||
<!-- iCheck -->
|
||||
<link rel="stylesheet" th:href="@{/plugins/icheck-bootstrap/icheck-bootstrap.min.css}">
|
||||
|
||||
@ -78,6 +78,25 @@
|
||||
<!-- </p>-->
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link" >
|
||||
<i class="nav-icon fas fa-edit"></i>
|
||||
<!-- <i class="nav-icon fas fa-tachometer-alt"></i>-->
|
||||
<p>
|
||||
테스트
|
||||
<i class="right fas fa-angle-left"></i>
|
||||
</p>
|
||||
</a>
|
||||
<ul class="nav nav-treeview">
|
||||
<li class="nav-item">
|
||||
<a th:href="@{/agent/view}" class="nav-link">
|
||||
<!-- <i class="far fa-circle nav-icon"></i>-->
|
||||
<i class="far fa-circle nav-icon"></i>
|
||||
<p>agent발송</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!--
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user