|
@@ -3,6 +3,9 @@ package com.lemon.lifecenter.controller;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
import org.json.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -19,6 +22,7 @@ import com.lemon.lifecenter.common.LifeCenterConfigVO;
|
|
|
import com.lemon.lifecenter.common.LifeCenterController;
|
|
|
import com.lemon.lifecenter.common.LifeCenterFunction;
|
|
|
import com.lemon.lifecenter.common.LifeCenterPaging;
|
|
|
+import com.lemon.lifecenter.common.LifeCenterSessionController;
|
|
|
import com.lemon.lifecenter.dto.CenterInfoDTO;
|
|
|
import com.lemon.lifecenter.dto.GroupListDTO;
|
|
|
import com.lemon.lifecenter.dto.LoginDTO;
|
|
@@ -114,30 +118,82 @@ public class StaffController extends LifeCenterController {
|
|
|
|
|
|
@RequestMapping("/edit")
|
|
|
public ModelAndView staffEdit(
|
|
|
- @RequestParam(value="staffId", required=false, defaultValue="") String staffId,
|
|
|
- @RequestParam(value="centerCode", required=false, defaultValue="") String centerCode,
|
|
|
- @RequestParam(value="groupIdx", required=false, defaultValue="") String groupIdx) {
|
|
|
+ @RequestParam(value="staffId", required=false, defaultValue="") String staffId) throws Exception {
|
|
|
|
|
|
List<CenterInfoDTO> centerList = memberService.selectCenterList();
|
|
|
StaffDTO dto = new StaffDTO();
|
|
|
dto.setId(staffId);
|
|
|
dto = memberService.selectMemberInfo(dto);
|
|
|
+ String groupIdx = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, String.valueOf(dto.getGroupIdx()));
|
|
|
+ int centerCode = dto.getCenterCode();
|
|
|
+
|
|
|
+ GroupListDTO gDto = new GroupListDTO();
|
|
|
+ List<GroupListDTO> groupList = groupListService.selectGroupList(gDto);
|
|
|
+
|
|
|
+ for( GroupListDTO data : groupList ) {
|
|
|
+// data.setPermissions( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, data.getPermissions() ) );
|
|
|
+ data.setEncryptIdx( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, String.valueOf( data.getIdx() ) ) );
|
|
|
+ }
|
|
|
|
|
|
ModelAndView mv = setMV("staff/edit");
|
|
|
mv.addObject("info", dto);
|
|
|
mv.addObject("centerCode", centerCode);
|
|
|
mv.addObject("groupIdx", groupIdx);
|
|
|
mv.addObject("centerList", centerList);
|
|
|
+ mv.addObject( "groupList", groupList );
|
|
|
|
|
|
return mv;
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/myinfo")
|
|
|
- public ModelAndView staffMyinfo() {
|
|
|
+ public ModelAndView staffMyinfo(HttpServletRequest request,HttpServletResponse response) {
|
|
|
+ String sesId = LifeCenterSessionController.getSession( request, "sesId" );
|
|
|
+
|
|
|
+ StaffDTO dto = new StaffDTO();
|
|
|
+ dto.setId(sesId);
|
|
|
+ dto = memberService.selectMemberInfo(dto);
|
|
|
+
|
|
|
+ String referer = request.getHeader( "Referer" );
|
|
|
+ logger.error("myinfo refere -- > " + referer);
|
|
|
+
|
|
|
ModelAndView mv = setMV("staff/myinfo");
|
|
|
+ mv.addObject("info", dto);
|
|
|
+ mv.addObject("returnUrl", referer);
|
|
|
|
|
|
return mv;
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping("myinfo/update")
|
|
|
+ public String myInfoUpdate(
|
|
|
+ HttpServletRequest request, HttpServletResponse response,
|
|
|
+ @ModelAttribute("dto") final StaffDTO dto,
|
|
|
+ @RequestParam(value="passwordNew", required=false, defaultValue="") String passwordNew,
|
|
|
+ @RequestParam(value="passwordConfirm", required=false, defaultValue="") String passwordConfirm,
|
|
|
+ @RequestParam(value="returnUrl", required=false, defaultValue="") String returnUrl) throws Exception {
|
|
|
+
|
|
|
+ logger.error("myinfo update returnUrl -- > " + returnUrl);
|
|
|
+ logger.error("dto.id -- > " + dto.getId());
|
|
|
+ logger.error("dto.getPassword -- > " + dto.getPassword());
|
|
|
+
|
|
|
+ String encryptPw = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, dto.getPassword());
|
|
|
+ dto.setPassword(encryptPw);
|
|
|
+
|
|
|
+ int mCnt = memberService.selectMemberCount(dto);
|
|
|
+ if (mCnt == 1) {
|
|
|
+ if (!passwordNew.equals("")) {
|
|
|
+ if (passwordNew.equals(passwordConfirm)) {
|
|
|
+ dto.setPassword(LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, passwordNew));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ memberService.updateMember(dto);
|
|
|
+ } else {
|
|
|
+ LifeCenterFunction.scriptMessage( response, "alert( '비밀번호가 일치하지않습니다.' ); history.back();" );
|
|
|
+ return "/common/blank";
|
|
|
+ }
|
|
|
+
|
|
|
+ return "redirect:" + returnUrl;
|
|
|
+// return "redi"returnUrl;
|
|
|
+ }
|
|
|
|
|
|
@RequestMapping("/list")
|
|
|
public ModelAndView staffList(
|
|
@@ -205,4 +261,30 @@ public class StaffController extends LifeCenterController {
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping( value="/passwordReset", method = RequestMethod.POST )
|
|
|
+ @ResponseBody
|
|
|
+ public boolean passwordReset(
|
|
|
+ @RequestParam( value="staffId", required = true ) String id,
|
|
|
+ @RequestParam( value="type", required = true ) String type) throws Exception {
|
|
|
+ logger.error("!!!!!!!!!!!!!!!!!! -- > " + id);
|
|
|
+ boolean result = false;
|
|
|
+ String pw = "";
|
|
|
+ StaffDTO dto = new StaffDTO();
|
|
|
+ dto.setId(id);
|
|
|
+ if (type.equals("staff")) {
|
|
|
+ pw = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, config.staffResetPw);
|
|
|
+ } else {
|
|
|
+ pw = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, config.centerResetPw);
|
|
|
+ }
|
|
|
+ dto.setPassword(pw);
|
|
|
+
|
|
|
+ int rts = memberService.updateMemberPwReset(dto);
|
|
|
+
|
|
|
+ if (rts == 1) {
|
|
|
+ result = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|