Commit 98a6984c authored by 周健威's avatar 周健威

Merge branch 'holiday-price' into dev

parents f89d93cd 8deb88e8
...@@ -55,7 +55,7 @@ public class OrderItemBiz extends BaseBiz<OrderItemMapper,OrderItem> { ...@@ -55,7 +55,7 @@ public class OrderItemBiz extends BaseBiz<OrderItemMapper,OrderItem> {
//根据延期的天数算出 对应的日期价格 //根据延期的天数算出 对应的日期价格
Date overStart = DateUtil.offsetDay(endDate, 1); Date overStart = DateUtil.offsetDay(endDate, 1);
Date overEnd = DateUtil.offsetDay(endDate, overDays); Date overEnd = DateUtil.offsetDay(endDate, overDays);
List<VehicleModelCalendarPriceDTO> overlist = vehicleFeign.findVehicleModelCalendarPriceByDate(overStart, overEnd, modelId, userId); List<VehicleModelCalendarPriceDTO> overlist = vehicleFeign.findVehicleModelCalendarPriceByDate(overStart, overEnd, modelId, userId).getData();
for(VehicleModelCalendarPriceDTO vmcpd : overlist) { for(VehicleModelCalendarPriceDTO vmcpd : overlist) {
overAmountList.add((VMCalendarPriceCostDTO) vmcpd); overAmountList.add((VMCalendarPriceCostDTO) vmcpd);
......
...@@ -238,7 +238,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -238,7 +238,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
VehicleModel vehicleModel = vehicleFeign.get(detail.getModelId()).getData(); VehicleModel vehicleModel = vehicleFeign.get(detail.getModelId()).getData();
detail.initDate(); detail.initDate();
List<VehicleModelCalendarPriceDTO> vmcpds = vehicleFeign.findVehicleModelCalendarPriceByDate(detail.getStartDate(), detail.getEndDate(), detail.getModelId(), dto.getUserid()); List<VehicleModelCalendarPriceDTO> vmcpds = vehicleFeign.findVehicleModelCalendarPriceByDate(detail.getStartDate(), detail.getEndDate(), detail.getModelId(), dto.getUserid()).getData();
//设置Item //设置Item
......
...@@ -12,12 +12,10 @@ import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo; ...@@ -12,12 +12,10 @@ import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo; import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO; import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* Created by ace on 2017/9/15. * Created by ace on 2017/9/15.
...@@ -190,8 +188,8 @@ public interface VehicleFeign { ...@@ -190,8 +188,8 @@ public interface VehicleFeign {
* @param userId * @param userId
* @return * @return
*/ */
@GetMapping("/vehicle_model/calendar_price/app/unauth/price") @GetMapping(value = "/vehicle_model/calendar_price/app/unauth/price",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
List<VehicleModelCalendarPriceDTO> findVehicleModelCalendarPriceByDate(@RequestParam(value = "startDate") Date startDate, ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> findVehicleModelCalendarPriceByDate(@RequestParam(value = "startDate") Date startDate,
@RequestParam(value = "endDate") Date endDate, @RequestParam(value = "endDate") Date endDate,
@RequestParam(value = "vehicleModelId") Integer vehicleModelId, @RequestParam(value = "vehicleModelId") Integer vehicleModelId,
@RequestParam(value = "userId") Integer userId); @RequestParam(value = "userId") Integer userId);
......
package com.xxfc.platform.vehicle.pojo.dto; package com.xxfc.platform.vehicle.pojo.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
......
...@@ -89,19 +89,15 @@ public class VehicleModelHolidayPriceBiz extends BaseBiz<VehicleModelHolidayPric ...@@ -89,19 +89,15 @@ public class VehicleModelHolidayPriceBiz extends BaseBiz<VehicleModelHolidayPric
/** /**
* @param multiple 倍数 * @param multiple 倍数
* @param freeDays 免费天数 * @param freeDays 免费天数
* @param configDate 设置的日期*月份
*/ */
public void updateVehicleModelHolidayPrice(Double multiple, Integer freeDays, Date configDate) { public void updateVehicleModelHolidayPrice(Double multiple, Integer freeDays) {
VehicleModelHolidayPrice vehicleModelHolidayPrice = new VehicleModelHolidayPrice(); VehicleModelHolidayPrice vehicleModelHolidayPrice = new VehicleModelHolidayPrice();
vehicleModelHolidayPrice.setMultiple(multiple); vehicleModelHolidayPrice.setMultiple(multiple);
vehicleModelHolidayPrice.setFreeDays(freeDays); vehicleModelHolidayPrice.setFreeDays(freeDays);
Example example = new Example(VehicleModelHolidayPrice.class); Example example = new Example(VehicleModelHolidayPrice.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
setCondtionDate(configDate, null, criteria); criteria.andEqualTo("isDel",0);
int effect = mapper.updateByExampleSelective(vehicleModelHolidayPrice, example); mapper.updateByExampleSelective(vehicleModelHolidayPrice,example);
if (effect < 1) {
throw new BaseException("车型节假日更新失败");
}
} }
/** /**
......
...@@ -11,4 +11,5 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -11,4 +11,5 @@ import tk.mybatis.mapper.common.Mapper;
* @data 2019/10/14 17:32 * @data 2019/10/14 17:32
*/ */
public interface VehicleModelHolidayPriceMapper extends Mapper<VehicleModelHolidayPrice>, InsertListMapper<VehicleModelHolidayPrice> { public interface VehicleModelHolidayPriceMapper extends Mapper<VehicleModelHolidayPrice>, InsertListMapper<VehicleModelHolidayPrice> {
} }
...@@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor; ...@@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDate; import java.time.LocalDate;
...@@ -51,13 +52,13 @@ public class VehicleModelCalendarPriceController { ...@@ -51,13 +52,13 @@ public class VehicleModelCalendarPriceController {
return ObjectRestResponse.succ(vehicleModelCalendarPriceVos); return ObjectRestResponse.succ(vehicleModelCalendarPriceVos);
} }
@GetMapping("/price") @GetMapping(value = "/price",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<VehicleModelCalendarPriceDTO> findVehicleModelCalendarPriceByDate(@RequestParam(value = "startDate") Date startDate, public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> findVehicleModelCalendarPriceByDate(@RequestParam(value = "startDate") Date startDate,
@RequestParam(value = "endDate") Date endDate, @RequestParam(value = "endDate") Date endDate,
@RequestParam(value = "vehicleModelId") Integer vehicleModelId, @RequestParam(value = "vehicleModelId") Integer vehicleModelId,
@RequestParam(value = "userId") Integer userId) { @RequestParam(value = "userId") Integer userId) {
startDate = Date.from(startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant()); startDate = Date.from(startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
endDate = Date.from(endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant()); endDate = Date.from(endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
return vehicleModelCalendarPriceBiz.findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId(startDate, endDate, vehicleModelId, userId); return ObjectRestResponse.succ(vehicleModelCalendarPriceBiz.findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId(startDate, endDate, vehicleModelId, userId));
} }
} }
...@@ -35,21 +35,27 @@ public class VehicleModelHolidayPriceAdminController { ...@@ -35,21 +35,27 @@ public class VehicleModelHolidayPriceAdminController {
} }
@GetMapping("/{id}") @GetMapping("/{id}")
public ObjectRestResponse<VehicleModelHolidayPriceSaveDTO> findVehicleModelHolidayPrice(@PathVariable(value = "id") Long id){ public ObjectRestResponse<VehicleModelHolidayPriceSaveDTO> findVehicleModelHolidayPrice(@PathVariable(value = "id") Long id) {
VehicleModelHolidayPriceSaveDTO vehicleModelHolidayPriceSaveDTO = vehicleModelHolidayPriceBiz.findVehicleModelHolidayPriceFestivalId(id); VehicleModelHolidayPriceSaveDTO vehicleModelHolidayPriceSaveDTO = vehicleModelHolidayPriceBiz.findVehicleModelHolidayPriceFestivalId(id);
return ObjectRestResponse.succ(vehicleModelHolidayPriceSaveDTO); return ObjectRestResponse.succ(vehicleModelHolidayPriceSaveDTO);
} }
@ApiOperation("节假日页查询") @ApiOperation("节假日页查询")
@PostMapping("/page") @PostMapping("/page")
public ObjectRestResponse<List<VehicleModelHolidayPriceVo>> listVehicleModelHolidayPrice(@RequestBody VehicleModelHolidayPriceFindDTO vehicleModelHolidayPriceFindDTO){ public ObjectRestResponse<List<VehicleModelHolidayPriceVo>> listVehicleModelHolidayPrice(@RequestBody VehicleModelHolidayPriceFindDTO vehicleModelHolidayPriceFindDTO) {
List<VehicleModelHolidayPriceVo> priceVoPageDataVO = vehicleModelHolidayPriceBiz.listVehicleModelHolidayPrice(vehicleModelHolidayPriceFindDTO); List<VehicleModelHolidayPriceVo> priceVoPageDataVO = vehicleModelHolidayPriceBiz.listVehicleModelHolidayPrice(vehicleModelHolidayPriceFindDTO);
return ObjectRestResponse.succ(priceVoPageDataVO); return ObjectRestResponse.succ(priceVoPageDataVO);
} }
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public ObjectRestResponse<Void> delete(@PathVariable(value = "id") Integer id){ public ObjectRestResponse<Void> delete(@PathVariable(value = "id") Integer id) {
vehicleModelHolidayPriceBiz.deleteById(id); vehicleModelHolidayPriceBiz.deleteById(id);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@PutMapping("/update")
public ObjectRestResponse<Void> update(@RequestParam(value = "multiple",required = false) Double multiple, @RequestParam(value = "freeDays",required = false) Integer freeDays) {
vehicleModelHolidayPriceBiz.updateVehicleModelHolidayPrice(multiple, freeDays);
return ObjectRestResponse.succ();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment