Commit bf9c6136 authored by hezhen's avatar hezhen

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

parents d9ea0851 db119a26
...@@ -23,6 +23,19 @@ public class ResultCode { ...@@ -23,6 +23,19 @@ public class ResultCode {
// 预定时间不能小于当前时间 // 预定时间不能小于当前时间
public static int ONLY_BOOK_FROM_TODAY = Integer.valueOf(SystemProperty.getResultConfig("ONLY_BOOK_FROM_TODAY")); public static int ONLY_BOOK_FROM_TODAY = Integer.valueOf(SystemProperty.getResultConfig("ONLY_BOOK_FROM_TODAY"));
// 只能预定两个月内的车辆
public static int ONLY_BOOK_TWO_MONTH = Integer.valueOf(SystemProperty.getResultConfig("ONLY_BOOK_TWO_MONTH"));
// 只能取消预定两个月内的车辆
public static int ONLY_UNBOOK_TWO_MONTH = Integer.valueOf(SystemProperty.getResultConfig("ONLY_UNBOOK_TWO_MONTH"));
// 选择日期不可取消预定
public static int VEHICLE_CAN_NOT_UNBOOK = Integer.valueOf(SystemProperty.getResultConfig("VEHICLE_CAN_NOT_UNBOOK"));
//预定日期为空
public static int BOOKED_DATE_IS_EMPTY = Integer.valueOf(SystemProperty.getResultConfig("BOOKED_DATE_IS_EMPTY"));
public static int TODAY_CAN_NOT_BOOK = Integer.valueOf(SystemProperty.getResultConfig("TODAY_CAN_NOT_BOOK"));
// 添加车辆失败,请重试 // 添加车辆失败,请重试
public static int ADD_VEHICLE_FAIL = Integer.valueOf(SystemProperty.getResultConfig("ADD_VEHICLE_FAIL")); public static int ADD_VEHICLE_FAIL = Integer.valueOf(SystemProperty.getResultConfig("ADD_VEHICLE_FAIL"));
......
...@@ -225,3 +225,17 @@ UPDATE_VEHICLE_FAIL = 4010 ...@@ -225,3 +225,17 @@ UPDATE_VEHICLE_FAIL = 4010
DATE_TIME_IS_NULL = 4011 DATE_TIME_IS_NULL = 4011
4011 = 预定时间不能为空 4011 = 预定时间不能为空
ONLY_BOOK_TWO_MONTH = 4012
4012 = 只能预定两月内的车辆
ONLY_UNBOOK_TWO_MONTH = 4013
4013 = 只能取消预定两月内的车辆
VEHICLE_CAN_NOT_UNBOOK = 4014
4014 = 选择日期不可取消预定
BOOKED_DATE_IS_EMPTY = 4015
4015 = 预定日期为空
TODAY_CAN_NOT_BOOK = 4016
4016 = 当天不可预定
\ No newline at end of file
...@@ -20,7 +20,7 @@ import java.io.Serializable; ...@@ -20,7 +20,7 @@ import java.io.Serializable;
@JobHandler(value = "walletHandler") @JobHandler(value = "walletHandler")
@Component @Component
@Slf4j @Slf4j
public class RentDepositJobHandler extends IJobHandler { public class WalletJobHandler extends IJobHandler {
@Autowired @Autowired
MyWaterBiz myWaterBiz; MyWaterBiz myWaterBiz;
......
...@@ -169,4 +169,10 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp ...@@ -169,4 +169,10 @@ public class OrderDepositRefundRecordBiz extends BaseBiz<DepositRefundRecordMapp
} }
} }
public void completeRecordStatus(Integer crosstownId, DepositRefundStatus depositRefundStatus) {
DepositRefundRecord depositRefundRecord = findByCrossIdAndStatus(crosstownId, depositRefundStatus.getCode());
depositRefundRecord.setIscomplete(Boolean.TRUE);
updateSelectiveById(depositRefundRecord);
}
} }
...@@ -28,7 +28,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -28,7 +28,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -82,14 +81,14 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -82,14 +81,14 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
//未退还, 进行挂起保留违章预备金 的退还 //未退还, 进行挂起保留违章预备金 的退还
if(RefundStatusEnum.NONE.getCode().equals(orderMQDTO.getRefundStatus())) { if(RefundStatusEnum.NONE.getCode().equals(orderMQDTO.getRefundStatus())) {
Integer crosstownTypeEnum; Integer crosstownTypeEnum;
Integer depositRefundRecordStatus; DepositRefundStatus depositRefundRecordStatus;
//判断是否定损过 //判断是否定损过
if(SYS_TRUE.equals(orderMQDTO.getOrderRentVehicleDetail().getFixedLossStatus())) { if(SYS_TRUE.equals(orderMQDTO.getOrderRentVehicleDetail().getFixedLossStatus())) {
crosstownTypeEnum = CrosstownTypeEnum.FIXED_LOSS.getCode(); crosstownTypeEnum = CrosstownTypeEnum.FIXED_LOSS.getCode();
depositRefundRecordStatus = DepositRefundStatus.FIXLOSSREFUND.getCode(); depositRefundRecordStatus = DepositRefundStatus.FIXLOSSREFUND;
}else { }else {
crosstownTypeEnum = CrosstownTypeEnum.ARRIVE.getCode(); crosstownTypeEnum = CrosstownTypeEnum.ARRIVE.getCode();
depositRefundRecordStatus = DepositRefundStatus.REFUNDARRIVAL.getCode(); depositRefundRecordStatus = DepositRefundStatus.REFUNDARRIVAL;
} }
OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{ OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{
setOrderId(orderMQDTO.getId()); setOrderId(orderMQDTO.getId());
...@@ -111,7 +110,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -111,7 +110,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString(); String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString();
try{ try{
if(null != crosstown.getDedDetail()) { if(null != crosstown.getDedDetail()) {
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class); List<DedDetailDTO> dddList = JSONUtil.toList(JSONUtil.parseArray(crosstown.getDedDetail()), DedDetailDTO.class);
for(DedDetailDTO ddd : dddList) { for(DedDetailDTO ddd : dddList) {
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost(); refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
} }
...@@ -122,10 +121,10 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -122,10 +121,10 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
refundDesc += ")"; refundDesc += ")";
refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), RefundTypeEnum.PART_DEPOSIT); refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), RefundTypeEnum.PART_DEPOSIT);
DepositRefundRecord depositRefundRecord = orderDepositRefundRecordBiz.findByCrossIdAndStatus(crosstown.getId(), depositRefundRecordStatus); // DepositRefundRecord depositRefundRecord = orderDepositRefundRecordBiz.findByCrossIdAndStatus(crosstown.getId(), depositRefundRecordStatus);
depositRefundRecord.setIscomplete(Boolean.TRUE); // depositRefundRecord.setIscomplete(Boolean.TRUE);
orderDepositRefundRecordBiz.updateSelectiveById(depositRefundRecord); // orderDepositRefundRecordBiz.updateSelectiveById(depositRefundRecord);
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), depositRefundRecordStatus);
orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData()); orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData());
} }
// else { // else {
......
...@@ -52,6 +52,9 @@ public class RentDepositJobHandler extends IJobHandler { ...@@ -52,6 +52,9 @@ public class RentDepositJobHandler extends IJobHandler {
@Autowired @Autowired
OrderVehicleCrosstownBiz crosstownBiz; OrderVehicleCrosstownBiz crosstownBiz;
@Autowired
OrderDepositRefundRecordBiz orderDepositRefundRecordBiz;
@Autowired @Autowired
OrderViolationBiz orderViolationBiz; OrderViolationBiz orderViolationBiz;
...@@ -78,9 +81,9 @@ public class RentDepositJobHandler extends IJobHandler { ...@@ -78,9 +81,9 @@ public class RentDepositJobHandler extends IJobHandler {
//三十天 //三十天
List<BaseOrder> lists = baseOrderBiz.selectByExample(new Example.Builder(BaseOrder.class) List<BaseOrder> lists = baseOrderBiz.selectByExample(new Example.Builder(BaseOrder.class)
//订单已完成的租车订单 //订单已完成的租车订单
.where(WeekendSqls.<BaseOrder>custom().andEqualTo(BaseOrder::getType, OrderTypeEnum.RENT_VEHICLE) .where(WeekendSqls.<BaseOrder>custom().andEqualTo(BaseOrder::getType, OrderTypeEnum.RENT_VEHICLE.getCode())
.andEqualTo(BaseOrder::getStatus, OrderStatusEnum.ORDER_FINISH) //已完成的订单 .andEqualTo(BaseOrder::getStatus, OrderStatusEnum.ORDER_FINISH.getCode()) //已完成的订单
.andEqualTo(BaseOrder::getRefundStatus, RefundStatusEnum.RESIDUE_ILLEGAL) //已归还了部分押金 .andEqualTo(BaseOrder::getRefundStatus, RefundStatusEnum.RESIDUE_ILLEGAL.getCode()) //已归还了部分押金
.andLessThanOrEqualTo(BaseOrder::getCrtTime, DateUtil.date(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60 * 1000))) .andLessThanOrEqualTo(BaseOrder::getCrtTime, DateUtil.date(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60 * 1000)))
// .andLike(BaseOrder::getId, "%"+ i) // .andLike(BaseOrder::getId, "%"+ i)
).build()); ).build());
...@@ -109,14 +112,20 @@ public class RentDepositJobHandler extends IJobHandler { ...@@ -109,14 +112,20 @@ public class RentDepositJobHandler extends IJobHandler {
setIsDel(SYS_FALSE); setIsDel(SYS_FALSE);
}}); }});
String refundDesc = "退还押金:";
BigDecimal refundAmont;
if(null != orderViolation) { if(null != orderViolation) {
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
BigDecimal refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice()); refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice());
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章扣款:"+ refundAmont.toString(); refundDesc += refundAmont.toString()+ "(已扣除 违章扣款:"+ refundAmont.toString();
refundDesc += ")"; refundDesc += ")";
orderRefundBiz.refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), RefundTypeEnum.RESIDUE_DEPOSIT); }else {
orderMsgBiz.handelMsgDeposit(orvd, baseOrder, userFeign.userDetailById(baseOrder.getUserId()).getData()); refundAmont = orvd.getReturnPayResidue();
refundDesc += refundAmont.toString();
} }
orderRefundBiz.refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), RefundTypeEnum.RESIDUE_DEPOSIT);
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), DepositRefundStatus.VIOLATIONARRIVAL);
orderMsgBiz.handelMsgDeposit(orvd, baseOrder, userFeign.userDetailById(baseOrder.getUserId()).getData());
} }
//获取交车时间 //获取交车时间
......
...@@ -84,7 +84,7 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -84,7 +84,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
if (userDTO == null) { if (userDTO == null) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
} }
if(dto.getType() != 3) { if(dto.getType() != null && dto.getType() != 3) {
List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone()); List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone());
List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList()); List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList());
dto.setCompanyIds(companyIds); dto.setCompanyIds(companyIds);
......
package com.xxfc.platform.user.behavior.common; package com.xxfc.platform.user.behavior.common;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
* @description 用户行为枚举 * @description 用户行为枚举
* @data 2019/8/12 14:57 * @data 2019/8/12 14:57
*/ */
public enum BehaviorEnum { public enum BehaviorEnum {
/**
* 弹窗曝光
*/
DIALOG_WINDOW(0, "弹窗曝光"),
/**
* 立即前往(弹窗)
*/
DIALOG_WINDOW_TO(1, "立即前往"),
/**
* banner 点击
*/
BANNER_CLICK(2, "banner点击"),
/**
* 精彩活动点击
*/
WONDERFUL_ACTIVITY_CLICK(3, "精彩活动点击"),
/**
* 注册
*/
REGISTRY(4, "注册"),
/**
* 领取任务
*/
CLAIM_TASK(5, "领取任务"),
/**
* 分享
*/
SHARE(6, "分享"),
/**
* 邀请
*/
INVITATION(7, "邀请");
BehaviorEnum(int code, String name) {
this.code = code;
this.name = name;
}
private int code;
private String name;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} }
...@@ -37,4 +37,6 @@ public class CustomerBehaviorNoteDTO implements Serializable { ...@@ -37,4 +37,6 @@ public class CustomerBehaviorNoteDTO implements Serializable {
@ApiModelProperty(value = "类型id") @ApiModelProperty(value = "类型id")
private Integer typeId; private Integer typeId;
@ApiModelProperty(value = "请求id")
private String requestId;
} }
...@@ -22,17 +22,13 @@ import java.io.Serializable; ...@@ -22,17 +22,13 @@ import java.io.Serializable;
public class CustomerBehaviorNotes implements Serializable { public class CustomerBehaviorNotes implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id") @ApiModelProperty("主键id")
private Integer id; private Integer id;
/**
* 用户id
*/
@Column(name = "customer_id") @Column(name = "customer_id")
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private String customerId; private String customerId;
...@@ -48,21 +44,21 @@ public class CustomerBehaviorNotes implements Serializable { ...@@ -48,21 +44,21 @@ public class CustomerBehaviorNotes implements Serializable {
* 行为类型 {@link com.xxfc.platform.user.behavior.common.BehaviorEnum} * 行为类型 {@link com.xxfc.platform.user.behavior.common.BehaviorEnum}
*/ */
@Column(name = "type") @Column(name = "type")
@ApiModelProperty(value = "行为类型(见枚举)") @ApiModelProperty(value = "行为类型")
private Integer type; private Integer type;
/**
* 类型id
*/
@Column(name = "type_id") @Column(name = "type_id")
@ApiModelProperty(value = "类型id") @ApiModelProperty(value = "类型id")
private Integer typeId; private Integer typeId;
/**
* 创建时间
*/
@Column(name = "crt_time") @Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true) @ApiModelProperty(value = "创建时间", hidden = true)
private Long crtTime; private Long crtTime;
@Column(name = "request_id")
@ApiModelProperty(value = "请求id")
private String requestId;
} }
package com.xxfc.platform.vehicle.pojo.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/12 16:08
*/
@Data
public class AccompanyingItemFindDTO extends PageParam {
private String name;
private Integer type;
}
...@@ -13,7 +13,7 @@ import com.xxfc.platform.vehicle.constant.RedisKey; ...@@ -13,7 +13,7 @@ import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.entity.AccompanyingItem; import com.xxfc.platform.vehicle.entity.AccompanyingItem;
import com.xxfc.platform.vehicle.mapper.AccompanyingItemMapper; import com.xxfc.platform.vehicle.mapper.AccompanyingItemMapper;
import com.xxfc.platform.vehicle.pojo.AddOrUpdateAccompanyingItem; import com.xxfc.platform.vehicle.pojo.AddOrUpdateAccompanyingItem;
import com.xxfc.platform.vehicle.pojo.QueryAccompanyItemVo; import com.xxfc.platform.vehicle.pojo.dto.AccompanyingItemFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo; import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
...@@ -29,7 +29,6 @@ import javax.annotation.Resource; ...@@ -29,7 +29,6 @@ import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -69,15 +68,12 @@ public class AccompanyingItemBiz extends BaseBiz<AccompanyingItemMapper, Accompa ...@@ -69,15 +68,12 @@ public class AccompanyingItemBiz extends BaseBiz<AccompanyingItemMapper, Accompa
/** /**
* 按页查询, * 按页查询,
* 注意,此处一共名称的模糊查询是预测其数据量较少,有变化后考虑加入全文索引
* @param queryAccompanyItemVo
* @return * @return
* @throws Exception * @throws Exception
*/ */
public PageDataVO<AccompanyingItem> getByPage(QueryAccompanyItemVo queryAccompanyItemVo) throws Exception{ public PageDataVO<AccompanyingItem> getByPage(AccompanyingItemFindDTO accompanyingItemFindDTO){
Map<String,String> params = BeanUtils.describe(queryAccompanyItemVo); PageHelper.startPage(accompanyingItemFindDTO.getPage(),accompanyingItemFindDTO.getLimit());
PageHelper.startPage(queryAccompanyItemVo.getPage(),queryAccompanyItemVo.getLimit()); List<AccompanyingItem> accompanyingItems = mapper.getAllPageByNameOrType(accompanyingItemFindDTO.getName(),accompanyingItemFindDTO.getType());
List<AccompanyingItem> accompanyingItems = mapper.getAllByPage(params);
PageInfo<AccompanyingItem> accompanyingItemsPageInfo = new PageInfo<>(accompanyingItems); PageInfo<AccompanyingItem> accompanyingItemsPageInfo = new PageInfo<>(accompanyingItems);
return PageDataVO.pageInfo(accompanyingItemsPageInfo); return PageDataVO.pageInfo(accompanyingItemsPageInfo);
} }
......
...@@ -830,7 +830,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -830,7 +830,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){ for( DateTime curDate = startDay;curDate.compareTo(endDay)<=0;curDate=curDate.plusDays(1)){
String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER); String curDateStr = curDate.toString(DEFAULT_DATE_TIME_FORMATTER);
if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){ if(curDateStr.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER))<0){
throw new CustomIllegalParamException("只可以取消当前时间之后的车辆"); throw new BaseException(ResultCode.ONLY_BOOK_FROM_TODAY);
} }
String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER); String curYearMonth = curDate.toString(YEARMONTH_DATE_TIME_FORMATTER);
if(!yearMonthAndDate.containsKey(curYearMonth)){ if(!yearMonthAndDate.containsKey(curYearMonth)){
...@@ -841,7 +841,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -841,7 +841,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
} }
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆"); throw new BaseException(ResultCode.ONLY_BOOK_TWO_MONTH);
} }
} }
...@@ -860,7 +860,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -860,7 +860,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay); fillDateList4DatePeriod(yearMonthAndDate,startDay,endDay);
if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月 if(yearMonthAndDate.size()>3){//连续的日期最多夸3个月
throw new CustomIllegalParamException(" 只可以预约两个月内的车辆"); throw new BaseException(ResultCode.ONLY_UNBOOK_TWO_MONTH);
} }
Boolean rs = Boolean.TRUE; Boolean rs = Boolean.TRUE;
for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){ for(Map.Entry<String,List<String>> entry:yearMonthAndDate.entrySet()){
...@@ -881,7 +881,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -881,7 +881,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
params.put("yearMonth",yearMonth); params.put("yearMonth",yearMonth);
//加入更新条件 //加入更新条件
if(CollectionUtils.isEmpty(unbookDates)){ if(CollectionUtils.isEmpty(unbookDates)){
throw new CustomIllegalParamException(" 车辆不可预定"); throw new BaseException(ResultCode.VEHICLE_CAN_NOT_UNBOOK);
} }
Map<String,List<String>> yearMonthAndDate = new HashMap<>(); Map<String,List<String>> yearMonthAndDate = new HashMap<>();
yearMonthAndDate.put(yearMonth,unbookDates); yearMonthAndDate.put(yearMonth,unbookDates);
...@@ -908,7 +908,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -908,7 +908,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
public void fillBookedDateSearchParam(Map<String, Object> params, public void fillBookedDateSearchParam(Map<String, Object> params,
Map<String,List<String>> yearMonthAndDate,Map<String,List<String>> yearMonthAndDateNotBooked){ Map<String,List<String>> yearMonthAndDate,Map<String,List<String>> yearMonthAndDateNotBooked){
if(MapUtils.isEmpty(yearMonthAndDate)&&MapUtils.isEmpty(yearMonthAndDateNotBooked)){//没有预定信息查询条件 if(MapUtils.isEmpty(yearMonthAndDate)&&MapUtils.isEmpty(yearMonthAndDateNotBooked)){//没有预定信息查询条件
throw new CustomIllegalParamException("没有预订信息!"); throw new BaseException(ResultCode.BOOKED_DATE_IS_EMPTY);
} }
Map<String,Map<String,Integer>> yearMonthAndParam = new HashMap<>(); Map<String,Map<String,Integer>> yearMonthAndParam = new HashMap<>();
...@@ -953,7 +953,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -953,7 +953,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
} }
for (String dateStr:entry.getValue()) {//已预定作为条件,该位与1作与运算必定为1 for (String dateStr:entry.getValue()) {//已预定作为条件,该位与1作与运算必定为1
if(bookedYearMonth.contains(dateStr)){ if(bookedYearMonth.contains(dateStr)){
throw new CustomIllegalParamException("同一天既作为未预定查询条件又作为已预定查询条件"); log.info("当天不可预定,日期为:dateStr = {}", dateStr);
throw new BaseException(ResultCode.TODAY_CAN_NOT_BOOK);
} }
DateTime dateTime = DateTime.parse(dateStr, DEFAULT_DATE_TIME_FORMATTER); DateTime dateTime = DateTime.parse(dateStr, DEFAULT_DATE_TIME_FORMATTER);
//仅对应位为1的整形值 //仅对应位为1的整形值
......
package com.xxfc.platform.vehicle.mapper; package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.AccompanyingItem; import com.xxfc.platform.vehicle.entity.AccompanyingItem;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
import java.util.Map;
public interface AccompanyingItemMapper extends Mapper<AccompanyingItem> { public interface AccompanyingItemMapper extends Mapper<AccompanyingItem> {
public List<AccompanyingItem> getAllByPage(Map<String, String> params); List<AccompanyingItem> getAllPageByNameOrType(@Param("name") String name, @Param("type") Integer type);
public List<AccompanyingItem> getByIdList(List<Integer> idList); List<AccompanyingItem> getByIdList(List<Integer> idList);
} }
package com.xxfc.platform.vehicle.rest; package com.xxfc.platform.vehicle.rest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.AccompanyingItemBiz; import com.xxfc.platform.vehicle.biz.AccompanyingItemBiz;
import com.xxfc.platform.vehicle.common.BaseController; import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.AccompanyingItem; import com.xxfc.platform.vehicle.entity.AccompanyingItem;
import com.xxfc.platform.vehicle.pojo.AddOrUpdateAccompanyingItem; import com.xxfc.platform.vehicle.pojo.AddOrUpdateAccompanyingItem;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.xxfc.platform.vehicle.pojo.dto.AccompanyingItemFindDTO;
import com.xxfc.platform.vehicle.pojo.QueryAccompanyItemVo;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo; import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -46,17 +42,9 @@ public class AccompanyingItemController extends BaseController<AccompanyingItemB ...@@ -46,17 +42,9 @@ public class AccompanyingItemController extends BaseController<AccompanyingItemB
} }
@RequestMapping(value ="/page",method = RequestMethod.GET) @RequestMapping(value ="/page",method = RequestMethod.POST)
public RestResponse<PageDataVO<AccompanyingItem>> getByPage(@RequestParam String queryAccompanyItemVoJson) throws Exception{ public RestResponse<PageDataVO<AccompanyingItem>> getByPage(@RequestBody AccompanyingItemFindDTO accompanyingItemFindDTO){
QueryAccompanyItemVo queryAccompanyItemVo = null; return RestResponse.data(baseBiz.getByPage(accompanyingItemFindDTO));
try {
queryAccompanyItemVo = JSON.parseObject(queryAccompanyItemVoJson,QueryAccompanyItemVo.class);
return RestResponse.data(baseBiz.getByPage(queryAccompanyItemVo));
} catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (CustomIllegalParamException ex){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
} }
@RequestMapping(value ="",method = RequestMethod.POST) @RequestMapping(value ="",method = RequestMethod.POST)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.vehicle.mapper.AccompanyingItemMapper"> <mapper namespace="com.xxfc.platform.vehicle.mapper.AccompanyingItemMapper">
<select id="getAllByPage" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.AccompanyingItem"> <select id="getAllPageByNameOrType" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.AccompanyingItem">
select select
`id`, `type`, `name`, `remark`,`price`, `create_time`, `update_time` `id`, `type`, `name`, `remark`,`price`, `create_time`, `update_time`
from from
......
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