diff --git a/.classpath b/.classpath index c41c43a..2f1d300 100644 --- a/.classpath +++ b/.classpath @@ -28,7 +28,7 @@ - + diff --git a/.gitignore b/.gitignore index f2587e4..2555fe8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ pom.properties + *.class + +MANIFEST +/target/ diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index 4e863b4..8cbce54 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -1,7 +1,6 @@ eclipse.preferences.version=1 -encoding//src/main/webapp/WEB-INF/views/user/authError.jsp=UTF-8 -encoding//src/main/webapp/WEB-INF/views/user/authSuccess.jsp=UTF-8 -encoding//src/main/webapp/WEB-INF/views/user/base.jsp=UTF-8 -encoding//src/main/webapp/WEB-INF/views/user/joinSuccess.jsp=UTF-8 -encoding//src/main/webapp/WEB-INF/views/user/login.jsp=UTF-8 -encoding//src/main/webapp/WEB-INF/views/user/register.jsp=UTF-8 +encoding//src/main/java=UTF-8 +encoding//src/main/java/com/ustyle/controller/AdminController.java=UTF-8 +encoding//src/main/java/com/ustyle/controller/CheckoutController.java=UTF-8 +encoding//src/main/webapp/WEB-INF/views/user/deleteForm.jsp=UTF-8 +encoding//src/test/java=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 107056a..13b3428 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,13 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index c71a0df..10736e1 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,7 +4,6 @@ - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 43b1e0c..2091c7f 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -3,5 +3,5 @@ - + diff --git a/README.md b/README.md new file mode 100644 index 0000000..03afa38 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# uStyle + uStyle은 여성을 대상으로 한 쇼핑몰입니다. + 다양한 카테고리의 상품을 확인해볼 수 있으며, 상품의 색상, 사이즈를 선택하여 구매할 수 있습니다. + 원하는 상품을 pin으로 등록하고, 등록된 상품을 다른 사용자에게 보여줌으로써, + 그 상품의 구매를 유도할 수 있는 PinBoard 기능을 구현하였습니다. + +- 통합개발환경(IDE) + - Language : Java 1.8 + - Application Framework : Spring 4.1.7, Spring Security 4.0.4 + - Build tool : Apache Maven 3.3.9 + - DBMS : MySQL 5.7 + - WAS : Apache Tomcat 8.0 + - else : jQuery 1.11.3, Handlebars.js 3.0.1, Log4j 1.2.17, Tiles 3.0.5, MyBatis 3.2.8 ... + +- Backend + - github를 통한 소스공유(sourcetree 이용) + - AWS EC2 이용 http://52.78.142.52:8080 : 본 uStyle 홈페이지 주소 + - docker 를 이용해 mysql DB 와 tomcat 를 각각 컨테이너로 세팅 + - jenkins 를 통해 CI/CD 구현. 빌드 및 배포 자동화. 지속적인 유지보수관리 가능. + - github hook service와 jenkins내 플러그인 이용 소스 자동업데이트 + - locust 를 통해 서버 부하테스트 + +- Frontend + - RESTful API 문서화 도구 Swagger 사용 + - 로그인이 필요한 페이지를 판별하기 위해 Interceptor 클래스 활용 + - tiles 를 이용한 template framework + - Ajax 를 이용하여 아이디 중복체크, 파일 업로드, 장바구니, 상품리뷰 작성 구현 + - Java mailsender를 이용하여 회원가입 이메일 인증, 비밀번호찾기 기능 구현 + - Spring Security를 통해 csrf token 적용 + - BCryptPasswordEncoder 를 통해 password 암호화 + - 만들어진 CSS template 이용(themeforest, AdminLTE) + - bootstrap modal을 이용하여 pinboard 기능 구현 + - 반응형 웹페이지 적용 + + +
+ +### more details, https://graybat21.github.io/uStyle/uStyle_Project.pdf diff --git a/pom.xml b/pom.xml index 8c1948d..a3c1ee9 100644 --- a/pom.xml +++ b/pom.xml @@ -1,290 +1,328 @@ - - - 4.0.0 - com.ustyle - controller - uStyle - war - 1.0.0-BUILD-SNAPSHOT - - 1.8 - 4.1.7.RELEASE - 1.6.10 - 1.6.6 - - - - - org.springframework - spring-context - ${org.springframework-version} - - - - commons-logging - commons-logging - - - - - org.springframework - spring-webmvc - ${org.springframework-version} - - - - com.mchange - c3p0 - 0.9.5 - - - mysql - mysql-connector-java - 5.1.38 - - - - - org.aspectj - aspectjrt - ${org.aspectj-version} - - - - org.aspectj - aspectjweaver - ${org.aspectj-version} - - - - - org.slf4j - slf4j-api - ${org.slf4j-version} - - - org.slf4j - jcl-over-slf4j - ${org.slf4j-version} - runtime - - - org.slf4j - slf4j-log4j12 - ${org.slf4j-version} - runtime - - - log4j - log4j - 1.2.17 - - - javax.mail - mail - - - javax.jms - jms - - - com.sun.jdmk - jmxtools - - - com.sun.jmx - jmxri - - - runtime - - - - - javax.inject - javax.inject - 1 - - - - - org.apache.tiles - tiles-extras - 3.0.5 - - - - - - - - javax.servlet - javax.servlet-api - 3.0.1 - - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - javax.servlet - jstl - 1.2 - - - - - javax.validation - validation-api - 1.1.0.Final - - - - - org.springframework - spring-context-support - ${org.springframework-version} - - - javax.mail - mail - 1.4.7 - - - - - junit - junit - 4.12 - test - - - - - org.mybatis - mybatis-spring - 1.2.2 - - - - org.mybatis - mybatis - 3.2.8 - - - - org.springframework - spring-jdbc - ${org.springframework-version} - - - - org.springframework - spring-test - ${org.springframework-version} - - - - org.springframework - spring-tx - ${org.springframework-version} - - - - org.springframework - spring-aop - ${org.springframework-version} - - - - com.fasterxml.jackson.core - jackson-databind - 2.5.4 - - - - org.bgee.log4jdbc-log4j2 - log4jdbc-log4j2-jdbc4 - 1.16 - - - - commons-fileupload - commons-fileupload - 1.3.1 - - - - org.imgscalr - imgscalr-lib - 4.2 - - - - - org.springframework.security - spring-security-web - 4.0.4.RELEASE - - - org.springframework.security - spring-security-core - 4.0.4.RELEASE - - - org.springframework.security - spring-security-config - 4.0.4.RELEASE - - - - - - - - - maven-eclipse-plugin - 2.9 - - - org.springframework.ide.eclipse.core.springnature - - - org.springframework.ide.eclipse.core.springbuilder - - true - true - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - -Xlint:all - true - true - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - org.test.int1.Main - - - - - + + + 4.0.0 + com.ustyle + controller + uStyle + war + 1.0.0-BUILD-SNAPSHOT + + 1.8 + 4.1.7.RELEASE + 1.6.10 + 1.6.6 + + + + + org.springframework + spring-context + ${org.springframework-version} + + + + commons-logging + commons-logging + + + + + org.springframework + spring-webmvc + ${org.springframework-version} + + + + com.mchange + c3p0 + 0.9.5 + + + mysql + mysql-connector-java + 5.1.38 + + + + + org.aspectj + aspectjrt + ${org.aspectj-version} + + + + org.aspectj + aspectjweaver + ${org.aspectj-version} + + + + + org.slf4j + slf4j-api + ${org.slf4j-version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j-version} + runtime + + + org.slf4j + slf4j-log4j12 + ${org.slf4j-version} + runtime + + + log4j + log4j + 1.2.17 + + + javax.mail + mail + + + javax.jms + jms + + + com.sun.jdmk + jmxtools + + + com.sun.jmx + jmxri + + + runtime + + + + + javax.inject + javax.inject + 1 + + + + + org.apache.tiles + tiles-extras + 3.0.5 + + + + + + + + javax.servlet + javax.servlet-api + 3.0.1 + + + + javax.servlet.jsp + jsp-api + 2.1 + provided + + + javax.servlet + jstl + 1.2 + + + + + javax.validation + validation-api + 1.1.0.Final + + + + + org.springframework + spring-context-support + ${org.springframework-version} + + + javax.mail + mail + 1.4.7 + + + + + io.springfox + springfox-swagger2 + 2.7.0 + + + io.springfox + springfox-swagger-ui + 2.7.0 + + + com.google.guava + guava + 18.0 + + + + + junit + junit + 4.12 + test + + + + + org.mybatis + mybatis-spring + 1.2.2 + + + + org.mybatis + mybatis + 3.2.8 + + + + org.springframework + spring-jdbc + ${org.springframework-version} + + + + org.springframework + spring-test + ${org.springframework-version} + + + + org.springframework + spring-tx + ${org.springframework-version} + + + + org.springframework + spring-aop + ${org.springframework-version} + + + + com.fasterxml.jackson.core + jackson-databind + 2.5.4 + + + + org.bgee.log4jdbc-log4j2 + log4jdbc-log4j2-jdbc4 + 1.16 + + + + commons-fileupload + commons-fileupload + 1.3.1 + + + + org.imgscalr + imgscalr-lib + 4.2 + + + + + org.springframework.security + spring-security-web + 4.0.4.RELEASE + + + org.springframework.security + spring-security-core + 4.0.4.RELEASE + + + org.springframework.security + spring-security-config + 4.0.4.RELEASE + + + + + + + ROOT + + + maven-eclipse-plugin + 2.9 + + + org.springframework.ide.eclipse.core.springnature + + + org.springframework.ide.eclipse.core.springbuilder + + true + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + 1.6 + 1.6 + -Xlint:all + true + true + UTF-8 + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + org.test.int1.Main + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + http://localhost:8081 + / + + + + + + + + org.codehaus.mojo + sonar-maven-plugin + + + + + + diff --git a/src/main/java/com/ustyle/controller/AdminController.java b/src/main/java/com/ustyle/controller/AdminController.java new file mode 100644 index 0000000..6eaef6c --- /dev/null +++ b/src/main/java/com/ustyle/controller/AdminController.java @@ -0,0 +1,352 @@ +package com.ustyle.controller; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.inject.Inject; +import javax.validation.Valid; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.ustyle.domain.Grade; +import com.ustyle.domain.PinBoard; +import com.ustyle.domain.User; +import com.ustyle.service.GradeService; +import com.ustyle.service.PinService; +import com.ustyle.service.SalesService; +import com.ustyle.service.UserService; +import com.ustyle.utils.PageMaker; + +@Controller +@RequestMapping("/admin/*") +public class AdminController { + private static final Logger logger = LoggerFactory.getLogger(AdminController.class); + + @Inject + private UserService userService; + @Inject + private GradeService gradeService; + @Inject + private SalesService salesService; + @Inject + private PinService pinService; + + @RequestMapping(value = "main.do", method = RequestMethod.GET) + public String mainForm() { + return "main/base"; + } + + @RequestMapping(value = "login", method = RequestMethod.GET) + public String loginForm() { + return "login/loginAdmin"; + } + + @RequestMapping(value = "logout.do", method = RequestMethod.GET) + public String logout() { + return "login/logoutAdmin"; + } + + @RequestMapping("userList.do") + public ModelAndView userList(PageMaker pagemaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + HashMap map = new HashMap(); + int page = pagemaker.getPage() != null ? pagemaker.getPage() : 1; + pagemaker.setPage(page); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + int totalCnt = userService.selectListCnt(map); // DB�뿰�룞_ 珥� 媛��닔 + // 援ы빐�삤湲� + int countPerPage = 3; + int countPerPaging = 3; + + int first = ((pagemaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = userService.userList(map); + pagemaker.setCount(totalCnt, countPerPage, countPerPaging); + mav.addObject("userList", list); + mav.addObject("pageMaker", pagemaker); + mav.setViewName("user/userList"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + logger.info(list.toString()); + return mav; + } + + @ResponseBody + @RequestMapping(value = "initializePoint.do", method = RequestMethod.POST) + public ResponseEntity initializePoint(@RequestBody User user) throws Exception { + + ResponseEntity entity = null; + + try + { + user.setPoint(0); + logger.info("INITIALIZE POINT TO USERNAME = " + user.getUsername()); + userService.updatePoint(user); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @ResponseBody + @RequestMapping(value = "userDelete.do", method = RequestMethod.POST) + public ResponseEntity userDelete(@RequestBody User user) throws Exception { + + ResponseEntity entity = null; + + try + { + String username = user.getUsername(); + logger.info("DELETE TO USERNAME = " + username); + userService.delete(username); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @RequestMapping(value = "grade.do", method = RequestMethod.GET) + public String gradeList(Model model) throws Exception { + List gradeList = gradeService.selectList(); + model.addAttribute(gradeList); + return "grade/gradeList"; + } + + @RequestMapping(value = "grade.do", method = RequestMethod.POST) + public String gradeInsert(@ModelAttribute @Valid Grade grade) throws Exception { + gradeService.insert(grade); + return "redirect:/admin/grade.do"; + } + + @RequestMapping(value = "gradeUpdate.do", method = RequestMethod.POST) + public String gradeUpdate(@ModelAttribute @Valid Grade grade) throws Exception { + gradeService.update(grade); + logger.info("grade has been successfully updated!! - " + grade.toString()); + return "redirect:/admin/grade.do"; + } + + @RequestMapping(value = "modifyAllUsersGrade.do") + public String modifyAllUsersGrade() throws Exception { + userService.modifyAllUsersGradeInitialize(); + Grade grade = new Grade(); + List gradeList = gradeService.selectList(); + for (int i = 0; i < gradeList.size(); i++) { + grade = gradeList.get(i); + userService.modifyAllUsersGrade(grade); + logger.info("\n***Grade idx" + grade.getIdx() + ", " + grade.getGrade() + + " users \nwho bought whole purchase price between " + grade.getMin() + " and " + grade.getMax() + + " last " + grade.getBuy_term() + " months \nhave been successfully updated!"); + } + return "redirect:/admin/grade.do"; + } + + @RequestMapping("deleteGrade.do") + public String gradeDelete(@RequestParam int idx) throws Exception { + gradeService.delete(idx); + return "redirect:/admin/grade.do"; + } + + @RequestMapping(value = "salesList.do", method = RequestMethod.GET) + public ModelAndView salesList(@RequestParam(value = "startDate", required = false) String startDate, + @RequestParam(value = "endDate", required = false) String endDate, Integer pageCount) throws Exception { + ModelAndView mav = new ModelAndView("sales/salesList"); + + PageMaker pagemaker = new PageMaker(); + + mav.addObject("startDate", startDate); + mav.addObject("endDate", endDate); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + + Timestamp firstTimestamp = new Timestamp(0); + String firstDate = sdf.format(firstTimestamp); // 19700101 + + if ( startDate == null || endDate == null ) + return mav; + else if ( Integer.parseInt(startDate) > Integer.parseInt(endDate) + || Integer.parseInt(startDate) < Integer.parseInt(firstDate) ) { + mav.setViewName("sales/salesListFail"); + return mav; + } + + Date formattedStartDate = sdf.parse(startDate); + Date formattedEndDate = sdf.parse(endDate); + formattedEndDate = getEndOfDay(formattedEndDate); // yyyymmdd 형식으로 입력된 날짜의 마지막 시간을 구함 + + Timestamp startTimestamp = new Timestamp(formattedStartDate.getTime()); + Timestamp endTimestamp = new Timestamp(formattedEndDate.getTime()); + + HashMap dateMap = new HashMap(); + dateMap.put("start", startTimestamp); + dateMap.put("end", endTimestamp); + + logger.info(startTimestamp.toString()); + logger.info(endTimestamp.toString()); + + HashMap totalMapForDaterange = salesService.selectSalesForDaterange(dateMap); + + int totalCnt = Integer.parseInt(String.valueOf(totalMapForDaterange.get("totalcnt"))); + long totalSalesPrice = Long.parseLong(String.valueOf(totalMapForDaterange.get("totalsalesprice"))); + int totalUsedPoint = Integer.parseInt(String.valueOf(totalMapForDaterange.get("totalusedpoint"))); + + int page = ( pageCount != null ) ? pageCount.intValue() : 1; + pagemaker.setPage(page); + int countPerPaging = 10; + int pageCnt = 10; + + pagemaker.setCount(totalCnt, pageCnt, countPerPaging); + + int first = ( (page - 1) * pageCnt); + dateMap.put("firstrow", first); + dateMap.put("pagecnt", pageCnt); + + List> salesList = salesService.selectSalesForDaterangeAndPagination(dateMap); + + for ( HashMap sales : salesList ) + { + Iterator iterator = sales.keySet().iterator(); + while (iterator.hasNext()) { + String key = String.valueOf(iterator.next()); + logger.info("key = " + key); + logger.info(" value = " + sales.get(key)); + } + } + + logger.info("START DATE = " + startTimestamp); + logger.info("END DATE = " + endTimestamp); + logger.info("TOTAL COUNT = " + totalCnt); + logger.info("PAGE = " + page); + + mav.addObject("salesList", salesList); + mav.addObject("totalSalesPrice", totalSalesPrice); + mav.addObject("totalUsedPoint", totalUsedPoint); + mav.addObject("pageMaker", pagemaker); + + return mav; + } + + private Date getEndOfDay(Date day) { + return getEndOfDay(day, Calendar.getInstance()); + } + + private Date getEndOfDay(Date day, Calendar cal) { + if (day == null) + day = new Date(); + + cal.setTime(day); + cal.set(Calendar.HOUR_OF_DAY, cal.getMaximum(Calendar.HOUR_OF_DAY)); + cal.set(Calendar.MINUTE, cal.getMaximum(Calendar.MINUTE)); + cal.set(Calendar.SECOND, cal.getMaximum(Calendar.SECOND)); + cal.set(Calendar.MILLISECOND, cal.getMaximum(Calendar.MILLISECOND)); + return cal.getTime(); + } + + @RequestMapping(value = "salesDetail.do", method = RequestMethod.GET) + public ModelAndView salesDetail(Timestamp purchasedate, String username) throws Exception { + ModelAndView mav = new ModelAndView("sales/salesDetail"); + + HashMap userMap = new HashMap(); + userMap.put("purchasedate", purchasedate); + userMap.put("username", username); + + HashMap userDetailMap = salesService.selectSalesForDate(userMap); + // userDetailMap이 null일 때, 400 Error 예외페이지 처리 + + Integer purchaseid = Integer.valueOf(String.valueOf(userDetailMap.get("purchaseid"))); + + List> salesDetailList = salesService.selectSalesDetail(purchaseid); + + mav.addObject("userMap", userMap); + mav.addObject("userDetailMap", userDetailMap); + mav.addObject("salesDetailList", salesDetailList); + + return mav; + } + + // =============================== pin =============================== // + + @RequestMapping("pinBoardList.do") + public ModelAndView pinBoardList(PageMaker pageMaker, + @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + HashMap map = new HashMap(); + + int page = pageMaker.getPage() != null ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + int totalCnt = pinService.selectListCnt(map); + int countPerPage = 10; + int countPerPaging = 10; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = pinService.selectPinBoardList(map); + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + mav.addObject("pinBoardList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("pin/pinBoardList"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + logger.info(list.toString()); + return mav; + } + + @ResponseBody + @RequestMapping(value = "pinBoardDelete.do", method = RequestMethod.POST) + public ResponseEntity pinBoardDelete(@RequestBody PinBoard pinBoard) throws Exception { + + ResponseEntity entity = null; + + try + { + int pinBoardno = pinBoard.getPinboardno(); + logger.info("DELETE TO PINBOARD = " + pinBoard.toString()); + pinService.deletePinBoard(pinBoardno); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } +} diff --git a/src/main/java/com/ustyle/controller/BoardAdminController.java b/src/main/java/com/ustyle/controller/BoardAdminController.java new file mode 100644 index 0000000..5eaff6f --- /dev/null +++ b/src/main/java/com/ustyle/controller/BoardAdminController.java @@ -0,0 +1,309 @@ +package com.ustyle.controller; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.ustyle.domain.Faq; +import com.ustyle.domain.Notice; +import com.ustyle.domain.Qna; +import com.ustyle.service.FaqService; +import com.ustyle.service.NoticeService; +import com.ustyle.service.QnaService; +import com.ustyle.utils.PageMaker; + +@Controller +@RequestMapping("/admin/board/*") +public class BoardAdminController { + + private static final Logger logger = LoggerFactory.getLogger(BoardAdminController.class); + + @Inject + private NoticeService noticeService; + + @Inject + private FaqService faqService; + + @Inject + private QnaService qnaService; + +/* ============================== Notice ================================= */ + + @RequestMapping(value = "notice.do", method = RequestMethod.GET) + public ModelAndView noticeList(PageMaker pageMaker, + @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + + HashMap map = new HashMap(); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + + int totalCnt = noticeService.selectListCnt(map); // DB연동_ 총 갯수 구해오기 + int page = ( pageMaker.getPage() != null ) ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + int countPerPage = 10; + int countPerPaging = 3; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = noticeService.noticeList(map); + logger.info(list.toString()); + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + + mav.addObject("noticeList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("board/board_notice"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + + return mav; + } + + @RequestMapping(value = "noticeWrite.do", method = RequestMethod.GET) + public String noticeWriteForm() { + return "board/noticeWrite"; + } + + @RequestMapping(value = "noticeWrite.do", method = RequestMethod.POST) + public String noticeWrite(Notice notice) throws Exception { + noticeService.noticeWrite(notice); + logger.info("WRITTEN NOTICE CONTENTS = ", notice.toString()); + return "redirect:/admin/board/notice.do"; + } + + @RequestMapping("noticeView.do") + public ModelAndView noticeView(@RequestParam(value = "bno") int bno, int page) throws Exception { + ModelAndView mav = new ModelAndView(); + + Notice notice = noticeService.noticeViewFromAdmin(bno); + mav.addObject("notice", notice); + mav.addObject("page", page); + mav.setViewName("board/noticeDetail"); + return mav; + } + + @RequestMapping(value = "noticeModify.do", method = RequestMethod.GET) + public String noticeModifyForm(@RequestParam(value = "bno") int bno, Model model) throws Exception { + Notice notice = noticeService.noticeViewFromAdmin(bno); + model.addAttribute("notice", notice); + return "board/noticeWrite"; + } + + @RequestMapping(value = "noticeModify.do", method = RequestMethod.POST) + public String noticeModify(Notice notice) throws Exception { + noticeService.noticeModify(notice); + return "redirect:/admin/board/notice.do"; + } + + @ResponseBody + @RequestMapping(value = "noticeDelete.do", method = RequestMethod.POST) + public ResponseEntity noticeDelete(@RequestBody Notice notice) throws Exception { + + ResponseEntity entity = null; + + try + { + int deleteBno = notice.getBno(); + logger.info("NOTICE TO DELETE = " + deleteBno); + noticeService.noticeDelete(deleteBno); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + +/* ============================== FAQ ================================= */ + + @RequestMapping(value = "faq.do", method = RequestMethod.GET) + public ModelAndView faqList(PageMaker pageMaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + + HashMap map = new HashMap(); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + + int totalCnt = faqService.selectListCnt(map); + int page = ( pageMaker.getPage() != null ) ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + int countPerPage = 10; + int countPerPaging = 5; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = faqService.faqList(map); + logger.info(list.toString()); + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + + mav.addObject("faqList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("board/board_faq"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + + return mav; + } + + @RequestMapping(value = "faqWrite.do", method = RequestMethod.GET) + public String faqWriteForm() { + return "board/faqWrite"; + } + + @RequestMapping(value = "faqWrite.do", method = RequestMethod.POST) + public String faqWrite(Faq faq) throws Exception { + faqService.faqWrite(faq); + logger.info(faq.toString()); + return "redirect:/admin/board/faq.do"; + } + + @RequestMapping(value = "faqModify.do", method = RequestMethod.GET) + public String faqModifyForm(@RequestParam(value = "bno") int bno,Model model) throws Exception { + Faq faq = faqService.faqViewFromAdmin(bno); + model.addAttribute("faq",faq); + return "board/faqWrite"; + } + + @RequestMapping(value = "faqModify.do", method = RequestMethod.POST) + public String faqModify(Faq faq) throws Exception { + System.out.println(faq.getBno() + "번 글 수정"); + faqService.faqModify(faq); + return "redirect:/admin/board/faq.do"; + } + + @ResponseBody + @RequestMapping(value = "faqDelete.do", method = RequestMethod.POST) + public ResponseEntity faqDelete(@RequestBody Faq faq) throws Exception { + + ResponseEntity entity = null; + + try + { + int deleteBno = faq.getBno(); + logger.info("FAQ TO DELETE = " + deleteBno); + faqService.faqDelete(deleteBno); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + +/* ============================== Q&A ================================= */ + + @RequestMapping(value = "qna.do", method = RequestMethod.GET) + public ModelAndView qnaList(PageMaker pageMaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + + HashMap map = new HashMap(); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + + int totalCnt = qnaService.selectListCnt(map); + int page = ( pageMaker.getPage() != null ) ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + + int countPerPage = 10; + int countPerPaging = 5; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = qnaService.qnaList(map); + logger.info(list.toString()); + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + + mav.addObject("qnaList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("board/board_qna"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + return mav; + } + + @RequestMapping("qnaView.do") + public ModelAndView qnaView(@RequestParam(value = "bno") int bno, int page) throws Exception { + ModelAndView mav = new ModelAndView(); + + Qna qna = qnaService.qnaViewFromAdmin(bno); + mav.addObject("qna", qna); + mav.addObject("page", page); + mav.setViewName("board/qnaDetail"); + return mav; + } + + @ResponseBody + @RequestMapping(value = "qnaDelete.do", method = RequestMethod.POST) + public ResponseEntity qnaDelete(@RequestBody Qna qna) throws Exception { + + ResponseEntity entity = null; + + try + { + int deleteBno = qna.getBno(); + logger.info("Q&A TO DELETE = " + deleteBno); + qnaService.qnaDelete(deleteBno); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @RequestMapping(value = "qnaReply.do", method = RequestMethod.GET) + public String qnaReplyForm(@RequestParam(value = "parent") int parent, Model model) throws Exception { + Qna qna = qnaService.qnaViewFromAdmin(parent); + model.addAttribute("qna",qna); + return "board/qnaWrite"; + } + + @RequestMapping(value = "qnaReply.do", method = RequestMethod.POST) + public String qnaReply(Qna qna) throws Exception { + qna.setUsername("administrator"); + qna.setParent(qna.getBno()); + qna.setDepth(1); + qna.setIndent(1); + + qnaService.qnaWrite(qna); + logger.info(qna.toString()); + return "redirect:/admin/board/qna.do"; + } + +} diff --git a/src/main/java/com/ustyle/controller/BoardController.java b/src/main/java/com/ustyle/controller/BoardController.java new file mode 100644 index 0000000..fc8519a --- /dev/null +++ b/src/main/java/com/ustyle/controller/BoardController.java @@ -0,0 +1,339 @@ +package com.ustyle.controller; + +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.ustyle.domain.Faq; +import com.ustyle.domain.Notice; +import com.ustyle.domain.Qna; +import com.ustyle.domain.User; +import com.ustyle.service.FaqService; +import com.ustyle.service.NoticeService; +import com.ustyle.service.QnaService; +import com.ustyle.utils.PageMaker; + +@Controller +@RequestMapping("/board/*") +public class BoardController { + + private static final Logger logger = LoggerFactory.getLogger(BoardController.class); + + @Inject + private NoticeService noticeService; + + @Inject + private FaqService faqService; + + @Inject + private QnaService qnaService; + +/* ============================== Notice ================================= */ + + @RequestMapping(value = "notice.do", method = RequestMethod.GET) + public ModelAndView noticeList(PageMaker pageMaker, + @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + + ModelAndView mav = new ModelAndView("board/board_notice/Notice"); + + if ( searchKeyword != null ) + searchKeyword = searchKeyword.trim(); + + HashMap map = new HashMap(); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + + int totalCnt = noticeService.selectListCnt(map); // DB연동_ 총 갯수 구해오기 + + int page = ( pageMaker.getPage() != null ) ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + int countPerPage = 10; + int countPerPaging = 3; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = noticeService.noticeList(map); + logger.info(list.toString()); + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + + mav.addObject("noticeList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("board/board_notice/공지사항"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + + return mav; + } + + @RequestMapping("noticeView.do") + public ModelAndView noticeView(@RequestParam(value = "bno") int bno) throws Exception { + ModelAndView mav = new ModelAndView(); + + Notice notice = noticeService.noticeView(bno); + logger.info(notice.toString()); + + mav.addObject("notice", notice); + mav.setViewName("board/noticeDetail/공지사항 상세보기"); + + return mav; + } + +/* ============================== FAQ ================================= */ + + @RequestMapping(value = "faq.do", method = RequestMethod.GET) + public ModelAndView faqList(PageMaker pageMaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + HashMap map = new HashMap(); + + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + + int totalCnt = faqService.selectListCnt(map); + int page = pageMaker.getPage() != null ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + int countPerPage = 10; + int countPerPaging = 5; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = faqService.faqList(map); + logger.info(list.toString()); + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + + mav.addObject("faqList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("board/board_faq/FAQ"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + + return mav; + } + +/* ============================== Q&A ================================= */ + + @RequestMapping(value = "qna.do", method = RequestMethod.GET) + public ModelAndView qnaList(PageMaker pageMaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + + HashMap map = new HashMap(); + + if ( searchKeyword != null ) + searchKeyword = searchKeyword.trim(); + + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + + int totalCnt = qnaService.selectListCnt(map); + + logger.info("aaa = " + totalCnt); + + int page = ( pageMaker.getPage() != null ) ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + int countPerPage = 10; + int countPerPaging = 5; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = qnaService.qnaList(map); + logger.info(list.toString()); + + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + mav.addObject("qnaList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("board/board_qna/Q&A"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + + return mav; + } + + @RequestMapping(value = "qnaWrite.do", method = RequestMethod.GET) + public ModelAndView qnaWriteForm(@RequestParam(value = "page") int page, HttpSession session) { + ModelAndView mav = new ModelAndView("board/qnaWrite/Q&A 글쓰기"); + + mav.addObject("page", page); + return mav; + } + + @RequestMapping(value = "qnaWrite.do", method = RequestMethod.POST) + public String qnaWrite(Qna qna, HttpSession session) throws Exception { + + User user = (User) session.getAttribute("session_user"); + qna.setUsername(user.getUsername()); + + logger.info(qna.toString()); + qnaService.qnaWrite(qna); + + return "redirect:/board/myQnaList.do"; + } + + @RequestMapping("qnaView.do") + public ModelAndView qnaView(@RequestParam(value = "bno") int bno, int page) throws Exception { + ModelAndView mav = new ModelAndView(); + + Qna qna = qnaService.qnaView(bno); + + mav.addObject("qna", qna); + mav.addObject("page", page); + mav.setViewName("board/qnaDetail/Q&A 상세보기"); + return mav; + } + + @ResponseBody + @RequestMapping(value = "qnaDelete.do", method = RequestMethod.POST) + public ResponseEntity qnaDelete(@RequestBody Qna qna) throws Exception { + + ResponseEntity entity = null; + + try + { + int deleteBno = qna.getBno(); + logger.info("Q&A TO DELETE = " + deleteBno); + qnaService.qnaDelete(deleteBno); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @RequestMapping(value = "myQnaList.do", method = RequestMethod.GET) + public ModelAndView myQnaList(HttpSession session, PageMaker pageMaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + + ModelAndView mav = new ModelAndView(); + + if ( searchKeyword != null ) + searchKeyword = searchKeyword.trim(); + + HashMap map = new HashMap(); + User user = (User) session.getAttribute("session_user"); + + map.put("username", user.getUsername()); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + int totalCnt = qnaService.selectMyListCnt(map); + + int page = ( pageMaker.getPage() != null ) ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + int countPerPage = 10; + int countPerPaging = 5; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = qnaService.myQnaList(map); + + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + mav.addObject("pageMaker", pageMaker); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + + mav.addObject("myQnaList", list); + mav.setViewName("board/myQnaList/My Q&A"); + return mav; + } + + @RequestMapping("myQnaView.do") + public ModelAndView myQnaView(@RequestParam(value = "bno") int bno, int page, HttpSession session) throws Exception { + ModelAndView mav = new ModelAndView(); + + Qna qna = qnaService.qnaView(bno); + + User user = (User) session.getAttribute("session_user"); + String username = user.getUsername(); + String qnaUsername = qna.getUsername(); + + if ( !(username.equals(qnaUsername)) ) { + mav.setViewName("board/myQnaDetailError/Error"); + return mav; + } + + mav.addObject("qna", qna); + mav.addObject("page", page); + mav.setViewName("board/myQnaDetail/나의 Q&A 상세보기"); + return mav; + } + + @RequestMapping(value = "qnaModify.do", method = RequestMethod.GET) + public ModelAndView qnaModifyForm(@RequestParam(value = "bno") int bno, + @RequestParam(value = "page") int page, HttpSession session, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + + ModelAndView mav = new ModelAndView(); + + User user = (User) session.getAttribute("session_user"); + Qna qna = qnaService.qnaView(bno); + + if ( !qna.getUsername().equals(user.getUsername()) ) { + if ( searchKeyword != null ) { + searchKeyword = URLEncoder.encode(searchKeyword, "UTF-8"); // 한글이 깨져나오지 않게 하기 위한 처리 + mav.setViewName("redirect:/board/myQnaView.do?page=" + page + "&o=" + searchOption + "&k=" + searchKeyword); + } + else + mav.setViewName("redirect:/board/myQnaView.do?page=" + page); + + return mav; + } + + mav.setViewName("board/qnaModify/Q&A 수정하기"); + mav.addObject(qna); + mav.addObject("page", page); + + return mav; + } + + @RequestMapping(value = "qnaModify.do", method = RequestMethod.POST) + public ModelAndView qnaModify(Qna qna, int page, + String searchOption, String searchKeyword) throws Exception { + + ModelAndView mav = new ModelAndView(); + + qnaService.qnaModify(qna); + mav.addObject(qna); + + int bno = qna.getBno(); + + if ( searchKeyword != null ) { + searchKeyword = URLEncoder.encode(searchKeyword, "UTF-8"); // 한글이 깨져나오지 않게 하기 위한 처리 + mav.setViewName("redirect:/board/myQnaView.do?bno=" + bno +"&page=" + page + "&o=" + searchOption + "&k=" + searchKeyword); + } + else + mav.setViewName("redirect:/board/myQnaView.do?bno=" + bno + "&page=" + page); + + return mav; + } +} diff --git a/src/main/java/com/ustyle/controller/CartController.java b/src/main/java/com/ustyle/controller/CartController.java new file mode 100644 index 0000000..4c10950 --- /dev/null +++ b/src/main/java/com/ustyle/controller/CartController.java @@ -0,0 +1,171 @@ +package com.ustyle.controller; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.inject.Inject; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +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 com.ustyle.domain.Cart; +import com.ustyle.domain.User; +import com.ustyle.service.CartService; + +@Controller +@RequestMapping("/cart/*") +public class CartController { + + private static final Logger logger = LoggerFactory.getLogger(CartController.class); + + @Inject + private CartService cartService; + + /** + * 상품의 상세페이지에서 옵션을 선택한 후 장바구니 추가 버튼을 눌렀을 때 호출되며, 호출 후 장바구니 페이지로 리다이렉션됨. + * + * @param cart + * @param session + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "addCart.do", method = RequestMethod.POST) + public ModelAndView productToCart(@ModelAttribute Cart cart, HttpSession session) throws Exception { + + ModelAndView mav = new ModelAndView(); + + User user = (User) session.getAttribute("session_user"); + String username = user.getUsername(); + + if ( cartService.selectCartItemsCountForUsername(username) == 10 ) + { // 장바구니에 담긴 상품이 10개인 경우, 장바구니에 담긴 상품을 빼도록 유도함 + mav.setViewName("cart/addtoCartFail/상품 추가 오류"); + return mav; + } + + cart.setUsername(username); + logger.info(cart.toString()); + cartService.insert(cart); + mav.setViewName("redirect:/cart/viewCart.do"); + return mav; + } + + /** + * 로그인한 회원의 장바구니 페이지를 조회함 + * + * @param session + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "viewCart.do", method = RequestMethod.GET) + public ModelAndView viewCart(HttpSession session) throws Exception { + User user = (User) session.getAttribute("session_user"); + + String username = user.getUsername(); + logger.info("login User: " + username); + + List> userCartInfoList = cartService.selectUserCartList(username); + + int totalPrice = 0; + + for ( HashMap map : userCartInfoList ) + { + int eachPrice = (Integer) map.get("saleprice"); + int eachCount = (Integer) map.get("count"); + + totalPrice += eachPrice * eachCount; + + Iterator iterator = map.keySet().iterator(); + while (iterator.hasNext()) { + String key = String.valueOf(iterator.next()); + logger.info("key = " + key); + logger.info(" value = " + map.get(key)); + } + } + + logger.info("totalPrice = " + totalPrice); + + ModelAndView mav = new ModelAndView("cart/viewCart/장바구니"); + mav.addObject("userCartInfoList", userCartInfoList); + mav.addObject("cartCount", userCartInfoList.size()); + mav.addObject("totalPrice", totalPrice); + + return mav; + + } + + /** + * 장바구니에 있는 Item의 수량을 바꾼 후, 수정 버튼을 눌렀을 때 호출됨 + * + * @param cart + * @return updatedItemCart + * @throws Exception + */ + + @ResponseBody + @RequestMapping(value = "updateCart.do", method = RequestMethod.POST) + public Cart updateCart(@RequestBody Cart cart) throws Exception { + + cartService.update(cart); + int updatedCartno = cart.getCartno(); + + Cart updatedItemCart = cartService.selectUserCartOne(updatedCartno); + + return updatedItemCart; + } + + /** + * 장바구니에 있는 특정 Item을 삭제했을 때 호출됨 + * + * @param cart + * @return deletedItemCart + * @throws Exception + */ + + @ResponseBody + @RequestMapping(value = "deleteCart.do", method = RequestMethod.POST) + public Cart deleteCart(@RequestBody Cart cart) throws Exception { + + int deleteCartNo = cart.getCartno(); + + cartService.delete(deleteCartNo); + + Cart deletedItemCart = cartService.selectUserCartOne(deleteCartNo); + + return deletedItemCart; + } + + /** + * 장바구니에 있는 모든 Item을 삭제할 때 호출됨 + * + * @param session + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "deleteAllCart.do", method = RequestMethod.POST) + public ModelAndView deleteAllCart(HttpSession session) throws Exception { + + ModelAndView mav = new ModelAndView(); + + User user = (User) session.getAttribute("session_user"); + String username = user.getUsername(); + + cartService.deleteAll(username); + + mav.setViewName("redirect:/cart/viewCart.do"); + + return mav; + } +} diff --git a/src/main/java/com/ustyle/controller/CheckoutController.java b/src/main/java/com/ustyle/controller/CheckoutController.java new file mode 100644 index 0000000..47062b6 --- /dev/null +++ b/src/main/java/com/ustyle/controller/CheckoutController.java @@ -0,0 +1,195 @@ +package com.ustyle.controller; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.inject.Inject; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +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 com.ustyle.domain.Item; +import com.ustyle.domain.Product; +import com.ustyle.domain.Purchase; +import com.ustyle.domain.Sales; +import com.ustyle.domain.User; +import com.ustyle.service.CartService; +import com.ustyle.service.ItemService; +import com.ustyle.service.ProductService; +import com.ustyle.service.SalesService; +import com.ustyle.service.UserService; + +@Controller +@RequestMapping("/checkout/*") +public class CheckoutController { + + private static final Logger logger = LoggerFactory.getLogger(CheckoutController.class); + private static final int SHIPPING_PRICE = 3000; + + @Inject + private UserService userService; + + @Inject + private ProductService productService; + + @Inject + private ItemService itemService; + + @Inject + private CartService cartService; + + @Inject + private SalesService salesService; + + /** + * 장바구니 페이지에서 결제 버튼을 눌렀을 때 호출됨 + * + * @param session + * @return mav + * @throws Exception + */ + + @ResponseBody + @RequestMapping(value = "checkout.do", method = RequestMethod.POST) + public ModelAndView checkout(HttpSession session) throws Exception { + ModelAndView mav = new ModelAndView("checkout/checkout/상품 결제"); + + User user = (User) session.getAttribute("session_user"); + String username = user.getUsername(); + logger.info("login User: " + username); + + List> userSelectedItemidList = cartService.selectUserItemidList(username); + + int totalPrice = 0; // 諛곗넚鍮꾨�� �젣�쇅�븳 媛�寃� + int shippingPrice = 0; // 諛곗넚鍮� + int finalPrice = 0; // 諛곗넚鍮꾨�� �룷�븿�븳 媛�寃� + int point = user.getPoint(); // �궗�슜�옄 �룷�씤�듃 + + for ( HashMap map : userSelectedItemidList ) + { + Iterator iterator = map.keySet().iterator(); + while (iterator.hasNext()) { + String key = String.valueOf(iterator.next()); + logger.info("key = " + key); + logger.info(" value = " + map.get(key)); + } + + int eachItemid = (Integer) map.get("itemid"); + int eachTotalCount = Integer.parseInt(String.valueOf(map.get("totalcount"))); + // HashMap�쑝濡� 諛쏆쓣 �븣, MySQL sum �븿�닔瑜� �씠�슜�븳 媛믪쓣 int�삎�쑝濡� 諛쏆� 紐삵븯誘�濡�, �쐞�� 媛숈씠 String�쑝濡� 諛쏆� �썑 int濡� �떎�떆 蹂��솚�븯���떎. + + Item eachItem = itemService.read(eachItemid); + int eachStock = eachItem.getStock(); + + if ( eachTotalCount > eachStock ) + { + Product outofStockProduct = productService.read(eachItem.getProductid()); + Item outofStockItem = eachItem; + + String outofStockProductname = outofStockProduct.getProductname(); + String outofStockColor = outofStockItem.getColor(); + String outofStockSize = outofStockItem.getSize(); + + mav.addObject("outofStockProductname", outofStockProductname); + mav.addObject("outofStockColor", outofStockColor); + mav.addObject("outofStockSize", outofStockSize); + mav.addObject("maxStock", eachStock); + + mav.setViewName("checkout/checkoutFail/결제 오류"); + return mav; + } + + int eachItemPrice = (Integer) map.get("saleprice"); + + totalPrice += ( eachItemPrice * eachTotalCount ); + } + + mav.addObject("userSelectedItemidList", userSelectedItemidList); + + if ( totalPrice < 30000 ) + { + finalPrice = totalPrice + SHIPPING_PRICE; + shippingPrice = SHIPPING_PRICE; + } + else + { + finalPrice = totalPrice; + shippingPrice = 0; + } + + mav.addObject("totalPrice", totalPrice); + mav.addObject("shippingPrice", shippingPrice); + mav.addObject("finalPrice", finalPrice); + mav.addObject("point", point); + + logger.info("TOTAL PRICE: " + totalPrice); + + return mav; + } + + /** + * 결제 페이지에서 배송지와 사용할 포인트를 입력한 후, 최종적으로 결제 버튼을 눌렀을 때 호출됨 + * + * @param session + * @param purchase + * @param totalprice + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "checkoutSuccess.do", method = RequestMethod.POST) + public ModelAndView checkoutSuccess(HttpSession session, + @ModelAttribute Purchase purchase, Integer totalprice) throws Exception { + + ModelAndView mav = new ModelAndView("checkout/checkoutSuccess/결제 성공"); + + User user = (User) session.getAttribute("session_user"); + String username = user.getUsername(); + + purchase.setUsername(username); + + logger.info("FINAL PRICE = " + totalprice); + logger.info("BEFORE PURCHASE = " + purchase.toString()); + + double point_ratio = userService.selectUserPointRatio(username); + int addpoint = (int) (totalprice * point_ratio); + logger.info("ADD POINT = " + addpoint); + + HashMap addPointMap = new HashMap(); + addPointMap.put("username", username); + addPointMap.put("addpoint", addpoint); + + salesService.updateAddPoint(addPointMap); + salesService.insertPurchase(purchase); + + logger.info("AFTER PURCHASE = " + purchase.toString()); + + int purchaseid = purchase.getPurchaseid(); + + int pointAfterPurchase = userService.selectOneUser(username).getPoint(); + + session.setAttribute("session_userpoint", pointAfterPurchase); + + List salesList = salesService.selectUserCartListForPurchase(username); + + for ( Sales sales : salesList ) + { + sales.setPurchaseid(purchaseid); + salesService.insert(sales); + logger.info("SALES = " + sales.toString()); + } + + cartService.deleteAll(username); // �옣諛붽뎄�땲 鍮꾩슦湲� + + return mav; + + } +} \ No newline at end of file diff --git a/src/main/java/com/ustyle/controller/CommonExceptionAdvice.java b/src/main/java/com/ustyle/controller/CommonExceptionAdvice.java new file mode 100644 index 0000000..ea72c6e --- /dev/null +++ b/src/main/java/com/ustyle/controller/CommonExceptionAdvice.java @@ -0,0 +1,23 @@ +package com.ustyle.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.ModelAndView; + +@ControllerAdvice +public class CommonExceptionAdvice +{ + private static final Logger logger = LoggerFactory.getLogger(CommonExceptionAdvice.class); + + @ExceptionHandler(Exception.class) + public ModelAndView errorModelAndView(Exception e) { + ModelAndView mav = new ModelAndView(); + mav.setViewName("error/errorCommon/Error"); + + logger.error("ERROR!!!", e); // 콘솔창에 예외 메시지, 예외 발생경로를 띄움. + return mav; + } + +} diff --git a/src/main/java/com/ustyle/controller/HomeController.java b/src/main/java/com/ustyle/controller/HomeController.java index f48b99b..bd6fef3 100644 --- a/src/main/java/com/ustyle/controller/HomeController.java +++ b/src/main/java/com/ustyle/controller/HomeController.java @@ -1,48 +1,31 @@ package com.ustyle.controller; -import java.text.DateFormat; -import java.util.Date; -import java.util.Locale; - -import javax.inject.Inject; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import com.ustyle.service.UserService; -import com.ustyle.utils.UserEntryValidator; +import io.swagger.annotations.Api; /** * Handles requests for the application home page. */ + @Controller +@Api(value="swagger", description="swagger-test") public class HomeController { - + private static final Logger logger = LoggerFactory.getLogger(HomeController.class); - - @Inject - private UserService service; - @Inject - private UserEntryValidator userEntryValidator; - /** - * Simply selects the home view to render by returning its name. - */ + @RequestMapping(value = "/", method = RequestMethod.GET) - public String home(Locale locale, Model model) { - logger.info("Welcome home! The client locale is {}.", locale); - - Date date = new Date(); - DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); - - String formattedDate = dateFormat.format(date); - - model.addAttribute("serverTime", formattedDate ); - - return "main/home/MAIN"; + public String home() { + return "redirect:/index.do"; } + @RequestMapping(value="/swagger", method = RequestMethod.GET) + public String homePost(){ + return "redirect:/swagger-ui.html"; + } + } diff --git a/src/main/java/com/ustyle/controller/ItemAdminController.java b/src/main/java/com/ustyle/controller/ItemAdminController.java new file mode 100644 index 0000000..f95628e --- /dev/null +++ b/src/main/java/com/ustyle/controller/ItemAdminController.java @@ -0,0 +1,256 @@ +package com.ustyle.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; +import javax.validation.Valid; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.ustyle.domain.Item; +import com.ustyle.domain.Product; +import com.ustyle.service.ItemService; +import com.ustyle.service.ProductService; +import com.ustyle.utils.PageMaker; + +@Controller +@RequestMapping("/admin/item/*") +public class ItemAdminController { + + private static final Logger logger = LoggerFactory.getLogger(ItemAdminController.class); + + @Inject + private ProductService productService; + + @Inject + private ItemService itemService; + + /** + * 관리자 페이지에서 특정 상품에 해당하는 Item을 추가하기 위한 페이지를 불러옴 + * + * @param productid + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "addItem.do", method = RequestMethod.GET) + public ModelAndView addItemForm(@RequestParam(value = "productid", required = false) Integer productid) + throws Exception { + + ModelAndView mav = new ModelAndView("item/addItem"); + + Product product = productService.read(productid); + + int originalprice = product.getOriginalprice(); + int saleprice = product.getSaleprice(); + + mav.addObject("productid", productid); + mav.addObject("originalprice", originalprice); + mav.addObject("saleprice", saleprice); + return mav; + } + + /** + * Item을 추가하는 페이지의 form을 이용하여 Item을 추가함 + * + * @param item + * @return productList + * @throws Exception + */ + + @RequestMapping(value = "addItem.do", method = RequestMethod.POST) + public String addItem(@ModelAttribute @Valid Item item) throws Exception { + + logger.info(item.toString()); + itemService.insert(item); + + return "redirect:/admin/product/productList.do"; + } + + /** + * 관리자 페이지에서 특정 옵션에 따른 검색을 통하여 그 조건에 맞는 Item을 호출함 + * + * @param pageMaker + * @param searchOption + * @param searchKeyword + * @return mav + * @throws Exception + */ + + @RequestMapping("itemList.do") + public ModelAndView itemList(PageMaker pageMaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + + if ( searchKeyword != null ) + searchKeyword = searchKeyword.trim(); + + HashMap map = new HashMap(); + int page = ( pageMaker.getPage() != null ) ? pageMaker.getPage() : 1; + pageMaker.setPage(page); + + if ( searchKeyword == null || searchKeyword.trim() == "") { + List list = new ArrayList(); + mav.addObject("itemList", list); + mav.setViewName("item/itemList"); + return mav; + } + + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + int totalCnt = itemService.selectListCnt(map); // DB연동_ 총 갯수 구해오기 + int countPerPage = 10; + int countPerPaging = 5; + + int first = ((pageMaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + List list = itemService.itemList(map); + pageMaker.setCount(totalCnt, countPerPage, countPerPaging); + logger.info(list.toString()); + + mav.addObject("itemList", list); + mav.addObject("pageMaker", pageMaker); + mav.setViewName("item/itemList"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + + return mav; + } + + /** + * Item 정보를 수정하기 위해 불러올 페이지를 호출함 + * @param itemid + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "modifyItem.do", method = RequestMethod.GET) + public ModelAndView modifyItemForm(@RequestParam("itemid") Integer itemid) throws Exception { + ModelAndView mav = new ModelAndView("item/modifyItem"); + + Item modifyItem = itemService.read(itemid); + + logger.info(modifyItem.toString()); + + mav.addObject("item", modifyItem); + return mav; + } + + /** + * Item 수정 페이지의 form을 이용하여 Item 수정 작업을 진행함 + * + * @param item + * @return productList + * @throws Exception + */ + + @RequestMapping(value = "modifyItem.do", method = RequestMethod.POST) + public String modifyItem(@ModelAttribute @Valid Item item) throws Exception { + logger.info(item.toString()); + itemService.update(item); + int productid = item.getProductid(); + return "redirect:/admin/item/itemList.do?o=productid&k=" + productid; + } + + @ResponseBody + @RequestMapping(value = "alreadyExistItem.do", method = RequestMethod.POST) + public ResponseEntity alreadyExistItem(@RequestBody Item item) throws Exception { + ResponseEntity entity = null; + + boolean isExistItem = true; + System.out.println(item.toString()); + try + { + isExistItem = itemService.existItem(item); + + logger.info("IS EXIST ITEM = " + isExistItem); + + if ( isExistItem == true ) { + entity = new ResponseEntity("FAIL", HttpStatus.OK); + } + else { + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @ResponseBody + @RequestMapping(value = "isDeleteItem.do", method = RequestMethod.POST) + public ResponseEntity isDeleteItem(@RequestBody Item item) throws Exception { + + ResponseEntity entity = null; + + int itemid = item.getItemid(); + boolean isExistSalesTable = true; + + try + { + isExistSalesTable = itemService.existSalesTable(itemid); + + if ( isExistSalesTable == true ) { + entity = new ResponseEntity("FAIL", HttpStatus.OK); + } + else { + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + /** + * 특정 Item을 삭제함 + * + * @param itemid + * @return itemList 페이지 + * @throws Exception + */ + + @ResponseBody + @RequestMapping(value = "deleteItem.do", method = RequestMethod.POST) + public ResponseEntity itemDelete(@RequestBody Item item) throws Exception { + int itemid = item.getItemid(); + ResponseEntity entity = null; + + try + { + logger.info("ITEM TO DELETE = " + item); + itemService.deleteItem(itemid); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } +} diff --git a/src/main/java/com/ustyle/controller/PinController.java b/src/main/java/com/ustyle/controller/PinController.java new file mode 100644 index 0000000..3645c01 --- /dev/null +++ b/src/main/java/com/ustyle/controller/PinController.java @@ -0,0 +1,380 @@ +package com.ustyle.controller; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.inject.Inject; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.ustyle.domain.Pin; +import com.ustyle.domain.PinBoard; +import com.ustyle.domain.PinBoardLike; +import com.ustyle.domain.PinBoardReply; +import com.ustyle.domain.User; +import com.ustyle.service.PinService; +import com.ustyle.utils.PageMaker; + +@Controller +@RequestMapping("/pin/*") +public class PinController { + + private static final Logger logger = LoggerFactory.getLogger(PinController.class); + + @Inject + private PinService pinService; + + @RequestMapping("pinBoardList.do") + public ModelAndView pinBoardList(@RequestParam(value = "pageCount", required = false) Integer pageCount, + HttpSession session) throws Exception { + + PageMaker pageMaker = new PageMaker(); + + int page = ( pageCount != null ) ? pageCount.intValue() : 1; + pageMaker.setPage(page); + + ModelAndView mav = new ModelAndView("pin/pinBoardList/PinBoard"); + + int totalCnt = pinService.selectListCnt(); // DB연동_ 총 갯수 구해오기 + + int countPerPaging = 10; + int pageCnt = 12; // 한 페이지당 12개씩 보이게 함. + + pageMaker.setCount(totalCnt, pageCnt, countPerPaging); + + HashMap map = new HashMap(); + + int first = ((pageMaker.getPage() - 1) * pageCnt) + 1; + int last = ( first + pageCnt - 1 > totalCnt ) ? totalCnt : first + pageCnt - 1; + + map.put("first", first); + map.put("last", last); + + List pinBoardList = pinService.selectPinBoardList(map); + logger.info(pinBoardList.toString()); + + mav.addObject("pinBoardList", pinBoardList); + mav.addObject("pageMaker", pageMaker); + mav.addObject("totalCnt", totalCnt); + mav.addObject("first", first); + mav.addObject("last", last); + + return mav; + } + + @RequestMapping("myPinBoardList.do") + public ModelAndView myPinBoardList(@RequestParam(value = "pageCount", required = false) Integer pageCount, + @RequestParam(value = "productid", required = false) Integer productid, HttpSession session) throws Exception { + + PageMaker pageMaker = new PageMaker(); + + int page = ( pageCount != null ) ? pageCount.intValue() : 1; + pageMaker.setPage(page); + + ModelAndView mav = new ModelAndView("pin/myPinBoardList/My PinBoard"); + User user = (User) session.getAttribute("session_user"); + + String username = user.getUsername(); + + int totalCnt = pinService.selectListCntForUsername(username); // DB연동_ 총 갯수 구해오기 + int countPerPaging = 10; + int pageCnt = 11; // 4 X 3 행렬에서 맨 위쪽에 있는 추가 버튼을 하나 제외하여 한 페이지당 11개씩 보이게 함. + + pageMaker.setCount(totalCnt, pageCnt, countPerPaging); + + HashMap map = new HashMap(); + + map.put("username", username); + + int first = ((pageMaker.getPage() - 1) * pageCnt) + 1; + int last = ( first + pageCnt - 1 > totalCnt ) ? totalCnt : first + pageCnt - 1; + + map.put("first", first); + map.put("last", last); + + List pinBoardList = pinService.selectPinBoardList(map); + logger.info(pinBoardList.toString()); + + mav.addObject("pinBoardList", pinBoardList); + mav.addObject("pageMaker", pageMaker); + mav.addObject("totalCnt", totalCnt); + mav.addObject("first", first); + mav.addObject("last", last); + mav.addObject("productid", productid); + return mav; + } + + @RequestMapping(value = "createPinBoard.do", method = RequestMethod.GET) + public String createPinBoardForm() throws Exception { + return "pin/createPinBoardForm/New Create Form"; + } + + @RequestMapping(value = "createPinBoard.do", method = RequestMethod.POST) + public String createPinBoard(HttpSession session, PinBoard pinBoard) throws Exception { + User user = (User) session.getAttribute("session_user"); + pinBoard.setUsername(user.getUsername()); + logger.info(pinBoard.toString()); + pinService.createPinBoard(pinBoard); + return "redirect:/pin/myPinBoardList.do"; + } + + @RequestMapping(value = "modifyPinBoard.do", method = RequestMethod.GET) + public ModelAndView modifyPinBoardForm(HttpSession session, @RequestParam int pinboardno) throws Exception { + + PinBoard pinBoard = pinService.getPinBoardByNo(pinboardno); + + ModelAndView mav = new ModelAndView(); + + User user = (User) session.getAttribute("session_user"); + String username = user.getUsername(); + String pinBoardUsername = pinBoard.getUsername(); + + if ( !(pinBoardUsername.equals(username)) ) { + mav.setViewName("pin/updatePinBoardError/Update PinBoard Error"); + return mav; + } + + List> pinBoardProductList = pinService.selectPinBoardProductList(pinBoard.getPinboardno()); + + mav.setViewName("pin/updatePinBoardForm/Update PinBoard"); + mav.addObject("pinBoard", pinBoard); + mav.addObject("pinBoardProductList", pinBoardProductList); + + return mav; + } + + @RequestMapping(value = "modifyPinBoard.do", method = RequestMethod.POST) + public String modifyPinBoard(PinBoard pinBoard) throws Exception { + + logger.info(pinBoard.toString()); + pinService.modifyPinBoard(pinBoard); + return "redirect:/pin/myPinBoardList.do"; + } + + @ResponseBody + @RequestMapping(value = "updatePinBoardPictureurl.do", method = RequestMethod.POST) + public ResponseEntity updatePinBoardPictureurl(@RequestBody PinBoard pinBoard) throws Exception { + + ResponseEntity entity = null; + + try + { + logger.info("PINBOARD TO CHANGEMAINIMAGE = " + pinBoard.toString()); + pinService.updatePictureurl(pinBoard); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @ResponseBody + @RequestMapping(value = "deletePinBoard.do", method = RequestMethod.POST) + public ResponseEntity deletePinBoard(@RequestBody PinBoard pinBoard) throws Exception { + + ResponseEntity entity = null; + + int pinboardno = pinBoard.getPinboardno(); + + try + { + logger.info("PINBOARDNUM TO DELETE = " + pinboardno); + + pinService.deletePinBoard(pinboardno); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @ResponseBody + @RequestMapping(value = "addLike.do", method = RequestMethod.POST) + public int addLike(@RequestBody PinBoardLike pinBoardLike) throws Exception { + + logger.info("PINBOARDLIKE TO ADD = " + pinBoardLike.toString()); + + int pinboardno = pinBoardLike.getPinboardno(); + + pinService.plusLike(pinboardno); + pinService.addLikeList(pinBoardLike); + + int selectLikeCnt = pinService.selectLikeCnt(pinboardno); + + return selectLikeCnt; + } + + @ResponseBody + @RequestMapping(value = "removeLike.do", method = RequestMethod.POST) + public int removeLike(@RequestBody PinBoardLike pinBoardLike) throws Exception { + + logger.info("PINBOARDLIKE TO REMOVE = " + pinBoardLike.toString()); + + int pinboardno = pinBoardLike.getPinboardno(); + + pinService.minusLike(pinboardno); + pinService.removeLikeList(pinBoardLike); + + int selectLikeCnt = pinService.selectLikeCnt(pinboardno); + + return selectLikeCnt; + } + +// ======================================================================= + + @RequestMapping(value = "viewPinBoard.do", method = RequestMethod.GET) + public ModelAndView viewPinBoard(@RequestParam(value = "productid", required = false) Integer productid, + int pinboardno, HttpSession session) throws Exception { + + ModelAndView mav = new ModelAndView("pinList"); + List pinList = pinService.getPins(pinboardno); + PinBoard pinBoard = pinService.getPinBoardByNo(pinboardno); + List> pinBoardProductList = pinService.selectPinBoardProductList(pinboardno); + logger.info("=============" + pinList.toString()); + logger.info("=============" + pinBoard.toString()); + + for ( HashMap map : pinBoardProductList ) + { + Iterator iterator = map.keySet().iterator(); + while (iterator.hasNext()) { + String key = String.valueOf(iterator.next()); + logger.info("key = " + key); + logger.info(" value = " + map.get(key)); + } + } + + User user = (User) session.getAttribute("session_user"); + + if ( user != null ) { + String username = user.getUsername(); + + HashMap map = new HashMap(); + map.put("pinboardno", pinboardno); + map.put("username", username); + + boolean isCheckLike = pinService.checkLike(map); // 특정 PinBoard에 대한 좋아요를 체크했는지 확인하는 변수 + + mav.addObject("isCheckLike", isCheckLike); + mav.addObject("username", username); + } + + mav.addObject(pinList); + mav.addObject("pinBoardProductList", pinBoardProductList); + mav.addObject(pinBoard); + + if ( productid != null ) + mav.addObject("productid", productid); + + return mav; + } + + @ResponseBody + @RequestMapping(value = "insertPin.do", method = RequestMethod.POST) + public ResponseEntity insertPin(@RequestBody Pin pin) { + + ResponseEntity entity = null; + + try + { + logger.info("PIN TO INSERT = " + pin.toString()); + + boolean isExistPin = pinService.existPin(pin); // 선택한 상품이 Pin으로 이미 추가되어있는지 체크함. + + if ( isExistPin == true ) { + entity = new ResponseEntity("EXIST OF PIN", HttpStatus.OK); + } + else { + int pinboardno = pin.getPinboardno(); + + int totalPinCnt = pinService.selectPinCnt(pinboardno); + // 하나의 PinBoard에 Pin을 최대 4개까지만 넣을 수 있도록 함. + + if ( totalPinCnt >= 4 ) { + entity = new ResponseEntity("EXCEED OF PIN", HttpStatus.OK); + } + else { + // Pin이 없는 PinBoard에 Pin을 추가하는 경우, 추가하는 Pin의 대표 이미지를 PinBoard의 대표 이미지로 넣음. + if ( totalPinCnt == 0 ) { + PinBoard updatePinBoard = new PinBoard(); + + updatePinBoard.setPinboardno(pinboardno); + updatePinBoard.setMainpictureproductid(pin.getProductid()); + + pinService.updatePictureurl(updatePinBoard); + } + + pinService.insertPin(pin); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + } + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @ResponseBody + @RequestMapping(value = "deletePin.do", method = RequestMethod.POST) + public ResponseEntity deletePin(@RequestBody Pin pin) throws Exception { + + ResponseEntity entity = null; + + try + { + logger.info("PIN TO DELETE = " + pin.toString()); + + pinService.deletePin(pin); + + int pinboardno = pin.getPinboardno(); + + int mainPictureProductid = pinService.getPinBoardByNo(pinboardno).getMainpictureproductid(); + int pinBoardProductid = pin.getProductid(); + + int totalPinCnt = pinService.selectPinCnt(pinboardno); + + /* PinBoard에 있는 Pin이 하나도 없거나 삭제하려는 Pin이 PinBoard의 메인 이미지로 설정된 경우, + PinBoard의 이미지를 다시 기본 이미지로 바꿈. */ + if ( totalPinCnt == 0 || mainPictureProductid == pinBoardProductid ) { + PinBoard updatePinBoard = new PinBoard(); + + updatePinBoard.setPinboardno(pinboardno); + updatePinBoard.setMainpictureproductid(0); + + pinService.updatePictureurl(updatePinBoard); + } + + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } +} diff --git a/src/main/java/com/ustyle/controller/ProductAdminController.java b/src/main/java/com/ustyle/controller/ProductAdminController.java new file mode 100644 index 0000000..acf451f --- /dev/null +++ b/src/main/java/com/ustyle/controller/ProductAdminController.java @@ -0,0 +1,256 @@ +package com.ustyle.controller; + +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.Resource; +import javax.inject.Inject; +import javax.validation.Valid; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.ustyle.domain.Product; +import com.ustyle.service.ProductService; +import com.ustyle.utils.PageMaker; + +@Controller +@RequestMapping("/admin/product/*") +public class ProductAdminController { + + private static final Logger logger = LoggerFactory.getLogger(ProductAdminController.class); + + @Inject + private ProductService service; + + @Resource(name="uploadPath") + private String uploadPath; + + @RequestMapping(value = "addProduct.do", method = RequestMethod.GET) + public String addProductForm() { + return "product/addProduct"; + } + + @RequestMapping(value = "addProduct.do", method = RequestMethod.POST) + public ModelAndView addProduct(@ModelAttribute @Valid Product product, BindingResult bindingResult) + throws Exception { + + String[] files = product.getFiles(); + + if ( files != null ) // 업로드할 상품의 이미지가 존재하는 경우 + { + product.setMainpictureurl(files[0]); // 대표 이미지 추가 + + String filesStr = Arrays.toString(files); + product.setPictureurl(filesStr); + } + + logger.info(product.toString()); + + ModelAndView mav = new ModelAndView(""); + + if (bindingResult.hasErrors()) { + mav.getModel().putAll(bindingResult.getModel()); + mav.setViewName("product/addProduct"); + return mav; + } + + service.insert(product); + mav.setViewName("redirect:/admin/product/productList.do"); + return mav; + } + + @RequestMapping(value = "readProduct.do", method = RequestMethod.GET) + public String readProduct(@RequestParam("productid") Integer productid, @RequestParam("page") Integer page, + Model model) throws Exception + { + Product readProduct = service.read(productid); + + logger.info(readProduct.toString()); + + model.addAttribute("product", readProduct); + model.addAttribute("page", page); // 목록으로 돌아갈 때, 페이지 번호를 유지시킴 + + return "product/readProduct"; + } + + @RequestMapping("readProductImage/{productid}") + @ResponseBody + public List readProductImage(@PathVariable("productid") Integer productid) throws Exception + { + String readPictureUrl = service.selectPictureurl(productid).replaceAll("\\[|\\]", ""); + String[] imageFiles = readPictureUrl.split(", "); + List readPictureList = new ArrayList(Arrays.asList(imageFiles)); + + for ( String pictureUrl : readPictureList ) + logger.info(pictureUrl.toString()); + + return readPictureList; + } + + @RequestMapping(value = "modifyProduct.do", method = RequestMethod.GET) + public String modifyProductForm(@RequestParam("productid") Integer productid, + @RequestParam("page") Integer page, Model model) throws Exception { + + Product modifyProduct = service.read(productid); + + logger.info(modifyProduct.toString()); + + model.addAttribute("product", modifyProduct); + model.addAttribute("page", page); // 목록으로 돌아갈 때, 페이지 번호를 유지시킴 + + return "product/modifyProduct"; + } + + @RequestMapping(value = "modifyProduct.do", method = RequestMethod.POST) + public ModelAndView modifyProduct(@ModelAttribute @Valid Product product, int page, + String searchOption, String searchKeyword) throws Exception { + + String[] files = product.getFiles(); + + if ( files != null ) // 업로드할 상품의 이미지가 존재하는 경우 + { + product.setMainpictureurl(files[0]); // 대표 이미지 수정 + + String filesStr = Arrays.toString(files); + product.setPictureurl(filesStr); + } + + logger.info(product.toString()); + + ModelAndView mav = new ModelAndView(); + + service.update(product); + + int productid = product.getProductid(); + + if ( searchKeyword != null ) { + searchKeyword = URLEncoder.encode(searchKeyword, "UTF-8"); // 한글이 깨져나오지 않게 하기 위한 처리 + mav.setViewName("redirect:/admin/product/readProduct.do?productid=" + productid +"&page=" + page + "&o=" + searchOption + "&k=" + searchKeyword); + } + else + mav.setViewName("redirect:/admin/product/readProduct.do?productid=" + productid + "&page=" + page); + + mav.addObject(product); + return mav; + } + + @RequestMapping("productList.do") + public ModelAndView productList(PageMaker pagemaker, @RequestParam(value = "o", required = false) String searchOption, + @RequestParam(value = "k", required = false) String searchKeyword) throws Exception { + ModelAndView mav = new ModelAndView(); + + if ( searchKeyword != null ) + searchKeyword = searchKeyword.trim(); + + HashMap map = new HashMap(); + + int page = pagemaker.getPage() != null ? pagemaker.getPage() : 1; + pagemaker.setPage(page); + map.put("searchOption", searchOption); + map.put("searchKeyword", searchKeyword); + + int totalCnt = service.selectListCnt(map); // DB연동_ 총 갯수 구해오기 + int countPerPage = 10; + int countPerPaging = 5; + + int first = ((pagemaker.getPage() - 1) * countPerPage) + 1; + int last = first + countPerPage - 1; + map.put("first", first); + map.put("last", last); + + List list = service.productList(map); + pagemaker.setCount(totalCnt, countPerPage, countPerPaging); + logger.info(list.toString()); + + String temp = null; + + for (int i = 0; i < list.size(); i++) { + temp = list.get(i).getPictureurl(); + + if (temp.length() < 50) + temp = "/ustylenone.jpg"; + else + temp = temp.substring(1, 55); + + list.get(i).setPictureurl(temp); + } + + mav.addObject("productList", list); + mav.addObject("pageMaker", pagemaker); + mav.setViewName("product/productList"); + mav.addObject("searchOption", searchOption); + mav.addObject("searchKeyword", searchKeyword); + mav.addObject("uploadPath", uploadPath); + return mav; + } + + @ResponseBody + @RequestMapping(value = "isDeleteProduct.do", method = RequestMethod.POST) + public ResponseEntity isDeleteProduct(@RequestBody Product product) throws Exception { + + ResponseEntity entity = null; + + int productid = product.getProductid(); + boolean isExistProduct = true; + + try + { + isExistProduct = service.existSalesAndPinTable(productid); + + if ( isExistProduct == true ) { + entity = new ResponseEntity("FAIL", HttpStatus.OK); + } + else { + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @ResponseBody + @RequestMapping(value = "deleteProduct.do", method = RequestMethod.POST) + public ResponseEntity productDelete(@RequestBody Product product) throws Exception { + + ResponseEntity entity = null; + + try + { + logger.info("PRODUCT TO DELETE = " + product); + + int productid = product.getProductid(); + service.delete(productid); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + // => product가 지워질 때, no action 제약조건으로 DB가 설계되었으므로, Service 단에서 product에 해당하는 item을 지우는 방향으로 진행 + } +} diff --git a/src/main/java/com/ustyle/controller/ProductController.java b/src/main/java/com/ustyle/controller/ProductController.java new file mode 100644 index 0000000..02ce913 --- /dev/null +++ b/src/main/java/com/ustyle/controller/ProductController.java @@ -0,0 +1,229 @@ +package com.ustyle.controller; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import com.ustyle.domain.Item; +import com.ustyle.domain.Product; +import com.ustyle.service.ItemService; +import com.ustyle.service.ProductService; +import com.ustyle.utils.PageMaker; + +@Controller +@RequestMapping("/product/*") +public class ProductController { + + private static final Logger logger = LoggerFactory.getLogger(ProductController.class); + + @Inject + private ProductService productService; + + @Inject + private ItemService itemService; + + /** + * 특정 카테고리에 대한 상품 리스트를 불러옴(옵션에 따른 정렬 가능) + * + * @param pageCount + * @param countPerPage + * @param subcategory + * @param brand + * @param sortby + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "productList.do", method = RequestMethod.GET) + public ModelAndView productList(@RequestParam(value = "pageCount", required = false) Integer pageCount, + @RequestParam(value = "countPerPage", required = false) Integer countPerPage, + @RequestParam(value = "subcategory", required = false) String subcategory, + @RequestParam(value = "brand", required = false) String brand, + @RequestParam(value = "sortby", defaultValue = "productid") String sortby) throws Exception { + + PageMaker pageMaker = new PageMaker(); + + int page = ( pageCount != null ) ? pageCount.intValue() : 1; + pageMaker.setPage(page); + + ModelAndView mav = new ModelAndView("product/productList/" + subcategory); + + HashMap map = new HashMap(); + map.put("subcategory", subcategory); + map.put("brand", brand); + + int totalCnt = productService.selectListCntForSubcategory(map); // DB연동_ 총 갯수 구해오기 + + int countPerPaging = 10; + + int pageCnt = ( countPerPage != null ) ? countPerPage.intValue() : 12; + + pageMaker.setCount(totalCnt, pageCnt, countPerPaging); + + logger.info("SORTBY = " + sortby); + + int first = ((pageMaker.getPage() - 1) * pageCnt) + 1; + int last = ( first + pageCnt - 1 > totalCnt ) ? totalCnt : first + pageCnt - 1; + + map.put("first", first); + map.put("last", last); + map.put("sortby", sortby); + + List productList = productService.productListForSubcategory(map); + List> brandList = productService.brandListForSubcategory(subcategory); + List> subcategoryList = productService.subcategoryListForSubcategory(subcategory); + List> priceList = productService.priceRangeForSubcategory(subcategory); + + logger.info(productList.toString()); + mav.addObject("productList", productList); + mav.addObject("brandList", brandList); + mav.addObject("subcategoryList", subcategoryList); + mav.addObject("priceList", priceList); + + mav.addObject("subcategory", subcategory); + mav.addObject("brand", brand); + mav.addObject("sortby", sortby); + mav.addObject("totalCnt", totalCnt); + mav.addObject("first", first); + mav.addObject("last", last); + mav.addObject("pageMaker", pageMaker); + + return mav; + } + + @RequestMapping(value = "searchProductList.do", method = RequestMethod.GET) + public ModelAndView searchProductList(@RequestParam(value = "pageCount", required = false) Integer pageCount, + @RequestParam(value = "countPerPage", required = false) Integer countPerPage, + @RequestParam(value = "productname", required = false) String productname, + @RequestParam(value = "sortby", defaultValue = "productid") String sortby) throws Exception { + + PageMaker pageMaker = new PageMaker(); + + int page = ( pageCount != null ) ? pageCount.intValue() : 1; + pageMaker.setPage(page); + + ModelAndView mav = new ModelAndView("product/searchProductList/검색 결과"); + + HashMap map = new HashMap(); + map.put("productname", productname); + + int totalCnt = productService.selectListCntForProductname(map); // DB연동_ 총 갯수 구해오기 + + int countPerPaging = 10; + + int pageCnt = ( countPerPage != null ) ? countPerPage.intValue() : 12; + + pageMaker.setCount(totalCnt, pageCnt, countPerPaging); + + logger.info("PRODUCTNAME TO SEARCH = " + productname); + logger.info("SORTBY = " + sortby); + + int first = ((pageMaker.getPage() - 1) * pageCnt) + 1; + int last = ( first + pageCnt - 1 > totalCnt ) ? totalCnt : first + pageCnt - 1; + + map.put("first", first); + map.put("last", last); + map.put("sortby", sortby); + + List productList = productService.productListForProductname(map); + System.out.println(totalCnt); + logger.info(productList.toString()); + mav.addObject("productList", productList); + mav.addObject("sortby", sortby); + mav.addObject("totalCnt", totalCnt); + mav.addObject("first", first); + mav.addObject("last", last); + mav.addObject("pageMaker", pageMaker); + + return mav; + } + + /** + * 상품 상세정보를 상세페이지에 불러옴 + * + * @param productid + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "productDetail.do", method = RequestMethod.GET) + public ModelAndView productDetail(@RequestParam(value = "productid", required = false) + Integer productid) throws Exception { + + Product product = productService.read(productid); + + ModelAndView mav = new ModelAndView("product/productDetail/" + product.getProductname()); + + String mainPictureurl = product.getMainpictureurl(); + product.setMainpictureurl(mainPictureurl.replace("/s_", "/")); + + String readPictureurl = product.getPictureurl().replaceAll("\\[|\\]", ""); + String[] imageFiles = readPictureurl.split(", "); + List pictureList = new ArrayList(Arrays.asList(imageFiles)); + + logger.info(product.toString()); + + List itemColorList = itemService.selectColorList(productid); // 상품의 색상을 리스트로 가져옴 + + int totalItemNum = itemService.totalItem(productid); // 하나의 상품에 속하는 아이템의 총 개수 + + mav.addObject("product", product); + mav.addObject("totalItemNum", totalItemNum); + mav.addObject("pictureList", pictureList); + mav.addObject("itemColorList", itemColorList); + + return mav; + } + + /** + * 선택된 색상에 해당하는 Item 객체 리스트를 가져옴 + * + * @param selectedColorItem + * @return selectedColorItemList + * @throws Exception + */ + + @ResponseBody + @RequestMapping(value = "selectedColor.do", method = RequestMethod.POST) + public List selectedColorAjax(@RequestBody Item selectedColorItem) throws Exception { + + List selectedColorItemList = itemService.selectedColorItemList(selectedColorItem); + + for ( Item eachItem : selectedColorItemList ) + logger.info(eachItem.toString()); + + return selectedColorItemList; + } + + /** + * 선택된 색상, 사이즈에 해당하는 Item 객체 한 개를 가져옴 + * + * @param selectedSizeItem + * @return selectedColorSizeItem + * @throws Exception + */ + + @ResponseBody + @RequestMapping(value = "selectedSize.do", method = RequestMethod.POST) + public Item selectedSizeAjax(@RequestBody Item selectedSizeItem) throws Exception { + + Item selectedColorSizeItem = itemService.selectedColorSizeItem(selectedSizeItem); + + logger.info(selectedColorSizeItem.toString()); + + return selectedColorSizeItem; + } +} diff --git a/src/main/java/com/ustyle/controller/ReviewController.java b/src/main/java/com/ustyle/controller/ReviewController.java new file mode 100644 index 0000000..be573ff --- /dev/null +++ b/src/main/java/com/ustyle/controller/ReviewController.java @@ -0,0 +1,121 @@ +package com.ustyle.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.ustyle.domain.Review; +import com.ustyle.service.ReviewService; +import com.ustyle.utils.PageMaker; + +@RestController +@RequestMapping("/reviews") +public class ReviewController +{ + private static final Logger logger = LoggerFactory.getLogger(ReviewController.class); + + @Inject + private ReviewService service; + + /** + * 상품 리뷰를 추가할 때 호출되는 메소드 + * @param review + * @return entity + */ + + @RequestMapping(value = "", method = RequestMethod.POST) + public ResponseEntity register(@RequestBody Review review) + { + ResponseEntity entity = null; + + try + { + String username = review.getUsername(); + int productid = review.getProductid(); + + HashMap reviewMap = new HashMap(); + reviewMap.put("username", username); + reviewMap.put("productid", productid); + + boolean isExistReview = service.existReview(reviewMap); + + if ( isExistReview == true ) { + entity = new ResponseEntity("FAIL", HttpStatus.OK); + } + else { + service.writeReview(review); + entity = new ResponseEntity("SUCCESS", HttpStatus.OK); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST); + } + + return entity; + } + + /** + * 한 페이지당 상품 리뷰를 다섯개씩 보여주는 메소드 + * @param productid + * @param page + * @return entity + */ + + @RequestMapping(value = "/{productid}/{page}", method = RequestMethod.GET) + public ResponseEntity> listPage( + @PathVariable("productid") Integer productid, @PathVariable("page") Integer page) + { + ResponseEntity> entity = null; + + try + { + PageMaker pagemaker = new PageMaker(); + + int pagecnt = 5; // 상세페이지를 로드할 때, 가장 최근에 작성한 다섯개의 리뷰만 보여지도록 함. + int countPerPaging = 10; + int start = (page - 1) * pagecnt; + + pagemaker.setPage(page); + + int totalReviewCnt = service.selectReviewCnt(productid); // DB연동_ 총 갯수 구해오기 + logger.info("totalReviewCnt = " + totalReviewCnt); + pagemaker.setCount(totalReviewCnt, pagecnt, countPerPaging); + + HashMap reviewMap = new HashMap(); + + reviewMap.put("productid", productid); + reviewMap.put("start", start); + reviewMap.put("pagecnt", pagecnt); + + List reviewList = service.selectReviewList(reviewMap); + + reviewMap.put("reviewList", reviewList); + reviewMap.put("totalReviewCnt", totalReviewCnt); + reviewMap.put("pageMaker", pagemaker); + + entity = new ResponseEntity>(reviewMap, HttpStatus.OK); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity>(HttpStatus.BAD_REQUEST); + } + + return entity; + } + +} diff --git a/src/main/java/com/ustyle/controller/UploadController.java b/src/main/java/com/ustyle/controller/UploadController.java new file mode 100644 index 0000000..dd8a3da --- /dev/null +++ b/src/main/java/com/ustyle/controller/UploadController.java @@ -0,0 +1,213 @@ +package com.ustyle.controller; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.UUID; + +import javax.annotation.Resource; +import javax.inject.Inject; + +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; + +import com.ustyle.service.ProductService; +import com.ustyle.utils.MediaUtils; +import com.ustyle.utils.UploadFileUtils; + +@Controller +public class UploadController +{ + private static final Logger logger = LoggerFactory.getLogger(UploadController.class); + + @Resource(name = "uploadPath") + private String uploadPath; + + @Inject + private ProductService productService; + + @RequestMapping(value = "/uploadForm", method = RequestMethod.GET) + public void uploadForm() + { + + } + + @RequestMapping(value = "/uploadForm", method = RequestMethod.POST) + public String uploadForm(MultipartFile file, Model model) throws Exception + { + logger.info("originalName: " + file.getOriginalFilename()); + logger.info("size: " + file.getSize()); + logger.info("contentType: " + file.getContentType()); + + String savedName = uploadFile(file.getOriginalFilename(), file.getBytes()); + + model.addAttribute("savedName", savedName); + + return "uploadResult"; + } + + @RequestMapping(value = "/uploadAjax", method = RequestMethod.GET) + public void uploadAjax() + { + + } + + private String uploadFile(String originalName, byte[] fileData) throws Exception + { + UUID uid = UUID.randomUUID(); + + String savedName = uid.toString(); + + File target = new File(uploadPath, savedName); + + FileCopyUtils.copy(fileData, target); + + return savedName; + } + + @ResponseBody + @RequestMapping(value = "/uploadAjax", method = RequestMethod.POST, produces = "text/plain;charset=UTF-8") + public ResponseEntity uploadAjax(MultipartFile file) throws Exception + { + String originalFilename = file.getOriginalFilename(); + + logger.info("originalName: " + originalFilename); + + String formatName = originalFilename.substring(originalFilename.lastIndexOf(".") + 1); + logger.info(formatName.toString()); + + if ( MediaUtils.getMediaType(formatName) != null ) // 파일의 이미지 업로드만 가능하게 함 + return new ResponseEntity( + UploadFileUtils.uploadFile(uploadPath, originalFilename, + file.getBytes()), HttpStatus.CREATED); + else + return new ResponseEntity("", HttpStatus.CREATED); + } + + @ResponseBody + @RequestMapping("/displayMainPictureurl") + public ResponseEntity displayMainPictureurl(int productid) throws Exception + { + ResponseEntity entity = null; + + try + { + String mainPictureurl = productService.selectMainpictureurl(productid); + entity = displayFile(mainPictureurl.replace("/s_", "/")); + + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(HttpStatus.BAD_REQUEST); + } + + return entity; + } + + @ResponseBody + @RequestMapping("/displayFile") + public ResponseEntity displayFile(String fileName) throws Exception + { + InputStream in = null; + ResponseEntity entity = null; + + logger.info("FILE NAME: " + fileName); + + try + { + String formatName = fileName.substring(fileName.lastIndexOf(".") + 1); + + MediaType mType = MediaUtils.getMediaType(formatName); + + HttpHeaders headers = new HttpHeaders(); + + in = new FileInputStream(uploadPath + fileName); + + if ( mType != null ) + headers.setContentType(mType); + else + { + fileName = fileName.substring(fileName.indexOf("_") + 1); + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); + headers.add("Content-Disposition", "attatchment; filename=\"" + + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\""); + } + + entity = new ResponseEntity(IOUtils.toByteArray(in), headers, HttpStatus.CREATED); + } + catch ( Exception e ) + { + e.printStackTrace(); + entity = new ResponseEntity(HttpStatus.BAD_REQUEST); + } + finally + { + in.close(); + } + return entity; + } + + @ResponseBody + @RequestMapping(value="/deleteFile", method=RequestMethod.POST) + public ResponseEntity deleteFile(String fileName) + { + logger.info("delete file: " + fileName); + + String formatName = fileName.substring(fileName.lastIndexOf(".") + 1); + + MediaType mType = MediaUtils.getMediaType(formatName); + + if ( mType != null ) + { + String front = fileName.substring(0, 12); + String end = fileName.substring(14); + new File(uploadPath + (front + end).replace('/', File.separatorChar)).delete(); + } + + new File(uploadPath + fileName.replace('/', File.separatorChar)).delete(); + + return new ResponseEntity("deleted", HttpStatus.OK); + } + + @ResponseBody + @RequestMapping(value="/deleteAllFiles", method=RequestMethod.POST) + public ResponseEntity deleteFile(@RequestParam("files[]") String[] files) + { + logger.info("delete all files: " + files); + + if ( files == null || files.length == 0 ) + return new ResponseEntity("deleted", HttpStatus.OK); + + for ( String fileName : files ) + { + String formatName = fileName.substring(fileName.lastIndexOf(".") + 1); + + MediaType mType = MediaUtils.getMediaType(formatName); + + if ( mType != null ) + { + String front = fileName.substring(0, 12); + String end = fileName.substring(14); + new File(uploadPath + (front + end).replace('/', File.separatorChar)).delete(); + } + + new File(uploadPath + fileName.replace('/', File.separatorChar)).delete(); + } + + return new ResponseEntity("deleted", HttpStatus.OK); + } +} diff --git a/src/main/java/com/ustyle/controller/UserController.java b/src/main/java/com/ustyle/controller/UserController.java index 8aa7c69..aa1359f 100644 --- a/src/main/java/com/ustyle/controller/UserController.java +++ b/src/main/java/com/ustyle/controller/UserController.java @@ -1,6 +1,10 @@ package com.ustyle.controller; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Random; +import java.util.UUID; import javax.inject.Inject; import javax.mail.internet.InternetAddress; @@ -24,8 +28,11 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; +import com.ustyle.domain.Product; import com.ustyle.domain.User; +import com.ustyle.service.ProductService; import com.ustyle.service.UserService; +import com.ustyle.utils.PageMaker; import com.ustyle.utils.UserEntryValidator; @Controller @@ -37,51 +44,107 @@ public class UserController { private JavaMailSenderImpl javaMailSenderImpl; @Inject - private UserService service; - + private UserService userService; + + @Inject + private ProductService productService; + @Inject private UserEntryValidator userEntryValidator; @Inject BCryptPasswordEncoder passwordEncoder; + + /** + * 홈페이지 호출 + * + * @return 홈 페이지 + */ + + @RequestMapping(value = "/index.do", method = RequestMethod.GET) + public ModelAndView index() throws Exception { + ModelAndView mav = new ModelAndView(); + + List newArrivalProductList = productService.recentProductList(); // 새로 추가된 상품을 가져옴(총 4개) + List bestProductList = productService.popularProductList(); // 인기 상품을 가져옴(총 4개) + + for ( Product newArrivalProduct : newArrivalProductList ) { + logger.info("NEW ARRIVAL PRODUCT - " + newArrivalProduct.toString()); + } + + for ( Product bestProduct : bestProductList ) { + logger.info("BEST PRODUCT - " + bestProduct.toString()); + } + + mav.addObject("newArrivalProductList", newArrivalProductList); + mav.addObject("bestProductList", bestProductList); + + mav.setViewName("user/index/uStyleHome"); + return mav; + } /** - * Simply selects the home view to render by returning its name. + * 로그인 페이지를 호출함 + * + * @param request + * @return 각각의 페이지(로그인이 이미 되어있는 경우, 메인 페이지로 리다이렉션됨) */ - @RequestMapping(value = "login.do", method = RequestMethod.GET) + @RequestMapping(value = "/login.do", method = RequestMethod.GET) public String loginForm() { return "user/login/LOGIN"; } - - @RequestMapping(value = "login.do", method = RequestMethod.POST) + + /** + * 로그인 페이지에서 로그인 버튼을 눌러서 회원의 로그인을 진햄함 + * + * @param request, user + * @return 로그인 이전 페이지, 만약 없거나 로그인 페이지일 경우 메인 페이지 + */ + + @RequestMapping(value = "/loginPost.do", method = RequestMethod.POST) public String login(HttpServletRequest request, User user) throws Exception { - try { - User resultUser = service.userLogin(user); - logger.info("{}", resultUser); - - String rawPassword = user.getPassword(); - String encodedPassword = resultUser.getPassword(); - - if (resultUser == null || !(passwordEncoder.matches(rawPassword, encodedPassword))) { - return "user/loginError/No Match PW"; - } - - HttpSession session = request.getSession(); - - session.setAttribute("USER", resultUser); - // session.setAttribute("session_realname", - // resultUser.getRealname()); - session.setAttribute("session_username", resultUser.getUsername()); - session.setAttribute("session_point", resultUser.getPoint()); - // session.setAttribute("TOKEN_SAVE_CHECK", "TRUE"); - - return "user/loginSuccess/LOGIN SUCCESS"; - } catch (NullPointerException e) { - return "user/loginError/LOGIN ERROR"; - } + User resultUser = userService.userLogin(user); + logger.info("{}", resultUser); + + if ( resultUser == null || !resultUser.getAuth().equals("y")) { + return "user/loginError/Login Error"; + } + + String rawPassword = user.getPassword(); + String encodedPassword = resultUser.getPassword(); + logger.info(resultUser.getAuth().toString()); + + if ( !(passwordEncoder.matches(rawPassword, encodedPassword)) ) { + return "user/loginError/No Match PW"; + } + + HttpSession session = request.getSession(); + + session.setAttribute("session_user", resultUser); + session.setAttribute("session_userpoint", resultUser.getPoint()); + + User loginUser = (User) session.getAttribute("session_user"); + logger.info(loginUser.toString()); + + String dest = (String)session.getAttribute("dest"); + logger.info("dest: " + dest); + + if ( dest == null || dest.equals("") || dest.endsWith("/login.do") ) { + return "redirect:/"; + } + else { + return "redirect:" + dest; + } } + + /** + * 회원의 로그아웃 수행 + * + * @param request + * @return 로그인 페이지 + */ @RequestMapping("/logout.do") public ModelAndView logout(HttpServletRequest request) { @@ -91,20 +154,37 @@ public ModelAndView logout(HttpServletRequest request) { if (session != null) { session.invalidate(); } + mav.addObject("user", new User()); - mav.setViewName("redirect:/login.do"); + mav.setViewName("redirect:/"); return mav; } + + /** + * 회원가입 페이지를 호출함 + * + * @return 회원가입 페이지 + */ - @RequestMapping(value = "register.do", method = RequestMethod.GET) + @RequestMapping(value = "/register.do", method = RequestMethod.GET) public String registerForm() { return "user/register/Register"; } + + /** + * 회원가입 진행 + * + * @param user + * @param bindingResult + * @param session + * @return mav + * @throws Exception + */ - @RequestMapping(value = "register.do", method = RequestMethod.POST) - public ModelAndView register(@ModelAttribute @Valid User user, BindingResult bindingResult, HttpSession session) - throws Exception { + @RequestMapping(value = "/register.do", method = RequestMethod.POST) + public ModelAndView register(@ModelAttribute @Valid User user, BindingResult bindingResult, + HttpServletRequest request, HttpSession session) throws Exception { logger.info(user.toString()); userEntryValidator.validate(user, bindingResult); @@ -112,65 +192,172 @@ public ModelAndView register(@ModelAttribute @Valid User user, BindingResult bin String encryptPassword = passwordEncoder.encode(user.getPassword()); user.setPassword(encryptPassword); - ModelAndView mav = new ModelAndView("joinSuccess"); + ModelAndView mav = new ModelAndView("user/joinSuccess/JoinSuccess"); if (bindingResult.hasErrors()) { mav.getModel().putAll(bindingResult.getModel()); mav.setViewName("user/register/Register"); return mav; } + + String homeUrl = request.getRequestURL().toString().replace(request.getRequestURI(), ""); - int ran = new Random().nextInt(90000) + 10000; // 10000 ~ 99999 - user.setPoint(ran); - String joinCode = String.valueOf(ran); - sendMail(user.getUsername(), user.getEmail(), joinCode); + String joinCode = getUuid(); + user.setAuth(joinCode); + sendMailForRegister(homeUrl, user.getUsername(), user.getEmail(), joinCode); - service.insert(user); - session.setAttribute("USER", user); + userService.insert(user); mav.addObject(user); return mav; } + + @RequestMapping(value = "/userInfo.do", method = RequestMethod.GET) + public ModelAndView userInfo(HttpSession session) throws Exception { + + ModelAndView mav = new ModelAndView("user/userInfo/회원 정보"); + User user = (User) session.getAttribute("session_user"); + String username = user.getUsername(); + + HashMap userMap = new HashMap(); + userMap = userService.selectUserInfo(username); + + mav.addObject("userMap", userMap); + + return mav; + } + + /** + * 회원정보 수정 페이지를 불러옴 + * + * @param session + * @return 회원정보 수정 페이지 + */ + + @RequestMapping(value = "/update.do", method = RequestMethod.GET) + public String updateForm(HttpSession session) { + return "user/update/Update"; + + } + + /** + * 회원정보 수정 작업 진행 + * + * @param updateUser + * @param bindingResult + * @param session + * @return mav + * @throws Exception + */ + + @RequestMapping(value = "/update.do", method = RequestMethod.POST) + public ModelAndView update(@ModelAttribute @Valid User updateUser, BindingResult bindingResult, HttpSession session) + throws Exception { + + logger.info(updateUser.toString()); + userEntryValidator.validate(updateUser, bindingResult); + + String encryptPassword = passwordEncoder.encode(updateUser.getPassword()); + updateUser.setPassword(encryptPassword); + + ModelAndView mav = new ModelAndView("user/updateSuccess/UpdateSuccess"); + + if (bindingResult.hasErrors()) { + mav.getModel().putAll(bindingResult.getModel()); + mav.setViewName("user/update/Update"); + return mav; + } + + userService.update(updateUser); + + if (session != null) { // 회원정보를 변경한 후, 다시 로그인하도록 유도한다. + session.invalidate(); + } + mav.addObject(updateUser); + + return mav; + } + + @RequestMapping(value = "/delete.do", method = RequestMethod.GET) + public String deleteForm() { + return "user/deleteForm/Delete"; + } + + @RequestMapping(value = "/delete.do", method = RequestMethod.POST) + public String delete(User user, HttpSession session) throws Exception { + logger.info(user.toString()); + User resultUser = userService.userLogin(user); + logger.info(resultUser.toString()); + String encodedPassword = resultUser.getPassword(); + String encryptPassword = user.getPassword(); + + String username = user.getUsername(); + + if ( !(passwordEncoder.matches(encryptPassword, encodedPassword)) ) { + return "user/deleteError/No Match PW"; + } + + userService.delete(username); - private void sendMail(String username, String email, String joinCode) throws Exception { + return "redirect:/logout.do"; + } + + /** + * 가입인증 메일을 보내는 작업 + * + * @param homeUrl + * @param username + * @param email + * @param joinCode + * @throws Exception + */ + + private void sendMailForRegister(String uri, String username, String email, String joinCode) throws Exception { MimeMessage mimeMessage = javaMailSenderImpl.createMimeMessage(); mimeMessage.setFrom(new InternetAddress("ustyle1111@gmail.com")); mimeMessage.addRecipient(RecipientType.TO, new InternetAddress(email)); - String subject = "uStyle - ȸ û Դϴ."; + String subject = "uStyle - 회원가입 인증요청메일 입니다."; mimeMessage.setSubject(subject); StringBuilder sb = new StringBuilder(); - // String uri = "http://localhost:8080/uStyle/"; - String uri = "http://localhost:8080/"; + sb.append(""); sb.append(""); sb.append("

Welcome uStyle

"); - sb.append(" uStyle ּż 帳ϴ.
"); - sb.append(" ģ Ʈ ̿Ͻ ֽϴ.
"); + sb.append("저희 uStyle에 가입해 주셔서 감사드립니다.
"); + sb.append("인증을 거친후 저희 사이트를 정상적으로 이용하실 수 있습니다.
"); sb.append("

"); - sb.append(""); - sb.append("ũ ŬϽø ˴ϴ."); - logger.info("content : {}", sb); + sb.append(""); + sb.append("링크를 클릭하시면 인증됩니다."); mimeMessage.setText(sb.toString(), "UTF-8", "html"); javaMailSenderImpl.send(mimeMessage); } + + /** + * 가입인증 메일에 있는 링크를 통한 인증 작업 진행 + * + * @param username + * @param auth + * @return mav + * @throws Exception + */ - @RequestMapping(value = "/auth/{username}/{point}") - public ModelAndView authOk(@PathVariable String username, @PathVariable String point) throws Exception { + @RequestMapping(value = "/auth/{username}/{auth}") + public ModelAndView authOk(@PathVariable String username, @PathVariable String auth) throws Exception { ModelAndView mav = new ModelAndView(); User user = new User(); - user.setPoint(Integer.parseInt(point)); + user.setAuth(auth); user.setUsername(username); - boolean isUserAuthOk = service.userAuthOk(user); + boolean isUserAuthOk = userService.userAuthOk(user); if (isUserAuthOk) { - service.userPointInitialize(username); + userService.userAuthInitialize(username); mav.setViewName("redirect:/authSuccess.do"); } else { mav.setViewName("redirect:/authError.do"); @@ -178,24 +365,181 @@ public ModelAndView authOk(@PathVariable String username, @PathVariable String p return mav; } + + /** + * 인증에 성공했을 때 호출됨. + * + * @return 인증 성공 페이지 + */ @RequestMapping("/authSuccess.do") public String authSuccess() { - return "user/authSuccess/ "; + return "user/authSuccess/인증 성공"; } + + /** + * 인증에 실패했을 때 호출됨. + * + * @return 인증 실패 페이지 + */ @RequestMapping("/authError.do") public String authError() { - return "user/authError/ "; + return "user/authError/인증 실패"; } + + /** + * 이미 가입된 회원이 있는지 확인하기 위해 호출되는 메소드 + * + * @param username + * @return + * @throws Exception + */ - @RequestMapping(value = "duplicationCheck.do", method = RequestMethod.POST) + @RequestMapping(value = "/duplicationCheck.do", method = RequestMethod.POST) @ResponseBody - public int userExist(@RequestBody String username) throws Exception { - - logger.info(username); - int isUserExist = service.userExist(username); + public int userExist(@RequestBody User user) throws Exception { + logger.info(user.getUsername()); + int isUserExist = userService.userExist(user); + + System.out.println(isUserExist); return isUserExist; } + + @RequestMapping(value = "/searchPassword.do", method = RequestMethod.GET) + public String searchPasswordForm() { + return "user/searchPassword/SEARCH PASSWORD"; + } + + @RequestMapping(value = "/changeTemporaryPassword.do", method = RequestMethod.POST) + public String changeTemporaryPassword(User user, HttpServletRequest request) throws Exception { + logger.info(user.toString()); + int isUserExist = userService.userExist(user); + + if ( isUserExist == 0 ) + return "user/changeTemporaryPasswordError/Error"; + + String homeUrl = request.getRequestURL().toString().replace(request.getRequestURI(), ""); + + String changePassword = randPassword(); + + String encryptPassword = passwordEncoder.encode(changePassword); + user.setPassword(encryptPassword); + + userService.updateTemporaryPassword(user); + + sendMailForChangePassword(homeUrl, user.getUsername(), user.getEmail(), changePassword); + + return "user/changeTemporaryPasswordSuccess/Success"; + } + + private String randPassword() { + Random rnd = new Random(); + + StringBuffer buf =new StringBuffer(); + + for ( int i = 0; i < 8; i++ ) { + if ( rnd.nextBoolean() ) { + buf.append((char)((int)(rnd.nextInt(26)) + 97)); + } + else { + buf.append((rnd.nextInt(10))); + } + } + + return buf.toString(); + } + + private void sendMailForChangePassword(String uri, String username, String email, String changePassword) throws Exception { + + MimeMessage mimeMessage = javaMailSenderImpl.createMimeMessage(); + + mimeMessage.setFrom(new InternetAddress("ustyle1111@gmail.com")); + mimeMessage.addRecipient(RecipientType.TO, new InternetAddress(email)); + + String subject = "uStyle - 임시 비밀번호 변경 메일입니다."; + mimeMessage.setSubject(subject); + + StringBuilder sb = new StringBuilder(); + + sb.append(""); + sb.append(""); + sb.append("

Welcome uStyle

"); + sb.append(username + "님의 비밀번호가 아래와 같이 변경되었으니, 이 비밀번호로 우선 로그인하신 후, 원하시는 비밀번호로 변경해주시기 바랍니다.
"); + sb.append("변경된 비밀번호 : " + changePassword + "
"); + sb.append("

"); + + mimeMessage.setText(sb.toString(), "UTF-8", "html"); + + javaMailSenderImpl.send(mimeMessage); + } + + /** + * 회원의 구매내역을 불러옴 + * + * @param session + * @param pageCount + * @return mav + * @throws Exception + */ + + @RequestMapping("/purchaseList.do") + public ModelAndView purchaseList(HttpSession session, Integer pageCount) throws Exception { + ModelAndView mav = new ModelAndView("user/purchaseList/구매내역"); + User loginUser = (User) session.getAttribute("session_user"); + String loginUsername = loginUser.getUsername(); + + int purchaseCount = userService.selectUserPurchaseCount(loginUsername); + + PageMaker pagemaker = new PageMaker(); + int page = ( pageCount != null ) ? pageCount.intValue() : 1; + int pageCnt = 10; + pagemaker.setPage(page); + pagemaker.setCount(purchaseCount, pageCnt, 10); // 구매한 상품들을 10개씩 보여줌 + + int start = ((pagemaker.getPage() - 1) * pageCnt); + + logger.info("PURCHASECOUNT = " + purchaseCount); + logger.info("START = " + start); + logger.info("PAGECNT = " + pageCnt); + + HashMap searchQueryMap = new HashMap(); + searchQueryMap.put("username", loginUsername); + searchQueryMap.put("start", start); + searchQueryMap.put("pagecnt", pageCnt); + + List> userPurchaseList = userService.selectUserPurchaseList(searchQueryMap); + + for ( HashMap map : userPurchaseList ) + { + Iterator iterator = map.keySet().iterator(); + while (iterator.hasNext()) { + String key = String.valueOf(iterator.next()); + logger.info("key = " + key); + logger.info(" value = " + map.get(key)); + } + } + + int first = start + 1; + int last = ( first + pageCnt - 1 > purchaseCount ) ? purchaseCount : first + pageCnt - 1; + + mav.addObject("userPurchaseList", userPurchaseList); + mav.addObject("purchaseCount", purchaseCount); + mav.addObject("first", first); + mav.addObject("last", last); + mav.addObject("pageMaker", pagemaker); + + return mav; + } + + /** + * 고유성 보장을 위해 '-'가 빠진 범용 고유 식별자(UUID, 소프트웨어 구축에 쓰이는 식별자 표준)를 가져옴. + * + * @return '-'가 빠진 범용 고유 식별자 + */ + private String getUuid() { + return UUID.randomUUID().toString().replaceAll("-", ""); + } + } diff --git a/src/main/java/com/ustyle/domain/Cart.java b/src/main/java/com/ustyle/domain/Cart.java new file mode 100644 index 0000000..d983f58 --- /dev/null +++ b/src/main/java/com/ustyle/domain/Cart.java @@ -0,0 +1,49 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class Cart { + + private int cartno; + private int count; + private Date updateDate; + private String username; + private int itemid; + + public int getCartno() { + return cartno; + } + public void setCartno(int cartno) { + this.cartno = cartno; + } + public int getCount() { + return count; + } + public void setCount(int count) { + this.count = count; + } + public Date getUpdateDate() { + return updateDate; + } + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public int getItemid() { + return itemid; + } + public void setItemid(int itemid) { + this.itemid = itemid; + } + + @Override + public String toString() { + return "Cart [cartno=" + cartno + ", count=" + count + ", updateDate=" + updateDate + ", username=" + username + + ", itemid=" + itemid + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/Faq.java b/src/main/java/com/ustyle/domain/Faq.java new file mode 100644 index 0000000..49cf98b --- /dev/null +++ b/src/main/java/com/ustyle/domain/Faq.java @@ -0,0 +1,68 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class Faq { + + private int bno; + private String content; + private String category; + private Date regdate; + private int viewcnt; + private String comment; + + public int getBno() { + return bno; + } + + public void setBno(int bno) { + this.bno = bno; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public Date getRegdate() { + return regdate; + } + + public void setRegdate(Date regdate) { + this.regdate = regdate; + } + + public int getViewcnt() { + return viewcnt; + } + + public void setViewcnt(int viewcnt) { + this.viewcnt = viewcnt; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + @Override + public String toString() { + return "\nFaq [bno=" + bno + ", content=" + content + ", category=" + category + ", regdate=" + regdate + + ", viewcnt=" + viewcnt + ", comment=" + comment + "]"; + } + +} diff --git a/src/main/java/com/ustyle/domain/Grade.java b/src/main/java/com/ustyle/domain/Grade.java new file mode 100644 index 0000000..59da4c4 --- /dev/null +++ b/src/main/java/com/ustyle/domain/Grade.java @@ -0,0 +1,54 @@ +package com.ustyle.domain; + +public class Grade { + + private int idx; + private String grade; + private double point_ratio; + private int buy_term; + private int min; + private int max; + + public int getIdx() { + return idx; + } + public void setIdx(int idx) { + this.idx = idx; + } + public String getGrade() { + return grade; + } + public void setGrade(String grade) { + this.grade = grade; + } + public int getBuy_term() { + return buy_term; + } + public void setBuy_term(int buy_term) { + this.buy_term = buy_term; + } + public int getMin() { + return min; + } + public void setMin(int min) { + this.min = min; + } + public int getMax() { + return max; + } + public void setMax(int max) { + this.max = max; + } + public double getPoint_ratio() { + return point_ratio; + } + public void setPoint_ratio(double point_ratio) { + this.point_ratio = point_ratio; + } + + @Override + public String toString() { + return "\nGrade [idx=" + idx + ", grade=" + grade + ", point_ratio=" + point_ratio + ", buy_term=" + buy_term + + ", min=" + min + ", max=" + max + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/Item.java b/src/main/java/com/ustyle/domain/Item.java new file mode 100644 index 0000000..6a9f9c8 --- /dev/null +++ b/src/main/java/com/ustyle/domain/Item.java @@ -0,0 +1,84 @@ +package com.ustyle.domain; + +public class Item { + + private int itemid; + private String color; + private String size; + private int stock; + private int originalprice; + private int saleprice; + private int productid; + private String productname; + + public int getItemid() { + return itemid; + } + + public void setItemid(int itemid) { + this.itemid = itemid; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public int getStock() { + return stock; + } + + public void setStock(int stock) { + this.stock = stock; + } + + public int getOriginalprice() { + return originalprice; + } + + public void setOriginalprice(int originalprice) { + this.originalprice = originalprice; + } + + public int getSaleprice() { + return saleprice; + } + + public void setSaleprice(int saleprice) { + this.saleprice = saleprice; + } + + public int getProductid() { + return productid; + } + + public void setProductid(int productid) { + this.productid = productid; + } + + @Override + public String toString() { + return "\nItem [itemid=" + itemid + ", color=" + color + ", size=" + size + ", stock=" + stock + + ", originalprice=" + originalprice + ", saleprice=" + saleprice + ", productid=" + productid + + ", productname=" + productname + "]"; + } + + public String getProductname() { + return productname; + } + + public void setProductname(String productname) { + this.productname = productname; + } +} \ No newline at end of file diff --git a/src/main/java/com/ustyle/domain/Notice.java b/src/main/java/com/ustyle/domain/Notice.java new file mode 100644 index 0000000..cd8a60c --- /dev/null +++ b/src/main/java/com/ustyle/domain/Notice.java @@ -0,0 +1,58 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class Notice { + + private int bno; + private String title; + private String content; + private Date regdate; + private int viewcnt; + + public int getBno() { + return bno; + } + + public void setBno(int bno) { + this.bno = bno; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Date getRegdate() { + return regdate; + } + + public void setRegdate(Date regdate) { + this.regdate = regdate; + } + + public int getViewcnt() { + return viewcnt; + } + + public void setViewcnt(int viewcnt) { + this.viewcnt = viewcnt; + } + + @Override + public String toString() { + return "Notice [bno=" + bno + ", title=" + title + ", content=" + content + ", regdate=" + regdate + + ", viewcnt=" + viewcnt + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/Pin.java b/src/main/java/com/ustyle/domain/Pin.java new file mode 100644 index 0000000..a6d7809 --- /dev/null +++ b/src/main/java/com/ustyle/domain/Pin.java @@ -0,0 +1,48 @@ +package com.ustyle.domain; + +public class Pin { + + private int pinno; + private int pinboardno; + private int productid; + + private String productimage; + + public int getPinno() { + return pinno; + } + + public void setPinno(int pinno) { + this.pinno = pinno; + } + + public int getPinboardno() { + return pinboardno; + } + + public void setPinboardno(int pinboardno) { + this.pinboardno = pinboardno; + } + + public int getProductid() { + return productid; + } + + public void setProductid(int productid) { + this.productid = productid; + } + + public String getProductimage() { + return productimage; + } + + public void setProductimage(String productimage) { + this.productimage = productimage; + } + + @Override + public String toString() { + return "Pin [pinno=" + pinno + ", pinboardno=" + pinboardno + ", productid=" + productid + "]"; + } + +} diff --git a/src/main/java/com/ustyle/domain/PinBoard.java b/src/main/java/com/ustyle/domain/PinBoard.java new file mode 100644 index 0000000..985f0b4 --- /dev/null +++ b/src/main/java/com/ustyle/domain/PinBoard.java @@ -0,0 +1,77 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class PinBoard { + + private int pinboardno; + private String username; + private String pinboardname; + private Date create_time; + private String content; + private int likecnt; + private int mainpictureproductid; + + public int getPinboardno() { + return pinboardno; + } + + public void setPinboardno(int pinboardno) { + this.pinboardno = pinboardno; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPinboardname() { + return pinboardname; + } + + public void setPinboardname(String pinboardname) { + this.pinboardname = pinboardname; + } + + public Date getCreate_time() { + return create_time; + } + + public void setCreate_time(Date create_time) { + this.create_time = create_time; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public int getLikecnt() { + return likecnt; + } + + public void setLikecnt(int likecnt) { + this.likecnt = likecnt; + } + + public int getMainpictureproductid() { + return mainpictureproductid; + } + + public void setMainpictureproductid(int mainpictureproductid) { + this.mainpictureproductid = mainpictureproductid; + } + + @Override + public String toString() { + return "PinBoard [pinboardno=" + pinboardno + ", username=" + username + ", pinboardname=" + pinboardname + + ", create_time=" + create_time + ", content=" + content + ", likecnt=" + likecnt + + ", mainpictureproductid=" + mainpictureproductid + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/PinBoardLike.java b/src/main/java/com/ustyle/domain/PinBoardLike.java new file mode 100644 index 0000000..a5cbfdd --- /dev/null +++ b/src/main/java/com/ustyle/domain/PinBoardLike.java @@ -0,0 +1,31 @@ +package com.ustyle.domain; + +public class PinBoardLike { + int likeno; + int pinboardno; + String username; + + public int getLikeno() { + return likeno; + } + public void setLikeno(int likeno) { + this.likeno = likeno; + } + public int getPinboardno() { + return pinboardno; + } + public void setPinboardno(int pinboardno) { + this.pinboardno = pinboardno; + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + + @Override + public String toString() { + return "PinBoardLike [likeno=" + likeno + ", pinboardno=" + pinboardno + ", username=" + username + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/PinBoardReply.java b/src/main/java/com/ustyle/domain/PinBoardReply.java new file mode 100644 index 0000000..d1d7fe2 --- /dev/null +++ b/src/main/java/com/ustyle/domain/PinBoardReply.java @@ -0,0 +1,77 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class PinBoardReply { + + private int pinboardreply; + private int pinboardno; + private String comment; + private int ref; + private int restep; + private int relevel; + private Date regdate; + + public int getPinboardreply() { + return pinboardreply; + } + + public void setPinboardreply(int pinboardreply) { + this.pinboardreply = pinboardreply; + } + + public int getPinboardno() { + return pinboardno; + } + + public void setPinboardno(int pinboardno) { + this.pinboardno = pinboardno; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public int getRef() { + return ref; + } + + public void setRef(int ref) { + this.ref = ref; + } + + public int getRestep() { + return restep; + } + + public void setRestep(int restep) { + this.restep = restep; + } + + public int getRelevel() { + return relevel; + } + + public void setRelevel(int relevel) { + this.relevel = relevel; + } + + public Date getRegdate() { + return regdate; + } + + public void setRegdate(Date regdate) { + this.regdate = regdate; + } + + @Override + public String toString() { + return "\nPinBoardReply [pinboardreply=" + pinboardreply + ", pinboardno=" + pinboardno + ", comment=" + comment + + ", ref=" + ref + ", restep=" + restep + ", relevel=" + relevel + ", regdate=" + regdate + "]"; + } + +} diff --git a/src/main/java/com/ustyle/domain/PinReply.java b/src/main/java/com/ustyle/domain/PinReply.java new file mode 100644 index 0000000..9fee4a9 --- /dev/null +++ b/src/main/java/com/ustyle/domain/PinReply.java @@ -0,0 +1,59 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class PinReply { + + private int pinboardreplyno; + private int pinboardno; + private String comment; + private String statuscode; + private Date regdate; + + public int getPinboardreplyno() { + return pinboardreplyno; + } + + public void setPinboardreplyno(int pinboardreplyno) { + this.pinboardreplyno = pinboardreplyno; + } + + public int getPinboardno() { + return pinboardno; + } + + public void setPinboardno(int pinboardno) { + this.pinboardno = pinboardno; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public String getStatuscode() { + return statuscode; + } + + public void setStatuscode(String statuscode) { + this.statuscode = statuscode; + } + + public Date getRegdate() { + return regdate; + } + + public void setRegdate(Date regdate) { + this.regdate = regdate; + } + + @Override + public String toString() { + return "\nPinReply [pinboardreplyno=" + pinboardreplyno + ", pinboardno=" + pinboardno + ", comment=" + comment + + ", statuscode=" + statuscode + ", regdate=" + regdate + "]"; + } + +} diff --git a/src/main/java/com/ustyle/domain/Product.java b/src/main/java/com/ustyle/domain/Product.java new file mode 100644 index 0000000..06a1982 --- /dev/null +++ b/src/main/java/com/ustyle/domain/Product.java @@ -0,0 +1,104 @@ +package com.ustyle.domain; + +import java.util.Arrays; +import java.util.Date; + +public class Product { + + private int productid; + private String productname; + private String description; + private String brand; + private String[] files; + private String mainpictureurl; + private String pictureurl; + private int originalprice; + private int saleprice; + private String category; + + private String subcategory; + private Date create_time; + + public int getProductid() { + return productid; + } + public void setProductid(int productid) { + this.productid = productid; + } + public String getProductname() { + return productname; + } + public void setProductname(String productname) { + this.productname = productname; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getBrand() { + return brand; + } + public void setBrand(String brand) { + this.brand = brand; + } + public String[] getFiles() { + return files; + } + public void setFiles(String[] files) { + this.files = files; + } + public int getOriginalprice() { + return originalprice; + } + public void setOriginalprice(int originalprice) { + this.originalprice = originalprice; + } + public int getSaleprice() { + return saleprice; + } + public void setSaleprice(int saleprice) { + this.saleprice = saleprice; + } + public String getCategory() { + return category; + } + public void setCategory(String category) { + this.category = category; + } + public String getSubcategory() { + return subcategory; + } + public void setSubcategory(String subcategory) { + this.subcategory = subcategory; + } + public Date getCreate_time() { + return create_time; + } + public void setCreate_time(Date create_time) { + this.create_time = create_time; + } + + public String getMainpictureurl() { + return mainpictureurl; + } + public void setMainpictureurl(String mainpictureurl) { + this.mainpictureurl = mainpictureurl; + } + + public String getPictureurl() { + return pictureurl; + } + public void setPictureurl(String pictureurl) { + this.pictureurl = pictureurl; + } + + @Override + public String toString() { + return "Product [productid=" + productid + ", productname=" + productname + ", description=" + description + + ", brand=" + brand + ", files=" + Arrays.toString(files) + ", mainpictureurl=" + mainpictureurl + + ", pictureurl=" + pictureurl + ", originalprice=" + originalprice + ", saleprice=" + saleprice + + ", category=" + category + ", subcategory=" + subcategory + ", create_time=" + create_time + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/Purchase.java b/src/main/java/com/ustyle/domain/Purchase.java new file mode 100644 index 0000000..eebc5d7 --- /dev/null +++ b/src/main/java/com/ustyle/domain/Purchase.java @@ -0,0 +1,79 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class Purchase { + + private int purchaseid; + private String recipientname; + private String shippingaddr1; + private String shippingaddr2; + private String shippingpostcode; + private String recipientphone; + private String username; + private Date purchasedate; + private int usedpoint; + + public int getPurchaseid() { + return purchaseid; + } + public void setPurchaseid(int purchaseid) { + this.purchaseid = purchaseid; + } + public String getRecipientname() { + return recipientname; + } + public void setRecipientname(String recipientname) { + this.recipientname = recipientname; + } + public String getShippingaddr1() { + return shippingaddr1; + } + public void setShippingaddr1(String shippingaddr1) { + this.shippingaddr1 = shippingaddr1; + } + public String getShippingaddr2() { + return shippingaddr2; + } + public void setShippingaddr2(String shippingaddr2) { + this.shippingaddr2 = shippingaddr2; + } + public String getShippingpostcode() { + return shippingpostcode; + } + public void setShippingpostcode(String shippingpostcode) { + this.shippingpostcode = shippingpostcode; + } + public String getRecipientphone() { + return recipientphone; + } + public void setRecipientphone(String recipientphone) { + this.recipientphone = recipientphone; + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public Date getPurchasedate() { + return purchasedate; + } + public void setPurchasedate(Date purchasedate) { + this.purchasedate = purchasedate; + } + public int getUsedpoint() { + return usedpoint; + } + public void setUsedpoint(int usedpoint) { + this.usedpoint = usedpoint; + } + + @Override + public String toString() { + return "Purchase [purchaseid=" + purchaseid + ", recipientname=" + recipientname + ", shippingaddr1=" + + shippingaddr1 + ", shippingaddr2=" + shippingaddr2 + ", shippingpostcode=" + shippingpostcode + + ", recipientphone=" + recipientphone + ", username=" + username + ", purchasedate=" + purchasedate + + ", usedpoint=" + usedpoint + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/Qna.java b/src/main/java/com/ustyle/domain/Qna.java new file mode 100644 index 0000000..79005fd --- /dev/null +++ b/src/main/java/com/ustyle/domain/Qna.java @@ -0,0 +1,114 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class Qna { + + private int bno; + private String username; + private String title; + private String content; + private String category; + private Date regdate; + private int viewcnt; + private int family; + private int parent; + private int depth; + private int indent; + + public int getBno() { + return bno; + } + + public void setBno(int bno) { + this.bno = bno; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public Date getRegdate() { + return regdate; + } + + public void setRegdate(Date regdate) { + this.regdate = regdate; + } + + public int getViewcnt() { + return viewcnt; + } + + public void setViewcnt(int viewcnt) { + this.viewcnt = viewcnt; + } + + public int getFamily() { + return family; + } + + public void setFamily(int family) { + this.family = family; + } + + public int getParent() { + return parent; + } + + public void setParent(int parent) { + this.parent = parent; + } + + public int getDepth() { + return depth; + } + + public void setDepth(int depth) { + this.depth = depth; + } + + public int getIndent() { + return indent; + } + + public void setIndent(int indent) { + this.indent = indent; + } + + @Override + public String toString() { + return "\nQna [bno=" + bno + ", username=" + username + ", title=" + title + ", content=" + content + + ", category=" + category + ", regdate=" + regdate + ", viewcnt=" + viewcnt + ", family=" + family + + ", parent=" + parent + ", depth=" + depth + ", indent=" + indent + "]"; + } + +} diff --git a/src/main/java/com/ustyle/domain/Review.java b/src/main/java/com/ustyle/domain/Review.java new file mode 100644 index 0000000..2b430d6 --- /dev/null +++ b/src/main/java/com/ustyle/domain/Review.java @@ -0,0 +1,49 @@ +package com.ustyle.domain; + +import java.util.Date; + +public class Review { + + private int reviewid; + private String contents; + private Date regdate; + private String username; + private int productid; + + public int getReviewid() { + return reviewid; + } + public void setReviewid(int reviewid) { + this.reviewid = reviewid; + } + public String getContents() { + return contents; + } + public void setContents(String contents) { + this.contents = contents; + } + public Date getRegdate() { + return regdate; + } + public void setRegdate(Date regdate) { + this.regdate = regdate; + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public int getProductid() { + return productid; + } + public void setProductid(int productid) { + this.productid = productid; + } + + @Override + public String toString() { + return "Review [reviewid=" + reviewid + ", contents=" + contents + ", regdate=" + regdate + ", username=" + + username + ", productid=" + productid + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/ReviewReply.java b/src/main/java/com/ustyle/domain/ReviewReply.java new file mode 100644 index 0000000..d85515b --- /dev/null +++ b/src/main/java/com/ustyle/domain/ReviewReply.java @@ -0,0 +1,6 @@ +package com.ustyle.domain; + +public class ReviewReply { + + +} diff --git a/src/main/java/com/ustyle/domain/Sales.java b/src/main/java/com/ustyle/domain/Sales.java new file mode 100644 index 0000000..cb7ff3e --- /dev/null +++ b/src/main/java/com/ustyle/domain/Sales.java @@ -0,0 +1,40 @@ +package com.ustyle.domain; + +public class Sales { + + private int salesno; + private int count; + private int purchaseid; + private int itemid; + + public int getSalesno() { + return salesno; + } + public void setSalesno(int salesno) { + this.salesno = salesno; + } + public int getCount() { + return count; + } + public void setCount(int count) { + this.count = count; + } + public int getPurchaseid() { + return purchaseid; + } + public void setPurchaseid(int purchaseid) { + this.purchaseid = purchaseid; + } + public int getItemid() { + return itemid; + } + public void setItemid(int itemid) { + this.itemid = itemid; + } + + @Override + public String toString() { + return "Sales [salesno=" + salesno + ", count=" + count + ", purchaseid=" + purchaseid + ", itemid=" + itemid + + "]"; + } +} diff --git a/src/main/java/com/ustyle/domain/User.java b/src/main/java/com/ustyle/domain/User.java index 49301ec..f97791a 100644 --- a/src/main/java/com/ustyle/domain/User.java +++ b/src/main/java/com/ustyle/domain/User.java @@ -10,10 +10,19 @@ public class User { private Date create_time; private String addr1; private String addr2; - private int postcode; + private String postcode; private String phone; private int point; private String realname; + private String auth; + + public String getAuth() { + return auth; + } + + public void setAuth(String auth) { + this.auth = auth; + } public String getUsername() { return username; @@ -63,11 +72,11 @@ public void setAddr2(String addr2) { this.addr2 = addr2; } - public int getPostcode() { + public String getPostcode() { return postcode; } - public void setPostcode(int postcode) { + public void setPostcode(String postcode) { this.postcode = postcode; } @@ -99,7 +108,8 @@ public void setRealname(String realname) { public String toString() { return "User [username=" + username + ", password=" + password + ", email=" + email + ", create_time=" + create_time + ", addr1=" + addr1 + ", addr2=" + addr2 + ", postcode=" + postcode + ", phone=" + phone - + ", point=" + point + ", realname=" + realname + "]"; + + ", point=" + point + ", realname=" + realname + ", auth=" + auth + "]"; } + } diff --git a/src/main/java/com/ustyle/interceptor/AuthInterceptor.java b/src/main/java/com/ustyle/interceptor/AuthInterceptor.java new file mode 100644 index 0000000..faf14fa --- /dev/null +++ b/src/main/java/com/ustyle/interceptor/AuthInterceptor.java @@ -0,0 +1,32 @@ +package com.ustyle.interceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +public class AuthInterceptor extends HandlerInterceptorAdapter +{ + private static final Logger logger = LoggerFactory.getLogger(AuthInterceptor.class); + + @Override + public boolean preHandle(HttpServletRequest request, + HttpServletResponse response, Object handler) throws Exception { + HttpSession session = request.getSession(); + + if ( session.getAttribute("session_user") == null ) { + logger.info("current user is not logined"); + + String oldUrl = request.getHeader("referer"); // 이전 페이지 주소값 + + session.setAttribute("dest", oldUrl); + + response.sendRedirect("/login.do"); + return false; + } + return true; + } +} diff --git a/src/main/java/com/ustyle/interceptor/LoginInterceptor.java b/src/main/java/com/ustyle/interceptor/LoginInterceptor.java new file mode 100644 index 0000000..6d963f2 --- /dev/null +++ b/src/main/java/com/ustyle/interceptor/LoginInterceptor.java @@ -0,0 +1,30 @@ +package com.ustyle.interceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +public class LoginInterceptor extends HandlerInterceptorAdapter +{ + private static final Logger logger = LoggerFactory.getLogger(LoginInterceptor.class); + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, + Object handler) throws Exception { + HttpSession session = request.getSession(); + + if ( session.getAttribute("session_user") != null ) { + logger.info("clear login data before"); + session.removeAttribute("session_user"); + return false; + } + + return true; + } + + +} diff --git a/src/main/java/com/ustyle/persistence/CartDAO.java b/src/main/java/com/ustyle/persistence/CartDAO.java new file mode 100644 index 0000000..27c9940 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/CartDAO.java @@ -0,0 +1,17 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Cart; + +public interface CartDAO { + public void insert(Cart cart); + public void update(Cart cart); + public void delete(int cartno); + public void deleteAll(String username); + public List> selectUserCartList(String username); + public List> selectUserItemidList(String username); + public Cart selectUserCartOne(int cartno); + public int selectCartItemsCountForUsername(String username); +} diff --git a/src/main/java/com/ustyle/persistence/CartDAOImpl.java b/src/main/java/com/ustyle/persistence/CartDAOImpl.java new file mode 100644 index 0000000..4f4eec3 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/CartDAOImpl.java @@ -0,0 +1,60 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Cart; + +@Repository +public class CartDAOImpl implements CartDAO { + + private static String namespace = "com.ustyle.mappers.cartMapper"; + + @Inject + private SqlSession session; + + @Override + public void insert(Cart cart) { + session.insert(namespace + ".insert", cart); + } + + @Override + public void update(Cart cart) { + session.update(namespace + ".update", cart); + } + + @Override + public void delete(int cartno) { + session.delete(namespace + ".delete", cartno); + } + + @Override + public void deleteAll(String username) { + session.delete(namespace + ".deleteAll", username); + } + + @Override + public List> selectUserCartList(String username) { + return session.selectList(namespace + ".selectUserCartList", username); + } + + @Override + public List> selectUserItemidList(String username) { + return session.selectList(namespace + ".selectUserItemidList", username); + } + + @Override + public Cart selectUserCartOne(int cartno) { + return session.selectOne(namespace + ".selectUserCartOne", cartno); + } + + @Override + public int selectCartItemsCountForUsername(String username) { + return session.selectOne(namespace + ".selectCartItemsCountForUsername", username); + } +} diff --git a/src/main/java/com/ustyle/persistence/FaqDAO.java b/src/main/java/com/ustyle/persistence/FaqDAO.java new file mode 100644 index 0000000..0ba5e52 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/FaqDAO.java @@ -0,0 +1,16 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Faq; + +public interface FaqDAO { + public int selectListCnt(HashMap map); + public List faqList(HashMap map); + public void faqWrite(Faq faq); + public Faq faqView(int bno); + public void viewCntPlus(int bno); + public void faqModify(Faq faq); + public void faqDelete(int bno); +} diff --git a/src/main/java/com/ustyle/persistence/FaqDAOImpl.java b/src/main/java/com/ustyle/persistence/FaqDAOImpl.java new file mode 100644 index 0000000..1d05680 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/FaqDAOImpl.java @@ -0,0 +1,55 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Faq; + +@Repository +public class FaqDAOImpl implements FaqDAO { + + private static String namespace = "com.ustyle.mappers.faqMapper"; + @Inject + private SqlSession session; + + @Override + public int selectListCnt(HashMap map) { + return session.selectOne(namespace + ".selectListCnt", map); + } + + @Override + public List faqList(HashMap map) { + return session.selectList(namespace + ".faqList", map); + } + + @Override + public void faqWrite(Faq faq) { + session.insert(namespace + ".faqWrite", faq); + } + + @Override + public Faq faqView(int bno) { + return session.selectOne(namespace + ".faqView", bno); + } + + @Override + public void viewCntPlus(int bno) { + session.update(namespace + ".viewCntPlus", bno); + } + + @Override + public void faqModify(Faq faq) { + session.update(namespace+".faqModify",faq); + } + + @Override + public void faqDelete(int bno) { + session.delete(namespace+".faqDelete",bno); + } + +} diff --git a/src/main/java/com/ustyle/persistence/GradeDAO.java b/src/main/java/com/ustyle/persistence/GradeDAO.java new file mode 100644 index 0000000..9adc991 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/GradeDAO.java @@ -0,0 +1,12 @@ +package com.ustyle.persistence; + +import java.util.List; + +import com.ustyle.domain.Grade; + +public interface GradeDAO { + public List selectList(); + public void insert(Grade grade); + public void update(Grade grade); + public void delete(int idx); +} diff --git a/src/main/java/com/ustyle/persistence/GradeDAOImpl.java b/src/main/java/com/ustyle/persistence/GradeDAOImpl.java new file mode 100644 index 0000000..e4f12ed --- /dev/null +++ b/src/main/java/com/ustyle/persistence/GradeDAOImpl.java @@ -0,0 +1,40 @@ +package com.ustyle.persistence; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Grade; + +@Repository +public class GradeDAOImpl implements GradeDAO { + + private static String namespace = "com.ustyle.mappers.gradeMapper"; + + @Inject + private SqlSession session; + + @Override + public List selectList() { + return session.selectList(namespace + ".selectList"); + } + + @Override + public void insert(Grade grade) { + session.insert(namespace + ".insert", grade); + } + + @Override + public void update(Grade grade) { + session.update(namespace + ".update", grade); + } + + @Override + public void delete(int idx) { + session.delete(namespace + ".delete", idx); + } + +} diff --git a/src/main/java/com/ustyle/persistence/ItemDAO.java b/src/main/java/com/ustyle/persistence/ItemDAO.java new file mode 100644 index 0000000..c736be5 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/ItemDAO.java @@ -0,0 +1,23 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Item; +import com.ustyle.domain.Sales; + +public interface ItemDAO { + public void insert(Item item); + public int selectListCnt(HashMap map); + public boolean existItem(Item item); + public List itemList(HashMap map); + public List selectColorList(Integer productid); + public List selectedColorItemList(Item selectedColorItem); + public Item selectedColorSizeItem(Item selectedSizeItem); + public Item read(Integer itemid) throws Exception; + public int totalItem(Integer productid); + public void update(Item item); + public void updateForSales(Sales sales); + public boolean existSalesTable(int itemid); + public void deleteItem(int itemid); +} \ No newline at end of file diff --git a/src/main/java/com/ustyle/persistence/ItemDAOImpl.java b/src/main/java/com/ustyle/persistence/ItemDAOImpl.java new file mode 100644 index 0000000..c4aef1e --- /dev/null +++ b/src/main/java/com/ustyle/persistence/ItemDAOImpl.java @@ -0,0 +1,86 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Item; +import com.ustyle.domain.Sales; + +@Repository +public class ItemDAOImpl implements ItemDAO { + + private static String namespace = "com.ustyle.mappers.itemMapper"; + + @Inject + private SqlSession session; + + @Override + public void insert(Item item) { + session.insert(namespace + ".insert", item); + } + + @Override + public int selectListCnt(HashMap map) { + return session.selectOne(namespace + ".selectListCnt", map); + } + + @Override + public boolean existItem(Item item) { + return session.selectOne(namespace + ".existItem", item); + } + + @Override + public List itemList(HashMap map) { + return session.selectList(namespace + ".itemList", map); + } + + @Override + public List selectColorList(Integer productid) { + return session.selectList(namespace + ".selectColorList", productid); + } + + @Override + public List selectedColorItemList(Item selectedColorItem) { + return session.selectList(namespace + ".selectedColorItemList", selectedColorItem); + } + + @Override + public Item selectedColorSizeItem(Item selectedSizeItem) { + return session.selectOne(namespace + ".selectedColorSizeItem", selectedSizeItem); + } + + @Override + public Item read(Integer itemid) throws Exception { + return session.selectOne(namespace + ".read", itemid); + } + + @Override + public int totalItem(Integer productid) { + return session.selectOne(namespace + ".totalItem", productid); + } + + @Override + public void update(Item item) { + session.update(namespace + ".update", item); + } + + @Override + public void updateForSales(Sales sales) { + session.update(namespace + ".updateForSales", sales); + } + + @Override + public boolean existSalesTable(int itemid) { + return session.selectOne(namespace + ".existSalesTable", itemid); + } + + @Override + public void deleteItem(int itemid) { + session.delete(namespace + ".deleteItem", itemid); + } +} diff --git a/src/main/java/com/ustyle/persistence/NoticeDAO.java b/src/main/java/com/ustyle/persistence/NoticeDAO.java new file mode 100644 index 0000000..aee69dc --- /dev/null +++ b/src/main/java/com/ustyle/persistence/NoticeDAO.java @@ -0,0 +1,16 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Notice; + +public interface NoticeDAO { + public int selectListCnt(HashMap map); + public List noticeList(HashMap map); + public void noticeWrite(Notice notice); + public Notice noticeView(int bno); + public void viewCntPlus(int bno); + public void noticeModify(Notice notice); + public void noticeDelete(int bno); +} diff --git a/src/main/java/com/ustyle/persistence/NoticeDAOImpl.java b/src/main/java/com/ustyle/persistence/NoticeDAOImpl.java new file mode 100644 index 0000000..55b9d76 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/NoticeDAOImpl.java @@ -0,0 +1,55 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Notice; + +@Repository +public class NoticeDAOImpl implements NoticeDAO { + + private static String namespace = "com.ustyle.mappers.noticeMapper"; + + @Inject + private SqlSession session; + + @Override + public int selectListCnt(HashMap map) { + return session.selectOne(namespace + ".selectListCnt", map); + } + + @Override + public List noticeList(HashMap map) { + return session.selectList(namespace + ".noticeList", map); + } + + @Override + public void noticeWrite(Notice notice) { + session.insert(namespace + ".noticeWrite", notice); + } + + @Override + public Notice noticeView(int bno) { + return session.selectOne(namespace + ".noticeView", bno); + } + + @Override + public void viewCntPlus(int bno) { + session.update(namespace + ".viewCntPlus", bno); + } + + @Override + public void noticeModify(Notice notice) { + session.update(namespace + ".noticeModify", notice); + } + + @Override + public void noticeDelete(int bno) { + session.delete(namespace + ".noticeDelete", bno); + } +} diff --git a/src/main/java/com/ustyle/persistence/PinBoardDAO.java b/src/main/java/com/ustyle/persistence/PinBoardDAO.java new file mode 100644 index 0000000..718e358 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/PinBoardDAO.java @@ -0,0 +1,33 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Pin; +import com.ustyle.domain.PinBoard; +import com.ustyle.domain.PinBoardLike; + +public interface PinBoardDAO { + public void createPinBoard(PinBoard pinBoard); + public int selectListCnt(); + public int selectListCntForUsername(String username); + public List selectPinBoardList(HashMap map); + public boolean checkLike(HashMap map); + public void plusLike(int pinboardno); + public void addLikeList(PinBoardLike pinBoardLike); + public void minusLike(int pinboardno); + public void removeLikeList(PinBoardLike pinBoardLike); + public int selectLikeCnt(int pinboardno); + public boolean existPin(Pin pin); + public int selectPinCnt(int pinboardno); + public List> selectPinBoardProductList(int pinboardno); + public void modifyPinBoard(PinBoard pinBoard); + public void updatePictureurl(PinBoard pinBoard); + public void deleteAllPinBoardLike(int pinboardno); + public List selectPinBoardNoList(String username); + public List getPinBoardList(); + public PinBoard pinBoardByNo(int pinboardno); + public List getPinBoardMainImage(String username); + public void deletePinBoard(int pinboardno); + public int selectListCnt(HashMap map); +} diff --git a/src/main/java/com/ustyle/persistence/PinBoardDAOImpl.java b/src/main/java/com/ustyle/persistence/PinBoardDAOImpl.java new file mode 100644 index 0000000..c0e1c9d --- /dev/null +++ b/src/main/java/com/ustyle/persistence/PinBoardDAOImpl.java @@ -0,0 +1,133 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Pin; +import com.ustyle.domain.PinBoard; +import com.ustyle.domain.PinBoardLike; + +@Repository +public class PinBoardDAOImpl implements PinBoardDAO { + + private static String namespace = "com.ustyle.mappers.pinBoardMapper"; + + @Inject + private SqlSession session; + + @Override + public void createPinBoard(PinBoard pinBoard) { + session.insert(namespace + ".createPinBoard", pinBoard); + } + + @Override + public int selectListCnt() { + return session.selectOne(namespace + ".selectListCnt"); + } + + @Override + public int selectListCntForUsername(String username) { + return session.selectOne(namespace + ".selectListCntForUsername", username); + } + + @Override + public List selectPinBoardList(HashMap map) { + return session.selectList(namespace + ".selectPinBoardList", map); + } + + @Override + public boolean checkLike(HashMap map) { + return session.selectOne(namespace + ".checkLike", map); + } + + @Override + public void plusLike(int pinboardno) { + session.update(namespace + ".plusLike", pinboardno); + } + + @Override + public void addLikeList(PinBoardLike pinBoardLike) { + session.insert(namespace + ".addLikeList", pinBoardLike); + } + + @Override + public void minusLike(int pinboardno) { + session.update(namespace + ".minusLike", pinboardno); + } + + @Override + public void removeLikeList(PinBoardLike pinBoardLike) { + session.insert(namespace + ".removeLikeList", pinBoardLike); + } + + @Override + public int selectLikeCnt(int pinboardno) { + return session.selectOne(namespace + ".selectLikeCnt", pinboardno); + } + + @Override + public boolean existPin(Pin pin) { + return session.selectOne(namespace + ".existPin", pin); + } + + @Override + public int selectPinCnt(int pinboardno) { + return session.selectOne(namespace + ".selectPinCnt", pinboardno); + } + + @Override + public List> selectPinBoardProductList(int pinboardno) { + return session.selectList(namespace + ".selectPinBoardProductList", pinboardno); + } + + @Override + public void modifyPinBoard(PinBoard pinBoard) { + session.update(namespace + ".modifyPinBoard", pinBoard); + } + + @Override + public void updatePictureurl(PinBoard pinBoard) { + session.update(namespace + ".updatePictureurl", pinBoard); + } + + @Override + public void deleteAllPinBoardLike(int pinboardno) { + session.update(namespace + ".deleteAllPinBoardLike", pinboardno); + } + + @Override + public List selectPinBoardNoList(String username) { + return session.selectList(namespace + ".selectPinBoardNoList", username); + } + + @Override + public List getPinBoardList() { + return session.selectList(namespace + ".getPinBoardList"); + } + + @Override + public PinBoard pinBoardByNo(int pinboardno) { + return session.selectOne(namespace + ".getPinBoardByNo", pinboardno); + } + + // ====================================================== + @Override + public List getPinBoardMainImage(String username) { + return session.selectList(namespace + ".getPinBoardMainImage", username); + } + + @Override + public void deletePinBoard(int pinboardno) { + session.delete(namespace + ".deletePinBoard", pinboardno); + } + + @Override + public int selectListCnt(HashMap map) { + return session.selectOne(namespace + ".selectListCnt", map); + } +} diff --git a/src/main/java/com/ustyle/persistence/PinBoardReplyDAO.java b/src/main/java/com/ustyle/persistence/PinBoardReplyDAO.java new file mode 100644 index 0000000..664568d --- /dev/null +++ b/src/main/java/com/ustyle/persistence/PinBoardReplyDAO.java @@ -0,0 +1,15 @@ +package com.ustyle.persistence; + +import java.util.List; + +import com.ustyle.domain.PinBoardReply; + +public interface PinBoardReplyDAO { + + public List getPinBoardReplyByPinBoardNo(int pinboardno); + + public void insertPinBoardReply(PinBoardReply pinBoardReply); + + public void deletePinBoardReply(int pinboardreplyno); + +} diff --git a/src/main/java/com/ustyle/persistence/PinBoardReplyDAOImpl.java b/src/main/java/com/ustyle/persistence/PinBoardReplyDAOImpl.java new file mode 100644 index 0000000..135c4bf --- /dev/null +++ b/src/main/java/com/ustyle/persistence/PinBoardReplyDAOImpl.java @@ -0,0 +1,33 @@ +package com.ustyle.persistence; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.PinBoardReply; + +@Repository +public class PinBoardReplyDAOImpl implements PinBoardReplyDAO { + private static String namespace = "com.ustyle.mappers.pinBoardReplyMapper"; + @Inject + private SqlSession session; + + @Override + public List getPinBoardReplyByPinBoardNo(int pinboardno) { + return session.selectList(namespace + ".getPinBoardReplyByPinBoardNo", pinboardno); + } + + @Override + public void insertPinBoardReply(PinBoardReply pinBoardReply) { + session.insert(namespace + ".insertPinBoardReply", pinBoardReply); + } + + @Override + public void deletePinBoardReply(int pinboardreplyno) { + session.delete(namespace + ".deletePinBoardReply", pinboardreplyno); + } + +} diff --git a/src/main/java/com/ustyle/persistence/PinDAO.java b/src/main/java/com/ustyle/persistence/PinDAO.java new file mode 100644 index 0000000..ddf73e9 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/PinDAO.java @@ -0,0 +1,12 @@ +package com.ustyle.persistence; + +import java.util.List; + +import com.ustyle.domain.Pin; + +public interface PinDAO { + public void insertPin(Pin pin); + public void deletePin(Pin pin); + public List getPins(int pinboardno); + public void deleteAllPin(int pinboardno); +} diff --git a/src/main/java/com/ustyle/persistence/PinDAOImpl.java b/src/main/java/com/ustyle/persistence/PinDAOImpl.java new file mode 100644 index 0000000..3eab32e --- /dev/null +++ b/src/main/java/com/ustyle/persistence/PinDAOImpl.java @@ -0,0 +1,41 @@ +package com.ustyle.persistence; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Pin; + +@Repository +public class PinDAOImpl implements PinDAO { + + private static String namespace = "com.ustyle.mappers.pinMapper"; + + @Inject + private SqlSession session; + + @Override + public void insertPin(Pin pin) { + session.insert(namespace + ".insertPin", pin); + } + + @Override + public void deletePin(Pin pin) { + session.delete(namespace+".deletePin", pin); + } + + @Override + public List getPins(int pinboardno) { + return session.selectList(namespace + ".getPins", pinboardno); + } + + @Override + public void deleteAllPin(int pinboardno) { + session.delete(namespace+".deleteAllPin", pinboardno); + } + + +} diff --git a/src/main/java/com/ustyle/persistence/ProductDAO.java b/src/main/java/com/ustyle/persistence/ProductDAO.java new file mode 100644 index 0000000..6479b8f --- /dev/null +++ b/src/main/java/com/ustyle/persistence/ProductDAO.java @@ -0,0 +1,36 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Product; +import com.ustyle.domain.Review; + +public interface ProductDAO { + public void insert(Product product) throws Exception; + public void writeReview(Review review) throws Exception; + public int selectListCnt(HashMap map) throws Exception; + public List productList(HashMap map) throws Exception; + public List recentProductList() throws Exception; + public List popularProductList() throws Exception; + public int selectListCntForSubcategory(HashMap map) throws Exception; + public List productListForSubcategory(HashMap map) throws Exception; + public int selectListCntForProductname(HashMap map) throws Exception; + public List productListForProductname(HashMap map) throws Exception; + public Product read(Integer productid) throws Exception; + public String selectPictureurl(Integer productid) throws Exception; + public String selectMainpictureurl(Integer productid) throws Exception; + public void update(Product product) throws Exception; + public boolean existSalesTable(int productid) throws Exception; + public boolean existPinTable(int productid) throws Exception; + public void delete(int productid) throws Exception; + public void deleteItem(int productid) throws Exception; + public int getNewProductId() throws Exception; + + // subcategory 에 따른 브랜드와 그 브랜드수 + public List> brandListForSubcategory(String subcategory)throws Exception; + // subcategory 의 상위카테고리와 하위카테고리 + public List> subcategoryListForSubcategory(String subcategory) throws Exception; + // subcategory 해당하는 모든 가격과 그 수 + public List> priceRangeForSubcategory(String subcategory)throws Exception; +} diff --git a/src/main/java/com/ustyle/persistence/ProductDAOImpl.java b/src/main/java/com/ustyle/persistence/ProductDAOImpl.java new file mode 100644 index 0000000..dd5970a --- /dev/null +++ b/src/main/java/com/ustyle/persistence/ProductDAOImpl.java @@ -0,0 +1,132 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Product; +import com.ustyle.domain.Review; + +@Repository +public class ProductDAOImpl implements ProductDAO { + + private static String namespace = "com.ustyle.mappers.productMapper"; + + @Inject + private SqlSession session; + + @Override + public void insert(Product product) throws Exception { + session.insert(namespace + ".insert", product); + } + + @Override + public void writeReview(Review review) throws Exception { + session.insert(namespace + ".writeReview", review); + } + + @Override + public Product read(Integer productid) throws Exception { + return session.selectOne(namespace + ".read", productid); + } + + @Override + public String selectPictureurl(Integer productid) throws Exception { + return session.selectOne(namespace + ".selectPictureurl", productid); + } + + @Override + public String selectMainpictureurl(Integer productid) throws Exception { + return session.selectOne(namespace + ".selectMainpictureurl", productid); + } + + @Override + public int selectListCnt(HashMap map) throws Exception { + return session.selectOne(namespace + ".selectListCnt", map); + } + + @Override + public List productList(HashMap map) throws Exception { + return session.selectList(namespace + ".productList", map); + } + + @Override + public List recentProductList() throws Exception { + return session.selectList(namespace + ".recentProductList"); + } + + @Override + public List popularProductList() throws Exception { + return session.selectList(namespace + ".popularProductList"); + } + + @Override + public int selectListCntForSubcategory(HashMap map) throws Exception { + return session.selectOne(namespace + ".selectListCntForSubcategory", map); + } + + @Override + public List productListForSubcategory(HashMap map) throws Exception { + return session.selectList(namespace + ".productListForSubcategory", map); + } + + @Override + public int selectListCntForProductname(HashMap map) throws Exception { + return session.selectOne(namespace + ".selectListCntForProductname", map); + } + + @Override + public List productListForProductname(HashMap map) throws Exception { + return session.selectList(namespace + ".productListForProductname", map); + } + + @Override + public void update(Product product) throws Exception { + session.update(namespace + ".update", product); + } + + @Override + public boolean existSalesTable(int productid) throws Exception { + return session.selectOne(namespace + ".existSalesTable", productid); + } + + @Override + public boolean existPinTable(int productid) throws Exception { + return session.selectOne(namespace + ".existPinTable", productid); + } + + @Override + public void delete(int productid) throws Exception { + session.delete(namespace + ".delete", productid); + } + + @Override + public void deleteItem(int productid) throws Exception { + session.delete(namespace + ".deleteItem", productid); + } + + @Override + public int getNewProductId() throws Exception { + return session.selectOne(namespace + ".getNewProductId"); + } + + @Override + public List> brandListForSubcategory(String subcategory) throws Exception { + return session.selectList(namespace + ".brandListForSubcategory", subcategory); + } + + @Override + public List> subcategoryListForSubcategory(String subcategory) throws Exception { + return session.selectList(namespace + ".subcategoryListForSubcategory", subcategory); + } + + @Override + public List> priceRangeForSubcategory(String subcategory) throws Exception { + return session.selectList(namespace + ".priceRangeForSubcategory", subcategory); + } + +} diff --git a/src/main/java/com/ustyle/persistence/QnaDAO.java b/src/main/java/com/ustyle/persistence/QnaDAO.java new file mode 100644 index 0000000..83029fa --- /dev/null +++ b/src/main/java/com/ustyle/persistence/QnaDAO.java @@ -0,0 +1,23 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Qna; + +public interface QnaDAO { + public int selectListCnt(HashMap map); + public List qnaList(HashMap map); + public void qnaWrite(Qna qna); + public void updateFamilyNo(Qna qna); + public Qna qnaView(int bno); + public void viewCntPlus(int bno); + public int getCurrentNo(); + public int getFamilyNo(int parent); + public void qnaModify(Qna qna); + public void qnaDelete(int bno); + public List selectBnoListByUsername(String username); + public void qnaDeleteByUsername(HashMap map); + public int selectMyListCnt(HashMap map); + public List myQnaList(HashMap map); +} diff --git a/src/main/java/com/ustyle/persistence/QnaDAOImpl.java b/src/main/java/com/ustyle/persistence/QnaDAOImpl.java new file mode 100644 index 0000000..30d6ac3 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/QnaDAOImpl.java @@ -0,0 +1,90 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Qna; + +@Repository +public class QnaDAOImpl implements QnaDAO { + private static String namespace = "com.ustyle.mappers.qnaMapper"; + + @Inject + private SqlSession session; + + @Override + public int selectListCnt(HashMap map) { + return session.selectOne(namespace + ".selectListCnt", map); + } + + @Override + public List qnaList(HashMap map) { + return session.selectList(namespace + ".qnaList", map); + } + + @Override + public void qnaWrite(Qna qna) { + session.insert(namespace+".qnaWrite",qna); + } + + @Override + public void updateFamilyNo(Qna qna) { + session.update(namespace + ".updateFamilyNo", qna); + } + + @Override + public Qna qnaView(int bno) { + return session.selectOne(namespace+".qnaView", bno); + } + + @Override + public void viewCntPlus(int bno) { + session.update(namespace + ".viewCntPlus", bno); + } + + @Override + public int getCurrentNo() { + return session.selectOne(namespace + ".getCurrentNo"); + } + + @Override + public int getFamilyNo(int parent) { + return session.selectOne(namespace + ".getFamilyNo",parent); + } + + @Override + public void qnaDelete(int bno) { + session.delete(namespace + ".qnaDelete",bno); + } + + @Override + public List selectBnoListByUsername(String username) { + return session.selectList(namespace + ".selectBnoListByUsername", username); + } + + @Override + public void qnaDeleteByUsername(HashMap map) { + session.delete(namespace + ".qnaDeleteByUsername", map); + } + + @Override + public int selectMyListCnt(HashMap map) { + return session.selectOne(namespace + ".selectMyListCnt", map); + } + + @Override + public List myQnaList(HashMap map) { + return session.selectList(namespace +".myQnaList",map); + } + + @Override + public void qnaModify(Qna qna) { + session.update(namespace +".qnaModify",qna); + } + +} diff --git a/src/main/java/com/ustyle/persistence/ReviewDAO.java b/src/main/java/com/ustyle/persistence/ReviewDAO.java new file mode 100644 index 0000000..942ce97 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/ReviewDAO.java @@ -0,0 +1,16 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Review; + +public interface ReviewDAO { + public List list(Integer bno) throws Exception; + public void insert(Review review) throws Exception; + public int selectReviewCnt(int productid) throws Exception; + public List selectReviewList(HashMap reviewMap) throws Exception; + public boolean existReview(HashMap reviewMap) throws Exception; + public void deleteReviewByUsername(String username) throws Exception; + public int count(Integer bno) throws Exception; +} diff --git a/src/main/java/com/ustyle/persistence/ReviewDAOImpl.java b/src/main/java/com/ustyle/persistence/ReviewDAOImpl.java new file mode 100644 index 0000000..3cb255a --- /dev/null +++ b/src/main/java/com/ustyle/persistence/ReviewDAOImpl.java @@ -0,0 +1,55 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Review; + +@Repository +public class ReviewDAOImpl implements ReviewDAO +{ + @Inject + private SqlSession session; + + private static String namespace = "com.ustyle.mappers.reviewMapper"; + + @Override + public List list(Integer bno) throws Exception { + return session.selectList(namespace + ".list", bno); + } + + @Override + public void insert(Review review) throws Exception { + session.insert(namespace + ".insert", review); + } + + @Override + public int selectReviewCnt(int productid) throws Exception { + return session.selectOne(namespace + ".selectReviewCnt", productid); + } + + @Override + public List selectReviewList(HashMap reviewMap) throws Exception { + return session.selectList(namespace + ".selectReviewList", reviewMap); + } + + @Override + public boolean existReview(HashMap reviewMap) throws Exception { + return session.selectOne(namespace + ".existReview", reviewMap); + } + + @Override + public void deleteReviewByUsername(String username) throws Exception { + session.delete(namespace + ".deleteReviewByUsername", username); + } + + @Override + public int count(Integer bno) throws Exception { + return session.selectOne(namespace + ".count", bno); + } +} diff --git a/src/main/java/com/ustyle/persistence/SalesDAO.java b/src/main/java/com/ustyle/persistence/SalesDAO.java new file mode 100644 index 0000000..f716bf9 --- /dev/null +++ b/src/main/java/com/ustyle/persistence/SalesDAO.java @@ -0,0 +1,19 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Purchase; +import com.ustyle.domain.Sales; + +public interface SalesDAO { + public List selectUserCartListForPurchase(String username); + public void insert(Sales sales); + public void insertPurchase(Purchase purchase); + public void updateAddPoint(HashMap addPointMap); + public void updateUsedPoint(Purchase purchase); + public HashMap selectSalesForDaterange(HashMap dateMap); + public List> selectSalesForDaterangeAndPagination(HashMap dateMap); + public HashMap selectSalesForDate(HashMap userMap); + public List> selectSalesDetail(int purchaseid); +} diff --git a/src/main/java/com/ustyle/persistence/SalesDAOImpl.java b/src/main/java/com/ustyle/persistence/SalesDAOImpl.java new file mode 100644 index 0000000..bf15c5c --- /dev/null +++ b/src/main/java/com/ustyle/persistence/SalesDAOImpl.java @@ -0,0 +1,66 @@ +package com.ustyle.persistence; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; +import org.springframework.stereotype.Repository; + +import com.ustyle.domain.Purchase; +import com.ustyle.domain.Sales; + +@Repository +public class SalesDAOImpl implements SalesDAO { + + private static String namespace = "com.ustyle.mappers.salesMapper"; + + @Inject + private SqlSession session; + + @Override + public void insert(Sales sales) { + session.insert(namespace + ".insert", sales); + } + + @Override + public List selectUserCartListForPurchase(String username) { + return session.selectList(namespace + ".selectUserCartListForPurchase", username); + } + + @Override + public void insertPurchase(Purchase purchase) { + session.insert(namespace + ".insertPurchase", purchase); + } + + @Override + public void updateAddPoint(HashMap addPointMap) { + session.update(namespace + ".updateAddPoint", addPointMap); + } + + @Override + public void updateUsedPoint(Purchase purchase) { + session.update(namespace + ".updateUsedPoint", purchase); + } + + @Override + public HashMap selectSalesForDaterange(HashMap dateMap) { + return session.selectOne(namespace + ".selectSalesForDaterange", dateMap); + } + + @Override + public List> selectSalesForDaterangeAndPagination(HashMap dateMap) { + return session.selectList(namespace + ".selectSalesForDaterangeAndPagination", dateMap); + } + + @Override + public HashMap selectSalesForDate(HashMap userMap) { + return session.selectOne(namespace + ".selectSalesForDate", userMap); + } + + @Override + public List> selectSalesDetail(int purchaseid) { + return session.selectList(namespace + ".selectSalesDetail", purchaseid); + } +} \ No newline at end of file diff --git a/src/main/java/com/ustyle/persistence/UserDAO.java b/src/main/java/com/ustyle/persistence/UserDAO.java index 0c9973d..36773c6 100644 --- a/src/main/java/com/ustyle/persistence/UserDAO.java +++ b/src/main/java/com/ustyle/persistence/UserDAO.java @@ -1,12 +1,28 @@ package com.ustyle.persistence; +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Grade; import com.ustyle.domain.User; public interface UserDAO { - public void insert(User user); // - public User userLogin(User user); // - public boolean userAuthOk(User user); // - public void userPointInitialize(String username); // - public int userExist(String username); - + public void insert(User user); + public User userLogin(User user); + public boolean userAuthOk(User user); + public void userAuthInitialize(String username); + public int userExist(User user); + public HashMap selectUserInfo(String username); + public void update(User user); + public void updatePoint(User user); + public void updateTemporaryPassword(User user); + public void delete(String username); + public int selectListCnt(HashMap map); + public List userList(HashMap map); + public User selectOneUser(String user); + public int selectUserPurchaseCount(String username); + public void modifyAllUsersGradeInitialize(); + public void modifyAllUsersGrade(Grade grade); + public List> selectUserPurchaseList(HashMap map); + public double selectUserPointRatio(String username); } diff --git a/src/main/java/com/ustyle/persistence/UserDAOImpl.java b/src/main/java/com/ustyle/persistence/UserDAOImpl.java index 84f0c61..6feaa0c 100644 --- a/src/main/java/com/ustyle/persistence/UserDAOImpl.java +++ b/src/main/java/com/ustyle/persistence/UserDAOImpl.java @@ -1,10 +1,14 @@ package com.ustyle.persistence; +import java.util.HashMap; +import java.util.List; + import javax.inject.Inject; import org.apache.ibatis.session.SqlSession; import org.springframework.stereotype.Repository; +import com.ustyle.domain.Grade; import com.ustyle.domain.User; @Repository @@ -31,13 +35,78 @@ public boolean userAuthOk(User user) { } @Override - public void userPointInitialize(String username) { - session.update(namespace + ".userPointInitialize", username); + public void userAuthInitialize(String username) { + session.update(namespace + ".userAuthInitialize", username); + } + + @Override + public int userExist(User user) { + return session.selectOne(namespace + ".userExist", user); + } + + @Override + public HashMap selectUserInfo(String username) { + return session.selectOne(namespace + ".selectUserInfo", username); + } + + @Override + public void update(User user) { + session.update(namespace + ".update", user); + } + + @Override + public void updatePoint(User user) { + session.update(namespace + ".updatePoint", user); + } + + @Override + public void updateTemporaryPassword(User user) { + session.update(namespace + ".updateTemporaryPassword", user); + } + + @Override + public void delete(String username) { + session.delete(namespace + ".delete", username); + } + + @Override + public int selectListCnt(HashMap map) { + return session.selectOne(namespace + ".selectListCnt", map); + } + + @Override + public List userList(HashMap map) { + return session.selectList(namespace + ".userList", map); + } + + @Override + public User selectOneUser(String username) { + return session.selectOne(namespace + ".selectUserOne", username); + } + + @Override + public void modifyAllUsersGradeInitialize() { + session.update(namespace+".modifyAllUsersGradeInitialize"); + } + + @Override + public void modifyAllUsersGrade(Grade grade) { + session.update(namespace+".modifyAllUsersGrade", grade); + } + + @Override + public int selectUserPurchaseCount(String username) { + return session.selectOne(namespace + ".selectUserPurchaseCount", username); + } + + @Override + public List> selectUserPurchaseList(HashMap map) { + return session.selectList(namespace + ".selectUserPurchaseList", map); } @Override - public int userExist(String username) { - return session.selectOne(namespace + ".userExist", username); + public double selectUserPointRatio(String username) { + return session.selectOne(namespace + ".selectUserPointRatio", username); } } diff --git a/src/main/java/com/ustyle/service/CartService.java b/src/main/java/com/ustyle/service/CartService.java new file mode 100644 index 0000000..3aa555e --- /dev/null +++ b/src/main/java/com/ustyle/service/CartService.java @@ -0,0 +1,17 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Cart; + +public interface CartService { + public void insert(Cart cart) throws Exception; + public void update(Cart cart) throws Exception; + public void delete(int cartno) throws Exception; + public void deleteAll(String username) throws Exception; + public List> selectUserCartList(String username) throws Exception; + public List> selectUserItemidList(String username) throws Exception; + public Cart selectUserCartOne(int cartno) throws Exception; + public int selectCartItemsCountForUsername(String username) throws Exception; +} diff --git a/src/main/java/com/ustyle/service/CartServiceImpl.java b/src/main/java/com/ustyle/service/CartServiceImpl.java new file mode 100644 index 0000000..efbc53e --- /dev/null +++ b/src/main/java/com/ustyle/service/CartServiceImpl.java @@ -0,0 +1,58 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; + +import com.ustyle.domain.Cart; +import com.ustyle.persistence.CartDAO; + +@Service +public class CartServiceImpl implements CartService { + + @Inject + private CartDAO dao; + + @Override + public void insert(Cart cart) throws Exception { + dao.insert(cart); + } + + @Override + public void update(Cart cart) throws Exception { + dao.update(cart); + } + + @Override + public void delete(int cartno) throws Exception { + dao.delete(cartno); + } + + @Override + public void deleteAll(String username) throws Exception { + dao.deleteAll(username); + } + + @Override + public List> selectUserCartList(String username) throws Exception { + return dao.selectUserCartList(username); + } + + @Override + public List> selectUserItemidList(String username) throws Exception { + return dao.selectUserItemidList(username); + } + + @Override + public Cart selectUserCartOne(int cartno) throws Exception { + return dao.selectUserCartOne(cartno); + } + + @Override + public int selectCartItemsCountForUsername(String username) throws Exception { + return dao.selectCartItemsCountForUsername(username); + } +} diff --git a/src/main/java/com/ustyle/service/FaqService.java b/src/main/java/com/ustyle/service/FaqService.java new file mode 100644 index 0000000..fd3afe9 --- /dev/null +++ b/src/main/java/com/ustyle/service/FaqService.java @@ -0,0 +1,16 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Faq; + +public interface FaqService { + public int selectListCnt(HashMap map) throws Exception; + public List faqList(HashMap map) throws Exception; + public void faqWrite(Faq faq) throws Exception; + public Faq faqView(int bno) throws Exception; + public Faq faqViewFromAdmin(int bno) throws Exception; + public void faqModify(Faq faq) throws Exception; + public void faqDelete(int bno) throws Exception; +} diff --git a/src/main/java/com/ustyle/service/FaqServiceImpl.java b/src/main/java/com/ustyle/service/FaqServiceImpl.java new file mode 100644 index 0000000..06ac504 --- /dev/null +++ b/src/main/java/com/ustyle/service/FaqServiceImpl.java @@ -0,0 +1,56 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.ustyle.domain.Faq; +import com.ustyle.persistence.FaqDAO; + +@Service +public class FaqServiceImpl implements FaqService { + + @Inject + private FaqDAO dao; + + @Override + public int selectListCnt(HashMap map) throws Exception { + return dao.selectListCnt(map); + } + + @Override + public List faqList(HashMap map) throws Exception { + return dao.faqList(map); + } + + @Override + public void faqWrite(Faq faq) throws Exception { + dao.faqWrite(faq); + } + + @Transactional + @Override + public Faq faqView(int bno) throws Exception { + dao.viewCntPlus(bno); + return dao.faqView(bno); + } + + @Override + public Faq faqViewFromAdmin(int bno) throws Exception { + return dao.faqView(bno); + } + + @Override + public void faqModify(Faq faq) throws Exception { + dao.faqModify(faq); + } + + @Override + public void faqDelete(int bno) throws Exception { + dao.faqDelete(bno); + } +} diff --git a/src/main/java/com/ustyle/service/GradeService.java b/src/main/java/com/ustyle/service/GradeService.java new file mode 100644 index 0000000..f5e0115 --- /dev/null +++ b/src/main/java/com/ustyle/service/GradeService.java @@ -0,0 +1,12 @@ +package com.ustyle.service; + +import java.util.List; + +import com.ustyle.domain.Grade; + +public interface GradeService { + public List selectList() throws Exception; + public void insert(Grade grade) throws Exception; + public void update(Grade grade) throws Exception; + public void delete(int idx) throws Exception; +} diff --git a/src/main/java/com/ustyle/service/GradeServiceImpl.java b/src/main/java/com/ustyle/service/GradeServiceImpl.java new file mode 100644 index 0000000..d20a609 --- /dev/null +++ b/src/main/java/com/ustyle/service/GradeServiceImpl.java @@ -0,0 +1,37 @@ +package com.ustyle.service; + +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; + +import com.ustyle.domain.Grade; +import com.ustyle.persistence.GradeDAO; + +@Service +public class GradeServiceImpl implements GradeService { + + @Inject + private GradeDAO dao; + + @Override + public List selectList() throws Exception { + return dao.selectList(); + } + + @Override + public void insert(Grade grade) throws Exception { + dao.insert(grade); + } + + @Override + public void update(Grade grade) throws Exception { + dao.update(grade); + } + + @Override + public void delete(int idx) throws Exception { + dao.delete(idx); + } +} diff --git a/src/main/java/com/ustyle/service/ItemService.java b/src/main/java/com/ustyle/service/ItemService.java new file mode 100644 index 0000000..de488ad --- /dev/null +++ b/src/main/java/com/ustyle/service/ItemService.java @@ -0,0 +1,21 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Item; + +public interface ItemService { + public void insert(Item item) throws Exception; + public int selectListCnt(HashMap map) throws Exception; + public boolean existItem(Item item) throws Exception; + public List itemList(HashMap map) throws Exception; + public List selectColorList(Integer productid) throws Exception; + public List selectedColorItemList(Item selectedColorItem) throws Exception; + public Item selectedColorSizeItem(Item selectedSizeItem) throws Exception; + public Item read(Integer itemid) throws Exception; + public int totalItem(Integer productid) throws Exception; + public void update(Item item) throws Exception; + public boolean existSalesTable(int itemid) throws Exception; + public void deleteItem(int itemid) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/com/ustyle/service/ItemServiceImpl.java b/src/main/java/com/ustyle/service/ItemServiceImpl.java new file mode 100644 index 0000000..2452896 --- /dev/null +++ b/src/main/java/com/ustyle/service/ItemServiceImpl.java @@ -0,0 +1,78 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; + +import com.ustyle.domain.Item; +import com.ustyle.persistence.ItemDAO; + +@Service +public class ItemServiceImpl implements ItemService { + + @Inject + private ItemDAO dao; + + @Override + public void insert(Item item) throws Exception { + dao.insert(item); + } + + @Override + public int selectListCnt(HashMap map) throws Exception { + return dao.selectListCnt(map); + } + + @Override + public boolean existItem(Item item) throws Exception { + return dao.existItem(item); + } + + @Override + public List itemList(HashMap map) throws Exception { + return dao.itemList(map); + } + + @Override + public List selectColorList(Integer productid) throws Exception { + return dao.selectColorList(productid); + } + + @Override + public List selectedColorItemList(Item selectedColorItem) throws Exception { + return dao.selectedColorItemList(selectedColorItem); + } + + @Override + public Item selectedColorSizeItem(Item selectedSizeItem) throws Exception { + return dao.selectedColorSizeItem(selectedSizeItem); + } + + @Override + public Item read(Integer itemid) throws Exception { + return dao.read(itemid); + } + + @Override + public int totalItem(Integer productid) throws Exception { + return dao.totalItem(productid); + } + + @Override + public void update(Item item) throws Exception { + dao.update(item); + } + + @Override + public boolean existSalesTable(int itemid) throws Exception { + return dao.existSalesTable(itemid); + } + + @Override + public void deleteItem(int itemid) throws Exception { + dao.deleteItem(itemid); + } +} diff --git a/src/main/java/com/ustyle/service/NoticeService.java b/src/main/java/com/ustyle/service/NoticeService.java new file mode 100644 index 0000000..4349213 --- /dev/null +++ b/src/main/java/com/ustyle/service/NoticeService.java @@ -0,0 +1,16 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Notice; + +public interface NoticeService { + public int selectListCnt(HashMap map) throws Exception; + public List noticeList(HashMap map) throws Exception; + public void noticeWrite(Notice notice) throws Exception; + public Notice noticeView(int bno) throws Exception; + public Notice noticeViewFromAdmin(int bno) throws Exception; + public void noticeModify(Notice notice) throws Exception; + public void noticeDelete(int bno) throws Exception; +} diff --git a/src/main/java/com/ustyle/service/NoticeServiceImpl.java b/src/main/java/com/ustyle/service/NoticeServiceImpl.java new file mode 100644 index 0000000..118e02a --- /dev/null +++ b/src/main/java/com/ustyle/service/NoticeServiceImpl.java @@ -0,0 +1,56 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.ustyle.domain.Notice; +import com.ustyle.persistence.NoticeDAO; + +@Service +public class NoticeServiceImpl implements NoticeService { + + @Inject + private NoticeDAO dao; + + @Override + public int selectListCnt(HashMap map) throws Exception { + return dao.selectListCnt(map); + } + + @Override + public List noticeList(HashMap map) throws Exception { + return dao.noticeList(map); + } + + @Override + public void noticeWrite(Notice notice) throws Exception { + dao.noticeWrite(notice); + } + + @Transactional + @Override + public Notice noticeView(int bno) throws Exception { + dao.viewCntPlus(bno); + return dao.noticeView(bno); + } + + @Override + public Notice noticeViewFromAdmin(int bno) throws Exception { + return dao.noticeView(bno); + } + + @Override + public void noticeModify(Notice notice) throws Exception { + dao.noticeModify(notice); + } + + @Override + public void noticeDelete(int bno) throws Exception { + dao.noticeDelete(bno); + } +} diff --git a/src/main/java/com/ustyle/service/PinService.java b/src/main/java/com/ustyle/service/PinService.java new file mode 100644 index 0000000..7ae74e5 --- /dev/null +++ b/src/main/java/com/ustyle/service/PinService.java @@ -0,0 +1,42 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Pin; +import com.ustyle.domain.PinBoard; +import com.ustyle.domain.PinBoardLike; +import com.ustyle.domain.PinBoardReply; + +public interface PinService { + public void createPinBoard(PinBoard pinBoard) throws Exception; + public int selectListCnt() throws Exception; + public int selectListCntForUsername(String username) throws Exception; + public List selectPinBoardList(HashMap map) throws Exception; + public boolean checkLike(HashMap map) throws Exception; + public void plusLike(int pinboardno) throws Exception; + public void addLikeList(PinBoardLike pinBoardLike) throws Exception; + public void minusLike(int pinboardno) throws Exception; + public void removeLikeList(PinBoardLike pinBoardLike) throws Exception; + public int selectLikeCnt(int pinboardno) throws Exception; + public boolean existPin(Pin pin) throws Exception; + public int selectPinCnt(int pinboardno) throws Exception; + public List> selectPinBoardProductList(int pinboardno) throws Exception; + public void modifyPinBoard(PinBoard pinBoard) throws Exception; + public List getPinBoardList(); + public List getPinBoardMainImage(String username); + public void deletePinBoard(int pinboardno) throws Exception; + public void deletePinBoardByUsername(String username) throws Exception; + public int selectListCnt(HashMap map); + public PinBoard getPinBoardByNo(int pinboardno); + // ===================================================================== // + public List getPins(int pinboardno); + public void insertPin(Pin pin) throws Exception; + public void updatePictureurl(PinBoard pinBoard) throws Exception; + public void deletePin(Pin pin) throws Exception; + // ===================================================================== // + public List getPinBoardReplyByPinBoardNo(int pinboardno); + public void insertPinBoardReply(PinBoardReply pinBoardReply); + public void deletePinBoardReply(int pinboardreplyno); + +} diff --git a/src/main/java/com/ustyle/service/PinServiceImpl.java b/src/main/java/com/ustyle/service/PinServiceImpl.java new file mode 100644 index 0000000..6812588 --- /dev/null +++ b/src/main/java/com/ustyle/service/PinServiceImpl.java @@ -0,0 +1,173 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.ustyle.domain.Pin; +import com.ustyle.domain.PinBoard; +import com.ustyle.domain.PinBoardLike; +import com.ustyle.domain.PinBoardReply; +import com.ustyle.persistence.PinBoardDAO; +import com.ustyle.persistence.PinBoardReplyDAO; +import com.ustyle.persistence.PinDAO; + +@Service +public class PinServiceImpl implements PinService { + + @Inject + private PinBoardDAO pinBoardDao; + + @Inject + private PinDAO pinDao; + + @Inject + private PinBoardReplyDAO pinBoardReplyDao; + + @Override + public void createPinBoard(PinBoard pinBoard) throws Exception { + pinBoardDao.createPinBoard(pinBoard); + } + + @Override + public int selectListCnt() throws Exception { + return pinBoardDao.selectListCnt(); + } + + @Override + public int selectListCntForUsername(String username) throws Exception { + return pinBoardDao.selectListCntForUsername(username); + } + + @Override + public List selectPinBoardList(HashMap map) throws Exception { + return pinBoardDao.selectPinBoardList(map); + } + + @Override + public boolean checkLike(HashMap map) throws Exception { + return pinBoardDao.checkLike(map); + } + + @Override + public void plusLike(int pinboardno) throws Exception { + pinBoardDao.plusLike(pinboardno); + } + + @Override + public void addLikeList(PinBoardLike pinBoardLike) throws Exception { + pinBoardDao.addLikeList(pinBoardLike); + } + + @Override + public void minusLike(int pinboardno) throws Exception { + pinBoardDao.minusLike(pinboardno); + } + + @Override + public void removeLikeList(PinBoardLike pinBoardLike) throws Exception { + pinBoardDao.removeLikeList(pinBoardLike); + } + + @Override + public int selectLikeCnt(int pinboardno) throws Exception { + return pinBoardDao.selectLikeCnt(pinboardno); + } + + @Override + public boolean existPin(Pin pin) throws Exception { + return pinBoardDao.existPin(pin); + } + + @Override + public int selectPinCnt(int pinboardno) throws Exception { + return pinBoardDao.selectPinCnt(pinboardno); + } + + @Override + public List> selectPinBoardProductList(int pinboardno) throws Exception { + return pinBoardDao.selectPinBoardProductList(pinboardno); + } + + @Override + public List getPinBoardList() { + return pinBoardDao.getPinBoardList(); + } + + @Override + public List getPinBoardMainImage(String username) { + return pinBoardDao.getPinBoardMainImage(username); + } + + @Override + public void modifyPinBoard(PinBoard pinBoard) throws Exception { + pinBoardDao.modifyPinBoard(pinBoard); + } + + @Transactional + @Override + public void deletePinBoard(int pinboardno) throws Exception { + pinDao.deleteAllPin(pinboardno); + pinBoardDao.deleteAllPinBoardLike(pinboardno); + pinBoardDao.deletePinBoard(pinboardno); + } + + @Transactional + @Override + public void deletePinBoardByUsername(String username) throws Exception { + List pinBoardNoList = pinBoardDao.selectPinBoardNoList(username); + + for ( Integer pinboardno : pinBoardNoList ) + deletePinBoard(pinboardno); + } + + @Override + public int selectListCnt(HashMap map) { + return pinBoardDao.selectListCnt(map); + } + + @Override + public PinBoard getPinBoardByNo(int pinboardno) { + return pinBoardDao.pinBoardByNo(pinboardno); + } + + @Override + public List getPins(int pinboardno) { + return pinDao.getPins(pinboardno); + } + + @Override + public void insertPin(Pin pin) throws Exception { + pinDao.insertPin(pin); + } + + @Override + public void updatePictureurl(PinBoard pinBoard) throws Exception { + pinBoardDao.updatePictureurl(pinBoard); + } + + @Override + public void deletePin(Pin pin) throws Exception { + pinDao.deletePin(pin); + } + + @Override + public List getPinBoardReplyByPinBoardNo(int pinboardno) { + return pinBoardReplyDao.getPinBoardReplyByPinBoardNo(pinboardno); + } + + @Override + public void insertPinBoardReply(PinBoardReply pinBoardReply) { + pinBoardReplyDao.insertPinBoardReply(pinBoardReply); + } + + @Override + public void deletePinBoardReply(int pinboardreplyno) { + pinBoardReplyDao.deletePinBoardReply(pinboardreplyno); + } + +} diff --git a/src/main/java/com/ustyle/service/ProductService.java b/src/main/java/com/ustyle/service/ProductService.java new file mode 100644 index 0000000..10f2729 --- /dev/null +++ b/src/main/java/com/ustyle/service/ProductService.java @@ -0,0 +1,32 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Product; +import com.ustyle.domain.Review; + +public interface ProductService { + public void insert(Product product) throws Exception; + public void writeReview(Review review) throws Exception; + public int selectListCnt(HashMap map) throws Exception; + public List productList(HashMap map) throws Exception; + public List recentProductList() throws Exception; + public List popularProductList() throws Exception; + public int selectListCntForSubcategory(HashMap map) throws Exception; + public List productListForSubcategory(HashMap map) throws Exception; + public int selectListCntForProductname(HashMap map) throws Exception; + public List productListForProductname(HashMap map) throws Exception; + public Product read(Integer productid) throws Exception; + public String selectPictureurl(Integer productid) throws Exception; + public String selectMainpictureurl(Integer productid) throws Exception; + public void update(Product product) throws Exception; + public boolean existSalesAndPinTable(int productid) throws Exception; + public void delete(int productid) throws Exception; + public int getNewProductId() throws Exception; + + public List> brandListForSubcategory(String subcategory)throws Exception; + public List> subcategoryListForSubcategory(String subcategory)throws Exception; + public List> priceRangeForSubcategory(String subcategory)throws Exception; + +} diff --git a/src/main/java/com/ustyle/service/ProductServiceImpl.java b/src/main/java/com/ustyle/service/ProductServiceImpl.java new file mode 100644 index 0000000..908c987 --- /dev/null +++ b/src/main/java/com/ustyle/service/ProductServiceImpl.java @@ -0,0 +1,123 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.ustyle.domain.Product; +import com.ustyle.domain.Review; +import com.ustyle.persistence.ProductDAO; + +@Service +public class ProductServiceImpl implements ProductService { + + @Inject + private ProductDAO dao; + + @Override + public void insert(Product product) throws Exception { + dao.insert(product); + } + + @Override + public void writeReview(Review review) throws Exception { + dao.writeReview(review); + } + + @Override + public Product read(Integer productid) throws Exception { + return dao.read(productid); + } + + @Override + public String selectPictureurl(Integer productid) throws Exception { + return dao.selectPictureurl(productid); + } + + @Override + public String selectMainpictureurl(Integer productid) throws Exception { + return dao.selectMainpictureurl(productid); + } + + @Override + public int selectListCnt(HashMap map) throws Exception { + return dao.selectListCnt(map); + } + + @Override + public List productList(HashMap map) throws Exception { + return dao.productList(map); + } + + @Override + public List recentProductList() throws Exception { + return dao.recentProductList(); + } + + @Override + public List popularProductList() throws Exception { + return dao.popularProductList(); + } + + @Override + public int selectListCntForSubcategory(HashMap map) throws Exception { + return dao.selectListCntForSubcategory(map); + } + + @Override + public List productListForSubcategory(HashMap map) throws Exception { + return dao.productListForSubcategory(map); + } + + @Override + public int selectListCntForProductname(HashMap map) throws Exception { + return dao.selectListCntForProductname(map); + } + + @Override + public List productListForProductname(HashMap map) throws Exception { + return dao.productListForProductname(map); + } + + @Override + public void update(Product product) throws Exception { + dao.update(product); + } + + @Override + public boolean existSalesAndPinTable(int productid) throws Exception { + boolean isExistTable = ( dao.existSalesTable(productid) || dao.existPinTable(productid) ); + return isExistTable; + } + + @Transactional + @Override + public void delete(int productid) throws Exception { + dao.deleteItem(productid); + dao.delete(productid); + } + + @Override + public int getNewProductId() throws Exception { + return dao.getNewProductId(); + } + + @Override + public List> brandListForSubcategory(String subcategory) throws Exception { + return dao.brandListForSubcategory(subcategory); + } + + @Override + public List> subcategoryListForSubcategory(String subcategory) throws Exception { + return dao.subcategoryListForSubcategory(subcategory); + } + + @Override + public List> priceRangeForSubcategory(String subcategory) throws Exception { + return dao.priceRangeForSubcategory(subcategory); + } +} diff --git a/src/main/java/com/ustyle/service/QnaService.java b/src/main/java/com/ustyle/service/QnaService.java new file mode 100644 index 0000000..8565ba6 --- /dev/null +++ b/src/main/java/com/ustyle/service/QnaService.java @@ -0,0 +1,19 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Qna; + +public interface QnaService { + public int selectListCnt(HashMap map) throws Exception; + public List qnaList(HashMap map) throws Exception; + public void qnaWrite(Qna qna) throws Exception; + public Qna qnaView(int bno) throws Exception; + public Qna qnaViewFromAdmin(int bno) throws Exception; + public void qnaModify(Qna qna) throws Exception; + public void qnaDelete(int bno) throws Exception; + public void qnaDeleteByUsername(String username) throws Exception; + public int selectMyListCnt(HashMap map)throws Exception; + public List myQnaList(HashMap map) throws Exception; +} diff --git a/src/main/java/com/ustyle/service/QnaServiceImpl.java b/src/main/java/com/ustyle/service/QnaServiceImpl.java new file mode 100644 index 0000000..f6e5900 --- /dev/null +++ b/src/main/java/com/ustyle/service/QnaServiceImpl.java @@ -0,0 +1,100 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.ustyle.domain.Qna; +import com.ustyle.persistence.QnaDAO; + +@Service +public class QnaServiceImpl implements QnaService { + + private static final Logger logger = LoggerFactory.getLogger(QnaService.class); + + @Inject + private QnaDAO dao; + + @Override + public int selectListCnt(HashMap map) throws Exception { + return dao.selectListCnt(map); + } + + @Override + public List qnaList(HashMap map) throws Exception { + return dao.qnaList(map); + } + + @Transactional + @Override + public void qnaWrite(Qna qna) throws Exception { + + if ( qna.getParent() == 0 ) { + logger.info("부모글이 없으면 새글 입력이므로 parent = 0, family는 bno와 같음"); + + dao.qnaWrite(qna); + int bno = qna.getBno(); + + logger.info("BNO = " + bno); + dao.updateFamilyNo(qna); + } + else { + int parent = qna.getParent(); + int family = dao.getFamilyNo(parent); + + logger.info("부모글이 있으면 답변글 입력이므로 parent는 부모글번호, family는 부모글번호를 통해 얻은 원글의 family와 같음"); + qna.setFamily(family); + dao.qnaWrite(qna); + } + } + + @Transactional + @Override + public Qna qnaView(int bno) throws Exception { + dao.viewCntPlus(bno); + return dao.qnaView(bno); + } + + @Override + public Qna qnaViewFromAdmin(int bno) throws Exception { + return dao.qnaView(bno); + } + + @Override + public void qnaDelete(int bno) throws Exception { + dao.qnaDelete(bno); + } + + @Override + public void qnaDeleteByUsername(String username) throws Exception { + List bnoList = dao.selectBnoListByUsername(username); + + if ( !(bnoList.isEmpty()) ) { + HashMap map = new HashMap(); + map.put("bnoList", bnoList); + + dao.qnaDeleteByUsername(map); + } + } + + @Override + public int selectMyListCnt(HashMap map) throws Exception { + return dao.selectMyListCnt(map); + } + + @Override + public List myQnaList(HashMap map) throws Exception { + return dao.myQnaList(map); + } + + @Override + public void qnaModify(Qna qna) throws Exception { + dao.qnaModify(qna); + } +} diff --git a/src/main/java/com/ustyle/service/ReviewService.java b/src/main/java/com/ustyle/service/ReviewService.java new file mode 100644 index 0000000..1882ca9 --- /dev/null +++ b/src/main/java/com/ustyle/service/ReviewService.java @@ -0,0 +1,16 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Review; + +public interface ReviewService { + public void writeReview(Review review) throws Exception; + public List listReply(Integer bno) throws Exception; + public int selectReviewCnt(int productid) throws Exception; + public List selectReviewList(HashMap reviewMap) throws Exception; + public boolean existReview(HashMap reviewMap) throws Exception; + public void deleteReviewByUsername(String username) throws Exception; + public int count(Integer bno) throws Exception; +} diff --git a/src/main/java/com/ustyle/service/ReviewServiceImpl.java b/src/main/java/com/ustyle/service/ReviewServiceImpl.java new file mode 100644 index 0000000..8caf59f --- /dev/null +++ b/src/main/java/com/ustyle/service/ReviewServiceImpl.java @@ -0,0 +1,53 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; + +import com.ustyle.domain.Review; +import com.ustyle.persistence.ReviewDAO; + +@Service +public class ReviewServiceImpl implements ReviewService +{ + @Inject + private ReviewDAO dao; + + @Override + public void writeReview(Review review) throws Exception { + dao.insert(review); + } + + @Override + public List listReply(Integer bno) throws Exception { + return dao.list(bno); + } + + @Override + public int selectReviewCnt(int productid) throws Exception { + return dao.selectReviewCnt(productid); + } + + @Override + public List selectReviewList(HashMap reviewMap) throws Exception { + return dao.selectReviewList(reviewMap); + } + + @Override + public boolean existReview(HashMap reviewMap) throws Exception { + return dao.existReview(reviewMap); + } + + @Override + public void deleteReviewByUsername(String username) throws Exception { + dao.deleteReviewByUsername(username); + } + + @Override + public int count(Integer bno) throws Exception { + return dao.count(bno); + } +} diff --git a/src/main/java/com/ustyle/service/SalesService.java b/src/main/java/com/ustyle/service/SalesService.java new file mode 100644 index 0000000..b1bc5c7 --- /dev/null +++ b/src/main/java/com/ustyle/service/SalesService.java @@ -0,0 +1,18 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Purchase; +import com.ustyle.domain.Sales; + +public interface SalesService { + public List selectUserCartListForPurchase(String username) throws Exception; + public void insert(Sales sales) throws Exception; + public void updateAddPoint(HashMap addPointMap) throws Exception; + public void insertPurchase(Purchase purchase) throws Exception; + public HashMap selectSalesForDaterange(HashMap dateMap) throws Exception; + public List> selectSalesForDaterangeAndPagination(HashMap dateMap) throws Exception; + public HashMap selectSalesForDate(HashMap userMap) throws Exception; + public List> selectSalesDetail(int purchaseid) throws Exception; +} diff --git a/src/main/java/com/ustyle/service/SalesServiceImpl.java b/src/main/java/com/ustyle/service/SalesServiceImpl.java new file mode 100644 index 0000000..b86f217 --- /dev/null +++ b/src/main/java/com/ustyle/service/SalesServiceImpl.java @@ -0,0 +1,68 @@ +package com.ustyle.service; + +import java.util.HashMap; +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.ustyle.domain.Purchase; +import com.ustyle.domain.Sales; +import com.ustyle.persistence.ItemDAO; +import com.ustyle.persistence.SalesDAO; + +@Service +public class SalesServiceImpl implements SalesService { + + @Inject + private SalesDAO salesDao; + + @Inject + private ItemDAO itemDao; + + @Override + public List selectUserCartListForPurchase(String username) throws Exception { + return salesDao.selectUserCartListForPurchase(username); + } + + @Transactional + @Override + public void insert(Sales sales) throws Exception { + itemDao.updateForSales(sales); + salesDao.insert(sales); + } + + @Override + public void updateAddPoint(HashMap addPointMap) throws Exception { + salesDao.updateAddPoint(addPointMap); + } + + @Transactional + @Override + public void insertPurchase(Purchase purchase) throws Exception { + salesDao.updateUsedPoint(purchase); + salesDao.insertPurchase(purchase); + } + + @Override + public HashMap selectSalesForDaterange(HashMap dateMap) throws Exception { + return salesDao.selectSalesForDaterange(dateMap); + } + + @Override + public List> selectSalesForDaterangeAndPagination(HashMap dateMap) throws Exception { + return salesDao.selectSalesForDaterangeAndPagination(dateMap); + } + + @Override + public HashMap selectSalesForDate(HashMap userMap) throws Exception { + return salesDao.selectSalesForDate(userMap); + } + + @Override + public List> selectSalesDetail(int purchaseid) throws Exception { + return salesDao.selectSalesDetail(purchaseid); + } +} diff --git a/src/main/java/com/ustyle/service/UserService.java b/src/main/java/com/ustyle/service/UserService.java index 5650a79..47e79be 100644 --- a/src/main/java/com/ustyle/service/UserService.java +++ b/src/main/java/com/ustyle/service/UserService.java @@ -1,20 +1,28 @@ package com.ustyle.service; +import java.util.HashMap; +import java.util.List; + +import com.ustyle.domain.Grade; import com.ustyle.domain.User; public interface UserService { - // 회원정보 입력해서 db에 입력 public void insert(User user) throws Exception; - - // username, password 이용해서 전체정보 불러오기 public User userLogin(User user) throws Exception; - - // 이메일인증 확인하여 t/f public boolean userAuthOk(User user) throws Exception; - - // 인증에 사용한 point 칼럼 초기화 - public void userPointInitialize(String username) throws Exception; - - // 회원가입 시 중복되는 ID 걸러내는 메소드 - public int userExist(String username) throws Exception; + public void userAuthInitialize(String username) throws Exception; + public int userExist(User user) throws Exception; + public HashMap selectUserInfo(String username) throws Exception; + public void update(User user) throws Exception; + public void updatePoint(User user) throws Exception; + public void updateTemporaryPassword(User user) throws Exception; + public void delete(String username) throws Exception; + public int selectListCnt(HashMap map) throws Exception; + public List userList(HashMap map) throws Exception; + public User selectOneUser(String username) throws Exception; + public void modifyAllUsersGradeInitialize(); + public void modifyAllUsersGrade(Grade grade); + public int selectUserPurchaseCount(String username) throws Exception; + public List> selectUserPurchaseList(HashMap map) throws Exception; + public double selectUserPointRatio(String username) throws Exception; } diff --git a/src/main/java/com/ustyle/service/UserServiceImpl.java b/src/main/java/com/ustyle/service/UserServiceImpl.java index ff9bbb5..031d40c 100644 --- a/src/main/java/com/ustyle/service/UserServiceImpl.java +++ b/src/main/java/com/ustyle/service/UserServiceImpl.java @@ -1,46 +1,124 @@ package com.ustyle.service; +import java.util.HashMap; +import java.util.List; + import javax.inject.Inject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.ustyle.domain.Grade; import com.ustyle.domain.User; +import com.ustyle.persistence.ReviewDAO; import com.ustyle.persistence.UserDAO; @Service public class UserServiceImpl implements UserService { @Inject - private UserDAO dao; + private UserDAO userDao; + + @Inject + private ReviewDAO reviewDao; + + @Inject + private QnaService qnaService; + + @Inject + private PinService pinService; - @Transactional @Override public void insert(User user) throws Exception { - dao.insert(user); + userDao.insert(user); } - @Transactional @Override public User userLogin(User user) throws Exception { - return dao.userLogin(user); + return userDao.userLogin(user); } - @Transactional @Override public boolean userAuthOk(User user) throws Exception { - return dao.userAuthOk(user); + return userDao.userAuthOk(user); } @Override - public void userPointInitialize(String username) throws Exception { - dao.userPointInitialize(username); + public void userAuthInitialize(String username) throws Exception { + userDao.userAuthInitialize(username); + } + + @Override + public int userExist(User user) throws Exception { + return userDao.userExist(user); } + @Override + public HashMap selectUserInfo(String username) throws Exception { + return userDao.selectUserInfo(username); + } + + @Override + public void update(User user) throws Exception { + userDao.update(user); + } + + @Override + public void updatePoint(User user) throws Exception { + userDao.updatePoint(user); + } + + @Override + public void updateTemporaryPassword(User user) throws Exception { + userDao.updateTemporaryPassword(user); + } + @Transactional @Override - public int userExist(String username) throws Exception { - return dao.userExist(username); + public void delete(String username) throws Exception { + reviewDao.deleteReviewByUsername(username); + qnaService.qnaDeleteByUsername(username);; + pinService.deletePinBoardByUsername(username); + userDao.delete(username); + } + + @Override + public int selectListCnt(HashMap map) throws Exception { + return userDao.selectListCnt(map); + } + + @Override + public List userList(HashMap map) throws Exception { + return userDao.userList(map); } + @Override + public User selectOneUser(String username) throws Exception { + return userDao.selectOneUser(username); + } + + @Override + public void modifyAllUsersGradeInitialize() { + userDao.modifyAllUsersGradeInitialize(); + } + + @Override + public void modifyAllUsersGrade(Grade grade) { + userDao.modifyAllUsersGrade(grade); + } + + @Override + public int selectUserPurchaseCount(String username) throws Exception { + return userDao.selectUserPurchaseCount(username); + } + + @Override + public List> selectUserPurchaseList(HashMap map) throws Exception { + return userDao.selectUserPurchaseList(map); + } + + @Override + public double selectUserPointRatio(String username) throws Exception { + return userDao.selectUserPointRatio(username); + } } diff --git a/src/main/java/com/ustyle/utils/MediaUtils.java b/src/main/java/com/ustyle/utils/MediaUtils.java new file mode 100644 index 0000000..735f8dc --- /dev/null +++ b/src/main/java/com/ustyle/utils/MediaUtils.java @@ -0,0 +1,24 @@ +package com.ustyle.utils; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.http.MediaType; + +public class MediaUtils +{ + private static Map mediaMap; + + static + { + mediaMap = new HashMap(); + mediaMap.put("JPG", MediaType.IMAGE_JPEG); + mediaMap.put("GIF", MediaType.IMAGE_GIF); + mediaMap.put("PNG", MediaType.IMAGE_PNG); + } + + public static MediaType getMediaType(String type) + { + return mediaMap.get(type.toUpperCase()); + } +} diff --git a/src/main/java/com/ustyle/utils/PageMaker.java b/src/main/java/com/ustyle/utils/PageMaker.java new file mode 100644 index 0000000..574a495 --- /dev/null +++ b/src/main/java/com/ustyle/utils/PageMaker.java @@ -0,0 +1,148 @@ +package com.ustyle.utils; + +public class PageMaker { + + public Integer page; + public Integer count; + public Integer start; + public Integer end; + public boolean prev; + public boolean next; + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + if (page < 1 || page == null) { + this.page = 1; + return; + } + this.page = page; + } + + public void setCount(Integer count, int countPerPage, int countPerPaging) { + if (count < 1) { + return; + } + this.count = count; + calcPage(countPerPage, countPerPaging); + } + + private void calcPage(int countPerPage, int countPerPaging) { + // page변수는 현재 페이지번호, 현재 페이지번호를 기준으로 끝 페이지를 계산한다. + int tempEnd = (int) (Math.ceil(page / (float) countPerPaging) * countPerPaging); + // 시작 페이지 계산 + this.start = tempEnd - countPerPaging + 1;// 1 + + this.end = (int) Math.ceil(this.count / (float) countPerPage); + if (tempEnd * countPerPage < this.count){ + this.end = tempEnd; + } + this.prev = this.start == 1 ? false : true; + this.next = this.end * countPerPage >= this.count ? false : true; + } + + public Integer getStart() { + return start; + } + + public void setStart(Integer start) { + this.start = start; + } + + public Integer getEnd() { + return end; + } + + public void setEnd(Integer end) { + this.end = end; + } + + public boolean isPrev() { + return prev; + } + + public void setPrev(boolean prev) { + this.prev = prev; + } + + public boolean isNext() { + return next; + } + + public void setNext(boolean next) { + this.next = next; + } + + public Integer getCount() { + return count; + } + + @Override + public String toString() { + return "PageMaker [page=" + page + ", count=" + count + ", start=" + start + ", end=" + end + ", prev=" + prev + + ", next=" + next + "]"; + } + +} +// -------------controller------------ +// @RequestMapping(value="/noticeList.gh") +// public String noticeList(PageMaker pagemaker,Model model) throws Exception{ +// int page = 1; +// int totalCnt = 0; +// int countPerPage = 5; +// int countPerPaging = 5; +// +// page = pagemaker.getPage() != null ? pagemaker.getPage() : 1; +// pagemaker.setPage(page); +// +// totalCnt = noticeService.selectListCnt(); // DB연동_ 총 갯수 구해오기 +// pagemaker.setCount(totalCnt, countPerPaging); +// +// int first = ((pagemaker.getPage() - 1) * countPerPage) + 1; +// int last = first + countPerPage - 1; +// +// HashMap map = new HashMap(); +// map.put("first", first); +// map.put("last", last); +// List list = noticeService.noticeList(map); +// +// model.addAttribute("noticeList", list); +// model.addAttribute("noticePageMaker", pagemaker); +// +// return "notice/noticeList/공지사항"; +// } +// +// ------------jsp------------- +//
+// +//
+// +// --------------sql---------------- +// \ No newline at end of file diff --git a/src/main/java/com/ustyle/utils/ProductUploadValidator.java b/src/main/java/com/ustyle/utils/ProductUploadValidator.java new file mode 100644 index 0000000..b253263 --- /dev/null +++ b/src/main/java/com/ustyle/utils/ProductUploadValidator.java @@ -0,0 +1,42 @@ +package com.ustyle.utils; + +import org.springframework.util.StringUtils; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; + +import com.ustyle.domain.Product; + +public class ProductUploadValidator implements Validator +{ + + @Override + public boolean supports(Class clazz) + { + return Product.class.isAssignableFrom(clazz); + } + + @Override + public void validate(Object command, Errors errors) + { + Product product = (Product) command; + + if ( !(StringUtils.hasLength(product.getProductname())) ) + errors.rejectValue("productname", "error.required"); + + if ( !(StringUtils.hasLength(product.getBrand())) ) + errors.rejectValue("brand", "error.required"); + + if ( !(StringUtils.hasLength(product.getDescription())) ) + errors.rejectValue("description", "error.required"); + + if ( !(StringUtils.hasLength(product.getCategory())) ) + errors.rejectValue("category", "error.required"); + + if ( !(StringUtils.hasLength(product.getSubcategory())) ) + errors.rejectValue("subcategory", "error.required"); + + if ( errors.hasErrors() ) + errors.reject("error.input.product"); + } + +} diff --git a/src/main/java/com/ustyle/utils/UploadFileUtils.java b/src/main/java/com/ustyle/utils/UploadFileUtils.java new file mode 100644 index 0000000..d66ecd8 --- /dev/null +++ b/src/main/java/com/ustyle/utils/UploadFileUtils.java @@ -0,0 +1,101 @@ +package com.ustyle.utils; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.text.DecimalFormat; +import java.util.Calendar; +import java.util.UUID; + +import javax.imageio.ImageIO; + +import org.imgscalr.Scalr; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.FileCopyUtils; + +public class UploadFileUtils +{ + private static final Logger logger = LoggerFactory.getLogger(UploadFileUtils.class); + + public static String uploadFile(String uploadPath, + String originalName, byte[] fileData) throws Exception + { + UUID uid = UUID.randomUUID(); + + // 파일명의 중복을 피하기 위한 작업 + String formatName = originalName.substring(originalName.lastIndexOf(".") + 1); + + String savedName = uid.toString() + "." + formatName; + String savedPath = calcPath(uploadPath); + + File target = new File(uploadPath + savedPath, savedName); + + FileCopyUtils.copy(fileData, target); + + String uploadFileName = null; + + if ( MediaUtils.getMediaType(formatName) != null ) + uploadFileName = makeThumbnail(uploadPath, savedPath, savedName); + else + uploadFileName = makeIcon(uploadPath, savedPath, savedName); + + return uploadFileName; + } + + private static String calcPath(String uploadPath) + { + Calendar cal = Calendar.getInstance(); + + String yearPath = File.separator + cal.get(Calendar.YEAR); + String monthPath = yearPath + File.separator + + new DecimalFormat("00").format(cal.get(Calendar.MONTH) + 1); + String datePath = monthPath + File.separator + + new DecimalFormat("00").format(cal.get(Calendar.DATE)); + + makeDir(uploadPath, yearPath, monthPath, datePath); + + logger.info(datePath); + + return datePath; + } + + private static void makeDir(String uploadPath, String... paths) + { + if ( new File(paths[paths.length - 1]).exists() ) + return; + + for ( String path : paths ) + { + File dirPath = new File(uploadPath + path); + + if ( !(dirPath.exists()) ) + dirPath.mkdir(); + } + } + + private static String makeThumbnail(String uploadPath, + String path, String fileName) throws Exception + { + BufferedImage sourceImg = ImageIO.read(new File(uploadPath + path, fileName)); + BufferedImage destImg = Scalr.resize(sourceImg, + Scalr.Method.AUTOMATIC, Scalr.Mode.FIT_TO_HEIGHT, 200); + + String thumbnailName = uploadPath + path + File.separator + "s_" + fileName; + + File newFile = new File(thumbnailName); + + String formatName = fileName.substring(fileName.lastIndexOf(".") + 1); + + ImageIO.write(destImg, formatName.toUpperCase(), newFile); + + return thumbnailName.substring(uploadPath.length()).replace(File.separatorChar, '/'); + } + + private static String makeIcon(String uploadPath, + String path, String fileName) throws Exception + { + String iconName = uploadPath + path + File.separator + fileName; + + return iconName.substring(uploadPath.length()).replace(File.separatorChar, '/'); + } +} diff --git a/src/main/java/com/ustyle/utils/UserEntryValidator.java b/src/main/java/com/ustyle/utils/UserEntryValidator.java index 8d4575d..bc93b32 100644 --- a/src/main/java/com/ustyle/utils/UserEntryValidator.java +++ b/src/main/java/com/ustyle/utils/UserEntryValidator.java @@ -35,7 +35,7 @@ public void validate(Object command, Errors errors) if ( !(StringUtils.hasLength(user.getAddr2())) ) errors.rejectValue("addr2", "error.required"); - if ( !(StringUtils.hasLength(Integer.toString(user.getPostcode()))) ) + if ( !(StringUtils.hasLength(user.getPostcode())) ) errors.rejectValue("postcode", "error.required"); if ( !(StringUtils.hasLength(user.getPhone())) ) diff --git a/src/main/resources/database.properties b/src/main/resources/database.properties new file mode 100644 index 0000000..049f1fb --- /dev/null +++ b/src/main/resources/database.properties @@ -0,0 +1,6 @@ +jdbc.driver=net.sf.log4jdbc.sql.jdbcapi.DriverSpy +jdbc.url=jdbc:log4jdbc:mysql://localhost:3306/ustyle?useUnicode=yes&characterEncoding=utf8 +#jdbc.username=root +#jdbc.password=chorok12# +jdbc.username=ustyle +jdbc.password=ustyle diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml index 174402b..d434262 100644 --- a/src/main/resources/log4j.xml +++ b/src/main/resources/log4j.xml @@ -15,6 +15,11 @@ + + + + + @@ -31,7 +36,7 @@ - + diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 1f2526b..8764a46 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,13 +1,59 @@ - - - - + + + + + [%d{yyyy/MM/dd HH:mm:ss.SSS}][%thread][%-5level][%logger{0}] %msg%n + + + + + + + + + + + + + log.txt + + + rainbird-%d{yyyy-MM-dd}.%i.gz + + + 10MB + + 30 + + + [%d{yyyy/MM/dd HH:mm:ss.SSS}][%thread][%-5level][%logger{0}] %msg%n + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/src/main/resources/mappers/cartMapper.xml b/src/main/resources/mappers/cartMapper.xml new file mode 100644 index 0000000..653e9eb --- /dev/null +++ b/src/main/resources/mappers/cartMapper.xml @@ -0,0 +1,64 @@ + + + + + + insert into tbl_cart(count, username, itemid) + values(#{count}, #{username}, #{itemid}) + + + + + + + + update tbl_cart + set count = #{count} + where cartno = #{cartno} + + + + delete from tbl_cart + where cartno = #{cartno} + + + + delete from tbl_cart + where username = #{username} + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mappers/faqMapper.xml b/src/main/resources/mappers/faqMapper.xml new file mode 100644 index 0000000..193ac02 --- /dev/null +++ b/src/main/resources/mappers/faqMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + insert into tbl_faq(content, category, comment) + values(#{content}, #{category}, #{comment}) + + + + + update tbl_faq set viewcnt = viewcnt + 1 where bno = #{bno} + + + update tbl_faq set content = #{content}, comment = #{comment}, category = #{category} + where bno = #{bno} + + + delete from tbl_faq where bno = #{bno} + + + \ No newline at end of file diff --git a/src/main/resources/mappers/gradeMapper.xml b/src/main/resources/mappers/gradeMapper.xml new file mode 100644 index 0000000..b8e387d --- /dev/null +++ b/src/main/resources/mappers/gradeMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + insert into tbl_grade(grade, point_ratio, buy_term, min, max) + values(#{grade}, #{point_ratio}, #{buy_term}, #{min}, #{max}) + + + + update tbl_grade + set grade = #{grade}, point_ratio = #{point_ratio}, buy_term = #{buy_term}, min = #{min}, max = #{max} + where idx = #{idx} + + + + delete from tbl_grade + where idx = #{idx} + + + \ No newline at end of file diff --git a/src/main/resources/mappers/itemMapper.xml b/src/main/resources/mappers/itemMapper.xml new file mode 100644 index 0000000..7a1f2d1 --- /dev/null +++ b/src/main/resources/mappers/itemMapper.xml @@ -0,0 +1,116 @@ + + + + + + insert into tbl_item(originalprice, saleprice, color, size, stock, productid) + values(#{originalprice}, #{saleprice}, #{color}, #{size}, #{stock}, #{productid} ) + + + + + + + + + + + AND p.productname LIKE CONCAT('%', #{searchKeyword}, '%') + + + AND i.productid like CONCAT('%', #{searchKeyword}, '%') + + + AND i.itemid like CONCAT('%', #{searchKeyword}, '%') + + + + + + + + + + + + + + + + + + + update tbl_item + set originalprice = #{originalprice}, saleprice = #{saleprice}, color = #{color}, + size = #{size}, stock = #{stock} + where itemid = #{itemid} + + + + update tbl_item + set stock = stock - #{count} + where itemid = #{itemid} + + + + + + delete from tbl_item + where itemid = #{itemid} + + \ No newline at end of file diff --git a/src/main/resources/mappers/noticeMapper.xml b/src/main/resources/mappers/noticeMapper.xml new file mode 100644 index 0000000..fe5d018 --- /dev/null +++ b/src/main/resources/mappers/noticeMapper.xml @@ -0,0 +1,61 @@ + + + + + + + + + where ( title like CONCAT('%', #{searchKeyword}, '%') + OR content like CONCAT('%', #{searchKeyword}, '%') ) + + + where title like CONCAT('%', #{searchKeyword}, '%') + + + where content like CONCAT('%', #{searchKeyword}, '%') + + + + + + + + + + + insert into tbl_notice(title, content, viewcnt) + values(#{title}, #{content}, 0) + + + + + + update tbl_notice set viewcnt = viewcnt + 1 where bno = #{bno} + + + + update tbl_notice set title = #{title}, content = #{content} + where bno = #{bno} + + + + delete from tbl_notice where bno = #{bno} + + \ No newline at end of file diff --git a/src/main/resources/mappers/pinBoardMapper.xml b/src/main/resources/mappers/pinBoardMapper.xml new file mode 100644 index 0000000..28d38ab --- /dev/null +++ b/src/main/resources/mappers/pinBoardMapper.xml @@ -0,0 +1,136 @@ + + + + + + insert into + tbl_pinboard (username, pinboardname, create_time, content) + values (#{username}, #{pinboardname}, now(), #{content}) + + + + + + + + + + + + update tbl_pinboard set likecnt = likecnt + 1 + where pinboardno = #{pinboardno} + + + + insert into + tbl_pinboardlike (pinboardno, username) + values(#{pinboardno}, #{username}) + + + + update tbl_pinboard set likecnt = likecnt - 1 + where pinboardno = #{pinboardno} + + + + delete from + tbl_pinboardlike + where pinboardno = #{pinboardno} and username = #{username} + + + + + + + + + + + + update + tbl_pinboard set pinboardname = #{pinboardname}, content = #{content} + where pinboardno = #{pinboardno} + + + + update + tbl_pinboard set mainpictureproductid = #{mainpictureproductid} + where pinboardno = #{pinboardno} + + + + delete from + tbl_pinboardlike + where pinboardno = #{pinboardno} + + + + + + + + + + + + delete from tbl_pinboard + where pinboardno = #{pinboardno} + + + \ No newline at end of file diff --git a/src/main/resources/mappers/pinMapper.xml b/src/main/resources/mappers/pinMapper.xml new file mode 100644 index 0000000..dacdeda --- /dev/null +++ b/src/main/resources/mappers/pinMapper.xml @@ -0,0 +1,26 @@ + + + + + + insert into tbl_pin (pinboardno, productid) + values(#{pinboardno}, #{productid}) + + + + delete from tbl_pin + where pinboardno = #{pinboardno} and productid = #{productid} + + + + + + delete from tbl_pin + where pinboardno = #{pinboardno} + + \ No newline at end of file diff --git a/src/main/resources/mappers/productMapper.xml b/src/main/resources/mappers/productMapper.xml new file mode 100644 index 0000000..004c484 --- /dev/null +++ b/src/main/resources/mappers/productMapper.xml @@ -0,0 +1,256 @@ + + + + + + + + insert into tbl_product(productname, description, brand, category, subcategory, pictureurl, mainpictureurl, originalprice, saleprice) + values(#{productname}, #{description}, #{brand}, #{category}, #{subcategory}, #{pictureurl}, #{mainpictureurl}, #{originalprice}, #{saleprice} ) + + + insert into tbl_product(productname, description, brand, category, subcategory, originalprice, saleprice) + values(#{productname}, #{description}, #{brand}, #{category}, #{subcategory}, #{originalprice}, #{saleprice}) + + + + + + + + + + + + + + + + + where productname like CONCAT('%', #{searchKeyword}, '%') + + + where productid like CONCAT('%', #{searchKeyword}, '%') + + + where brand like CONCAT('%', #{searchKeyword}, '%') + + + where category like CONCAT('%', #{searchKeyword}, '%') + + + where subcategory like CONCAT('%', #{searchKeyword}, '%') + + + where description like CONCAT('%', #{searchKeyword}, '%') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update tbl_product + set productname = #{productname}, description = #{description}, brand = #{brand}, + category = #{category}, subcategory = #{subcategory}, pictureurl = #{pictureurl}, + mainpictureurl = #{mainpictureurl}, originalprice = #{originalprice}, saleprice = #{saleprice} + where productid = #{productid} + + + update tbl_product + set productname = #{productname}, description = #{description}, brand = #{brand}, + category = #{category}, subcategory = #{subcategory}, pictureurl = '[/ustylenone.jpg]', + mainpictureurl = '/ustylenone.jpg', originalprice = #{originalprice}, saleprice = #{saleprice} + where productid = #{productid} + + + + + + + + + + delete from tbl_product + where productid = #{productid} + + + + delete from tbl_item + where productid = #{productid} + + \ No newline at end of file diff --git a/src/main/resources/mappers/qnaMapper.xml b/src/main/resources/mappers/qnaMapper.xml new file mode 100644 index 0000000..3ee1579 --- /dev/null +++ b/src/main/resources/mappers/qnaMapper.xml @@ -0,0 +1,124 @@ + + + + + + + + + where ( title like CONCAT('%', #{searchKeyword}, '%') + OR content like CONCAT('%', #{searchKeyword}, '%') ) + + + where title like CONCAT('%', #{searchKeyword}, '%') + + + where content like CONCAT('%', #{searchKeyword}, '%') + + + + + + + + + + and ( title like CONCAT('%', #{searchKeyword}, '%') + OR content like CONCAT('%', #{searchKeyword}, '%') ) + + + and title like CONCAT('%', #{searchKeyword}, '%') + + + and content like CONCAT('%', #{searchKeyword}, '%') + + + + + + + + + + + + + insert into tbl_qna(title, content, category, username, family, parent, depth, indent) + values(#{title}, #{content}, #{category}, #{username}, #{family}, #{parent},#{depth},#{indent}) + + + + update tbl_qna set family = #{bno} + where bno = #{bno} + + + + + + update tbl_qna set title = #{title}, content = #{content}, category = #{category} + where bno = #{bno} + + + + update tbl_qna set viewcnt = viewcnt + 1 where bno = #{bno} + + + + delete from tbl_qna where bno = #{bno} + + + + + + delete from tbl_qna + where + family in + + #{bno} + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mappers/reviewMapper.xml b/src/main/resources/mappers/reviewMapper.xml new file mode 100644 index 0000000..c438de1 --- /dev/null +++ b/src/main/resources/mappers/reviewMapper.xml @@ -0,0 +1,46 @@ + + + + + + insert into tbl_review(contents, regdate, username, productid) + values(#{contents}, now(), #{username}, #{productid}) + + + + + + + + + + delete from tbl_review + where username = #{username} + + + \ No newline at end of file diff --git a/src/main/resources/mappers/salesMapper.xml b/src/main/resources/mappers/salesMapper.xml new file mode 100644 index 0000000..2956941 --- /dev/null +++ b/src/main/resources/mappers/salesMapper.xml @@ -0,0 +1,89 @@ + + + + + + insert into tbl_sales(count, purchaseid, itemid) + values(#{count}, #{purchaseid}, #{itemid}) + + + + insert into tbl_purchase(recipientname, shippingaddr1, shippingaddr2, shippingpostcode, recipientphone, username, purchasedate, usedpoint) + values(#{recipientname}, #{shippingaddr1}, #{shippingaddr2}, #{shippingpostcode}, #{recipientphone}, #{username}, now(), #{usedpoint}) + + + + update tbl_user + set point = point + #{addpoint} + where username = #{username} + + + + update tbl_user + set point = point - #{usedpoint} + where username = #{username} + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mappers/userMapper.xml b/src/main/resources/mappers/userMapper.xml index e3c9f0b..1e77266 100644 --- a/src/main/resources/mappers/userMapper.xml +++ b/src/main/resources/mappers/userMapper.xml @@ -2,39 +2,156 @@ - - - - insert into tbl_user(username, email, password, create_time, postcode, phone, realname, addr1, addr2, point) - values(#{username}, #{email}, #{password}, now(), #{postcode}, #{phone}, #{realname}, #{addr1}, #{addr2}, #{point} ) + + insert into tbl_user(username, email, password, create_time, postcode, phone, realname, addr1, addr2, point, auth) + values(#{username}, #{email}, #{password}, now(), #{postcode}, #{phone}, #{realname}, #{addr1}, #{addr2}, #{point}, #{auth} ) - select * from tbl_user where username = #{username} - + select (auth = #{auth}) from tbl_user where username = #{username} - + select count(*) from tbl_user where username = #{username} + + and email = #{email} + - - update tbl_user set point = 0 + + update tbl_user set auth = 'y' where username = #{username} + + + + + update tbl_user set password = #{password}, postcode = #{postcode}, phone = #{phone}, realname = #{realname}, + addr1 = #{addr1}, addr2 = #{addr2} + where username = #{username} + + + + update tbl_user set point = #{point} + where username = #{username} + + + + update tbl_user set password = #{password} + where username = #{username} + - - - + + delete from tbl_user + where username = #{username} + + + + + + + + + + update tbl_user set grade_idx = 1 + + + + update tbl_user set grade_idx = #{idx} + where username in ( + select username from ( + select + p.username, sum(i.saleprice*s.count) sum + from + tbl_item i, tbl_sales s, tbl_purchase p + where i.itemid = s.itemid + and p.purchaseid=s.purchaseid + and purchasedate now() + and purchasedate ]]> DATE_ADD(NOW(), INTERVAL - #{buy_term} MONTH) + group by username + ) X + where X.sum =]]> #{min} + and X.sum #{max} + ) + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 94d3c24..94d08f2 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -1,10 +1,8 @@ +####### User \uac1d\uccb4 Validator \uad00\ub828 \ubcc0\uc218 \uc120\uc5b8 \uc2dc\uc791 ####### + # \uc785\ub825 \uc815\ubcf4\uc5d0 \ubb38\uc81c\uac00 \uc788\uc2b5\ub2c8\ub2e4. error.input.user=\uc785\ub825 \uc815\ubcf4\uc5d0 \ubb38\uc81c\uac00 \uc788\uc2b5\ub2c8\ub2e4. -# \uc544\uc774\ub514\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. -#error.required.username=\uc544\uc774\ub514\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. -# \ud328\uc2a4\uc6cc\ub4dc\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. -#error.required.password=\ube44\ubc00\ubc88\ud638\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. # \uc785\ub825\ub41c \uc720\uc800 ID, \ud328\uc2a4\uc6cc\ub4dc\uac00 \ub9de\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. #error.login.user=\uc785\ub825\ub41c \uc720\uc800 ID, \ud328\uc2a4\uc6cc\ub4dc\uac00 \ub9de\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. @@ -29,13 +27,37 @@ error.required.email=E-Mail\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694. # \uc785\ub825\ub41c \uc720\uc800 ID\ub294 \uc774\ubbf8 \uc0ac\uc6a9 \uc911\uc785\ub2c8\ub2e4. error.duplicate.user=\uc785\ub825\ub41c \uc720\uc800 ID\ub294 \uc774\ubbf8 \uc0ac\uc6a9 \uc911\uc785\ub2c8\ub2e4. +####### User \uac1d\uccb4 Validator \uad00\ub828 \ubcc0\uc218 \uc120\uc5b8 \ub05d ####### + +####### Product \uac1d\uccb4 Validator \uad00\ub828 \ubcc0\uc218 \uc120\uc5b8 \uc2dc\uc791 ####### + +# \uc0c1\ud488\uba85\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694. +error.required.productname=\uc0c1\ud488\uba85\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694. + +# \ube0c\ub79c\ub4dc\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. +error.required.brand=\ube0c\ub79c\ub4dc\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. + +# \uc0c1\uc138\uc124\uba85\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694. +error.required.description=\uc0c1\uc138\uc124\uba85\uc744 \uc785\ub825\ud574\uc8fc\uc138\uc694. + +# \uce74\ud14c\uace0\ub9ac\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. +error.required.category=\uce74\ud14c\uace0\ub9ac\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. + +# \uc11c\ube0c \uce74\ud14c\uace0\ub9ac\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. +error.required.subcategory=\uc11c\ube0c \uce74\ud14c\uace0\ub9ac\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. + +# \uc5c5\ub85c\ub4dc\ud560 \uc0c1\ud488 \uc815\ubcf4\uc5d0 \ubb38\uc81c\uac00 \uc788\uc2b5\ub2c8\ub2e4. +error.input.product=\uc5c5\ub85c\ub4dc\ud560 \uc0c1\ud488 \uc815\ubcf4\uc5d0 \ubb38\uc81c\uac00 \uc788\uc2b5\ub2c8\ub2e4. + +####### Product \uac1d\uccb4 Validator \uad00\ub828 \ubcc0\uc218 \uc120\uc5b8 \ub05d ####### + # \ub85c\uadf8\uc778 \uc2dc \ud544\uc694\ud569\ub2c8\ub2e4. -user.userId.default=\ub85c\uadf8\uc778 \uc2dc \ud544\uc694\ud569\ub2c8\ub2e4. +#user.userId.default=\ub85c\uadf8\uc778 \uc2dc \ud544\uc694\ud569\ub2c8\ub2e4. # \ubc30\uc1a1 \uc2dc \ud544\uc694\ud569\ub2c8\ub2e4. -user.userName.default=\ubc30\uc1a1 \uc2dc \ud544\uc694\ud569\ub2c8\ub2e4. +#user.userName.default=\ubc30\uc1a1 \uc2dc \ud544\uc694\ud569\ub2c8\ub2e4. # \uc0dd\ub144\uc6d4\uc77c\uc740 1900-01-01 \ud615\uc2dd\uc73c\ub85c \uc785\ub825\ud574\uc8fc\uc138\uc694. -typeMismatch.user.birthDay=\uc0dd\ub144\uc6d4\uc77c\uc740 1900-01-01 \ud615\uc2dd\uc73c\ub85c \uc785\ub825\ud574\uc8fc\uc138\uc694. +#typeMismatch.user.birthDay=\uc0dd\ub144\uc6d4\uc77c\uc740 1900-01-01 \ud615\uc2dd\uc73c\ub85c \uc785\ub825\ud574\uc8fc\uc138\uc694. -AbstractUserDetailsAuthenticationProvider.badCredentials=\uc720\uc800ID, \ub610\ub294 \ud328\uc2a4\uc6cc\ub4dc\uac00 \ub9de\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. -ConcurrentSessionControllerImpl.exceededAllowed=\uc774 \uc720\uc800\ub294 \uc774\ubbf8 \ub85c\uadf8\uc778\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ No newline at end of file +#AbstractUserDetailsAuthenticationProvider.badCredentials=\uc720\uc800ID, \ub610\ub294 \ud328\uc2a4\uc6cc\ub4dc\uac00 \ub9de\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. +#ConcurrentSessionControllerImpl.exceededAllowed=\uc774 \uc720\uc800\ub294 \uc774\ubbf8 \ub85c\uadf8\uc778\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index 263de71..eb4112d 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -5,8 +5,19 @@ - + + + - - + \ No newline at end of file diff --git a/src/main/resources/uploadpath.properties b/src/main/resources/uploadpath.properties new file mode 100644 index 0000000..6c9f683 --- /dev/null +++ b/src/main/resources/uploadpath.properties @@ -0,0 +1 @@ +upload_path=C:\\zzz\\upload \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml b/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml index 9e9f5bf..d379b23 100644 --- a/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml +++ b/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml @@ -1,31 +1,35 @@ + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd"> - - + + - + + + + + - - - @@ -42,8 +46,58 @@ value="org.springframework.web.servlet.view.tiles3.TilesView" /> - - - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/spring/appServlet/test-context.xml b/src/main/webapp/WEB-INF/spring/appServlet/test-context.xml new file mode 100644 index 0000000..304ba58 --- /dev/null +++ b/src/main/webapp/WEB-INF/spring/appServlet/test-context.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/spring/root-context.xml b/src/main/webapp/WEB-INF/spring/root-context.xml index f6233a6..8fbb72d 100644 --- a/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/src/main/webapp/WEB-INF/spring/root-context.xml @@ -13,27 +13,13 @@ + - - - - - - - - - - + + + + @@ -47,7 +33,6 @@ - @@ -61,8 +46,8 @@ - - + + @@ -71,8 +56,8 @@ - - + + true diff --git a/src/main/webapp/WEB-INF/spring/security-context.xml b/src/main/webapp/WEB-INF/spring/security-context.xml index 741a6e1..cf74171 100644 --- a/src/main/webapp/WEB-INF/spring/security-context.xml +++ b/src/main/webapp/WEB-INF/spring/security-context.xml @@ -9,36 +9,26 @@ - - + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/tiles.xml b/src/main/webapp/WEB-INF/tiles.xml index a0765ba..10163cf 100644 --- a/src/main/webapp/WEB-INF/tiles.xml +++ b/src/main/webapp/WEB-INF/tiles.xml @@ -14,9 +14,28 @@ + + + + + + + + + + + + + + + + + + - - - - + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/admin/board/board_faq.jsp b/src/main/webapp/WEB-INF/views/admin/board/board_faq.jsp new file mode 100644 index 0000000..16fbf4b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/board_faq.jsp @@ -0,0 +1,177 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +
+ +
+

FAQ

+
+ +
+
+
+
+
+

FAQ 리스트

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
글번호분류내용action
${item.bno }${item.category } + ${item.content } + + + +
+
+ + + +
+ +
+
+
+ +
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/admin/board/board_notice.jsp b/src/main/webapp/WEB-INF/views/admin/board/board_notice.jsp new file mode 100644 index 0000000..461b42b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/board_notice.jsp @@ -0,0 +1,121 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +
+ +
+

공지사항

+
+ +
+
+
+
+
+

공지사항 리스트

+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
번호제목작성자날짜조회수
${item.bno} + ${item.title} + 관리자 + + ${item.viewcnt}
+
+ + + +
+ +
+ +
+ +
+ +
+ diff --git a/src/main/webapp/WEB-INF/views/admin/board/board_qna.jsp b/src/main/webapp/WEB-INF/views/admin/board/board_qna.jsp new file mode 100644 index 0000000..e028f90 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/board_qna.jsp @@ -0,0 +1,115 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +
+ +
+

Q&A

+
+
+
+
+
+
+

Q&A 리스트

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
번호분류제목작성자날짜조회수
${qna.bno}${qna.category}${qna.title}${qna.username} + + ${qna.viewcnt}
+
+ + + +
+ +
+ +
+ +
+ +
+ diff --git a/src/main/webapp/WEB-INF/views/admin/board/faqWrite.jsp b/src/main/webapp/WEB-INF/views/admin/board/faqWrite.jsp new file mode 100644 index 0000000..aff9cec --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/faqWrite.jsp @@ -0,0 +1,81 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + +
+ +
+

FAQ

+
+ +
+
+
+
+
+

FAQ 작성

+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
질문:
분류: + +
답변: + +
+ + + +
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/views/admin/board/noticeDetail.jsp b/src/main/webapp/WEB-INF/views/admin/board/noticeDetail.jsp new file mode 100644 index 0000000..8746ce9 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/noticeDetail.jsp @@ -0,0 +1,94 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + +
+ +
+

공지사항

+
+ +
+
+
+
+
+
+ + +
+
+ + +
+
+ +
+ ${notice.content} +
+
+
+ + +
+
+
+
+
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/admin/board/noticeWrite.jsp b/src/main/webapp/WEB-INF/views/admin/board/noticeWrite.jsp new file mode 100644 index 0000000..d303d0b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/noticeWrite.jsp @@ -0,0 +1,71 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + +
+ +
+

공지사항게시판

+
+ +
+
+
+
+
+

공지사항 작성

+
+ +
+
+ + + + + + + + + + + + + + + +
제목:
내용: + +
+ + + +
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/views/admin/board/qnaDetail.jsp b/src/main/webapp/WEB-INF/views/admin/board/qnaDetail.jsp new file mode 100644 index 0000000..7ac58f6 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/qnaDetail.jsp @@ -0,0 +1,106 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + +
+ +
+

Q&A

+
+ +
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ ${qna.content} +
+
+
+ + + +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/admin/board/qnaWrite.jsp b/src/main/webapp/WEB-INF/views/admin/board/qnaWrite.jsp new file mode 100644 index 0000000..8aebd9c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/board/qnaWrite.jsp @@ -0,0 +1,110 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + +
+ +
+

Q&A 답변하기

+
+ +
+
+ +
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ ${qna.content} +
+
+
+ + +
+
+
+
+ +
+
+
+
+
+

답변하기

+
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
제목:
답변: +
+ + + +
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/views/admin/grade/gradeList.jsp b/src/main/webapp/WEB-INF/views/admin/grade/gradeList.jsp new file mode 100644 index 0000000..f14ed18 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/grade/gradeList.jsp @@ -0,0 +1,70 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + +
+ +
+

Grade 리스트

+
+ +
+
+
+
+
+

Grade 리스트

+ + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + +
idxgradepoint_ratiobuy_termminmaxetc
자료가 없습니다.
+ +
+
+ +
+ +
+ +
+ +
+ +
+ diff --git a/src/main/webapp/WEB-INF/views/admin/item/addItem.jsp b/src/main/webapp/WEB-INF/views/admin/item/addItem.jsp new file mode 100644 index 0000000..d155240 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/item/addItem.jsp @@ -0,0 +1,75 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + +
+ +
+

Add Item

+
+ + +
+
+ +
+ +
+
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+ +
+ +
+ +
+ +
+ + diff --git a/src/main/webapp/WEB-INF/views/admin/item/itemList.jsp b/src/main/webapp/WEB-INF/views/admin/item/itemList.jsp new file mode 100644 index 0000000..bab4844 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/item/itemList.jsp @@ -0,0 +1,204 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + + +
+ +
+

Item 리스트

+
+ +
+
+
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
productIdproductNameitemIdoriginalPricesalePricecolorsizestockact
자료가 없습니다.
${list.productid}${list.productname}${list.itemid}${list.originalprice}${list.saleprice}${list.color}${list.size}${list.stock} +
+
+ + + +
+ +
+ +
+ +
+ +
+ + diff --git a/src/main/webapp/WEB-INF/views/admin/item/modifyItem.jsp b/src/main/webapp/WEB-INF/views/admin/item/modifyItem.jsp new file mode 100644 index 0000000..d347438 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/item/modifyItem.jsp @@ -0,0 +1,75 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + +
+ +
+

Modify Item

+
+ + +
+
+ +
+ +
+
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+ +
+ +
+ +
+ +
+ + diff --git a/src/main/webapp/WEB-INF/views/admin/login/login.jsp b/src/main/webapp/WEB-INF/views/admin/login/login.jsp new file mode 100644 index 0000000..34baf97 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/login/login.jsp @@ -0,0 +1,94 @@ + + + + + + AdminLTE 2 | Log in + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/admin/loginAdmin.jsp b/src/main/webapp/WEB-INF/views/admin/loginAdmin.jsp new file mode 100644 index 0000000..9d4e18e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/loginAdmin.jsp @@ -0,0 +1,80 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> + + + + + + ADMIN LOGIN + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/admin/main/base.jsp b/src/main/webapp/WEB-INF/views/admin/main/base.jsp new file mode 100644 index 0000000..9a90721 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/main/base.jsp @@ -0,0 +1,19 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +
+ +
+

+ uStyle 관리자 페이지 +

+
+ + +
+ +
+ +
+ + diff --git a/src/main/webapp/WEB-INF/views/admin/pin/pinBoardList.jsp b/src/main/webapp/WEB-INF/views/admin/pin/pinBoardList.jsp new file mode 100644 index 0000000..192d176 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/pin/pinBoardList.jsp @@ -0,0 +1,148 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + +
+ +
+

PinBoard 리스트

+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
pinboardnocreate usernamepinboardnamecreate_timecontentlikecntact
${list.pinboardno}${list.username}${list.pinboardname} + + ${list.content}${list.likecnt } + +
+
+ + + +
+ +
+ +
+ + +
+ +
+ + diff --git a/src/main/webapp/WEB-INF/views/admin/product/addProduct.jsp b/src/main/webapp/WEB-INF/views/admin/product/addProduct.jsp new file mode 100644 index 0000000..985fbc1 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/product/addProduct.jsp @@ -0,0 +1,196 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + +
+ +
+

Add Product

+
+ + +
+
+ +
+ +
+
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ + + +
+
+ +
+ +
+ +
+ +
+ + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/admin/product/modifyProduct.jsp b/src/main/webapp/WEB-INF/views/admin/product/modifyProduct.jsp new file mode 100644 index 0000000..1b89045 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/product/modifyProduct.jsp @@ -0,0 +1,220 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> + + + +
+ +
+

Modify Product

+
+ + +
+
+ +
+ +
+
+
+ + +
+ + + + + + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ + + +
+
+ +
+ +
+ +
+ +
+ + + + + + + diff --git a/src/main/webapp/WEB-INF/views/admin/product/productList.jsp b/src/main/webapp/WEB-INF/views/admin/product/productList.jsp new file mode 100644 index 0000000..a668d36 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/product/productList.jsp @@ -0,0 +1,140 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> + + +
+ +
+

Product 리스트

+
+ +
+
+
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
productIdpictureproductNamebrandcategorysubcategorydescriptionoriginalpricesalepriceact
${list.productid} + ${list.productname}${list.brand}${list.category}${list.subcategory}${list.description}${list.originalprice}${list.saleprice}
+
+ + + +
+ +
+ +
+ +
+ +
+ diff --git a/src/main/webapp/WEB-INF/views/admin/product/readProduct.jsp b/src/main/webapp/WEB-INF/views/admin/product/readProduct.jsp new file mode 100644 index 0000000..31c0864 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/product/readProduct.jsp @@ -0,0 +1,260 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + +
+ +
+

상품 정보

+
+ + +
+
+ +
+ +
+
+
+ +
+ + + + + + +
+ +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
    + +
    + +
    + +
    + +
    + +
    + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/admin/sales/salesDetail.jsp b/src/main/webapp/WEB-INF/views/admin/sales/salesDetail.jsp new file mode 100644 index 0000000..dca143c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/sales/salesDetail.jsp @@ -0,0 +1,157 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + +
    + +
    +

    매출 상세내역

    +
    + +
    +
    +
    +
    +
    +

    매출 상세내역

    +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    상품명색상사이즈정상가격(원)판매가격(원)수량(개)합계(원)
    ${salesDetail.productname}${salesDetail.color}${salesDetail.size}${salesDetail.count}
    +
    + +
    + +
    + +
    + + +
    + +
    + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/admin/sales/salesList.jsp b/src/main/webapp/WEB-INF/views/admin/sales/salesList.jsp new file mode 100644 index 0000000..f0b4eac --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/sales/salesList.jsp @@ -0,0 +1,219 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + +
    + +
    +

    매출내역

    +
    + +
    +
    +
    +
    +
    +

    매출내역

    +
    + +
    +
    + + +
    +
    +         + +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    구매일자구매자총 구매가격사용 포인트act
    자료가 없습니다.
    ${sales.purchasedate}${sales.username}${sales.usedpoint} Point + 상세내역 조회 +
    +
    + + + + + +
    + +
    + +
    + + +
    + +
    + + + diff --git a/src/main/webapp/WEB-INF/views/admin/sales/salesListFail.jsp b/src/main/webapp/WEB-INF/views/admin/sales/salesListFail.jsp new file mode 100644 index 0000000..34c2d6f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/sales/salesListFail.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> + + + + + + +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/admin/user/userList.jsp b/src/main/webapp/WEB-INF/views/admin/user/userList.jsp new file mode 100644 index 0000000..4f48c25 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/user/userList.jsp @@ -0,0 +1,205 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + +
    + +
    +

    회원 리스트

    +
    + +
    +
    +
    +
    +
    +

    회원리스트

    + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    username / realnameemailphonepointauthaddresscreate_timeact
    ${list.username} ${list.realname}${list.email}${list.phone}${list.point}${ list.auth == 'y' }${list.addr1} ${list.addr2} ${list.postcode} + + + + +
    +
    + + + +
    + +
    + +
    + + +
    + +
    + + diff --git a/src/main/webapp/WEB-INF/views/board/board_faq.jsp b/src/main/webapp/WEB-INF/views/board/board_faq.jsp new file mode 100644 index 0000000..30a9b4b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/board_faq.jsp @@ -0,0 +1,154 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +
    +
    + +
    +

    + + + +

    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    글번호분류내용
    ${item.bno }${item.category } ${item.content }
    +
    + +
    +
    +
      + + + + + + + + + + + + + +
    • 이전
    • +
      + + + + + + + + + + + + + +
    • '> + ${idx} +
    • + +
      + + + + + + + + + + + + + +
    • 다음
    • +
      +
    +
    +
    +
    + +
    +
    +
    +
    +
    + +
    + +
    + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/board/board_notice.jsp b/src/main/webapp/WEB-INF/views/board/board_notice.jsp new file mode 100644 index 0000000..8fa3e3d --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/board_notice.jsp @@ -0,0 +1,168 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + +
    +
    + +
    +

    + + + +

    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    번호제목작성자날짜조회수
    + ${item.bno } + ${item.title }관리자 + ${item.viewcnt }
    + 요청하신 자료가 존재하지 않습니다. +
    +
    + +
    +
    + +
    +
    +
      + + + + + + + + + + + + + +
    • 이전
    • +
      + + + + + + + + + + + + + +
    • '> + ${idx} +
    • +
      + + + + + + + + + + + + + +
    • 다음
    • +
      +
    +
    +
    +
    + +
    +
    +
    +
    +
    + +
    + +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/board/board_qna.jsp b/src/main/webapp/WEB-INF/views/board/board_qna.jsp new file mode 100644 index 0000000..84a2959 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/board_qna.jsp @@ -0,0 +1,162 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + + +
    +
    +
    +

    + + + +

    +
    + +
    +
    +
    +
    +
    +
    +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    번호분류제목작성자날짜조회수
    ${qna.bno}${qna.category}${qna.title}${qna.username} + + ${qna.viewcnt}
    + 요청하신 자료가 존재하지 않습니다. +
    +
    + +
    +
    + +
    +
    +
      + + + + + + + + + + + + + +
    • 이전
    • +
      + + + + + + + + + + + + + +
    • '> + ${idx} +
    • + +
      + + + + + + + + + + + + + +
    • 다음
    • +
      +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/board/myQnaDetail.jsp b/src/main/webapp/WEB-INF/views/board/myQnaDetail.jsp new file mode 100644 index 0000000..18d2dc0 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/myQnaDetail.jsp @@ -0,0 +1,121 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +

    My Q&A

    +
    +

    질문과 답변

    +
      +
    • + +
      + +
      +
    • +
    • + +
      + +
      +
    • +
    • + +
      + +
      +
    • +
    • + +
      + ${qna.content} +
      +
    • +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + <%@ include file="/WEB-INF/views/include/sidemenu.jspf" %> +
    +
    +
    + +
    +
    +
    +
    + + diff --git a/src/main/webapp/WEB-INF/views/board/myQnaDetailError.jsp b/src/main/webapp/WEB-INF/views/board/myQnaDetailError.jsp new file mode 100644 index 0000000..3900dd2 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/myQnaDetailError.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ page session="false"%> + + + + + + +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/board/myQnaList.jsp b/src/main/webapp/WEB-INF/views/board/myQnaList.jsp new file mode 100644 index 0000000..6b50337 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/myQnaList.jsp @@ -0,0 +1,161 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +

    My Q&A List

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    번호분류제목날짜조회수
    ${qna.bno}${qna.category}${qna.title} + + ${qna.viewcnt}
    + 작성한 Q&A가 없습니다. +
    +
    + +
    +
    + +
    + + + + + + + + +
    + +
      + + + + + + + + + + + + + +
    • 이전
    • +
      + + + + + + + + + + + + + +
    • '> + ${idx} +
    • + +
      + + + + + + + + + + + + + +
    • 다음
    • +
      +
    +
    +
    +
    +
    +
    + + <%@ include file="/WEB-INF/views/include/sidemenu.jspf" %> +
    +
    +
    +
    +
    +
    + +
    + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/board/noticeDetail.jsp b/src/main/webapp/WEB-INF/views/board/noticeDetail.jsp new file mode 100644 index 0000000..33067ac --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/noticeDetail.jsp @@ -0,0 +1,44 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +
    +
    +
    +
    +
    +
    +

    Notice

    +
    +
    +

    공지사항

    +
      +
    • + +
      + +
      +
    • +
    • + +
      + ${notice.content} +
      +
    • +
    +
    +
    + + + + + + + + +
    +
    +
    +
    +
    + +
    diff --git a/src/main/webapp/WEB-INF/views/board/qnaDetail.jsp b/src/main/webapp/WEB-INF/views/board/qnaDetail.jsp new file mode 100644 index 0000000..e1ce264 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/qnaDetail.jsp @@ -0,0 +1,54 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +
    +
    +
    +
    +
    +
    +

    Q&A

    +
    +

    질문과 답변

    +
      +
    • + +
      + +
      +
    • +
    • + +
      + +
      +
    • +
    • + +
      + +
      +
    • +
    • + +
      + ${qna.content} +
      +
    • +
    +
    + + + + + + + + +
    +
    +
    +
    +
    + +
    diff --git a/src/main/webapp/WEB-INF/views/board/qnaModify.jsp b/src/main/webapp/WEB-INF/views/board/qnaModify.jsp new file mode 100644 index 0000000..72946c2 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/qnaModify.jsp @@ -0,0 +1,127 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +

    Q&A 수정

    +
    + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    제목:
    분류: + +
    내용: +
    + + + +
    +
    +
    +
    +
    + + <%@ include file="/WEB-INF/views/include/sidemenu.jspf" %> +
    +
    +
    +
    +
    +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/board/qnaWrite.jsp b/src/main/webapp/WEB-INF/views/board/qnaWrite.jsp new file mode 100644 index 0000000..435cc6f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/board/qnaWrite.jsp @@ -0,0 +1,113 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +

    Q&A 작성

    +
    + +
    + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + +
    제목:
    분류: + +
    내용: +
    + + + +
    +
    +
    +
    +
    + + <%@ include file="/WEB-INF/views/include/sidemenu.jspf" %> +
    +
    +
    +
    +
    +
    + +
    + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cart/addtoCartFail.jsp b/src/main/webapp/WEB-INF/views/cart/addtoCartFail.jsp new file mode 100644 index 0000000..76d2b67 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cart/addtoCartFail.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> + + + + + + +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cart/viewCart.jsp b/src/main/webapp/WEB-INF/views/cart/viewCart.jsp new file mode 100644 index 0000000..640edc2 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cart/viewCart.jsp @@ -0,0 +1,300 @@ +<%@ page pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Shopping Cart

    +
      +
    • + +
    • +
    +
    +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Product NameCategoryUnit Price + QtySubtotal
    + + + +
    +
    Remove item + ${userCartInfo.productname } + +
    + +
    +

    ${userCartInfo.productname }

    +

    Brand : ${userCartInfo.brand} / Color : ${userCartInfo.color} / Size: ${userCartInfo.size}

    +
    ${userCartInfo.subcategory} + + +
    +
    + +
    + +
    + +
    +
    +
    +
    + 장바구니에 담겨있는 상품이 없습니다. +
    +
    +
    +
    + +
    + +
    +
    +

    Order Total(3만원 이상 무료배송)

    +
    + + + + + + + + + + + + + + + + + + + +
    Grand Total + +
    Subtotal +
    Delivery Fee + +
    +
      +
    • + +
    • +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + diff --git a/src/main/webapp/WEB-INF/views/checkout/checkout.jsp b/src/main/webapp/WEB-INF/views/checkout/checkout.jsp new file mode 100644 index 0000000..944db29 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/checkout/checkout.jsp @@ -0,0 +1,411 @@ +<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + +
    + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + + + + + +
    +
    +
    +
    +
    +

    Checkout

    +
    +
      +
    1. + +
      + + + + + + + + + + + + + + + + + + + + + + + + + +
      Product NameBrandColorSizeUnit PriceQtySubtotal

      ${userSelectedItemid.productname}

      ${userSelectedItemid.brand}

      ${userSelectedItemid.color}

      ${userSelectedItemid.size}

      ${userSelectedItemid.totalcount}

      +
      +
      +
      + + + + + + + + + + + + + +
      Point ${point} +
       Point 사용 +
      +
      + +
      +
      +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Grand Total + +
      Subtotal +
      Delivery Fee + +
      Total + +
      Use Point + +
      +
      +
      +
      +
      +
    2. +
    3. +
      +
      1 +

      Billing Information

      +
      +
      +
      +
      +
        +
      • +
        + +
          +
        • +
          +
          + +
          + +
          +
          +
          +
        • +
        • + +
          + +
          +
        • +
        • +
          + +
          +
        • +
        • +
          + +
          + +
          +
          +
        • +
        • +
          + +
          + +
          +
          +
        • +
        • + +
        • +
        + + +
        +
      • +
      • + + +
      • +
      +
      +
      +
    4. +
    5. +
      +
      2 +

      Shipping Information

      +
      +
      +
      +
        +
      • +
        + +
          +
        • +
          +
          + +
          + +
          +
          +
          +
        • +
        • +
          +        + +
          + +
          +
          +
        • +
        • + +
          + +
          +
        • +
        • +
          + +
          +
        • +
        • +
          + +
          + +
          +
          +
        • +
        • + +
        • +
        +
        +
      • +
      +
      +

      * Required Fields

      + + +
      +
      +
    6. +
    +
    +
    +
    +
    +
    +
    Your Checkout Progress +
    +
    +
    +
    Billing Address
    +
    +
    Shipping Address
    +
    +
    Shipping Method
    +
    +
    Payment Method
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + + diff --git a/src/main/webapp/WEB-INF/views/checkout/checkoutFail.jsp b/src/main/webapp/WEB-INF/views/checkout/checkoutFail.jsp new file mode 100644 index 0000000..b027d0c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/checkout/checkoutFail.jsp @@ -0,0 +1,31 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> + + + + + + +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/checkout/checkoutSuccess.jsp b/src/main/webapp/WEB-INF/views/checkout/checkoutSuccess.jsp new file mode 100644 index 0000000..175b50d --- /dev/null +++ b/src/main/webapp/WEB-INF/views/checkout/checkoutSuccess.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> + + + + + + +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/error/errorCommon.jsp b/src/main/webapp/WEB-INF/views/error/errorCommon.jsp new file mode 100644 index 0000000..bb5251d --- /dev/null +++ b/src/main/webapp/WEB-INF/views/error/errorCommon.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> + + + + + + +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/include/footer.jsp b/src/main/webapp/WEB-INF/views/include/footer.jsp index 160a576..11bc255 100644 --- a/src/main/webapp/WEB-INF/views/include/footer.jsp +++ b/src/main/webapp/WEB-INF/views/include/footer.jsp @@ -1,6 +1,6 @@ <%@ page pageEncoding="UTF-8"%> - + <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> @@ -17,7 +17,7 @@
    -
    +

    @@ -26,31 +26,20 @@

    - Skort Maison Martin Margiela knot ponytail cami texture - as tucked t-shirt. Black skirt razor pleats - plaited gold collar. Crop 90s spearmint indigo seam - luxe washed out. + uStyle +

    +

    + Tel. 010) 0000-1111 +

    +

    + E-mail. ustyle11111@gmail.com

    -
    + -
    +

    @@ -98,24 +67,7 @@

    @@ -136,26 +88,10 @@
    -
    -
    diff --git a/src/main/webapp/WEB-INF/views/include/footerAdmin.jsp b/src/main/webapp/WEB-INF/views/include/footerAdmin.jsp new file mode 100644 index 0000000..9360a97 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/include/footerAdmin.jsp @@ -0,0 +1,5 @@ +<%@ page pageEncoding="UTF-8"%> + +
    + Copyright © 2017 uStyle. All rights reserved. +
    diff --git a/src/main/webapp/WEB-INF/views/include/header.jsp b/src/main/webapp/WEB-INF/views/include/header.jsp index db457ad..20686f2 100644 --- a/src/main/webapp/WEB-INF/views/include/header.jsp +++ b/src/main/webapp/WEB-INF/views/include/header.jsp @@ -1,11 +1,37 @@ <%@ page pageEncoding="UTF-8"%> - - + + + <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> <%@ include file="/WEB-INF/views/include/include-header.jspf" %> + + +
    @@ -13,8 +39,10 @@ @@ -22,12 +50,12 @@