qh 2 éve
szülő
commit
2ee31a4b04

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusCustomerController.java

@@ -65,7 +65,7 @@ public class BusCustomerController extends JeecgController<BusCustomer, IBusCust
 	@GetMapping(value = "/list")
 	public Result<IPage<BusCustomer>> queryPageList(BusCustomer busCustomer,
 								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   @RequestParam(name="pageSize", defaultValue="99999") Integer pageSize,
 								   HttpServletRequest req) {
 		QueryWrapper<BusCustomer> queryWrapper = QueryGenerator.initQueryWrapper(busCustomer, req.getParameterMap());
 		Page<BusCustomer> page = new Page<BusCustomer>(pageNo, pageSize);

+ 42 - 14
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusRoomBookingOrdersServiceImpl.java

@@ -93,6 +93,27 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
         if(item.getOrderInfo().getBookingOrdersType() == null)
             throw new JeecgBootException("参数错误");
+        // 【添加客人信息 Start】
+            if(item.getContactName() != null && !item.getContactName().isEmpty() && item.getPhone() != null && !item.getPhone().isEmpty()){
+                BusCustomer customer = customerService.getOne(Wrappers.<BusCustomer>query().eq("name",item.getContactName())
+                        .eq("phone",item.getPhone()));
+                if(customer == null) {
+                    // save customer
+                    BusCustomer newCustomer = new BusCustomer();
+                    newCustomer.setCreateTime(new Date());
+                    newCustomer.setCreateUser(user.getId());
+                    newCustomer.setHotelId(user.getRelTenantIds());
+                    newCustomer.setTenantId(user.getRelTenantIds());
+                    newCustomer.setName(item.getContactName());
+                    newCustomer.setPhone(item.getPhone());
+                    newCustomer.setCertType(1); // 身份证
+                    customerService.save(newCustomer);
+                } else {
+                    item.getOrderInfo().setContactId(customer.getId());
+                }
+            } else throw new JeecgBootException("客人信息不能为空");
+
+        // 【添加客人信息 end】
         // 散客预定
         if(item.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.NORMAL.getKey())) {
             if(item.getOrderInfo().getArrivalTime() == null || item.getOrderInfo().getDueOutTime() == null)
@@ -137,21 +158,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             dayPriceService.saveBatch(item.getLayoutDayPrices());
             // 处理预定每天的房型价格 End
 
-            // 添加客人信息 Start
-//            if(item.getContactName() != null && !item.getContactName().isEmpty() && item.getPhone() != null && !item.getPhone().isEmpty()){
-//                BusCustomer customer = customerService.getOne(Wrappers.<BusCustomer>query().eq("name",item.getContactName())
-//                        .eq("phone",item.getPhone()));
-//
-//                if(item.getOrderInfo().getContactId() != null && !item.getOrderInfo().getContactId().isEmpty()) {
-//                    if(customer == null) {
-//                        item.getOrderInfo().setContactId(customer.getId());
-//                    } else {
-//                        if(customer.getId().equals(item.getOrderInfo().getContactId()))
-//                    }
-//                }
-//            }
 
-            // 添加客人信息 end
 
 
             return item.getOrderInfo().getBookingOrdersNo();
@@ -290,6 +297,27 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             if(item.getOrderInfo().getHourRoomId() == null || item.getOrderInfo().getHourRoomId().isEmpty())
                 throw new JeecgBootException("钟点房计费项目不能为空");
         }
+        // 【添加客人信息 Start】
+        if(item.getContactName() != null && !item.getContactName().isEmpty() && item.getPhone() != null && !item.getPhone().isEmpty()){
+            BusCustomer customer = customerService.getOne(Wrappers.<BusCustomer>query().eq("name",item.getContactName())
+                    .eq("phone",item.getPhone()));
+            if(customer == null) {
+                // save customer
+                BusCustomer newCustomer = new BusCustomer();
+                newCustomer.setCreateTime(new Date());
+                newCustomer.setCreateUser(user.getId());
+                newCustomer.setHotelId(user.getRelTenantIds());
+                newCustomer.setTenantId(user.getRelTenantIds());
+                newCustomer.setName(item.getContactName());
+                newCustomer.setPhone(item.getPhone());
+                newCustomer.setCertType(1); // 身份证
+                customerService.save(newCustomer);
+            } else {
+                item.getOrderInfo().setContactId(customer.getId());
+            }
+        } else throw new JeecgBootException("客人信息不能为空");
+
+        // 【添加客人信息 end】
         // 散客预定
         if(item.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.NORMAL.getKey())) {
             if(item.getOrderInfo().getArrivalTime() == null || item.getOrderInfo().getDueOutTime() == null)