Commit 3ea1b53c authored by hezhen's avatar hezhen

Merge branch 'dev-chw' of http://113.105.137.151:22280/youjj/cloud-platform into dev-chw

parents f4f482f0 cd38a860
package com.github.wxiaoqi.security.common.biz; package com.github.wxiaoqi.security.common.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -235,18 +237,38 @@ public abstract class BaseBiz<M extends Mapper<T>, T> { ...@@ -235,18 +237,38 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
return new TableResultResponse<T>(result.getTotal(), list); return new TableResultResponse<T>(result.getTotal(), list);
} }
public ObjectRestResponse selectAll(){ public ObjectRestResponse selectAll(T entity){
List<T> list = selectListAlls(); List<T> list = selectListAlls(entity);
return ObjectRestResponse.succ(list); return ObjectRestResponse.succ(list);
} }
public List<T> selectListAlls(){ public List<T> selectListAlls(){
return selectListAlls(null);
}
public List<T> selectListAlls(T entity){
Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1]; Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
Example example = new Example(clazz); Example example = new Example(clazz);
Example.Criteria criteria=example.createCriteria(); Example.Criteria criteria=example.createCriteria();
if(null != entity) {
Map<String, Object> map = BeanUtil.beanToMap(entity);
if(map.entrySet().size()>0) {
if (criteria==null){
criteria=example.createCriteria();
}
for (Map.Entry<String, Object> entry : map.entrySet()) {
if(null != entry.getValue()) {
criteria.andLike(entry.getKey(), "%" + entry.getValue().toString() + "%");
}
}
}
}
if (checkFieldName(clazz,"isDel")){ if (checkFieldName(clazz,"isDel")){
criteria.andEqualTo("isDel",0); criteria.andEqualTo("isDel",0);
} }
if (checkFieldName(clazz,"sortOrder")){ if (checkFieldName(clazz,"sortOrder")){
example.setOrderByClause("sort_order desc"); example.setOrderByClause("sort_order desc");
}else if(checkFieldName(clazz,"rank")){ }else if(checkFieldName(clazz,"rank")){
......
...@@ -116,8 +116,8 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro ...@@ -116,8 +116,8 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
@ApiOperation("查询所有") @ApiOperation("查询所有")
@RequestMapping(value = "/alls",method = RequestMethod.GET) @RequestMapping(value = "/alls",method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ObjectRestResponse alls(){ public ObjectRestResponse alls(Entity entity){
return baseBiz.selectAll(); return ObjectRestResponse.succ(baseBiz.selectListAlls(entity));
} }
......
...@@ -212,4 +212,8 @@ public class ShuntApply implements Serializable { ...@@ -212,4 +212,8 @@ public class ShuntApply implements Serializable {
@Column(name = "category_id") @Column(name = "category_id")
@ApiModelProperty("型号id") @ApiModelProperty("型号id")
private Integer categoryId; private Integer categoryId;
@Column(name = "goods_type")
@ApiModelProperty("商品类型 1--房车;2--机车;3--游艇")
private Integer goodsType;
} }
...@@ -251,7 +251,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -251,7 +251,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
detail.setStartTime(shuntApply.getStartTime()); detail.setStartTime(shuntApply.getStartTime());
detail.setEndTime(shuntApply.getEndTime()); detail.setEndTime(shuntApply.getEndTime());
detail.setVehicleId(dto.getVehicleId()); detail.setVehicleId(dto.getVehicleId());
detail.setModelId(shuntApply.getModelId()); // detail.setModelId(shuntApply.getModelId());
detail.setStartAddr(shuntApply.getStartCompanyName()); detail.setStartAddr(shuntApply.getStartCompanyName());
detail.setStartCompanyId(shuntApply.getStartCompanyId()); detail.setStartCompanyId(shuntApply.getStartCompanyId());
detail.setEndCompanyId(shuntApply.getEndCompanyId()); detail.setEndCompanyId(shuntApply.getEndCompanyId());
...@@ -292,7 +292,9 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -292,7 +292,9 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
StewardShuntApply shuntApplyVO = BeanUtil.toBean(shuntApply, StewardShuntApply.class); StewardShuntApply shuntApplyVO = BeanUtil.toBean(shuntApply, StewardShuntApply.class);
shuntApplyVO.setVehicleCategory(vehicleFeign.getVehicleCategory(shuntApply.getCategoryId()).getData()); shuntApplyVO.setVehicleCategory(vehicleFeign.getVehicleCategory(shuntApply.getCategoryId()).getData());
RentVehicleBookDTO rbd = new RentVehicleBookDTO(); RentVehicleBookDTO rbd = new RentVehicleBookDTO();
rbd.setModelId(shuntApply.getModelId()); //rbd.setModelId(shuntApply.getModelId());
rbd.setBrandId(shuntApply.getBrandId());
rbd.setCategoryId(shuntApply.getCategoryId());
rbd.setParkBranchCompanyId(companyId); rbd.setParkBranchCompanyId(companyId);
rbd.setStartCompanyId(companyId); rbd.setStartCompanyId(companyId);
rbd.setEndCompanyId(companyId); rbd.setEndCompanyId(companyId);
......
...@@ -371,10 +371,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -371,10 +371,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
@Override @Override
public RentVehiclePriceVO calculatePrice(RentVehicleBO detail) { public RentVehiclePriceVO calculatePrice(RentVehicleBO detail) {
if(Vehicle.GOODS_TYPE_RV == detail.getOrder().getGoodsType()) { if(Vehicle.PRICE_TYPE_HOUR == detail.getVehicle().getPriceType()) {
return dayCalculatePrice(detail);
}else {
return hourCalculatePrice(detail); return hourCalculatePrice(detail);
}else {
return dayCalculatePrice(detail);
} }
} }
......
...@@ -20,6 +20,9 @@ public class Vehicle { ...@@ -20,6 +20,9 @@ public class Vehicle {
public static final int STATE_UP = 1; public static final int STATE_UP = 1;
public static final int STATE_DOWN = 2; public static final int STATE_DOWN = 2;
public static final int PRICE_TYPE_DAY = 1;
public static final int PRICE_TYPE_HOUR = 2;
/** /**
* 主键(uuid) * 主键(uuid)
*/ */
......
...@@ -45,6 +45,7 @@ import java.util.HashSet; ...@@ -45,6 +45,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import static cn.hutool.core.date.DateField.HOUR_OF_DAY;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.*; import static com.github.wxiaoqi.security.common.constant.CommonConstants.*;
import static com.xxfc.platform.vehicle.constant.VehicleConstant.USER_APP; import static com.xxfc.platform.vehicle.constant.VehicleConstant.USER_APP;
import static com.xxfc.platform.vehicle.constant.VehicleConstant.USER_APP_NAME; import static com.xxfc.platform.vehicle.constant.VehicleConstant.USER_APP_NAME;
...@@ -422,25 +423,49 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements ...@@ -422,25 +423,49 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
return CollUtil.newArrayList(); return CollUtil.newArrayList();
} }
//Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate)); if(Vehicle.PRICE_TYPE_HOUR == vehicle.getPriceType()) {
for(cn.hutool.core.date.DateTime currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate)); //Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
(currentDate.isAfterOrEquals(beginOfStartDate) && currentDate.isBeforeOrEquals(endOfEndDate)); for(cn.hutool.core.date.DateTime currentDate = DateUtil.truncate(DateUtil.parse(startDate), HOUR_OF_DAY);
currentDate = DateUtil.offsetDay(currentDate, 1)) { (currentDate.isAfterOrEquals(beginOfStartDate) && currentDate.isBeforeOrEquals(endOfEndDate));
cn.hutool.core.date.DateTime finalCurrentDate = currentDate; currentDate = DateUtil.offsetHour(currentDate, 1)) {
VehicleModelCalendarPriceDTO dto = new VehicleModelCalendarPriceDTO(){{ cn.hutool.core.date.DateTime finalCurrentDate = currentDate;
setDate(DateUtil.beginOfDay(finalCurrentDate)); VehicleModelCalendarPriceDTO dto = new VehicleModelCalendarPriceDTO(){{
}}; setDate(DateUtil.beginOfDay(finalCurrentDate));
if(currentDate.isWeekend()) { }};
dto.setNo_discount_price(vehicle.getHolidayPrice()); if(currentDate.isWeekend()) {
dto.setPrice(vehicle.getHolidayPrice()); dto.setNo_discount_price(vehicle.getHolidayPrice());
dto.setFreeDays(1); dto.setPrice(vehicle.getHolidayPrice());
}else { dto.setFreeDays(1);
dto.setNo_discount_price(vehicle.getPrice()); }else {
dto.setPrice(vehicle.getPrice()); dto.setNo_discount_price(vehicle.getPrice());
dto.setFreeDays(1); dto.setPrice(vehicle.getPrice());
dto.setFreeDays(1);
}
priceDTOS.add(dto);
}
}else {
//Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
for(cn.hutool.core.date.DateTime currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
(currentDate.isAfterOrEquals(beginOfStartDate) && currentDate.isBeforeOrEquals(endOfEndDate));
currentDate = DateUtil.offsetDay(currentDate, 1)) {
cn.hutool.core.date.DateTime finalCurrentDate = currentDate;
VehicleModelCalendarPriceDTO dto = new VehicleModelCalendarPriceDTO(){{
setDate(DateUtil.beginOfDay(finalCurrentDate));
}};
if(currentDate.isWeekend()) {
dto.setNo_discount_price(vehicle.getHolidayPrice());
dto.setPrice(vehicle.getHolidayPrice());
dto.setFreeDays(1);
}else {
dto.setNo_discount_price(vehicle.getPrice());
dto.setPrice(vehicle.getPrice());
dto.setFreeDays(1);
}
priceDTOS.add(dto);
} }
priceDTOS.add(dto);
} }
//获取节假日价格 //获取节假日价格
......
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