|
|
@@ -15,9 +15,12 @@ import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jeecg.annotation.ApiLogin;
|
|
|
import org.jeecg.com.util.ThirdSessionHolder;
|
|
|
+import org.jeecg.common.api.dto.message.MessageDTO;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
+import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.TenantContextHolder;
|
|
|
import org.jeecg.config.ApiVersion;
|
|
|
@@ -43,6 +46,8 @@ import org.jeecg.modules.rooms.Vo.CanUseResultVo;
|
|
|
import org.jeecg.modules.rooms.entity.*;
|
|
|
import org.jeecg.modules.rooms.service.*;
|
|
|
import org.jeecg.modules.mall.entity.MallUserInfo;
|
|
|
+import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecg.modules.system.service.ISysUserService;
|
|
|
import org.jeecg.modules.wxuser.service.IUserInfoService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -104,6 +109,10 @@ public class HotelController extends WebConfig {
|
|
|
private IMallOrderGoodsDetailService mallOrderGoodsDetailService;
|
|
|
@Resource
|
|
|
private IBusMemberBalanceLogService busMemberBalanceLogService;
|
|
|
+ @Resource
|
|
|
+ private ISysBaseAPI sysBaseAPI;
|
|
|
+ @Resource
|
|
|
+ private ISysUserService sysUserService;
|
|
|
/**
|
|
|
* 酒店列表查询
|
|
|
*
|
|
|
@@ -165,22 +174,15 @@ public class HotelController extends WebConfig {
|
|
|
@ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
public Result<BusHotel> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
BusHotel busHotel = busHotelService.getById(id);
|
|
|
-
|
|
|
-// String token = UUID.randomUUID().toString();
|
|
|
-// ThirdSession thirdSession = new ThirdSession();
|
|
|
-// thirdSession.setTenantId("5");
|
|
|
-// thirdSession.setAppId("wx25c23ef33ba80ee5");
|
|
|
-// thirdSession.setSessionKey("");
|
|
|
-// thirdSession.setWxUserId("111111111");
|
|
|
-// thirdSession.setOpenId("");
|
|
|
-// thirdSession.setUserId("111111111");
|
|
|
-//
|
|
|
-// String key = CommonConstant.PREFIX_WX_APP_USER_TOKEN + token;
|
|
|
-// // 设置token缓存有效时间
|
|
|
-// redisUtil.set(key, com.alibaba.fastjson.JSON.toJSONString(thirdSession));
|
|
|
-//// redisUtil.set(key, JSONUtils.toJSONString(thirdSession));
|
|
|
-// redisUtil.expire(key, JwtUtil.EXPIRE_TIME * 24 * 30 / 1000);
|
|
|
-// busHotel.setTenantId(token);
|
|
|
+ LambdaQueryWrapper<CesOrderComment> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(CesOrderComment::getHotelId, busHotel.getId());
|
|
|
+ lambdaQueryWrapper.eq(CesOrderComment::getCommentType, 1);
|
|
|
+ List<CesOrderComment> list = cesOrderCommentService.list(lambdaQueryWrapper);
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
+ busHotel.setCommentNum(list.size());
|
|
|
+ Double score = list.stream().collect(Collectors.averagingDouble(CesOrderComment::getScore));
|
|
|
+ busHotel.setScore(score);
|
|
|
+ }
|
|
|
return Result.OK(busHotel);
|
|
|
}
|
|
|
|
|
|
@@ -427,6 +429,25 @@ public class HotelController extends WebConfig {
|
|
|
busRoomBookingOrders.getOrderInfo().setCustomerType(1);
|
|
|
}
|
|
|
busRoomBookingOrdersService.bookingOrderSave(busRoomBookingOrders, isTeam);
|
|
|
+
|
|
|
+ //创建业务消息信息
|
|
|
+ LambdaQueryWrapper<SysUser> lambdaQueryWrapper3 = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper3.eq(SysUser::getDelFlag, 0);
|
|
|
+ lambdaQueryWrapper3.eq(SysUser::getRelTenantIds, mallHotelOrder.getTenantId());
|
|
|
+ List<SysUser> sysUsers = sysUserService.list(lambdaQueryWrapper3);
|
|
|
+ String userIds = "";
|
|
|
+ for (SysUser sysUser : sysUsers) {
|
|
|
+ userIds += sysUser.getUsername() + ",";
|
|
|
+ }
|
|
|
+ if (userIds.length() > 0) {
|
|
|
+ MessageDTO messageDTO = new MessageDTO();
|
|
|
+ messageDTO.setFromUser("");
|
|
|
+ messageDTO.setToUser(userIds);
|
|
|
+ messageDTO.setTitle("用户预定了酒店订单");
|
|
|
+ messageDTO.setContent("用户预定了酒店订单");
|
|
|
+ messageDTO.setCategory(CommonConstant.MSG_CATEGORY_2);
|
|
|
+ sysBaseAPI.sendSysAnnouncement(messageDTO);
|
|
|
+ }
|
|
|
return Result.OK("预定成功");
|
|
|
}
|
|
|
|
|
|
@@ -480,6 +501,7 @@ public class HotelController extends WebConfig {
|
|
|
if (cesRooms != null) {
|
|
|
busHotel = busHotelService.getById(cesRooms.getHotelId());
|
|
|
busHotel.setRoomName(cesRooms.getName());
|
|
|
+ busHotel.setLivingOrder(busRoomsLivingOrder);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -571,6 +593,24 @@ public class HotelController extends WebConfig {
|
|
|
updateWrapper.set(BusRoomBookingOrders::getBookingStatus, 1);
|
|
|
updateWrapper.eq(BusRoomBookingOrders::getOuterOrdersNo, order.getCode());
|
|
|
busRoomBookingOrdersService.update(updateWrapper);
|
|
|
+ //创建业务消息信息
|
|
|
+ LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getDelFlag, 0);
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getRelTenantIds, order.getTenantId());
|
|
|
+ List<SysUser> sysUsers = sysUserService.list(lambdaQueryWrapper);
|
|
|
+ String userIds = "";
|
|
|
+ for (SysUser sysUser : sysUsers) {
|
|
|
+ userIds += sysUser.getUsername() + ",";
|
|
|
+ }
|
|
|
+ if (userIds.length() > 0) {
|
|
|
+ MessageDTO messageDTO = new MessageDTO();
|
|
|
+ messageDTO.setFromUser("");
|
|
|
+ messageDTO.setToUser(userIds);
|
|
|
+ messageDTO.setTitle("酒店订单确认入住");
|
|
|
+ messageDTO.setContent("用户已确认酒店订单入住");
|
|
|
+ messageDTO.setCategory(CommonConstant.MSG_CATEGORY_2);
|
|
|
+ sysBaseAPI.sendSysAnnouncement(messageDTO);
|
|
|
+ }
|
|
|
return Result.OK("确认入住成功!");
|
|
|
}
|
|
|
|
|
|
@@ -585,6 +625,24 @@ public class HotelController extends WebConfig {
|
|
|
}
|
|
|
order.setStatus(3);
|
|
|
mallHotelOrderService.updateById(order);
|
|
|
+ //创建业务消息信息
|
|
|
+ LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getDelFlag, 0);
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getRelTenantIds, order.getTenantId());
|
|
|
+ List<SysUser> sysUsers = sysUserService.list(lambdaQueryWrapper);
|
|
|
+ String userIds = "";
|
|
|
+ for (SysUser sysUser : sysUsers) {
|
|
|
+ userIds += sysUser.getUsername() + ",";
|
|
|
+ }
|
|
|
+ if (userIds.length() > 0) {
|
|
|
+ MessageDTO messageDTO = new MessageDTO();
|
|
|
+ messageDTO.setFromUser("");
|
|
|
+ messageDTO.setToUser(userIds);
|
|
|
+ messageDTO.setTitle("商城酒店订单取消");
|
|
|
+ messageDTO.setContent("用户已确认商城酒店订单取消");
|
|
|
+ messageDTO.setCategory(CommonConstant.MSG_CATEGORY_2);
|
|
|
+ sysBaseAPI.sendSysAnnouncement(messageDTO);
|
|
|
+ }
|
|
|
return Result.OK("取消成功!");
|
|
|
}
|
|
|
|
|
|
@@ -762,6 +820,24 @@ public class HotelController extends WebConfig {
|
|
|
});
|
|
|
mallOrderGoodsDetailService.saveBatch(mallOrderGoods.getDetailList());
|
|
|
|
|
|
+ //创建业务消息信息
|
|
|
+ LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getDelFlag, 0);
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getRelTenantIds, mallOrderGoods.getTenantId());
|
|
|
+ List<SysUser> sysUsers = sysUserService.list(lambdaQueryWrapper);
|
|
|
+ String userIds = "";
|
|
|
+ for (SysUser sysUser : sysUsers) {
|
|
|
+ userIds += sysUser.getUsername() + ",";
|
|
|
+ }
|
|
|
+ if (userIds.length() > 0) {
|
|
|
+ MessageDTO messageDTO = new MessageDTO();
|
|
|
+ messageDTO.setFromUser("");
|
|
|
+ messageDTO.setToUser(userIds);
|
|
|
+ messageDTO.setTitle("商城点餐订单");
|
|
|
+ messageDTO.setContent("商城点餐订单");
|
|
|
+ messageDTO.setCategory(CommonConstant.MSG_CATEGORY_2);
|
|
|
+ sysBaseAPI.sendSysAnnouncement(messageDTO);
|
|
|
+ }
|
|
|
return Result.ok("提交成功");
|
|
|
}
|
|
|
|
|
|
@@ -855,4 +931,54 @@ public class HotelController extends WebConfig {
|
|
|
mallOrderGoods.setDetailList(list);
|
|
|
return Result.OK(mallOrderGoods);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取入住订单费用账单(结账界面费用展示)
|
|
|
+ * @param bookingOrderId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value="获取入住订单费用账单(结账界面费用展示)", notes="获取入住订单费用账单(结账界面费用展示)")
|
|
|
+ @RequestMapping(value = "/living-fees",method = RequestMethod.GET)
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ @ApiLogin
|
|
|
+ public Result<HashMap> getLivingOrderFees(String bookingOrderId) {
|
|
|
+ if (bookingOrderId == null || bookingOrderId.isEmpty()) throw new JeecgBootException("参数错误");
|
|
|
+ List<BusOrderFee> list = busRoomBookingOrdersService.getLivingOrderFee(bookingOrderId);
|
|
|
+ HashMap<String, BigDecimal> obj = new HashMap<String, BigDecimal>();
|
|
|
+ obj.put("xf", BigDecimal.ZERO);
|
|
|
+ obj.put("sk", BigDecimal.ZERO);
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ List<BusOrderFee> xfList = list.stream().filter(t -> t.getFeeType().equals(1)).collect(Collectors.toList());
|
|
|
+ if (xfList != null && xfList.size() > 0) {
|
|
|
+ BigDecimal sum = BigDecimal.ZERO;
|
|
|
+ for (BusOrderFee busOrderFee : xfList) {
|
|
|
+ sum = sum.add(busOrderFee.getMoney());
|
|
|
+ }
|
|
|
+ obj.put("xf", sum);
|
|
|
+ }
|
|
|
+ List<BusOrderFee> skList = list.stream().filter(t -> t.getFeeType().equals(2)).collect(Collectors.toList());
|
|
|
+ if (skList != null && skList.size() > 0) {
|
|
|
+ BigDecimal sum = BigDecimal.ZERO;
|
|
|
+ for (BusOrderFee busOrderFee : skList) {
|
|
|
+ sum = sum.add(busOrderFee.getMoney());
|
|
|
+ }
|
|
|
+ obj.put("sk", sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.ok(obj);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单房一键结账
|
|
|
+ * @param livingOrderId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value="单房一键结账", notes="单房一键结账")
|
|
|
+ @RequestMapping(value = "/living-settle-checkout",method = RequestMethod.POST)
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ @ApiLogin
|
|
|
+ public Result<Boolean> livingSettleBillCheckOut(@RequestBody List<BusOrderFee> fees, String livingOrderId) {
|
|
|
+ Boolean isOk = busRoomBookingOrdersService.livingSettleBillCheckOut(fees,livingOrderId);
|
|
|
+ return Result.OK(isOk);
|
|
|
+ }
|
|
|
}
|