12개 파일 추가됨
5개 파일 이름 변경됨
3개 파일 복사됨
3개 파일 변경됨
11개 파일 삭제됨
| | |
| | | public static final String DEPARTMENT_ALREADY_IN_USE = "DEPARTMENT_ALREADY_IN_USE"; // 선택한 부서는 이미 사용하고 있습니다. |
| | | public static final String DEPARTMENT_REMOVE_NOT_SELECT = "DEPARTMENT_REMOVE_NOT_SELECT"; // 삭제할 부서가 선택되지 않았습니다. |
| | | |
| | | |
| | | |
| | | public static final String COMPANY_REMOVE_NOT_SELECT = "COMPANY_REMOVE_NOT_SELECT"; // 삭제할 업체가 선택되지 않았습니다. |
| | | public static final String COMPANYFIELD_NOT_EXIST = "COMPANYFIELD_NOT_EXIST"; // 업체가 존재하지 않습니다. |
| | | |
| | | public static final String HOSTING_NOT_EXIST = "HOSTING_NOT_EXIST"; // 호스팅이 존재하지 않습니다. |
| | | public static final String HOSTING_REMOVE_NOT_SELECT = "HOSTING_REMOVE_NOT_SELECT"; // 삭제할 호스팅이 선택되지 않았습니다. |
| | | |
| | | public static final String ISP_NOT_EXIST = "ISP_NOT_EXIST"; // ISP가 존재하지 않습니다. |
| | | public static final String ISP_REMOVE_NOT_SELECT = "ISP_REMOVE_NOT_SELECT"; // 삭제할 ISP가 선택되지 않았습니다. |
| | | } |
File was renamed from src/main/java/kr/wisestone/owl/domain/Hosting.java |
| | |
| | | import java.io.Serializable; |
| | | |
| | | @Entity |
| | | public class Hosting extends BaseEntity implements Serializable { |
| | | public class HostingField extends BaseEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Id |
| | |
| | | private String email; |
| | | private String memo; |
| | | |
| | | public Hosting() {} |
| | | public HostingField() {} |
| | | |
| | | public Long getId() { |
| | | return id; |
copy from src/main/java/kr/wisestone/owl/domain/Hosting.java
copy to src/main/java/kr/wisestone/owl/domain/IspField.java
File was copied from src/main/java/kr/wisestone/owl/domain/Hosting.java |
| | |
| | | import java.io.Serializable; |
| | | |
| | | @Entity |
| | | public class Hosting extends BaseEntity implements Serializable { |
| | | public class IspField extends BaseEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Id |
| | |
| | | private String email; |
| | | private String memo; |
| | | |
| | | public Hosting() {} |
| | | public IspField() {} |
| | | |
| | | public Long getId() { |
| | | return id; |
New file |
| | |
| | | package kr.wisestone.owl.mapper; |
| | | |
| | | import kr.wisestone.owl.web.condition.HostingFieldCondition; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by wisestone on 2018-02-26. |
| | | */ |
| | | @Repository |
| | | public interface HostingFieldMapper { |
| | | List<Map<String, Object>> find(HostingFieldCondition hostingFieldCondition); |
| | | |
| | | Long count(HostingFieldCondition hostingFieldCondition); |
| | | |
| | | List<Map<String, Object>> findEvent(); |
| | | |
| | | Long findByHosting(Long id); |
| | | } |
New file |
| | |
| | | package kr.wisestone.owl.mapper; |
| | | |
| | | import kr.wisestone.owl.web.condition.IspFieldCondition; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by wisestone on 2018-02-26. |
| | | */ |
| | | @Repository |
| | | public interface IspFieldMapper { |
| | | List<Map<String, Object>> find(IspFieldCondition ispFieldCondition); |
| | | |
| | | Long count(IspFieldCondition ispFieldCondition); |
| | | |
| | | List<Map<String, Object>> findEvent(); |
| | | |
| | | Long findByIsp(Long id); |
| | | } |
New file |
| | |
| | | package kr.wisestone.owl.repository; |
| | | |
| | | import kr.wisestone.owl.domain.HostingField; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | |
| | | public interface HostingFieldRepository extends JpaRepository<HostingField, Long> { |
| | | |
| | | } |
New file |
| | |
| | | package kr.wisestone.owl.repository; |
| | | |
| | | import kr.wisestone.owl.domain.IspField; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | |
| | | public interface IspFieldRepository extends JpaRepository<IspField, Long> { |
| | | |
| | | } |
| | |
| | | void removeCompany(CompanyFieldForm make); |
| | | |
| | | ModelAndView downloadExcel(HttpServletRequest request, Model model); |
| | | |
| | | boolean company(Long id); |
| | | } |
New file |
| | |
| | | package kr.wisestone.owl.service; |
| | | |
| | | import kr.wisestone.owl.domain.HostingField; |
| | | import kr.wisestone.owl.vo.HostingFieldVo; |
| | | import kr.wisestone.owl.web.condition.HostingFieldCondition; |
| | | import kr.wisestone.owl.web.form.HostingFieldForm; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface HostingFieldService { |
| | | HostingField add(HostingFieldForm hostingFieldForm); |
| | | |
| | | List<HostingFieldVo> find(Map<String, Object> resJsonData, HostingFieldCondition make, Pageable pageable); |
| | | |
| | | HostingField getHosting(Long id); |
| | | |
| | | void detail(Map<String, Object> resJsonData, HostingFieldCondition make); |
| | | |
| | | void modify(HostingFieldForm make); |
| | | |
| | | void remove(HostingFieldForm make); |
| | | |
| | | ModelAndView downloadExcel(HttpServletRequest request, Model model); |
| | | |
| | | } |
New file |
| | |
| | | package kr.wisestone.owl.service; |
| | | |
| | | import kr.wisestone.owl.domain.IspField; |
| | | import kr.wisestone.owl.vo.IspFieldVo; |
| | | import kr.wisestone.owl.web.condition.IspFieldCondition; |
| | | import kr.wisestone.owl.web.form.IspFieldForm; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IspFieldService { |
| | | IspField add(IspFieldForm ispFieldForm); |
| | | |
| | | List<IspFieldVo> find(Map<String, Object> resJsonData, IspFieldCondition make, Pageable pageable); |
| | | |
| | | IspField getIsp(Long id); |
| | | |
| | | void detail(Map<String, Object> resJsonData, IspFieldCondition make); |
| | | |
| | | void modify(IspFieldForm make); |
| | | |
| | | void remove(IspFieldForm make); |
| | | |
| | | ModelAndView downloadExcel(HttpServletRequest request, Model model); |
| | | } |
| | |
| | | return new ModelAndView(this.excelView); |
| | | } |
| | | |
| | | // 삭제 할 업체가 있는지 확인 |
| | | @Override |
| | | public boolean company(Long Id) { |
| | | return this.companyFieldMapper.findByCompany(Id) > 0; |
| | | } |
| | | |
| | | // 검색 결과를 CompanyFieldVo 로 변환한다. |
| | | private List<CompanyFieldVo> convertCompanyVoToMap(List<Map<String, Object>> results, Long totalCompanyCount, Pageable pageable, Map<String, Object> resJsonData) { |
| | | List<CompanyFieldVo> companyFieldVos = Lists.newArrayList(); |
New file |
| | |
| | | package kr.wisestone.owl.service.impl; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import kr.wisestone.owl.common.ExcelConditionCheck; |
| | | import kr.wisestone.owl.constant.Constants; |
| | | import kr.wisestone.owl.constant.MsgConstants; |
| | | import kr.wisestone.owl.domain.HostingField; |
| | | import kr.wisestone.owl.exception.OwlRuntimeException; |
| | | import kr.wisestone.owl.mapper.HostingFieldMapper; |
| | | import kr.wisestone.owl.repository.HostingFieldRepository; |
| | | import kr.wisestone.owl.service.HostingFieldService; |
| | | import kr.wisestone.owl.service.UserService; |
| | | import kr.wisestone.owl.service.WorkspaceService; |
| | | import kr.wisestone.owl.util.ConvertUtil; |
| | | import kr.wisestone.owl.vo.HostingFieldVo; |
| | | import kr.wisestone.owl.vo.ExportExcelAttrVo; |
| | | import kr.wisestone.owl.vo.ExportExcelVo; |
| | | import kr.wisestone.owl.vo.ResPage; |
| | | import kr.wisestone.owl.web.condition.HostingFieldCondition; |
| | | import kr.wisestone.owl.web.form.HostingFieldForm; |
| | | import kr.wisestone.owl.web.view.ExcelView; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class HostingFieldFieldServiceImpl extends AbstractServiceImpl<HostingField, Long, JpaRepository<HostingField, Long>> implements HostingFieldService { |
| | | |
| | | @Autowired |
| | | private HostingFieldRepository hostingFieldRepository; |
| | | |
| | | @Autowired |
| | | private HostingFieldMapper hostingFieldMapper; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private WorkspaceService workspaceService; |
| | | |
| | | @Autowired |
| | | private ExcelView excelView; |
| | | |
| | | @Autowired |
| | | private ExcelConditionCheck excelConditionCheck; |
| | | |
| | | @Override |
| | | protected JpaRepository<HostingField, Long> getRepository() { |
| | | return this.hostingFieldRepository; |
| | | } |
| | | |
| | | // 업체 추가 |
| | | @Override |
| | | public HostingField add(HostingFieldForm HostingFieldForm) { |
| | | HostingField HostingField = ConvertUtil.copyProperties(HostingFieldForm, HostingField.class); |
| | | hostingFieldRepository.saveAndFlush(HostingField); |
| | | return HostingField; |
| | | } |
| | | |
| | | // 업체 목록을 가져온다. |
| | | @Override |
| | | public List<HostingFieldVo> find(Map<String, Object> resJsonData, |
| | | HostingFieldCondition condition, Pageable pageable) { |
| | | condition.setPage(pageable.getPageNumber() * pageable.getPageSize()); |
| | | condition.setPageSize(pageable.getPageSize()); |
| | | |
| | | List<Map<String, Object>> results = this.hostingFieldMapper.find(condition); |
| | | Long totalHostingCount = this.hostingFieldMapper.count(condition); |
| | | |
| | | return this.convertHostingVoToMap(results, totalHostingCount, pageable, resJsonData); |
| | | } |
| | | |
| | | |
| | | // 업체 상세 조회한다. |
| | | @Override |
| | | public void detail(Map<String, Object> resJsonData, HostingFieldCondition hostingFieldCondition) { |
| | | HostingFieldVo HostingFieldVo = new HostingFieldVo(); |
| | | |
| | | Long hostingId = hostingFieldCondition.getId(); |
| | | if (hostingId != null) { |
| | | HostingField HostingField = this.getHosting(hostingId); |
| | | HostingFieldVo = ConvertUtil.copyProperties(HostingField, HostingFieldVo.class); |
| | | } |
| | | resJsonData.put(Constants.REQ_KEY_CONTENT, HostingFieldVo); |
| | | } |
| | | |
| | | // 업체 정로를 수정한다. |
| | | @Override |
| | | public void modify(HostingFieldForm HostingFieldForm) { |
| | | HostingField HostingField = ConvertUtil.copyProperties(HostingFieldForm, HostingField.class); |
| | | hostingFieldRepository.saveAndFlush(HostingField); |
| | | } |
| | | |
| | | |
| | | // 업체를 삭제한다. |
| | | @Override |
| | | public void remove(HostingFieldForm HostingFieldForm) { |
| | | if (HostingFieldForm.getRemoveIds().size() < 1) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.COMPANY_REMOVE_NOT_SELECT)); |
| | | } |
| | | for (Long id : HostingFieldForm.getRemoveIds()) { |
| | | if (!this.userService.useUserLevel(id)) { |
| | | this.hostingFieldRepository.deleteById(id); |
| | | } else { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE)); |
| | | } |
| | | |
| | | } |
| | | this.hostingFieldRepository.flush(); |
| | | } |
| | | |
| | | // 업체 목록을 엑셀로 다운로드 한다. |
| | | @Override |
| | | public ModelAndView downloadExcel(HttpServletRequest request, Model model) { |
| | | ModelAndView modelAndView = this.workspaceService.checkUseExcelDownload(model); |
| | | if (modelAndView != null) { |
| | | return modelAndView; |
| | | } |
| | | |
| | | Map<String, Object> conditions = new HashMap<>(); |
| | | // 엑셀 다운로드에 필요한 검색 조건 정보를 추출하고 검색 조건 추출에 오류가 발생하면 경고를 표시해준다. |
| | | modelAndView = this.excelConditionCheck.checkCondition(conditions, request, model); |
| | | if (modelAndView != null) { |
| | | return modelAndView; |
| | | } |
| | | |
| | | HostingFieldCondition hostingFieldCondition = HostingFieldCondition.make(conditions); |
| | | |
| | | |
| | | List<Map<String, Object>> results = this.hostingFieldMapper.find(hostingFieldCondition); |
| | | List<HostingFieldVo> hostingFieldVos = ConvertUtil.convertListToListClass(results, HostingFieldVo.class); |
| | | // code_ko_KR 에 code명 설정 |
| | | ExportExcelVo excelInfo = new ExportExcelVo(); |
| | | excelInfo.setFileName(this.messageAccessor.message("업체 목록")); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("companyName", this.messageAccessor.message("Hosting.companyName"), 6, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("companyManager", this.messageAccessor.message("Hosting.companyManager"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("companyTel", this.messageAccessor.message("Hosting.companyTel"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("companyEmail", this.messageAccessor.message("Hosting.companyEmail"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("companyMemo", this.messageAccessor.message("Hosting.companyMemo"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | |
| | | excelInfo.setDatas(hostingFieldVos); |
| | | |
| | | model.addAttribute(Constants.EXCEL, excelInfo); |
| | | return new ModelAndView(this.excelView); |
| | | } |
| | | |
| | | // 검색 결과를 HostingVo 로 변환한다. |
| | | private List<HostingFieldVo> convertHostingVoToMap(List<Map<String, Object>> results, Long totalHostingCount, Pageable pageable, Map<String, Object> resJsonData) { |
| | | List<HostingFieldVo> hostingFieldVos = Lists.newArrayList(); |
| | | |
| | | for (Map<String, Object> result : results) { |
| | | HostingFieldVo HostingFieldVo = ConvertUtil.convertMapToClass(result, HostingFieldVo.class); |
| | | hostingFieldVos.add(HostingFieldVo); |
| | | } |
| | | |
| | | int totalPage = (int) Math.ceil((totalHostingCount - 1) / pageable.getPageSize()) + 1; |
| | | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, hostingFieldVos); |
| | | resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(), |
| | | totalPage, totalHostingCount)); |
| | | |
| | | return hostingFieldVos; |
| | | } |
| | | |
| | | // 업체 ID 로 조회한다 |
| | | @Override |
| | | public HostingField getHosting(Long id) { |
| | | if (id == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.HOSTING_NOT_EXIST)); |
| | | } |
| | | |
| | | HostingField HostingField = this.findOne(id); |
| | | |
| | | if (HostingField == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.HOSTING_NOT_EXIST)); |
| | | } |
| | | return HostingField; |
| | | } |
| | | } |
New file |
| | |
| | | package kr.wisestone.owl.service.impl; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import kr.wisestone.owl.common.ExcelConditionCheck; |
| | | import kr.wisestone.owl.constant.Constants; |
| | | import kr.wisestone.owl.constant.MsgConstants; |
| | | import kr.wisestone.owl.domain.IspField; |
| | | import kr.wisestone.owl.exception.OwlRuntimeException; |
| | | import kr.wisestone.owl.mapper.IspFieldMapper; |
| | | import kr.wisestone.owl.repository.IspFieldRepository; |
| | | import kr.wisestone.owl.service.IspFieldService; |
| | | import kr.wisestone.owl.service.UserService; |
| | | import kr.wisestone.owl.service.WorkspaceService; |
| | | import kr.wisestone.owl.util.ConvertUtil; |
| | | import kr.wisestone.owl.vo.IspFieldVo; |
| | | import kr.wisestone.owl.vo.ExportExcelAttrVo; |
| | | import kr.wisestone.owl.vo.ExportExcelVo; |
| | | import kr.wisestone.owl.vo.ResPage; |
| | | import kr.wisestone.owl.web.condition.IspFieldCondition; |
| | | import kr.wisestone.owl.web.form.IspFieldForm; |
| | | import kr.wisestone.owl.web.view.ExcelView; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class IspFieldFieldServiceImpl extends AbstractServiceImpl<IspField, Long, JpaRepository<IspField, Long>> implements IspFieldService { |
| | | |
| | | @Autowired |
| | | private IspFieldRepository ispFieldRepository; |
| | | |
| | | @Autowired |
| | | private IspFieldMapper ispFieldMapper; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private WorkspaceService workspaceService; |
| | | |
| | | @Autowired |
| | | private ExcelView excelView; |
| | | |
| | | @Autowired |
| | | private ExcelConditionCheck excelConditionCheck; |
| | | |
| | | @Override |
| | | protected JpaRepository<IspField, Long> getRepository() { |
| | | return this.ispFieldRepository; |
| | | } |
| | | |
| | | // 업체 추가 |
| | | @Override |
| | | public IspField add(IspFieldForm IspFieldForm) { |
| | | IspField IspField = ConvertUtil.copyProperties(IspFieldForm, IspField.class); |
| | | ispFieldRepository.saveAndFlush(IspField); |
| | | return IspField; |
| | | } |
| | | |
| | | // 업체 목록을 가져온다. |
| | | @Override |
| | | public List<IspFieldVo> find(Map<String, Object> resJsonData, |
| | | IspFieldCondition condition, Pageable pageable) { |
| | | condition.setPage(pageable.getPageNumber() * pageable.getPageSize()); |
| | | condition.setPageSize(pageable.getPageSize()); |
| | | |
| | | List<Map<String, Object>> results = this.ispFieldMapper.find(condition); |
| | | Long totalIspCount = this.ispFieldMapper.count(condition); |
| | | |
| | | return this.convertIspVoToMap(results, totalIspCount, pageable, resJsonData); |
| | | } |
| | | |
| | | |
| | | // 업체 상세 조회한다. |
| | | @Override |
| | | public void detail(Map<String, Object> resJsonData, IspFieldCondition ispFieldCondition) { |
| | | IspFieldVo IspFieldVo = new IspFieldVo(); |
| | | |
| | | Long IspId = ispFieldCondition.getId(); |
| | | if (IspId != null) { |
| | | IspField IspField = this.getIsp(IspId); |
| | | IspFieldVo = ConvertUtil.copyProperties(IspField, IspFieldVo.class); |
| | | } |
| | | resJsonData.put(Constants.REQ_KEY_CONTENT, IspFieldVo); |
| | | } |
| | | |
| | | // 업체 정로를 수정한다. |
| | | @Override |
| | | public void modify(IspFieldForm IspFieldForm) { |
| | | IspField IspField = ConvertUtil.copyProperties(IspFieldForm, IspField.class); |
| | | ispFieldRepository.saveAndFlush(IspField); |
| | | } |
| | | |
| | | |
| | | // 업체를 삭제한다. |
| | | @Override |
| | | public void remove(IspFieldForm IspFieldForm) { |
| | | if (IspFieldForm.getRemoveIds().size() < 1) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.ISP_REMOVE_NOT_SELECT)); |
| | | } |
| | | for (Long id : IspFieldForm.getRemoveIds()) { |
| | | if (!this.userService.useUserLevel(id)) { |
| | | this.ispFieldRepository.deleteById(id); |
| | | } else { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE)); |
| | | } |
| | | |
| | | } |
| | | this.ispFieldRepository.flush(); |
| | | } |
| | | |
| | | // 업체 목록을 엑셀로 다운로드 한다. |
| | | @Override |
| | | public ModelAndView downloadExcel(HttpServletRequest request, Model model) { |
| | | ModelAndView modelAndView = this.workspaceService.checkUseExcelDownload(model); |
| | | if (modelAndView != null) { |
| | | return modelAndView; |
| | | } |
| | | |
| | | Map<String, Object> conditions = new HashMap<>(); |
| | | // 엑셀 다운로드에 필요한 검색 조건 정보를 추출하고 검색 조건 추출에 오류가 발생하면 경고를 표시해준다. |
| | | modelAndView = this.excelConditionCheck.checkCondition(conditions, request, model); |
| | | if (modelAndView != null) { |
| | | return modelAndView; |
| | | } |
| | | |
| | | IspFieldCondition ispFieldCondition = IspFieldCondition.make(conditions); |
| | | |
| | | |
| | | List<Map<String, Object>> results = this.ispFieldMapper.find(ispFieldCondition); |
| | | List<IspFieldVo> ispFieldVos = ConvertUtil.convertListToListClass(results, IspFieldVo.class); |
| | | // code_ko_KR 에 code명 설정 |
| | | ExportExcelVo excelInfo = new ExportExcelVo(); |
| | | excelInfo.setFileName(this.messageAccessor.message("업체 목록")); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("IspName", this.messageAccessor.message("Isp.IspName"), 6, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("IspManager", this.messageAccessor.message("Isp.IspManager"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("IspTel", this.messageAccessor.message("Isp.IspTel"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("IspEmail", this.messageAccessor.message("Isp.IspEmail"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | excelInfo.addAttrInfos(new ExportExcelAttrVo("IspMemo", this.messageAccessor.message("Isp.IspMemo"), 10, ExportExcelAttrVo.ALIGN_CENTER)); |
| | | |
| | | excelInfo.setDatas(ispFieldVos); |
| | | |
| | | model.addAttribute(Constants.EXCEL, excelInfo); |
| | | return new ModelAndView(this.excelView); |
| | | } |
| | | |
| | | // 검색 결과를 IspVo 로 변환한다. |
| | | private List<IspFieldVo> convertIspVoToMap(List<Map<String, Object>> results, Long totalIspCount, Pageable pageable, Map<String, Object> resJsonData) { |
| | | List<IspFieldVo> ispFieldVos = Lists.newArrayList(); |
| | | |
| | | for (Map<String, Object> result : results) { |
| | | IspFieldVo IspFieldVo = ConvertUtil.convertMapToClass(result, IspFieldVo.class); |
| | | ispFieldVos.add(IspFieldVo); |
| | | } |
| | | |
| | | int totalPage = (int) Math.ceil((totalIspCount - 1) / pageable.getPageSize()) + 1; |
| | | |
| | | resJsonData.put(Constants.RES_KEY_CONTENTS, ispFieldVos); |
| | | resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(), |
| | | totalPage, totalIspCount)); |
| | | |
| | | return ispFieldVos; |
| | | } |
| | | |
| | | // 업체 ID 로 조회한다 |
| | | @Override |
| | | public IspField getIsp(Long id) { |
| | | if (id == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.ISP_NOT_EXIST)); |
| | | } |
| | | |
| | | IspField IspField = this.findOne(id); |
| | | |
| | | if (IspField == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.ISP_NOT_EXIST)); |
| | | } |
| | | return IspField; |
| | | } |
| | | } |
File was renamed from src/main/java/kr/wisestone/owl/vo/IspVo.java |
| | |
| | | package kr.wisestone.owl.vo; |
| | | |
| | | public class IspVo extends BaseVo{ |
| | | public class HostingFieldVo extends BaseVo{ |
| | | |
| | | private Long id; |
| | | private String name; |
| | |
| | | private String email; |
| | | private String memo; |
| | | |
| | | public IspVo() {} |
| | | public HostingFieldVo() {} |
| | | |
| | | public IspVo(Long id, String name, String manager, String tel, String email, String memo) { |
| | | public HostingFieldVo(Long id, String name, String manager, String tel, String email, String memo) { |
| | | |
| | | this.id = id; |
| | | this.name = name; |
copy from src/main/java/kr/wisestone/owl/vo/IspVo.java
copy to src/main/java/kr/wisestone/owl/vo/IspFieldVo.java
File was copied from src/main/java/kr/wisestone/owl/vo/IspVo.java |
| | |
| | | package kr.wisestone.owl.vo; |
| | | |
| | | public class IspVo extends BaseVo{ |
| | | public class IspFieldVo extends BaseVo{ |
| | | |
| | | private Long id; |
| | | private String name; |
| | |
| | | private String email; |
| | | private String memo; |
| | | |
| | | public IspVo() {} |
| | | public IspFieldVo() {} |
| | | |
| | | public IspVo(Long id, String name, String manager, String tel, String email, String memo) { |
| | | public IspFieldVo(Long id, String name, String manager, String tel, String email, String memo) { |
| | | |
| | | this.id = id; |
| | | this.name = name; |
copy from src/main/java/kr/wisestone/owl/web/condition/HostingCondition.java
copy to src/main/java/kr/wisestone/owl/web/condition/HostingFieldCondition.java
File was copied from src/main/java/kr/wisestone/owl/web/condition/HostingCondition.java |
| | |
| | | |
| | | import java.util.Map; |
| | | |
| | | public class HostingCondition { |
| | | public class HostingFieldCondition { |
| | | private Long id; |
| | | private String name; |
| | | private String manager; |
| | |
| | | private Integer Page; |
| | | private Integer PageSize; |
| | | |
| | | public static HostingCondition make(Map<String, Object> companyFieldCondition) { |
| | | return ConvertUtil.convertMapToClass(companyFieldCondition, HostingCondition.class); |
| | | public static HostingFieldCondition make(Map<String, Object> hostingFieldCondition) { |
| | | return ConvertUtil.convertMapToClass(hostingFieldCondition, HostingFieldCondition.class); |
| | | } |
| | | |
| | | public Long getId() { |
File was renamed from src/main/java/kr/wisestone/owl/web/condition/HostingCondition.java |
| | |
| | | |
| | | import java.util.Map; |
| | | |
| | | public class HostingCondition { |
| | | public class IspFieldCondition { |
| | | private Long id; |
| | | private String name; |
| | | private String manager; |
| | |
| | | private Integer Page; |
| | | private Integer PageSize; |
| | | |
| | | public static HostingCondition make(Map<String, Object> companyFieldCondition) { |
| | | return ConvertUtil.convertMapToClass(companyFieldCondition, HostingCondition.class); |
| | | public static IspFieldCondition make(Map<String, Object> companyFieldCondition) { |
| | | return ConvertUtil.convertMapToClass(companyFieldCondition, IspFieldCondition.class); |
| | | } |
| | | |
| | | public Long getId() { |
File was renamed from src/main/java/kr/wisestone/owl/web/controller/HostingController.java |
| | |
| | | package kr.wisestone.owl.web.controller; |
| | | |
| | | import kr.wisestone.owl.constant.Constants; |
| | | import kr.wisestone.owl.service.HostingService; |
| | | import kr.wisestone.owl.web.condition.HostingCondition; |
| | | import kr.wisestone.owl.web.form.HostingForm; |
| | | import kr.wisestone.owl.service.HostingFieldService; |
| | | import kr.wisestone.owl.web.condition.HostingFieldCondition; |
| | | import kr.wisestone.owl.web.form.HostingFieldForm; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.http.MediaType; |
| | |
| | | import java.util.Map; |
| | | |
| | | @Controller |
| | | public class HostingController extends BaseController{ |
| | | public class HostingFieldController extends BaseController{ |
| | | |
| | | @Autowired |
| | | private HostingService HostingService; |
| | | private HostingFieldService HostingFieldService; |
| | | |
| | | // 업체 생성 |
| | | @RequestMapping(value = "/hosting/add", method = RequestMethod.POST) |
| | |
| | | Map<String, Object> add(@RequestBody Map<String, Map<String, Object>> params) { |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT); |
| | | this.HostingService.addCompany(HostingForm.make(content)); |
| | | this.HostingFieldService.add(HostingFieldForm.make(content)); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); |
| | | |
| | | this.HostingService.findCompany(resJsonData, HostingCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable); |
| | | this.HostingFieldService.find(resJsonData, HostingFieldCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | @ResponseBody |
| | | Map<String, Object> detail(@RequestBody Map<String, Map<String, Object>> params) { |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | this.HostingService.detailCompany(resJsonData, HostingCondition.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | this.HostingFieldService.detail(resJsonData, HostingFieldCondition.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | Map<String, Object> modify(@RequestBody Map<String, Map<String, Object>> params) { |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | |
| | | this.HostingService.modifyCompany(HostingForm.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | this.HostingFieldService.modify(HostingFieldForm.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT); |
| | | |
| | | this.HostingService.removeCompany(HostingForm.make(content)); |
| | | this.HostingFieldService.remove(HostingFieldForm.make(content)); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | // 업체 엑셀 다운로드 |
| | | @RequestMapping(value = "/hosting/downloadExcel", method = RequestMethod.POST) |
| | | public ModelAndView downloadExcel(HttpServletRequest request, Model model) { |
| | | return this.HostingService.downloadExcel(request, model); |
| | | return this.HostingFieldService.downloadExcel(request, model); |
| | | } |
| | | } |
| | | |
File was renamed from src/main/java/kr/wisestone/owl/web/controller/IspController.java |
| | |
| | | package kr.wisestone.owl.web.controller; |
| | | |
| | | import kr.wisestone.owl.constant.Constants; |
| | | import kr.wisestone.owl.service.IspService; |
| | | import kr.wisestone.owl.service.IspFieldService; |
| | | import kr.wisestone.owl.web.condition.IspCondition; |
| | | import kr.wisestone.owl.web.form.IspForm; |
| | | import kr.wisestone.owl.web.form.IspFieldForm; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.http.MediaType; |
| | |
| | | import java.util.Map; |
| | | |
| | | @Controller |
| | | public class IspController extends BaseController{ |
| | | public class IspFieldController extends BaseController{ |
| | | |
| | | @Autowired |
| | | private IspService IspService; |
| | | private IspFieldService IspFieldService; |
| | | |
| | | // 업체 생성 |
| | | @RequestMapping(value = "/isp/add", method = RequestMethod.POST) |
| | |
| | | Map<String, Object> add(@RequestBody Map<String, Map<String, Object>> params) { |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT); |
| | | this.IspService.addCompany(IspForm.make(content)); |
| | | this.IspFieldService.add(IspFieldForm.make(content)); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); |
| | | |
| | | this.IspService.findCompany(resJsonData, IspCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable); |
| | | this.IspFieldService.find(resJsonData, IspCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | @ResponseBody |
| | | Map<String, Object> detail(@RequestBody Map<String, Map<String, Object>> params) { |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | this.IspService.detailCompany(resJsonData, IspCondition.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | this.IspFieldService.detail(resJsonData, IspCondition.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | Map<String, Object> modify(@RequestBody Map<String, Map<String, Object>> params) { |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | |
| | | this.IspService.modifyCompany(IspForm.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | this.IspFieldService.modify(IspFieldForm.make(params.get(Constants.REQ_KEY_CONTENT))); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | Map<String, Object> resJsonData = new HashMap<>(); |
| | | Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT); |
| | | |
| | | this.IspService.removeCompany(IspForm.make(content)); |
| | | this.IspFieldService.remove(IspFieldForm.make(content)); |
| | | |
| | | return this.setSuccessMessage(resJsonData); |
| | | } |
| | |
| | | // 업체 엑셀 다운로드 |
| | | @RequestMapping(value = "/isp/downloadExcel", method = RequestMethod.POST) |
| | | public ModelAndView downloadExcel(HttpServletRequest request, Model model) { |
| | | return this.IspService.downloadExcel(request, model); |
| | | return this.IspFieldService.downloadExcel(request, model); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | 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; |
| | | |
| | | public class HostingFieldForm { |
| | | private Long id; |
| | | private String name; |
| | | private String manager; |
| | | private String tel; |
| | | private String email; |
| | | private String memo; |
| | | private List<Long> removeIds = Lists.newArrayList(); |
| | | |
| | | public HostingFieldForm() { |
| | | } |
| | | public static HostingFieldForm make(Map<String, Object> params) { |
| | | HostingFieldForm form = ConvertUtil.convertMapToClass(params, HostingFieldForm.class); |
| | | |
| | | if (MapUtil.getLongs(params,"removeIds") != null) { |
| | | form.setRemoveIds(MapUtil.getLongs(params, "removeIds")); |
| | | } |
| | | return form; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getManager() { |
| | | return manager; |
| | | } |
| | | |
| | | public void setManager(String manager) { |
| | | this.manager = manager; |
| | | } |
| | | |
| | | public String getTel() { |
| | | return tel; |
| | | } |
| | | |
| | | public void setTel(String tel) { |
| | | this.tel = tel; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getMemo() { |
| | | return memo; |
| | | } |
| | | |
| | | public void setMemo(String memo) { |
| | | this.memo = memo; |
| | | } |
| | | |
| | | public List<Long> getRemoveIds() { |
| | | return removeIds; |
| | | } |
| | | |
| | | public void setRemoveIds(List<Long> removeIds) { |
| | | this.removeIds = removeIds; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | public class IspFieldForm { |
| | | private Long id; |
| | | private String name; |
| | | private String manager; |
| | | private String tel; |
| | | private String email; |
| | | private String memo; |
| | | private List<Long> removeIds = Lists.newArrayList(); |
| | | |
| | | public IspFieldForm() { |
| | | } |
| | | public static IspFieldForm make(Map<String, Object> params) { |
| | | IspFieldForm form = ConvertUtil.convertMapToClass(params, IspFieldForm.class); |
| | | |
| | | if (MapUtil.getLongs(params,"removeIds") != null) { |
| | | form.setRemoveIds(MapUtil.getLongs(params, "removeIds")); |
| | | } |
| | | return form; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getManager() { |
| | | return manager; |
| | | } |
| | | |
| | | public void setManager(String manager) { |
| | | this.manager = manager; |
| | | } |
| | | |
| | | public String getTel() { |
| | | return tel; |
| | | } |
| | | |
| | | public void setTel(String tel) { |
| | | this.tel = tel; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getMemo() { |
| | | return memo; |
| | | } |
| | | |
| | | public void setMemo(String memo) { |
| | | this.memo = memo; |
| | | } |
| | | |
| | | public List<Long> getRemoveIds() { |
| | | return removeIds; |
| | | } |
| | | |
| | | public void setRemoveIds(List<Long> removeIds) { |
| | | this.removeIds = removeIds; |
| | | } |
| | | } |
New file |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="kr.wisestone.owl.mapper.HostingFieldMapper"> |
| | | |
| | | <select id="find" resultType="java.util.HashMap" parameterType="kr.wisestone.owl.web.condition.HostingCondition"> |
| | | SELECT |
| | | h.id as id, |
| | | h.name as name, |
| | | h.manager as manager, |
| | | h.tel as tel, |
| | | h.email as email, |
| | | h.memo as memo |
| | | FROM |
| | | hosting h |
| | | WHERE 1=1 |
| | | <if test="name != '' and name != null"> |
| | | AND h.name like CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test="id != '' and id != null"> |
| | | AND h.id like CONCAT('%',#{id},'%') |
| | | </if> |
| | | <if test="pageSize != '' and pageSize != null"> |
| | | limit #{pageSize} offset #{page}; |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long" parameterType="kr.wisestone.owl.web.condition.HostingCondition"> |
| | | SELECT |
| | | count(h.id) |
| | | FROM |
| | | hosting h |
| | | WHERE 1=1 |
| | | <if test="name != '' and name != null"> |
| | | AND h.name like CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test="id != '' and id != null"> |
| | | AND h.id like CONCAT('%',#{id},'%') |
| | | </if> |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="kr.wisestone.owl.mapper.IspFieldMapper"> |
| | | |
| | | <select id="find" resultType="java.util.HashMap" parameterType="kr.wisestone.owl.web.condition.IspCondition"> |
| | | SELECT |
| | | i.id as id, |
| | | i.name as name, |
| | | i.manager as manager, |
| | | i.tel as tel, |
| | | i.email as email, |
| | | i.memo as memo |
| | | FROM |
| | | isp i |
| | | WHERE 1=1 |
| | | <if test="name != '' and name != null"> |
| | | AND i.name like CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test="id != '' and id != null"> |
| | | AND i.id like CONCAT('%',#{id},'%') |
| | | </if> |
| | | <if test="pageSize != '' and pageSize != null"> |
| | | limit #{pageSize} offset #{page}; |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long" parameterType="kr.wisestone.owl.web.condition.IspCondition"> |
| | | SELECT |
| | | count(i.id) |
| | | FROM |
| | | isp i |
| | | WHERE 1=1 |
| | | <if test="name != '' and name != null"> |
| | | AND i.name like CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test="id != '' and id != null"> |
| | | AND i.id like CONCAT('%',#{id},'%') |
| | | </if> |
| | | </select> |
| | | </mapper> |