Commit a8d07bd0 authored by hezhen's avatar hezhen

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

parents f5d84a20 75c6fac1
...@@ -276,24 +276,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -276,24 +276,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
orderPageVo.setUsername(appUserVo.getRealname()); orderPageVo.setUsername(appUserVo.getRealname());
orderPageVo.setPositionName(appUserVo.getPositionName()); orderPageVo.setPositionName(appUserVo.getPositionName());
} }
List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone()); List<Integer> companyIds = userDTO.getCompanyIds();
List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList());
if (orderPageVo.getOrderRentVehicleDetail() != null) { if (orderPageVo.getOrderRentVehicleDetail() != null) {
if (!companyIds.contains(orderPageVo.getOrderRentVehicleDetail().getStartCompanyId()) && !companyIds.contains(orderPageVo.getOrderRentVehicleDetail().getEndCompanyId())) {
return ObjectRestResponse.createFailedResult(ResCode.YOU_AUTH_FAIL.getCode(), ResCode.YOU_AUTH_FAIL.getDesc());
}
if (userDTO.getCompanyId() == orderPageVo.getOrderRentVehicleDetail().getEndCompanyId()) {
orderPageVo.setUserCompanyStatus(true);
}
if (orderPageVo.getStatus() == 4) { //未交车 if (orderPageVo.getStatus() == 4) { //未交车
// boolean flag = getTodayTime(orderPageVo.getOrderRentVehicleDetail().getStartTime()); if (companyIds.contains(orderPageVo.getOrderRentVehicleDetail().getStartCompanyId())) {
// if (!flag) { orderPageVo.setUserCompanyStatus(true);
// return ObjectRestResponse.createFailedResult(3501, "今日不是交车日期"); }
// }
getDriverInfo(orderPageVo); getDriverInfo(orderPageVo);
} else if (orderPageVo.getStatus() >= 5 || orderPageVo.getStatus() == -1) {//出行中 已交车 } else if (orderPageVo.getStatus() >= 5 || orderPageVo.getStatus() == -1) {//出行中 已交车
if (companyIds.contains(orderPageVo.getOrderRentVehicleDetail().getEndCompanyId())) {
orderPageVo.setUserCompanyStatus(true);
}
//设置违约金金额 //设置违约金金额
getDriverInfo(orderPageVo); getDriverInfo(orderPageVo);
getUserLicense(orderPageVo); getUserLicense(orderPageVo);
......
...@@ -154,6 +154,13 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> { ...@@ -154,6 +154,13 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
specialRent.setUpdUser(userDTO.getId().toString()); specialRent.setUpdUser(userDTO.getId().toString());
specialRent.setStatus(STATUS_CRT); specialRent.setStatus(STATUS_CRT);
Long delayTime = handleRent(specialRent, vehicle);
insertSelective(specialRent);
// rabbitProduct.sendApplyRequireDelayMessage(baseBiz.selectById(shuntApply.getId()), delayTime);
rabbitProduct.sendSpecialDelayMessage(selectById(specialRent.getId()), delayTime);
}
public Long handleRent(@RequestBody SpecialRent specialRent, VehicleVO vehicle) {
RentVehicleBO detail = new RentVehicleBO(); RentVehicleBO detail = new RentVehicleBO();
detail.setStartTime(specialRent.getStartTime()); detail.setStartTime(specialRent.getStartTime());
detail.setEndTime(specialRent.getEndTime()); detail.setEndTime(specialRent.getEndTime());
...@@ -188,8 +195,6 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> { ...@@ -188,8 +195,6 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
Date endDateTime = DateUtil.date(specialRent.getEndTime()); Date endDateTime = DateUtil.date(specialRent.getEndTime());
Long delayTime = DateUtil.offsetHour(endDateTime, -1).getTime() - DateUtil.date().getTime(); Long delayTime = DateUtil.offsetHour(endDateTime, -1).getTime() - DateUtil.date().getTime();
specialRent.setOverTime(DateUtil.offsetHour(endDateTime, -1).getTime()); specialRent.setOverTime(DateUtil.offsetHour(endDateTime, -1).getTime());
insertSelective(specialRent); return delayTime;
// rabbitProduct.sendApplyRequireDelayMessage(baseBiz.selectById(shuntApply.getId()), delayTime);
rabbitProduct.sendSpecialDelayMessage(selectById(specialRent.getId()), delayTime);
} }
} }
\ No newline at end of file
...@@ -14,6 +14,7 @@ import com.xxfc.platform.activity.feign.ActivityFeign; ...@@ -14,6 +14,7 @@ import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.*; import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.contant.enumerate.*; import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction; import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail; import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO; import com.xxfc.platform.order.pojo.calculate.InProgressVO;
...@@ -28,6 +29,7 @@ import com.xxfc.platform.universal.entity.Dictionary; ...@@ -28,6 +29,7 @@ import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.vo.VehicleVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -90,6 +92,9 @@ public class OrderCancelBiz { ...@@ -90,6 +92,9 @@ public class OrderCancelBiz {
@Autowired @Autowired
SpecialRentBiz specialRentBiz; SpecialRentBiz specialRentBiz;
@Autowired
RabbitProduct rabbitProduct;
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
...@@ -366,9 +371,24 @@ public class OrderCancelBiz { ...@@ -366,9 +371,24 @@ public class OrderCancelBiz {
if(OrderStatusEnum.ORDER_CANCEL.getCode().equals(baseOrder.getStatus()) && SYS_TRUE.equals(baseOrder.getHasPay())){ if(OrderStatusEnum.ORDER_CANCEL.getCode().equals(baseOrder.getStatus()) && SYS_TRUE.equals(baseOrder.getHasPay())){
vehicleFeign.rentUnbookVehicle(orvd.getBookRecordId()); vehicleFeign.rentUnbookVehicle(orvd.getBookRecordId());
//特惠租车 恢复排班记录
if (BaseOrder.ORDER_SIGN_SPECIAL == baseOrder.getOrderSign()) {
SpecialRent specialRent = specialRentBiz.selectOne(new SpecialRent(){{
setOrderNo(baseOrder.getNo());
}});
VehicleVO vehicle = vehicleFeign.getVehicleDetail(specialRent.getVehicleId()).getData();
Long delayTime = specialRentBiz.handleRent(specialRent, vehicle);
specialRent.setUpdTime(null);
specialRentBiz.updateSelectiveById(specialRent);
rabbitProduct.sendSpecialDelayMessage(specialRentBiz.selectById(specialRent.getId()), delayTime);
}
}else { }else {
//未支付,拒绝之前的预约 //非特惠租车 拒绝之前预约
RestResponse<Integer> restResponse = vehicleFeign.rentRejectVehicleBooking(orvd.getBookRecordId()); if(BaseOrder.ORDER_SIGN_SPECIAL != baseOrder.getOrderSign()) {
//未支付,拒绝之前的预约
RestResponse<Integer> restResponse = vehicleFeign.rentRejectVehicleBooking(orvd.getBookRecordId());
}
} }
//取消租车免费天数使用 //取消租车免费天数使用
...@@ -411,6 +431,7 @@ public class OrderCancelBiz { ...@@ -411,6 +431,7 @@ public class OrderCancelBiz {
if(null != specialRent ) { if(null != specialRent ) {
Integer status = SpecialRent.STATUS_AUTOCNL_TOPAY; Integer status = SpecialRent.STATUS_AUTOCNL_TOPAY;
if(SYS_TRUE.equals(baseOrder.getHasPay())) { if(SYS_TRUE.equals(baseOrder.getHasPay())) {
//
status = SpecialRent.STATUS_AUTOCNL_PAYED; status = SpecialRent.STATUS_AUTOCNL_PAYED;
} }
Integer finalStatus = status; Integer finalStatus = status;
......
...@@ -98,11 +98,6 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -98,11 +98,6 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
.andEqualTo(ShuntApply::getUserId, getCurrentUserIdInt()); .andEqualTo(ShuntApply::getUserId, getCurrentUserIdInt());
return w; return w;
}); });
// new ShuntApply(){{
// setId(idDTO.getApplyId());
// setUserId(getCurrentUserIdInt());
// setIsDel(SYS_TRUE);
// }}
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
...@@ -286,8 +281,8 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -286,8 +281,8 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
PageDataVO<StewardShuntApply> list = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> { PageDataVO<StewardShuntApply> list = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
if(null != dto.getCityCode()) { if(null != dto.getCityCode()) {
w.andEqualTo(ShuntApply::getStartCityCode, dto.getCityCode()); w.andEqualTo(ShuntApply::getStartCityCode, dto.getCityCode());
w.andEqualTo(ShuntApply::getIsDel, SYS_FALSE);
} }
w.andEqualTo(ShuntApply::getIsDel, SYS_FALSE);
w.andEqualTo(ShuntApply::getStatus, STATUS_CRT); w.andEqualTo(ShuntApply::getStatus, STATUS_CRT);
return w; return w;
}, " crt_time desc "), StewardShuntApply.class); }, " crt_time desc "), StewardShuntApply.class);
...@@ -408,15 +403,15 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -408,15 +403,15 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@RequestMapping(value = "/appBusiness/myApplyList", method = RequestMethod.GET) @RequestMapping(value = "/appBusiness/myApplyList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "我的申请") @ApiOperation(value = "我接过单的申请列表")
public ObjectRestResponse myApplyList(PageDTO dto) { public ObjectRestResponse myApplyList(PageDTO dto) {
UserDTO userDTO = getBusinessUserByAppUser(); UserDTO userDTO = getBusinessUserByAppUser();
AssertUtils.isBlank(userDTO); AssertUtils.isBlank(userDTO);
PageDataVO<ShuntApplyController.ShuntApplyVO> pages = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> { PageDataVO<ShuntApplyController.ShuntApplyVO> pages = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
w.andEqualTo(ShuntApply::getConfirmUserId, userDTO.getId()); w.andEqualTo(ShuntApply::getConfirmUserId, userDTO.getId());
w.andEqualTo(ShuntApply::getIsBizdel, SYS_FALSE);
if(StrUtil.isNotBlank(dto.getMultiStatus())) { if(StrUtil.isNotBlank(dto.getMultiStatus())) {
w.andIn(ShuntApply::getStatus, CollUtil.toList(dto.getMultiStatus().split(","))); w.andIn(ShuntApply::getStatus, CollUtil.toList(dto.getMultiStatus().split(",")));
w.andEqualTo(ShuntApply::getIsBizdel, SYS_FALSE);
} }
return w; return w;
}), ShuntApplyController.ShuntApplyVO.class); }), ShuntApplyController.ShuntApplyVO.class);
......
package com.xxfc.platform.order.rest; package com.xxfc.platform.order.rest;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
...@@ -32,7 +33,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -32,7 +33,7 @@ import org.springframework.web.bind.annotation.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.entity.SpecialRent.STATUS_CRT; import static com.xxfc.platform.order.entity.SpecialRent.*;
@RestController @RestController
@RequestMapping("/chw/specialRent") @RequestMapping("/chw/specialRent")
...@@ -115,7 +116,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia ...@@ -115,7 +116,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
} }
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO<SpecialRentVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> { PageDataVO<SpecialRentVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> {
w.andEqualTo(SpecialRent::getStatus, STATUS_CRT); w.andIn(SpecialRent::getStatus, CollUtil.newArrayList(STATUS_CRT, STATUS_AUTOCNL_ORDER, STATUS_AUTOCNL_TOPAY, STATUS_AUTOCNL_PAYED));
return w; return w;
}, " crt_time desc "), SpecialRentVO.class); }, " crt_time desc "), SpecialRentVO.class);
...@@ -170,10 +171,10 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia ...@@ -170,10 +171,10 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
throw new BaseException("该特惠租车已下单", ResultCode.PARAM_ILLEGAL_CODE); throw new BaseException("该特惠租车已下单", ResultCode.PARAM_ILLEGAL_CODE);
} }
//拒绝原来的预约 // //拒绝原来的预约
orderRentVehicleService.errorRejectVehicle(new RentVehicleBO(){{ // orderRentVehicleService.errorRejectVehicle(new RentVehicleBO(){{
setBookRecordId(specialRent.getBookRecordId()); // setBookRecordId(specialRent.getBookRecordId());
}}); // }});
//正式下单 //正式下单
dto.setVehicleId(specialRent.getVehicleId()); dto.setVehicleId(specialRent.getVehicleId());
...@@ -182,7 +183,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia ...@@ -182,7 +183,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
RentVehicleBO bo = orderRentVehicleBiz.initRentVehicleBO(dto); RentVehicleBO bo = orderRentVehicleBiz.initRentVehicleBO(dto);
bo.setOrderSign(BaseOrder.ORDER_SIGN_SPECIAL); bo.setOrderSign(BaseOrder.ORDER_SIGN_SPECIAL);
bo.setAppUserDTO(getAppUser()); bo.setAppUserDTO(getAppUser());
orderRentVehicleService.createOrder(bo); orderRentVehicleService.specialCreateOrder(bo, specialRent.getOrderNo());
baseBiz.updateSelectiveById(new SpecialRent(){{ baseBiz.updateSelectiveById(new SpecialRent(){{
setId(specialRent.getId()); setId(specialRent.getId());
setStatus(SpecialRent.STATUS_ORDER); setStatus(SpecialRent.STATUS_ORDER);
......
...@@ -110,20 +110,20 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -110,20 +110,20 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
handleDetail(detail); handleDetail(detail);
} }
// /** /**
// * 创建订单及其子项(特惠租车) * 创建订单及其子项(特惠租车)
// * @param detail * @param detail
// */ */
// public void specialCreateOrder(RentVehicleBO detail, String orderNo) { public void specialCreateOrder(RentVehicleBO detail, String orderNo) {
// //初始化 //初始化
// applyInitDetail(detail, orderNo); specialInitDetail(detail, orderNo);
// //计算价格 //计算价格
// handleCalculate(detail); handleCalculate(detail);
// //插入baseOrder //插入baseOrder
// baseOrderBiz.insertSelective(detail.getOrder()); baseOrderBiz.insertSelective(detail.getOrder());
// //处理detail //处理detail
// handleDetail(detail); handleDetail(detail);
// } }
public void applyInitDetail(RentVehicleBO bo, String orderNo) { public void applyInitDetail(RentVehicleBO bo, String orderNo) {
BaseOrder order = createBaseOrder(bo.getOrderOrigin(), bo.getFacilitatePhone(), bo.getAppUserDTO(), orderNo); BaseOrder order = createBaseOrder(bo.getOrderOrigin(), bo.getFacilitatePhone(), bo.getAppUserDTO(), orderNo);
...@@ -131,6 +131,12 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -131,6 +131,12 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
initDetailSecond(bo); initDetailSecond(bo);
} }
public void specialInitDetail(RentVehicleBO bo, String orderNo) {
BaseOrder order = createBaseOrder(bo.getOrderOrigin(), bo.getFacilitatePhone(), bo.getAppUserDTO(), orderNo);
bo.setOrder(order);
initDetailSecond(bo);
}
// public void specialInitDetail(RentVehicleBO bo, String orderNo) { // public void specialInitDetail(RentVehicleBO bo, String orderNo) {
// BaseOrder order = createBaseOrder(bo.getOrderOrigin(), bo.getFacilitatePhone(), bo.getAppUserDTO(), orderNo); // BaseOrder order = createBaseOrder(bo.getOrderOrigin(), bo.getFacilitatePhone(), bo.getAppUserDTO(), orderNo);
// bo.setOrder(order); // bo.setOrder(order);
...@@ -283,8 +289,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -283,8 +289,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
} }
bo.setAccompanyItems(oads); bo.setAccompanyItems(oads);
if(BaseOrder.ORDER_SIGN_APPLY != bo.getOrderSign()) { if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//获取可用车辆 //获取可用车辆(创建排班记录)
acquireVehicle(bo, null, null); acquireVehicle(bo, null, null);
cloudTransact = 1; cloudTransact = 1;
} }
...@@ -326,7 +332,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -326,7 +332,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//判断分布式事务执行到哪里 //判断分布式事务执行到哪里
switch (cloudTransact) { switch (cloudTransact) {
case 1 : case 1 :
if(!SYS_TRUE.equals(bo.getOrderSign())) { if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//取消车辆预定 //取消车辆预定
//未支付,拒绝之前的预约 //未支付,拒绝之前的预约
errorRejectVehicle(bo); errorRejectVehicle(bo);
...@@ -334,7 +340,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -334,7 +340,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
break; break;
case 2 : case 2 :
if(!SYS_TRUE.equals(bo.getOrderSign())) { if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//取消车辆预定 //取消车辆预定
//未支付,拒绝之前的预约 //未支付,拒绝之前的预约
errorRejectVehicle(bo); errorRejectVehicle(bo);
...@@ -343,7 +349,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -343,7 +349,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
break; break;
case 3 : case 3 :
if(!SYS_TRUE.equals(bo.getOrderSign())) { if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//取消车辆预定 //取消车辆预定
//未支付,拒绝之前的预约 //未支付,拒绝之前的预约
errorRejectVehicle(bo); errorRejectVehicle(bo);
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.PictureParsing.impl; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.PictureParsing.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.universal.entity.IDCardInformation; import com.xxfc.platform.universal.entity.IDCardInformation;
...@@ -14,7 +15,13 @@ import org.apache.http.HttpResponse; ...@@ -14,7 +15,13 @@ import org.apache.http.HttpResponse;
import org.apache.http.StatusLine; import org.apache.http.StatusLine;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import sun.misc.BASE64Encoder;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -28,7 +35,9 @@ import java.util.Map; ...@@ -28,7 +35,9 @@ import java.util.Map;
public class XCFQPictureParsingImpl implements UserPictureParsing { public class XCFQPictureParsingImpl implements UserPictureParsing {
// private String appcode = "acea1c8811f748b3a65815f11db357c4"; // private String appcode = "acea1c8811f748b3a65815f11db357c4";
private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7"; // private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
//潮惠玩
private String appcode2 = "acea1c8811f748b3a65815f11db357c4";
/** /**
* 认证相关的数据 * 认证相关的数据
...@@ -75,7 +84,7 @@ public class XCFQPictureParsingImpl implements UserPictureParsing { ...@@ -75,7 +84,7 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
} }
private Map<String,String> judgeAccordingToAnalyticalData(String imageUrl, String type) { private Map<String,String> judgeAccordingToAnalyticalData(String imageUrl, String type) {
String json = imageParse(imageUrl); String json = imageParseBase64(imageUrl);
log.info("json:" + json); log.info("json:" + json);
if (StringUtils.isBlank(json)) { if (StringUtils.isBlank(json)) {
...@@ -125,6 +134,22 @@ public class XCFQPictureParsingImpl implements UserPictureParsing { ...@@ -125,6 +134,22 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
return null; return null;
} }
//身份证照片解析
private String imageParseBase64(String imageUrl) {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + appcode2);
Map<String, String> querys = new HashMap<String, String>();
Map<String, String> bodys = new HashMap<String, String>();
String imgUrlToBase64 = getImgUrlToBase64(imageUrl);
bodys.put("image", "data:image/png;base64,"+ imgUrlToBase64);
try {
return callExternalRequest(headers,querys,bodys,1);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null;
}
private String callExternalRequest(Map<String, String> headers, private String callExternalRequest(Map<String, String> headers,
Map<String, String> querys, Map<String, String> querys,
...@@ -146,10 +171,70 @@ public class XCFQPictureParsingImpl implements UserPictureParsing { ...@@ -146,10 +171,70 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
} }
if (403==statusCode){ if (403==statusCode){
log.error("验证次数已用完"); log.error("验证次数已用完");
} }
return null; return null;
} }
/**
* 将网络图片转换成Base64编码字符串
*
* @param imgUrl 网络图片Url
* @return
*/
public static String getImgUrlToBase64(String imgUrl) {
InputStream inputStream = null;
ByteArrayOutputStream outputStream = null;
byte[] buffer = null;
try {
// 创建URL
URL url = new URL(imgUrl);
// 创建链接
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5000);
inputStream = conn.getInputStream();
outputStream = new ByteArrayOutputStream();
// 将内容读取内存中
buffer = new byte[1024];
int len = -1;
while ((len = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, len);
}
buffer = outputStream.toByteArray();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (inputStream != null) {
try {
// 关闭inputStream流
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (outputStream != null) {
try {
// 关闭outputStream流
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
// 对字节数组Base64编码
String str = new BASE64Encoder().encode(buffer);
if(StrUtil.isNotBlank(str)) {
str = str.replaceAll("\n","");
}
return str;
}
public static void main(String[] args) {
String str = getImgUrlToBase64("http://xxtest.upyuns.com/image/app/2020-10-19/3.jpg");
//str = str.replaceAll("\n","");
System.out.println(str);
}
} }
...@@ -27,8 +27,10 @@ import java.util.Map; ...@@ -27,8 +27,10 @@ import java.util.Map;
@Primary @Primary
public class XCFQAuthentication implements UserAuthentication { public class XCFQAuthentication implements UserAuthentication {
// private String appcode="acea1c8811f748b3a65815f11db357c4"; // private String appcode="acea1c8811f748b3a65815f11db357c4";
private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7"; // private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
//潮惠玩
private String appcode2 = "acea1c8811f748b3a65815f11db357c4";
/** /**
* 认证相关的数据 * 认证相关的数据
......
...@@ -254,7 +254,7 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements ...@@ -254,7 +254,7 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
rbd.setBookEndDateTime(dto.getEndDateTime()); rbd.setBookEndDateTime(dto.getEndDateTime());
rbd.setCatas2(dto.getCatas()); rbd.setCatas2(dto.getCatas());
rbd.setGoodsType(dto.getGoodsType()); rbd.setGoodsType(dto.getGoodsType());
rbd.setRecordIntersection(Boolean.TRUE); rbd.setRecordIntersection(Boolean.FALSE);
rbd.setYearNo4Where(Boolean.TRUE); rbd.setYearNo4Where(Boolean.TRUE);
//查询可车辆信息 //查询可车辆信息
PageDataVO<UsableVeicleVO> pageDataVO = vehicleBiz.searchUsableVehicle(rbd); PageDataVO<UsableVeicleVO> pageDataVO = vehicleBiz.searchUsableVehicle(rbd);
...@@ -288,10 +288,10 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements ...@@ -288,10 +288,10 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
@RequestMapping(value = "/rent/apply/usable-vehicle", method = RequestMethod.POST) @RequestMapping(value = "/rent/apply/usable-vehicle", method = RequestMethod.POST)
@IgnoreUserToken @IgnoreUserToken
public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd) { public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd) {
rbd.setRecordIntersection(Boolean.FALSE); rbd.setRecordIntersection(Boolean.TRUE);
rbd.setLimit(100); rbd.setLimit(100);
rbd.setPage(1); rbd.setPage(1);
//rbd.setYearNo4Where(Boolean.TRUE); rbd.setYearNo4Where(Boolean.TRUE);
//查询可车辆信息 //查询可车辆信息
PageDataVO<UsableVeicleVO> pageDataVO = vehicleBiz.searchUsableVehicle(rbd); PageDataVO<UsableVeicleVO> pageDataVO = vehicleBiz.searchUsableVehicle(rbd);
......
...@@ -1251,6 +1251,7 @@ ...@@ -1251,6 +1251,7 @@
</if> </if>
and v.is_del = 0 and v.is_del = 0
and v.status != 3 and v.status != 3
and v.state = 1
<if test="useType != null"> <if test="useType != null">
and v.use_type = #{useType} and v.use_type = #{useType}
</if> </if>
......
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