|
|
@@ -1,10 +1,14 @@
|
|
|
package org.springblade.app.controller;
|
|
|
|
|
|
+import cn.hutool.core.lang.Assert;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.constant.OperationConstant;
|
|
|
+import org.springblade.community.entity.Room;
|
|
|
+import org.springblade.community.feign.IRoomClient;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.estate.entity.ApplyUser;
|
|
|
import org.springblade.estate.entity.GuestAuthorize;
|
|
|
import org.springblade.estate.feign.IApplyUserClient;
|
|
|
@@ -33,6 +37,7 @@ public class GuestAuthorizeController {
|
|
|
private final IApplyUserClient applyUserClient;
|
|
|
private final IGuestAuthorizeClient guestAuthorizeClient;
|
|
|
private final IHouseUserClient houseUserClient;
|
|
|
+ private final IRoomClient roomClient;
|
|
|
|
|
|
/**
|
|
|
* 功能描述: 通过会员id获取访客授权密码列表
|
|
|
@@ -86,6 +91,39 @@ public class GuestAuthorizeController {
|
|
|
return hashMap;
|
|
|
}
|
|
|
|
|
|
+ @PostMapping(value = "/addGuestAuthorize")
|
|
|
+ public R addGuestAuthorize(@RequestBody GuestAuthorize guestAuthorize){
|
|
|
+ Long roomId = guestAuthorize.getRoomId();
|
|
|
+ Date beginDate = guestAuthorize.getBeginDate();
|
|
|
+ Date endDate = guestAuthorize.getEndDate();
|
|
|
+ Long memberId = guestAuthorize.getMemberId();
|
|
|
+ Integer guestType = guestAuthorize.getGuestType();
|
|
|
+ Assert.notNull(roomId, "房间id不能为空");
|
|
|
+ Assert.notNull(beginDate, "开始时间不能为空");
|
|
|
+ Assert.notNull(endDate, "结束时间不能为空");
|
|
|
+ Assert.notNull(memberId, "会员id不能为空");
|
|
|
+ Assert.notNull(guestType, "访客类型不能为空");
|
|
|
+ Room room = roomClient.getById(roomId);
|
|
|
+ Assert.notNull(room, "找不到访问的房间");
|
|
|
+ GuestAuthorize ga = new GuestAuthorize();
|
|
|
+ ga.setGuestType(guestType);
|
|
|
+ ga.setRoomId(roomId);
|
|
|
+ ga.setRoomName(room.getName());
|
|
|
+ ga.setUnitId(room.getUnitId());
|
|
|
+ ga.setUnitName(room.getUnitName());
|
|
|
+ ga.setBuildingId(room.getBuildingId());
|
|
|
+ ga.setBuildingName(room.getBuildingName());
|
|
|
+ ga.setUserId(memberId);
|
|
|
+ ga.setUserName(guestAuthorize.getUserName());
|
|
|
+ ga.setResidentialId(room.getResidentialId());
|
|
|
+ ga.setResidentialName(room.getResidentialName());
|
|
|
+ ga.setEnableType(OperationConstant.ZERO);
|
|
|
+ ga.setBeginDate(beginDate);
|
|
|
+ ga.setEndDate(endDate);
|
|
|
+ GuestAuthorize vo = this.guestAuthorizeClient.save(ga);
|
|
|
+ return R.data(vo);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 功能描述: 新增访客授权记录
|
|
|
*
|
|
|
@@ -99,8 +137,8 @@ public class GuestAuthorizeController {
|
|
|
* }
|
|
|
* @return ResultBean<hashMap> 返回结果
|
|
|
*/
|
|
|
- @PostMapping(value = "/addGuestAuthorize")
|
|
|
- public Map<String, Object> getGuestAuthorize(@RequestBody Map<String, String> map) {
|
|
|
+ @PostMapping(value = "/addGuestAuthorize-bak")
|
|
|
+ public Map<String, Object> getGuestAuthorizeBak(@RequestBody Map<String, String> map) {
|
|
|
Map<String, Object> hashMap = new HashMap<>();
|
|
|
//result_code:0-失败 1-成功
|
|
|
hashMap.put("result_code", 0);
|