|
@@ -20,10 +20,10 @@ import com.lemon.lifecenter.common.LifeCenterController;
|
|
|
import com.lemon.lifecenter.common.LifeCenterFunction;
|
|
|
import com.lemon.lifecenter.common.LifeCenterPaging;
|
|
|
import com.lemon.lifecenter.dto.CenterInfoDTO;
|
|
|
-import com.lemon.lifecenter.dto.LocationDTO;
|
|
|
+import com.lemon.lifecenter.dto.GroupListDTO;
|
|
|
import com.lemon.lifecenter.dto.LoginDTO;
|
|
|
import com.lemon.lifecenter.dto.StaffDTO;
|
|
|
-import com.lemon.lifecenter.service.CenterService;
|
|
|
+import com.lemon.lifecenter.service.GroupListService;
|
|
|
import com.lemon.lifecenter.service.LoginService;
|
|
|
import com.lemon.lifecenter.service.StaffService;
|
|
|
|
|
@@ -32,38 +32,69 @@ import com.lemon.lifecenter.service.StaffService;
|
|
|
@RequestMapping("/staff")
|
|
|
public class StaffController extends LifeCenterController {
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+ private LifeCenterPaging paging;
|
|
|
|
|
|
@Autowired
|
|
|
private LoginService loginService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private StaffService memberService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private LifeCenterConfigVO config;
|
|
|
- private LifeCenterPaging paging;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GroupListService groupListService;
|
|
|
|
|
|
@RequestMapping("/new")
|
|
|
- public ModelAndView staffNew() {
|
|
|
-
|
|
|
+ public ModelAndView staffNew() throws Exception {
|
|
|
List<CenterInfoDTO> centerList = memberService.selectCenterList();
|
|
|
|
|
|
ModelAndView mv = setMV("staff/new");
|
|
|
- mv.addObject("centerList", centerList);
|
|
|
+
|
|
|
+ GroupListDTO dto = new GroupListDTO();
|
|
|
+ List<GroupListDTO> groupList = groupListService.selectGroupList(dto);
|
|
|
+
|
|
|
+ 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() ) ) );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ mv.addObject( "centerList", centerList );
|
|
|
+ mv.addObject( "groupList", groupList );
|
|
|
+
|
|
|
return mv;
|
|
|
}
|
|
|
|
|
|
- @RequestMapping("/newRegist")
|
|
|
+ @RequestMapping("/new/regist")
|
|
|
public String staffNewRegist(
|
|
|
@ModelAttribute("dto") final StaffDTO dto,
|
|
|
- @RequestParam(value="centerCode", required=true) String centerCode,
|
|
|
- @RequestParam(value="passwordConfirm", required=true) String passwordConfirm) throws Exception {
|
|
|
+ @RequestParam(value="encryptIdx", required=true) String encryptIdx,
|
|
|
+ @RequestParam(value="passwordConfirm", required=true) String passwordConfirm ) throws Exception {
|
|
|
+
|
|
|
+ // 의료진 관리 -> 의료진 신규등록 컨트롤러
|
|
|
+ // 의료진 신규등록시 -> 계정 권한은 일반사용자 권한으로 생성? -> 관리자로도 생성?
|
|
|
+ // 센터하나당 관리자 권한 계정은 1개임 (시스템관리자가 센터생성할때 관리자 계정 1개 발급)
|
|
|
+// System.out.println( "permissions : " + permissions );
|
|
|
+// System.out.println( "permissions : " + LifeCenterFunction.aesDecrypt( config.aesKey, config.IV, permissions ) );
|
|
|
+ System.out.println( "encIdx : " + encryptIdx );
|
|
|
+
|
|
|
+ String decryptIdx = LifeCenterFunction.aesDecrypt( config.aesKey, config.IV, encryptIdx );
|
|
|
+
|
|
|
+ // password 일치확인
|
|
|
+ String password = dto.getPassword();
|
|
|
+
|
|
|
+ if( !password.equals( passwordConfirm ) ) {
|
|
|
+ // redirect page back
|
|
|
+ }
|
|
|
|
|
|
- String pw = dto.getPassword();
|
|
|
- dto.setPassword(LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, pw));
|
|
|
- dto.setGroupIdx("3");
|
|
|
+ dto.setGroupIdx( Integer.valueOf( decryptIdx ) );
|
|
|
+ dto.setPassword( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, password ) );
|
|
|
|
|
|
- memberService.insertStaff(dto);
|
|
|
+ memberService.insertStaff( dto );
|
|
|
|
|
|
- return "redirect:./info?staffId=" + dto.getId();
|
|
|
+ return "redirect:../info?staffId=" + dto.getId();
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/info")
|