| | |
| | | |
| | | import kr.wisestone.owl.domain.UserDepartment; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | import org.springframework.data.repository.query.Param; |
| | | |
| | | import javax.transaction.Transactional; |
| | | import java.util.List; |
| | | |
| | | public interface UserDepartmentRepository extends JpaRepository<UserDepartment, Long> { |
| | | List<UserDepartment> findByUserId(Long userId); |
| | | |
| | | @Transactional |
| | | void removeByUserId(@Param("userId") Long userId); |
| | | } |
| | |
| | | import kr.wisestone.owl.web.condition.DepartmentCondition; |
| | | import kr.wisestone.owl.web.condition.UserCondition; |
| | | import kr.wisestone.owl.web.form.DepartmentForm; |
| | | import kr.wisestone.owl.web.form.UserDepartmentForm; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.ui.Model; |
| | |
| | | boolean department(Long id); |
| | | |
| | | List<Map<String, Object>> findByDepartmentIds( UserCondition condition); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | this.messageAccessor.getMessage(MsgConstants.COMPANY_REMOVE_NOT_SELECT)); |
| | | } |
| | | for (Long id : companyFieldForm.getRemoveIds()) { |
| | | if (!this.userService.useUserLevel(id)) { |
| | | this.companyFieldRepository.deleteById(id); |
| | | } else { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE)); |
| | | } |
| | | |
| | | this.companyFieldRepository.deleteById(id); |
| | | this.companyFieldRepository.flush(); |
| | | } |
| | | this.companyFieldRepository.flush(); |
| | | } |
| | | |
| | | // 업체 목록을 엑셀로 다운로드 한다. |
| | |
| | | |
| | | excelInfo.setDatas(companyFieldVos); |
| | | |
| | | System.out.println(excelInfo); |
| | | model.addAttribute(Constants.EXCEL, excelInfo); |
| | | return new ModelAndView(this.excelView); |
| | | } |
| | |
| | | import kr.wisestone.owl.web.condition.DepartmentCondition; |
| | | import kr.wisestone.owl.web.condition.UserCondition; |
| | | import kr.wisestone.owl.web.form.DepartmentForm; |
| | | import kr.wisestone.owl.web.form.UserDepartmentForm; |
| | | import org.springframework.ui.Model; |
| | | import com.google.common.collect.Lists; |
| | | import kr.wisestone.owl.common.ExcelConditionCheck; |
| | |
| | | return this.departmentMapper.findByDepartmentIds(condition); |
| | | } |
| | | |
| | | |
| | | // 검색 결과를 DepartmentVo 로 변환한다. |
| | | private List<DepartmentVo> convertDepartmentVoToMap(List<Map<String, Object>> results, Long totalDepartmentsCount, Pageable pageable, Map<String, Object> resJsonData) { |
| | | List<DepartmentVo> departmentVos = Lists.newArrayList(); |
| | | |
| | | for (Map<String, Object> result : results) { |
| | | DepartmentVo departmentVo = ConvertUtil.convertMapToClass(result, DepartmentVo.class); |
| | | departmentVo.setByName(departmentVo.getDepartmentName()); |
| | | departmentVos.add(departmentVo); |
| | | } |
| | | |
| | |
| | | import com.google.common.collect.Lists; |
| | | import kr.wisestone.owl.constant.Constants; |
| | | import kr.wisestone.owl.constant.MsgConstants; |
| | | import kr.wisestone.owl.domain.Department; |
| | | import kr.wisestone.owl.domain.UserDepartment; |
| | | import kr.wisestone.owl.domain.*; |
| | | import kr.wisestone.owl.exception.OwlRuntimeException; |
| | | import kr.wisestone.owl.repository.UserDepartmentRepository; |
| | | import kr.wisestone.owl.service.DepartmentService; |
| | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.AbstractList; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class UserDepartmentServiceImpl extends AbstractServiceImpl<UserDepartment, Long, JpaRepository<UserDepartment, Long>> implements UserDepartmentService { |
| | |
| | | // departmentVos = ConvertUtil.convertObjectsToClasses(userDepartments, DepartmentVo.class); |
| | | } |
| | | } |
| | | |
| | | |
| | | private List<DepartmentVo> makeDepartmentVos(List<Map<String, Object>> results) { |
| | | List<DepartmentVo> departmentVos = Lists.newArrayList(); |
| | | |
| | |
| | | |
| | | @Override |
| | | public void userDepartmentModify(UserDepartmentForm userDepartmentForm) { |
| | | UserDepartment userDepartment = ConvertUtil.copyProperties(userDepartmentForm, UserDepartment.class); |
| | | userDepartmentRepository.saveAndFlush(userDepartment); |
| | | Long userId = userDepartmentForm.getUserId(); |
| | | |
| | | // 기존 데이터 삭제 |
| | | this.userDepartmentRepository.removeByUserId(userId); |
| | | |
| | | // 새로운 데이터 추가 |
| | | List<UserDepartment> list = Lists.newArrayList(); |
| | | for (Long departmentId : userDepartmentForm.getIds()){ |
| | | UserDepartment userDepartment = new UserDepartment(); |
| | | userDepartment.setUserId(userId); |
| | | userDepartment.setDepartmentId(departmentId); |
| | | |
| | | list.add(userDepartment); |
| | | } |
| | | |
| | | this.userDepartmentRepository.saveAll(list); |
| | | } |
| | | |
| | | |
| | | // 사용자 부서 ID로 조회한다. |
| | | // @Override |
| | | // public List<DepartmentVo> getUserDepartments (Long id) { |
| | |
| | | |
| | | 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 String departmentDescription; |
| | | private Long departmentCount; |
| | | |
| | | private List<Long> excludeIds = Lists.newArrayList(); |
| | | |
| | | private List<Long> departmentIds = Lists.newArrayList(); |
| | | |
| | | private Integer Page; |
| | | private Integer PageSize; |
| | | |
| | | public static DepartmentCondition make(Map<String, Object> departmentConditions) { |
| | | return ConvertUtil.convertMapToClass(departmentConditions, DepartmentCondition.class); |
| | | DepartmentCondition condition = ConvertUtil.convertMapToClass(departmentConditions, DepartmentCondition.class); |
| | | |
| | | if (MapUtil.getStrings(departmentConditions, "excludeIds") != null) { |
| | | condition.setExcludeIds(MapUtil.getLongs(departmentConditions, "excludeIds")); |
| | | } |
| | | |
| | | return condition; |
| | | } |
| | | |
| | | public Long getId() { |
| | |
| | | public void setDepartmentIds(List<Long> departmentIds) { |
| | | this.departmentIds = departmentIds; |
| | | } |
| | | |
| | | public List<Long> getExcludeIds() { |
| | | return excludeIds; |
| | | } |
| | | |
| | | public void setExcludeIds(List<Long> excludeIds) { |
| | | this.excludeIds = excludeIds; |
| | | } |
| | | } |
| | |
| | | public static UserDepartmentForm make(Map<String, Object> params) { |
| | | UserDepartmentForm form = ConvertUtil.convertMapToClass(params, UserDepartmentForm.class); |
| | | |
| | | if (MapUtil.getLongs(params,"Ids") != null) { |
| | | form.setIds(MapUtil.getLongs(params, "Ids")); |
| | | if (MapUtil.getLongs(params,"ids") != null) { |
| | | form.setIds(MapUtil.getLongs(params, "ids")); |
| | | } |
| | | return form; |
| | | } |
| | |
| | | <if test="id != '' and id != null"> |
| | | AND d.id like CONCAT('%',#{id},'%') |
| | | </if> |
| | | <choose> |
| | | <when test="excludeIds != null and excludeIds.size != 0"> |
| | | AND d.id NOT IN |
| | | <foreach collection="excludeIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | <if test="pageSize != '' and pageSize != null"> |
| | | limit #{pageSize} offset #{page}; |
| | | </if> |
| | |
| | | case "USE_DEPARTMENT_LIST" : |
| | | makeTag += "<ul class='ul-not-comma'>"; |
| | | |
| | | if(scope.data.departmentVos.length == 0){ //속해있는 부서가 없을 경우 |
| | | makeTag += "<div style='cursor: pointer' ng-click='event.modifyUserDepartments(data.id)'>부서를 선택해 주세요.</div>"; |
| | | if(scope.data.departmentVos != null && scope.data.departmentVos.length == 0){ //속해있는 부서가 없을 경우 |
| | | makeTag += "<div style='cursor: pointer' ng-click='event.modifyUserDepartments(data.id, data.userId)'>부서를 선택해 주세요.</div>"; |
| | | }else{ |
| | | makeTag += "<div style='cursor: pointer' ng-click='event.modifyUserDepartments(data.id)'>"; |
| | | makeTag += "<div style='cursor: pointer' ng-click='event.modifyUserDepartments(data.id, data.userId)'>"; |
| | | angular.forEach(scope.data.departmentVos, function (departments) { |
| | | makeTag += "<li>" + departments.departmentName + "</li>"; |
| | | }); |
| | |
| | | formCheck : formCheck, // 폼 체크 |
| | | detail : detail, // 상세 정보 조회 |
| | | removeDepartments : removeDepartments, // 추가한 부서 제거 |
| | | getDepartmentListCallBack : getDepartmentListCallBack |
| | | }; |
| | | |
| | | $scope.vm = { |
| | | id : parameter.id, |
| | | userId : parameter.userId, |
| | | form : { |
| | | id : parameter.id, |
| | | departmentList : [], // 현재 부서 목록 |
| | | departments : [] // 부서 |
| | | }, |
| | | departmentName : [], //부서명 검색 |
| | | departmentName : "", //부서명 검색 |
| | | /*autoCompletePage : { |
| | | project : { |
| | | page : 0, |
| | |
| | | }; |
| | | angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector})); |
| | | |
| | | function getDepartmentListCallBack(result) { |
| | | console.log("TEST"); |
| | | |
| | | } |
| | | |
| | | |
| | | // 선택 한 부서 제거 |
| | | function removeDepartments(index) { |
| | | $scope.vm.form.departmentList.splice(index, 1); |
| | | $scope.vm.form.departments.splice(index, 1); |
| | | } |
| | | |
| | | function formCheck(formInvalid) { |
| | |
| | | $rootScope.spinner = true; |
| | | |
| | | var content = { |
| | | id : $scope.vm.form.id, |
| | | departmentId : (function () { |
| | | id : $scope.vm.id, |
| | | userId : $scope.vm.userId, |
| | | ids : (function () { |
| | | var departmentIds = []; |
| | | angular.forEach($scope.vm.form.departments, function (department) { |
| | | departmentIds.push(department.id); |
| | |
| | | |
| | | function detail() { |
| | | var contents = { |
| | | id : parameter.id |
| | | id : parameter.id, |
| | | userId : parameter.userId |
| | | } |
| | | |
| | | UserWorkspace.userDepartmentDetail($resourceProvider.getContent(//test |
| | |
| | | |
| | | if (result.data.message.status === "success") { |
| | | if (angular.isDefined(result.data.data)) { |
| | | $scope.vm.form.departmentList = result.data.data; //체크 필 |
| | | $scope.vm.form.departments = result.data.data; |
| | | } |
| | | } |
| | | else { |
| | |
| | | } |
| | | |
| | | // 사용자가 속해있는 부서 수정 팝업 |
| | | function modifyUserDepartments(id) { |
| | | function modifyUserDepartments(id, userId) { |
| | | $uibModal.open({ |
| | | templateUrl : 'views/workspace/workspaceDepartmentModify.html', |
| | | size : "xlg", |
| | |
| | | resolve : { |
| | | parameter : function () { |
| | | return { |
| | | id : id |
| | | id : id, |
| | | userId : userId |
| | | }; |
| | | } |
| | | } |
| | |
| | | }; |
| | | var deferred = $q.defer(); |
| | | |
| | | UserWorkspace.userDepartmentDetail($resourceProvider.getContent( // 페이징 업데이트가 필요한 컴포넌트 일경우, page 업데이트가 있을 경우 기본 10개씩 가져오고 아닐경우 25개씩 가져온다. |
| | | UserWorkspace.departmentFind($resourceProvider.getContent( // 페이징 업데이트가 필요한 컴포넌트 일경우, page 업데이트가 있을 경우 기본 10개씩 가져오고 아닐경우 25개씩 가져온다. |
| | | conditions, $resourceProvider.getPageContent($rootScope.isDefined(page) ? page : 0, $rootScope.isDefined(page) ? 10 : 25))).then(function (result) { |
| | | if (result.data.message.status === "success") { |
| | | |
| | |
| | | <js-autocomplete-multi data-input-name="departments" |
| | | selected-model="vm.form.departments" |
| | | search="vm.departmentName" |
| | | source="fn.getUserDepartmentList(vm.departmentName, vm.form.departmentList)" |
| | | source="fn.getUserDepartmentList(vm.departmentName, vm.form.departments)" |
| | | input-disabled="false" |
| | | translation-texts="{ count : 'common.userNum', empty : 'common.emptyUser' }" |
| | | extra-settings="{ displayProp : 'byName' , idProp : 'id', imageable : false, maxlength : 100, autoResize : true }"></js-autocomplete-multi> |
| | | |
| | | |
| | | <div class="select3-selection__choicediv mt-10"> |
| | | <span class="select3-selection__choice" ng-repeat="department in vm.form.departmentList"> |
| | | <span class="select3-selection__choice" ng-repeat="department in vm.form.departments"> |
| | | <span>{{department.byName}}</span> <!--사용자가 속해 있는 부서 이름 출력--> |
| | | <span class="select3-selection__choice__remove" ng-click="fn.removeDepartments($index)">×</span> |
| | | </span> |