diff --git a/src/main/java/com/kh/samdado/admin/controller/AdminController.java b/src/main/java/com/kh/samdado/admin/controller/AdminController.java index ccba1979..543311d6 100644 --- a/src/main/java/com/kh/samdado/admin/controller/AdminController.java +++ b/src/main/java/com/kh/samdado/admin/controller/AdminController.java @@ -518,13 +518,15 @@ public String sendAboard(A_board aboard, Model model) { int insertAboard = aService.insertAboard(aboard); // -- 은솔 : news에 새로운 공지사항 넣기 - // 1. bno 찾아오기 - int findBno = mService.findNewBno(aboard); +// // 1. bno 찾아오기 +// int findBno = mService.findNewBno(aboard); - aboard.setBno(findBno); - int insertNews = mService.insertNewBoard(aboard); - - if (insertAboard > 0 && insertNews > 0) { +// aboard.setBno(findBno); +// int insertNews = mService.insertNewBoard(aboard); + + int insertNewsUser = mService.updateNewUserNews(aboard); + + if (insertAboard > 0 && insertNewsUser > 0) { //System.out.println("insertAboard 결과 : " + insertAboard); model.addAttribute("msg", "공지글 등록에 성공하였습니다."); return "redirect:/admin/home"; diff --git a/src/main/java/com/kh/samdado/admin/model/vo/A_board.java b/src/main/java/com/kh/samdado/admin/model/vo/A_board.java index b1a1ad31..dae0c5ed 100644 --- a/src/main/java/com/kh/samdado/admin/model/vo/A_board.java +++ b/src/main/java/com/kh/samdado/admin/model/vo/A_board.java @@ -30,5 +30,5 @@ public class A_board { private String bstatus; private String usno; private String uspart; - + private int usnews; } diff --git a/src/main/java/com/kh/samdado/business/controller/businessController.java b/src/main/java/com/kh/samdado/business/controller/businessController.java index 0b6e27c5..1492bc65 100644 --- a/src/main/java/com/kh/samdado/business/controller/businessController.java +++ b/src/main/java/com/kh/samdado/business/controller/businessController.java @@ -1084,7 +1084,15 @@ public ModelAndView carList(ModelAndView mv) { } List carList = bService.selectCarList(); - + List reviewList = bService.selectReviewList(); + for(Business t : carList) { + for(Review r : reviewList) { + if(t.getBus_code() == r.getBus_code()) { + t.setAvstar(r.getAvstar()); + t.setRevcnt(r.getRevcnt()); + } + } + } if(carList != null) { mv.addObject("carList", carList); mv.setViewName("business/rentcar/car_list"); @@ -1095,10 +1103,10 @@ public ModelAndView carList(ModelAndView mv) { // 예약결제 성공 시 insert @GetMapping("/pay") - public String payBtn(@ModelAttribute Income i, @ModelAttribute Booking b, @ModelAttribute Point p, int bus_code) { + public String payBtn(@ModelAttribute Income i, @ModelAttribute Booking b, @ModelAttribute Point p, int bus_code, User u) { // 포인트에 amount 넣어주기 - p.setPamount(i.getAmount()); + p.setPamount(i.getAmount() * 9/10); // income에 들어갈 원가 10퍼센트 셋팅 i.setAmount(i.getAmount() * 1/10); @@ -1119,7 +1127,12 @@ public String payBtn(@ModelAttribute Income i, @ModelAttribute Booking b, @Model p.setPbalance(i.getAmount() * 9); } // 포인트 넣기 - int point = bService.insertPoint(p); + int point = bService.insertPoint(p); + + // User테이블 pbalance에 추가하기 + u.setUsno(selectUser.getUs_no()); + u.setPbalance(p.getPbalance()); + int userPbalance = bService.updateUserPblance(u); // 예약정보 insert if(b.getBookingLv() == 1) { @@ -1196,6 +1209,15 @@ public List starList(HttpServletResponse response, @RequestParam Strin //System.out.println(starList); return starList; + } + @RequestMapping(value="starList2", method=RequestMethod.POST) + @ResponseBody + public List starList2(HttpServletResponse response, @RequestParam String kinds) { + + List starList2 = bService.starList2(); + //System.out.println(starList); + return starList2; + } @RequestMapping(value="reviewList", method=RequestMethod.POST) @@ -1208,6 +1230,16 @@ public List reviewList(HttpServletResponse response, @RequestParam Str } + @RequestMapping(value="reviewList2", method=RequestMethod.POST) + @ResponseBody + public List reviewList2(HttpServletResponse response, @RequestParam String kinds) { + + List reviewList2 = bService.reviewList2(); + + return reviewList2; + + } + //찜하기 ajax받기 @RequestMapping("/jjim") @ResponseBody diff --git a/src/main/java/com/kh/samdado/business/model/dao/businessDao.java b/src/main/java/com/kh/samdado/business/model/dao/businessDao.java index 9584882d..b875feaa 100644 --- a/src/main/java/com/kh/samdado/business/model/dao/businessDao.java +++ b/src/main/java/com/kh/samdado/business/model/dao/businessDao.java @@ -136,6 +136,8 @@ public interface businessDao { int insertPoint(Point p); public Point findPoint(Point p); + + int updateUserPblance(User u); // 비즈니스 등록 폼, 본인이 등록한 사업장 셀렉 List selectMyBusinessCategory(User loginUser); @@ -186,8 +188,10 @@ public interface businessDao { List selectReviewList(); List starList(); + List starList2(); List reviewList(); + List reviewList2(); List facList(String kind); @@ -211,6 +215,8 @@ public interface businessDao { + + diff --git a/src/main/java/com/kh/samdado/business/model/dao/businessDaoImpl.java b/src/main/java/com/kh/samdado/business/model/dao/businessDaoImpl.java index fe9e3e8a..b7786db2 100644 --- a/src/main/java/com/kh/samdado/business/model/dao/businessDaoImpl.java +++ b/src/main/java/com/kh/samdado/business/model/dao/businessDaoImpl.java @@ -260,6 +260,11 @@ public int insertPoint(Point p) { public Point findPoint(Point p) { return sqlSession.selectOne("businessMapper.findPoint", p); } + + @Override + public int updateUserPblance(User u) { + return sqlSession.update("businessMapper.updateUserPblance", u); + } @Override public List businessSearch() { @@ -441,12 +446,22 @@ public List starList() { // TODO Auto-generated method stub return sqlSession.selectList("businessMapper.starList"); } + @Override + public List starList2() { + // TODO Auto-generated method stub + return sqlSession.selectList("businessMapper.starList2"); + } @Override - public List reviewList( ) { + public List reviewList() { // TODO Auto-generated method stub return sqlSession.selectList("businessMapper.reviewList"); } + @Override + public List reviewList2( ) { + // TODO Auto-generated method stub + return sqlSession.selectList("businessMapper.reviewList2"); + } @Override public List facList(String kind) { @@ -467,5 +482,7 @@ public List rescateList(String kind) { + + } diff --git a/src/main/java/com/kh/samdado/business/model/service/businessService.java b/src/main/java/com/kh/samdado/business/model/service/businessService.java index 65c87e48..aac7082c 100644 --- a/src/main/java/com/kh/samdado/business/model/service/businessService.java +++ b/src/main/java/com/kh/samdado/business/model/service/businessService.java @@ -137,6 +137,8 @@ public interface businessService { int insertPoint(Point p); public Point findPoint(Point p); + + int updateUserPblance(User u); // 배너 광고 등록 폼, 본인 사업장 가져오기 List selectMyBusinessCategory(User loginUser); @@ -180,8 +182,10 @@ public interface businessService { List selectReviewList(); List starList(); + List starList2(); List reviewList(); + List reviewList2(); List facList(String kind); @@ -215,6 +219,8 @@ public interface businessService { + + diff --git a/src/main/java/com/kh/samdado/business/model/service/businessServiceImpl.java b/src/main/java/com/kh/samdado/business/model/service/businessServiceImpl.java index 1e793747..6c1d006c 100644 --- a/src/main/java/com/kh/samdado/business/model/service/businessServiceImpl.java +++ b/src/main/java/com/kh/samdado/business/model/service/businessServiceImpl.java @@ -255,6 +255,11 @@ public Point findPoint(Point p) { // TODO Auto-generated method stub return bDao.findPoint(p); } + + @Override + public int updateUserPblance(User u) { + return bDao.updateUserPblance(u); + } // 지혜 @Override @@ -409,18 +414,28 @@ public List selectReviewList() { // TODO Auto-generated method stub return bDao.selectReviewList(); } - + @Override public List starList() { // TODO Auto-generated method stub return bDao.starList(); } + @Override + public List starList2() { + // TODO Auto-generated method stub + return bDao.starList2(); + } @Override public List reviewList() { // TODO Auto-generated method stub return bDao.reviewList(); } + @Override + public List reviewList2() { + // TODO Auto-generated method stub + return bDao.reviewList2(); + } @Override public List facList(String kind) { @@ -451,6 +466,8 @@ public List rescateList(String kind) { + + diff --git a/src/main/java/com/kh/samdado/business/model/vo/Jjim.java b/src/main/java/com/kh/samdado/business/model/vo/Jjim.java index 7472e5cb..20138503 100644 --- a/src/main/java/com/kh/samdado/business/model/vo/Jjim.java +++ b/src/main/java/com/kh/samdado/business/model/vo/Jjim.java @@ -49,6 +49,7 @@ public class Jjim { private String bus_opening; private String hotel_facility; private String usname; // user 테이블 조인 + private String avstar; //BUSINNESS_ATT JOINs private String file_rename; // 리네임 diff --git a/src/main/java/com/kh/samdado/business/model/vo/Review.java b/src/main/java/com/kh/samdado/business/model/vo/Review.java index 9fdb345c..ee105389 100644 --- a/src/main/java/com/kh/samdado/business/model/vo/Review.java +++ b/src/main/java/com/kh/samdado/business/model/vo/Review.java @@ -65,6 +65,7 @@ US_NO VARCHAR2(15 BYTE) private Date c_booking_trv; private int rent_no; private int c_bus_code; + private Date c_booking_trvEnd; private int r_booking_no; private String r_bus_name; @@ -78,6 +79,7 @@ US_NO VARCHAR2(15 BYTE) private Date r_booking_trv; private int room_no; private int r_bus_code; + private Date r_booking_trvEnd; private int t_booking_no; // 예약번호 private String t_bus_name; // 사업장이름 diff --git a/src/main/java/com/kh/samdado/business/model/vo/business/Business.java b/src/main/java/com/kh/samdado/business/model/vo/business/Business.java index f1dd02db..8b8e934b 100644 --- a/src/main/java/com/kh/samdado/business/model/vo/business/Business.java +++ b/src/main/java/com/kh/samdado/business/model/vo/business/Business.java @@ -95,5 +95,6 @@ public class Business { private String avstar; private String revcnt; + private int avgstar; } diff --git a/src/main/java/com/kh/samdado/mypage/controller/MypageController.java b/src/main/java/com/kh/samdado/mypage/controller/MypageController.java index 45692dd0..e36c9eb4 100644 --- a/src/main/java/com/kh/samdado/mypage/controller/MypageController.java +++ b/src/main/java/com/kh/samdado/mypage/controller/MypageController.java @@ -11,7 +11,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import javax.websocket.Session; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; @@ -29,6 +28,7 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import com.kh.samdado.admin.model.vo.A_board; import com.kh.samdado.business.model.vo.Jjim; import com.kh.samdado.business.model.vo.Review; import com.kh.samdado.business.model.vo.business.Business; @@ -40,6 +40,7 @@ import com.kh.samdado.mypage.model.vo.ApplyPageInfo; import com.kh.samdado.mypage.model.vo.ApplyPagination; import com.kh.samdado.mypage.model.vo.Booking; +import com.kh.samdado.mypage.model.vo.MpBoardPagination; import com.kh.samdado.mypage.model.vo.Point; import com.kh.samdado.mypage.model.vo.QnA; import com.kh.samdado.mypage.model.vo.RouteMP; @@ -71,10 +72,36 @@ public int findNew(@RequestBody User u){ // --은솔 : 새로운 알림 있는지 확인하기 int newNews = mService.findNewNews(u); //System.out.println("mpcontroller newNews : " + newNews); + //int newBoardNews = mService.findNewUserNews(u); + int userNews = u.getUsnews(); + + //System.out.println(newNews); + //System.out.println(userNews); + + + if(newNews > 0 || userNews > 0) { + return 1; + } else { + return 0; + } + + + } + + @RequestMapping("/usernew") + @ResponseBody + public int findNewAlert(@RequestBody User u){ + + //System.out.println("User확인 : " + u); + // --은솔 : 새로운 알림 있는지 확인하기 + //int newNews = mService.findNewUserNews(u); + //System.out.println("mpcontroller newNews : " + newNews); + int newNews = u.getUsnews(); return newNews; } + // 제휴회원 마이페이지로 이동 @GetMapping("/buserinfo") public String mypageBuserFirstView() { @@ -332,6 +359,7 @@ public ModelAndView selectAdvertList(ModelAndView mv, List chartDataList = mService.selectAlliChartList(usno); //System.out.println(chartDataList); + mv.addObject("api", api); mv.addObject("allList", allList); mv.addObject("applyList", applyList); @@ -351,12 +379,23 @@ public ModelAndView selectAlertList(ModelAndView mv, User u = (User) session.getAttribute("loginUser"); + // 공지사항 갯수 구하기 + int boardListCount = mService.selectBoardListCount(u.getUspart()); + //System.out.println("공지사항 전체 글 갯수 확인 : " + boardListCount); + + // 요청 페이지에 맞는 게시글 리스트 조회 + ApplyPageInfo api = MpBoardPagination.getApplyPageInfo(currentPage, boardListCount); + // DB에서 가져와야 할 알림 내역들 : 문의하기, 신고 받은 내역, 포인트 충전 알림, 배너광고 신청, 승인, 반려(사유), 포인트 얼마 안남음 // 안읽은 리스트 List alertNList = mService.selectAlertList(u); // 읽은 리스트 List alertYList = mService.selectYAlertList(u); + // 공지사항 + List alertBoard = mService.selectBoard(u, api); + mv.addObject("api", api); + mv.addObject("alertBoard", alertBoard); mv.addObject("alertNList", alertNList); mv.addObject("alertYList", alertYList); mv.setViewName("mypage/mp_news"); @@ -377,6 +416,7 @@ public List selectNewAlertList(@RequestBody User user, // 읽은 리스트 List alertYList = mService.selectYAlertList(u); + // 두개의 리스트 합치기 List newDataList = new ArrayList<>(); @@ -385,7 +425,7 @@ public List selectNewAlertList(@RequestBody User user, newDataList.addAll(alertNList); newDataList.addAll(alertYList); - //System.out.println(newDataList); + System.out.println(newDataList); return newDataList; @@ -404,8 +444,8 @@ public Alert findDetailNews(@RequestBody Alert al) { // 2. 읽음으로 처리해주기 int result = mService.updateNstatus(al); - - if(deAlert != null) { + System.out.println(result); + if(deAlert != null && result > 0) { return deAlert; } else { return null; @@ -424,17 +464,10 @@ public ModelAndView mypageUserFirstView(ModelAndView mv, //System.out.println(user); - List alertNList = mService.selectAlertList(user); - // 읽은 리스트 - List alertYList = mService.selectYAlertList(user); - - //System.out.println(alertNList); - //System.out.println(alertYList); + // 공지사항 + List alertBoard = mService.selectUserBoard(user); - mv.addObject("alertNList", alertNList); - mv.addObject("alertYList", alertYList); - //mv.addObject("usno", user.getUsno()); - //mv.addObject("uspart",user.getUspart()); + mv.addObject("alertBoard", alertBoard); mv.setViewName("mypage/mp_UserInfo"); return mv; } @@ -453,7 +486,7 @@ public String updatePwd(@ModelAttribute User u, //System.out.println("change안에서 u : " + u); User loginUser = uService.loginUser(u); - + List alertBoard = null; if(bcryptPasswordEncoder.matches(cPwd, loginUser.getUspwd())) { // 4) 비밀번호 변경 값 받아서 암호화 @@ -463,26 +496,29 @@ public String updatePwd(@ModelAttribute User u, // 5) db에 update 후 int result = uService.updatePwdUser(u); // 암호화 한 비번 db에 update u.setUspart("일반"); - List alertNList = mService.selectAlertList(u); - // 읽은 리스트 - List alertYList = mService.selectYAlertList(u); + + User user = (User) session.getAttribute("loginUser"); + + //System.out.println(user); + + // 공지사항 + alertBoard = mService.selectUserBoard(user); + //System.out.println(alertBoard); + // 6) 마이페이지로 돌아가기 if (result > 0) { - model.addAttribute("alertNList", alertNList); - model.addAttribute("alertYList", alertYList); + model.addAttribute("alertBoard", alertBoard); model.addAttribute("msg", "비밀번호가 수정되었습니다."); return "/mypage/mp_UserInfo"; } else { - model.addAttribute("alertNList", alertNList); - model.addAttribute("alertYList", alertYList); + model.addAttribute("alertBoard", alertBoard); model.addAttribute("msg", "비밀번호 변경에 실패하였습니다. 다시 시도해주세요."); return "/mypage/mp_UserInfo"; } } else { - model.addAttribute("usno", u.getUsno()); - model.addAttribute("uspart", u.getUspart()); + model.addAttribute("alertBoard", alertBoard); model.addAttribute("msg", "현재 비밀번호가 틀립니다."); return "/mypage/mp_UserInfo"; } @@ -520,21 +556,21 @@ public String updateInfo(@ModelAttribute("loginUser") User u, //변경 값 다시 loginUser에 넣어주기 User loginUser = uService.loginUser(u); - - //System.out.println("loginUser가 변경 되었는지 확인해보쟈 : " + loginUser); - u.setUspart("일반"); - List alertNList = mService.selectAlertList(u); - // 읽은 리스트 - List alertYList = mService.selectYAlertList(u); + + List alertBoard = null; + User user = (User) session.getAttribute("loginUser"); + + //System.out.println(user); + + // 공지사항 + alertBoard = mService.selectUserBoard(user); if (result > 0) { - model.addAttribute("alertNList", alertNList); - model.addAttribute("alertYList", alertYList); + model.addAttribute("alertBoard", alertBoard); model.addAttribute("msg", "수정이 완료되었습니다!"); return "/mypage/mp_UserInfo"; } else { - model.addAttribute("alertNList", alertNList); - model.addAttribute("alertYList", alertYList); + model.addAttribute("alertBoard", alertBoard); model.addAttribute("msg", "수정에 실패했습니다. 다시 시도해주세요."); return "/mypage/mp_UserInfo"; } @@ -932,7 +968,7 @@ public Review rewriteReview(@RequestBody Review r) { //System.out.println("가기전에 r 확인 : " + r); Review reviewDetail = mService.selectReview(r); - //System.out.println("reviewDetail 확인 : " + reviewDetail); + System.out.println("reviewDetail 확인 : " + reviewDetail); return reviewDetail; @@ -1035,7 +1071,7 @@ public ModelAndView goToMyroute(ModelAndView mv, Map map, HttpSession session) { routeTest.put(mapKey, insertThis); forIndex = forIndex + standardList[b]; mapKey ++; - //System.out.println("routeTest["+b+"] : " + routeTest.get(b)); + System.out.println("routeTest["+b+"] : " + routeTest.get(b)); } mv.addObject("routeTest", routeTest); @@ -1050,17 +1086,19 @@ public ModelAndView goToMyroute(ModelAndView mv, Map map, HttpSession session) { // 회원 탈퇴 @PostMapping("/userout") - public String memberOut(@ModelAttribute User u, Model model) { + public String memberOut(@ModelAttribute User u, Model model, HttpSession session) { ////System.out.println("out u : " + u); //System.out.println(memoutPwd); User loginUser = uService.loginUser(u); //System.out.println("out loginUser" + loginUser); - - List alertNList = mService.selectAlertList(u); - // 읽은 리스트 - List alertYList = mService.selectYAlertList(u); - + User user = (User) session.getAttribute("loginUser"); + + //System.out.println(user); + + // 공지사항 + List alertBoard = mService.selectUserBoard(user); + if(bcryptPasswordEncoder.matches(u.getUspwd(), loginUser.getUspwd())) { @@ -1072,8 +1110,7 @@ public String memberOut(@ModelAttribute User u, Model model) { return "redirect:/main"; } else { if(u.getUspart() == "일반") { - model.addAttribute("alertNList", alertNList); - model.addAttribute("alertYList", alertYList); + model.addAttribute("alertBoard", alertBoard); model.addAttribute("msg", "문제가 발생했습니다. 잠시 후에 다시 시도해 주세요!"); return "/mypage/mp_UserInfo"; } else { @@ -1084,8 +1121,7 @@ public String memberOut(@ModelAttribute User u, Model model) { } } else { if(u.getUspart() == "일반") { - model.addAttribute("alertNList", alertNList); - model.addAttribute("alertYList", alertYList); + model.addAttribute("alertBoard", alertBoard); model.addAttribute("msg", "문제가 발생했습니다. 잠시 후에 다시 시도해 주세요!"); return "/mypage/mp_UserInfo"; } else { @@ -1122,4 +1158,24 @@ public String saveFile(MultipartFile file, HttpServletRequest request) { return renameFileName; } + // 공지사항 디테일 가져오기 + @RequestMapping("/alertboardajax") + @ResponseBody + public A_board findBoardAjax(@RequestBody A_board aboard) { + //System.out.println("aboard 확인 : " + aboard); + A_board ab = mService.findThisBoard(aboard); + + int result = 0; + + if(aboard.getUsnews() > 0) { + result = mService.updateUserRead(aboard); + } + + if(ab != null && result > 0) { + return ab; + } else { + return ab; + } + + } } diff --git a/src/main/java/com/kh/samdado/mypage/model/dao/MypageDao.java b/src/main/java/com/kh/samdado/mypage/model/dao/MypageDao.java index 2a186ab6..9b646cc3 100644 --- a/src/main/java/com/kh/samdado/mypage/model/dao/MypageDao.java +++ b/src/main/java/com/kh/samdado/mypage/model/dao/MypageDao.java @@ -195,4 +195,25 @@ public interface MypageDao { // 후기 작성 후 비즈니스에 별점 update public int updateBusStar(Review r); + // 공지사항 등록 시 해당 user의 news +1 해주기 + public int updateNewUserNews(A_board aboard); + + // 내소식에 들어갈 공지사항 리스트 + public List selectBoard(User u, ApplyPageInfo api); + + // 특정 공지사항 가져오기 + public A_board findThisBoard(A_board aboard); + + // 일반회원 새로운 공지사항 있는지 확인 + public int findNewUserNews(User u); + + // 공지사항 읽으면 user -1 해주기 + public int updateUserRead(A_board aboard); + + // 공지사항 갯수 구하기 + public int selectBoardListCout(String uspart); + + // 일반회원 공지사항 가져오기 + public List selectUserBoard(User user); + } diff --git a/src/main/java/com/kh/samdado/mypage/model/dao/MypageDaoImpl.java b/src/main/java/com/kh/samdado/mypage/model/dao/MypageDaoImpl.java index b35f68e9..3e88c2d7 100644 --- a/src/main/java/com/kh/samdado/mypage/model/dao/MypageDaoImpl.java +++ b/src/main/java/com/kh/samdado/mypage/model/dao/MypageDaoImpl.java @@ -56,6 +56,7 @@ public Alert selectDetailAlert(Alert al) { // 알림 nstatus update @Override public int updateNstatus(Alert al) { +// sqlSession.update("mypageMapper.updateUserRead",al.getUsno()); return sqlSession.update("mypageMapper.updateNstatus", al); } @@ -209,6 +210,7 @@ public List selectChartList(AccountBook ab) { // 제휴회원 - QnA 새로운 알림 등록 @Override public int insertQnANews(Alert a) { + //sqlSession.update("mypageMapper.updateUserNewNews", a.getUsno()); return sqlSession.insert("mypageMapper.insertQnANews", a); } @@ -221,6 +223,7 @@ public int findAlno(Alliance a) { // 제휴회원 - Alliance 새로운 알림 등록 @Override public int insertAlliNews(Alert al) { + //sqlSession.update("mypageMapper.updateUserNewNews", al.getUsno()); return sqlSession.insert("mypageMapper.insertAlliNews", al); } @@ -233,6 +236,7 @@ public String findAlliUsno(Alliance alliance) { // 제휴회원 - Alliance 승인시 새로운 알림 등록 @Override public int insertNewApprove(Alert alert) { + //sqlSession.update("mypageMapper.updateUserNewNews", alert.getUsno()); return sqlSession.insert("mypageMapper.insertNewApprove", alert); } @@ -246,6 +250,7 @@ public int updatePbalance(Point po) { // 제휴회원 - Report 승인시 알림 등록 @Override public int insertNewReport(Alert a) { + //sqlSession.update("mypageMapper.updateUserNewNews", a.getUsno()); return sqlSession.insert("mypageMapper.insertNewReport", a); } @@ -270,7 +275,7 @@ public List selectCarBookList(String usno) { // 일반회원 - 내예약 취소 @Override public int deleteBooking(Booking b) { - System.out.println("dao까지는 잘 오니?"); + //System.out.println("dao까지는 잘 오니?"); return sqlSession.delete("mypageMapper.deleteBooking", b); } // 일반회원 - 후기등록 @@ -382,4 +387,48 @@ public int updateBusStar(Review r) { return sqlSession.update("mypageMapper.updateBusStar", r); } + // 공지사항 등록 시 해당 user의 news +1 해주기 + @Override + public int updateNewUserNews(A_board aboard) { + return sqlSession.update("mypageMapper.updateNewUserNews", aboard); + } + + // 내소식에 들어갈 공지사항 리스트 + @Override + public List selectBoard(User u, ApplyPageInfo api) { + int offset = (api.getCurrentPage()-1) * api.getBoardLimit(); + RowBounds rowBounds = new RowBounds(offset, api.getBoardLimit()); + return sqlSession.selectList("mypageMapper.selectBoard", u, rowBounds); + } + + // 특정 공지사항 가져오기 + @Override + public A_board findThisBoard(A_board aboard) { + return sqlSession.selectOne("mypageMapper.findThisBoard", aboard); + } + + // 일반회원 새로운 공지사항 있는지 확인 + @Override + public int findNewUserNews(User u) { + return sqlSession.selectOne("mypageMapper.findNewUserNews", u); + } + + // 공지사항 읽으면 user -1 해주기 + @Override + public int updateUserRead(A_board aboard) { + return sqlSession.update("mypageMapper.updateUserRead", aboard); + } + + // 공지사항 갯수 구하기 + @Override + public int selectBoardListCout(String uspart) { + return sqlSession.selectOne("mypageMapper.selectBoardListCout", uspart); + } + + // 일반회원 공지사항 가져오기 + @Override + public List selectUserBoard(User user) { + return sqlSession.selectList("mypageMapper.selectBoard", user); + } + } diff --git a/src/main/java/com/kh/samdado/mypage/model/service/MypageService.java b/src/main/java/com/kh/samdado/mypage/model/service/MypageService.java index 55ef8f46..782d78dc 100644 --- a/src/main/java/com/kh/samdado/mypage/model/service/MypageService.java +++ b/src/main/java/com/kh/samdado/mypage/model/service/MypageService.java @@ -195,5 +195,26 @@ public interface MypageService { // 후기 작성 후 비즈니스에 별점 update public int updateBusStar(Review r); + // 공지사항 등록 시 해당 user의 news +1 해주기 + public int updateNewUserNews(A_board aboard); + + // 내소식에 들어갈 공지사항 리스트 + public List selectBoard(User u, ApplyPageInfo api); + + // 특정 공지사항 가져오기 + public A_board findThisBoard(A_board aboard); + + // 일반회원 새로운 공지사항 있는지 확인 + public int findNewUserNews(User u); + + // 공지사항 읽으면 user -1 해주기 + public int updateUserRead(A_board aboard); + + // 공지사항 갯수 구하기 + public int selectBoardListCount(String uspart); + + // 일반회원 공지사항 가져오기 + public List selectUserBoard(User user); + } diff --git a/src/main/java/com/kh/samdado/mypage/model/service/MypageServiceImpl.java b/src/main/java/com/kh/samdado/mypage/model/service/MypageServiceImpl.java index 4e1af5a5..c1c5c1de 100644 --- a/src/main/java/com/kh/samdado/mypage/model/service/MypageServiceImpl.java +++ b/src/main/java/com/kh/samdado/mypage/model/service/MypageServiceImpl.java @@ -378,5 +378,47 @@ public int updateBusStar(Review r) { return mDao.updateBusStar(r); } + // 공지사항 등록 시 해당 user의 news +1 해주기 + @Override + public int updateNewUserNews(A_board aboard) { + return mDao.updateNewUserNews(aboard); + } + + // 내소식에 들어갈 공지사항 리스트 + @Override + public List selectBoard(User u,ApplyPageInfo api) { + return mDao.selectBoard(u, api); + } + + // 특정 공지사항 가져오기 + @Override + public A_board findThisBoard(A_board aboard) { + return mDao.findThisBoard(aboard); + } + + // 일반회원 새로운 공지사항 있는지 확인 + @Override + public int findNewUserNews(User u) { + return mDao.findNewUserNews(u); + } + + // 공지사항 읽으면 user -1 해주기 + @Override + public int updateUserRead(A_board aboard) { + return mDao.updateUserRead(aboard); + } + + // 공지사항 갯수 구하기 + @Override + public int selectBoardListCount(String uspart) { + return mDao.selectBoardListCout(uspart); + } + + // 일반회원 공지사항 가져오기 + @Override + public List selectUserBoard(User user) { + return mDao.selectUserBoard(user); + } + } diff --git a/src/main/java/com/kh/samdado/mypage/model/vo/MpBoardPagination.java b/src/main/java/com/kh/samdado/mypage/model/vo/MpBoardPagination.java new file mode 100644 index 00000000..3553f85c --- /dev/null +++ b/src/main/java/com/kh/samdado/mypage/model/vo/MpBoardPagination.java @@ -0,0 +1,24 @@ +package com.kh.samdado.mypage.model.vo; + +public class MpBoardPagination { + // PageInfo 객체를 리턴하는 static 메소드 + public static ApplyPageInfo getApplyPageInfo(int currentPage, int listCount) { + ApplyPageInfo api = null; // 페이지 정보를 담아 줄 PageInfo 참조변수 선언 + + int pageLimit = 3; // 한 페이지에 보여질 페이징바의 갯수 + int boardLimit = 2; // 한 페이지 보여질 게시글 개수 + + int maxPage = (int)Math.ceil((double)listCount / boardLimit); + int startPage = (currentPage - 1) / pageLimit * pageLimit + 1; + int endPage = startPage + pageLimit - 1; + + // 마지막 페이지가 총 페이지 수보다 클 경우 + if(maxPage < endPage) { + endPage = maxPage; + } + + api = new ApplyPageInfo(currentPage, listCount, pageLimit, maxPage, startPage, endPage, boardLimit); + + return api; + } +} diff --git a/src/main/java/com/kh/samdado/route/controller/RouteController.java b/src/main/java/com/kh/samdado/route/controller/RouteController.java index 63818e49..61bc8a3b 100644 --- a/src/main/java/com/kh/samdado/route/controller/RouteController.java +++ b/src/main/java/com/kh/samdado/route/controller/RouteController.java @@ -1,11 +1,9 @@ package com.kh.samdado.route.controller; import java.sql.Date; +import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.servlet.http.HttpSession; @@ -29,7 +27,6 @@ import com.kh.samdado.route.model.vo.Route; import com.kh.samdado.route.model.vo.RouteFinal; import com.kh.samdado.route.model.vo.SpotBus; -import com.kh.samdado.route.model.vo.TourSpot; import com.kh.samdado.route.model.vo.rSearch; import com.kh.samdado.user.model.vo.User; @@ -103,7 +100,7 @@ public ModelAndView changeRoutePage(HttpSession session, Model model, String[] r List rlist = rService.changeRoute(rrlist); - System.out.println("rlist: " + rlist); + //System.out.println("rlist: " + rlist); model.addAttribute("list", rlist); User loginUser = (User)session.getAttribute("loginUser"); @@ -181,7 +178,7 @@ public ModelAndView clearChange(HttpSession session, Model model, String[] chlis u.setUsno(loginUser.getUsno()); // 사용자별 찜한 숙소리스트 가져오기 List jjimHotel = mService.findHotelJjimList(u); - //System.out.println("jjimHotel 확인 : " + jjimHotel); + System.out.println("jjimHotel 확인 : " + jjimHotel); // 검색 모달창에 찜한 사업장 가져오기 List jjimB = rService.jjimBusiness(u); @@ -229,7 +226,11 @@ public String finalRoute(HttpSession session, Model model, RouteFinal rf) { User loginUser = (User)session.getAttribute("loginUser"); String price = (String)session.getAttribute("price"); - rf.setRoute_date(routeDate); + System.out.println(routeDate); + SimpleDateFormat format1 = new SimpleDateFormat ( "yyyy/MM/dd"); + String time1 = format1.format(routeDate); + + rf.setRoute_date(time1); rf.setUs_no(loginUser.getUsno()); rf.setRoute_price(price); diff --git a/src/main/java/com/kh/samdado/route/model/vo/RouteFinal.java b/src/main/java/com/kh/samdado/route/model/vo/RouteFinal.java index c6bd76ea..9dadc5a5 100644 --- a/src/main/java/com/kh/samdado/route/model/vo/RouteFinal.java +++ b/src/main/java/com/kh/samdado/route/model/vo/RouteFinal.java @@ -21,7 +21,7 @@ public class RouteFinal { private int route_no; // 루트 번호 @DateTimeFormat(pattern = "yyyy-MM-dd") - private Date route_date; // 루트 날짜 + private String route_date; // 루트 날짜 private String route_price; // 총 예상 예산 private String us_no; // 회원 번호 diff --git a/src/main/java/com/kh/samdado/user/controller/UserController.java b/src/main/java/com/kh/samdado/user/controller/UserController.java index 2c759770..af49fee2 100644 --- a/src/main/java/com/kh/samdado/user/controller/UserController.java +++ b/src/main/java/com/kh/samdado/user/controller/UserController.java @@ -40,6 +40,7 @@ public class UserController { @Autowired private EmailSender emailSender; + @Autowired private Email email; diff --git a/src/main/java/com/kh/samdado/user/model/vo/User.java b/src/main/java/com/kh/samdado/user/model/vo/User.java index 03be8b81..eccf9a72 100644 --- a/src/main/java/com/kh/samdado/user/model/vo/User.java +++ b/src/main/java/com/kh/samdado/user/model/vo/User.java @@ -36,6 +36,7 @@ public class User { private String authKey; private int pbalance; private Date enrolldate; + private int usnews; private int upartcount; private String utodate; // 관리자 서치 날짜 포멧팅을 위한 컬럼 diff --git a/src/main/resources/mappers/admin-mapper.xml b/src/main/resources/mappers/admin-mapper.xml index f07aa9f0..c0b86368 100644 --- a/src/main/resources/mappers/admin-mapper.xml +++ b/src/main/resources/mappers/admin-mapper.xml @@ -585,6 +585,16 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" AND ITEM = '프리미엄' AND BUS_CLASSIFY = 'P' AND ISTATUS IS NULL + GROUP BY PAY_NO, + ITEM, + AMOUNT, + PDATE, + EXDATE, + INCOME.US_NO, + US_NAME, + BUSINESS.BUS_CATEGORY, + BUSINESS.BUS_CODE, + ISTATUS ORDER BY PDATE DESC diff --git a/src/main/resources/mappers/business-mapper.xml b/src/main/resources/mappers/business-mapper.xml index f1331d42..907de25d 100644 --- a/src/main/resources/mappers/business-mapper.xml +++ b/src/main/resources/mappers/business-mapper.xml @@ -256,6 +256,26 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" + + + + + + + + + + + + + + + + + + + + INSERT INTO BUSINESS @@ -648,6 +668,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" , PRO_ADULT , PRO_YOUTH , PRO_CHILD + , AVGSTAR FROM BUSINESS B, BUSINESS_ATT BT, TOUR_PRODUCT TP WHERE @@ -677,6 +698,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" , HOTEL_CATEGORY , BT.FILE_RENAME , BT.FILE_LV + , AVGSTAR FROM BUSINESS B JOIN @@ -740,6 +762,8 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" , BUS_OPENING , BT.FILE_RENAME , BT.FILE_LV + , AVGSTAR + , RES_CATEGORY FROM BUSINESS B JOIN @@ -774,6 +798,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" , BUS_OPENING , BT.FILE_RENAME , BT.FILE_LV + , AVGSTAR FROM BUSINESS B JOIN @@ -1360,6 +1385,15 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" ROWNUM = 1 + + UPDATE + "USER" + SET + PBALANCE = #{pbalance} + WHERE + US_NO = #{usno} + + + + + - SELECT + SELECT ACC_CLASSIFY , SUM(ACC_WON) AS totalSum , SUM(ACC_ONEWON) AS oneTotalSum + , ACC_TRIPD FROM ACCOUNT WHERE US_NO = #{usno} + AND ACC_TRIPD = #{searchDate} GROUP BY - ACC_CLASSIFY + ACC_CLASSIFY, ACC_TRIPD @@ -738,7 +746,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" INSERT - INTO NEWS + INTO NEWS ( NNO , US_NO @@ -761,7 +769,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" INSERT - INTO NEWS + INTO NEWS ( NNO , US_NO @@ -784,7 +792,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" INSERT - INTO NEWS + INTO NEWS ( NNO , US_NO @@ -814,7 +822,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" INSERT INTO NEWS(NNO, US_NO, NTITLE, NSTATUS, NCATE, NKEYNO, N_DATE) - VALUES (NEWS_SEQ_NO.NEXTVAL, #{usno}, '회원님의 사업장에대한 신고가 3회 누적되었습니다.', 'N', 'R', #{nkeyno}, SYADATE) + VALUES (NEWS_SEQ_NO.NEXTVAL, #{usno}, '회원님의 사업장에대한 신고가 3회 누적되었습니다.', 'N', 'R', #{nkeyno}, SYSDATE) @@ -1213,7 +1221,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" + + SELECT * + FROM A_BOARD + WHERE US_PART = '전체' + OR US_PART = '일반' + ORDER BY BNO DESC + + + SELECT * + FROM A_BOARD + WHERE US_PART = '전체' + OR US_PART = '제휴' + ORDER BY BNO DESC + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mappers/user-mapper.xml b/src/main/resources/mappers/user-mapper.xml index 75717ba9..01868c53 100644 --- a/src/main/resources/mappers/user-mapper.xml +++ b/src/main/resources/mappers/user-mapper.xml @@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" + @@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" , US_STOP , PBALANCE , ENROLL_DATE + , USNEWS FROM "USER" WHERE @@ -61,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" , US_STATUS , PBALANCE , ENROLL_DATE + , USNEWS ) VALUES ( @@ -76,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapepr 3.0//EN" , DEFAULT , DEFAULT , DEFAULT + , DEFAULT ) diff --git a/src/main/webapp/WEB-INF/views/business/hotel/hotel_list.jsp b/src/main/webapp/WEB-INF/views/business/hotel/hotel_list.jsp index 1578bfd5..21c83fb2 100644 --- a/src/main/webapp/WEB-INF/views/business/hotel/hotel_list.jsp +++ b/src/main/webapp/WEB-INF/views/business/hotel/hotel_list.jsp @@ -497,15 +497,16 @@ /* 사업장종류선택끝 */ .cateSelect { - width: 70px; + width: 65px; /* height: 33px; */ /* border: 1px solid black; */ - border-radius: 20%; + border-radius: 10%; /* -webkit-appearance: none; */ appearance: none; padding-left: 5px; font-weight: bold; - + border: 1px solid #467355; + color: #467355; } .cateSelect a, .cateSelect label { @@ -575,8 +576,6 @@ str += ""; str += "★4.90(후기 99+개)"; str += ""+ data[i].bus_name +""; - str += "38,000원 ~ 40,000원 / 박"; - str += "총액 80,000원"; str += "" str += ""; str += ""; @@ -597,16 +596,14 @@