문자 agent 테스트 페이지 기능 추가
This commit is contained in:
parent
8694e21d0c
commit
50c3760e66
@ -0,0 +1,60 @@
|
||||
package com.itn.admin.agent.client.cmm.service;
|
||||
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public abstract class AbstractAgentService<T, M> implements AgentService<T> {
|
||||
|
||||
@Autowired
|
||||
protected M mapper; // 매퍼를 protected로 선언하여 서브 클래스에서 접근 가능
|
||||
|
||||
private static final int BATCH_SIZE = 10000;
|
||||
|
||||
@Override
|
||||
public RestResponse send(T agentVO) {
|
||||
List<T> agentVOL = new ArrayList<>();
|
||||
int sendCnt = parseSendCount(agentVO);
|
||||
|
||||
for (int i = 0; i < sendCnt; i++) {
|
||||
T paramVO = createCopy(agentVO, i);
|
||||
agentVOL.add(paramVO);
|
||||
}
|
||||
|
||||
int totalSize = agentVOL.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<T> batchList = agentVOL.subList(i, end);
|
||||
insertBatch(batchList);
|
||||
logBatchProgress(i, totalBatches);
|
||||
}
|
||||
long endTime = System.currentTimeMillis() / 1000;
|
||||
long totalTime = endTime - startTime;
|
||||
log.info("insert 시간 : [{}]", totalTime);
|
||||
return new RestResponse(HttpStatus.OK, "데이터를 정상적으로 입력했습니다.", totalTime + "초");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResponse findByInsertCnt(T agentVO) {
|
||||
int count = countByCondition(agentVO);
|
||||
return new RestResponse(HttpStatus.OK, "", count);
|
||||
}
|
||||
|
||||
protected abstract int countByCondition(T agentVO);
|
||||
protected abstract int parseSendCount(T agentVO);
|
||||
protected abstract T createCopy(T originalVO, int index);
|
||||
protected abstract void insertBatch(List<T> batchList);
|
||||
|
||||
private void logBatchProgress(int i, int totalBatches) {
|
||||
int currentBatch = (i / BATCH_SIZE) + 1;
|
||||
log.info("현재 처리 중인 배치: [{}]", currentBatch + "/" + totalBatches);
|
||||
log.info("남은 배치 수: [{}]", (totalBatches - currentBatch));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.itn.admin.agent.client.cmm.service;
|
||||
|
||||
import com.itn.admin.cmn.msg.RestResponse;
|
||||
|
||||
public interface AgentService<T> {
|
||||
RestResponse send(T agentVO);
|
||||
RestResponse findByInsertCnt(T agentVO);
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.itn.admin.agent.client.one.mapper;
|
||||
|
||||
import com.itn.admin.agent.client.one.mapper.domain.AgentCOneVO;
|
||||
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 AgentCOneMapper {
|
||||
|
||||
List<AgentCOneVO> findAll(AgentCOneVO agentCTwoVO);
|
||||
|
||||
void insertAgents(List<AgentCOneVO> agentCTwoVO);
|
||||
|
||||
int countBySendStatusNotAndMsgType(AgentCOneVO agentCTwoVO);
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.itn.admin.agent.client.one.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 AgentCOneVO 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 subject;
|
||||
private String message;
|
||||
private String sendCnt;
|
||||
|
||||
private String cnt;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.itn.admin.agent.client.one.service;
|
||||
|
||||
import com.itn.admin.agent.client.one.mapper.domain.AgentCOneVO;
|
||||
import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO;
|
||||
import com.itn.admin.cmn.msg.RestResponse;
|
||||
|
||||
|
||||
public interface AgentCOneService {
|
||||
|
||||
|
||||
|
||||
RestResponse send(AgentCOneVO agentCOneVO);
|
||||
|
||||
RestResponse findByInsertCnt(AgentCOneVO agentCOneVO);
|
||||
|
||||
// RestResponse findByReportCnt(AgentCTwoVO agentCTwoVO);
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.itn.admin.agent.client.one.service.impl;
|
||||
|
||||
import com.itn.admin.agent.client.cmm.service.AbstractAgentService;
|
||||
import com.itn.admin.agent.client.one.mapper.AgentCOneMapper;
|
||||
import com.itn.admin.agent.client.one.mapper.domain.AgentCOneVO;
|
||||
import com.itn.admin.agent.client.one.service.AgentCOneService;
|
||||
import com.itn.admin.cmn.msg.RestResponse;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j@Service
|
||||
public class AgentCOneServiceImpl extends AbstractAgentService<AgentCOneVO, AgentCOneMapper> implements AgentCOneService {
|
||||
|
||||
@Autowired
|
||||
private AgentCOneMapper agentCOneMapper;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
this.mapper = agentCOneMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int countByCondition(AgentCOneVO agentVO) {
|
||||
return mapper.countBySendStatusNotAndMsgType(agentVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int parseSendCount(AgentCOneVO agentVO) {
|
||||
try {
|
||||
return (agentVO.getSendCnt() != null && !agentVO.getSendCnt().isEmpty()) ? Integer.parseInt(agentVO.getSendCnt()) : 0;
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AgentCOneVO createCopy(AgentCOneVO originalVO, int index) {
|
||||
AgentCOneVO paramVO = new AgentCOneVO();
|
||||
String msgType = originalVO.getMsgType();
|
||||
|
||||
paramVO.setMsgType(msgType);
|
||||
paramVO.setSendStatus(originalVO.getSendStatus());
|
||||
paramVO.setRecvPhone(modifyPhoneNumber(originalVO.getRecvPhone(), index));
|
||||
paramVO.setSendPhone(modifyPhoneNumber(originalVO.getSendPhone(), index));
|
||||
paramVO.setMessage(originalVO.getMessage() + " " + (index + 1));
|
||||
if (!"S".equals(msgType)) {
|
||||
paramVO.setSubject(originalVO.getSubject() + " " + (index + 1));
|
||||
}
|
||||
return paramVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertBatch(List<AgentCOneVO> batchList) {
|
||||
mapper.insertAgents(batchList);
|
||||
}
|
||||
|
||||
|
||||
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,32 @@
|
||||
package com.itn.admin.agent.client.one.web;
|
||||
|
||||
import com.itn.admin.agent.client.one.mapper.domain.AgentCOneVO;
|
||||
import com.itn.admin.agent.client.one.service.AgentCOneService;
|
||||
import com.itn.admin.agent.client.two.mapper.domain.AgentCTwoVO;
|
||||
import com.itn.admin.agent.client.two.service.AgentCTwoService;
|
||||
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 AgentCOneController {
|
||||
|
||||
private AgentCOneService agentCOneService;
|
||||
|
||||
@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 setAgentCOneService(AgentCOneService agentCOneService) {
|
||||
this.agentCOneService = agentCOneService;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.itn.admin.agent.client.one.web;
|
||||
|
||||
import com.itn.admin.agent.client.one.mapper.domain.AgentCOneVO;
|
||||
import com.itn.admin.agent.client.one.service.AgentCOneService;
|
||||
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.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 AgentCOneRestController {
|
||||
|
||||
private AgentCOneService agentCOneService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
public void setAgentService(AgentCOneService agentCOneService) {
|
||||
this.agentCOneService = agentCOneService;
|
||||
}
|
||||
|
||||
/*
|
||||
* client db에 insert
|
||||
* */
|
||||
@PostMapping("/agent/one/send")
|
||||
public ResponseEntity<RestResponse> send(@RequestBody AgentCOneVO agentCOneVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentCOneService.send(agentCOneVO));
|
||||
}
|
||||
|
||||
/*
|
||||
* client db에 insert 됐는지 확인 count
|
||||
* */
|
||||
@PostMapping("/agent/one/findByInsertCnt")
|
||||
public ResponseEntity<RestResponse> findByInsertCnt(@RequestBody AgentCOneVO agentCOneVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentCOneService.findByInsertCnt(agentCOneVO));
|
||||
}
|
||||
|
||||
/*
|
||||
* client db에 insert 됐는지 확인 count
|
||||
* */
|
||||
// @PostMapping("/agent/two/findByReportCnt")
|
||||
// public ResponseEntity<RestResponse> findByReportCnt(@RequestBody AgentCTwoVO agentCTwoVO) throws Exception {
|
||||
// return ResponseEntity.ok().body(agentCTwoService.findByReportCnt(agentCTwoVO));
|
||||
// }
|
||||
}
|
||||
@ -29,6 +29,7 @@ public class AgentCTwoVO implements Serializable {
|
||||
private String requestSate;
|
||||
private String recvPhone;
|
||||
private String sendPhone;
|
||||
private String subject;
|
||||
private String message;
|
||||
private String sendCnt;
|
||||
|
||||
|
||||
@ -1,119 +1,65 @@
|
||||
package com.itn.admin.agent.client.two.service.impl;
|
||||
|
||||
import com.itn.admin.agent.client.cmm.service.AbstractAgentService;
|
||||
import com.itn.admin.agent.client.one.service.AgentCOneService;
|
||||
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 com.itn.admin.agent.client.two.service.AgentCTwoService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
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 {
|
||||
public class AgentCTwoServiceImpl extends AbstractAgentService<AgentCTwoVO, AgentCTwoMapper> implements AgentCTwoService {
|
||||
|
||||
|
||||
@Autowired
|
||||
AgentCTwoMapper agentCTwoMapper;
|
||||
private AgentCTwoMapper agentCTwoMapper;
|
||||
|
||||
// private SqlSession sqlSession;
|
||||
private static final int BATCH_SIZE = 10000; // 배치 크기 설정
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
this.mapper = agentCTwoMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResponse send(AgentCTwoVO agentCTwoVO) {
|
||||
|
||||
System.out.println("t : "+ agentCTwoVO.toString());
|
||||
List<AgentCTwoVO> agentCTwoVOL = new ArrayList<>();
|
||||
|
||||
String sendCntStr = agentCTwoVO.getSendCnt();
|
||||
int sendCnt;
|
||||
protected int countByCondition(AgentCTwoVO agentVO) {
|
||||
return mapper.countBySendStatusNotAndMsgType(agentVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int parseSendCount(AgentCTwoVO agentVO) {
|
||||
try {
|
||||
sendCnt = (sendCntStr != null && !sendCntStr.isEmpty()) ? Integer.parseInt(sendCntStr) : 0;
|
||||
return (agentVO.getSendCnt() != null && !agentVO.getSendCnt().isEmpty()) ? Integer.parseInt(agentVO.getSendCnt()) : 0;
|
||||
} catch (NumberFormatException e) {
|
||||
// 변환에 실패하면 기본값으로 설정
|
||||
sendCnt = 0;
|
||||
return 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) {
|
||||
protected AgentCTwoVO createCopy(AgentCTwoVO originalVO, int index) {
|
||||
AgentCTwoVO paramVO = new AgentCTwoVO();
|
||||
String msgType = originalVO.getMsgType();
|
||||
|
||||
int cnt = agentCTwoMapper.countBySendStatusNotAndMsgType(agentCTwoVO);
|
||||
|
||||
return new RestResponse(HttpStatus.OK,"", cnt);
|
||||
paramVO.setMsgType(msgType);
|
||||
paramVO.setSendStatus(originalVO.getSendStatus());
|
||||
paramVO.setRecvPhone(modifyPhoneNumber(originalVO.getRecvPhone(), index));
|
||||
paramVO.setSendPhone(modifyPhoneNumber(originalVO.getSendPhone(), index));
|
||||
paramVO.setMessage(originalVO.getMessage() + " " + (index + 1));
|
||||
if (!"S".equals(msgType)) {
|
||||
paramVO.setSubject(originalVO.getSubject() + " " + (index + 1));
|
||||
}
|
||||
return paramVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertBatch(List<AgentCTwoVO> batchList) {
|
||||
mapper.insertAgents(batchList);
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public RestResponse findByReportCnt(AgentCTwoVO agentCTwoVO) {
|
||||
// int cnt = agentCTwoMapper.countBySendStatusNotAndMsgType(agentCTwoVO);
|
||||
//
|
||||
// return new RestResponse(HttpStatus.OK,"", cnt);
|
||||
// }
|
||||
|
||||
|
||||
private String modifyPhoneNumber(String phone, int index) {
|
||||
|
||||
@ -22,7 +22,7 @@ public class AgentCTwoController {
|
||||
|
||||
|
||||
@Autowired
|
||||
public void setCommuteService(AgentCTwoService agentCTwoService) {
|
||||
public void setAgentCTwoService(AgentCTwoService agentCTwoService) {
|
||||
this.agentCTwoService = agentCTwoService;
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ 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.*;
|
||||
|
||||
|
||||
@ -3,8 +3,6 @@ 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
|
||||
@ -13,12 +11,12 @@ import java.util.List;
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* -----------------------------$------------------------------
|
||||
* 2024-07-31 hylee 최초 생성
|
||||
*/
|
||||
@Mapper
|
||||
public interface AgentSMapper {
|
||||
int countByCurStateAndUserId(AgentSVO agentSVO);
|
||||
|
||||
int updatetwoReport(AgentSVO agentSVO);
|
||||
int updateReportWhereUserId(AgentSVO agentSVO);
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
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;
|
||||
|
||||
@ -10,5 +9,5 @@ public interface AgentSService {
|
||||
|
||||
RestResponse findByTransferCnt(AgentSVO agentSVO);
|
||||
|
||||
RestResponse twoReport(AgentSVO agentSVO);
|
||||
RestResponse serverReport(AgentSVO agentSVO);
|
||||
}
|
||||
|
||||
@ -1,19 +1,14 @@
|
||||
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
|
||||
@ -26,16 +21,14 @@ public class AgentSServiceImpl implements AgentSService {
|
||||
@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);
|
||||
public RestResponse serverReport(AgentSVO agentSVO) {
|
||||
int cnt = agentSMapper.updateReportWhereUserId(agentSVO);
|
||||
return new RestResponse(HttpStatus.OK,"report를 시작합니다.", cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
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;
|
||||
@ -33,9 +32,9 @@ public class AgentSRestController {
|
||||
* server DB에 update 함
|
||||
* @@ 대량 없뎃
|
||||
* */
|
||||
@PostMapping("/agent/server/two/report")
|
||||
public ResponseEntity<RestResponse> twoReport(@RequestBody AgentSVO agentSVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentSService.twoReport(agentSVO));
|
||||
@PostMapping("/agent/server/report")
|
||||
public ResponseEntity<RestResponse> serverReport(@RequestBody AgentSVO agentSVO) throws Exception {
|
||||
return ResponseEntity.ok().body(agentSService.serverReport(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.one.mapper", sqlSessionFactoryRef = "factory5")
|
||||
class MjonAgentCOneDatabaseConfig {
|
||||
|
||||
private final String COMMUTE_DATA_SOURCE = "MjagentClienOneDatabase";
|
||||
|
||||
// A database DataSource
|
||||
@Bean(COMMUTE_DATA_SOURCE)
|
||||
@ConfigurationProperties(prefix = "spring.mjagent.client.one.datasource")
|
||||
public DataSource CommuteDataSource() {
|
||||
return DataSourceBuilder.create()
|
||||
// .type(HikariDataSource.class)
|
||||
.build();
|
||||
}
|
||||
|
||||
// SqlSessionTemplate 에서 사용할 SqlSession 을 생성하는 Factory
|
||||
@Bean(name = "factory5")
|
||||
public SqlSessionFactory MjonAgentCOneSqlSessionFactory(@Qualifier(COMMUTE_DATA_SOURCE) DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean();
|
||||
sqlSessionFactory.setDataSource(dataSource);
|
||||
sqlSessionFactory.setTypeAliasesPackage("com.itn.admin.agent.client.one.*");
|
||||
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/agent/client/one/*Mapper.xml"));
|
||||
sqlSessionFactory.setConfigLocation(new PathMatchingResourcePatternResolver().getResource("classpath:mybatis-config.xml"));
|
||||
return sqlSessionFactory.getObject();
|
||||
}
|
||||
|
||||
// DataSource 에서 Transaction 관리를 위한 Manager 클래스 등록
|
||||
@Bean(name = "sqlSession5")
|
||||
public SqlSessionTemplate sqlSession(SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
||||
@ -37,7 +37,7 @@ 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.jdbc-url=jdbc:log4jdbc:mysql://192.168.0.125:3306/mjon_agent?serverTimezone=Asia/Seoul
|
||||
spring.mjagent.client.one.datasource.username=mjonUr_agent
|
||||
spring.mjagent.client.one.datasource.password=mjagent123$
|
||||
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
<?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.one.mapper.AgentCOneMapper">
|
||||
|
||||
<select id="findAll" resultType="agentCOneVO" parameterType="agentCOneVO">
|
||||
/* one findAll */
|
||||
SELECT
|
||||
MSG_TYPE
|
||||
, SEND_STATUS
|
||||
, REQUEST_DATE
|
||||
, RECV_PHONE
|
||||
, SEND_PHONE
|
||||
, MESSAGE
|
||||
from MUNJAON_MSG
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 대량의 데이터를 삽입하는 쿼리 -->
|
||||
<insert id="insertAgents" parameterType="java.util.List">
|
||||
/* two insertAgents */
|
||||
INSERT INTO MUNJAON_MSG
|
||||
(
|
||||
MSG_TYPE
|
||||
, SEND_STATUS
|
||||
, REQUEST_DATE
|
||||
, RECV_PHONE
|
||||
, SEND_PHONE
|
||||
, SUBJECT
|
||||
, MESSAGE
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.msgType}
|
||||
, #{item.sendStatus}
|
||||
, now()
|
||||
, #{item.recvPhone}
|
||||
, #{item.sendPhone}
|
||||
, #{item.subject}
|
||||
, #{item.message}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="countBySendStatusNotAndMsgType" resultType="Integer" parameterType="agentCOneVO">
|
||||
/* one countBySendStatusNotAndMsgType */
|
||||
SELECT
|
||||
count(*) as cnt
|
||||
FROM
|
||||
MUNJAON_MSG
|
||||
WHERE SEND_STATUS != 1000
|
||||
and MSG_TYPE = #{msgType}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -6,6 +6,7 @@
|
||||
<mapper namespace="com.itn.admin.agent.client.two.mapper.AgentCTwoMapper">
|
||||
|
||||
<select id="findAll" resultType="agentCTwoVO" parameterType="agentCTwoVO">
|
||||
/* two findAll */
|
||||
SELECT
|
||||
MSG_TYPE
|
||||
, SEND_STATUS
|
||||
@ -19,15 +20,34 @@
|
||||
|
||||
<!-- 대량의 데이터를 삽입하는 쿼리 -->
|
||||
<insert id="insertAgents" parameterType="java.util.List">
|
||||
INSERT INTO MUNJAON_MSG (MSG_TYPE, SEND_STATUS, REQUEST_DATE, RECV_PHONE, SEND_PHONE, MESSAGE)
|
||||
/* two insertAgents */
|
||||
INSERT INTO MUNJAON_MSG
|
||||
(
|
||||
MSG_TYPE
|
||||
, SEND_STATUS
|
||||
, REQUEST_DATE
|
||||
, RECV_PHONE
|
||||
, SEND_PHONE
|
||||
, SUBJECT
|
||||
, MESSAGE
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.msgType}, #{item.sendStatus}, now(), #{item.recvPhone}, #{item.sendPhone}, #{item.message})
|
||||
(
|
||||
#{item.msgType}
|
||||
, #{item.sendStatus}
|
||||
, now()
|
||||
, #{item.recvPhone}
|
||||
, #{item.sendPhone}
|
||||
, #{item.subject}
|
||||
, #{item.message}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="countBySendStatusNotAndMsgType" resultType="Integer" parameterType="agentCTwoVO">
|
||||
/* two countBySendStatusNotAndMsgType */
|
||||
SELECT
|
||||
count(*) as cnt
|
||||
FROM
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
AND USER_ID = #{userId}
|
||||
</select>
|
||||
|
||||
<update id="updatetwoReport" parameterType="agentSVO">
|
||||
<update id="updateReportWhereUserId" parameterType="agentSVO">
|
||||
UPDATE mj_msg_data SET
|
||||
CUR_STATE = 3,
|
||||
SENT_DATE = NOW(),
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
<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.one.mapper.domain.AgentCOneVO" alias="agentCOneVO"/>
|
||||
<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"/>
|
||||
|
||||
|
||||
@ -1,27 +1,32 @@
|
||||
|
||||
$(function () {
|
||||
|
||||
// 슬라이더 초기화
|
||||
$("#divTwoSms #slider").slider({
|
||||
range: "max",
|
||||
min: 1,
|
||||
max: 1000000,
|
||||
value: 1,
|
||||
slide: function (event, ui) {
|
||||
$("#divTwoSms #sendCnt").val(ui.value); // 슬라이더 이동 시 input 값 업데이트
|
||||
}
|
||||
});
|
||||
$(".slider").each(function () {
|
||||
var $slider = $(this); // 현재 슬라이더 요소
|
||||
var $input = $slider.closest('.input-group').find('.sliderValue'); // 해당 슬라이더의 input 요소
|
||||
|
||||
// 슬라이더의 초기 값을 input에 설정
|
||||
$("#divTwoSms #sendCnt").val($("#divTwoSms #slider").slider("value"));
|
||||
// 슬라이더 초기화
|
||||
$slider.slider({
|
||||
range: "max",
|
||||
min: 1,
|
||||
max: 1000000,
|
||||
value: 1,
|
||||
slide: function (event, ui) {
|
||||
$input.val(ui.value); // 슬라이더 이동 시 input 값 업데이트
|
||||
}
|
||||
});
|
||||
|
||||
// input 변경 시 슬라이더 값 업데이트 (실시간)
|
||||
$("#divTwoSms #sendCnt").on("input", function () {
|
||||
var value = $(this).val();
|
||||
// 숫자 범위 확인 후 슬라이더 값 업데이트
|
||||
if ($.isNumeric(value) && value >= 1 && value <= 1000000) {
|
||||
$("#divTwoSms #slider").slider("value", value);
|
||||
}
|
||||
// 슬라이더의 초기 값을 input에 설정
|
||||
$input.val($slider.slider("value"));
|
||||
|
||||
// input 변경 시 슬라이더 값 업데이트 (실시간)
|
||||
$input.on("input", function () {
|
||||
var value = $(this).val();
|
||||
// 숫자 범위 확인 후 슬라이더 값 업데이트
|
||||
if ($.isNumeric(value) && value >= 1 && value <= 1000000) {
|
||||
$slider.slider("value", value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("form").on("reset", function () {
|
||||
@ -34,15 +39,71 @@ $(function () {
|
||||
/*
|
||||
* 예시 버튼
|
||||
* */
|
||||
$("#divTwoSms #examBtn").on("click", function () {
|
||||
$('#divTwoSms #recvPhone').val('01012345678')
|
||||
$('#divTwoSms #sendPhone').val('01043219876')
|
||||
// 메시지 필드에 값 설정
|
||||
$('#divTwoSms #message').val('message test ' + getNowDate());
|
||||
$(".examBtn").on("click", function () {
|
||||
|
||||
var tagId = getParentsId($(this));
|
||||
var $recvPhone = $(tagId + ' .recvPhone');
|
||||
var $sendPhone = $(tagId + ' .sendPhone');
|
||||
var $msgType = $(tagId + ' .msgType');
|
||||
var $message = $(tagId + ' .message');
|
||||
var $subject = $(tagId + ' .subject');
|
||||
|
||||
// 기본 전화번호 설정
|
||||
$recvPhone.val('01012345678');
|
||||
$sendPhone.val('01043219876');
|
||||
|
||||
// 메시지 타입에 따른 메시지 설정
|
||||
var msgType = $msgType.val();
|
||||
var msg = generateMessage(msgType);
|
||||
|
||||
// 내용
|
||||
$message.val(msg);
|
||||
|
||||
if (msgType === 'L'
|
||||
||msgType === 'M'
|
||||
||msgType === 'A'
|
||||
||msgType === 'F'
|
||||
) {
|
||||
$subject.val('ITN SUBJECT');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function generateMessage(msgType) {
|
||||
var messages = {
|
||||
'S': 'ITN SMS test ',
|
||||
'L': 'ITN LMS test ',
|
||||
'M': 'ITN MMS message test ',
|
||||
'A': 'ITN ',
|
||||
'F': 'ITN '
|
||||
};
|
||||
// 타입이 위 값들고 같이 않으면 null 반환
|
||||
return (messages[msgType] || '') + getNowDate();
|
||||
}
|
||||
$('.msgType').on('change', function() {
|
||||
|
||||
var msgType = $(this).val();
|
||||
var tagId = getParentsId($(this));
|
||||
if(msgType === 'L'
|
||||
||msgType === 'M'
|
||||
||msgType === 'A'
|
||||
||msgType === 'F'
|
||||
) {
|
||||
$(tagId+' .subject').closest('.form-group').show();
|
||||
}else{
|
||||
$(tagId+' .subject').closest('.form-group').hide();
|
||||
}
|
||||
|
||||
var $message = $(tagId + ' .message');
|
||||
$message.val(generateMessage(msgType));
|
||||
|
||||
});
|
||||
|
||||
$('#toggle-info-btn').on('click', function() {
|
||||
var $hiddenInfo = $('#hidden-info');
|
||||
|
||||
$('.toggle-info-btn').on('click', function() {
|
||||
var $card = $(this).closest('.card'); // 클릭한 버튼의 가장 가까운 부모 .card 요소 찾기
|
||||
var $hiddenInfo = $card.find('.hidden-info'); // 해당 카드 내에서 .hidden-info 요소 찾기
|
||||
|
||||
$hiddenInfo.slideToggle(); // 애니메이션 효과를 추가하여 더 부드럽게 보이도록 함
|
||||
var icon = $(this).find('i');
|
||||
if ($hiddenInfo.is(':visible')) {
|
||||
@ -51,4 +112,24 @@ $(function () {
|
||||
icon.removeClass('fa-times-circle').addClass('fa-info-circle');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getParentsId($obj){
|
||||
|
||||
var $col = $obj.closest('.col-md-6'); // 클릭한 버튼의 가장 가까운 부모 .card 요소 찾기
|
||||
// 해당 카드 내에서 .hidden-info 요소 찾기
|
||||
return '#' + $col.attr('id');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1,68 +1,93 @@
|
||||
/*
|
||||
|
||||
// 타이머 ID 저장을 위한 변수
|
||||
let insertCntIntervalId;
|
||||
let transferCntIntervalId;
|
||||
let oneInsertCntIntervalId;
|
||||
let oneTransferCntIntervalId;
|
||||
let oneReporingCntIntervalId;
|
||||
// insert 타이머
|
||||
let intervalId_insertSeconds;
|
||||
let oneIntervalId_insertSeconds;
|
||||
// 이관 타이머
|
||||
let intervalId_transferSeconds;
|
||||
let oneIntervalId_transferSeconds;
|
||||
// 이관 타이머
|
||||
let oneIntervalId_reporingSeconds;
|
||||
|
||||
function startInsertTimer() {
|
||||
|
||||
|
||||
function fn_oneScriptStart(){
|
||||
// 건수를 현황확인으로 이동
|
||||
$('#divOneSmsCard .sendCntTxt').text('('+$('#divOneSms .sliderValue').val()+'건)');
|
||||
oneStartInsertTimer(); // insert 타임어택 시작
|
||||
oneStartTransferTimer($('#oneUserId').val()); // 이관 카운트
|
||||
}
|
||||
|
||||
|
||||
function fn_oneReportScriptStart(){
|
||||
oneStartReportTimer($('#oneUserId').val()); // report 타임어택 시작
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function oneStartInsertTimer() {
|
||||
console.log(' :: startInsertTimer :: ');
|
||||
let startTime = Date.now();
|
||||
startInsertCntTimer();
|
||||
intervalId_insertSeconds = setInterval(function() {
|
||||
oneStartInsertCntTimer();
|
||||
oneIntervalId_insertSeconds = setInterval(function() {
|
||||
let currentTime = Date.now();
|
||||
let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환
|
||||
document.getElementById('insertSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
// 분과 초로 변환
|
||||
let minutes = Math.floor(elapsedTime / 60); // 분 계산
|
||||
let seconds = (elapsedTime % 60).toFixed(3); // 나머지 초 계산
|
||||
|
||||
document.querySelector('#divOneSmsCard .insertSeconds').innerText = minutes + ' 분 ' + seconds + ' 초';
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function startInsertCntTimer() {
|
||||
function oneStartInsertCntTimer() {
|
||||
console.log('oneStartInsertCntTimer ::');
|
||||
// 1초마다 fn_insertCntAndTime 함수를 호출
|
||||
insertCntIntervalId = setInterval(fn_insertCntAndTime, 1000);
|
||||
oneInsertCntIntervalId = setInterval(fn_oneInsertCntAndTime, 1000);
|
||||
}
|
||||
|
||||
function stopInsertTimer() {
|
||||
clearInterval(intervalId_insertSeconds);
|
||||
clearInterval(insertCntIntervalId);
|
||||
function oneStopInsertTimer() {
|
||||
clearInterval(oneIntervalId_insertSeconds);
|
||||
clearInterval(oneInsertCntIntervalId);
|
||||
console.log("insert 타이머가 멈췄습니다.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fn_insertCntAndTime(){
|
||||
|
||||
function fn_oneInsertCntAndTime(){
|
||||
|
||||
console.log('fn_oneInsertCntAndTime ::');
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divSmsTwo #sendForm")[0]);
|
||||
var formData = new FormData($("#divOneSms .sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
jsonObject[key] = value;
|
||||
});
|
||||
|
||||
console.log('url : /agent/one/findByInsertCnt');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/agent/two/findByInsertCnt",
|
||||
url: "/agent/one/findByInsertCnt",
|
||||
data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
// async: true,
|
||||
success: function (data) {
|
||||
console.log('insert data : ', data);
|
||||
console.log(' one findByInsertCnt data : ', data);
|
||||
|
||||
if (data.status == 'OK') {
|
||||
if (data.status === 'OK') {
|
||||
var cnt = data.data;
|
||||
|
||||
$('#divSmsTwoCard #insertCnt').text(cnt);
|
||||
let text = $('#divSmsTwoCard #sendCntTxt').text();
|
||||
$('#divOneSmsCard .insertCnt').text(cnt);
|
||||
let text = $('#divOneSmsCard .sendCntTxt').text();
|
||||
let numberOnly = text.match(/\d+/)[0];
|
||||
console.log('numberOnly :', numberOnly);
|
||||
console.log('cnt >= numberOnly :', cnt >= numberOnly);
|
||||
console.log(' one numberOnly :', numberOnly);
|
||||
console.log(' one cnt >= numberOnly :', cnt >= numberOnly);
|
||||
if(cnt >= numberOnly){
|
||||
stopInsertTimer();
|
||||
oneStopInsertTimer();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -83,37 +108,37 @@ function fn_insertCntAndTime(){
|
||||
|
||||
|
||||
|
||||
function startTransferTimer(userId) {
|
||||
console.log(' :: startTransferTimer :: ');
|
||||
function oneStartTransferTimer(userId) {
|
||||
console.log(' :: one startTransferTimer :: ');
|
||||
let startTime = Date.now();
|
||||
startTransferCntTimer(userId)
|
||||
intervalId_transferSeconds = setInterval(function() {
|
||||
oneStartTransferCntTimer(userId)
|
||||
oneIntervalId_transferSeconds = setInterval(function() {
|
||||
let currentTime = Date.now();
|
||||
let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환
|
||||
document.getElementById('transferSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
document.querySelector('#divOneSmsCard .transferSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function startTransferCntTimer(userId) {
|
||||
function oneStartTransferCntTimer(userId) {
|
||||
// 1초마다 fn_tranferCntAndTime 함수를 호출
|
||||
transferCntIntervalId = setInterval(function() {
|
||||
fn_tranferCntAndTime(userId);
|
||||
oneTransferCntIntervalId = setInterval(function() {
|
||||
fn_oneTranferCntAndTime(userId);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
function stopTransferTimer() {
|
||||
clearInterval(intervalId_transferSeconds);
|
||||
clearInterval(transferCntIntervalId);
|
||||
function oneStopTransferTimer() {
|
||||
clearInterval(oneIntervalId_transferSeconds);
|
||||
clearInterval(oneTransferCntIntervalId);
|
||||
console.log("이관 타이머가 멈췄습니다.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fn_tranferCntAndTime(userId){
|
||||
function fn_oneTranferCntAndTime(userId){
|
||||
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divSmsTwo #sendForm")[0]);
|
||||
var formData = new FormData($("#divOneSms .sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
@ -135,11 +160,11 @@ function fn_tranferCntAndTime(userId){
|
||||
if (data.status == 'OK') {
|
||||
var cnt = data.data;
|
||||
|
||||
$('#divSmsTwoCard #trensferCnt').text(cnt);
|
||||
let text = $('#divSmsTwoCard #insertCnt').text();
|
||||
$('#divOneSmsCard .transferCnt').text(cnt);
|
||||
let text = $('#divOneSmsCard .insertCnt').text();
|
||||
let numberOnly = text.match(/\d+/)[0];
|
||||
if(cnt >= numberOnly){
|
||||
stopTransferTimer();
|
||||
oneStopTransferTimer();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -156,4 +181,78 @@ function fn_tranferCntAndTime(userId){
|
||||
//로딩창 hide
|
||||
}
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
// 리포트 영역
|
||||
// 리포트 영역
|
||||
// 리포트 영역
|
||||
function oneStartReportTimer(userId) {
|
||||
console.log(' :: startReportTimer :: ');
|
||||
let startTime = Date.now();
|
||||
oneStartReporingCntTimer(userId);
|
||||
oneIntervalId_reporingSeconds = setInterval(function() {
|
||||
let currentTime = Date.now();
|
||||
let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환
|
||||
document.querySelector('#divOneSmsCard .reportSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function oneStartReporingCntTimer(userId) {
|
||||
// 1초마다 fn_twoReportCntAndTime 함수를 호출
|
||||
oneReporingCntIntervalId = setInterval(function() {
|
||||
fn_oneReportCntAndTime(userId);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function oneStopReporingTimer() {
|
||||
clearInterval(oneIntervalId_reporingSeconds);
|
||||
clearInterval(oneReporingCntIntervalId);
|
||||
console.log("report 타이머가 멈췄습니다.");
|
||||
}
|
||||
|
||||
|
||||
function fn_oneReportCntAndTime(userId){
|
||||
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divOneSms .sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
jsonObject[key] = value;
|
||||
});
|
||||
jsonObject['userId'] = userId;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/agent/one/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;
|
||||
|
||||
$('#divOneSmsCard .reportSndCnt').text(cnt);
|
||||
if(cnt == 0){
|
||||
oneStopReporingTimer();
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("오류 알림 : :: "+data.msg);
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
alert("report 조회에 실패하였습니다.");
|
||||
console.log("ERROR : " + JSON.stringify(e));
|
||||
},
|
||||
beforeSend : function(xmlHttpRequest) {
|
||||
|
||||
},
|
||||
complete : function(xhr, textStatus) {
|
||||
//로딩창 hide
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
|
||||
// 타이머 ID 저장을 위한 변수
|
||||
let towInsertCntIntervalId;
|
||||
let towTransferCntIntervalId;
|
||||
let towReporingCntIntervalId;
|
||||
let twoInsertCntIntervalId;
|
||||
let twoTransferCntIntervalId;
|
||||
let twoReporingCntIntervalId;
|
||||
// insert 타이머
|
||||
let twoIntervalId_insertSeconds;
|
||||
// 이관 타이머
|
||||
@ -14,7 +14,7 @@ let twoIntervalId_reporingSeconds;
|
||||
|
||||
function fn_twoScriptStart(){
|
||||
// 건수를 현황확인으로 이동
|
||||
$('#divTwoSmsCard #sendCntTxt').text('('+$('#divTwoSms #sendCnt').val()+'건)');
|
||||
$('#divTwoSmsCard .sendCntTxt').text('('+$('#divTwoSms .sliderValue').val()+'건)');
|
||||
twoStartInsertTimer(); // insert 타임어택 시작
|
||||
twoStartTransferTimer($('#twoUserId').val()); // 이관 카운트
|
||||
}
|
||||
@ -34,18 +34,22 @@ function twoStartInsertTimer() {
|
||||
twoIntervalId_insertSeconds = setInterval(function() {
|
||||
let currentTime = Date.now();
|
||||
let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환
|
||||
document.querySelector('#divTwoSmsCard #insertSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
// 분과 초로 변환
|
||||
let minutes = Math.floor(elapsedTime / 60); // 분 계산
|
||||
let seconds = (elapsedTime % 60).toFixed(3); // 나머지 초 계산
|
||||
|
||||
document.querySelector('#divTwoSmsCard .insertSeconds').innerText = minutes + ' 분 ' + seconds + ' 초';
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function twoStartInsertCntTimer() {
|
||||
// 1초마다 fn_insertCntAndTime 함수를 호출
|
||||
towInsertCntIntervalId = setInterval(fn_twoInsertCntAndTime, 1000);
|
||||
twoInsertCntIntervalId = setInterval(fn_twoInsertCntAndTime, 1000);
|
||||
}
|
||||
|
||||
function twoStopInsertTimer() {
|
||||
clearInterval(twoIntervalId_insertSeconds);
|
||||
clearInterval(towInsertCntIntervalId);
|
||||
clearInterval(twoInsertCntIntervalId);
|
||||
console.log("insert 타이머가 멈췄습니다.");
|
||||
}
|
||||
|
||||
@ -55,7 +59,7 @@ function twoStopInsertTimer() {
|
||||
function fn_twoInsertCntAndTime(){
|
||||
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divTwoSms #sendForm")[0]);
|
||||
var formData = new FormData($("#divTwoSms .sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
@ -75,8 +79,8 @@ function fn_twoInsertCntAndTime(){
|
||||
if (data.status == 'OK') {
|
||||
var cnt = data.data;
|
||||
|
||||
$('#divTwoSmsCard #insertCnt').text(cnt);
|
||||
let text = $('#divTwoSmsCard #sendCntTxt').text();
|
||||
$('#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);
|
||||
@ -103,19 +107,20 @@ function fn_twoInsertCntAndTime(){
|
||||
|
||||
|
||||
function twoStartTransferTimer(userId) {
|
||||
console.log(' :: startTransferTimer :: ');
|
||||
console.log(' :: two 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) + ' 초';
|
||||
// console.log('elapsedTime : ', elapsedTime);
|
||||
document.querySelector('#divTwoSmsCard .transferSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function twoStartTransferCntTimer(userId) {
|
||||
// 1초마다 fn_tranferCntAndTime 함수를 호출
|
||||
towTransferCntIntervalId = setInterval(function() {
|
||||
twoTransferCntIntervalId = setInterval(function() {
|
||||
fn_twoTranferCntAndTime(userId);
|
||||
}, 1000);
|
||||
}
|
||||
@ -123,7 +128,7 @@ function twoStartTransferCntTimer(userId) {
|
||||
|
||||
function twoStopTransferTimer() {
|
||||
clearInterval(twoIntervalId_transferSeconds);
|
||||
clearInterval(towTransferCntIntervalId);
|
||||
clearInterval(twoTransferCntIntervalId);
|
||||
console.log("이관 타이머가 멈췄습니다.");
|
||||
}
|
||||
|
||||
@ -132,7 +137,7 @@ function twoStopTransferTimer() {
|
||||
function fn_twoTranferCntAndTime(userId){
|
||||
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divTwoSms #sendForm")[0]);
|
||||
var formData = new FormData($("#divTwoSms .sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
@ -154,8 +159,8 @@ function fn_twoTranferCntAndTime(userId){
|
||||
if (data.status == 'OK') {
|
||||
var cnt = data.data;
|
||||
|
||||
$('#divTwoSmsCard #transferCnt').text(cnt);
|
||||
let text = $('#divTwoSmsCard #insertCnt').text();
|
||||
$('#divTwoSmsCard .transferCnt').text(cnt);
|
||||
let text = $('#divTwoSmsCard .insertCnt').text();
|
||||
let numberOnly = text.match(/\d+/)[0];
|
||||
if(cnt >= numberOnly){
|
||||
twoStopTransferTimer();
|
||||
@ -187,20 +192,20 @@ function twoStartReportTimer(userId) {
|
||||
twoIntervalId_reporingSeconds = setInterval(function() {
|
||||
let currentTime = Date.now();
|
||||
let elapsedTime = (currentTime - startTime) / 1000; // 밀리초를 초 단위로 변환
|
||||
document.querySelector('#divTwoSmsCard #reportSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
document.querySelector('#divTwoSmsCard .reportSeconds').innerText = elapsedTime.toFixed(3) + ' 초';
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function twoStartReporingCntTimer(userId) {
|
||||
// 1초마다 fn_twoReportCntAndTime 함수를 호출
|
||||
towReporingCntIntervalId = setInterval(function() {
|
||||
twoReporingCntIntervalId = setInterval(function() {
|
||||
fn_twoReportCntAndTime(userId);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function twoStopReporingTimer() {
|
||||
clearInterval(twoIntervalId_reporingSeconds);
|
||||
clearInterval(towReporingCntIntervalId);
|
||||
clearInterval(twoReporingCntIntervalId);
|
||||
console.log("report 타이머가 멈췄습니다.");
|
||||
}
|
||||
|
||||
@ -208,7 +213,7 @@ function twoStopReporingTimer() {
|
||||
function fn_twoReportCntAndTime(userId){
|
||||
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divTwoSms #sendForm")[0]);
|
||||
var formData = new FormData($("#divTwoSms .sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
@ -229,7 +234,7 @@ function fn_twoReportCntAndTime(userId){
|
||||
if (data.status == 'OK') {
|
||||
var cnt = data.data;
|
||||
|
||||
$('#divTwoSmsCard #reportSndCnt').text(cnt);
|
||||
$('#divTwoSmsCard .reportSndCnt').text(cnt);
|
||||
if(cnt == 0){
|
||||
twoStopReporingTimer();
|
||||
}
|
||||
|
||||
@ -51,11 +51,11 @@
|
||||
color: #555;
|
||||
}
|
||||
|
||||
#toggle-info-btn i {
|
||||
.toggle-info-btn i {
|
||||
transition: transform 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
#toggle-info-btn.rotate i {
|
||||
.toggle-info-btn.rotate i {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
</style>
|
||||
@ -95,31 +95,34 @@
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<input type="hidden" id="oneUserId" th:value="${oneUserId}">
|
||||
<input type="hidden" id="twoUserId" th:value="${twoUserId}">
|
||||
<!-- <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 class="col-md-6" id="divOneSms">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Client 1 (daltex)</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 toggle-info-btn">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div id="hidden-info" class="p-3" style="display: none;">
|
||||
</div>
|
||||
<div class="p-3 hidden-info" style="display: none;">
|
||||
<!-- Client 1의 정보 -->
|
||||
<div class="p-3 hidden-info" style="display: none;">
|
||||
<div class="info-section">
|
||||
<p class="section-title">사용자ID</p>
|
||||
<p class="info-item">- 006star</p>
|
||||
<p class="info-item">- daltex</p>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<p class="section-title">DB정보</p>
|
||||
<p class="info-item">- 192.168.0.30:3306</p>
|
||||
<p class="info-item">- 192.168.0.125:3306</p>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<p class="section-title">msg 발송 TB</p>
|
||||
@ -132,77 +135,274 @@
|
||||
<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>
|
||||
<p class="info-item">- /home/mjon_client_agent_1</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-body">
|
||||
<form class="sendForm">
|
||||
<!-- Client 1의 입력 폼 -->
|
||||
<input type="hidden" name="sendStatus" value="0">
|
||||
<div class="form-group">
|
||||
<label for="msgType1">문자타입 - MSG_TYPE</label>
|
||||
<div class="input-group">
|
||||
<select type="text" class="form-control msgType" id="msgType1" name="msgType">
|
||||
<option value="S">SMS</option>
|
||||
<option value="L">LMS</option>
|
||||
<option value="M">MMS</option>
|
||||
<option value="A">알림톡</option>
|
||||
<option value="F">친구톡</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="recvPhone1">수신번호 - RECV_PHONE</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control recvPhone" id="recvPhone1" name="recvPhone" placeholder="수신번호 - RECV_PHONE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sendPhone1">회신번호 - SEND_PHONE</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control sendPhone" id="sendPhone1" name="sendPhone" placeholder="회신번호 - SEND_PHONE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: none">
|
||||
<label for="subject1">제목 - SUBJECT</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control subject" id="subject1" name="subject" placeholder="제목 - SUBJECT">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sendPhone1">메세지 - MESSAGE</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control message" id="message1" name="message" placeholder="메세지 - MESSAGE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="slider1">건수 (max 1,000,000 | 백만)</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control sliderValue" id="sendCnt1" name="sendCnt" placeholder="건수">
|
||||
<div class="slider mt-2" id="slider1"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="divTwoSmsCard">
|
||||
<button type="button" class="btn btn-primary w-20 sendBtn">발송</button>
|
||||
<button type="button" class="btn btn-info w-40 examBtn">예시입력</button>
|
||||
<button type="reset" class="btn btn-secondary w-30">Reset</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6" id="divTwoSms">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Client 2 (006star)</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 toggle-info-btn">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="p-3 hidden-info" 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 class="sendForm">
|
||||
<input type="hidden" name="msgType" value="S">
|
||||
<input type="hidden" name="sendStatus" value="0">
|
||||
<div class="form-group">
|
||||
<label for="msgType">문자타입 - MSG_TYPE</label>
|
||||
<div class="input-group">
|
||||
<select type="text" class="form-control msgType" id="msgType" name="msgType">
|
||||
<option value="S">SMS</option>
|
||||
<option value="L">LMS</option>
|
||||
<option value="M">MMS</option>
|
||||
<option value="A">알림톡</option>
|
||||
<option value="F">친구톡</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="recvPhone">수신번호 - RECV_PHONE</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control recvPhone" id="recvPhone" name="recvPhone" placeholder="수신번호 - RECV_PHONE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sendPhone">회신번호 - SEND_PHONE</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control sendPhone" id="sendPhone" name="sendPhone" placeholder="회신번호 - SEND_PHONE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: none">
|
||||
<label for="subject">제목 - SUBJECT</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control subject" id="subject" name="subject" placeholder="제목 - SUBJECT">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sendPhone">메세지 - MESSAGE</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control message" id="message" name="message" placeholder="메세지 - MESSAGE">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="slider">건수 (max 1,000,000 | 백만)</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 sendBtn">발송</button>
|
||||
<button type="button" class="btn btn-info w-40 examBtn">예시입력</button>
|
||||
<button type="reset" class="btn btn-secondary w-30">Reset</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card" id="divOneSmsCard">
|
||||
<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>
|
||||
<h3 class="card-title mb-0">클라이언트1 현황확인</h3>
|
||||
<span class="text-primary font-weight-bold h4 ml-2 sendCntTxt"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row"><!-- 클라이언트 insert -->
|
||||
<div class="col-md-4 col-sm-6 col-12">
|
||||
<div class="col-md-3 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>
|
||||
<span class="info-box-icon bg-gray" style="width: 35px;"><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-number 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">
|
||||
<span class="progress-description 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" style="width: 35px;"><i class="fas fa-clock"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">데이터 이관 시간 (C -> S)</span>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="info-box-number 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 transferSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 클라이언트 report -->
|
||||
<div class="col-md-5 col-sm-6 col-12">
|
||||
<div class="info-box bg-light">
|
||||
<span class="info-box-icon bg-gray" style="width: 35px;"><i class="fas fa-chart-line"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">클라이언트 report (S -> C)</span>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="info-box-number reportStartCnt">0</span>
|
||||
<span class="info-box-number mx-2">→</span>
|
||||
<span class="info-box-number 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 reportSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- Reporting start 버튼 -->
|
||||
<div class="row">
|
||||
<div class="col-12 text-left">
|
||||
<button class="btn btn-primary reportingStartBtn" data-tagid="oneUserId">Reporting start</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<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">클라이언트2 현황확인</h3>
|
||||
<span class="text-primary font-weight-bold h4 ml-2 sendCntTxt"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row"><!-- 클라이언트 insert -->
|
||||
<div class="col-md-3 col-sm-6 col-12">
|
||||
<div class="info-box bg-light">
|
||||
<span class="info-box-icon bg-gray" style="width: 35px;"><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 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 insertSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
@ -211,38 +411,38 @@
|
||||
<!-- 데이터 이관 시간 -->
|
||||
<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>
|
||||
<span class="info-box-icon bg-gray" style="width: 35px;"><i class="fas fa-clock"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">데이터 이관 시간 (client -> server)</span>
|
||||
<span class="info-box-text">데이터 이관 시간 (C -> S)</span>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="info-box-number" id="transferCnt">0</span>
|
||||
<span class="info-box-number 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">
|
||||
<span class="progress-description transferSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 클라이언트 report -->
|
||||
<div class="col-md-4 col-sm-6 col-12">
|
||||
<div class="col-md-5 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>
|
||||
<span class="info-box-icon bg-gray" style="width: 35px;"><i class="fas fa-chart-line"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">클라이언트 report</span>
|
||||
<span class="info-box-text">클라이언트 report (S -> C)</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 reportStartCnt">0</span>
|
||||
<span class="info-box-number mx-2">→</span>
|
||||
<span class="info-box-number" id="reportSndCnt">0</span>
|
||||
<span class="info-box-number 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">
|
||||
<span class="progress-description reportSeconds">
|
||||
0초
|
||||
</span>
|
||||
</div>
|
||||
@ -254,13 +454,11 @@
|
||||
<!-- Reporting start 버튼 -->
|
||||
<div class="row">
|
||||
<div class="col-12 text-left">
|
||||
<button class="btn btn-primary" id="reportingStartBtn" data-tagid="twoUserId">Reporting start</button>
|
||||
<button class="btn btn-primary reportingStartBtn" data-tagid="twoUserId">Reporting start</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
@ -292,23 +490,32 @@
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
|
||||
// client_1 영역
|
||||
// client_1 영역
|
||||
// client_1 영역
|
||||
// client_1 영역
|
||||
// client_1 영역
|
||||
/*
|
||||
* client_2 msg insert
|
||||
* client_1 msg insert
|
||||
* */
|
||||
$("#divTwoSms #sendBtn").on("click", function () {
|
||||
$("#divOneSms .sendBtn").on("click", function () {
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divTwoSms #sendForm")[0]);
|
||||
var formData = new FormData($("#divOneSms .sendForm")[0]);
|
||||
|
||||
var jsonObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
jsonObject[key] = value;
|
||||
});
|
||||
if(jsonObject['recvPhone'] === ""){
|
||||
alert('정보를 입력하거나 예시입력을 클릭해주세요.')
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log('one jsonObject send : ', jsonObject);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/agent/two/send",
|
||||
url: "/agent/one/send",
|
||||
data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
@ -316,7 +523,7 @@
|
||||
success: function (data) {
|
||||
console.log('data : ', data);
|
||||
|
||||
if (data.status == 'OK') {
|
||||
if (data.status === 'OK') {
|
||||
fn_successAlert('경과시간 : '+data.data, data.msg);
|
||||
// fn_successAlert(data, message)
|
||||
}
|
||||
@ -328,12 +535,122 @@
|
||||
alert("저장에 실패하였습니다.");
|
||||
console.log("ERROR : " + JSON.stringify(e));
|
||||
},
|
||||
beforeSend : function(xmlHttpRequest) {
|
||||
fn_oneScriptStart();
|
||||
|
||||
},
|
||||
complete : function(xhr, textStatus) {
|
||||
// oneStopInsertTimer();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* client_1 reporting 버튼
|
||||
* */
|
||||
$("#divOneSmsCard .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');
|
||||
jsonObject['userId'] = $(usertagId).val();
|
||||
|
||||
console.log('jsonObject : ', jsonObject);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/agent/server/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_oneReportScriptStart();
|
||||
|
||||
},
|
||||
complete : function(xhr, textStatus) {
|
||||
oneStopInsertTimer();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// client_2 영역
|
||||
// client_2 영역
|
||||
// client_2 영역
|
||||
// client_2 영역
|
||||
// client_2 영역
|
||||
/*
|
||||
* 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;
|
||||
});
|
||||
|
||||
if(jsonObject['recvPhone'] === ""){
|
||||
alert('정보를 입력하거나 예시입력을 클릭해주세요.')
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
console.log('two sendBtn : ', jsonObject);
|
||||
|
||||
|
||||
$.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();
|
||||
oneStopInsertTimer();
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -343,22 +660,21 @@
|
||||
/*
|
||||
* client_2 reporting 버튼
|
||||
* */
|
||||
$("#divTwoSmsCard #reportingStartBtn").on("click", function () {
|
||||
$("#divTwoSmsCard .reportingStartBtn").on("click", function () {
|
||||
// 폼 데이터를 수집
|
||||
var formData = new FormData($("#divTwoSms #sendForm")[0]);
|
||||
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;
|
||||
jsonObject['userId'] = $(usertagId).val();
|
||||
|
||||
console.log('jsonObject : ', jsonObject);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/agent/server/two/report",
|
||||
url: "/agent/server/report",
|
||||
data: JSON.stringify(jsonObject), // JSON 문자열로 변환된 데이터를 전송
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
@ -366,8 +682,8 @@
|
||||
success: function (data) {
|
||||
console.log('data : ', data);
|
||||
|
||||
if (data.status == 'OK') {
|
||||
$("#divTwoSmsCard #reportStartCnt").text(data.data);
|
||||
if (data.status === 'OK') {
|
||||
$("#divTwoSmsCard .reportStartCnt").text(data.data);
|
||||
fn_successAlert(data.data+'건', data.msg);
|
||||
}
|
||||
else {
|
||||
@ -384,29 +700,14 @@
|
||||
|
||||
},
|
||||
complete : function(xhr, textStatus) {
|
||||
twoStopInsertTimer();
|
||||
oneStopInsertTimer();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
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',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user