고객 등급 초기화 기능 추가
This commit is contained in:
parent
c9ba6517b8
commit
98e71f0aff
@ -29,6 +29,9 @@ public interface MberGrdService {
|
||||
// 회원별 등급 일괄변경
|
||||
public int updateMberGrdAll(MberGrdVO mberGrdVO) throws Exception;
|
||||
|
||||
// 회원별 등급 초기화
|
||||
public int updateMberGrdEndAll(MberGrdVO mberGrdVO) throws Exception;
|
||||
|
||||
// 회원별 등급 진행여부
|
||||
int selectMberGrdPrgCnt(String userId) throws Exception;
|
||||
|
||||
|
||||
@ -51,6 +51,11 @@ public class MberGrdDAO extends EgovAbstractDAO {
|
||||
return update("mberGrdDAO.updateMberGrdAll", mberGrdVO);
|
||||
}
|
||||
|
||||
// 회원별 등급 초기화
|
||||
public int updateMberGrdEndAll(MberGrdVO mberGrdVO) throws Exception {
|
||||
return update("mberGrdDAO.updateMberGrdEndAll", mberGrdVO);
|
||||
}
|
||||
|
||||
// 회원별 등급 진행여부
|
||||
public int selectMberGrdPrgCnt(String userId) throws Exception{
|
||||
return (int) select("mberGrdDAO.selectMberGrdPrgCnt", userId);
|
||||
|
||||
@ -75,12 +75,18 @@ public class MberGrdServiceImpl extends EgovAbstractServiceImpl implements MberG
|
||||
mberGrdDAO.updateMberGrd(mberGrdVO);
|
||||
}
|
||||
|
||||
// 회원별 등급 일괄변경
|
||||
// 회원별 등급 초기화
|
||||
@Override
|
||||
public int updateMberGrdAll(MberGrdVO mberGrdVO) throws Exception {
|
||||
return mberGrdDAO.updateMberGrdAll(mberGrdVO);
|
||||
}
|
||||
|
||||
// 회원별 등급 일괄변경
|
||||
@Override
|
||||
public int updateMberGrdEndAll(MberGrdVO mberGrdVO) throws Exception {
|
||||
return mberGrdDAO.updateMberGrdEndAll(mberGrdVO);
|
||||
}
|
||||
|
||||
// 회원별 등급 진행여부
|
||||
@Override
|
||||
public int selectMberGrdPrgCnt(String userId) throws Exception{
|
||||
|
||||
@ -90,6 +90,41 @@ public class MberGrdController {
|
||||
modelAndView.addObject("updateMberCnt", updateMberCnt);
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
}
|
||||
|
||||
// 회원별 등급 초기화
|
||||
@RequestMapping(value = "/sym/grd/mberGrdEndMassUpdateAjax.do")
|
||||
public ModelAndView mberGrdEndMassUpdateAjax(
|
||||
@ModelAttribute("mberGrdVO") MberGrdVO mberGrdVO) throws Exception {
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
modelAndView.setViewName("jsonView");
|
||||
|
||||
boolean isSuccess = true;
|
||||
String msg = "";
|
||||
int updateMberCnt = 0;
|
||||
|
||||
// 로그인VO에서 사용자 정보 가져오기
|
||||
LoginVO loginVO = (LoginVO)EgovUserDetailsHelper.getAuthenticatedUser();
|
||||
String frstRegisterId = loginVO == null ? "" : loginVO.getId();
|
||||
mberGrdVO.setEditId(frstRegisterId); // 최초등록자ID
|
||||
|
||||
try{
|
||||
|
||||
// 회원별 등급 초기화
|
||||
updateMberCnt = mberGrdService.updateMberGrdEndAll(mberGrdVO);
|
||||
|
||||
}
|
||||
catch(Exception e) {
|
||||
isSuccess = false;
|
||||
msg = e.getMessage();
|
||||
}
|
||||
|
||||
modelAndView.addObject("isSuccess", isSuccess);
|
||||
modelAndView.addObject("msg", msg);
|
||||
modelAndView.addObject("updateMberCnt", updateMberCnt);
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -194,6 +194,17 @@
|
||||
AND NOW() BETWEEN GRD_START_DATE AND GRD_END_DATE
|
||||
]]>
|
||||
</update>
|
||||
|
||||
<!-- 회원별 등급 초기화 -->
|
||||
<update id="mberGrdDAO.updateMberGrdEndAll" parameterClass="mberGrdVO">
|
||||
UPDATE mj_mber_grd_info SET
|
||||
GRD_END_DATE = NOW()
|
||||
, GRD_STATUS = 'E'
|
||||
, EDIT_ID = #editId#
|
||||
, EDIT_DATE = NOW()
|
||||
WHERE
|
||||
GRD_STATUS != 'E'
|
||||
</update>
|
||||
|
||||
<!-- 회원별 등급 진행여부 -->
|
||||
<select id="mberGrdDAO.selectMberGrdPrgCnt" parameterClass="String" resultClass="Integer">
|
||||
|
||||
@ -5,13 +5,18 @@
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>등급제 관리</title>
|
||||
<script type="text/javascript">
|
||||
//숫자 천단위 콤마 찍어주기
|
||||
function numberWithCommas(x) {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
// 등급제 일괄변경
|
||||
function setMassEdit() {
|
||||
function setMberGrdSettingMassEdit() {
|
||||
|
||||
if ($("input[name='grdNoti']:checked").val() == "") {
|
||||
alert("등급제 적용 온/오프를 선택해주세요.");
|
||||
@ -39,9 +44,8 @@
|
||||
dataType:'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
if (data.isSuccess) {
|
||||
alert(data.updateMberCnt + "명 저장 완료했습니다.");
|
||||
alert(numberWithCommas(data.updateMberCnt) + "명 저장 완료했습니다.");
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
@ -55,6 +59,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 회원별 등급 초기화
|
||||
function setMberGrdEndMassEdit() {
|
||||
if(confirm("모든 고객 등급을 초기화하시겠습니까?")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/sym/grd/mberGrdEndMassUpdateAjax.do",
|
||||
data: {},
|
||||
dataType:'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
if (data.isSuccess) {
|
||||
alert(numberWithCommas(data.updateMberCnt) + "명 저장 완료했습니다.");
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
alert("Msg : " + data.msg);
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
alert("ERROR : " + JSON.stringify(e));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -139,8 +168,12 @@
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<br />
|
||||
<div class="btnWrap">
|
||||
<input type="button" class="btnType1" value="수정" onclick="javascript:setMassEdit(); return false;">
|
||||
<input type="button" class="btnType2" value="모든 고객 등급 초기화" onclick="javascript:setMberGrdEndMassEdit(); return false;">
|
||||
<input type="button" class="btnType1" value="취소" onclick="javascript:location.reload(); return false;">
|
||||
<input type="button" class="btnType1" value="수정" onclick="javascript:setMberGrdSettingMassEdit(); return false;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user