| | |
| | | import kr.wisestone.owl.web.form.DepartmentManageForm; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | List<DepartmentManageVo> findDepartment(Map<String, Object> resJsonData, |
| | | DepartmentManageCondition make, Pageable pageable); |
| | | |
| | | ModelAndView downloadExcel(HttpServletRequest request, Model model); |
| | | |
| | | void removeUserLevel(DepartmentManageForm departmentManageForm); |
| | | } |
| | |
| | | package kr.wisestone.owl.service; |
| | | |
| | | import kr.wisestone.owl.domain.Qna; |
| | | import kr.wisestone.owl.domain.UserLevel; |
| | | import kr.wisestone.owl.vo.UserLevelVo; |
| | | import kr.wisestone.owl.web.condition.UserCondition; |
| | | import kr.wisestone.owl.web.condition.UserLevelCondition; |
| | | import kr.wisestone.owl.web.form.ManageUserForm; |
| | | import kr.wisestone.owl.web.form.UserForm; |
| | | import kr.wisestone.owl.web.form.UserLevelForm; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | package kr.wisestone.owl.service.impl; |
| | | |
| | | import kr.wisestone.owl.web.form.UserLevelForm; |
| | | import org.springframework.ui.Model; |
| | | import com.google.common.collect.Lists; |
| | | import kr.wisestone.owl.common.ExcelConditionCheck; |
| | | import kr.wisestone.owl.constant.Constants; |
| | |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | return this.departmentManageRepository; |
| | | } |
| | | |
| | | // 부서 추가 |
| | | @Override |
| | | public DepartmentManage addDepartmentManage(DepartmentManageForm departmentManageForm) { |
| | | DepartmentManage departmentManage = ConvertUtil.copyProperties(departmentManageForm, DepartmentManage.class); |
| | |
| | | return departmentManage; |
| | | } |
| | | |
| | | // 부서 목록을 가져온다. |
| | | @Override |
| | | public List<DepartmentManageVo> findDepartment(Map<String, Object> resJsonData, |
| | | DepartmentManageCondition condition, Pageable pageable) { |
| | | |
| | | condition.setPage(pageable.getPageNumber() * pageable.getPageSize()); |
| | | condition.setPageSize(pageable.getPageSize()); |
| | | |
| | | List<Map<String, Object>> results = this.departmentManageMapper.find(condition); |
| | | Long totalDepartmentCount = this.departmentManageMapper.count(condition); |
| | | |
| | | return this.convertDepartmentManageVoToMap(results, totalDepartmentCount, pageable, resJsonData); |
| | | } |
| | | |
| | | |
| | | |
| | | // 사용자 부서 ID로 조회한다. |
| | | @Override |
| | | public DepartmentManage getDepartment(Long id) { |
| | | if (id == null) { |
| | |
| | | return departmentManage; |
| | | } |
| | | |
| | | // 부서를 삭제한다. |
| | | @Override |
| | | public List<DepartmentManageVo> findDepartment(Map<String, Object> resJsonData, |
| | | DepartmentManageCondition condition, Pageable pageable) { |
| | | |
| | | condition.setPage(pageable.getPageNumber() * pageable.getPageSize()); |
| | | condition.setPageSize(pageable.getPageSize()); |
| | | |
| | | List<Map<String, Object>> results = this.departmentManageMapper.find(condition); |
| | | Long totalDepartmentCount = this.departmentManageMapper.count(condition); |
| | | |
| | | return this.convertDepartmentManageVoToMap(results, totalDepartmentCount, pageable, resJsonData); |
| | | public void removeUserLevel(DepartmentManageForm departmentManageForm) { |
| | | if (departmentManageForm.getRemoveIds().size() < 1) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.PROJECT_REMOVE_NOT_SELECT)); |
| | | } |
| | | this.departmentManageRepository.flush(); |
| | | } |
| | | |
| | | |
| | | // 검색 결과를 DepartmentManageVo 로 변환한다. |
| | | private List<DepartmentManageVo> convertDepartmentManageVoToMap(List<Map<String, Object>> results, Long totalDepartmentCount, Pageable pageable, Map<String, Object> resJsonData) { |
| | | private List<DepartmentManageVo> convertDepartmentManageVoToMap(List<Map<String, Object>> results, Long totalDepartmentsCount, Pageable pageable, Map<String, Object> resJsonData) { |
| | | List<DepartmentManageVo> departmentManageVos = Lists.newArrayList(); |
| | | |
| | | for (Map<String, Object> result : results) { |
| | | DepartmentManageVo departmentManageVo = ConvertUtil.convertMapToClass(result, DepartmentManageVo.class); |
| | | // 부서명만 변환 하면 되는건가 ? |
| | | departmentManageVos.add(departmentManageVo); |
| | | } |
| | | |
| | | int totalPage = (int) Math.ceil((totalDepartmentCount - 1) / pageable.getPageSize()) + 1; |
| | | int totalPage = (int) Math.ceil((totalDepartmentsCount - 1) / pageable.getPageSize()) + 1; |
| | | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, departmentManageVos); |
| | | resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(), |
| | | totalPage, totalDepartmentCount)); |
| | | totalPage, totalDepartmentsCount)); |
| | | |
| | | return departmentManageVos; |
| | | } |
| | | |
| | | // 부서 목록을 엑셀로 다운로드 한다. |
| | | @Override |
| | | public ModelAndView downloadExcel(HttpServletRequest request, Model model) { |
| | | |
| | | ModelAndView modelAndView = this.workspaceService.checkUseExcelDownload(model); |
| | | if (modelAndView != null) { |
| | | return modelAndView; |
| | |
| | | package kr.wisestone.owl.vo; |
| | | |
| | | /** |
| | | * Created by jeong on 2017-08-02. |
| | | * Created by wyu on 2021-11-05. |
| | | */ |
| | | public class DepartmentManageVo extends BaseVo{ |
| | | |
| | |
| | | private String departmentName; |
| | | private String departmentDescription; |
| | | |
| | | public DepartmentManageVo() { |
| | | } |
| | | private Long departmentCount; |
| | | public DepartmentManageVo() {} |
| | | |
| | | public DepartmentManageVo(Long id, String departmentName, String departmentDescription) { |
| | | this.id = id; |
| | |
| | | public void setDepartmentDescription(String departmentDescription) { |
| | | this.departmentDescription = departmentDescription; |
| | | } |
| | | |
| | | public Long getDepartmentCount() { |
| | | return departmentCount; |
| | | } |
| | | |
| | | public void setDepartmentCount(Long departmentCount) { |
| | | this.departmentCount = departmentCount; |
| | | } |
| | | } |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by jeong on 2018-01-01. |
| | | * Created by wyu on 2021-11-05. |
| | | */ |
| | | public class DepartmentManageCondition { |
| | | private Long id; |
| | | private String departmentName; |
| | | private String departmentDescription; |
| | | private Long departmentCount; |
| | | |
| | | private Integer Page; |
| | | private Integer PageSize; |
| | |
| | | this.departmentDescription = departmentDescription; |
| | | } |
| | | |
| | | public Long getDepartmentCount() { |
| | | return departmentCount; |
| | | } |
| | | |
| | | public void setDepartmentCount(Long departmentCount) { |
| | | this.departmentCount = departmentCount; |
| | | } |
| | | |
| | | public Integer getPage() { |
| | | return Page; |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import org.springframework.ui.Model; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | | |
| | | // 사용자등급 조회 |
| | | // 부서 조회 |
| | | @RequestMapping(value = "/departmentManage/find", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) |
| | | public |
| | | @ResponseBody |
| | |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | | // |
| | | // // 사용자등급 상세 조회 |
| | | |
| | | // |
| | | // // 부서 상세 조회 |
| | | // @RequestMapping(value = "/userLevel/detail", produces = MediaType.APPLICATION_JSON_VALUE) |
| | | // public |
| | | // @ResponseBody |
| | |
| | | // return this.setSuccessMessage(resJsonData); |
| | | // } |
| | | // |
| | | // // 사용자등급 수정 |
| | | // // 부서 수정 |
| | | // @RequestMapping(value = "/userLevel/modify", produces = MediaType.APPLICATION_JSON_VALUE) |
| | | // public |
| | | // @ResponseBody |
| | |
| | | // return this.setSuccessMessage(resJsonData); |
| | | // } |
| | | // |
| | | // // 사용자등급 삭제 |
| | | // @RequestMapping(value = "/userLevel/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) |
| | | // public |
| | | // @ResponseBody |
| | | // Map<String, Object> remove(@RequestBody Map<String, Map<String, Object>> params) { |
| | | // Map<String, Object> resJsonData = new HashMap<>(); |
| | | // Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT); |
| | | // |
| | | // this.userLevelService.removeUserLevel(UserLevelForm.make(content)); |
| | | // |
| | | // return this.setSuccessMessage(resJsonData); |
| | | // } |
| | | // |
| | | // |
| | | // // 사용자 등급 엑셀 다운로드 |
| | | // @RequestMapping(value = "/userLevel/downloadExcel", method = RequestMethod.POST) |
| | | // public ModelAndView downloadExcel(HttpServletRequest request, Model model) { |
| | | // return this.userLevelService.downloadExcel(request, model); |
| | | } |
| | | // // 부서 삭제 |
| | | @RequestMapping(value = "/departmentManage/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) |
| | | public |
| | | @ResponseBody |
| | | Map<String, Object> remove(@RequestBody Map<String, Map<String, Object>> params) { |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT); |
| | | |
| | | this.departmentManageService.removeUserLevel(DepartmentManageForm.make(content)); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | | |
| | | |
| | | // 부서 엑셀 다운로드 |
| | | @RequestMapping(value = "/departmentManage/downloadExcel", method = RequestMethod.POST) |
| | | public ModelAndView downloadExcel(HttpServletRequest request, Model model) { |
| | | return this.departmentManageService.downloadExcel(request, model); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | package kr.wisestone.owl.web.controller; |
| | | |
| | | import kr.wisestone.owl.constant.Constants; |
| | | import kr.wisestone.owl.domain.enumType.SocialType; |
| | | import kr.wisestone.owl.service.UserLevelService; |
| | | import kr.wisestone.owl.service.UserService; |
| | | import kr.wisestone.owl.util.ConvertUtil; |
| | | import kr.wisestone.owl.web.condition.NoticeCondition; |
| | | import kr.wisestone.owl.web.condition.UserCondition; |
| | | import kr.wisestone.owl.web.condition.UserLevelCondition; |
| | | import kr.wisestone.owl.web.form.ManageUserForm; |
| | | import kr.wisestone.owl.web.form.UserForm; |
| | | import kr.wisestone.owl.web.form.UserLevelForm; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Pageable; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by jeong on 2017-08-02. |
| | | * Created by jeong on 2021-11-05. |
| | | */ |
| | | @Controller |
| | | public class UserLevelController extends BaseController { |
| | |
| | | package kr.wisestone.owl.web.form; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import kr.wisestone.owl.util.ConvertUtil; |
| | | import kr.wisestone.owl.util.MapUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | private Long id; |
| | | private String departmentName; |
| | | private String departmentDescription; |
| | | private List<Long> removeIds = Lists.newArrayList(); |
| | | |
| | | public DepartmentManageForm() { |
| | | } |
| | | |
| | | public static DepartmentManageForm make(Map<String, Object> params) { |
| | | return ConvertUtil.convertMapToClass(params, DepartmentManageForm.class); |
| | | DepartmentManageForm form = ConvertUtil.convertMapToClass(params, DepartmentManageForm.class); |
| | | |
| | | if (MapUtil.getLongs(params,"removeIds") != null) { |
| | | form.setRemoveIds(MapUtil.getLongs(params, "removeIds")); |
| | | } |
| | | return form; |
| | | } |
| | | |
| | | public Long getId() { |
| | |
| | | public void setDepartmentDescription(String departmentDescription) { |
| | | this.departmentDescription = departmentDescription; |
| | | } |
| | | |
| | | public List<Long> getRemoveIds() { |
| | | return removeIds; |
| | | } |
| | | |
| | | public void setRemoveIds(List<Long> removeIds) { |
| | | this.removeIds = removeIds; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import kr.wisestone.owl.constant.MngPermission; |
| | | import kr.wisestone.owl.domain.User; |
| | | import kr.wisestone.owl.domain.UserLevel; |
| | | import kr.wisestone.owl.util.ConvertUtil; |
| | | import kr.wisestone.owl.util.MapUtil; |
| | | |
| | |
| | | SELECT |
| | | dm.id as id, |
| | | dm.department_name as departmentName, |
| | | dm.department_description as departmentDescription |
| | | dm.department_description as departmentDescription, |
| | | count(u.department_id) as departmentCount |
| | | FROM |
| | | department_manage dm |
| | | WHERE id != 1 AND 1=1 |
| | | OUTER JOIN user u on dm.id = u.department_id |
| | | WHERE 1=1 |
| | | <if test="departmentName != '' and departmentName != null"> |
| | | AND ul.department_name like CONCAT('%',#{departmentName},'%') |
| | | </if> |
| | |
| | | 'app' |
| | | ], |
| | | function (app) { |
| | | app.controller('workspaceDepartmentAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', '$state', 'Workspace', '$filter', 'parameter', '$timeout', |
| | | function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, Workspace, $filter, parameter) { |
| | | app.controller('workspaceDepartmentAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', '$state', 'Workspace', 'UserWorkspace', '$filter', |
| | | function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, $state, Workspace, UserWorkspace, $filter) { |
| | | |
| | | $scope.fn = { |
| | | cancel : cancel, // 팝업 창 닫기 |
| | |
| | | |
| | | $scope.vm = { |
| | | form : { |
| | | title : "", |
| | | description : "" |
| | | departmentName : "", // 제목 |
| | | departmentDescription : "" // 내용 |
| | | }, |
| | | options : { |
| | | callbacks : { |
| | |
| | | $rootScope.spinner = true; |
| | | |
| | | var content = { |
| | | title : $rootScope.preventXss($scope.vm.form.title), |
| | | description : $rootScope.preventXss($scope.vm.form.description) |
| | | departmentName : $rootScope.preventXss($scope.vm.form.title), |
| | | departmentDescription : $rootScope.preventXss($scope.vm.form.description) |
| | | }; |
| | | |
| | | UserWorkspace.departmentAdd($resourceProvider.getContent( |
| | |
| | | .setDType("renderer") |
| | | .setDRenderer("DEPARTMENT_MODIFY")); |
| | | $scope.vm.tableConfigs2.push($tableProvider.config() |
| | | .setHName("manageDepartment.departmentDescription") |
| | | .setHName("manageDepartment.departmentEx") |
| | | .setHWidth("width-120-p") |
| | | .setDAlign("text-center") |
| | | .setDName("departmentDescription")); |
| | |
| | | if (result.data.message.status === "success") { |
| | | $scope.vm.page.selectedPage = currentPage + 1; |
| | | $scope.vm.responseData = result.data; |
| | | |
| | | } |
| | | else { |
| | | SweetAlert.error($filter("translate")("managementWorkspace.failedToSelectWorkspaceFullUserList"), result.data.message.message); // "업무 공간 전체 사용자 목록 조회 실패" |