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
orderPageVo.setUsername(appUserVo.getRealname());
orderPageVo.setPositionName(appUserVo.getPositionName());
}
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 = userDTO.getCompanyIds();
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()) {
if (orderPageVo.getStatus() == 4) { //未交车
if (companyIds.contains(orderPageVo.getOrderRentVehicleDetail().getStartCompanyId())) {
orderPageVo.setUserCompanyStatus(true);
}
if (orderPageVo.getStatus() == 4) { //未交车
// boolean flag = getTodayTime(orderPageVo.getOrderRentVehicleDetail().getStartTime());
// if (!flag) {
// return ObjectRestResponse.createFailedResult(3501, "今日不是交车日期");
// }
getDriverInfo(orderPageVo);
} else if (orderPageVo.getStatus() >= 5 || orderPageVo.getStatus() == -1) {//出行中 已交车
if (companyIds.contains(orderPageVo.getOrderRentVehicleDetail().getEndCompanyId())) {
orderPageVo.setUserCompanyStatus(true);
}
//设置违约金金额
getDriverInfo(orderPageVo);
getUserLicense(orderPageVo);
......
......@@ -154,6 +154,13 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
specialRent.setUpdUser(userDTO.getId().toString());
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();
detail.setStartTime(specialRent.getStartTime());
detail.setEndTime(specialRent.getEndTime());
......@@ -188,8 +195,6 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
Date endDateTime = DateUtil.date(specialRent.getEndTime());
Long delayTime = DateUtil.offsetHour(endDateTime, -1).getTime() - DateUtil.date().getTime();
specialRent.setOverTime(DateUtil.offsetHour(endDateTime, -1).getTime());
insertSelective(specialRent);
// rabbitProduct.sendApplyRequireDelayMessage(baseBiz.selectById(shuntApply.getId()), delayTime);
rabbitProduct.sendSpecialDelayMessage(selectById(specialRent.getId()), delayTime);
return delayTime;
}
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.contant.enumerate.*;
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.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
......@@ -28,6 +29,7 @@ import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.vo.VehicleVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -90,6 +92,9 @@ public class OrderCancelBiz {
@Autowired
SpecialRentBiz specialRentBiz;
@Autowired
RabbitProduct rabbitProduct;
@Autowired
UserFeign userFeign;
......@@ -366,10 +371,25 @@ public class OrderCancelBiz {
if(OrderStatusEnum.ORDER_CANCEL.getCode().equals(baseOrder.getStatus()) && SYS_TRUE.equals(baseOrder.getHasPay())){
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 {
//非特惠租车 拒绝之前预约
if(BaseOrder.ORDER_SIGN_SPECIAL != baseOrder.getOrderSign()) {
//未支付,拒绝之前的预约
RestResponse<Integer> restResponse = vehicleFeign.rentRejectVehicleBooking(orvd.getBookRecordId());
}
}
//取消租车免费天数使用
if(null != orvd.getFreeDays() && orvd.getFreeDays() > 0) {
......@@ -411,6 +431,7 @@ public class OrderCancelBiz {
if(null != specialRent ) {
Integer status = SpecialRent.STATUS_AUTOCNL_TOPAY;
if(SYS_TRUE.equals(baseOrder.getHasPay())) {
//
status = SpecialRent.STATUS_AUTOCNL_PAYED;
}
Integer finalStatus = status;
......
......@@ -98,11 +98,6 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
.andEqualTo(ShuntApply::getUserId, getCurrentUserIdInt());
return w;
});
// new ShuntApply(){{
// setId(idDTO.getApplyId());
// setUserId(getCurrentUserIdInt());
// setIsDel(SYS_TRUE);
// }}
return ObjectRestResponse.succ();
}
......@@ -286,8 +281,8 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
PageDataVO<StewardShuntApply> list = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
if(null != 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);
return w;
}, " crt_time desc "), StewardShuntApply.class);
......@@ -408,15 +403,15 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@RequestMapping(value = "/appBusiness/myApplyList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "我的申请")
@ApiOperation(value = "我接过单的申请列表")
public ObjectRestResponse myApplyList(PageDTO dto) {
UserDTO userDTO = getBusinessUserByAppUser();
AssertUtils.isBlank(userDTO);
PageDataVO<ShuntApplyController.ShuntApplyVO> pages = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
w.andEqualTo(ShuntApply::getConfirmUserId, userDTO.getId());
w.andEqualTo(ShuntApply::getIsBizdel, SYS_FALSE);
if(StrUtil.isNotBlank(dto.getMultiStatus())) {
w.andIn(ShuntApply::getStatus, CollUtil.toList(dto.getMultiStatus().split(",")));
w.andEqualTo(ShuntApply::getIsBizdel, SYS_FALSE);
}
return w;
}), ShuntApplyController.ShuntApplyVO.class);
......
package com.xxfc.platform.order.rest;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
......@@ -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_TRUE;
import static com.xxfc.platform.order.entity.SpecialRent.STATUS_CRT;
import static com.xxfc.platform.order.entity.SpecialRent.*;
@RestController
@RequestMapping("/chw/specialRent")
......@@ -115,7 +116,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
}
Query query = new Query(dto);
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;
}, " crt_time desc "), SpecialRentVO.class);
......@@ -170,10 +171,10 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
throw new BaseException("该特惠租车已下单", ResultCode.PARAM_ILLEGAL_CODE);
}
//拒绝原来的预约
orderRentVehicleService.errorRejectVehicle(new RentVehicleBO(){{
setBookRecordId(specialRent.getBookRecordId());
}});
// //拒绝原来的预约
// orderRentVehicleService.errorRejectVehicle(new RentVehicleBO(){{
// setBookRecordId(specialRent.getBookRecordId());
// }});
//正式下单
dto.setVehicleId(specialRent.getVehicleId());
......@@ -182,7 +183,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
RentVehicleBO bo = orderRentVehicleBiz.initRentVehicleBO(dto);
bo.setOrderSign(BaseOrder.ORDER_SIGN_SPECIAL);
bo.setAppUserDTO(getAppUser());
orderRentVehicleService.createOrder(bo);
orderRentVehicleService.specialCreateOrder(bo, specialRent.getOrderNo());
baseBiz.updateSelectiveById(new SpecialRent(){{
setId(specialRent.getId());
setStatus(SpecialRent.STATUS_ORDER);
......
......@@ -110,20 +110,20 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
handleDetail(detail);
}
// /**
// * 创建订单及其子项(特惠租车)
// * @param detail
// */
// public void specialCreateOrder(RentVehicleBO detail, String orderNo) {
// //初始化
// applyInitDetail(detail, orderNo);
// //计算价格
// handleCalculate(detail);
// //插入baseOrder
// baseOrderBiz.insertSelective(detail.getOrder());
// //处理detail
// handleDetail(detail);
// }
/**
* 创建订单及其子项(特惠租车)
* @param detail
*/
public void specialCreateOrder(RentVehicleBO detail, String orderNo) {
//初始化
specialInitDetail(detail, orderNo);
//计算价格
handleCalculate(detail);
//插入baseOrder
baseOrderBiz.insertSelective(detail.getOrder());
//处理detail
handleDetail(detail);
}
public void applyInitDetail(RentVehicleBO bo, String orderNo) {
BaseOrder order = createBaseOrder(bo.getOrderOrigin(), bo.getFacilitatePhone(), bo.getAppUserDTO(), orderNo);
......@@ -131,6 +131,12 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
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) {
// BaseOrder order = createBaseOrder(bo.getOrderOrigin(), bo.getFacilitatePhone(), bo.getAppUserDTO(), orderNo);
// bo.setOrder(order);
......@@ -283,8 +289,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
}
bo.setAccompanyItems(oads);
if(BaseOrder.ORDER_SIGN_APPLY != bo.getOrderSign()) {
//获取可用车辆
if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//获取可用车辆(创建排班记录)
acquireVehicle(bo, null, null);
cloudTransact = 1;
}
......@@ -326,7 +332,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//判断分布式事务执行到哪里
switch (cloudTransact) {
case 1 :
if(!SYS_TRUE.equals(bo.getOrderSign())) {
if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//取消车辆预定
//未支付,拒绝之前的预约
errorRejectVehicle(bo);
......@@ -334,7 +340,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
break;
case 2 :
if(!SYS_TRUE.equals(bo.getOrderSign())) {
if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//取消车辆预定
//未支付,拒绝之前的预约
errorRejectVehicle(bo);
......@@ -343,7 +349,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
break;
case 3 :
if(!SYS_TRUE.equals(bo.getOrderSign())) {
if(BaseOrder.ORDER_SIGN_NORMAL == bo.getOrderSign()) {
//取消车辆预定
//未支付,拒绝之前的预约
errorRejectVehicle(bo);
......
......@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.PictureParsing.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.universal.entity.IDCardInformation;
......@@ -14,7 +15,13 @@ import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.util.EntityUtils;
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.Map;
......@@ -28,7 +35,9 @@ import java.util.Map;
public class XCFQPictureParsingImpl implements UserPictureParsing {
// 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 {
}
private Map<String,String> judgeAccordingToAnalyticalData(String imageUrl, String type) {
String json = imageParse(imageUrl);
String json = imageParseBase64(imageUrl);
log.info("json:" + json);
if (StringUtils.isBlank(json)) {
......@@ -125,6 +134,22 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
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,
Map<String, String> querys,
......@@ -152,4 +177,64 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
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;
@Primary
public class XCFQAuthentication implements UserAuthentication {
// private String appcode="acea1c8811f748b3a65815f11db357c4";
private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
// private String appcode="acea1c8811f748b3a65815f11db357c4";
// private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
//潮惠玩
private String appcode2 = "acea1c8811f748b3a65815f11db357c4";
/**
* 认证相关的数据
......
......@@ -254,7 +254,7 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
rbd.setBookEndDateTime(dto.getEndDateTime());
rbd.setCatas2(dto.getCatas());
rbd.setGoodsType(dto.getGoodsType());
rbd.setRecordIntersection(Boolean.TRUE);
rbd.setRecordIntersection(Boolean.FALSE);
rbd.setYearNo4Where(Boolean.TRUE);
//查询可车辆信息
PageDataVO<UsableVeicleVO> pageDataVO = vehicleBiz.searchUsableVehicle(rbd);
......@@ -288,10 +288,10 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
@RequestMapping(value = "/rent/apply/usable-vehicle", method = RequestMethod.POST)
@IgnoreUserToken
public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd) {
rbd.setRecordIntersection(Boolean.FALSE);
rbd.setRecordIntersection(Boolean.TRUE);
rbd.setLimit(100);
rbd.setPage(1);
//rbd.setYearNo4Where(Boolean.TRUE);
rbd.setYearNo4Where(Boolean.TRUE);
//查询可车辆信息
PageDataVO<UsableVeicleVO> pageDataVO = vehicleBiz.searchUsableVehicle(rbd);
......
......@@ -1251,6 +1251,7 @@
</if>
and v.is_del = 0
and v.status != 3
and v.state = 1
<if test="useType != null">
and v.use_type = #{useType}
</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