Commit 294fefbf authored by libin's avatar libin

Merge remote-tracking branch 'origin/dev' into dev

parents 1077735a c82d506b
......@@ -23,6 +23,27 @@ public class ResultCode {
// 预定时间不能小于当前时间
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 ADD_VEHICLE_MORE = Integer.valueOf(SystemProperty.getResultConfig("ADD_VEHICLE_MORE"));
// 停靠公司不能为空
public static int RET_COMPANY_CAN_NOT_BE_NULL = Integer.valueOf(SystemProperty.getResultConfig("RET_COMPANY_CAN_NOT_BE_NULL"));
// 车牌不能为空
public static int NUMBER_PLAT_CAN_NOT_BE_NULL = Integer.valueOf(SystemProperty.getResultConfig("NUMBER_PLAT_CAN_NOT_BE_NULL"));
// 选择日期不可取消预定
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"));
......
......@@ -225,3 +225,26 @@ UPDATE_VEHICLE_FAIL = 4010
DATE_TIME_IS_NULL = 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 = 当天不可预定
ADD_VEHICLE_MORE = 4017
4017 = 添加车辆过多,请分批添加
RET_COMPANY_CAN_NOT_BE_NULL = 4018
4018 = 停靠公司不能为空
NUMBER_PLAT_CAN_NOT_BE_NULL = 4019
4019 = 车牌不能为空
\ No newline at end of file
......@@ -16,6 +16,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.Query;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -78,13 +79,13 @@ public class UserController extends CommonBaseController {
if (StringUtils.isNotBlank(username)) {
List<User> list = userBiz.getCountByUsername(username);
if (list.size() > 0) {
throw new RuntimeException("用户名不能重复");
}
return ObjectRestResponse.createFailedResult(ResCode.USER_IS_EXIST.getCode(), ResCode.USER_IS_EXIST.getDesc());
}
}
userBiz.insertSelective(vo);
//添加权限关系
groupBiz.modifyUserGroups(vo.getId(), vo.getMembers());
return new ObjectRestResponse();
return ObjectRestResponse.succ();
}
private void handleDataLimit(@RequestBody UserVO dto) {
......@@ -166,12 +167,12 @@ public class UserController extends CommonBaseController {
if (StringUtils.isNotBlank(username)) {
List<User> list = userBiz.getCountByUsername(username);
if (list.size() > 1) {
throw new RuntimeException("用户名不能重复");
return ObjectRestResponse.createFailedResult(ResCode.USER_IS_EXIST.getCode(), ResCode.USER_IS_EXIST.getDesc());
}
if (list.size() == 1) {
User user = list.get(0);
if (!user.getId().equals(vo.getId())) {
throw new RuntimeException("用户名不能重复");
return ObjectRestResponse.createFailedResult(ResCode.USER_IS_EXIST.getCode(), ResCode.USER_IS_EXIST.getDesc());
}
}
}
......
......@@ -110,7 +110,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString();
try{
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) {
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
}
......
......@@ -98,7 +98,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getByUserIds(userIds);
log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getData());
Map<String, AppUserVo> appUserVoMap = objectRestResponse.getData() == null ? new HashMap<String, AppUserVo>()
: objectRestResponse.getData().parallelStream().collect(Collectors.toMap(v -> v.getUserid().toString().trim(), v -> v));
: objectRestResponse.getData().parallelStream().collect(Collectors.toMap(v -> v.getUserid() == null ? "" : v.getUserid() + "", v -> v));
for (OrderListVo orderPageVO : list) {
AppUserVo appUserVo = appUserVoMap.get(orderPageVO.getUserId().toString());
......
......@@ -36,7 +36,7 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
public ObjectRestResponse<TourGood> getGoodList(@RequestParam(value = "page", required = true) Integer page, @RequestParam(value = "limit",defaultValue = "10") Integer limit,
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "latitude", required = false) Double latitude,
@RequestParam(value = "longitude", required = false) Double longitude, @RequestParam(value = "tagId", required = false) Integer tagId,
@RequestParam(value = "distance", defaultValue = "0.00") Double distance) {
@RequestParam(value = "distance", defaultValue = "100") Double distance) {
return baseBiz.getGoodList(page, limit, query, latitude, longitude, tagId, distance);
}
......
......@@ -53,6 +53,7 @@ public enum ResCode {
ORDER_DETAIL_IS_NOT_EXIST(10001, "订单详情不可查询"),
YOU_AUTH_FAIL(-2,"无权限查看此信息"),
ORDER_IS_NOT_PAY(10002, "订单未支付"),
USER_IS_EXIST(10003, "用户名已存在");
;
/**
* 返回码
......
......@@ -2,9 +2,9 @@ package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.constant.ConstantType;
import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.entity.Constant;
......@@ -159,7 +159,7 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
return Boolean.FALSE;
}
if(constants.size()>MAX_BATCH_SIZE_CONSTANT_UPDATE){
throw new IllegalArgumentException(" exceed max batch size");
throw new BaseException(" exceed max batch size");
}
return Boolean.TRUE;
......@@ -198,7 +198,7 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
return 0;
}
if(codes.size()>MAX_BATCH_SIZE_CONSTANT_UPDATE){
throw new IllegalArgumentException(" exceed max batch size");
throw new BaseException(" exceed max batch size");
}
List<String> delCodes = Lists.newArrayList();
for(Integer code:codes){
......@@ -242,12 +242,12 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
*/
public Boolean checkIfExists(Integer type,Integer code){
if(!ConstantType.exists(type)){
throw new CustomIllegalParamException(" no such type of constant");
throw new BaseException(" no such type of constant");
}
List<ConstantVo> constantVoList = getAllConstantByType(type);
if(CollectionUtils.isEmpty(constantVoList)){
throw new CustomIllegalParamException(" no such code of constant in relative type");
throw new BaseException(" no such code of constant in relative type");
}
for(ConstantVo constantVo:constantVoList){
......@@ -255,7 +255,7 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
return Boolean.TRUE;
}
}
throw new CustomIllegalParamException(" no such code of constant in relative type");
throw new BaseException(" no such code of constant in relative type");
}
}
......@@ -3,8 +3,8 @@ package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.constant.RegionType;
import com.xxfc.platform.vehicle.entity.SysRegion;
......@@ -42,7 +42,7 @@ public class SysRegionBiz extends BaseBiz<SysRegionMapper, SysRegion> {
public List<SysRegion> getRegionsByCodes(List<Long> ids){
List<String> redisCacheKeys = Lists.newArrayList();
if(CollectionUtils.isEmpty(ids)){
throw new CustomIllegalParamException("empty id list");
throw new BaseException("empty id list");
}
for(Long id:ids){
redisCacheKeys.add(RedisKey.SYS_REGION_CACHE_PREFIX+id);
......
......@@ -3,10 +3,10 @@ package com.xxfc.platform.vehicle.biz;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.google.common.collect.Maps;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.VehicleBookHourInfo;
import com.xxfc.platform.vehicle.mapper.VehicleBookHourInfoMapper;
......@@ -39,15 +39,15 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
startDate = simpleDateFormat.parse(bookStartDate);
endDate = simpleDateFormat.parse(bookEndDate);
}catch (Exception e) {
e.printStackTrace();
}
//判定时间是否合法
if (bookStartDate.compareTo(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER)) < 0) {
throw new CustomIllegalParamException(ResultCode.getMsg(ResultCode.ONLY_BOOK_FROM_TODAY));
throw new BaseException(ResultCode.ONLY_BOOK_FROM_TODAY);
}
if (bookStartDate.compareTo(bookEndDate) > 0) {
throw new CustomIllegalParamException("预定开始日期不能大于结束日期!");
throw new BaseException(ResultCode.ONLY_BOOK_FROM_TODAY);
}
Map<String, Integer> predictableHours = Maps.newHashMap();
//预定开始小时
......
......@@ -12,7 +12,6 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.BookType;
import com.xxfc.platform.vehicle.constant.RedisKey;
......@@ -273,7 +272,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if(params.get("selectedMonth") != null) {
String selectedMonth = (String)params.get("selectedMonth");
if(StringUtils.isBlank(selectedMonth)){
throw new CustomIllegalParamException(" no month selected ");
throw new BaseException("no month selected ");
}
DateTime selectedMonthDate = DateTime.parse(selectedMonth,YEARMONTH_DATE_TIME_FORMATTER);
if(selectedMonthDate.compareTo(DateTime.now().plusMonths(-1).withDayOfMonth(1).withMillisOfDay(0)) < 0){
......
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