Commit 8d244a69 authored by hezhen's avatar hezhen

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

parents aa516126 6ef20d08
......@@ -349,4 +349,10 @@ public class BaseOrder implements Serializable {
@Column(name = "goods_type")
private Integer goodsType;
@Column(name = "user_phone")
private String userPhone;
@Column(name = "realname")
private String realname;
}
......@@ -59,6 +59,10 @@ public class ShuntApply implements Serializable {
@ApiModelProperty(value = "状态 1--待支付 2--已支付 3--已取消 ")
private Integer orderStatus;
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
/**
* 创建时间
*/
......
......@@ -147,6 +147,8 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
@Autowired
CompanyInfoBiz companyInfoBiz;
@Autowired
ShuntApplyBiz shuntApplyBiz;
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
......@@ -766,6 +768,8 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
userFeign.memberDays(baseOrder.getUserId(), orvd.getFreeDays(), UserFeign.MEMBER_DAYS_CONFIRM);
}
//
} else if (OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
updateOrder.setStatus(OrderStatusEnum.ORDER_TOSTART.getCode());
otd = orderTourDetailBiz.selectOne(new OrderTourDetail() {{
......@@ -797,6 +801,19 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
BeanUtil.copyProperties(this.updateSelectiveByIdReT(updateOrder), baseOrder);
//记录订单账款记录
Integer flag = orderAccountBiz.addOrderAccount(baseOrder.getId(), "订单支付", oad.getOriginOrderAmount().add(oad.getOriginDepositAmount()), oad.getOrderAmount().add(oad.getDepositAmount()), tradeNo, AccountTypeEnum.IN_ORDER_PAY.getCode(), JSONUtil.toJsonStr(oad));
//更新 申请状态
ShuntApply shuntApply = shuntApplyBiz.selectOne(new ShuntApply(){{
setOrderNo(baseOrder.getNo());
}});
if(null != shuntApply && shuntApply.getStatus() == ShuntApply.STATUS_ORDER) {
shuntApplyBiz.updateSelectiveById(new ShuntApply(){{
setId(shuntApply.getId());
setStatus(ShuntApply.STATUS_SUCC);
setOrderStatus(ShuntApply.ORDER_STATUS_PAY);
}});
}
} finally {
AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData();
......
......@@ -234,9 +234,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
//获取app用户信息 根据用户名(手机号)定位后台商家用户
UserDTO userDTO = getBusinessUserByAppUser();
if(null == userDTO && null != getAppUser()) {
userDTO = userFeign.businessUserinfoByMobilePhone(getAppUser().getUsername()).getData();
}
if (userDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, "token is null or invalid");
......@@ -256,11 +253,11 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
if (!flag) {
return ObjectRestResponse.createFailedResult(3502, "已超过预定还车时间,不能进行交车操作!");
}
if (null == userDTO.getCompanyId() || !userDTO.getCompanyId().equals(orderRentVehicleDetail.getStartCompanyId())) {
if (null == userDTO.getCompanyIds() || !userDTO.getCompanyIds().contains(orderRentVehicleDetail.getStartCompanyId())) {
return ObjectRestResponse.createFailedResult(3501, "无交车权限");
}
} else {
if (null == userDTO.getCompanyId() || !userDTO.getCompanyId().equals(orderRentVehicleDetail.getEndCompanyId())) {
if (null == userDTO.getCompanyIds() || !userDTO.getCompanyIds().contains(orderRentVehicleDetail.getEndCompanyId())) {
return ObjectRestResponse.createFailedResult(3503, "无收车权限");
}
}
......
......@@ -84,6 +84,9 @@ public class OrderCancelBiz {
@Autowired
OrderTemplateBiz orderTemplateBiz;
@Autowired
ShuntApplyBiz shuntApplyBiz;
@Autowired
UserFeign userFeign;
......@@ -376,6 +379,24 @@ public class OrderCancelBiz {
orderRentVehicleBiz.updateSelectiveById(orvd);
}
//更新 申请状态
ShuntApply shuntApply = shuntApplyBiz.selectOne(new ShuntApply(){{
setOrderNo(baseOrder.getNo());
}});
if(null != shuntApply ) {
Integer status = ShuntApply.STATUS_AUTOCNL_TOPAY;
if(SYS_TRUE.equals(baseOrder.getHasPay())) {
status = ShuntApply.STATUS_AUTOCNL_PAYED;
}
Integer finalStatus = status;
shuntApplyBiz.updateSelectiveById(new ShuntApply(){{
setId(shuntApply.getId());
setStatus(finalStatus);
setOrderStatus(ShuntApply.ORDER_STATUS_CANCEL);
}});
}
}else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
otd = orderTourDetailBiz.selectOne(new OrderTourDetail(){{
setOrderId(baseOrder.getId());
......
......@@ -386,7 +386,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
@IgnoreClientToken
@ResponseBody
public ObjectRestResponse<OrderPageVO> getOrderDetail(String orderNo, Boolean flag) {
UserDTO userDTO = getAdminUserInfo();
UserDTO userDTO = getBusinessUserByAppUser();
if(null == userDTO && null != getAppUser()) {
userDTO = userFeign.businessUserinfoByMobilePhone(getAppUser().getUsername()).getData();
}
......
......@@ -2,6 +2,7 @@ package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
......@@ -39,6 +40,7 @@ import com.xxfc.platform.vehicle.pojo.RentVehicleBookDTO;
import com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -81,11 +83,43 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@Autowired
RabbitProduct rabbitProduct;
@RequestMapping(value = "/app/del", method = RequestMethod.DELETE)
@ResponseBody
@ApiOperation(value = "删除申请")
public ObjectRestResponse appDel(@RequestBody IdDTO idDTO) {
//查询列表数据
if (StrUtil.isBlank(getCurrentUserId())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
baseBiz.updateByWeekendSelective(new ShuntApply(){{
setIsDel(SYS_TRUE);
}}, w -> {
w.andEqualTo(ShuntApply::getId, idDTO.getApplyId())
.andEqualTo(ShuntApply::getUserId, getCurrentUserIdInt());
return w;
});
// new ShuntApply(){{
// setId(idDTO.getApplyId());
// setUserId(getCurrentUserIdInt());
// setIsDel(SYS_TRUE);
// }}
return ObjectRestResponse.succ();
}
@RequestMapping(value = "/addApply", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "添加申请")
public ObjectRestResponse addApply(@RequestBody ShuntApply shuntApply) {
DateTime startDateTime = DateUtil.date(shuntApply.getStartTime());
DateTime afterDateTime = DateUtil.offsetHour(DateUtil.date(), 1);
if(!startDateTime.isAfterOrEquals(afterDateTime)) {
throw new BaseException(ResultCode.FAILED_CODE, Sets.newSet("请提前一小时需求预定"));
}
//查询列表数据
if (StrUtil.isBlank(getCurrentUserId())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
......@@ -103,7 +137,12 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
shuntApply.setUserId(getCurrentUserIdInt());
shuntApply.setStatus(STATUS_CRT);
return add(shuntApply);
Long delayTime = DateUtil.date().getTime() - DateUtil.offsetMinute(startDateTime, -30).getTime();
shuntApply.setOverTime(delayTime);
baseBiz.insertSelective(shuntApply);
rabbitProduct.sendApplyRequireDelayMessage(baseBiz.selectById(shuntApply.getId()), delayTime);
return ObjectRestResponse.succ();
}
@RequestMapping(value = "/cancelApply", method = RequestMethod.POST)
......@@ -216,6 +255,29 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
/********************************************app商家端**********************************************************/
@RequestMapping(value = "/appBusiness/del", method = RequestMethod.DELETE)
@ResponseBody
@ApiOperation(value = "删除申请")
public ObjectRestResponse appBusinessDel(@RequestBody IdDTO idDTO) {
//查询列表数据
if (StrUtil.isBlank(getCurrentUserId())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
UserDTO userDTO = getBusinessUserByAppUser();
AssertUtils.isBlank(userDTO);
baseBiz.updateByWeekendSelective(new ShuntApply(){{
setIsBizdel(SYS_TRUE);
}}, w -> {
w.andEqualTo(ShuntApply::getId, idDTO.getApplyId())
.andEqualTo(ShuntApply::getConfirmUserId, userDTO.getId());
return w;
});
return ObjectRestResponse.succ();
}
@RequestMapping(value = "/appBusiness/list", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据城市查询待确认申请列表")
......@@ -377,6 +439,10 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
return ObjectRestResponse.succ(pages);
}
@Data
public static class IdDTO {
Integer applyId;
}
@Data
public static class ConfirmApplyDTO {
......
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