商家酒店模块之java商城 开源java电子商务Spring Cloud+Spring Boot+mybatis+MQ+VR全景+b2b2c
源码地址来源: https://minglisoft.cn/honghu2/business.html
/*** Copyright © 2012-2017 <a href="http://minglisoft.cn">HongHu</a> All rights reserved.*/
package com.honghu.cloud.controller;import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.honghu.cloud.bean.EvaluatePraise;
import com.honghu.cloud.bean.GoodsProperty;
import com.honghu.cloud.bean.HotelSales;
import com.honghu.cloud.bean.Store;
import com.honghu.cloud.bean.SysDict;
import com.honghu.cloud.code.ResponseCode;
import com.honghu.cloud.common.page.Page;
import com.honghu.cloud.dto.AccessoryDto;
import com.honghu.cloud.dto.EvaluateDto;
import com.honghu.cloud.dto.GoodsDto;
import com.honghu.cloud.dto.OrderFormDto;
import com.honghu.cloud.dto.UserDto;
import com.honghu.cloud.feign.AccessoryFeignClient;
import com.honghu.cloud.feign.EvaluateFeignClient;
import com.honghu.cloud.feign.GoodsFeignClient;
import com.honghu.cloud.feign.HandleOrderFormFeignClient;
import com.honghu.cloud.feign.UserFeignClient;
import com.honghu.cloud.service.IEvaluatePraiseService;
import com.honghu.cloud.service.IHotelSalesService;
import com.honghu.cloud.service.IStoreService;
import com.honghu.cloud.service.ISysDictService;
import com.honghu.cloud.tools.QueryTools;
import com.honghu.cloud.tools.SecurityUserHolder;
import com.honghu.cloud.tools.UtilDate;
import com.honghu.cloud.utils.CommUtil;import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;/*** 酒店Controller* * @author Administrator* @param <E>**/
@Slf4j
@RestController
@RequestMapping(value = "/hotel")
public class HotelController<E> {@Autowiredprivate QueryTools queryTools;@Autowiredprivate ISysDictService sysDictService;@Autowiredprivate IStoreService storeService;@Autowiredprivate GoodsFeignClient goodsFeignClient;@Autowiredprivate IHotelSalesService hotelSalesService;@Autowiredprivate UserFeignClient userFeignClient;@Autowiredprivate HandleOrderFormFeignClient handleOrderFormFeignClient;@Autowiredprivate EvaluateFeignClient evaluateFeignClient;@Autowiredprivate IEvaluatePraiseService evaluatePraiseService;@Autowiredprivate AccessoryFeignClient accessoryFeignClient;/*** 酒店首页* @param request* @param response* @return*/@RequestMapping(value = "/hotel_index", method = RequestMethod.POST)public Map<String, Object> hotel_index(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject json) {String currentPage = json.optString("currentPage");String mc_id = json.optString("mc_id");String lat = json.optString("lat"); //lat=26.68String lng = json.optString("lng"); //lng=106.63if(StringUtils.isBlank(lat) || StringUtils.isBlank(lng)){return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);}Map<String, Object> result = new HashMap<String, Object>();List<SysDict> scList = sysDictService.selectByType("hotel_star_class");List<SysDict> psList = sysDictService.selectByType("hotel_prices_section");result.put("scList", scList); //星级result.put("psList", psList); //价格区间Map<String, Object> maps = queryTools.getParams(currentPage, 12, null, null);if(StringUtils.isBlank(mc_id)){mc_id = "17";}maps.put("mc_id",mc_id);maps.put("well_evaluate", "well_evaluate");maps.put("lat", lat);maps.put("lng", lng);maps.put("group_by", "group_by");maps.put("orderBy", "distance");maps.put("orderType", "ASC");Page<Store> pList = storeService.listPagesNew(maps);result.put("pList", pList);return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}/*** 酒店列表* @param request* @param response* key:品牌 酒店名称 位置* @return*/@RequestMapping(value = "/hotel_list", method = RequestMethod.POST)public Map<String, Object> hotel_list(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String key = json.optString("key");String currentPage = json.optString("currentPage");String beginPrice = json.optString("beginPrice");String endPrice = json.optString("endPrice");String store_distance = json.optString("store_distance");String hscid = json.optString("hscid");String orderby = json.optString("orderby");String aaid = json.optString("aaid");String acid = json.optString("acid");String hdid = json.optString("hdid");String house_type_id = json.optString("house_type_id");String breakfast_calss_id = json.optString("breakfast_calss_id");String checkinTime = json.optString("checkinTime");String checkoutTime = json.optString("checkoutTime");String mc_id = json.optString("mc_id");String lat = json.optString("lat");String lng = json.optString("lng");if(StringUtils.isBlank(lat) || StringUtils.isBlank(lng)){return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);}Map<String, Object> maps = queryTools.getParams(currentPage, 12, null, null);//如果没传时间默认是今天的时间SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");if(StringUtils.isBlank(checkinTime) || StringUtils.isBlank(checkoutTime)){Date now = new Date();checkinTime = sdf.format(now);Calendar calBegin = Calendar.getInstance();// 使用给定的 Date 设置此 Calendar 的时间calBegin.setTime(now);calBegin.add(Calendar.DAY_OF_MONTH, 1);checkoutTime = sdf.format(calBegin.getTime());}if(StringUtils.isBlank(mc_id)){mc_id = "17";}maps.put("mc_id",mc_id);maps.put("well_evaluate", "well_evaluate");maps.put("lat", lat);maps.put("lng", lng);maps.put("group_by", "group_by");if(StringUtils.isNotBlank(key)){ //位置酒店名称品牌筛选maps.put("key", key);}if(StringUtils.isNotBlank(beginPrice)){ //价格阶段筛选maps.put("beginPrice", beginPrice);}if(StringUtils.isNotBlank(endPrice)){maps.put("endPrice", endPrice);}if(StringUtils.isNotBlank(store_distance)){//距离筛选<500米这种maps.put("store_distance_where", store_distance);}if(StringUtils.isNotBlank(hscid)){ //星级筛选maps.put("hotel_starclass_id", hscid);}if(StringUtils.isNotBlank(hdid)){ //酒店类型筛选maps.put("hotel_dit_id", hdid);}if(StringUtils.isNotBlank(house_type_id)){ //房型maps.put("house_type_id", house_type_id);}if(StringUtils.isNotBlank(breakfast_calss_id)){ //早餐maps.put("breakfast_calss_id", breakfast_calss_id);}if(StringUtils.isNotBlank(aaid)){ //天天特惠maps.put("aaid", aaid);}if(StringUtils.isNotBlank(acid)){ //住客印象SysDict dict = sysDictService.selectByPrimaryKey(Long.parseLong(acid));maps.put("ac_name", dict.getLabel());}if("evaluate".equals(orderby)){ //好评排序maps.put("orderBy", "IFNULL(avg(sp.store_evaluate), 5)");maps.put("orderType", "DESC");}else if("lowPrice".equals(orderby)){//低价排序maps.put("orderBy", "minPrice");maps.put("orderType", "ASC");}else if("browse_count".equals(orderby)){ //人气优先maps.put("orderBy", "obj.favorite_count");maps.put("orderType", "DESC");}else{ //距离排序 ("distance".equals(orderby))maps.put("orderBy", "distance");maps.put("orderType", "ASC");}Map<String, Object> result = new HashMap<String, Object>();Page<Store> pList = storeService.listPagesNew(maps);result.put("pList", pList);//筛选基础数据给到List<SysDict> scList = sysDictService.selectByType("hotel_star_class");List<SysDict> psList = sysDictService.selectByType("hotel_prices_section");List<SysDict> atList = sysDictService.selectByType("hotel_attribute_type");List<SysDict> abList = sysDictService.selectByType("hotel_attribute_bed");List<SysDict> atbList = sysDictService.selectByType("hotel_attribute_breakfast");List<SysDict> aaList = sysDictService.selectByType("goods_activity");List<SysDict> acList = sysDictService.selectByType("hotel_attribute_comment");result.put("scList", scList); //星级result.put("psList", psList); //价格区间result.put("atList", atList); //酒店类型result.put("abList", abList); //房型result.put("atbList", atbList); //早餐result.put("aaList", aaList); //优惠价格result.put("acList", acList); //住客印象result.put("lat", lat);result.put("lng", lng);result.put("checkinTime", checkinTime);result.put("checkoutTime", checkoutTime);result.put("currentPage", currentPage);//前端展示日期转换List<String> strIn = Arrays.asList(checkinTime.split("-"));List<String> strOut = Arrays.asList(checkoutTime.split("-"));String shortInTime = Integer.parseInt(strIn.get(1))+"-"+strIn.get(2);String shortOutTime = Integer.parseInt(strOut.get(1))+"-"+strOut.get(2);result.put("shortInTime", shortInTime);result.put("shortOutTime", shortOutTime);try {int days = UtilDate.daysBetween(sdf.parse(checkinTime), sdf.parse(checkoutTime));result.put("days", days);} catch (ParseException e) {e.printStackTrace();}return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}//酒店店铺首页@RequestMapping(value = "/hotel_store_index", method = RequestMethod.POST)public Map<String, Object> hotel_store_index(HttpServletRequest request,HttpServletResponse response,@RequestBody JSONObject json){String key = json.optString("key");String currentPage = json.optString("currentPage");String store_id = json.optString("store_id");String checkinTime = json.optString("checkinTime");String checkoutTime = json.optString("checkoutTime");String lat = json.optString("lat");String lng = json.optString("lng");if(StringUtils.isBlank(store_id) || StringUtils.isBlank(checkinTime) || StringUtils.isBlank(checkoutTime)){return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);}Store store = this.storeService.selectByPrimaryKey(Long.parseLong(store_id)); // 根据店铺ID获取店铺信息if (store == null) {return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);}if((CommUtil.null2Int(store.getStore_status())==25)||(CommUtil.null2Int(store.getStore_status())==26)){return ResponseCode.buildCodeMap("20002", "店铺因为合同到期现已关闭,如有疑问请联系商城客服", null);}else if(store.getStore_status()<15){ return ResponseCode.buildCodeMap("20003", "店铺未正常营业", null);}else if(store.getStore_status()==20){return ResponseCode.buildCodeMap("20004", "店铺因为违反商城相关规定现已关闭,如有疑问请联系商城客服", null);}Map<String, Object> result = new HashMap<String, Object>();//如果没传时间默认是今天的时间SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");if(checkinTime == null || checkoutTime == null){Date now = new Date();checkinTime = sdf.format(now);Calendar calBegin = Calendar.getInstance();// 使用给定的 Date 设置此 Calendar 的时间calBegin.setTime(now);calBegin.add(Calendar.DAY_OF_MONTH, 1);checkoutTime = sdf.format(calBegin.getTime());}//type = "-1"; //住宿 -2 餐饮Map<String, Object> maps = Maps.newHashMap();maps.put("lat", lat);maps.put("lng", lng);//maps.put("store_distance", "store_distance");maps.put("id", store_id);List<Store> storeList = storeService.queryPagesNew(maps);if(storeList!=null && storeList.size()>0){Map<String, Object> params = queryTools.getParams(currentPage, 12, null, null);params.put("goods_store_id", storeList.get(0).getId());//params.put("gc_id", type);params.put("hotel_store_index", "yes");params.put("checkinTime", checkinTime);params.put("checkoutTime", checkoutTime);params.put("goods_status", 0);if(StringUtils.isNotBlank(key)){params.put("honghu_goods_name", key);}//IPageList pList = goodsService.listPages(params);Map<String, Object> pList = goodsFeignClient.list(params);result.put("goodsList", pList);store = storeList.get(0);result.put("store", store);//评论数量params.clear();params.put("store_id", store_id);int evaluateCount = evaluateFeignClient.selectCount(params);result.put("evaluateCount", evaluateCount);}result.put("checkinTime", checkinTime);result.put("checkoutTime", checkoutTime);result.put("key", key);result.put("store_id", store_id);//前端展示日期转换List<String> strIn = Arrays.asList(checkinTime.split("-"));List<String> strOut = Arrays.asList(checkoutTime.split("-"));String shortInTime = Integer.parseInt(strIn.get(1))+"-"+strIn.get(2);String shortOutTime = Integer.parseInt(strOut.get(1))+"-"+strOut.get(2);result.put("shortInTime", shortInTime);result.put("shortOutTime", shortOutTime);try {int days = UtilDate.daysBetween(sdf.parse(checkinTime), sdf.parse(checkoutTime));result.put("days", days);} catch (ParseException e) {}UserDto user = SecurityUserHolder.getCurrentUser(request);result.put("user", user);return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}/*** 房间详情页(预定)* @param request* @param response* @param goods_id 房间编号* @param checkInTime 入住时间* @param departureTime 离店时间* @return*/@RequestMapping(value = "/room_info", method = RequestMethod.POST)public Map<String,Object> getRoomInfo(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject json){String goods_id = json.optString("goods_id");if(StringUtils.isBlank(goods_id)){return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);}Map<String, Object> result = new HashMap<String, Object>();UserDto user = SecurityUserHolder.getCurrentUser(request);if(user != null){result.put("code", 200); //用户登入状态}else{result.put("code", 201); //用户未登入状态}if(StringUtils.isNotEmpty(goods_id)){ //非空验证//GoodsDto goods = this.goodsFeignClient.getSimpleGoodsByid(CommUtil.null2Long(goods_id)); //根据编号查询房间信息GoodsDto goods = this.goodsFeignClient.selectByPrimaryKey(CommUtil.null2Long(goods_id)); //根据编号查询房间信息List<GoodsProperty> lists = Lists.newArrayList(); //房间属性集合if(null!=goods){JSONArray goodsPropertyArray = JSONArray.fromObject(goods.getGoods_property().trim()); //解析楚房间属性for (int i=0; i<goodsPropertyArray.size();i++) {JSONObject object = (JSONObject)goodsPropertyArray.get(i);//lists.add(object.optString("val")); //获取房间属性信息GoodsProperty gProperty = (GoodsProperty)JSONObject.toBean(object,GoodsProperty.class);lists.add(gProperty); //将房间属性添加到list集合}result.put("goods_pro", lists); //返回房间属性信息// 商品图片List<AccessoryDto> goods_photos = accessoryFeignClient.getGoodsPhotosByAccessoryId(goods.getId());goods.setGoods_photos(goods_photos);}result.put("goods",goods); //返回房间信息}return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}/*** 订房(下订单)* @param request* @param response* @param goods_id 房间编号* @param checkInTime 预计入住时间* @param departureTime 预计离店时间* @return*/@RequestMapping(value = "/reservation", method = RequestMethod.POST)public Map<String, Object> reservation(HttpServletRequest request,HttpServletResponse response,@RequestBody JSONObject json){String goods_id = json.optString("goods_id");String checkinTime = json.optString("checkinTime");String checkoutTime = json.optString("checkoutTime");if(StringUtils.isBlank(goods_id)){return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);}Map<String, Object> result = new HashMap<String, Object>();GoodsDto goods = this.goodsFeignClient.selectByPrimaryKey(CommUtil.null2Long(goods_id)); //根据编号查询房间信息result.put("goods", goods);if(goods == null){return ResponseCode.buildCodeMap("20005", "查询不到该商品信息", null);}// 商品图片List<AccessoryDto> goods_photos = accessoryFeignClient.getGoodsPhotosByAccessoryId(goods.getId());goods.setGoods_photos(goods_photos);JSONArray goodsPropertyArray = JSONArray.fromObject(goods.getGoods_property().trim()); //解析楚房间属性List<GoodsProperty> lists = Lists.newArrayList(); //房间集合for (int i=0; i<goodsPropertyArray.size();i++) {JSONObject object = (JSONObject)goodsPropertyArray.get(i);GoodsProperty gProperty = (GoodsProperty)JSONObject.toBean(object,GoodsProperty.class);lists.add(gProperty); //将房间属性添加到list集合}result.put("goods_pro", lists); //返回房间属性信息SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");try {int days = UtilDate.daysBetween(sdf.parse(checkinTime), sdf.parse(checkoutTime));result.put("days", days);} catch (ParseException e) {}List<String> strIn = Arrays.asList(checkinTime.split("-"));List<String> strOut = Arrays.asList(checkoutTime.split("-"));String shortInTime = Integer.parseInt(strIn.get(1))+"月"+strIn.get(2)+"日";String shortOutTime = Integer.parseInt(strOut.get(1))+"月"+strOut.get(2)+"日";result.put("checkinTime", shortInTime); result.put("checkoutTime", shortOutTime); return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}//酒店提交定单@RequestMapping(value = "/hotel_submit_order", method = RequestMethod.POST)public Map<String, Object> hotel_submit_order(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject json){String checkinTime = json.optString("checkinTime");String checkoutTime = json.optString("checkoutTime");String goods_id = json.optString("goods_id");String count = json.optString("count");String name = json.optString("name");String phone = json.optString("phone");String payType = json.optString("payType");String order_types = json.optString("order_types");String into_date = json.optString("into_date"); //预计到店的时间/*goods_id = "609";count = "2";name = "冯宝宝";phone = "13786165231";//payType = "online";checkinTime = "2019-12-07";checkoutTime = "2019-12-09";*/GoodsDto goods = goodsFeignClient.selectByPrimaryKey(Long.parseLong(goods_id));if (goods == null) {return ResponseCode.buildCodeMap("20005", "查询不到该房间信息", null);}if (goods.getGoods_status() != 0) {return ResponseCode.buildCodeMap("20010", "酒店房间未上架,不能预订", null);}//查询是否满房这段时间Map<String, Object> params = Maps.newHashMap();params.put("checkinTime", checkinTime);params.put("checkoutTime", checkoutTime);params.put("goods_id", goods_id);List<HotelSales> hsList = hotelSalesService.queryPages(params);if(hsList != null && hsList.size() > 0){for (HotelSales hotelSales : hsList) {if(hotelSales.getSales_num()>=goods.getGoods_inventory()){return ResponseCode.buildCodeMap("20006", "订单中房间已满,请重新下单", null);}else if(hotelSales.getSales_num()+Integer.parseInt(count) > goods.getGoods_inventory()){return ResponseCode.buildCodeMap("20007", "订单中房间库存不足,请重新下单", null);}}}if(Integer.parseInt(count) > goods.getGoods_inventory()){return ResponseCode.buildCodeMap("20008", "订单数超过酒店房型数量,请重新下单", null);}UserDto user = SecurityUserHolder.getCurrentUser(request);if(user == null){return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);}UserDto buyer = this.userFeignClient.selectByPrimaryKey(user.getId());if(buyer.getStore_id() != null && buyer.getStore_id().longValue() == goods.getGoods_store_id().longValue()){return ResponseCode.buildCodeMap("20009", "不能预订自己店铺的房间", null);}Map<String, Object> maps = new HashMap<String, Object>();maps.put("goods_id", goods_id.toString());maps.put("checkinName", name);maps.put("mobile", phone);maps.put("count", count.toString());maps.put("checkinTime", checkinTime);maps.put("checkoutTime", checkoutTime);maps.put("payType", payType);maps.put("buyer_id", user.getId().toString());maps.put("order_type", order_types);maps.put("into_date", into_date);OrderFormDto main_order = handleOrderFormFeignClient.hotelSubmitOrderForm(maps);//更新库存(酒店换成添加入住记录)this.hotelSalesService.addCheckinlog(checkinTime, checkoutTime, Integer.valueOf(count), goods.getId());Map<String, Object> result = new HashMap<String, Object>();result.put("all_of_price",main_order.getTotalPrice());//result.put("user", user);result.put("from", "goodsCart");result.put("order", main_order);return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}/*** 酒店评价列表* @param request* @param response* @param store_id 酒店编号* @param currentPage 当前页数* @return*/@RequestMapping(value = "/hotel_evaluate_list", method = RequestMethod.POST)public Map<String, Object> hotel_evaluate_list(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject json ) {String currentPage = json.optString("currentPage");String store_id = json.optString("store_id");String type = json.optString("type");if(StringUtils.isBlank(store_id)){return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);}Store store = storeService.selectByPrimaryKey(Long.parseLong(store_id));if(store == null){return ResponseCode.buildCodeMap("20010", "查询不到店铺信息", null);}UserDto user = SecurityUserHolder.getCurrentUser(request);if(user == null){return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);}Map<String, Object> params = queryTools.getParams(currentPage, 12, "addTime", "desc");params.put("creater_id", user.getId()); //当前用户编号params.put("store_id", store_id);params.put("hotel", "hotel"); //行业标识if(StringUtils.contains(type, "lately")){params.put("lately", "lately"); //最新}if(StringUtils.contains(type, "lowScore")){params.put("lowScore", "lowScore"); //低分}if(StringUtils.contains(type, "slideShow")){params.put("slideShow", "slideShow"); //晒图}Map<String, Object> result = new HashMap<String, Object>();//IPageList pList = this.evaluateService.list(params);Map<String, Object> pList = evaluateFeignClient.list(params);result.put("pList", pList);Map<String, Object> maps = Maps.newHashMap();maps.put("store_id", store_id);EvaluateDto evaluate = this.evaluateFeignClient.getEvaluateAvgScore(maps); //获取所有评价信息if(evaluate == null){evaluate = new EvaluateDto();}evaluate.setAvgEvaluate(new BigDecimal("5.0"));if(store.getPoint().getStore_evaluate() != null){evaluate.setAvgEvaluate(store.getPoint().getStore_evaluate());}result.put("evaluate", evaluate);//全部Integer countAll = this.evaluateFeignClient.getEvaluate(maps); //所有评价信息result.put("countAll", countAll);//最新maps.put("lately", "lately");Integer latelyCount = this.evaluateFeignClient.getEvaluate(maps); //所有最新评价result.put("lately", latelyCount);//低分maps.put("lately", null);maps.put("lowScore", "lowScore");Integer lowScore = this.evaluateFeignClient.getEvaluate(maps); //所有低分评价result.put("lowScore", lowScore);//晒图maps.put("lowScore",null);maps.put("slideShow", "slideShow");Integer slideShow = this.evaluateFeignClient.getEvaluate(maps); //所有晒图评价result.put("slideShow", slideShow);params.clear();params.put("store_id",CommUtil.null2Long(store_id));params.put("hotel_type", "hotel_evaluate_praise");List<SysDict> praise = this.sysDictService.getByEvaluateLabelCount(params);result.put("praise", praise); //好评标签params.clear();params.put("store_id",CommUtil.null2Long(store_id));params.put("hotel_type", "hotel_evaluate_bad");List<SysDict> bad = this.sysDictService.getByEvaluateLabelCount(params);result.put("bad", bad); //差评标签return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}/*** 评价信息点赞* @param fabulous* @param id*/@RequestMapping(value = "/ajaxfabulous", method = RequestMethod.POST)public Map<String, Object> ajaxFabulous(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject json ){String evaluate_id = json.optString("evaluate_id");if(StringUtils.isBlank(evaluate_id)){return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);}UserDto user = SecurityUserHolder.getCurrentUser(request);if(user == null ){return ResponseCode.buildReturnMap(ResponseCode.TOKEN_EXPIRE, null);}EvaluateDto evaluate = this.evaluateFeignClient.selectByPrimaryKey(CommUtil.null2Long(evaluate_id));if(null == evaluate || null==evaluate.getFabulous()){return ResponseCode.buildCodeMap("20009", "评论数据异常", null);}Map<String, Object> params = Maps.newHashMap();Integer sumFabulous =evaluate.getFabulous()+CommUtil.null2Int(1);params.put("fabulous",sumFabulous); //点赞数量params.put("id", evaluate.getId()); //评价编号this.evaluateFeignClient.updateByFabulous(params);params.clear();params.put("evaluate_id", evaluate.getId());params.put("creater_id", user.getId());EvaluatePraise evaluateFabulous = this.evaluatePraiseService.getByCreaterIdAndEvaluateId(params); //根据评价编号if(null==evaluateFabulous){EvaluatePraise obj = new EvaluatePraise();obj.setEvaluate_id(evaluate.getId()); //对应评价编号obj.setPraise(1); //点赞标识obj.setCreater_id(SecurityUserHolder.getCurrentUser(request).getId()); //点赞用户obj.setAddTime(new Date()); //点赞时间this.evaluatePraiseService.saveEntity(obj);}return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, sumFabulous);}}
源码地址来源: https://minglisoft.cn/honghu2/business.html
商家酒店模块之java商城 开源java电子商务Spring Cloud+Spring Boot+mybatis+MQ+VR全景+b2b2c相关推荐
- 分离聚合支付之java商城 开源java电子商务Spring Cloud+Spring Boot+mybatis+MQ+VR全景+b2b2c
源码地址来源: https://minglisoft.cn/honghu2/business.html package com.honghu.cloud.controller;import java. ...
- java版聚合支付源码Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+b2b2c多商家入驻前后端分离商城源码
@源码地址来源: https://minglisoft.cn/honghu/business.html 电商微信支付.支付宝支付.余额支付代码 package com.honghu.cloud.con ...
- java版商城源码之聚合支付Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+b2b2c多商家入驻前后端分离
@源码地址来源: https://minglisoft.cn/honghu/business.html package com.honghu.cloud.controller;import java. ...
- java版商城源码之商家中心Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+b2b2c多商家入驻前后端分离商城源码
@源码地址来源: https://minglisoft.cn/honghu/business.html /*** Copyright © 2012-2017 <a href="http ...
- java版微信小程序登录商城源码Spring Cloud+Redis+MQ+VR全景+b2b2c多商家入驻前后端分离商城源码
@源码地址来源: https://minglisoft.cn/honghu2/business.html 微信小程序登录代码: /*** Copyright © 2012-2017 <a hre ...
- java版微信小程序登录商城源码Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+b2b2c多商家入驻前后端分离商城源码
@源码地址来源: https://minglisoft.cn/honghu2/business.html 微信小程序登录代码: /*** Copyright © 2012-2017 <a hre ...
- java版微信小程序多商家入驻前后端分离商城源码 Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+b2b2c
@源码地址来源: https://minglisoft.cn/honghu2/business.html 微信小程序登录代码: /*** Copyright © 2012-2017 <a hre ...
- java版微信小程序之多商家入驻前后端分离商城源码 Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+b2b2c
@源码地址来源: https://minglisoft.cn/honghu2/business.html 微信小程序登录代码: /*** Copyright © 2012-2017 <a hre ...
- java版微信小程序登录商城源码MQ+VR全景+b2b2c多商家入驻前后端分离商城源码
@源码地址来源: https://minglisoft.cn/honghu2/business.html 微信小程序登录代码: /*** Copyright © 2012-2017 <a hre ...
最新文章
- 零基础入门学习Python(15)-序列
- 图灵奖大佬Hinton团队CV新作:用语言建模做目标检测,性能媲美DETR
- TextView及其子类
- 《简明 PHP 教程》01 关于 PHP
- H5前端框架推荐合集 (转)
- OpenCASCADE:OCCT应用框架OCAF之标准属性
- 交换机组网常见九大故障问题
- 如何学习编程?顺便介绍些好的网站
- ibm java英语面试_IBMJava英文面试题(附参考答案)
- android学习笔记---43_音乐播放器,音频采集,音乐播放,使用SoundPool播放音效
- HanLP自定义词典注意事项
- c语言实现全排列并存储,C语言实现全排列和回溯法总结
- Jetson Nano配置MCP2515 CANBUS模块
- git命令之配置diff3冲突合并方式及KDiff3工具
- jquery.seat-charts.1.1.15 选座座位插件的方法介绍
- 中印程序员对比:是什么让我们觉得印度程序员很厉害?
- The project uses Gradle 4.4 which is incompatible with Java 11 or newer.
- 第十三届蓝桥杯复盘及未来规划
- vue2.0生命周期数据共享
- Mac 程序员的十种武器