|
@@ -4,6 +4,9 @@ import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -63,15 +66,17 @@ public class CenterController extends LifeCenterController {
|
|
|
StaffDTO mDto = new StaffDTO();
|
|
|
|
|
|
centerService.insertCenter(dto);
|
|
|
+
|
|
|
mDto.setCenterCode(dto.getCenterCode());
|
|
|
mDto.setId(staffId);
|
|
|
mDto.setPassword(LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, staffPw));
|
|
|
mDto.setName(staffName);
|
|
|
mDto.setPhoneNumber(staffPhoneNumber);
|
|
|
- mDto.setGroupIdx( 2 ); // 1: 시스템관리자 2:관리자 3:일반사용자, 센터신규등록시 아이디생성은 관리자 권한으로 생성
|
|
|
+ mDto.setGroupIdx( 2 ); // 1: 시스템관리자 2:관리자 3:일반사용자, 센터신규등록시 아이디생성은 관리자 권한으로 생성, 센터하나에 관리자 1명으로 개발진행
|
|
|
+
|
|
|
memberService.inserMember(mDto);
|
|
|
|
|
|
- return "redirect:./info?centerCode=" + dto.getCenterCode();
|
|
|
+ return "redirect:/center/info?centerCode=" + dto.getCenterCode();
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/info")
|
|
@@ -86,44 +91,60 @@ public class CenterController extends LifeCenterController {
|
|
|
return mv;
|
|
|
}
|
|
|
|
|
|
- @RequestMapping("/editProc")
|
|
|
- @Transactional(propagation=Propagation.REQUIRED)
|
|
|
- public String centerEditProc(
|
|
|
+ @RequestMapping("/edit/update")
|
|
|
+ @Transactional(propagation=Propagation.REQUIRED, rollbackFor = { RuntimeException.class, Error.class })
|
|
|
+ public String centerEditUpdate(
|
|
|
@ModelAttribute("dto") final CenterInfoDTO dto,
|
|
|
@RequestParam(value="detailAddr", required=true) String detailAddr,
|
|
|
@RequestParam(value="staffId", required=true) String staffId,
|
|
|
@RequestParam(value="staffPw", required=true) String staffPw,
|
|
|
@RequestParam(value="staffNewPw", required=false, defaultValue="") String staffNewPw,
|
|
|
+ @RequestParam(value="staffNewPwConfirm", required=false, defaultValue="") String staffNewPwConfirm,
|
|
|
@RequestParam(value="staffName", required=true) String staffName,
|
|
|
- @RequestParam(value="staffPhoneNumber", required=true) String staffPhoneNumber) throws Exception {
|
|
|
+ @RequestParam(value="staffPhoneNumber", required=true) String staffPhoneNumber,
|
|
|
+ HttpServletRequest request, HttpServletResponse response ) throws Exception {
|
|
|
+
|
|
|
+ System.out.println( "staff Id : " + staffId );
|
|
|
|
|
|
StaffDTO mDto = new StaffDTO();
|
|
|
+
|
|
|
mDto.setId(staffId);
|
|
|
mDto.setPassword(LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, staffPw));
|
|
|
int mCnt = memberService.selectMemberCount(mDto);
|
|
|
|
|
|
- if (mCnt > 0) {
|
|
|
+ if( mCnt == 1 ) {
|
|
|
String address = dto.getCenterAddress() + "|" + detailAddr;
|
|
|
dto.setCenterAddress(address);
|
|
|
int result = centerService.updateCenterInfo(dto);
|
|
|
|
|
|
+ System.out.println( "result cnt : " + result );
|
|
|
+
|
|
|
if (result > 0) {
|
|
|
mDto.setName(staffName);
|
|
|
mDto.setPhoneNumber(staffPhoneNumber);
|
|
|
mDto.setPassword("");
|
|
|
- if (!staffNewPw.equals("")) {
|
|
|
- mDto.setPassword(LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, staffNewPw));
|
|
|
- }
|
|
|
|
|
|
- int mUpCnt = memberService.updateMember(mDto);
|
|
|
- if (mUpCnt < 0) {
|
|
|
-
|
|
|
+ try {
|
|
|
+ if (!staffNewPw.equals("")) {
|
|
|
+ if( staffNewPw.equals( staffNewPwConfirm ) ) {
|
|
|
+ mDto.setPassword(LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, staffNewPw));
|
|
|
+ } else {
|
|
|
+ // not match password.
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch( Exception e ) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
}
|
|
|
- return "redirect:./info?centerCode=" + dto.getCenterCode();
|
|
|
+
|
|
|
+ memberService.updateMember(mDto);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ LifeCenterFunction.scriptMessage( response, "alert( '비밀번호가 일치하지않습니다.' );location.href='../edit?centerCode="+dto.getCenterCode()+"';" );
|
|
|
+ return "/common/blank";
|
|
|
}
|
|
|
|
|
|
- return "redirect:./edit?centerCode=" + dto.getCenterCode();
|
|
|
+ return "redirect:/center/info?centerCode=" + dto.getCenterCode();
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/edit")
|
|
@@ -181,6 +202,10 @@ public class CenterController extends LifeCenterController {
|
|
|
paging.paging(config, total, page, param);
|
|
|
|
|
|
ModelAndView mv = setMV("center/list");
|
|
|
+
|
|
|
+ startDate = startDate.equals( "" ) ? LifeCenterFunction.getNow( "yyyy-MM-dd" ) : startDate;
|
|
|
+ endDate = endDate.equals( "" ) ? LifeCenterFunction.getNow( "yyyy-MM-dd" ) : endDate;
|
|
|
+
|
|
|
mv.addObject("locationList", list);
|
|
|
mv.addObject("locationCode", locationCode);
|
|
|
mv.addObject("startDate", startDate);
|
|
@@ -189,6 +214,8 @@ public class CenterController extends LifeCenterController {
|
|
|
mv.addObject("total", total);
|
|
|
mv.addObject("item", result);
|
|
|
mv.addObject("paging", paging);
|
|
|
+ mv.addObject("page", page);
|
|
|
+ mv.addObject("pageSize", dto.getLimitMax());
|
|
|
|
|
|
return mv;
|
|
|
}
|