File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package itn.let.mjo.rejt.web;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import itn.let.mjo.block.service.MjonBlockService;
import itn.let.mjo.block.service.MjonBlockVO;
import itn.let.mjo.msg.service.MjonMsgService;
import itn.let.mjo.msg.service.MjonMsgVO;
import itn.let.mjo.rejt.service.MjonRejectService;
import itn.let.mjo.rejt.service.MjonRejectVO;
@Controller
public class MjonRejectController {
@Resource(name = "mjonRejectService")
private MjonRejectService mjonRejectService;
@Resource(name = "mjonMsgService")
private MjonMsgService mjonMsgService;
@Resource(name = "mjonBlockService")
private MjonBlockService mjonBlockService;
/**
* 080 수신번호 차단 API
* @param rejectVO
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/mjonRejectReceive")
public HashMap<String, String> mjonRejectReceive(@RequestBody MjonRejectVO rejectVO) throws Exception {
//ModelAndView mv = new ModelAndView();
//mv.setViewName("jsonView");
//System.out.println(rejectVO.getPhone()+"==============");
//System.out.println(rejectVO.getInsertDate()+"==============");
//System.out.println(rejectVO.getCallId()+"==============");
HashMap<String, String> map = new HashMap<String, String>();
try {
// 1. mj_reject_log 테이블에 로그 insert
String rejectLogId = mjonRejectService.insertRejectLog(rejectVO);
// 2. 각 개인의 수신거부목록 테이블에 insert
/**
* 리스트에 담기 > mj_msg_data 에서 rejectVO.getPhone() 로 문자를 보낸 회원을 조회하기
*/
MjonMsgVO mjonMsgVO = new MjonMsgVO();
mjonMsgVO.setCallTo(rejectVO.getPhone().replaceAll("\\-", ""));
List<MjonMsgVO> senderList = mjonMsgService.selectSender(mjonMsgVO);
/**
* 리스트를 for문 돌리기 size만큼 > 그 회원들의 "수신거부목록" 에 insert 해주기
*/
MjonBlockVO blockVO = new MjonBlockVO();
for(int i=0; i<senderList.size(); i++ ) {
blockVO.setRejectLogId(rejectLogId);
blockVO.setUserId(senderList.get(i).getUserId());
blockVO.setPhone(rejectVO.getPhone().replaceAll("\\-", ""));
blockVO.setBlockType(1); // 080 수신거부
mjonBlockService.insertBlock(blockVO);
}
map.put("result", "100");
} catch(Exception e) {
e.printStackTrace();
map.put("result", "error");
}
return map;
}
/**
* 080수신거부 테스트 페이지
* @return
* @throws Exception
*/
@RequestMapping("/web/rejectTest.do")
public String rejectTest() throws Exception {
return "/web/rejectTest";
}
/**
* 080 수신차단관리 목록 관리자페이지
* @param rejectVO
* @param request
* @param model
* @return
* @throws Exception
*/
@RequestMapping("/uss/ion/rejt/selectRejectList.do")
public String selectRejectList(@ModelAttribute("searchVO") MjonRejectVO rejectVO,
HttpServletRequest request ,
ModelMap model) throws Exception {
if(rejectVO.getPageUnit() != 10) {
rejectVO.setPageUnit(rejectVO.getPageUnit());
}
/** paging */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(rejectVO.getPageIndex());
paginationInfo.setRecordCountPerPage(rejectVO.getPageUnit());
paginationInfo.setPageSize(rejectVO.getPageSize());
rejectVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
rejectVO.setLastIndex(paginationInfo.getLastRecordIndex());
rejectVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(rejectVO.getSearchSortCnd())){ //최초조회시 최신것 조회List
rejectVO.setSearchSortCnd("regDate");
rejectVO.setSearchSortOrd("desc");
}
List<MjonRejectVO> rejectList = mjonRejectService.selectRejectList(rejectVO);
int totCnt = 0;
if(rejectList.size() > 0) {
totCnt = rejectList.get(0).getTotCnt();
}
model.addAttribute("rejectList", rejectList);
paginationInfo.setTotalRecordCount(totCnt);
model.addAttribute("paginationInfo", paginationInfo);
return "/uss/ion/msg/RejectList";
}
}