|
|
@@ -1,7 +1,9 @@
|
|
|
package org.jeecg.modules.business.controller;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
@@ -20,13 +22,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.business.dto.BusMarketAgreementCheckInRecordDto;
|
|
|
import org.jeecg.modules.business.entity.*;
|
|
|
+import org.jeecg.modules.business.enums.AgreementCommonEnum;
|
|
|
import org.jeecg.modules.business.enums.AgreenmentAccountStatus;
|
|
|
import org.jeecg.modules.business.enums.AgreenmentCheckStatus;
|
|
|
-import org.jeecg.modules.business.service.IBusMarketAgreementUnitService;
|
|
|
-import org.jeecg.modules.business.service.IBusHotelService;
|
|
|
+import org.jeecg.modules.business.service.*;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
-import org.jeecg.modules.system.entity.SysDictItem;
|
|
|
+import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
@@ -50,6 +53,19 @@ public class BusMarketAgreementUnitController extends JeecgController<BusMarketA
|
|
|
|
|
|
@Autowired
|
|
|
private IBusHotelService busHotelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBusMarketAgreementCheckInRecordService busMarketAgreementCheckInRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBusMarketAgreementCustomerService busMarketAgreementCustomerService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBusMarketAgreementCustomerHousePriceService busMarketAgreementCustomerHousePriceService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private CesRoomLayoutServiceImpl cesRoomLayoutService;
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
|
@@ -85,6 +101,61 @@ public class BusMarketAgreementUnitController extends JeecgController<BusMarketA
|
|
|
return Result.OK(pageList);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param busMarketAgreementCheckInRecordDto
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "协议单位-入住记录-分页列表查询")
|
|
|
+ @ApiOperation(value="协议单位-入住记录-分页列表查询", notes="协议单位-入住记录-分页列表查询")
|
|
|
+ @GetMapping(value = "/listCheckInRecord")
|
|
|
+ public Result<IPage<BusMarketAgreementCheckInRecordDto>> queryPageCheckInRecordList(BusMarketAgreementCheckInRecordDto busMarketAgreementCheckInRecordDto,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ Page<BusMarketAgreementCheckInRecordDto> page = new Page<BusMarketAgreementCheckInRecordDto>(pageNo, pageSize);
|
|
|
+ String startDate = busMarketAgreementCheckInRecordDto.getStartDate() + " 00:00:00";
|
|
|
+ String endDate = busMarketAgreementCheckInRecordDto.getEndDate() + " 23:59:59";
|
|
|
+ IPage<BusMarketAgreementCheckInRecordDto> pageList = busMarketAgreementCheckInRecordService
|
|
|
+ .getCheckInRecord(page,busMarketAgreementCheckInRecordDto.getAgreementId(), startDate, endDate, busMarketAgreementCheckInRecordDto.getRoomNumber(), busMarketAgreementCheckInRecordDto.getCustomerName());
|
|
|
+
|
|
|
+ pageList.getRecords().forEach(item->{
|
|
|
+ //当前客户有选择具体客户协议,则房价根据客户协议处理
|
|
|
+ if (item.getAgreementCustomerId() != null && !item.getAgreementCustomerId().equals("")){
|
|
|
+ BigDecimal realPrice = getRealPrice(item);
|
|
|
+ item.setHousePrice(realPrice);
|
|
|
+ item.setTotalPrice(realPrice);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ public BigDecimal getRealPrice(BusMarketAgreementCheckInRecordDto item){
|
|
|
+ long realPrice = 0;
|
|
|
+ BusMarketAgreementCustomer busMarketAgreementCustomer = busMarketAgreementCustomerService.getById(item.getAgreementCustomerId());
|
|
|
+ if (busMarketAgreementCustomer != null ){
|
|
|
+ //使用固定折扣,则房价=门市价*固定折扣
|
|
|
+ if (busMarketAgreementCustomer.getFixedDiscount() == AgreementCommonEnum.yes.getKey()){
|
|
|
+ realPrice = Math.round(item.getHousePrice().doubleValue() * (busMarketAgreementCustomer.getDiscount().doubleValue()/100));
|
|
|
+ }else{
|
|
|
+ //获取到协议房价表
|
|
|
+ QueryWrapper<BusMarketAgreementCustomerHousePrice> queryWrapper = new QueryWrapper<BusMarketAgreementCustomerHousePrice>();
|
|
|
+ queryWrapper.eq("customer_id",item.getAgreementCustomerId());
|
|
|
+ queryWrapper.eq("layout_id",item.getLayoutId());
|
|
|
+ BusMarketAgreementCustomerHousePrice busMarketAgreementCustomerHousePrice = busMarketAgreementCustomerHousePriceService.getOne(queryWrapper);
|
|
|
+ if(busMarketAgreementCustomerHousePrice != null && busMarketAgreementCustomerHousePrice.getDiscount() !=null){
|
|
|
+ realPrice = Math.round(item.getHousePrice().doubleValue() * (busMarketAgreementCustomerHousePrice.getDiscount().doubleValue()/100));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return BigDecimal.valueOf(realPrice);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|